@splinetool/runtime 0.9.40 → 0.9.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/runtime.js +1 -1
- package/package.json +1 -1
package/build/runtime.js
CHANGED
|
@@ -2983,7 +2983,7 @@ void main() {
|
|
|
2983
2983
|
squared_mean = squared_mean / samples;
|
|
2984
2984
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
2985
2985
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
2986
|
-
}`;function gb(i,e,t){let r=new Pa,n=new N,s=new N,o=new Ke,a=new Jc({depthPacking:uE}),l=new Qc,c={},u=t.maxTextureSize,h={0:Cr,1:ni,2:ir},f=new St({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new N},radius:{value:4}},vertexShader:tP,fragmentShader:rP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Ie;p.setAttribute("position",new Ue(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Gt(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eb,this.render=function(b,S,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;let A=i.getRenderTarget(),x=i.getActiveCubeFace(),E=i.getActiveMipmapLevel(),_=i.state;_.setBlending(kt),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let C=0,P=b.length;C<P;C++){let B=b[C],R=B.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;n.copy(R.mapSize);let U=R.getFrameExtents();if(n.multiply(U),s.copy(R.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/U.x),n.x=s.x*U.x,R.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/U.y),n.y=s.y*U.y,R.mapSize.y=s.y)),R.map===null&&!R.isPointLightShadow&&this.type===Bc&&(R.map=new mt(n.x,n.y),R.map.texture.name=B.name+".shadowMap",R.mapPass=new mt(n.x,n.y),R.camera.updateProjectionMatrix()),R.map===null){let J={minFilter:lr,magFilter:lr,format:On};R.map=new mt(n.x,n.y,J),R.map.texture.name=B.name+".shadowMap",R.camera.updateProjectionMatrix()}i.setRenderTarget(R.map),i.clear();let z=R.getViewportCount();for(let J=0;J<z;J++){let Q=R.getViewport(J);o.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),_.viewport(o),R.updateMatrices(B,J),r=R.getFrustum(),w(S,T,R.camera,B,this.type)}!R.isPointLightShadow&&this.type===Bc&&v(R,T),R.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(A,x,E)};function v(b,S){let T=e.update(m);f.defines.VSM_SAMPLES!==b.blurSamples&&(f.defines.VSM_SAMPLES=b.blurSamples,d.defines.VSM_SAMPLES=b.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=b.map.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(S,null,T,f,m,null),d.uniforms.shadow_pass.value=b.mapPass.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(S,null,T,d,m,null)}function y(b,S,T,A,x,E){let _=null,C=T.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0?_=C:_=T.isPointLight===!0?l:a,i.localClippingEnabled&&S.clipShadows===!0&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){let P=_.uuid,B=S.uuid,R=c[P];R===void 0&&(R={},c[P]=R);let U=R[B];U===void 0&&(U=_.clone(),R[B]=U),_=U}return _.visible=S.visible,_.wireframe=S.wireframe,E===Bc?_.side=S.shadowSide!==null?S.shadowSide:S.side:_.side=S.shadowSide!==null?S.shadowSide:h[S.side],_.alphaMap=S.alphaMap,_.alphaTest=S.alphaTest,_.clipShadows=S.clipShadows,_.clippingPlanes=S.clippingPlanes,_.clipIntersection=S.clipIntersection,_.displacementMap=S.displacementMap,_.displacementScale=S.displacementScale,_.displacementBias=S.displacementBias,_.wireframeLinewidth=S.wireframeLinewidth,_.linewidth=S.linewidth,T.isPointLight===!0&&_.isMeshDistanceMaterial===!0&&(_.referencePosition.setFromMatrixPosition(T.matrixWorld),_.nearDistance=A,_.farDistance=x),_}function w(b,S,T,A,x){if(b.visible===!1)return;if(b.layers.test(S.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===Bc)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);let C=e.update(b),P=b.material;if(Array.isArray(P)){let B=C.groups;for(let R=0,U=B.length;R<U;R++){let z=B[R],J=P[z.materialIndex];if(J&&J.visible){let Q=y(b,J,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,Q,b,z)}}}else if(P.visible){let B=y(b,P,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,B,b,null)}}let _=b.children;for(let C=0,P=_.length;C<P;C++)w(_[C],S,T,A,x)}}function nP(i,e,t){let r=t.isWebGL2;function n(){let G=!1,Me=new Ke,Ce=null,Ze=new Ke(0,0,0,0);return{setMask:function(Oe){Ce!==Oe&&!G&&(i.colorMask(Oe,Oe,Oe,Oe),Ce=Oe)},setLocked:function(Oe){G=Oe},setClear:function(Oe,Qe,Ae,$e,at){at===!0&&(Oe*=$e,Qe*=$e,Ae*=$e),Me.set(Oe,Qe,Ae,$e),Ze.equals(Me)===!1&&(i.clearColor(Oe,Qe,Ae,$e),Ze.copy(Me))},reset:function(){G=!1,Ce=null,Ze.set(-1,0,0,0)}}}function s(){let G=!1,Me=null,Ce=null,Ze=null;return{setTest:function(Oe){Oe?K(2929):W(2929)},setMask:function(Oe){Me!==Oe&&!G&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(Ce!==Oe){if(Oe)switch(Oe){case PT:i.depthFunc(512);break;case IT:i.depthFunc(519);break;case RT:i.depthFunc(513);break;case $m:i.depthFunc(515);break;case BT:i.depthFunc(514);break;case NT:i.depthFunc(518);break;case OT:i.depthFunc(516);break;case FT:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);Ce=Oe}},setLocked:function(Oe){G=Oe},setClear:function(Oe){Ze!==Oe&&(i.clearDepth(Oe),Ze=Oe)},reset:function(){G=!1,Me=null,Ce=null,Ze=null}}}function o(){let G=!1,Me=null,Ce=null,Ze=null,Oe=null,Qe=null,Ae=null,$e=null,at=null;return{setTest:function(ft){G||(ft?K(2960):W(2960))},setMask:function(ft){Me!==ft&&!G&&(i.stencilMask(ft),Me=ft)},setFunc:function(ft,Ot,Nr){(Ce!==ft||Ze!==Ot||Oe!==Nr)&&(i.stencilFunc(ft,Ot,Nr),Ce=ft,Ze=Ot,Oe=Nr)},setOp:function(ft,Ot,Nr){(Qe!==ft||Ae!==Ot||$e!==Nr)&&(i.stencilOp(ft,Ot,Nr),Qe=ft,Ae=Ot,$e=Nr)},setLocked:function(ft){G=ft},setClear:function(ft){at!==ft&&(i.clearStencil(ft),at=ft)},reset:function(){G=!1,Me=null,Ce=null,Ze=null,Oe=null,Qe=null,Ae=null,$e=null,at=null}}}let a=new n,l=new s,c=new o,u={},h={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,P=null,B=i.getParameter(35661),R=!1,U=0,z=i.getParameter(7938);z.indexOf("WebGL")!==-1?(U=parseFloat(/^WebGL (\d)/.exec(z)[1]),R=U>=1):z.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),R=U>=2);let J=null,Q={},X=i.getParameter(3088),F=i.getParameter(2978),k=new Ke().fromArray(X),O=new Ke().fromArray(F);function j(G,Me,Ce){let Ze=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(G,Oe),i.texParameteri(G,10241,9728),i.texParameteri(G,10240,9728);for(let Qe=0;Qe<Ce;Qe++)i.texImage2D(Me+Qe,0,6408,1,1,0,6408,5121,Ze);return Oe}let q={};q[3553]=j(3553,3553,1),q[34067]=j(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc($m),$(!1),ce(mx),K(2884),Z(kt);function K(G){u[G]!==!0&&(i.enable(G),u[G]=!0)}function W(G){u[G]!==!1&&(i.disable(G),u[G]=!1)}function ge(G,Me){return h[G]!==Me?(i.bindFramebuffer(G,Me),h[G]=Me,r&&(G===36009&&(h[36160]=Me),G===36160&&(h[36009]=Me)),!0):!1}function oe(G,Me){let Ce=d,Ze=!1;if(G)if(Ce=f.get(Me),Ce===void 0&&(Ce=[],f.set(Me,Ce)),G.isWebGLMultipleRenderTargets){let Oe=G.texture;if(Ce.length!==Oe.length||Ce[0]!==36064){for(let Qe=0,Ae=Oe.length;Qe<Ae;Qe++)Ce[Qe]=36064+Qe;Ce.length=Oe.length,Ze=!0}}else Ce[0]!==36064&&(Ce[0]=36064,Ze=!0);else Ce[0]!==1029&&(Ce[0]=1029,Ze=!0);Ze&&(t.isWebGL2?i.drawBuffers(Ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ce))}function le(G){return p!==G?(i.useProgram(G),p=G,!0):!1}let H={[Sa]:32774,[bT]:32778,[wT]:32779};if(r)H[xx]=32775,H[bx]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(H[xx]=G.MIN_EXT,H[bx]=G.MAX_EXT)}let ue={[ST]:0,[MT]:1,[AT]:768,[rb]:770,[DT]:776,[CT]:774,[ET]:772,[TT]:769,[nb]:771,[LT]:775,[_T]:773};function Z(G,Me,Ce,Ze,Oe,Qe,Ae,$e){if(G===kt){m===!0&&(W(3042),m=!1);return}if(m===!1&&(K(3042),m=!0),G!==xT){if(G!==g||$e!==A){if((v!==Sa||b!==Sa)&&(i.blendEquation(32774),v=Sa,b=Sa),$e)switch(G){case Es:i.blendFuncSeparate(1,771,1,771);break;case gx:i.blendFunc(1,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Es:i.blendFuncSeparate(770,771,1,771);break;case gx:i.blendFunc(770,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}y=null,w=null,S=null,T=null,g=G,A=$e}return}Oe=Oe||Me,Qe=Qe||Ce,Ae=Ae||Ze,(Me!==v||Oe!==b)&&(i.blendEquationSeparate(H[Me],H[Oe]),v=Me,b=Oe),(Ce!==y||Ze!==w||Qe!==S||Ae!==T)&&(i.blendFuncSeparate(ue[Ce],ue[Ze],ue[Qe],ue[Ae]),y=Ce,w=Ze,S=Qe,T=Ae),g=G,A=null}function V(G,Me){G.side===ir?W(2884):K(2884);let Ce=G.side===Cr;Me&&(Ce=!Ce),$(Ce),G.blending===Es&&G.transparent===!1?Z(kt):Z(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let Ze=G.stencilWrite;c.setTest(Ze),Ze&&(c.setMask(G.stencilWriteMask),c.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),c.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),pe(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?K(32926):W(32926)}function $(G){x!==G&&(G?i.frontFace(2304):i.frontFace(2305),x=G)}function ce(G){G!==yT?(K(2884),G!==E&&(G===mx?i.cullFace(1029):G===vT?i.cullFace(1028):i.cullFace(1032))):W(2884),E=G}function ie(G){G!==_&&(R&&i.lineWidth(G),_=G)}function pe(G,Me,Ce){G?(K(32823),(C!==Me||P!==Ce)&&(i.polygonOffset(Me,Ce),C=Me,P=Ce)):W(32823)}function ve(G){G?K(3089):W(3089)}function me(G){G===void 0&&(G=33984+B-1),J!==G&&(i.activeTexture(G),J=G)}function De(G,Me){J===null&&me();let Ce=Q[J];Ce===void 0&&(Ce={type:void 0,texture:void 0},Q[J]=Ce),(Ce.type!==G||Ce.texture!==Me)&&(i.bindTexture(G,Me||q[G]),Ce.type=G,Ce.texture=Me)}function ke(){let G=Q[J];G!==void 0&&G.type!==void 0&&(i.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function I(){try{i.compressedTexImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function L(){try{i.texSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{i.texSubImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Pe(){try{i.texStorage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function he(){try{i.texImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function nt(G){k.equals(G)===!1&&(i.scissor(G.x,G.y,G.z,G.w),k.copy(G))}function st(G){O.equals(G)===!1&&(i.viewport(G.x,G.y,G.z,G.w),O.copy(G))}function Te(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),u={},J=null,Q={},h={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,P=null,k.set(0,0,i.canvas.width,i.canvas.height),O.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:W,bindFramebuffer:ge,drawBuffers:oe,useProgram:le,setBlending:Z,setMaterial:V,setFlipSided:$,setCullFace:ce,setLineWidth:ie,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:De,unbindTexture:ke,compressedTexImage2D:I,texImage2D:Fe,texImage3D:he,texStorage2D:Se,texStorage3D:Pe,texSubImage2D:L,texSubImage3D:te,compressedTexSubImage2D:ye,scissor:nt,viewport:st,reset:Te}}function iP(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,u=n.maxTextureSize,h=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(I,L){return v?new OffscreenCanvas(I,L):jc("canvas")}function w(I,L,te,ye){let Se=1;if((I.width>ye||I.height>ye)&&(Se=ye/Math.max(I.width,I.height)),Se<1||L===!0)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap){let Pe=L?df:Math.floor,Fe=Pe(Se*I.width),he=Pe(Se*I.height);m===void 0&&(m=y(Fe,he));let nt=te?y(Fe,he):m;return nt.width=Fe,nt.height=he,nt.getContext("2d").drawImage(I,0,0,Fe,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+I.width+"x"+I.height+") to ("+Fe+"x"+he+")."),nt}else return"data"in I&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+I.width+"x"+I.height+")."),I;return I}function b(I){return ig(I.width)&&ig(I.height)}function S(I){return a?!1:I.wrapS!==_r||I.wrapT!==_r||I.minFilter!==lr&&I.minFilter!==ut}function T(I,L){return I.generateMipmaps&&L&&I.minFilter!==lr&&I.minFilter!==ut}function A(I){i.generateMipmap(I)}function x(I,L,te,ye,Se=!1){if(a===!1)return L;if(I!==null){if(i[I]!==void 0)return i[I];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let Pe=L;return L===6403&&(te===5126&&(Pe=33326),te===5131&&(Pe=33325),te===5121&&(Pe=33321)),L===33319&&(te===5126&&(Pe=33328),te===5131&&(Pe=33327),te===5121&&(Pe=33323)),L===6408&&(te===5126&&(Pe=34836),te===5131&&(Pe=34842),te===5121&&(Pe=ye===je&&Se===!1?35907:32856),te===32819&&(Pe=32854),te===32820&&(Pe=32855)),(Pe===33325||Pe===33326||Pe===33327||Pe===33328||Pe===34842||Pe===34836)&&e.get("EXT_color_buffer_float"),Pe}function E(I,L,te){return T(I,te)===!0||I.isFramebufferTexture&&I.minFilter!==lr&&I.minFilter!==ut?Math.log2(Math.max(L.width,L.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?L.mipmaps.length:1}function _(I){return I===lr||I===wx||I===Sx?9728:9729}function C(I){let L=I.target;L.removeEventListener("dispose",C),B(L),L.isVideoTexture&&p.delete(L)}function P(I){let L=I.target;L.removeEventListener("dispose",P),U(L)}function B(I){let L=r.get(I);if(L.__webglInit===void 0)return;let te=I.source,ye=g.get(te);if(ye){let Se=ye[L.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&R(I),Object.keys(ye).length===0&&g.delete(te)}r.remove(I)}function R(I){let L=r.get(I);i.deleteTexture(L.__webglTexture);let te=I.source,ye=g.get(te);delete ye[L.__cacheKey],o.memory.textures--}function U(I){let L=I.texture,te=r.get(I),ye=r.get(L);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),I.depthTexture&&I.depthTexture.dispose(),I.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(te.__webglFramebuffer[Se]),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer[Se]);else i.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&i.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&i.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&i.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(I.isWebGLMultipleRenderTargets)for(let Se=0,Pe=L.length;Se<Pe;Se++){let Fe=r.get(L[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(L[Se])}r.remove(L),r.remove(I)}let z=0;function J(){z=0}function Q(){let I=z;return I>=l&&console.warn("THREE.WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+l),z+=1,I}function X(I){let L=[];return L.push(I.wrapS),L.push(I.wrapT),L.push(I.magFilter),L.push(I.minFilter),L.push(I.anisotropy),L.push(I.internalFormat),L.push(I.format),L.push(I.type),L.push(I.generateMipmaps),L.push(I.premultiplyAlpha),L.push(I.flipY),L.push(I.unpackAlignment),L.push(I.encoding),L.join()}function F(I,L){let te=r.get(I);if(I.isVideoTexture&&De(I),I.isRenderTargetTexture===!1&&I.version>0&&te.__version!==I.version){let ye=I.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(te,I,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,te.__webglTexture)}function k(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){oe(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(35866,te.__webglTexture)}function O(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){oe(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(32879,te.__webglTexture)}function j(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){le(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(34067,te.__webglTexture)}let q={[Ca]:10497,[_r]:33071,[rg]:33648},K={[lr]:9728,[wx]:9984,[Sx]:9986,[ut]:9729,[jT]:9985,[ks]:9987};function W(I,L,te){if(te?(i.texParameteri(I,10242,q[L.wrapS]),i.texParameteri(I,10243,q[L.wrapT]),(I===32879||I===35866)&&i.texParameteri(I,32882,q[L.wrapR]),i.texParameteri(I,10240,K[L.magFilter]),i.texParameteri(I,10241,K[L.minFilter])):(i.texParameteri(I,10242,33071),i.texParameteri(I,10243,33071),(I===32879||I===35866)&&i.texParameteri(I,32882,33071),(L.wrapS!==_r||L.wrapT!==_r)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(I,10240,_(L.magFilter)),i.texParameteri(I,10241,_(L.minFilter)),L.minFilter!==lr&&L.minFilter!==ut&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let ye=e.get("EXT_texture_filter_anisotropic");if(L.type===Ts&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===Vc&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(i.texParameterf(I,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function ge(I,L){let te=!1;I.__webglInit===void 0&&(I.__webglInit=!0,L.addEventListener("dispose",C));let ye=L.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Pe=X(L);if(Pe!==I.__cacheKey){Se[Pe]===void 0&&(Se[Pe]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,te=!0),Se[Pe].usedTimes++;let Fe=Se[I.__cacheKey];Fe!==void 0&&(Se[I.__cacheKey].usedTimes--,Fe.usedTimes===0&&R(L)),I.__cacheKey=Pe,I.__webglTexture=Se[Pe].texture}return te}function oe(I,L,te){let ye=3553;L.isDataArrayTexture&&(ye=35866),L.isData3DTexture&&(ye=32879);let Se=ge(I,L),Pe=L.source;if(t.activeTexture(33984+te),t.bindTexture(ye,I.__webglTexture),Pe.version!==Pe.__currentVersion||Se===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Fe=S(L)&&b(L.image)===!1,he=w(L.image,Fe,!1,u);he=ke(L,he);let nt=b(he)||a,st=s.convert(L.format,L.encoding),Te=s.convert(L.type),G=x(L.internalFormat,st,Te,L.encoding,L.isVideoTexture);W(ye,L,nt);let Me,Ce=L.mipmaps,Ze=a&&L.isVideoTexture!==!0,Oe=I.__version===void 0||Se===!0,Qe=E(L,he,nt);if(L.isDepthTexture)G=6402,a?L.type===Ts?G=36012:L.type===_a?G=33190:L.type===_s?G=35056:G=33189:L.type===Ts&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Mo&&G===6402&&L.type!==kc&&L.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=kc,Te=s.convert(L.type)),L.format===Ps&&G===6402&&(G=34041,L.type!==_s&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=_s,Te=s.convert(L.type))),Oe&&(Ze?t.texStorage2D(3553,1,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Te,null));else if(L.isDataTexture)if(Ce.length>0&&nt){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],Ze?t.texSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Te,Me.data):t.texImage2D(3553,Ae,G,Me.width,Me.height,0,st,Te,Me.data);L.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,he.width,he.height,st,Te,he.data)):t.texImage2D(3553,0,G,he.width,he.height,0,st,Te,he.data);else if(L.isCompressedTexture){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],L.format!==On?st!==null?Ze?t.compressedTexSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,Ae,G,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?t.texSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Te,Me.data):t.texImage2D(3553,Ae,G,Me.width,Me.height,0,st,Te,Me.data)}else if(L.isDataArrayTexture)Ze?(Oe&&t.texStorage3D(35866,Qe,G,he.width,he.height,he.depth),t.texSubImage3D(35866,0,0,0,0,he.width,he.height,he.depth,st,Te,he.data)):t.texImage3D(35866,0,G,he.width,he.height,he.depth,0,st,Te,he.data);else if(L.isData3DTexture)Ze?(Oe&&t.texStorage3D(32879,Qe,G,he.width,he.height,he.depth),t.texSubImage3D(32879,0,0,0,0,he.width,he.height,he.depth,st,Te,he.data)):t.texImage3D(32879,0,G,he.width,he.height,he.depth,0,st,Te,he.data);else if(L.isFramebufferTexture){if(Oe)if(Ze)t.texStorage2D(3553,Qe,G,he.width,he.height);else{let Ae=he.width,$e=he.height;for(let at=0;at<Qe;at++)t.texImage2D(3553,at,G,Ae,$e,0,st,Te,null),Ae>>=1,$e>>=1}}else if(Ce.length>0&&nt){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],Ze?t.texSubImage2D(3553,Ae,0,0,st,Te,Me):t.texImage2D(3553,Ae,G,st,Te,Me);L.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,st,Te,he)):t.texImage2D(3553,0,G,st,Te,he);T(L,nt)&&A(ye),Pe.__currentVersion=Pe.version,L.onUpdate&&L.onUpdate(L)}I.__version=L.version}function le(I,L,te){if(L.image.length!==6)return;let ye=ge(I,L),Se=L.source;if(t.activeTexture(33984+te),t.bindTexture(34067,I.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Pe=L.isCompressedTexture||L.image[0].isCompressedTexture,Fe=L.image[0]&&L.image[0].isDataTexture,he=[];for(let Ae=0;Ae<6;Ae++)!Pe&&!Fe?he[Ae]=w(L.image[Ae],!1,!0,c):he[Ae]=Fe?L.image[Ae].image:L.image[Ae],he[Ae]=ke(L,he[Ae]);let nt=he[0],st=b(nt)||a,Te=s.convert(L.format,L.encoding),G=s.convert(L.type),Me=x(L.internalFormat,Te,G,L.encoding),Ce=a&&L.isVideoTexture!==!0,Ze=I.__version===void 0,Oe=E(L,nt,st);W(34067,L,st);let Qe;if(Pe){Ce&&Ze&&t.texStorage2D(34067,Oe,Me,nt.width,nt.height);for(let Ae=0;Ae<6;Ae++){Qe=he[Ae].mipmaps;for(let $e=0;$e<Qe.length;$e++){let at=Qe[$e];L.format!==On?Te!==null?Ce?t.compressedTexSubImage2D(34069+Ae,$e,0,0,at.width,at.height,Te,at.data):t.compressedTexImage2D(34069+Ae,$e,Me,at.width,at.height,0,at.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ce?t.texSubImage2D(34069+Ae,$e,0,0,at.width,at.height,Te,G,at.data):t.texImage2D(34069+Ae,$e,Me,at.width,at.height,0,Te,G,at.data)}}}else{Qe=L.mipmaps,Ce&&Ze&&(Qe.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,he[0].width,he[0].height));for(let Ae=0;Ae<6;Ae++)if(Fe){Ce?t.texSubImage2D(34069+Ae,0,0,0,he[Ae].width,he[Ae].height,Te,G,he[Ae].data):t.texImage2D(34069+Ae,0,Me,he[Ae].width,he[Ae].height,0,Te,G,he[Ae].data);for(let $e=0;$e<Qe.length;$e++){let ft=Qe[$e].image[Ae].image;Ce?t.texSubImage2D(34069+Ae,$e+1,0,0,ft.width,ft.height,Te,G,ft.data):t.texImage2D(34069+Ae,$e+1,Me,ft.width,ft.height,0,Te,G,ft.data)}}else{Ce?t.texSubImage2D(34069+Ae,0,0,0,Te,G,he[Ae]):t.texImage2D(34069+Ae,0,Me,Te,G,he[Ae]);for(let $e=0;$e<Qe.length;$e++){let at=Qe[$e];Ce?t.texSubImage2D(34069+Ae,$e+1,0,0,Te,G,at.image[Ae]):t.texImage2D(34069+Ae,$e+1,Me,Te,G,at.image[Ae])}}}T(L,st)&&A(34067),Se.__currentVersion=Se.version,L.onUpdate&&L.onUpdate(L)}I.__version=L.version}function H(I,L,te,ye,Se){let Pe=s.convert(te.format,te.encoding),Fe=s.convert(te.type),he=x(te.internalFormat,Pe,Fe,te.encoding);r.get(L).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,he,L.width,L.height,L.depth,0,Pe,Fe,null):t.texImage2D(Se,0,he,L.width,L.height,0,Pe,Fe,null)),t.bindFramebuffer(36160,I),me(L)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(te).__webglTexture,0,ve(L)):i.framebufferTexture2D(36160,ye,Se,r.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ue(I,L,te){if(i.bindRenderbuffer(36161,I),L.depthBuffer&&!L.stencilBuffer){let ye=33189;if(te||me(L)){let Se=L.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ts?ye=36012:Se.type===_a&&(ye=33190));let Pe=ve(L);me(L)?f.renderbufferStorageMultisampleEXT(36161,Pe,ye,L.width,L.height):i.renderbufferStorageMultisample(36161,Pe,ye,L.width,L.height)}else i.renderbufferStorage(36161,ye,L.width,L.height);i.framebufferRenderbuffer(36160,36096,36161,I)}else if(L.depthBuffer&&L.stencilBuffer){let ye=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,L.width,L.height):i.renderbufferStorage(36161,34041,L.width,L.height),i.framebufferRenderbuffer(36160,33306,36161,I)}else{let ye=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,Se=s.convert(ye.format,ye.encoding),Pe=s.convert(ye.type),Fe=x(ye.internalFormat,Se,Pe,ye.encoding),he=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,he,Fe,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,he,Fe,L.width,L.height):i.renderbufferStorage(36161,Fe,L.width,L.height)}i.bindRenderbuffer(36161,null)}function Z(I,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,I),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),F(L.depthTexture,0);let ye=r.get(L.depthTexture).__webglTexture,Se=ve(L);if(L.depthTexture.format===Mo)me(L)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(L.depthTexture.format===Ps)me(L)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function V(I){let L=r.get(I),te=I.isWebGLCubeRenderTarget===!0;if(I.depthTexture&&!L.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");Z(L.__webglFramebuffer,I)}else if(te){L.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,L.__webglFramebuffer[ye]),L.__webglDepthbuffer[ye]=i.createRenderbuffer(),ue(L.__webglDepthbuffer[ye],I,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=i.createRenderbuffer(),ue(L.__webglDepthbuffer,I,!1);t.bindFramebuffer(36160,null)}function $(I,L,te){let ye=r.get(I);L!==void 0&&H(ye.__webglFramebuffer,I,I.texture,36064,3553),te!==void 0&&V(I)}function ce(I){let L=I.texture,te=r.get(I),ye=r.get(L);I.addEventListener("dispose",P),I.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=L.version,o.memory.textures++);let Se=I.isWebGLCubeRenderTarget===!0,Pe=I.isWebGLMultipleRenderTargets===!0,Fe=b(I)||a;if(Se){te.__webglFramebuffer=[];for(let he=0;he<6;he++)te.__webglFramebuffer[he]=i.createFramebuffer()}else if(te.__webglFramebuffer=i.createFramebuffer(),Pe)if(n.drawBuffers){let he=I.texture;for(let nt=0,st=he.length;nt<st;nt++){let Te=r.get(he[nt]);Te.__webglTexture===void 0&&(Te.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&I.samples>0&&me(I)===!1){te.__webglMultisampledFramebuffer=i.createFramebuffer(),te.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let he=s.convert(L.format,L.encoding),nt=s.convert(L.type),st=x(L.internalFormat,he,nt,L.encoding),Te=ve(I);i.renderbufferStorageMultisample(36161,Te,st,I.width,I.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),I.depthBuffer&&(te.__webglDepthRenderbuffer=i.createRenderbuffer(),ue(te.__webglDepthRenderbuffer,I,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),W(34067,L,Fe);for(let he=0;he<6;he++)H(te.__webglFramebuffer[he],I,L,36064,34069+he);T(L,Fe)&&A(34067),t.unbindTexture()}else if(Pe){let he=I.texture;for(let nt=0,st=he.length;nt<st;nt++){let Te=he[nt],G=r.get(Te);t.bindTexture(3553,G.__webglTexture),W(3553,Te,Fe),H(te.__webglFramebuffer,I,Te,36064+nt,3553),T(Te,Fe)&&A(3553)}t.unbindTexture()}else{let he=3553;(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(a?he=I.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(he,ye.__webglTexture),W(he,L,Fe),H(te.__webglFramebuffer,I,L,36064,he),T(L,Fe)&&A(he),t.unbindTexture()}I.depthBuffer&&V(I)}function ie(I){let L=b(I)||a,te=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let ye=0,Se=te.length;ye<Se;ye++){let Pe=te[ye];if(T(Pe,L)){let Fe=I.isWebGLCubeRenderTarget?34067:3553,he=r.get(Pe).__webglTexture;t.bindTexture(Fe,he),A(Fe),t.unbindTexture()}}}function pe(I){if(a&&I.samples>0&&me(I)===!1){let L=I.width,te=I.height,ye=16384,Se=[36064],Pe=I.stencilBuffer?33306:36096;I.depthBuffer&&Se.push(Pe);let Fe=r.get(I),he=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;he===!1&&(I.depthBuffer&&(ye|=256),I.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),he===!0&&(i.invalidateFramebuffer(36008,[Pe]),i.invalidateFramebuffer(36009,[Pe])),i.blitFramebuffer(0,0,L,te,0,0,L,te,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(I){return Math.min(h,I.samples)}function me(I){let L=r.get(I);return a&&I.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function De(I){let L=o.render.frame;p.get(I)!==L&&(p.set(I,L),I.update())}function ke(I,L){let te=I.encoding,ye=I.format,Se=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||I.format===ng||te!==dn&&(te===je?a===!1?e.has("EXT_sRGB")===!0&&ye===On?(I.format=ng,I.minFilter=ut,I.generateMipmaps=!1):L=es.sRGBToLinear(L):(ye!==On||Se!==Wt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),L}this.allocateTextureUnit=Q,this.resetTextureUnits=J,this.setTexture2D=F,this.setTexture2DArray=k,this.setTexture3D=O,this.setTextureCube=j,this.rebindTextures=$,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ie,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=me}function sP(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===Wt)return 5121;if(s===JT)return 32819;if(s===QT)return 32820;if(s===qT)return 5120;if(s===YT)return 5122;if(s===kc)return 5123;if(s===XT)return 5124;if(s===_a)return 5125;if(s===Ts)return 5126;if(s===Vc)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===KT)return 6406;if(s===On)return 6408;if(s===$T)return 6409;if(s===eE)return 6410;if(s===Mo)return 6402;if(s===Ps)return 34041;if(s===tE)return 6403;if(s===ZT)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===rE)return 36244;if(s===nE)return 33319;if(s===iE)return 33320;if(s===sE)return 36249;if(s===mm||s===gm||s===ym||s===vm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===mm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===mm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Mx||s===Ax||s===Tx||s===Ex)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Mx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ax)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Tx)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Ex)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===oE)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===_x||s===Cx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===_x)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Cx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Lx||s===Dx||s===Px||s===Ix||s===Rx||s===Bx||s===Nx||s===Ox||s===Fx||s===Ux||s===zx||s===Gx||s===kx||s===Vx)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Lx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Px)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ix)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Rx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Nx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Ox)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Fx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Hx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Hx)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===_s?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:n}}var vf=class extends nr{constructor(e=[]){super(),this.cameras=e}};vf.prototype.isArrayCamera=!0;var Zi=class extends ot{constructor(){super(),this.type="Group"}};Zi.prototype.isGroup=!0;var oP={type:"move"},Uc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Zi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(oP))),c&&e.hand){o=!0;for(let m of e.hand.values()){let g=t.getJointPose(m,r);if(c.joints[m.jointName]===void 0){let y=new Zi;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}let v=c.joints[m.jointName];g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=g.radius),v.visible=g!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},si=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){if(u=u!==void 0?u:Mo,u!==Mo&&u!==Ps)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Mo&&(r=kc),r===void 0&&u===Ps&&(r=_s),super(null,n,s,o,a,l,u,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lr,this.minFilter=l!==void 0?l:lr,this.flipY=!1,this.generateMipmaps=!1}};si.prototype.isDepthTexture=!0;var fg=class extends jt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,f=null,d=null,p=t.getContextAttributes(),m=null,g=null,v=[],y=new Map,w=new nr;w.layers.enable(1),w.viewport=new Ke;let b=new nr;b.layers.enable(2),b.viewport=new Ke;let S=[w,b],T=new vf;T.layers.enable(1),T.layers.enable(2);let A=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getTargetRaySpace()},this.getControllerGrip=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getGripSpace()},this.getHand=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getHandSpace()};function E(X){let F=y.get(X.inputSource);F&&F.dispatchEvent({type:X.type,data:X.inputSource})}function _(){y.forEach(function(X,F){X.disconnect(F)}),y.clear(),A=null,x=null,e.setRenderTarget(m),f=null,h=null,u=null,n=null,g=null,Q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(X){l=X},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=async function(X){if(n=X,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",E),n.addEventListener("selectstart",E),n.addEventListener("selectend",E),n.addEventListener("squeeze",E),n.addEventListener("squeezestart",E),n.addEventListener("squeezeend",E),n.addEventListener("end",_),n.addEventListener("inputsourceschange",C),p.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let F={antialias:n.renderState.layers===void 0?p.antialias:!0,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(n,t,F),n.updateRenderState({baseLayer:f}),g=new mt(f.framebufferWidth,f.framebufferHeight,{format:On,type:Wt,encoding:e.outputEncoding})}else{let F=null,k=null,O=null;p.depth&&(O=p.stencil?35056:33190,F=p.stencil?Ps:Mo,k=p.stencil?_s:kc);let j={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:O,scaleFactor:s};u=new XRWebGLBinding(n,t),h=u.createProjectionLayer(j),n.updateRenderState({layers:[h]}),g=new mt(h.textureWidth,h.textureHeight,{format:On,type:Wt,depthTexture:new si(h.textureWidth,h.textureHeight,k,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});let q=e.properties.get(g);q.__ignoreDepthValues=h.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),Q.setContext(n),Q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(X){let F=n.inputSources;for(let k=0;k<F.length;k++){let O=F[k].handedness==="right"?1:0;y.set(F[k],v[O])}for(let k=0;k<X.removed.length;k++){let O=X.removed[k],j=y.get(O);j&&(j.dispatchEvent({type:"disconnected",data:O}),y.delete(O))}for(let k=0;k<X.added.length;k++){let O=X.added[k],j=y.get(O);j&&j.dispatchEvent({type:"connected",data:O})}}let P=new M,B=new M;function R(X,F,k){P.setFromMatrixPosition(F.matrixWorld),B.setFromMatrixPosition(k.matrixWorld);let O=P.distanceTo(B),j=F.projectionMatrix.elements,q=k.projectionMatrix.elements,K=j[14]/(j[10]-1),W=j[14]/(j[10]+1),ge=(j[9]+1)/j[5],oe=(j[9]-1)/j[5],le=(j[8]-1)/j[0],H=(q[8]+1)/q[0],ue=K*le,Z=K*H,V=O/(-le+H),$=V*-le;F.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX($),X.translateZ(V),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert();let ce=K+V,ie=W+V,pe=ue-$,ve=Z+(O-$),me=ge*W/ie*ce,De=oe*W/ie*ce;X.projectionMatrix.makePerspective(pe,ve,me,De,ce,ie)}function U(X,F){F===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(F.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(n===null)return;T.near=b.near=w.near=X.near,T.far=b.far=w.far=X.far,(A!==T.near||x!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,x=T.far);let F=X.parent,k=T.cameras;U(T,F);for(let j=0;j<k.length;j++)U(k[j],F);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),X.position.copy(T.position),X.quaternion.copy(T.quaternion),X.scale.copy(T.scale),X.matrix.copy(T.matrix),X.matrixWorld.copy(T.matrixWorld);let O=X.children;for(let j=0,q=O.length;j<q;j++)O[j].updateMatrixWorld(!0);k.length===2?R(T,w,b):T.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(X){h!==null&&(h.fixedFoveation=X),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=X)};let z=null;function J(X,F){if(c=F.getViewerPose(l||o),d=F,c!==null){let O=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let j=!1;O.length!==T.cameras.length&&(T.cameras.length=0,j=!0);for(let q=0;q<O.length;q++){let K=O[q],W=null;if(f!==null)W=f.getViewport(K);else{let oe=u.getViewSubImage(h,K);W=oe.viewport,q===0&&(e.setRenderTargetTextures(g,oe.colorTexture,h.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(g))}let ge=S[q];ge.matrix.fromArray(K.transform.matrix),ge.projectionMatrix.fromArray(K.projectionMatrix),ge.viewport.set(W.x,W.y,W.width,W.height),q===0&&T.matrix.copy(ge.matrix),j===!0&&T.cameras.push(ge)}}let k=n.inputSources;for(let O=0;O<v.length;O++){let j=k[O],q=y.get(j);q!==void 0&&q.update(j,F,l||o)}z&&z(X,F),d=null}let Q=new cb;Q.setAnimationLoop(J),this.setAnimationLoop=function(X){z=X},this.dispose=function(){}}};function aP(i,e){function t(m,g){m.fogColor.value.copy(g.color),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,v,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(m,g):g.isMeshToonMaterial?(n(m,g),u(m,g)):g.isMeshPhongMaterial?(n(m,g),c(m,g)):g.isMeshStandardMaterial?(n(m,g),h(m,g),g.isMeshPhysicalMaterial&&f(m,g,w)):g.isMeshMatcapMaterial?(n(m,g),d(m,g)):g.isMeshDepthMaterial?n(m,g):g.isMeshDistanceMaterial?(n(m,g),p(m,g)):g.isMeshNormalMaterial?n(m,g):g.isLineBasicMaterial?(s(m,g),g.isLineDashedMaterial&&o(m,g)):g.isPointsMaterial?a(m,g,v,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===Cr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===Cr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v=e.get(g).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;let b=i.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*b}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uv2Transform.value.copy(w.matrix))}function s(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function o(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function a(m,g,v,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uvTransform.value.copy(w.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v;g.map?v=g.map:g.alphaMap&&(v=g.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function c(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function u(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function h(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,v){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Cr&&m.clearcoatNormalScale.value.negate())),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function d(m,g){g.matcap&&(m.matcap.value=g.matcap)}function p(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function lP(){let i=jc("canvas");return i.style.display="block",i}function Ct(i={}){let e=i.canvas!==void 0?i.canvas:lP(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,u;t!==null?u=t.getContextAttributes().alpha:u=i.alpha!==void 0?i.alpha:!1;let h=null,f=null,d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=dn,this.physicallyCorrectLights=!1,this.toneMapping=$i,this.toneMappingExposure=1;let m=this,g=!1,v=0,y=0,w=null,b=-1,S=null,T=new Ke,A=new Ke,x=null,E=e.width,_=e.height,C=1,P=null,B=null,R=new Ke(0,0,E,_),U=new Ke(0,0,E,_),z=!1,J=new Pa,Q=!1,X=!1,F=null,k=new _e,O=new N,j=new M,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function K(){return w===null?C:1}let W=t;function ge(D,Y){for(let ne=0;ne<D.length;ne++){let re=D[ne],fe=e.getContext(re,Y);if(fe!==null)return fe}return null}try{let D={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${No}`),e.addEventListener("webglcontextlost",G,!1),e.addEventListener("webglcontextrestored",Me,!1),W===null){let Y=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&Y.shift(),W=ge(Y,D),W===null)throw ge(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let oe,le,H,ue,Z,V,$,ce,ie,pe,ve,me,De,ke,I,L,te,ye,Se,Pe,Fe,he,nt;function st(){oe=new CL(W),le=new SL(W,oe,i),oe.init(le),he=new sP(W,oe,le),H=new nP(W,oe,le),ue=new PL(W),Z=new qD,V=new iP(W,oe,H,Z,le,he,ue),$=new AL(m),ce=new _L(m),ie=new jE(W,le),nt=new bL(W,oe,ie,le),pe=new LL(W,ie,ue,nt),ve=new NL(W,pe,ie,ue),Se=new BL(W,le,V),L=new ML(Z),me=new jD(m,$,ce,oe,le,nt,L),De=new aP(m,Z),ke=new XD,I=new eP(oe,le),ye=new xL(m,$,H,ve,u,o),te=new gb(m,ve,le),Pe=new wL(W,oe,ue,le),Fe=new DL(W,oe,ue,le),ue.programs=me.programs,m.capabilities=le,m.extensions=oe,m.properties=Z,m.renderLists=ke,m.shadowMap=te,m.state=H,m.info=ue}st();let Te=new fg(m,W);this.xr=Te,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let D=oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){let D=oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(D){D!==void 0&&(C=D,this.setSize(E,_,!1))},this.getSize=function(D){return D.set(E,_)},this.setSize=function(D,Y,ne){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=D,_=Y,e.width=Math.floor(D*C),e.height=Math.floor(Y*C),ne!==!1&&(e.style.width=D+"px",e.style.height=Y+"px"),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(E*C,_*C).floor()},this.setDrawingBufferSize=function(D,Y,ne){E=D,_=Y,C=ne,e.width=Math.floor(D*ne),e.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.getCurrentViewport=function(D){return D.copy(T)},this.getViewport=function(D){return D.copy(R)},this.setViewport=function(D,Y,ne,re){D.isVector4?R.set(D.x,D.y,D.z,D.w):R.set(D,Y,ne,re),H.viewport(T.copy(R).multiplyScalar(C).floor())},this.getScissor=function(D){return D.copy(U)},this.setScissor=function(D,Y,ne,re){D.isVector4?U.set(D.x,D.y,D.z,D.w):U.set(D,Y,ne,re),H.scissor(A.copy(U).multiplyScalar(C).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(D){H.setScissorTest(z=D)},this.setOpaqueSort=function(D){P=D},this.setTransparentSort=function(D){B=D},this.getClearColor=function(D){return D.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(D=!0,Y=!0,ne=!0){let re=0;D&&(re|=16384),Y&&(re|=256),ne&&(re|=1024),W.clear(re)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",G,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),I.dispose(),Z.dispose(),$.dispose(),ce.dispose(),ve.dispose(),nt.dispose(),me.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",$e),Te.removeEventListener("sessionend",at),F&&(F.dispose(),F=null),ft.stop()};function G(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let D=ue.autoReset,Y=te.enabled,ne=te.autoUpdate,re=te.needsUpdate,fe=te.type;st(),ue.autoReset=D,te.enabled=Y,te.autoUpdate=ne,te.needsUpdate=re,te.type=fe}function Ce(D){let Y=D.target;Y.removeEventListener("dispose",Ce),Ze(Y)}function Ze(D){Oe(D),Z.remove(D)}function Oe(D){let Y=Z.get(D).programs;Y!==void 0&&(Y.forEach(function(ne){me.releaseProgram(ne)}),D.isShaderMaterial&&me.releaseShaderCache(D))}this.renderBufferDirect=function(D,Y,ne,re,fe,Ve){Y===null&&(Y=q);let et=fe.isMesh&&fe.matrixWorld.determinant()<0,it=vt(D,Y,ne,re,fe);H.setMaterial(re,et);let ct=ne.index,Bt=ne.attributes.position;if(ct===null){if(Bt===void 0||Bt.count===0)return}else if(ct.count===0)return;let wt=1;re.wireframe===!0&&(ct=pe.getWireframeAttribute(ne),wt=2),nt.setup(fe,re,it,ne,ct);let Tt,tr=Pe;ct!==null&&(Tt=ie.get(ct),tr=Fe,tr.setIndex(Tt));let go=ct!==null?ct.count:Bt.count,ta=ne.drawRange.start*wt,ra=ne.drawRange.count*wt,vi=Ve!==null?Ve.start*wt:0,Dt=Ve!==null?Ve.count*wt:1/0,na=Math.max(ta,vi),mr=Math.min(go,ta+ra,vi+Dt)-1,xi=Math.max(0,mr-na+1);if(xi!==0){if(fe.isMesh)re.wireframe===!0?(H.setLineWidth(re.wireframeLinewidth*K()),tr.setMode(1)):tr.setMode(4);else if(fe.isLine){let gs=re.linewidth;gs===void 0&&(gs=1),H.setLineWidth(gs*K()),fe.isLineSegments?tr.setMode(1):fe.isLineLoop?tr.setMode(2):tr.setMode(3)}else fe.isPoints?tr.setMode(0):fe.isSprite&&tr.setMode(4);if(fe.isInstancedMesh)tr.renderInstances(na,xi,fe.count);else if(ne.isInstancedBufferGeometry){let gs=Math.min(ne.instanceCount,ne._maxInstanceCount);tr.renderInstances(na,xi,gs)}else tr.render(na,xi)}},this.compile=function(D,Y){f=I.get(D),f.init(),p.push(f),D.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Y.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(m.physicallyCorrectLights),D.traverse(function(ne){let re=ne.material;if(re)if(Array.isArray(re))for(let fe=0;fe<re.length;fe++){let Ve=re[fe];lt(Ve,D,ne)}else lt(re,D,ne)}),p.pop(),f=null};let Qe=null;function Ae(D){Qe&&Qe(D)}function $e(){ft.stop()}function at(){ft.start()}let ft=new cb;ft.setAnimationLoop(Ae),typeof self<"u"&&ft.setContext(self),this.setAnimationLoop=function(D){Qe=D,Te.setAnimationLoop(D),D===null?ft.stop():ft.start()},Te.addEventListener("sessionstart",$e),Te.addEventListener("sessionend",at),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;D.autoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(Y),Y=Te.getCamera()),D.isScene===!0&&D.onBeforeRender(m,D,Y,w),f=I.get(D,p.length),f.init(),p.push(f),k.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),J.setFromProjectionMatrix(k),X=this.localClippingEnabled,Q=L.init(this.clippingPlanes,X,Y),h=ke.get(D,d.length),h.init(),d.push(h),Ot(D,Y,0,m.sortObjects),h.finish(),m.sortObjects===!0&&h.sort(P,B),Q===!0&&L.beginShadows();let ne=f.state.shadowsArray;if(te.render(ne,D,Y),Q===!0&&L.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(h,D),f.setupLights(m.physicallyCorrectLights),Y.isArrayCamera){let re=Y.cameras;for(let fe=0,Ve=re.length;fe<Ve;fe++){let et=re[fe];Nr(h,D,et,et.viewport)}}else Nr(h,D,Y);w!==null&&(V.updateMultisampleRenderTarget(w),V.updateRenderTargetMipmap(w)),D.isScene===!0&&D.onAfterRender(m,D,Y),nt.resetDefaultState(),b=-1,S=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Ot(D,Y,ne,re){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)f.pushLight(D),D.castShadow&&f.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||J.intersectsSprite(D)){re&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(k);let et=ve.update(D),it=D.material;it.visible&&h.push(D,et,it,ne,j.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.frame!==ue.render.frame&&(D.skeleton.update(),D.skeleton.frame=ue.render.frame),!D.frustumCulled||J.intersectsObject(D))){re&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(k);let et=ve.update(D),it=D.material;if(Array.isArray(it)){let ct=et.groups;for(let Bt=0,wt=ct.length;Bt<wt;Bt++){let Tt=ct[Bt],tr=it[Tt.materialIndex];tr&&tr.visible&&h.push(D,et,tr,ne,j.z,Tt)}}else it.visible&&h.push(D,et,it,ne,j.z,null)}}let Ve=D.children;for(let et=0,it=Ve.length;et<it;et++)Ot(Ve[et],Y,ne,re)}function Nr(D,Y,ne,re){let fe=D.opaque,Ve=D.transmissive,et=D.transparent;f.setupLightsView(ne),Ve.length>0&&ea(fe,Y,ne),re&&H.viewport(T.copy(re)),fe.length>0&&We(fe,Y,ne),Ve.length>0&&We(Ve,Y,ne),et.length>0&&We(et,Y,ne),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function ea(D,Y,ne){let re=le.isWebGL2;F===null&&(F=new mt(1,1,{generateMipmaps:!0,type:oe.has("EXT_color_buffer_half_float")?Vc:Wt,minFilter:ks,samples:re&&s===!0?4:0})),m.getDrawingBufferSize(O),re?F.setSize(O.x,O.y):F.setSize(df(O.x),df(O.y));let fe=m.getRenderTarget();m.setRenderTarget(F),m.clear();let Ve=m.toneMapping;m.toneMapping=$i,We(D,Y,ne),m.toneMapping=Ve,V.updateMultisampleRenderTarget(F),V.updateRenderTargetMipmap(F),m.setRenderTarget(fe)}function We(D,Y,ne){let re=Y.isScene===!0?Y.overrideMaterial:null;for(let fe=0,Ve=D.length;fe<Ve;fe++){let et=D[fe],it=et.object,ct=et.geometry,Bt=re===null?et.material:re,wt=et.group;it.layers.test(ne.layers)&&pt(it,Y,ne,ct,Bt,wt)}}function pt(D,Y,ne,re,fe,Ve){D.onBeforeRender(m,Y,ne,re,fe,Ve),D.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),fe.onBeforeRender(m,Y,ne,re,D,Ve),fe.transparent===!0&&fe.side===ir?(fe.side=Cr,fe.needsUpdate=!0,m.renderBufferDirect(ne,Y,re,fe,D,Ve),fe.side=ni,fe.needsUpdate=!0,m.renderBufferDirect(ne,Y,re,fe,D,Ve),fe.side=ir):m.renderBufferDirect(ne,Y,re,fe,D,Ve),D.onAfterRender(m,Y,ne,re,fe,Ve)}function lt(D,Y,ne){Y.isScene!==!0&&(Y=q);let re=Z.get(D),fe=f.state.lights,Ve=f.state.shadowsArray,et=fe.state.version,it=me.getParameters(D,fe.state,Ve,Y,ne),ct=me.getProgramCacheKey(it),Bt=re.programs;re.environment=D.isMeshStandardMaterial?Y.environment:null,re.fog=Y.fog,re.envMap=(D.isMeshStandardMaterial?ce:$).get(D.envMap||re.environment),Bt===void 0&&(D.addEventListener("dispose",Ce),Bt=new Map,re.programs=Bt);let wt=Bt.get(ct);if(wt!==void 0){if(re.currentProgram===wt&&re.lightsStateVersion===et)return ht(D,it),wt}else it.uniforms=me.getUniforms(D),D.onBuild(ne,it,m),D.onBeforeCompile(it,m),wt=me.acquireProgram(it,ct),Bt.set(ct,wt),re.uniforms=it.uniforms;let Tt=re.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Tt.clippingPlanes=L.uniform),ht(D,it),re.needsLights=Ft(D),re.lightsStateVersion=et,re.needsLights&&(Tt.ambientLightColor.value=fe.state.ambient,Tt.lightProbe.value=fe.state.probe,Tt.directionalLights.value=fe.state.directional,Tt.directionalLightShadows.value=fe.state.directionalShadow,Tt.spotLights.value=fe.state.spot,Tt.spotLightShadows.value=fe.state.spotShadow,Tt.rectAreaLights.value=fe.state.rectArea,Tt.ltc_1.value=fe.state.rectAreaLTC1,Tt.ltc_2.value=fe.state.rectAreaLTC2,Tt.pointLights.value=fe.state.point,Tt.pointLightShadows.value=fe.state.pointShadow,Tt.hemisphereLights.value=fe.state.hemi,Tt.directionalShadowMap.value=fe.state.directionalShadowMap,Tt.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,Tt.spotShadowMap.value=fe.state.spotShadowMap,Tt.spotShadowMatrix.value=fe.state.spotShadowMatrix,Tt.pointShadowMap.value=fe.state.pointShadowMap,Tt.pointShadowMatrix.value=fe.state.pointShadowMatrix);let tr=wt.getUniforms(),go=Cs.seqWithValue(tr.seq,Tt);return re.currentProgram=wt,re.uniformsList=go,wt}function ht(D,Y){let ne=Z.get(D);ne.outputEncoding=Y.outputEncoding,ne.instancing=Y.instancing,ne.skinning=Y.skinning,ne.morphTargets=Y.morphTargets,ne.morphNormals=Y.morphNormals,ne.morphColors=Y.morphColors,ne.morphTargetsCount=Y.morphTargetsCount,ne.numClippingPlanes=Y.numClippingPlanes,ne.numIntersection=Y.numClipIntersection,ne.vertexAlphas=Y.vertexAlphas,ne.vertexTangents=Y.vertexTangents,ne.toneMapping=Y.toneMapping}function vt(D,Y,ne,re,fe){Y.isScene!==!0&&(Y=q),V.resetTextureUnits();let Ve=Y.fog,et=re.isMeshStandardMaterial?Y.environment:null,it=w===null?m.outputEncoding:w.isXRRenderTarget===!0?w.texture.encoding:dn,ct=(re.isMeshStandardMaterial?ce:$).get(re.envMap||et),Bt=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,wt=!!re.normalMap&&!!ne.attributes.tangent,Tt=!!ne.morphAttributes.position,tr=!!ne.morphAttributes.normal,go=!!ne.morphAttributes.color,ta=re.toneMapped?m.toneMapping:$i,ra=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,vi=ra!==void 0?ra.length:0,Dt=Z.get(re),na=f.state.lights;if(Q===!0&&(X===!0||D!==S)){let bi=D===S&&re.id===b;L.setState(re,D,bi)}let mr=!1;re.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==na.state.version||Dt.outputEncoding!==it||fe.isInstancedMesh&&Dt.instancing===!1||!fe.isInstancedMesh&&Dt.instancing===!0||fe.isSkinnedMesh&&Dt.skinning===!1||!fe.isSkinnedMesh&&Dt.skinning===!0||Dt.envMap!==ct||re.fog===!0&&Dt.fog!==Ve||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==L.numPlanes||Dt.numIntersection!==L.numIntersection)||Dt.vertexAlphas!==Bt||Dt.vertexTangents!==wt||Dt.morphTargets!==Tt||Dt.morphNormals!==tr||Dt.morphColors!==go||Dt.toneMapping!==ta||le.isWebGL2===!0&&Dt.morphTargetsCount!==vi)&&(mr=!0):(mr=!0,Dt.__version=re.version);let xi=Dt.currentProgram;mr===!0&&(xi=lt(re,Y,fe));let gs=!1,Ac=!1,fm=!1,Zr=xi.getUniforms(),Tc=Dt.uniforms;if(H.useProgram(xi.program)&&(gs=!0,Ac=!0,fm=!0),re.id!==b&&(b=re.id,Ac=!0),gs||S!==D){if(Zr.setValue(W,"projectionMatrix",D.projectionMatrix),le.logarithmicDepthBuffer&&Zr.setValue(W,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),S!==D&&(S=D,Ac=!0,fm=!0),re.isShaderMaterial||re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshStandardMaterial||re.envMap){let bi=Zr.map.cameraPosition;bi!==void 0&&bi.setValue(W,j.setFromMatrixPosition(D.matrixWorld))}(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&Zr.setValue(W,"isOrthographic",D.isOrthographicCamera===!0),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial||re.isShadowMaterial||fe.isSkinnedMesh)&&Zr.setValue(W,"viewMatrix",D.matrixWorldInverse)}if(fe.isSkinnedMesh){Zr.setOptional(W,fe,"bindMatrix"),Zr.setOptional(W,fe,"bindMatrixInverse");let bi=fe.skeleton;bi&&(le.floatVertexTextures?(bi.boneTexture===null&&bi.computeBoneTexture(),Zr.setValue(W,"boneTexture",bi.boneTexture,V),Zr.setValue(W,"boneTextureSize",bi.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."))}let dm=ne.morphAttributes;return(dm.position!==void 0||dm.normal!==void 0||dm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,re,xi),(Ac||Dt.receiveShadow!==fe.receiveShadow)&&(Dt.receiveShadow=fe.receiveShadow,Zr.setValue(W,"receiveShadow",fe.receiveShadow)),Ac&&(Zr.setValue(W,"toneMappingExposure",m.toneMappingExposure),Dt.needsLights&&Lt(Tc,fm),Ve&&re.fog===!0&&De.refreshFogUniforms(Tc,Ve),De.refreshMaterialUniforms(Tc,re,C,_,F),Cs.upload(W,Dt.uniformsList,Tc,V)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Cs.upload(W,Dt.uniformsList,Tc,V),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&Zr.setValue(W,"center",fe.center),Zr.setValue(W,"modelViewMatrix",fe.modelViewMatrix),Zr.setValue(W,"normalMatrix",fe.normalMatrix),Zr.setValue(W,"modelMatrix",fe.matrixWorld),xi}function Lt(D,Y){D.ambientLightColor.needsUpdate=Y,D.lightProbe.needsUpdate=Y,D.directionalLights.needsUpdate=Y,D.directionalLightShadows.needsUpdate=Y,D.pointLights.needsUpdate=Y,D.pointLightShadows.needsUpdate=Y,D.spotLights.needsUpdate=Y,D.spotLightShadows.needsUpdate=Y,D.rectAreaLights.needsUpdate=Y,D.hemisphereLights.needsUpdate=Y}function Ft(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(D,Y,ne){Z.get(D.texture).__webglTexture=Y,Z.get(D.depthTexture).__webglTexture=ne;let re=Z.get(D);re.__hasExternalTextures=!0,re.__hasExternalTextures&&(re.__autoAllocateDepthBuffer=ne===void 0,re.__autoAllocateDepthBuffer||oe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),re.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(D,Y){let ne=Z.get(D);ne.__webglFramebuffer=Y,ne.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(D,Y=0,ne=0){w=D,v=Y,y=ne;let re=!0;if(D){let ct=Z.get(D);ct.__useDefaultFramebuffer!==void 0?(H.bindFramebuffer(36160,null),re=!1):ct.__webglFramebuffer===void 0?V.setupRenderTarget(D):ct.__hasExternalTextures&&V.rebindTextures(D,Z.get(D.texture).__webglTexture,Z.get(D.depthTexture).__webglTexture)}let fe=null,Ve=!1,et=!1;if(D){let ct=D.texture;(ct.isData3DTexture||ct.isDataArrayTexture)&&(et=!0);let Bt=Z.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(fe=Bt[Y],Ve=!0):le.isWebGL2&&D.samples>0&&V.useMultisampledRTT(D)===!1?fe=Z.get(D).__webglMultisampledFramebuffer:fe=Bt,T.copy(D.viewport),A.copy(D.scissor),x=D.scissorTest}else T.copy(R).multiplyScalar(C).floor(),A.copy(U).multiplyScalar(C).floor(),x=z;if(H.bindFramebuffer(36160,fe)&&le.drawBuffers&&re&&H.drawBuffers(D,fe),H.viewport(T),H.scissor(A),H.setScissorTest(x),Ve){let ct=Z.get(D.texture);W.framebufferTexture2D(36160,36064,34069+Y,ct.__webglTexture,ne)}else if(et){let ct=Z.get(D.texture),Bt=Y||0;W.framebufferTextureLayer(36160,36064,ct.__webglTexture,ne||0,Bt)}b=-1},this.readRenderTargetPixels=function(D,Y,ne,re,fe,Ve,et){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Z.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&et!==void 0&&(it=it[et]),it){H.bindFramebuffer(36160,it);try{let ct=D.texture,Bt=ct.format,wt=ct.type;if(Bt!==On&&he.convert(Bt)!==W.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Tt=wt===Vc&&(oe.has("EXT_color_buffer_half_float")||le.isWebGL2&&oe.has("EXT_color_buffer_float"));if(wt!==Wt&&he.convert(wt)!==W.getParameter(35738)&&!(wt===Ts&&(le.isWebGL2||oe.has("OES_texture_float")||oe.has("WEBGL_color_buffer_float")))&&!Tt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-re&&ne>=0&&ne<=D.height-fe&&W.readPixels(Y,ne,re,fe,he.convert(Bt),he.convert(wt),Ve)}finally{let ct=w!==null?Z.get(w).__webglFramebuffer:null;H.bindFramebuffer(36160,ct)}}},this.copyFramebufferToTexture=function(D,Y,ne=0){if(Y.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let re=Math.pow(2,-ne),fe=Math.floor(Y.image.width*re),Ve=Math.floor(Y.image.height*re);V.setTexture2D(Y,0),W.copyTexSubImage2D(3553,ne,0,0,D.x,D.y,fe,Ve),H.unbindTexture()},this.copyTextureToTexture=function(D,Y,ne,re=0){let fe=Y.image.width,Ve=Y.image.height,et=he.convert(ne.format),it=he.convert(ne.type);V.setTexture2D(ne,0),W.pixelStorei(37440,ne.flipY),W.pixelStorei(37441,ne.premultiplyAlpha),W.pixelStorei(3317,ne.unpackAlignment),Y.isDataTexture?W.texSubImage2D(3553,re,D.x,D.y,fe,Ve,et,it,Y.image.data):Y.isCompressedTexture?W.compressedTexSubImage2D(3553,re,D.x,D.y,Y.mipmaps[0].width,Y.mipmaps[0].height,et,Y.mipmaps[0].data):W.texSubImage2D(3553,re,D.x,D.y,et,it,Y.image),re===0&&ne.generateMipmaps&&W.generateMipmap(3553),H.unbindTexture()},this.copyTextureToTexture3D=function(D,Y,ne,re,fe=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ve=D.max.x-D.min.x+1,et=D.max.y-D.min.y+1,it=D.max.z-D.min.z+1,ct=he.convert(re.format),Bt=he.convert(re.type),wt;if(re.isData3DTexture)V.setTexture3D(re,0),wt=32879;else if(re.isDataArrayTexture)V.setTexture2DArray(re,0),wt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(37440,re.flipY),W.pixelStorei(37441,re.premultiplyAlpha),W.pixelStorei(3317,re.unpackAlignment);let Tt=W.getParameter(3314),tr=W.getParameter(32878),go=W.getParameter(3316),ta=W.getParameter(3315),ra=W.getParameter(32877),vi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;W.pixelStorei(3314,vi.width),W.pixelStorei(32878,vi.height),W.pixelStorei(3316,D.min.x),W.pixelStorei(3315,D.min.y),W.pixelStorei(32877,D.min.z),ne.isDataTexture||ne.isData3DTexture?W.texSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,Bt,vi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,vi.data)):W.texSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,Bt,vi),W.pixelStorei(3314,Tt),W.pixelStorei(32878,tr),W.pixelStorei(3316,go),W.pixelStorei(3315,ta),W.pixelStorei(32877,ra),fe===0&&re.generateMipmaps&&W.generateMipmap(wt),H.unbindTexture()},this.initTexture=function(D){V.setTexture2D(D,0),H.unbindTexture()},this.resetState=function(){v=0,y=0,w=null,H.reset(),nt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ct.prototype.isWebGLRenderer=!0;var dg=class extends Ct{};dg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var Eo=class{constructor(e,t=1,r=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=r}clone(){return new Eo(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};Eo.prototype.isFog=!0;var nn=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};nn.prototype.isScene=!0;var rs=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};rs.prototype.isInterleavedBuffer=!0;var $r=new M,Ai=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.applyMatrix4(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.applyNormalMatrix(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.transformDirection(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ue(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ai(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ai.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends cr{constructor(e){super(),this.type="SpriteMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Zc.prototype.isSpriteMaterial=!0;var va,Lc=new M,xa=new M,ba=new M,wa=new N,Dc=new N,yb=new _e,qh=new M,Pc=new M,Yh=new M,A0=new N,qm=new N,T0=new N,pg=class extends ot{constructor(e){if(super(),this.type="Sprite",va===void 0){va=new Ie;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new rs(t,5);va.setIndex([0,1,2,0,2,3]),va.setAttribute("position",new Ai(r,3,0,!1)),va.setAttribute("uv",new Ai(r,2,3,!1))}this.geometry=va,this.material=e!==void 0?e:new Zc,this.center=new N(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),xa.setFromMatrixScale(this.matrixWorld),yb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ba.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&xa.multiplyScalar(-ba.z);let r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Xh(qh.set(-.5,-.5,0),ba,o,xa,n,s),Xh(Pc.set(.5,-.5,0),ba,o,xa,n,s),Xh(Yh.set(.5,.5,0),ba,o,xa,n,s),A0.set(0,0),qm.set(1,0),T0.set(1,1);let a=e.ray.intersectTriangle(qh,Pc,Yh,!1,Lc);if(a===null&&(Xh(Pc.set(-.5,.5,0),ba,o,xa,n,s),qm.set(0,1),a=e.ray.intersectTriangle(qh,Yh,Pc,!1,Lc),a===null))return;let l=e.ray.origin.distanceTo(Lc);l<e.near||l>e.far||t.push({distance:l,point:Lc.clone(),uv:Jt.getUV(Lc,qh,Pc,Yh,A0,qm,T0,new N),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};pg.prototype.isSprite=!0;function Xh(i,e,t,r,n,s){wa.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Dc.x=s*wa.x-n*wa.y,Dc.y=n*wa.x+s*wa.y):Dc.copy(wa),i.copy(e),i.x+=Dc.x,i.y+=Dc.y,i.applyMatrix4(yb)}var E0=new M,_0=new Ke,C0=new Ke,cP=new M,L0=new _e,xf=class extends Gt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new _e,this.bindMatrixInverse=new _e}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Ke,t=this.geometry.attributes.skinWeight;for(let r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let r=this.skeleton,n=this.geometry;_0.fromBufferAttribute(n.attributes.skinIndex,e),C0.fromBufferAttribute(n.attributes.skinWeight,e),E0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=C0.getComponent(s);if(o!==0){let a=_0.getComponent(s);L0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(cP.copy(E0).applyMatrix4(L0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};xf.prototype.isSkinnedMesh=!0;var mg=class extends ot{constructor(){super(),this.type="Bone"}};mg.prototype.isBone=!0;var bf=class extends _t{constructor(e=null,t=1,r=1,n,s,o,a,l,c=lr,u=lr,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};bf.prototype.isDataTexture=!0;var Ia=class extends Ue{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};Ia.prototype.isInstancedBufferAttribute=!0;var D0=new _e,P0=new _e,Jh=[],Ic=new Gt,gg=class extends Gt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Ia(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let r=this.matrixWorld,n=this.count;if(Ic.geometry=this.geometry,Ic.material=this.material,Ic.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,D0),P0.multiplyMatrices(r,D0),Ic.matrixWorld=P0,Ic.raycast(e,Jh);for(let o=0,a=Jh.length;o<a;o++){let l=Jh[o];l.instanceId=s,l.object=this,t.push(l)}Jh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ia(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};gg.prototype.isInstancedMesh=!0;var Ur=class extends cr{constructor(e){super(),this.type="LineBasicMaterial",this.color=new xe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};Ur.prototype.isLineBasicMaterial=!0;var I0=new M,R0=new M,B0=new _e,Ym=new ii,Qh=new Yr,ns=class extends ot{constructor(e=new Ie,t=new Ur){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[0];for(let n=1,s=t.count;n<s;n++)I0.fromBufferAttribute(t,n-1),R0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=I0.distanceTo(R0);e.setAttribute("lineDistance",new Le(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){let r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Qh.copy(r.boundingSphere),Qh.applyMatrix4(n),Qh.radius+=s,e.ray.intersectsSphere(Qh)===!1)return;B0.copy(n).invert(),Ym.copy(e.ray).applyMatrix4(B0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,u=new M,h=new M,f=new M,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let p=r.index,g=r.attributes.position;if(p!==null){let v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){let S=p.getX(w),T=p.getX(w+1);if(c.fromBufferAttribute(g,S),u.fromBufferAttribute(g,T),Ym.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(f);x<e.near||x>e.far||t.push({distance:x,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){if(c.fromBufferAttribute(g,w),u.fromBufferAttribute(g,w+1),Ym.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(f);T<e.near||T>e.far||t.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};ns.prototype.isLine=!0;var N0=new M,O0=new M,oi=class extends ns{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[];for(let n=0,s=t.count;n<s;n+=2)N0.fromBufferAttribute(t,n),O0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+N0.distanceTo(O0);e.setAttribute("lineDistance",new Le(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};oi.prototype.isLineSegments=!0;var yg=class extends ns{constructor(e,t){super(e,t),this.type="LineLoop"}};yg.prototype.isLineLoop=!0;var $c=class extends cr{constructor(e){super(),this.type="PointsMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};$c.prototype.isPointsMaterial=!0;var F0=new _e,vg=new ii,Kh=new Yr,Zh=new M,xg=class extends ot{constructor(e=new Ie,t=new $c){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Kh.copy(r.boundingSphere),Kh.applyMatrix4(n),Kh.radius+=s,e.ray.intersectsSphere(Kh)===!1)return;F0.copy(n).invert(),vg.copy(e.ray).applyMatrix4(F0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,h=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let p=f,m=d;p<m;p++){let g=c.getX(p);Zh.fromBufferAttribute(h,g),U0(Zh,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let p=f,m=d;p<m;p++)Zh.fromBufferAttribute(h,p),U0(Zh,p,l,n,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};xg.prototype.isPoints=!0;function U0(i,e,t,r,n,s,o){let a=vg.distanceSqToPoint(i);if(a<t){let l=new M;vg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eu=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ut,this.magFilter=s!==void 0?s:ut,this.generateMipmaps=!1;let u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};eu.prototype.isVideoTexture=!0;var bg=class extends _t{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=lr,this.minFilter=lr,this.generateMipmaps=!1,this.needsUpdate=!0}};bg.prototype.isFramebufferTexture=!0;var wg=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};wg.prototype.isCompressedTexture=!0;var Sg=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Sg.prototype.isCanvasTexture=!0;var gn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let u=r[n],f=r[n+1]-u,d=(o-u)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new N:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new M,n=[],s=[],o=[],a=new M,l=new _e;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new M)}s[0]=new M,o[0]=new M;let c=Number.MAX_VALUE,u=Math.abs(n[0].x),h=Math.abs(n[0].y),f=Math.abs(n[0].z);u<=c&&(c=u,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(yr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(yr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(n[p],d*p)),o[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Bs=class extends gn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new N,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};Bs.prototype.isEllipseCurve=!0;var wf=class extends Bs{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};wf.prototype.isArcCurve=!0;function ey(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var $h=new M,Xm=new ey,Jm=new ey,Qm=new ey,Sf=class extends gn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new M){let r=t,n=this.points,s=n.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=n[(a-1)%s]:($h.subVectors(n[0],n[1]).add(n[0]),c=$h);let h=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?u=n[(a+2)%s]:($h.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=$h),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(u),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Xm.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,p,m,g),Jm.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,p,m,g),Qm.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,p,m,g)}else this.curveType==="catmullrom"&&(Xm.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Jm.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Qm.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return r.set(Xm.calc(l),Jm.calc(l),Qm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Sf.prototype.isCatmullRomCurve3=!0;function z0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function uP(i,e){let t=1-i;return t*t*e}function hP(i,e){return 2*(1-i)*i*e}function fP(i,e){return i*i*e}function zc(i,e,t,r){return uP(i,e)+hP(i,t)+fP(i,r)}function dP(i,e){let t=1-i;return t*t*t*e}function pP(i,e){let t=1-i;return 3*t*t*i*e}function mP(i,e){return 3*(1-i)*i*i*e}function gP(i,e){return i*i*i*e}function Gc(i,e,t,r,n){return dP(i,e)+pP(i,t)+mP(i,r)+gP(i,n)}var sn=class extends gn{constructor(e=new N,t=new N,r=new N,n=new N){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};sn.prototype.isCubicBezierCurve=!0;var Mf=class extends gn{constructor(e=new M,t=new M,r=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y),Gc(e,n.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};Mf.prototype.isCubicBezierCurve3=!0;var on=class extends gn{constructor(e=new N,t=new N){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new N){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new N;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};on.prototype.isLineCurve=!0;var tu=class extends gn{constructor(e=new M,t=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Gn=class extends gn{constructor(e=new N,t=new N,r=new N){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Gn.prototype.isQuadraticBezierCurve=!0;var Af=class extends gn{constructor(e=new M,t=new M,r=new M){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y),zc(e,n.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Af.prototype.isQuadraticBezierCurve3=!0;var _o=class extends gn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new N){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],u=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return r.set(z0(a,l.x,c.x,u.x,h.x),z0(a,l.y,c.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new N().fromArray(n))}return this}};_o.prototype.isSplineCurve=!0;var vb=Object.freeze({__proto__:null,ArcCurve:wf,CatmullRomCurve3:Sf,CubicBezierCurve:sn,CubicBezierCurve3:Mf,EllipseCurve:Bs,LineCurve:on,LineCurve3:tu,QuadraticBezierCurve:Gn,QuadraticBezierCurve3:Af,SplineCurve:_o}),Mg=class extends gn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new on(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];r&&r.equals(u)||(t.push(u),r=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new vb[n.type]().fromJSON(n))}return this}},Ra=class extends Mg{constructor(e){super(),this.type="Path",this.currentPoint=new N,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new on(this.currentPoint.clone(),new N(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new Gn(this.currentPoint.clone(),new N(e,t),new N(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new sn(this.currentPoint.clone(),new N(e,t),new N(r,n),new N(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new _o(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Bs(e,t,r,n,s,o,a,l);if(this.curves.length>0){let h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ba=class extends Ie{constructor(e=[new N(0,.5),new N(.5,0),new N(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=yr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],u=1/t,h=new M,f=new N,d=new M,p=new M,m=new M,g=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,m.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(m.x,m.y,m.z);break;default:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),l.push(d.x,d.y,d.z),m.copy(p)}for(let y=0;y<=t;y++){let w=r+y*u*n,b=Math.sin(w),S=Math.cos(w);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*b,h.y=e[T].y,h.z=e[T].x*S,o.push(h.x,h.y,h.z),f.x=y/t,f.y=T/(e.length-1),a.push(f.x,f.y);let A=l[3*T+0]*b,x=l[3*T+1],E=l[3*T+0]*S;c.push(A,x,E)}}for(let y=0;y<t;y++)for(let w=0;w<e.length-1;w++){let b=w+y*e.length,S=b,T=b+e.length,A=b+e.length+1,x=b+1;s.push(S,T,x),s.push(A,x,T)}this.setIndex(s),this.setAttribute("position",new Le(o,3)),this.setAttribute("uv",new Le(a,2)),this.setAttribute("normal",new Le(c,3))}static fromJSON(e){return new Ba(e.points,e.segments,e.phiStart,e.phiLength)}};var Co=class extends Ie{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let u=[],h=[],f=[],d=[],p=0,m=[],g=r/2,v=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function y(){let b=new M,S=new M,T=0,A=(t-e)/r;for(let x=0;x<=s;x++){let E=[],_=x/s,C=_*(t-e)+e;for(let P=0;P<=n;P++){let B=P/n,R=B*l+a,U=Math.sin(R),z=Math.cos(R);S.x=C*U,S.y=-_*r+g,S.z=C*z,h.push(S.x,S.y,S.z),b.set(U,A,z).normalize(),f.push(b.x,b.y,b.z),d.push(B,1-_),E.push(p++)}m.push(E)}for(let x=0;x<n;x++)for(let E=0;E<s;E++){let _=m[E][x],C=m[E+1][x],P=m[E+1][x+1],B=m[E][x+1];u.push(_,C,B),u.push(C,P,B),T+=6}c.addGroup(v,T,0),v+=T}function w(b){let S=p,T=new N,A=new M,x=0,E=b===!0?e:t,_=b===!0?1:-1;for(let P=1;P<=n;P++)h.push(0,g*_,0),f.push(0,_,0),d.push(.5,.5),p++;let C=p;for(let P=0;P<=n;P++){let R=P/n*l+a,U=Math.cos(R),z=Math.sin(R);A.x=E*z,A.y=g*_,A.z=E*U,h.push(A.x,A.y,A.z),f.push(0,_,0),T.x=U*.5+.5,T.y=z*.5*_+.5,d.push(T.x,T.y),p++}for(let P=0;P<n;P++){let B=S+P,R=C+P;b===!0?u.push(R,R+1,B):u.push(R+1,R,B),x+=3}c.addGroup(v,x,b===!0?1:2),v+=x}}static fromJSON(e){return new Co(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Na=class extends Co{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Na(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Oa=class extends Ie{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),u(),this.setAttribute("position",new Le(s,3)),this.setAttribute("normal",new Le(s.slice(),3)),this.setAttribute("uv",new Le(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(y){let w=new M,b=new M,S=new M;for(let T=0;T<t.length;T+=3)d(t[T+0],w),d(t[T+1],b),d(t[T+2],S),l(w,b,S,y)}function l(y,w,b,S){let T=S+1,A=[];for(let x=0;x<=T;x++){A[x]=[];let E=y.clone().lerp(b,x/T),_=w.clone().lerp(b,x/T),C=T-x;for(let P=0;P<=C;P++)P===0&&x===T?A[x][P]=E:A[x][P]=E.clone().lerp(_,P/C)}for(let x=0;x<T;x++)for(let E=0;E<2*(T-x)-1;E++){let _=Math.floor(E/2);E%2===0?(f(A[x][_+1]),f(A[x+1][_]),f(A[x][_])):(f(A[x][_+1]),f(A[x+1][_+1]),f(A[x+1][_]))}}function c(y){let w=new M;for(let b=0;b<s.length;b+=3)w.x=s[b+0],w.y=s[b+1],w.z=s[b+2],w.normalize().multiplyScalar(y),s[b+0]=w.x,s[b+1]=w.y,s[b+2]=w.z}function u(){let y=new M;for(let w=0;w<s.length;w+=3){y.x=s[w+0],y.y=s[w+1],y.z=s[w+2];let b=g(y)/2/Math.PI+.5,S=v(y)/Math.PI+.5;o.push(b,1-S)}p(),h()}function h(){for(let y=0;y<o.length;y+=6){let w=o[y+0],b=o[y+2],S=o[y+4],T=Math.max(w,b,S),A=Math.min(w,b,S);T>.9&&A<.1&&(w<.2&&(o[y+0]+=1),b<.2&&(o[y+2]+=1),S<.2&&(o[y+4]+=1))}}function f(y){s.push(y.x,y.y,y.z)}function d(y,w){let b=y*3;w.x=e[b+0],w.y=e[b+1],w.z=e[b+2]}function p(){let y=new M,w=new M,b=new M,S=new M,T=new N,A=new N,x=new N;for(let E=0,_=0;E<s.length;E+=9,_+=6){y.set(s[E+0],s[E+1],s[E+2]),w.set(s[E+3],s[E+4],s[E+5]),b.set(s[E+6],s[E+7],s[E+8]),T.set(o[_+0],o[_+1]),A.set(o[_+2],o[_+3]),x.set(o[_+4],o[_+5]),S.copy(y).add(w).add(b).divideScalar(3);let C=g(S);m(T,_+0,y,C),m(A,_+2,w,C),m(x,_+4,b,C)}}function m(y,w,b,S){S<0&&y.x===1&&(o[w]=y.x-1),b.x===0&&b.z===0&&(o[w]=S/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new Oa(e.vertices,e.indices,e.radius,e.details)}},Fa=class extends Oa{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Fa(e.radius,e.detail)}},zz=new M,Gz=new M,kz=new M,Vz=new Jt;var en=class extends Ra{constructor(e){super(e),this.uuid=Fn(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Ra().fromJSON(n))}return this}},yP={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=xb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(r&&(s=SP(i,e,s,t)),i.length>80*t){a=c=i[0],l=u=i[1];for(let p=t;p<n;p+=t)h=i[p],f=i[p+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return ru(s,o,t,a,l,d),o}};function xb(i,e,t,r,n){let s,o;if(n===RP(i,e,t,r)>0)for(s=e;s<t;s+=r)o=G0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=G0(s,i[s],i[s+1],o);return o&&$f(o,o.next)&&(iu(o),o=o.next),o}function Ns(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&($f(t,t.next)||$t(t.prev,t,t.next)===0)){if(iu(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function ru(i,e,t,r,n,s,o){if(!i)return;!o&&s&&_P(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?xP(i,r,n,s):vP(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),iu(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=bP(Ns(i),e,t),ru(i,e,t,r,n,s,2)):o===2&&wP(i,e,t,r,n,s):ru(Ns(i),e,t,r,n,s,1);break}}}function vP(i){let e=i.prev,t=i,r=i.next;if($t(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(Ea(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&$t(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function xP(i,e,t,r){let n=i.prev,s=i,o=i.next;if($t(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,u=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,h=Ag(a,l,e,t,r),f=Ag(c,u,e,t,r),d=i.prevZ,p=i.nextZ;for(;d&&d.z>=h&&p&&p.z<=f;){if(d!==i.prev&&d!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&$t(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==i.prev&&p!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&$t(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function bP(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!$f(n,s)&&bb(n,r,r.next,s)&&nu(n,s)&&nu(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),iu(r),iu(r.next),r=i=s),r=r.next}while(r!==i);return Ns(r)}function wP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&DP(o,a)){let l=wb(o,a);o=Ns(o,o.next),l=Ns(l,l.next),ru(o,e,t,r,n,s),ru(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function SP(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=xb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(LP(c));for(n.sort(MP),s=0;s<n.length;s++)AP(n[s],t),t=Ns(t,t.next);return t}function MP(i,e){return i.x-e.x}function AP(i,e){if(e=TP(i,e),e){let t=wb(e,i);Ns(e,e.next),Ns(t,t.next)}}function TP(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(r===s)return o;let a=o,l=o.x,c=o.y,u=1/0,h;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&Ea(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(r-t.x),nu(t,i)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&EP(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function EP(i,e){return $t(i.prev,i,e.prev)<0&&$t(e.next,i,i.next)<0}function _P(i,e,t,r){let n=i;do n.z===null&&(n.z=Ag(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,CP(n)}function CP(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Ag(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function LP(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Ea(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function DP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!PP(i,e)&&(nu(i,e)&&nu(e,i)&&IP(i,e)&&($t(i.prev,i,e.prev)||$t(i,e.prev,e))||$f(i,e)&&$t(i.prev,i,i.next)>0&&$t(e.prev,e,e.next)>0)}function $t(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function $f(i,e){return i.x===e.x&&i.y===e.y}function bb(i,e,t,r){let n=tf($t(i,e,t)),s=tf($t(i,e,r)),o=tf($t(t,r,i)),a=tf($t(t,r,e));return!!(n!==s&&o!==a||n===0&&ef(i,t,e)||s===0&&ef(i,r,e)||o===0&&ef(t,i,r)||a===0&&ef(t,e,r))}function ef(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tf(i){return i>0?1:i<0?-1:0}function PP(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&bb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nu(i,e){return $t(i.prev,i,i.next)<0?$t(i,e,i.next)>=0&&$t(i,i.prev,e)>=0:$t(i,e,i.prev)<0||$t(i,i.next,e)<0}function IP(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function wb(i,e){let t=new Tg(i.i,i.x,i.y),r=new Tg(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function G0(i,e,t,r){let n=new Tg(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function iu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Tg(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function RP(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ri=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ri.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];k0(e),V0(r,e);let o=e.length;t.forEach(k0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,V0(r,t[l]);let a=yP.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function k0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function V0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Os=class extends Ie{constructor(e=new en([new N(.5,.5),new N(-.5,.5),new N(-.5,-.5),new N(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Le(n,3)),this.setAttribute("uv",new Le(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:BP;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let w,b=!1,S,T,A,x;v&&(w=v.getSpacedPoints(u),b=!0,f=!1,S=v.computeFrenetFrames(u,!1),T=new M,A=new M,x=new M),f||(g=0,d=0,p=0,m=0);let E=a.extractPoints(c),_=E.shape,C=E.holes;if(!ri.isClockWise(_)){_=_.reverse();for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];ri.isClockWise($)&&(C[Z]=$.reverse())}}let B=ri.triangulateShape(_,C),R=_;for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];_=_.concat($)}function U(Z,V,$){return V||console.error("THREE.ExtrudeGeometry: vec does not exist"),V.clone().multiplyScalar($).add(Z)}let z=_.length,J=B.length;function Q(Z,V,$){let ce,ie,pe,ve=Z.x-V.x,me=Z.y-V.y,De=$.x-Z.x,ke=$.y-Z.y,I=ve*ve+me*me,L=ve*ke-me*De;if(Math.abs(L)>Number.EPSILON){let te=Math.sqrt(I),ye=Math.sqrt(De*De+ke*ke),Se=V.x-me/te,Pe=V.y+ve/te,Fe=$.x-ke/ye,he=$.y+De/ye,nt=((Fe-Se)*ke-(he-Pe)*De)/(ve*ke-me*De);ce=Se+ve*nt-Z.x,ie=Pe+me*nt-Z.y;let st=ce*ce+ie*ie;if(st<=2)return new N(ce,ie);pe=Math.sqrt(st/2)}else{let te=!1;ve>Number.EPSILON?De>Number.EPSILON&&(te=!0):ve<-Number.EPSILON?De<-Number.EPSILON&&(te=!0):Math.sign(me)===Math.sign(ke)&&(te=!0),te?(ce=-me,ie=ve,pe=Math.sqrt(I)):(ce=ve,ie=me,pe=Math.sqrt(I/2))}return new N(ce/pe,ie/pe)}let X=[];for(let Z=0,V=R.length,$=V-1,ce=Z+1;Z<V;Z++,$++,ce++)$===V&&($=0),ce===V&&(ce=0),X[Z]=Q(R[Z],R[$],R[ce]);let F=[],k,O=X.concat();for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];k=[];for(let ce=0,ie=$.length,pe=ie-1,ve=ce+1;ce<ie;ce++,pe++,ve++)pe===ie&&(pe=0),ve===ie&&(ve=0),k[ce]=Q($[ce],$[pe],$[ve]);F.push(k),O=O.concat(k)}for(let Z=0;Z<g;Z++){let V=Z/g,$=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let ie=0,pe=R.length;ie<pe;ie++){let ve=U(R[ie],X[ie],ce);ge(ve.x,ve.y,-$)}for(let ie=0,pe=C.length;ie<pe;ie++){let ve=C[ie];k=F[ie];for(let me=0,De=ve.length;me<De;me++){let ke=U(ve[me],k[me],ce);ge(ke.x,ke.y,-$)}}}let j=p+m;for(let Z=0;Z<z;Z++){let V=f?U(_[Z],O[Z],j):_[Z];b?(A.copy(S.normals[0]).multiplyScalar(V.x),T.copy(S.binormals[0]).multiplyScalar(V.y),x.copy(w[0]).add(A).add(T),ge(x.x,x.y,x.z)):ge(V.x,V.y,0)}for(let Z=1;Z<=u;Z++)for(let V=0;V<z;V++){let $=f?U(_[V],O[V],j):_[V];b?(A.copy(S.normals[Z]).multiplyScalar($.x),T.copy(S.binormals[Z]).multiplyScalar($.y),x.copy(w[Z]).add(A).add(T),ge(x.x,x.y,x.z)):ge($.x,$.y,h/u*Z)}for(let Z=g-1;Z>=0;Z--){let V=Z/g,$=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let ie=0,pe=R.length;ie<pe;ie++){let ve=U(R[ie],X[ie],ce);ge(ve.x,ve.y,h+$)}for(let ie=0,pe=C.length;ie<pe;ie++){let ve=C[ie];k=F[ie];for(let me=0,De=ve.length;me<De;me++){let ke=U(ve[me],k[me],ce);b?ge(ke.x,ke.y+w[u-1].y,w[u-1].x+$):ge(ke.x,ke.y,h+$)}}}q(),K();function q(){let Z=n.length/3;if(f){let V=0,$=z*V;for(let ce=0;ce<J;ce++){let ie=B[ce];oe(ie[2]+$,ie[1]+$,ie[0]+$)}V=u+g*2,$=z*V;for(let ce=0;ce<J;ce++){let ie=B[ce];oe(ie[0]+$,ie[1]+$,ie[2]+$)}}else{for(let V=0;V<J;V++){let $=B[V];oe($[2],$[1],$[0])}for(let V=0;V<J;V++){let $=B[V];oe($[0]+z*u,$[1]+z*u,$[2]+z*u)}}r.addGroup(Z,n.length/3-Z,0)}function K(){let Z=n.length/3,V=0;W(R,V),V+=R.length;for(let $=0,ce=C.length;$<ce;$++){let ie=C[$];W(ie,V),V+=ie.length}r.addGroup(Z,n.length/3-Z,1)}function W(Z,V){let $=Z.length;for(;--$>=0;){let ce=$,ie=$-1;ie<0&&(ie=Z.length-1);for(let pe=0,ve=u+g*2;pe<ve;pe++){let me=z*pe,De=z*(pe+1),ke=V+ce+me,I=V+ie+me,L=V+ie+De,te=V+ce+De;le(ke,I,L,te)}}}function ge(Z,V,$){l.push(Z),l.push(V),l.push($)}function oe(Z,V,$){H(Z),H(V),H($);let ce=n.length/3,ie=y.generateTopUV(r,n,ce-3,ce-2,ce-1);ue(ie[0]),ue(ie[1]),ue(ie[2])}function le(Z,V,$,ce){H(Z),H(V),H(ce),H(V),H($),H(ce);let ie=n.length/3,pe=y.generateSideWallUV(r,n,ie-6,ie-3,ie-2,ie-1);ue(pe[0]),ue(pe[1]),ue(pe[3]),ue(pe[1]),ue(pe[2]),ue(pe[3])}function H(Z){n.push(l[Z*3+0]),n.push(l[Z*3+1]),n.push(l[Z*3+2])}function ue(Z){s.push(Z.x),s.push(Z.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return NP(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new vb[n.type]().fromJSON(n)),new Os(r,e.options)}},BP={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],u=e[n*3+1];return[new N(s,o),new N(a,l),new N(c,u)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],u=e[r*3+1],h=e[r*3+2],f=e[n*3],d=e[n*3+1],p=e[n*3+2],m=e[s*3],g=e[s*3+1],v=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new N(o,1-l),new N(c,1-h),new N(f,1-p),new N(m,1-v)]:[new N(a,1-l),new N(u,1-h),new N(d,1-p),new N(g,1-v)]}};function NP(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ua=class extends Oa{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ua(e.radius,e.detail)}};var Lo=class extends Ie{constructor(e=new en([new N(0,.5),new N(-.5,-.5),new N(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],s=[],o=[],a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Le(n,3)),this.setAttribute("normal",new Le(s,3)),this.setAttribute("uv",new Le(o,2));function c(u){let h=n.length/3,f=u.extractPoints(t),d=f.shape,p=f.holes;ri.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,v=p.length;g<v;g++){let y=p[g];ri.isClockWise(y)===!0&&(p[g]=y.reverse())}let m=ri.triangulateShape(d,p);for(let g=0,v=p.length;g<v;g++){let y=p[g];d=d.concat(y)}for(let g=0,v=d.length;g<v;g++){let y=d[g];n.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let g=0,v=m.length;g<v;g++){let y=m[g],w=y[0]+h,b=y[1]+h,S=y[2]+h;r.push(w,b,S),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return OP(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Lo(r,e.curveSegments)}};function OP(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Do=class extends Ie{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new M,f=new M,d=[],p=[],m=[],g=[];for(let v=0;v<=r;v++){let y=[],w=v/r,b=0;v==0&&o==0?b=.5/t:v==r&&l==Math.PI&&(b=-.5/t);for(let S=0;S<=t;S++){let T=S/t;h.x=-e*Math.cos(n+T*s)*Math.sin(o+w*a),h.y=e*Math.cos(o+w*a),h.z=e*Math.sin(n+T*s)*Math.sin(o+w*a),p.push(h.x,h.y,h.z),f.copy(h).normalize(),m.push(f.x,f.y,f.z),g.push(T+b,1-w),y.push(c++)}u.push(y)}for(let v=0;v<r;v++)for(let y=0;y<t;y++){let w=u[v][y+1],b=u[v][y],S=u[v+1][y],T=u[v+1][y+1];(v!==0||o>0)&&d.push(w,b,T),(v!==r-1||l<Math.PI)&&d.push(b,S,T)}this.setIndex(d),this.setAttribute("position",new Le(p,3)),this.setAttribute("normal",new Le(m,3)),this.setAttribute("uv",new Le(g,2))}static fromJSON(e){return new Do(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var za=class extends Ie{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],u=[],h=new M,f=new M,d=new M,p=new M,m=new M,g=new M,v=new M;for(let w=0;w<=r;++w){let b=w/r*s*Math.PI*2;y(b,s,o,e,d),y(b+.01,s,o,e,p),g.subVectors(p,d),v.addVectors(p,d),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize();for(let S=0;S<=n;++S){let T=S/n*Math.PI*2,A=-t*Math.cos(T),x=t*Math.sin(T);h.x=d.x+(A*v.x+x*m.x),h.y=d.y+(A*v.y+x*m.y),h.z=d.z+(A*v.z+x*m.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(w/r),u.push(S/n)}}for(let w=1;w<=r;w++)for(let b=1;b<=n;b++){let S=(n+1)*(w-1)+(b-1),T=(n+1)*w+(b-1),A=(n+1)*w+b,x=(n+1)*(w-1)+b;a.push(S,T,x),a.push(T,A,x)}this.setIndex(a),this.setAttribute("position",new Le(l,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(u,2));function y(w,b,S,T,A){let x=Math.cos(w),E=Math.sin(w),_=S/b*w,C=Math.cos(_);A.x=T*(2+C)*.5*x,A.y=T*(2+C)*E*.5,A.z=T*Math.sin(_)*.5}}static fromJSON(e){return new za(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var Tf=class extends cr{constructor(e){super(),this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};Tf.prototype.isShadowMaterial=!0;var Ef=class extends St{constructor(e){super(e),this.type="RawShaderMaterial"}};Ef.prototype.isRawShaderMaterial=!0;var su=class extends cr{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};su.prototype.isMeshStandardMaterial=!0;var _f=class extends su{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new N(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};_f.prototype.isMeshPhysicalMaterial=!0;var Cf=class extends cr{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Cf.prototype.isMeshPhongMaterial=!0;var Lf=class extends cr{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Lf.prototype.isMeshToonMaterial=!0;var Df=class extends cr{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};Df.prototype.isMeshNormalMaterial=!0;var Pf=class extends cr{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Pf.prototype.isMeshLambertMaterial=!0;var If=class extends cr{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}};If.prototype.isMeshMatcapMaterial=!0;var Rf=class extends Ur{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};Rf.prototype.isLineDashedMaterial=!0;var FP={ShadowMaterial:Tf,SpriteMaterial:Zc,RawShaderMaterial:Ef,ShaderMaterial:St,PointsMaterial:$c,MeshPhysicalMaterial:_f,MeshStandardMaterial:su,MeshPhongMaterial:Cf,MeshToonMaterial:Lf,MeshNormalMaterial:Df,MeshLambertMaterial:Pf,MeshDepthMaterial:Jc,MeshDistanceMaterial:Qc,MeshBasicMaterial:Un,MeshMatcapMaterial:If,LineDashedMaterial:Rf,LineBasicMaterial:Ur,Material:cr};cr.fromType=function(i){return new FP[i]};var Xt={arraySlice:function(i,e,t){return Xt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){let p=c.times[d]*n;if(!(p<t||p>=r)){h.push(c.times[d]);for(let m=0;m<u;++m)f.push(c.values[d*u+m])}}h.length!==0&&(c.times=Xt.convertArray(h,c.times.constructor),c.values=Xt.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=a.times.length-1,m;if(s<=a.times[0]){let v=u,y=h-u;m=Xt.arraySlice(a.values,v,y)}else if(s>=a.times[p]){let v=p*h+u,y=v+h-u;m=Xt.arraySlice(a.values,v,y)}else{let v=a.createInterpolant(),y=u,w=h-u;v.evaluate(s),m=Xt.arraySlice(v.resultBuffer,y,w)}l==="quaternion"&&new Ut().fromArray(m).normalize().conjugate().toArray(m);let g=c.times.length;for(let v=0;v<g;++v){let y=v*d+f;if(l==="quaternion")Ut.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{let w=d-f*2;for(let b=0;b<w;++b)c.values[y+b]-=m[b]}}}return i.blendMode=sb,i}},Ti=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ti.prototype.beforeStart_=Ti.prototype.copySampleValue_;Ti.prototype.afterEnd_=Ti.prototype.copySampleValue_;var Eg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ma,endingEnd:Ma}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Aa:s=e,a=2*t-r;break;case hf:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Aa:o=e,l=2*r-t;break;case hf:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),m=p*p,g=m*p,v=-f*g+2*f*m-f*p,y=(1+f)*g+(-1.5-2*f)*m+(-.5+f)*p+1,w=(-1-d)*g+(1.5+d)*m+.5*p,b=d*g-d*m;for(let S=0;S!==a;++S)s[S]=v*o[u+S]+y*o[c+S]+w*o[l+S]+b*o[h+S];return s}},Bf=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(r-t)/(n-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}},_g=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},kn=class{constructor(e,t,r,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Xt.convertArray(t,this.TimeBufferType),this.values=Xt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Xt.convertArray(e.times,Array),values:Xt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new _g(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Eg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case cf:t=this.InterpolantFactoryMethodDiscrete;break;case uf:t=this.InterpolantFactoryMethodLinear;break;case xm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return cf;case this.InterpolantFactoryMethodLinear:return uf;case this.InterpolantFactoryMethodSmooth:return xm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Xt.arraySlice(r,s,o),this.values=Xt.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,n=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(n!==void 0&&Xt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=Xt.arraySlice(this.times),t=Xt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===xm,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(n)l=!0;else{let h=a*r,f=h-r,d=h+r;for(let p=0;p!==r;++p){let m=t[h+p];if(m!==t[f+p]||m!==t[d+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let h=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Xt.arraySlice(e,0,o),this.values=Xt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Xt.arraySlice(this.times,0),t=Xt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};kn.prototype.TimeBufferType=Float32Array;kn.prototype.ValueBufferType=Float32Array;kn.prototype.DefaultInterpolation=uf;var Fs=class extends kn{};Fs.prototype.ValueTypeName="bool";Fs.prototype.ValueBufferType=Array;Fs.prototype.DefaultInterpolation=cf;Fs.prototype.InterpolantFactoryMethodLinear=void 0;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Nf=class extends kn{};Nf.prototype.ValueTypeName="color";var Ga=class extends kn{};Ga.prototype.ValueTypeName="number";var Cg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let u=c+a;c!==u;c+=4)Ut.slerpFlat(s,0,o,c-a,o,c,l);return s}},Po=class extends kn{InterpolantFactoryMethodLinear(e){return new Cg(this.times,this.values,this.getValueSize(),e)}};Po.prototype.ValueTypeName="quaternion";Po.prototype.DefaultInterpolation=uf;Po.prototype.InterpolantFactoryMethodSmooth=void 0;var Us=class extends kn{};Us.prototype.ValueTypeName="string";Us.prototype.ValueBufferType=Array;Us.prototype.DefaultInterpolation=cf;Us.prototype.InterpolantFactoryMethodLinear=void 0;Us.prototype.InterpolantFactoryMethodSmooth=void 0;var ka=class extends kn{};ka.prototype.ValueTypeName="vector";var Of=class{constructor(e,t=-1,r,n=Kg){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Fn(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(zP(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(kn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){let s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);let u=Xt.getKeyframeOrder(l);l=Xt.sortedArray(l,1,u),c=Xt.sortedArray(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Ga(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],u=c.name.match(s);if(u&&u.length>1){let h=u[1],f=n[h];f||(n[h]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(h,f,d,p,m){if(d.length!==0){let g=[],v=[];Xt.flattenJSON(d,g,v,p),g.length!==0&&m.push(new h(f,g,v))}},n=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let h=0;h<c.length;h++){let f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let m=0;m<f[p].morphTargets.length;m++)d[f[p].morphTargets[m]]=-1;for(let m in d){let g=[],v=[];for(let y=0;y!==f[p].morphTargets.length;++y){let w=f[p];g.push(w.time),v.push(w.morphTarget===m?1:0)}n.push(new Ga(".morphTargetInfluence["+m+"]",g,v))}l=d.length*o}else{let d=".bones["+t[h].name+"]";r(ka,d+".position",f,"pos",n),r(Po,d+".quaternion",f,"rot",n),r(ka,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function UP(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ga;case"vector":case"vector2":case"vector3":case"vector4":return ka;case"color":return Nf;case"quaternion":return Po;case"bool":case"boolean":return Fs;case"string":return Us}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function zP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=UP(i.type);if(i.times===void 0){let t=[],r=[];Xt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var Va={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Io=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(u){a++,s===!1&&n.onStart!==void 0&&n.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,n.onProgress!==void 0&&n.onProgress(u,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(u){n.onError!==void 0&&n.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){let h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){let d=c[h],p=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null}}},GP=new Io,an=class{constructor(e){this.manager=e!==void 0?e:GP,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Qi={},is=class extends an{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=Va.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:r,onError:n});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Qi[e],h=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,m=0,g=new ReadableStream({start(v){y();function y(){h.read().then(({done:w,value:b})=>{if(w)v.close();else{m+=b.byteLength;let S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let T=0,A=u.length;T<A;T++){let x=u[T];x.onProgress&&x.onProgress(S)}v.enqueue(b),y()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{Va.add(e,c);let u=Qi[e];delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onLoad&&d.onLoad(c)}}).catch(c=>{let u=Qi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Ff=class extends an{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Va.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){u(),Va.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),n&&n(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=new Rs,o=new Ff(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Dg=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=new _t,o=new Ff(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,n),s}},yn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};yn.prototype.isLight=!0;var zs=class extends yn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return yn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};zs.prototype.isHemisphereLight=!0;var H0=new _e,W0=new M,j0=new M,ou=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new N(512,512),this.map=null,this.mapPass=null,this.matrix=new _e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Pa,this._frameExtents=new N(1,1),this._viewportCount=1,this._viewports=[new Ke(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;W0.setFromMatrixPosition(e.matrixWorld),t.position.copy(W0),j0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(j0),t.updateMatrixWorld(),H0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(H0),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Uf=class extends ou{constructor(){super(new nr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Uf.prototype.isSpotLightShadow=!0;var au=class extends yn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Uf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};au.prototype.isSpotLight=!0;var q0=new _e,Rc=new M,Km=new M,zf=class extends ou{constructor(){super(new nr(90,1,.5,500)),this._frameExtents=new N(4,2),this._viewportCount=6,this._viewports=[new Ke(2,1,1,1),new Ke(0,1,1,1),new Ke(3,1,1,1),new Ke(1,1,1,1),new Ke(3,0,1,1),new Ke(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rc),Km.copy(r.position),Km.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Km),r.updateMatrixWorld(),n.makeTranslation(-Rc.x,-Rc.y,-Rc.z),q0.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(q0)}};zf.prototype.isPointLightShadow=!0;var lu=class extends yn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new zf}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}};lu.prototype.isPointLight=!0;var Gf=class extends ou{constructor(){super(new To(-5,5,5,-5,.5,500))}};Gf.prototype.isDirectionalLightShadow=!0;var cu=class extends yn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Gf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};cu.prototype.isDirectionalLight=!0;var Pg=class extends yn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Pg.prototype.isAmbientLight=!0;var Ig=class extends yn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Ig.prototype.isRectAreaLight=!0;var kf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};kf.prototype.isSphericalHarmonics3=!0;var uu=class extends yn{constructor(e=new kf,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};uu.prototype.isLightProbe=!0;var Rg=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Vf=class extends Ie{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Vf.prototype.isInstancedBufferGeometry=!0;var Gs=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,p){if(t[p]!==void 0)return t[p];let g=d.interleavedBuffers[p],v=s(d,g.buffer),y=Th(g.type,v),w=new rs(y,g.stride);return w.uuid=g.uuid,t[p]=w,w}function s(d,p){if(r[p]!==void 0)return r[p];let g=d.arrayBuffers[p],v=new Uint32Array(g).buffer;return r[p]=v,v}let o=e.isInstancedBufferGeometry?new Vf:new Ie,a=e.data.index;if(a!==void 0){let d=Th(a.type,a.array);o.setIndex(new Ue(d,1))}let l=e.data.attributes;for(let d in l){let p=l[d],m;if(p.isInterleavedBufferAttribute){let g=n(e.data,p.data);m=new Ai(g,p.itemSize,p.offset,p.normalized)}else{let g=Th(p.type,p.array),v=p.isInstancedBufferAttribute?Ia:Ue;m=new v(g,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),p.updateRange!==void 0&&(m.updateRange.offset=p.updateRange.offset,m.updateRange.count=p.updateRange.count),o.setAttribute(d,m)}let c=e.data.morphAttributes;if(c)for(let d in c){let p=c[d],m=[];for(let g=0,v=p.length;g<v;g++){let y=p[g],w;if(y.isInterleavedBufferAttribute){let b=n(e.data,y.data);w=new Ai(b,y.itemSize,y.offset,y.normalized)}else{let b=Th(y.type,y.array);w=new Ue(b,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),m.push(w)}o.morphAttributes[d]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,p=h.length;d!==p;++d){let m=h[d];o.addGroup(m.start,m.count,m.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new M;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Yr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Bg=class extends an{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Va.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Va.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Bg.prototype.isImageBitmapLoader=!0;var rf,kP={getContext:function(){return rf===void 0&&(rf=new(window.AudioContext||window.webkitAudioContext)),rf},setContext:function(i){rf=i}},Ng=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let l=a.slice(0);kP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Og=class extends uu{constructor(e,t,r=1){super(void 0,r);let n=new xe().set(e),s=new xe().set(t),o=new M(n.r,n.g,n.b),a=new M(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}};Og.prototype.isHemisphereLightProbe=!0;var Fg=class extends uu{constructor(e,t=1){super(void 0,t);let r=new xe().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};Fg.prototype.isAmbientLightProbe=!0;var Hf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Y0(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=Y0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Y0(){return(typeof performance>"u"?Date:performance).now()}var Ug=class extends ot{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}};var zg=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}},Gg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let l=t*this._origIndex;this._mixBufferRegion(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){Ut.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ut.multiplyQuaternionsFlat(e,o,e,t,e,r),Ut.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ty="\\[\\]\\.:\\/",VP=new RegExp("["+ty+"]","g"),ry="[^"+ty+"]",HP="[^"+ty.replace("\\.","")+"]",WP=/((?:WC+[\/:])*)/.source.replace("WC",ry),jP=/(WCOD+)?/.source.replace("WCOD",HP),qP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ry),YP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ry),XP=new RegExp("^"+WP+jP+qP+YP+"$"),JP=["material","materials","bones"],kg=class{constructor(e,t,r){let n=r||xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},xt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||xt.parseTrackName(t),this.node=xt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new xt.Composite(e,t,r):new xt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(VP,"")}static parseTrackName(e){let t=XP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);JP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=xt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let c=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(n==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};xt.Composite=kg;xt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};xt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};xt.prototype.GetterByBindingType=[xt.prototype._getValue_direct,xt.prototype._getValue_array,xt.prototype._getValue_arrayElement,xt.prototype._getValue_toArray];xt.prototype.SetterByBindingTypeAndVersioning=[[xt.prototype._setValue_direct,xt.prototype._setValue_direct_setNeedsUpdate,xt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_array,xt.prototype._setValue_array_setNeedsUpdate,xt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_arrayElement,xt.prototype._setValue_arrayElement_setNeedsUpdate,xt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_fromArray,xt.prototype._setValue_fromArray_setNeedsUpdate,xt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vg=class{constructor(){this.uuid=Fn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,r=this._paths,n=this._parsedPaths,s=this._bindings,o=s.length,a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let f=arguments[u],d=f.uuid,p=t[d];if(p===void 0){p=l++,t[d]=p,e.push(f);for(let m=0,g=o;m!==g;++m)s[m].push(new xt(f,r[m],n[m]))}else if(p<c){a=e[p];let m=--c,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=f;for(let v=0,y=o;v!==y;++v){let w=s[v],b=w[m],S=w[p];w[p]=b,S===void 0&&(S=new xt(f,r[v],n[v])),w[m]=S}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){let h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,p=n;d!==p;++d){let m=r[d],g=m[h],v=m[u];m[u]=g,m[h]=v}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){let f=--s,d=e[f],p=--o,m=e[p];t[d.uuid]=h,e[h]=d,t[m.uuid]=f,e[f]=m,e.pop();for(let g=0,v=n;g!==v;++g){let y=r[g],w=y[f],b=y[p];y[h]=w,y[f]=b,y.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let p=0,m=n;p!==m;++p){let g=r[p];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){let p=l[f];h[f]=new xt(p,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Vg.prototype.isAnimationObjectGroup=!0;var Hg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Ma,endingEnd:Ma};for(let c=0;c!==o;++c){let u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=lE,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=t/o,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*l}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Kg:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===cE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===aE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Aa,n.endingEnd=Aa):(e?n.endingStart=this.zeroSlopeAtStart?Aa:Ma:n.endingStart=hf,t?n.endingEnd=this.zeroSlopeAtEnd?Aa:Ma:n.endingEnd=hf)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},Wg=class extends jt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){let f=n[h],d=f.name,p=u[d];if(p!==void 0)++p.referenceCount,o[h]=p;else{if(p=o[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}let m=t&&t._propertyBindings[h].binding.parsedPath;p=new Gg(xt.create(r,d,m),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){let n=this._actions,s=this._actionsByClip,o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{let a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;let h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Bf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Of.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=Kg),l!==void 0){let h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Hg(this,o,t,r);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Of.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,e,s,o);let a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,r=e.uuid,n=this._actionsByClip,s=n[r];if(s!==void 0){let o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};Wg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Ee=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Ee(this.value.clone===void 0?this.value:this.value.clone())}},jg=class extends rs{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};jg.prototype.isInstancedInterleavedBuffer=!0;var qg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};qg.prototype.isGLBufferAttribute=!0;var Wf=class{constructor(e,t,r=0,n=1/0){this.ray=new ii(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Yg(e,this,r,t),r.sort(X0),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Yg(e[n],this,r,t);return r.sort(X0),r}};function X0(i,e){return i.distance-e.distance}function Yg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Yg(n[s],e,t,!0)}}var hu=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(yr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var J0=new N,Ro=class{constructor(e=new N(1/0,1/0),t=new N(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=J0.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return J0.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Ro.prototype.isBox2=!0;var Q0=new M,nf=new M,Xr=class{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Q0.subVectors(e,this.start),nf.subVectors(this.end,this.start);let r=nf.dot(nf),s=nf.dot(Q0)/r;return t&&(s=yr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},K0=new M,jf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Ie,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}r.setAttribute("position",new Le(n,3));let s=new Ur({fog:!1,toneMapped:!1});this.cone=new oi(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),K0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(K0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},As=new M,sf=new _e,Zm=new _e,Xg=class extends oi{constructor(e){let t=Sb(e),r=new Ie,n=[],s=[],o=new xe(0,0,1),a=new xe(0,1,0);for(let c=0;c<t.length;c++){let u=t[c];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Le(n,3)),r.setAttribute("color",new Le(s,3));let l=new Ur({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,r=this.geometry,n=r.getAttribute("position");Zm.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(sf.multiplyMatrices(Zm,a.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o,As.x,As.y,As.z),sf.multiplyMatrices(Zm,a.parent.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o+1,As.x,As.y,As.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Sb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Sb(i.children[t]));return e}var qf=class extends Gt{constructor(e,t,r){let n=new Do(t,4,2),s=new Un({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}};var Jg=class extends oi{constructor(e=10,t=10,r=4473924,n=8947848){r=new xe(r),n=new xe(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,p=-a;f<=t;f++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);let m=f===s?r:n;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}let u=new Ie;u.setAttribute("position",new Le(l,3)),u.setAttribute("color",new Le(c,3));let h=new Ur({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}};var Z0=new M,of=new M,$0=new M,Yf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Ie;n.setAttribute("position",new Le([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new Ur({fog:!1,toneMapped:!1});this.lightPlane=new ns(n,s),this.add(this.lightPlane),n=new Ie,n.setAttribute("position",new Le([0,0,0,0,0,1],3)),this.targetLine=new ns(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Z0.setFromMatrixPosition(this.light.matrixWorld),of.setFromMatrixPosition(this.light.target.matrixWorld),$0.subVectors(of,Z0),this.lightPlane.lookAt(of),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(of),this.targetLine.scale.z=$0.length()}},af=new M,rr=new zn,Vn=class extends oi{constructor(e){let t=new Ie,r=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new xe(16755200),l=new xe(16711680),c=new xe(43775),u=new xe(16777215),h=new xe(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(p,m,g){d(p,g),d(m,g)}function d(p,m){n.push(0,0,0),s.push(m.r,m.g,m.b),o[p]===void 0&&(o[p]=[]),o[p].push(n.length/3-1)}t.setAttribute("position",new Le(n,3)),t.setAttribute("color",new Le(s,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,t=this.pointMap,r=1,n=1;rr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ar("c",t,e,rr,0,0,-1),ar("t",t,e,rr,0,0,1),ar("n1",t,e,rr,-r,-n,-1),ar("n2",t,e,rr,r,-n,-1),ar("n3",t,e,rr,-r,n,-1),ar("n4",t,e,rr,r,n,-1),ar("f1",t,e,rr,-r,-n,1),ar("f2",t,e,rr,r,-n,1),ar("f3",t,e,rr,-r,n,1),ar("f4",t,e,rr,r,n,1),ar("u1",t,e,rr,r*.7,n*1.1,-1),ar("u2",t,e,rr,-r*.7,n*1.1,-1),ar("u3",t,e,rr,0,n*2,-1),ar("cf1",t,e,rr,-r,0,1),ar("cf2",t,e,rr,r,0,1),ar("cf3",t,e,rr,0,-n,1),ar("cf4",t,e,rr,0,n,1),ar("cn1",t,e,rr,-r,0,-1),ar("cn2",t,e,rr,r,0,-1),ar("cn3",t,e,rr,0,-n,-1),ar("cn4",t,e,rr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function ar(i,e,t,r,n,s,o){af.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],af.x,af.y,af.z)}}var Bo=class extends oi{constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ie;s.setIndex(new Ue(r,1)),s.setAttribute("position",new Le(n,3)),super(s,new Ur({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}};var Xf=class extends oi{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Ie;n.setAttribute("position",new Le(t,3)),n.setAttribute("color",new Le(r,3));let s=new Ur({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new xe,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Jf=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ra,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(y){let w=[];for(let b=0,S=y.length;b<S;b++){let T=y[b],A=new en;A.curves=T.curves,w.push(A)}return w}function n(y,w){let b=w.length,S=!1;for(let T=b-1,A=0;A<b;T=A++){let x=w[T],E=w[A],_=E.x-x.x,C=E.y-x.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(x=w[A],_=-_,E=w[T],C=-C),y.y<x.y||y.y>E.y)continue;if(y.y===x.y){if(y.x===x.x)return!0}else{let P=C*(y.x-x.x)-_*(y.y-x.y);if(P===0)return!0;if(P<0)continue;S=!S}}else{if(y.y!==x.y)continue;if(E.x<=y.x&&y.x<=x.x||x.x<=y.x&&y.x<=E.x)return!0}}return S}let s=ri.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,u=[];if(o.length===1)return l=o[0],c=new en,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;let f=[],d=[],p=[],m=0,g;d[m]=void 0,p[m]=[];for(let y=0,w=o.length;y<w;y++)l=o[y],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new en,p:g},d[m].s.curves=l.curves,h&&m++,p[m]=[]):p[m].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let y=!1,w=0;for(let b=0,S=d.length;b<S;b++)f[b]=[];for(let b=0,S=d.length;b<S;b++){let T=p[b];for(let A=0;A<T.length;A++){let x=T[A],E=!0;for(let _=0;_<d.length;_++)n(x.p,d[_].p)&&(b!==_&&w++,E?(E=!1,f[_].push(x)):y=!0);E&&f[b].push(x)}}w>0&&y===!1&&(p=f)}let v;for(let y=0,w=d.length;y<w;y++){c=d[y].s,u.push(c),v=p[y];for(let b=0,S=v.length;b<S;b++)c.holes.push(v[b].h)}return u}};var Mb=new ArrayBuffer(4),Hz=new Float32Array(Mb),Wz=new Uint32Array(Mb),wi=new Uint32Array(512),Si=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(wi[i]=0,wi[i|256]=32768,Si[i]=24,Si[i|256]=24):e<-14?(wi[i]=1024>>-e-14,wi[i|256]=1024>>-e-14|32768,Si[i]=-e-1,Si[i|256]=-e-1):e<=15?(wi[i]=e+15<<10,wi[i|256]=e+15<<10|32768,Si[i]=13,Si[i|256]=13):e<128?(wi[i]=31744,wi[i|256]=64512,Si[i]=24,Si[i|256]=24):(wi[i]=31744,wi[i|256]=64512,Si[i]=13,Si[i|256]=13)}var Ab=new Uint32Array(2048),fu=new Uint32Array(64),QP=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ab[i]=e|t}for(let i=1024;i<2048;++i)Ab[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fu[i]=i<<23;fu[31]=1199570944;fu[32]=2147483648;for(let i=33;i<63;++i)fu[i]=2147483648+(i-32<<23);fu[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(QP[i]=1024);gn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(gn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Ra.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Jg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Xg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};an.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Rg.extractUrlBase(i)};an.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Ro.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Ro.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Ro.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Ro.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Qt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Qt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Qt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Qt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};pn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Yr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Pa.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Xr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Nt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Nt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Nt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Nt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};_e.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};_e.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};_e.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};_e.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};_e.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};_e.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};_e.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};_e.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};_e.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};_e.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};_e.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};_e.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};_e.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};_e.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};_e.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Fr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ut.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ut.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};ii.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};ii.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};ii.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};en.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};en.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Os(this,i)};en.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Lo(this,i)};N.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};N.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};N.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};M.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};M.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};M.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};M.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};M.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ke.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Ke.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Gt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Gt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),ob},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});xf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};nr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(yn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ue.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===ff},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ff)}}});Ue.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};Ue.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ue.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ie.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Ie.prototype.addAttribute=function(i,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(i,new Ue(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Ie.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Ie.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Ie.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Ie.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Ie.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ie.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});rs.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};rs.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};nn.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Ee.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(cr.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===tb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(St.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Ct.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Ct.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Ct.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ct.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ct.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ct.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ct.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ct.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ct.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ct.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ct.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ct.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ct.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ct.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ct.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Ct.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ct.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ct.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ct.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ct.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ct.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ct.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ct.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ct.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ct.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:dn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(gb.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Ug.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Ng().load(i,function(r){e.setBuffer(r)}),this};zg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Xc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Xc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};es.crossOrigin=void 0;es.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Dg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};es.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Qf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:No}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=No);var qa=".",du=Symbol("target"),ny=Symbol("unsubscribe");function pu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Tb(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var _n=Array.isArray;function Oo(i){return typeof i=="symbol"}var KP={after:(i,e)=>_n(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>_n(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=qa),Oo(e)?i+e.toString():i+e):i,initial:i=>{if(_n(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(qa);return e===-1?"":i.slice(0,e)},last:i=>{if(_n(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(qa);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(_n(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(qa);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(qa,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},ln=KP;function iy(i){return typeof i=="object"&&typeof i.next=="function"}function sy(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[du].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function ed(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Oo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mu=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,ln.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ya(i){return toString.call(i)==="[object Object]"}function Xa(){return!0}function Vs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var td=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var ZP=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),oy={push:Xa,pop:Xa,shift:Xa,unshift:Xa,copyWithin:Vs,reverse:Vs,sort:Vs,splice:Vs,flat:Vs,fill:Vs},Eb=new Set([...td,...ZP,...Object.keys(oy)]);function Ja(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var ay=["keys","values","entries"],ly=new Set(["has","toString"]),cy={add:Ja,clear:Ja,delete:Ja,forEach:Ja},_b=new Set([...ly,...Object.keys(cy),...ay]);function Qa(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var $P=new Set([...ly,"get"]),uy={set:Qa,clear:Qa,delete:Qa,forEach:Qa},Cb=new Set([...$P,...Object.keys(uy),...ay]);var Dr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return td.has(e)}_shallowClone(e){let t=e;if(Ya(e))t=se({},e);else if(_n(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(_n(n)?this._onIsChanged=oy[t]:n instanceof Set?this._onIsChanged=cy[t]:n instanceof Map&&(this._onIsChanged=uy[t]),n):r}update(e,t,r){let n=ln.after(e,this._path);if(t!=="length"){let s=this.clone;ln.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],ln.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var Ka=class extends Dr{static isHandledMethod(e){return Eb.has(e)}};var gu=class extends Dr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var Za=class extends Dr{static isHandledMethod(e){return _b.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var $a=class extends Dr{static isHandledMethod(e){return Cb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var li=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ya(e)||_n(e)||pu(e)}static isHandledMethod(e,t){return Ya(e)?Dr.isHandledMethod(t):_n(e)?Ka.isHandledMethod(t):e instanceof Set?Za.isHandledMethod(t):e instanceof Map?$a.isHandledMethod(t):pu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Dr;_n(e)?n=Ka:e instanceof Date?n=gu:e instanceof Set?n=Za:e instanceof Map?n=$a:e instanceof WeakSet?n=yu:e instanceof WeakMap&&(n=vu),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=li.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var e2={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hy=(i,e,t={})=>{t=se(se({},e2),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mu(n),c=typeof t.onValidate=="function",u=new li(c),h=(y,w,b,S,T)=>!c||u.isCloning||t.onValidate(ln.concat(l.getPath(y),w),b,S,T)===!0,f=(y,w,b,S)=>{!ed(l,t,w)&&!(o&&l.isDetached(y,i))&&d(l.getPath(y),w,b,S)},d=(y,w,b,S,T)=>{u.isCloning?u.update(y,w,S):e(ln.concat(y,w),b,S,T)},p=y=>y&&(y[r]||y),m=(y,w,b,S)=>Tb(y)||b==="constructor"||s&&!li.isHandledMethod(w,b)||ed(l,t,b)||l.isGetInvariant(w,b)||o&&l.isDetached(w,i)?y:(S===void 0&&(S=l.getPath(w)),l.getProxy(y,ln.concat(S,b),g,r)),g={get(y,w,b){if(Oo(w)){if(w===r||w===du)return y;if(w===ny&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=pu(y)?Reflect.get(y,w):Reflect.get(y,w,b);return m(S,y,w)},set(y,w,b,S){b=p(b);let T=y[r]||y,A=T[w];if(n(A,b)&&w in y)return!0;let x=h(y,w,b,A);return x&&l.setProperty(T,w,b,S,A)?(f(y,w,y[w],A),!0):!x},defineProperty(y,w,b){if(!l.isSameDescriptor(b,y,w)){let S=y[w];h(y,w,b.value,S)&&l.defineProperty(y,w,b,S)&&f(y,w,b.value,S)}return!0},deleteProperty(y,w){if(!Reflect.has(y,w))return!0;let b=Reflect.get(y,w),S=h(y,w,void 0,b);return S&&l.deleteProperty(y,w,b)?(f(y,w,void 0,b),!0):!S},apply(y,w,b){let S=w[r]||w;if(l.isUnsubscribed)return Reflect.apply(y,S,b);if((a===!1||a!==!0&&!a.includes(y.name))&&li.isHandledType(S)){let T=ln.initial(l.getPath(y)),A=li.isHandledMethod(S,y.name);u.start(S,T,b);let x=Reflect.apply(y,u.preferredThisArg(y,w,S),A?b.map(C=>p(C)):b),E=u.isChanged(S,n),_=u.stop();if(li.isHandledType(x)&&A&&(w instanceof Map&&y.name==="get"&&(T=ln.concat(T,b[0])),x=l.getProxy(x,T,g)),E){let C={name:y.name,args:b,result:x},P=u.isCloning?ln.initial(T):T,B=u.isCloning?ln.last(T):"";h(ln.get(i,P),B,S,_,C)?d(P,B,S,_,C):u.undo(S)}return(w instanceof Map||w instanceof Set)&&iy(x)?sy(x,y,w,T,m):x}return Reflect.apply(y,w,b)}},v=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(v),c&&(t.onValidate=t.onValidate.bind(v)),v};hy.target=i=>i&&i[du]||i;hy.unsubscribe=i=>i[ny]||i;var fy=hy;var t2=typeof global=="object"&&global&&global.Object===Object&&global,rd=t2;var r2=typeof self=="object"&&self&&self.Object===Object&&self,n2=rd||r2||Function("return this")(),sr=n2;var i2=sr.Symbol,cn=i2;var Lb=Object.prototype,s2=Lb.hasOwnProperty,o2=Lb.toString,xu=cn?cn.toStringTag:void 0;function a2(i){var e=s2.call(i,xu),t=i[xu];try{i[xu]=void 0;var r=!0}catch{}var n=o2.call(i);return r&&(e?i[xu]=t:delete i[xu]),n}var Db=a2;var l2=Object.prototype,c2=l2.toString;function u2(i){return c2.call(i)}var Pb=u2;var h2="[object Null]",f2="[object Undefined]",Ib=cn?cn.toStringTag:void 0;function d2(i){return i==null?i===void 0?f2:h2:Ib&&Ib in Object(i)?Db(i):Pb(i)}var Cn=d2;function p2(i){return i!=null&&typeof i=="object"}var Jr=p2;var m2="[object Symbol]";function g2(i){return typeof i=="symbol"||Jr(i)&&Cn(i)==m2}var Hs=g2;function y2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var nd=y2;var v2=Array.isArray,zr=v2;var x2=1/0,Rb=cn?cn.prototype:void 0,Bb=Rb?Rb.toString:void 0;function Nb(i){if(typeof i=="string")return i;if(zr(i))return nd(i,Nb)+"";if(Hs(i))return Bb?Bb.call(i):"";var e=i+"";return e=="0"&&1/i==-x2?"-0":e}var Ob=Nb;var b2=/\s/;function w2(i){for(var e=i.length;e--&&b2.test(i.charAt(e)););return e}var Fb=w2;var S2=/^\s+/;function M2(i){return i&&i.slice(0,Fb(i)+1).replace(S2,"")}var Ub=M2;function A2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ur=A2;var zb=0/0,T2=/^[-+]0x[0-9a-f]+$/i,E2=/^0b[01]+$/i,_2=/^0o[0-7]+$/i,C2=parseInt;function L2(i){if(typeof i=="number")return i;if(Hs(i))return zb;if(ur(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=ur(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Ub(i);var t=E2.test(i);return t||_2.test(i)?C2(i.slice(2),t?2:8):T2.test(i)?zb:+i}var dy=L2;function D2(i){return i}var id=D2;var P2="[object AsyncFunction]",I2="[object Function]",R2="[object GeneratorFunction]",B2="[object Proxy]";function N2(i){if(!ur(i))return!1;var e=Cn(i);return e==I2||e==R2||e==P2||e==B2}var el=N2;var O2=sr["__core-js_shared__"],sd=O2;var Gb=function(){var i=/[^.]+$/.exec(sd&&sd.keys&&sd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function F2(i){return!!Gb&&Gb in i}var kb=F2;var U2=Function.prototype,z2=U2.toString;function G2(i){if(i!=null){try{return z2.call(i)}catch{}try{return i+""}catch{}}return""}var ss=G2;var k2=/[\\^$.*+?()[\]{}|]/g,V2=/^\[object .+?Constructor\]$/,H2=Function.prototype,W2=Object.prototype,j2=H2.toString,q2=W2.hasOwnProperty,Y2=RegExp("^"+j2.call(q2).replace(k2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X2(i){if(!ur(i)||kb(i))return!1;var e=el(i)?Y2:V2;return e.test(ss(i))}var Vb=X2;function J2(i,e){return i==null?void 0:i[e]}var Hb=J2;function Q2(i,e){var t=Hb(i,e);return Vb(t)?t:void 0}var vn=Q2;var K2=vn(sr,"WeakMap"),od=K2;var Wb=Object.create,Z2=function(){function i(){}return function(e){if(!ur(e))return{};if(Wb)return Wb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),jb=Z2;function $2(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var qb=$2;function eI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var ad=eI;var tI=800,rI=16,nI=Date.now;function iI(i){var e=0,t=0;return function(){var r=nI(),n=rI-(r-t);if(t=r,n>0){if(++e>=tI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Yb=iI;function sI(i){return function(){return i}}var Xb=sI;var oI=function(){try{var i=vn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),tl=oI;var aI=tl?function(i,e){return tl(i,"toString",{configurable:!0,enumerable:!1,value:Xb(e),writable:!0})}:id,Jb=aI;var lI=Yb(Jb),ld=lI;function cI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var Qb=cI;var uI=9007199254740991,hI=/^(?:0|[1-9]\d*)$/;function fI(i,e){var t=typeof i;return e=e==null?uI:e,!!e&&(t=="number"||t!="symbol"&&hI.test(i))&&i>-1&&i%1==0&&i<e}var cd=fI;function dI(i,e,t){e=="__proto__"&&tl?tl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var rl=dI;function pI(i,e){return i===e||i!==i&&e!==e}var Ws=pI;var mI=Object.prototype,gI=mI.hasOwnProperty;function yI(i,e,t){var r=i[e];(!(gI.call(i,e)&&Ws(r,t))||t===void 0&&!(e in i))&&rl(i,e,t)}var ud=yI;function vI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?rl(t,a,l):ud(t,a,l)}return t}var Hn=vI;var Kb=Math.max;function xI(i,e,t){return e=Kb(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Kb(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),qb(i,this,a)}}var hd=xI;function bI(i,e){return ld(hd(i,e,id),i+"")}var Zb=bI;var wI=9007199254740991;function SI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=wI}var fd=SI;function MI(i){return i!=null&&fd(i.length)&&!el(i)}var js=MI;function AI(i,e,t){if(!ur(t))return!1;var r=typeof e;return(r=="number"?js(t)&&cd(e,t.length):r=="string"&&e in t)?Ws(t[e],i):!1}var $b=AI;function TI(i){return Zb(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&$b(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var ew=TI;var EI=Object.prototype;function _I(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||EI;return i===t}var nl=_I;function CI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var tw=CI;var LI="[object Arguments]";function DI(i){return Jr(i)&&Cn(i)==LI}var py=DI;var rw=Object.prototype,PI=rw.hasOwnProperty,II=rw.propertyIsEnumerable,RI=py(function(){return arguments}())?py:function(i){return Jr(i)&&PI.call(i,"callee")&&!II.call(i,"callee")},Fo=RI;function BI(){return!1}var nw=BI;var ow=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iw=ow&&typeof module=="object"&&module&&!module.nodeType&&module,NI=iw&&iw.exports===ow,sw=NI?sr.Buffer:void 0,OI=sw?sw.isBuffer:void 0,FI=OI||nw,il=FI;var UI="[object Arguments]",zI="[object Array]",GI="[object Boolean]",kI="[object Date]",VI="[object Error]",HI="[object Function]",WI="[object Map]",jI="[object Number]",qI="[object Object]",YI="[object RegExp]",XI="[object Set]",JI="[object String]",QI="[object WeakMap]",KI="[object ArrayBuffer]",ZI="[object DataView]",$I="[object Float32Array]",eR="[object Float64Array]",tR="[object Int8Array]",rR="[object Int16Array]",nR="[object Int32Array]",iR="[object Uint8Array]",sR="[object Uint8ClampedArray]",oR="[object Uint16Array]",aR="[object Uint32Array]",qt={};qt[$I]=qt[eR]=qt[tR]=qt[rR]=qt[nR]=qt[iR]=qt[sR]=qt[oR]=qt[aR]=!0;qt[UI]=qt[zI]=qt[KI]=qt[GI]=qt[ZI]=qt[kI]=qt[VI]=qt[HI]=qt[WI]=qt[jI]=qt[qI]=qt[YI]=qt[XI]=qt[JI]=qt[QI]=!1;function lR(i){return Jr(i)&&fd(i.length)&&!!qt[Cn(i)]}var aw=lR;function cR(i){return function(e){return i(e)}}var sl=cR;var lw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bu=lw&&typeof module=="object"&&module&&!module.nodeType&&module,uR=bu&&bu.exports===lw,my=uR&&rd.process,hR=function(){try{var i=bu&&bu.require&&bu.require("util").types;return i||my&&my.binding&&my.binding("util")}catch{}}(),os=hR;var cw=os&&os.isTypedArray,fR=cw?sl(cw):aw,dd=fR;var dR=Object.prototype,pR=dR.hasOwnProperty;function mR(i,e){var t=zr(i),r=!t&&Fo(i),n=!t&&!r&&il(i),s=!t&&!r&&!n&&dd(i),o=t||r||n||s,a=o?tw(i.length,String):[],l=a.length;for(var c in i)(e||pR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||cd(c,l)))&&a.push(c);return a}var pd=mR;function gR(i,e){return function(t){return i(e(t))}}var md=gR;var yR=md(Object.keys,Object),uw=yR;var vR=Object.prototype,xR=vR.hasOwnProperty;function bR(i){if(!nl(i))return uw(i);var e=[];for(var t in Object(i))xR.call(i,t)&&t!="constructor"&&e.push(t);return e}var hw=bR;function wR(i){return js(i)?pd(i):hw(i)}var ol=wR;function SR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var fw=SR;var MR=Object.prototype,AR=MR.hasOwnProperty;function TR(i){if(!ur(i))return fw(i);var e=nl(i),t=[];for(var r in i)r=="constructor"&&(e||!AR.call(i,r))||t.push(r);return t}var dw=TR;function ER(i){return js(i)?pd(i,!0):dw(i)}var Ei=ER;var _R=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,CR=/^\w*$/;function LR(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Hs(i)?!0:CR.test(i)||!_R.test(i)||e!=null&&i in Object(e)}var pw=LR;var DR=vn(Object,"create"),as=DR;function PR(){this.__data__=as?as(null):{},this.size=0}var mw=PR;function IR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var gw=IR;var RR="__lodash_hash_undefined__",BR=Object.prototype,NR=BR.hasOwnProperty;function OR(i){var e=this.__data__;if(as){var t=e[i];return t===RR?void 0:t}return NR.call(e,i)?e[i]:void 0}var yw=OR;var FR=Object.prototype,UR=FR.hasOwnProperty;function zR(i){var e=this.__data__;return as?e[i]!==void 0:UR.call(e,i)}var vw=zR;var GR="__lodash_hash_undefined__";function kR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=as&&e===void 0?GR:e,this}var xw=kR;function al(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}al.prototype.clear=mw;al.prototype.delete=gw;al.prototype.get=yw;al.prototype.has=vw;al.prototype.set=xw;var gy=al;function VR(){this.__data__=[],this.size=0}var bw=VR;function HR(i,e){for(var t=i.length;t--;)if(Ws(i[t][0],e))return t;return-1}var qs=HR;var WR=Array.prototype,jR=WR.splice;function qR(i){var e=this.__data__,t=qs(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():jR.call(e,t,1),--this.size,!0}var ww=qR;function YR(i){var e=this.__data__,t=qs(e,i);return t<0?void 0:e[t][1]}var Sw=YR;function XR(i){return qs(this.__data__,i)>-1}var Mw=XR;function JR(i,e){var t=this.__data__,r=qs(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Aw=JR;function ll(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ll.prototype.clear=bw;ll.prototype.delete=ww;ll.prototype.get=Sw;ll.prototype.has=Mw;ll.prototype.set=Aw;var Ys=ll;var QR=vn(sr,"Map"),Xs=QR;function KR(){this.size=0,this.__data__={hash:new gy,map:new(Xs||Ys),string:new gy}}var Tw=KR;function ZR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Ew=ZR;function $R(i,e){var t=i.__data__;return Ew(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Js=$R;function eB(i){var e=Js(this,i).delete(i);return this.size-=e?1:0,e}var _w=eB;function tB(i){return Js(this,i).get(i)}var Cw=tB;function rB(i){return Js(this,i).has(i)}var Lw=rB;function nB(i,e){var t=Js(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Dw=nB;function cl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}cl.prototype.clear=Tw;cl.prototype.delete=_w;cl.prototype.get=Cw;cl.prototype.has=Lw;cl.prototype.set=Dw;var wu=cl;var iB="Expected a function";function yy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(iB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(yy.Cache||wu),t}yy.Cache=wu;var Pw=yy;var sB=500;function oB(i){var e=Pw(i,function(r){return t.size===sB&&t.clear(),r}),t=e.cache;return e}var Iw=oB;var aB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lB=/\\(\\)?/g,cB=Iw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(aB,function(t,r,n,s){e.push(n?s.replace(lB,"$1"):r||t)}),e}),Rw=cB;function uB(i){return i==null?"":Ob(i)}var Bw=uB;function hB(i,e){return zr(i)?i:pw(i,e)?[i]:Rw(Bw(i))}var ul=hB;var fB=1/0;function dB(i){if(typeof i=="string"||Hs(i))return i;var e=i+"";return e=="0"&&1/i==-fB?"-0":e}var gd=dB;function pB(i,e){e=ul(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[gd(e[t++])];return t&&t==r?i:void 0}var Nw=pB;function mB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var hl=mB;var Ow=cn?cn.isConcatSpreadable:void 0;function gB(i){return zr(i)||Fo(i)||!!(Ow&&i&&i[Ow])}var Fw=gB;function Uw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Fw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Uw(a,e-1,t,r,n):hl(n,a):r||(n[n.length]=a)}return n}var zw=Uw;function yB(i){var e=i==null?0:i.length;return e?zw(i,1):[]}var Gw=yB;function vB(i){return ld(hd(i,void 0,Gw),i+"")}var kw=vB;var xB=md(Object.getPrototypeOf,Object),fl=xB;var bB="[object Object]",wB=Function.prototype,SB=Object.prototype,Vw=wB.toString,MB=SB.hasOwnProperty,AB=Vw.call(Object);function TB(i){if(!Jr(i)||Cn(i)!=bB)return!1;var e=fl(i);if(e===null)return!0;var t=MB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Vw.call(t)==AB}var yd=TB;function EB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var Hw=EB;function _B(){this.__data__=new Ys,this.size=0}var Ww=_B;function CB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var jw=CB;function LB(i){return this.__data__.get(i)}var qw=LB;function DB(i){return this.__data__.has(i)}var Yw=DB;var PB=200;function IB(i,e){var t=this.__data__;if(t instanceof Ys){var r=t.__data__;if(!Xs||r.length<PB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wu(r)}return t.set(i,e),this.size=t.size,this}var Xw=IB;function dl(i){var e=this.__data__=new Ys(i);this.size=e.size}dl.prototype.clear=Ww;dl.prototype.delete=jw;dl.prototype.get=qw;dl.prototype.has=Yw;dl.prototype.set=Xw;var vd=dl;function RB(i,e){return i&&Hn(e,ol(e),i)}var Jw=RB;function BB(i,e){return i&&Hn(e,Ei(e),i)}var Qw=BB;var eS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kw=eS&&typeof module=="object"&&module&&!module.nodeType&&module,NB=Kw&&Kw.exports===eS,Zw=NB?sr.Buffer:void 0,$w=Zw?Zw.allocUnsafe:void 0;function OB(i,e){if(e)return i.slice();var t=i.length,r=$w?$w(t):new i.constructor(t);return i.copy(r),r}var xd=OB;function FB(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var tS=FB;function UB(){return[]}var bd=UB;var zB=Object.prototype,GB=zB.propertyIsEnumerable,rS=Object.getOwnPropertySymbols,kB=rS?function(i){return i==null?[]:(i=Object(i),tS(rS(i),function(e){return GB.call(i,e)}))}:bd,pl=kB;function VB(i,e){return Hn(i,pl(i),e)}var nS=VB;var HB=Object.getOwnPropertySymbols,WB=HB?function(i){for(var e=[];i;)hl(e,pl(i)),i=fl(i);return e}:bd,wd=WB;function jB(i,e){return Hn(i,wd(i),e)}var iS=jB;function qB(i,e,t){var r=e(i);return zr(i)?r:hl(r,t(i))}var Sd=qB;function YB(i){return Sd(i,ol,pl)}var sS=YB;function XB(i){return Sd(i,Ei,wd)}var Md=XB;var JB=vn(sr,"DataView"),Ad=JB;var QB=vn(sr,"Promise"),Td=QB;var KB=vn(sr,"Set"),Ed=KB;var oS="[object Map]",ZB="[object Object]",aS="[object Promise]",lS="[object Set]",cS="[object WeakMap]",uS="[object DataView]",$B=ss(Ad),eN=ss(Xs),tN=ss(Td),rN=ss(Ed),nN=ss(od),Uo=Cn;(Ad&&Uo(new Ad(new ArrayBuffer(1)))!=uS||Xs&&Uo(new Xs)!=oS||Td&&Uo(Td.resolve())!=aS||Ed&&Uo(new Ed)!=lS||od&&Uo(new od)!=cS)&&(Uo=function(i){var e=Cn(i),t=e==ZB?i.constructor:void 0,r=t?ss(t):"";if(r)switch(r){case $B:return uS;case eN:return oS;case tN:return aS;case rN:return lS;case nN:return cS}return e});var ml=Uo;var iN=Object.prototype,sN=iN.hasOwnProperty;function oN(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&sN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var hS=oN;var aN=sr.Uint8Array,vy=aN;function lN(i){var e=new i.constructor(i.byteLength);return new vy(e).set(new vy(i)),e}var gl=lN;function cN(i,e){var t=e?gl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var fS=cN;var uN=/\w*$/;function hN(i){var e=new i.constructor(i.source,uN.exec(i));return e.lastIndex=i.lastIndex,e}var dS=hN;var pS=cn?cn.prototype:void 0,mS=pS?pS.valueOf:void 0;function fN(i){return mS?Object(mS.call(i)):{}}var gS=fN;function dN(i,e){var t=e?gl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var _d=dN;var pN="[object Boolean]",mN="[object Date]",gN="[object Map]",yN="[object Number]",vN="[object RegExp]",xN="[object Set]",bN="[object String]",wN="[object Symbol]",SN="[object ArrayBuffer]",MN="[object DataView]",AN="[object Float32Array]",TN="[object Float64Array]",EN="[object Int8Array]",_N="[object Int16Array]",CN="[object Int32Array]",LN="[object Uint8Array]",DN="[object Uint8ClampedArray]",PN="[object Uint16Array]",IN="[object Uint32Array]";function RN(i,e,t){var r=i.constructor;switch(e){case SN:return gl(i);case pN:case mN:return new r(+i);case MN:return fS(i,t);case AN:case TN:case EN:case _N:case CN:case LN:case DN:case PN:case IN:return _d(i,t);case gN:return new r;case yN:case bN:return new r(i);case vN:return dS(i);case xN:return new r;case wN:return gS(i)}}var yS=RN;function BN(i){return typeof i.constructor=="function"&&!nl(i)?jb(fl(i)):{}}var Cd=BN;var NN="[object Map]";function ON(i){return Jr(i)&&ml(i)==NN}var vS=ON;var xS=os&&os.isMap,FN=xS?sl(xS):vS,bS=FN;var UN="[object Set]";function zN(i){return Jr(i)&&ml(i)==UN}var wS=zN;var SS=os&&os.isSet,GN=SS?sl(SS):wS,MS=GN;var kN=1,VN=2,HN=4,AS="[object Arguments]",WN="[object Array]",jN="[object Boolean]",qN="[object Date]",YN="[object Error]",TS="[object Function]",XN="[object GeneratorFunction]",JN="[object Map]",QN="[object Number]",ES="[object Object]",KN="[object RegExp]",ZN="[object Set]",$N="[object String]",e3="[object Symbol]",t3="[object WeakMap]",r3="[object ArrayBuffer]",n3="[object DataView]",i3="[object Float32Array]",s3="[object Float64Array]",o3="[object Int8Array]",a3="[object Int16Array]",l3="[object Int32Array]",c3="[object Uint8Array]",u3="[object Uint8ClampedArray]",h3="[object Uint16Array]",f3="[object Uint32Array]",Vt={};Vt[AS]=Vt[WN]=Vt[r3]=Vt[n3]=Vt[jN]=Vt[qN]=Vt[i3]=Vt[s3]=Vt[o3]=Vt[a3]=Vt[l3]=Vt[JN]=Vt[QN]=Vt[ES]=Vt[KN]=Vt[ZN]=Vt[$N]=Vt[e3]=Vt[c3]=Vt[u3]=Vt[h3]=Vt[f3]=!0;Vt[YN]=Vt[TS]=Vt[t3]=!1;function Ld(i,e,t,r,n,s){var o,a=e&kN,l=e&VN,c=e&HN;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!ur(i))return i;var u=zr(i);if(u){if(o=hS(i),!a)return ad(i,o)}else{var h=ml(i),f=h==TS||h==XN;if(il(i))return xd(i,a);if(h==ES||h==AS||f&&!n){if(o=l||f?{}:Cd(i),!a)return l?iS(i,Qw(o,i)):nS(i,Jw(o,i))}else{if(!Vt[h])return n?i:{};o=yS(i,h,a)}}s||(s=new vd);var d=s.get(i);if(d)return d;s.set(i,o),MS(i)?i.forEach(function(g){o.add(Ld(g,e,t,g,i,s))}):bS(i)&&i.forEach(function(g,v){o.set(v,Ld(g,e,t,v,i,s))});var p=c?l?Md:sS:l?Ei:ol,m=u?void 0:p(i);return Qb(m||i,function(g,v){m&&(v=g,g=i[v]),ud(o,v,Ld(g,e,t,v,i,s))}),o}var Dd=Ld;var d3=1,p3=4;function m3(i){return Dd(i,d3|p3)}var Su=m3;function g3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var _S=g3;var y3=_S(),CS=y3;var v3=function(){return sr.Date.now()},Pd=v3;var x3="Expected a function",b3=Math.max,w3=Math.min;function S3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,h=!1,f=!0;if(typeof i!="function")throw new TypeError(x3);e=dy(e)||0,ur(t)&&(u=!!t.leading,h="maxWait"in t,s=h?b3(dy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(T){var A=r,x=n;return r=n=void 0,c=T,o=i.apply(x,A),o}function p(T){return c=T,a=setTimeout(v,e),u?d(T):o}function m(T){var A=T-l,x=T-c,E=e-A;return h?w3(E,s-x):E}function g(T){var A=T-l,x=T-c;return l===void 0||A>=e||A<0||h&&x>=s}function v(){var T=Pd();if(g(T))return y(T);a=setTimeout(v,m(T))}function y(T){return a=void 0,f&&r?d(T):(r=n=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:y(Pd())}function S(){var T=Pd(),A=g(T);if(r=arguments,n=this,l=T,A){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(v,e),d(l)}return a===void 0&&(a=setTimeout(v,e)),o}return S.cancel=w,S.flush=b,S}var Mu=S3;function M3(i,e,t){(t!==void 0&&!Ws(i[e],t)||t===void 0&&!(e in i))&&rl(i,e,t)}var Au=M3;function A3(i){return Jr(i)&&js(i)}var LS=A3;function T3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Tu=T3;function E3(i){return Hn(i,Ei(i))}var DS=E3;function _3(i,e,t,r,n,s,o){var a=Tu(i,t),l=Tu(e,t),c=o.get(l);if(c){Au(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,h=u===void 0;if(h){var f=zr(l),d=!f&&il(l),p=!f&&!d&&dd(l);u=l,f||d||p?zr(a)?u=a:LS(a)?u=ad(a):d?(h=!1,u=xd(l,!0)):p?(h=!1,u=_d(l,!0)):u=[]:yd(l)||Fo(l)?(u=a,Fo(a)?u=DS(a):(!ur(a)||el(a))&&(u=Cd(l))):h=!1}h&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Au(i,t,u)}var PS=_3;function IS(i,e,t,r,n){i!==e&&CS(e,function(s,o){if(n||(n=new vd),ur(s))PS(i,e,o,t,IS,r,n);else{var a=r?r(Tu(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Au(i,o,a)}},Ei)}var RS=IS;function C3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var BS=C3;function L3(i,e){return e.length<2?i:Nw(i,Hw(e,0,-1))}var NS=L3;var D3=ew(function(i,e,t){RS(i,e,t)}),zo=D3;function P3(i,e){return e=ul(e,i),i=NS(i,e),i==null||delete i[gd(BS(e))]}var OS=P3;function I3(i){return yd(i)?void 0:i}var FS=I3;var R3=1,B3=2,N3=4,O3=kw(function(i,e){var t={};if(i==null)return t;var r=!1;e=nd(e,function(s){return s=ul(s,i),r||(r=s.length>1),s}),Hn(i,Md(i),t),r&&(t=Dd(t,R3|B3|N3,FS));for(var n=e.length;n--;)OS(t,e[n]);return t}),yl=O3;var F3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),U3=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),z3=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eu&&"ontouchend"in document,G3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,k3=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,V3=()=>{let i=navigator.userAgent,e=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(e)},Tj=F3(),Eu=U3(),_u=z3(),US=G3(),Id=k3(),zS=V3();function GS(i){return Array.isArray(i)?i:[i]}function Cu(i){return Eu?i.metaKey:i.ctrlKey}var Qs;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(Qs||(Qs={}));var Go;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(Go||(Go={}));var ls;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(ls||(ls={}));var vr;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(vr||(vr={}));var Lu;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Lu||(Lu={}));var _i;(s=>{s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(o,a){for(let l=0;l<16;l++)if(o[l]!==a[l])return!1;return!0}s.isEqual=e;function t(o){return o!=null?o:s.identity}s.simplify=t;function r(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3){let h=1/(o[3]*a[c]+o[7]*a[c+1]+o[11]*a[c+2]+o[15]);l[c]=(o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2]+o[12])*h,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*h,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*h}return l}s.applyMatrix4=r;function n(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3)l[c]=o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2],l[c+1]=o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2],l[c+2]=o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2];return l}s.applyMatrix3Components=n})(_i||(_i={}));var Sr;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,u){return c.r===u.r&&c.g===u.g&&c.b===u.b}l.equals=o;function a(c,u,h){return{r:c.r+(u.r-c.r)*h,g:c.g+(u.g-c.g)*h,b:c.b+(u.b-c.b)*h}}l.lerp=a})(Sr||(Sr={}));var Ln;(o=>{o.white=be(se({},Sr.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return be(se({},Sr.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Sr.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Rd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Rd||(Rd={}));var Bd;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Bd||(Bd={}));var Nd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Nd||(Nd={}));var Od;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Od||(Od={}));var Wn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=be(se({},r),{[e]:t});return Object.setPrototypeOf(s,Wn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=be(se({},t),{[s]:o});return Object.setPrototypeOf(a,Wn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=se({},t);return Object.setPrototypeOf(s,Wn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Du(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Du(r)}return Object.freeze(i)}function kS(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var Fd=class extends Error{};function Ci(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function VS(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function HS(){return typeof process<"u"}function WS(i,e){for(let t of i)e(t.id,t.data),WS(t.children,e)}function jS(i,e){e(i.id,i.data);for(let t of i.children)jS(t,e)}var jn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,jn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t,r){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let n of t.children)this.fillCaches0(n,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&jS(n,r)}}traverse(t){WS(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(u=>u.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=be(se({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(u=>u.id===l);if(c<0)throw new Error;s=[...s],s[c]=be(se({},s[c]),{children:a})}Object.setPrototypeOf(s,jn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.get(s)!==void 0)return null;{let l=r,c=this.childrenArray(l),u={fi:n,id:s,data:o,children:a};return c=[...c,u],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:be(se({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new Fd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let u=l.splice(c,1)[0],h=this.modifyArrayBy(o,l);o=r,l=h.childrenArray(o);let f=u.fi;return u=be(se({},u),{fi:n}),l=[...l,u],l.sort((d,p)=>d.fi-p.fi),t.localIndex=l.indexOf(u),h=h.modifyArrayBy(o,l),{data:h,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(se(se({},n),s))}r.sort((n,s)=>kS(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return be(se({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Ci(0,n,n);{let o=s[0].fi;return Ci(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ci(l,l+n,n)}else return Ci(o.fi,a.fi,n)}}};var Ud;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=se({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var er=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,er.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=be(se({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,er.prototype);let r=t;return HS()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:se({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(u=>u.id===n);if(o===-1)return null;let a=s[o].fi,l=be(se({},s[o]),{fi:r});return s[o]=l,s.sort((u,h)=>u.fi-h.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Ci(0,r,r);{let s=n[0].fi;return Ci(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Ci(a,a+r,r)}else return Ci(s.fi,o.fi,r)}}};var qS=Symbol(),Gd=Symbol(),vl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof zd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Gd];r&&r(),delete this._children[e]}}}},by=class extends vl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=be(se({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},wy=class extends vl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=be(se({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,Wn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},YS={get(i,e){if(e===Gd)return()=>{i._parent=null};if(e===qS)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=kd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},H3=be(se({},YS),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ay(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),W3=be(se({},YS),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),xl=class extends vl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},bl=class extends vl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return be(se({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function xy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Vd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(be(se({},e),{path:t}))}var zd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){xy(this.ts,t,e),xy(this.actual,r,e),xy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function kd(i,e,t){return t instanceof jn?new xl(i,e,t):t instanceof er?new bl(i,e,t):t instanceof Wn?new Proxy(new wy(i,e,t),W3):t!==null&&typeof t=="object"?VS(t)?t:new Proxy(new by(i,e,t),H3):t}function Sy(i){let e=new zd(i);return[kd(e,"",i),e]}function My(i,e){let[t,r]=Sy(i);return e(t),r.result()}function Ay(i){return i instanceof xl||i instanceof bl?i._current:i!==null&&typeof i=="object"?i[qS]:i}var Vd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=se({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof jn||n instanceof xl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof er||n instanceof bl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Vd||(Vd={}));var Hd=class{},Pu=class extends Hd{constructor(t){super();this.id=t}},Iu=class extends Hd{constructor(t){super();this.data=t}};var Ey;try{Ey=new TextDecoder}catch{}var Re,Zs,ee=0;var tM=[],_y=tM,Cy=0,xn={},Et,Ks,qn=0,Li=0,Dn,cs,un=[],Pt,XS={useRecords:!1,mapsAsObjects:!0},Ru=class{},Dy=new Ru;Dy.name="MessagePack 0xC1";var wl=!1,Di=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return oM(()=>(jd(),this?this.unpack(e,t):Di.prototype.unpack.call(XS,e,t)));Zs=t>-1?t:e.length,ee=0,Cy=0,Li=0,Ks=null,_y=tM,Dn=null,Re=e;try{Pt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Di){if(xn=this,this.structures)return Et=this.structures,Wd();(!Et||Et.length>0)&&(Et=[])}else xn=XS,(!Et||Et.length>0)&&(Et=[]);return Wd()}unpackMultiple(e,t){let r,n=0;try{wl=!0;let s=e.length,o=this?this.unpack(e,s):Xd.unpack(e,s);if(t){for(t(o);ee<s;)if(n=ee,t(Wd())===!1)return}else{for(r=[o];ee<s;)n=ee,r.push(Wd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{wl=!1,jd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Wd(){try{if(!xn.trusted&&!wl){let e=Et.sharedLength||0;e<Et.length&&(Et.length=e)}let i=or();if(ee==Zs)Et.restoreStructures&&JS(),Et=null,Re=null,cs&&(cs=null);else if(ee>Zs){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!wl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Et.restoreStructures&&JS(),jd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function JS(){for(let i in Et.restoreStructures)Et[i]=Et.restoreStructures[i];Et.restoreStructures=null}function or(){let i=Re[ee++];if(i<160)if(i<128){if(i<64)return i;{let e=Et[i&63]||xn.getStructures&&rM()[i&63];return e?(e.read||(e.read=Py(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}else if(i<192){let e=i-160;if(Li>=ee)return Ks.slice(ee-qn,(ee+=e)-qn);if(Li==0&&Zs<140){let t=e<16?Iy(e):nM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return Dn?(e=or(),e>0?Dn[1].slice(Dn.position1,Dn.position1+=e):Dn[0].slice(Dn.position0,Dn.position0-=e)):Dy;case 194:return!1;case 195:return!0;case 196:return Ty(Re[ee++]);case 197:return e=Pt.getUint16(ee),ee+=2,Ty(e);case 198:return e=Pt.getUint32(ee),ee+=4,Ty(e);case 199:return ko(Re[ee++]);case 200:return e=Pt.getUint16(ee),ee+=2,ko(e);case 201:return e=Pt.getUint32(ee),ee+=4,ko(e);case 202:if(e=Pt.getFloat32(ee),xn.useFloat32>2){let t=Yd[(Re[ee]&127)<<1|Re[ee+1]>>7];return ee+=4,(t*e+(e>0?.5:-.5)>>0)/t}return ee+=4,e;case 203:return e=Pt.getFloat64(ee),ee+=8,e;case 204:return Re[ee++];case 205:return e=Pt.getUint16(ee),ee+=2,e;case 206:return e=Pt.getUint32(ee),ee+=4,e;case 207:return xn.int64AsNumber?(e=Pt.getUint32(ee)*4294967296,e+=Pt.getUint32(ee+4)):e=Pt.getBigUint64(ee),ee+=8,e;case 208:return Pt.getInt8(ee++);case 209:return e=Pt.getInt16(ee),ee+=2,e;case 210:return e=Pt.getInt32(ee),ee+=4,e;case 211:return xn.int64AsNumber?(e=Pt.getInt32(ee)*4294967296,e+=Pt.getUint32(ee+4)):e=Pt.getBigInt64(ee),ee+=8,e;case 212:if(e=Re[ee++],e==114)return eM(Re[ee++]&63);{let t=un[e];if(t)return t.read?(ee++,t.read(or())):t.noBuffer?(ee++,t()):t(Re.subarray(ee,++ee));throw new Error("Unknown extension "+e)}case 213:return e=Re[ee],e==114?(ee++,eM(Re[ee++]&63,Re[ee++])):ko(2);case 214:return ko(4);case 215:return ko(8);case 216:return ko(16);case 217:return e=Re[ee++],Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):q3(e);case 218:return e=Pt.getUint16(ee),ee+=2,Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):Y3(e);case 219:return e=Pt.getUint32(ee),ee+=4,Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):X3(e);case 220:return e=Pt.getUint16(ee),ee+=2,KS(e);case 221:return e=Pt.getUint32(ee),ee+=4,KS(e);case 222:return e=Pt.getUint16(ee),ee+=2,ZS(e);case 223:return e=Pt.getUint32(ee),ee+=4,ZS(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var j3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Py(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>j3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(or);return i.highByte===0&&(i.read=QS(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=or()}return r}return t.count=0,i.highByte===0?QS(e,t):t}var QS=(i,e)=>function(){let t=Re[ee++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Et[r]||rM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Py(n,i)),n.read()};function rM(){let i=oM(()=>(Re=null,xn.getStructures()));return Et=xn._mergeStructures(i,Et)}var Ly=qd,q3=qd,Y3=qd,X3=qd;function qd(i){let e;if(i<16&&(e=Iy(i)))return e;if(i>64&&Ey)return Ey.decode(Re.subarray(ee,ee+=i));let t=ee+i,r=[];for(e="";ee<t;){let n=Re[ee++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[ee++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[ee++]&63,o=Re[ee++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[ee++]&63,o=Re[ee++]&63,a=Re[ee++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Pr.apply(String,r),r.length=0)}return r.length>0&&(e+=Pr.apply(String,r)),e}function KS(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}function ZS(i){if(xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}}var Pr=String.fromCharCode;function nM(i){let e=ee,t=new Array(i);for(let r=0;r<i;r++){let n=Re[ee++];if((n&128)>0){ee=e;return}t[r]=n}return Pr.apply(String,t)}function Iy(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[ee++];if((e&128)>1){ee-=1;return}return Pr(e)}}else{let e=Re[ee++],t=Re[ee++];if((e&128)>0||(t&128)>0){ee-=2;return}if(i<3)return Pr(e,t);let r=Re[ee++];if((r&128)>0){ee-=3;return}return Pr(e,t,r)}else{let e=Re[ee++],t=Re[ee++],r=Re[ee++],n=Re[ee++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){ee-=4;return}if(i<6){if(i===4)return Pr(e,t,r,n);{let s=Re[ee++];if((s&128)>0){ee-=5;return}return Pr(e,t,r,n,s)}}else if(i<8){let s=Re[ee++],o=Re[ee++];if((s&128)>0||(o&128)>0){ee-=6;return}if(i<7)return Pr(e,t,r,n,s,o);let a=Re[ee++];if((a&128)>0){ee-=7;return}return Pr(e,t,r,n,s,o,a)}else{let s=Re[ee++],o=Re[ee++],a=Re[ee++],l=Re[ee++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ee-=8;return}if(i<10){if(i===8)return Pr(e,t,r,n,s,o,a,l);{let c=Re[ee++];if((c&128)>0){ee-=9;return}return Pr(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[ee++],u=Re[ee++];if((c&128)>0||(u&128)>0){ee-=10;return}if(i<11)return Pr(e,t,r,n,s,o,a,l,c,u);let h=Re[ee++];if((h&128)>0){ee-=11;return}return Pr(e,t,r,n,s,o,a,l,c,u,h)}else{let c=Re[ee++],u=Re[ee++],h=Re[ee++],f=Re[ee++];if((c&128)>0||(u&128)>0||(h&128)>0||(f&128)>0){ee-=12;return}if(i<14){if(i===12)return Pr(e,t,r,n,s,o,a,l,c,u,h,f);{let d=Re[ee++];if((d&128)>0){ee-=13;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d)}}else{let d=Re[ee++],p=Re[ee++];if((d&128)>0||(p&128)>0){ee-=14;return}if(i<15)return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,p);let m=Re[ee++];if((m&128)>0){ee-=15;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,p,m)}}}}}function Ty(i){return xn.copyBuffers?Uint8Array.prototype.slice.call(Re,ee,ee+=i):Re.subarray(ee,ee+=i)}function ko(i){let e=Re[ee++];if(un[e])return un[e](Re.subarray(ee,ee+=i));throw new Error("Unknown extension type "+e)}var $S=new Array(4096);function iM(){let i=Re[ee++];if(i>=160&&i<192){if(i=i-160,Li>=ee)return Ks.slice(ee-qn,(ee+=i)-qn);if(!(Li==0&&Zs<180))return Ly(i)}else return ee--,or();let e=(i<<5^(i>1?Pt.getUint16(ee):i>0?Re[ee]:0))&4095,t=$S[e],r=ee,n=ee+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Pt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return ee=r,t.string;n-=3,r=ee}for(t=[],$S[e]=t,t.bytes=i;r<n;)s=Pt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?Iy(i):nM(i);return a!=null?t.string=a:t.string=Ly(i)}var eM=(i,e)=>{var t=or();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Et[i];return n&&n.isShared&&((Et.restoreStructures||(Et.restoreStructures=[]))[i]=n),Et[i]=t,t.read=Py(t,r),t.read()},sM=typeof self=="object"?self:global;un[0]=()=>{};un[0].noBuffer=!0;un[101]=()=>{let i=or();return(sM[i[0]]||Error)(i[1])};un[105]=i=>{let e=Pt.getUint32(ee-4);cs||(cs=new Map);let t=Re[ee],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};cs.set(e,n);let s=or();return n.used?Object.assign(r,s):(n.target=s,s)};un[112]=i=>{let e=Pt.getUint32(ee-4),t=cs.get(e);return t.used=!0,t.target};un[115]=()=>new Set(or());var Ry=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");un[116]=i=>{let e=i[0],t=Ry[e];if(!t)throw new Error("Could not find typed array for code "+e);return new sM[t](Uint8Array.prototype.slice.call(i,1).buffer)};un[120]=()=>{let i=or();return new RegExp(i[0],i[1])};un[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=ee;ee+=e-4,Dn=[or(),or()],Dn.position0=0,Dn.position1=0;let r=ee;ee=t;try{return or()}finally{ee=r}};un[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function oM(i){let e=Zs,t=ee,r=Cy,n=qn,s=Li,o=Ks,a=_y,l=cs,c=Dn,u=new Uint8Array(Re.slice(0,Zs)),h=Et,f=Et.slice(0,Et.length),d=xn,p=wl,m=i();return Zs=e,ee=t,Cy=r,qn=n,Li=s,Ks=o,_y=a,cs=l,Dn=c,Re=u,wl=p,Et=h,Et.splice(0,Et.length,...f),xn=d,Pt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),m}function jd(){Re=null,cs=null,Et=null}function aM(i){i.unpack?un[i.type]=i.unpack:un[i.type]=i}var Yd=new Array(147);for(let i=0;i<256;i++)Yd[i]=+("1e"+Math.floor(45.15-i*.30103));var Xd=new Di({useRecords:!1}),J3=Xd.unpack,Q3=Xd.unpackMultiple,K3=Xd.unpack,Jd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Z3=new Float32Array(1),n9=new Uint8Array(Z3.buffer,0,4);var Qd;try{Qd=new TextEncoder}catch{}var Kd,Ny,Zd=typeof Buffer<"u",By=Zd?Buffer.allocUnsafeSlow:Uint8Array,hM=Zd?Buffer:Uint8Array,lM=Zd?4294967296:2144337920,de,hr,ae=0,Pi,Ii=null,$3=/[\u0080-\uFFFF]/,Bu=Symbol("record-id"),Vo=class extends Di{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=hM.prototype.utf8Write?function(x,E,_){return de.utf8Write(x,E,_)}:Qd&&Qd.encodeInto?function(x,E){return Qd.encodeInto(x,de.subarray(E)).written}:!1,u=this;e||(e={});let h=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let p=e.maxOwnStructures;p==null&&(p=f?32:64),h&&!e.saveStructures&&(this.structures=[]);let m=d>32||p+d>64,g=d+64,v=d+p+64;if(v>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],w=0,b=0;this.pack=this.encode=function(x,E){if(de||(de=new By(8192),hr=new DataView(de.buffer,0,8192),ae=0),Pi=de.length-10,Pi-ae<2048?(de=new By(de.length),hr=new DataView(de.buffer,0,de.length),Pi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=u.structuredClone?new Map:null,u.bundleStrings?(Ii=["",""],de[ae++]=214,de[ae++]=98,Ii.position=ae-r,ae+=4):Ii=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let _=n.sharedLength||0;if(_>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let C=0;C<_;C++){let P=n[C];if(!P)continue;let B,R=n.transitions;for(let U=0,z=P.length;U<z;U++){let J=P[U];B=R[J],B||(B=R[J]=Object.create(null)),R=B}R[Bu]=C+64}l=_}h||(n.nextId=_+64)}s&&(s=!1),o=n||[];try{if(S(x),Ii){hr.setUint32(Ii.position+r,ae-Ii.position-r);let _=Ii;Ii=null,S(_[0]),S(_[1])}if(u.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Pi&&A(ae),u.offset=ae;let _=tO(de.subarray(r,ae),a.idsToInsert);return a=null,_}return E&dM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,w>1e4)n.transitions=null,b=0,w=0,y.length>0&&(y=[]);else if(y.length>0&&!h){for(let _=0,C=y.length;_<C;_++)y[_][Bu]=0;y=[]}if(s&&u.saveStructures){let _=n.sharedLength||d;n.length>_&&(n=n.slice(0,_));let C=de.subarray(r,ae);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(x)):(l=_,C)}}E&lO&&(ae=r)}};let S=x=>{ae>Pi&&(de=A(ae));var E=typeof x,_;if(E==="string"){let C=x.length;if(Ii&&C>=8&&C<4096){let R=$3.test(x);Ii[R?0:1]+=x,de[ae++]=193,S(R?-C:C);return}let P;C<32?P=1:C<256?P=2:C<65536?P=3:P=5;let B=C*3;if(ae+B>Pi&&(de=A(ae+B)),C<64||!c){let R,U,z,J=ae+P;for(R=0;R<C;R++)U=x.charCodeAt(R),U<128?de[J++]=U:U<2048?(de[J++]=U>>6|192,de[J++]=U&63|128):(U&64512)===55296&&((z=x.charCodeAt(R+1))&64512)===56320?(U=65536+((U&1023)<<10)+(z&1023),R++,de[J++]=U>>18|240,de[J++]=U>>12&63|128,de[J++]=U>>6&63|128,de[J++]=U&63|128):(de[J++]=U>>12|224,de[J++]=U>>6&63|128,de[J++]=U&63|128);_=J-ae-P}else _=c(x,ae+P,B);_<32?de[ae++]=160|_:_<256?(P<2&&de.copyWithin(ae+2,ae+1,ae+1+_),de[ae++]=217,de[ae++]=_):_<65536?(P<3&&de.copyWithin(ae+3,ae+2,ae+2+_),de[ae++]=218,de[ae++]=_>>8,de[ae++]=_&255):(P<5&&de.copyWithin(ae+5,ae+3,ae+3+_),de[ae++]=219,hr.setUint32(ae,_),ae+=4),ae+=_}else if(E==="number")if(x>>>0===x)x<64?de[ae++]=x:x<256?(de[ae++]=204,de[ae++]=x):x<65536?(de[ae++]=205,de[ae++]=x>>8,de[ae++]=x&255):(de[ae++]=206,hr.setUint32(ae,x),ae+=4);else if(x>>0===x)x>=-32?de[ae++]=256+x:x>=-128?(de[ae++]=208,de[ae++]=x+256):x>=-32768?(de[ae++]=209,hr.setInt16(ae,x),ae+=2):(de[ae++]=210,hr.setInt32(ae,x),ae+=4);else{let C;if((C=this.useFloat32)>0&&x<4294967296&&x>=-2147483648){de[ae++]=202,hr.setFloat32(ae,x);let P;if(C<4||(P=x*Yd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===P){ae+=4;return}else ae--}de[ae++]=203,hr.setFloat64(ae,x),ae+=8}else if(E==="object")if(!x)de[ae++]=192;else{if(a){let P=a.get(x);if(P){if(!P.id){let B=a.idsToInsert||(a.idsToInsert=[]);P.id=B.push(P)}de[ae++]=214,de[ae++]=112,hr.setUint32(ae,P.id),ae+=4;return}else a.set(x,{offset:ae-r})}let C=x.constructor;if(C===Object)T(x,!0);else if(C===Array){_=x.length,_<16?de[ae++]=144|_:_<65536?(de[ae++]=220,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=221,hr.setUint32(ae,_),ae+=4);for(let P=0;P<_;P++)S(x[P])}else if(C===Map){_=x.size,_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,hr.setUint32(ae,_),ae+=4);for(let[P,B]of x)S(P),S(B)}else{for(let P=0,B=Kd.length;P<B;P++){let R=Ny[P];if(x instanceof R){let U=Kd[P];if(U.write){U.type&&(de[ae++]=212,de[ae++]=U.type,de[ae++]=0),S(U.write.call(this,x));return}let z=de,J=hr,Q=ae;de=null;let X;try{X=U.pack.call(this,x,F=>(de=z,z=null,ae+=F,ae>Pi&&A(ae),{target:de,targetView:hr,position:ae-F}),S)}finally{z&&(de=z,hr=J,ae=Q,Pi=de.length-10)}X&&(X.length+ae>Pi&&A(X.length+ae),ae=eO(X,de,ae,U.type));return}}T(x,!x.hasOwnProperty)}}else if(E==="boolean")de[ae++]=x?195:194;else if(E==="bigint"){if(x<BigInt(1)<<BigInt(63)&&x>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,hr.setBigInt64(ae,x);else if(x<BigInt(1)<<BigInt(64)&&x>0)de[ae++]=207,hr.setBigUint64(ae,x);else if(this.largeBigIntToFloat)de[ae++]=203,hr.setFloat64(ae,Number(x));else throw new RangeError(x+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ae+=8}else if(E==="undefined")this.encodeUndefinedAsNil?de[ae++]=192:(de[ae++]=212,de[ae++]=0,de[ae++]=0);else if(E==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?x=>{let E=Object.keys(x),_=E.length;_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,hr.setUint32(ae,_),ae+=4);let C;for(let P=0;P<_;P++)S(C=E[P]),S(x[C])}:(x,E)=>{de[ae++]=222;let _=ae-r;ae+=2;let C=0;for(let P in x)(E||x.hasOwnProperty(P))&&(S(P),S(x[P]),C++);de[_+++r]=C>>8,de[_+r]=C&255}:x=>{let E=Object.keys(x),_,C=o.transitions||(o.transitions=Object.create(null)),P=0;for(let R=0,U=E.length;R<U;R++){let z=E[R];_=C[z],_||(_=C[z]=Object.create(null),P++),C=_}let B=C[Bu];if(B)B>=96&&m?(de[ae++]=((B-=96)&31)+96,de[ae++]=B>>5):de[ae++]=B;else{B=o.nextId,B||(B=64),B<g&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(B=o.nextOwnId,B<v||(B=g),o.nextOwnId=B+1):(B>=v&&(B=g),o.nextId=B+1);let R=E.highByte=B>=96&&m?B-96>>5:-1;C[Bu]=B,o[B-64]=E,B<g?(E.isShared=!0,o.sharedLength=B-63,s=!0,R>=0?(de[ae++]=(B&31)+96,de[ae++]=R):de[ae++]=B):(R>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(B&31)+96,de[ae++]=R):(de[ae++]=212,de[ae++]=114,de[ae++]=B),P&&(w+=b*P),y.length>=p&&(y.shift()[Bu]=0),y.push(C),S(E))}for(let R=0,U=E.length;R<U;R++)S(x[E[R]])},A=x=>{let E;if(x>16777216){if(x-r>lM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(lM,Math.round(Math.max((x-r)*(x>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(x-r<<2,de.length-1)>>12)+1<<12;let _=new By(E);return hr=new DataView(_.buffer,0,E),de.copy?de.copy(_,0,r,x):_.set(de.slice(r,x)),ae-=r,r=0,Pi=_.length-10,de=_}}useBuffer(e){de=e,hr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Ny=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ru];Kd=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?cM(i,16,e):uM(Zd?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==hM&&this.structuredClone?cM(i,Ry.indexOf(t.name),e):uM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function cM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function uM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function eO(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function tO(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Ho(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ny.unshift(i.Class),Kd.unshift(i)}aM(i)}var fM=new Vo({useRecords:!1}),rO=fM.pack,nO=fM.pack;var{NEVER:iO,ALWAYS:sO,DECIMAL_ROUND:oO,DECIMAL_FIT:aO}=Jd,dM=512,lO=1024;var pM=new Vo({structuredClone:!0});Ho({Class:Wn.prototype.constructor,type:1,write(i){return se({},i)},read(i){return Object.setPrototypeOf(i,Wn.prototype),i}});Ho({Class:er.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,er.prototype),i}});Ho({Class:jn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Ho({Class:Pu.prototype.constructor,type:4,write(i){return i.id},read(i){return new Pu(i)}});Ho({Class:Iu.prototype.constructor,type:5,write(i){return i.data},read(i){return new Iu(i)}});function cO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var $d;(r=>{function i(n){return pM.pack(n)}r.serialize=i;function e(n){return pM.unpack(n)}r.deserialize=e;function t(n){return cO(i(n)).toString()}r.checksum=t})($d||($d={}));var ep;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(ep||(ep={}));var tp;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(tp||(tp={}));var Oy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Oy||(Oy={}));var Fy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(Fy||(Fy={}));var rp;(e=>e.defaultData=be(se(se({},Fy.defaultData),Oy.defaultData),{cloner:null}))(rp||(rp={}));var Uy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Uy||{}),zy=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(zy||{}),Gy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Gy||{}),np;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(np||(np={}));var mM=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis"];var Sl;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Sr.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:be(se({},Sr.fromHex(6710886)),{a:1}),colorB:be(se({},Sr.fromHex(6710886)),{a:1}),colorC:be(se({},Sr.fromHex(16777215)),{a:1}),colorD:be(se({},Sr.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Sl||(Sl={}));var Ri;(a=>{function i(l){return!l.layers.some(u=>{if(u.data.type==="texture"&&u.data.projection!==0||u.data.type==="depth"&&!u.data.isWorldSpace||u.data.type==="noise"||u.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([h,f])=>{c+=`${h}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let u of l.layers)"alpha"in u.data&&u.data.type!=="light"&&u.data.type!=="fresnel"&&(c+=(1-c)*u.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new er}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",u="layer2"){let h=new er;return h.push({fi:0,data:Sl.defaultData("light",l),id:c}),h.push({fi:1,data:Sl.defaultData("color"),id:u}),{layers:h}}a.defaultTwoLayerData=s;function o(l,c="basic",u="layer1",h="layer2"){let f=Sl.defaultData("texture");Object.assign(f.texture,{image:l});let d=new er;return d.push({fi:0,data:f,id:u}),d.push({fi:1,data:Sl.defaultData("light",c),id:h}),{layers:d}}a.defaultTwoLayerTextureData=o})(Ri||(Ri={}));var Ml;(r=>{function i(){return{points:new er,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(n,s){let{points:o}=s;if(o){for(let a of o)if(a.data.position[0]===n[0]&&a.data.position[1]===n[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(n,s){let o=n.controlNext,a=s.controlPrevious;return n.position[0]===o.position[0]&&n.position[1]===o.position[1]&&s.position[0]===a.position[0]&&s.position[1]===a.position[1]}r.isStraightLine=t})(Ml||(Ml={}));var ip;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(ip||(ip={}));var sp;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="VectorGeometry")return{width:1,height:1,type:t,subdivisions:12,shape:Ml.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};throw new Error("not implemented")}e.defaultData=i})(sp||(sp={}));var Nu;(n=>{n.identity=be(se({},Rd.identity),{hiddenMatrix:_i.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:vr.isEqual(s.position,o.position)?null:o.position,rotation:vr.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:vr.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:_i.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Nu||(Nu={}));var $s;(e=>e.defaultData=se({states:new er,events:new er,visible:!0,raycastLock:!1},Nu.identity))($s||($s={}));var gM;(e=>e.defaultData=se({type:"Empty"},$s.defaultData))(gM||(gM={}));var ky;(e=>e.defaultData=se(se({type:"Mesh"},$s.defaultData),rp.defaultData))(ky||(ky={}));var yM;(e=>e.defaultData=se(se({type:"TextFrame"},$s.defaultData),np.defaultData))(yM||(yM={}));var op;(e=>e.defaultData=se(se(se({},$s.defaultData),Nu.identity),Go.defaultData))(op||(op={}));var vM;(e=>{function i(t){return se(se({},$s.defaultData),tp.defaultData(t))}e.defaultData=i})(vM||(vM={}));var xM;(t=>(t.defaultCamera=se({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:_i.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new er,events:new er},Go.defaultData),t.defaultMeshObject=be(se(se({name:"Rectangle"},$s.defaultData),ky.defaultData),{geometry:sp.defaultData("RectangleGeometry"),material:Ri.defaultTwoLayerData("basic","layer1","layer2")})))(xM||(xM={}));var Ou;(t=>{function i(r,n){if(n===void 0)return r;let s=se({},r);return"material"in s&&"material"in n&&n.material&&(s.material=My(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&zo(c,l)}}).data),s.materials&&n.materials&&(s.materials=My(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let u=n.materials[c];if(typeof u!="string")for(let[h,f]of Object.entries(u.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(h);d&&zo(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=se({},r);if(Object.assign(s,Nu.merge(s,n)),Qs.is(r.type)){s.orthographic=se({},s.orthographic),s.perspective=se({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=se({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(ep.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Sr.clone(l.color))}return s}t.patch=e})(Ou||(Ou={}));function wM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Ie,c=0;for(let u=0;u<i.length;++u){let h=i[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in h.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in h.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0,h=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let p=0;p<d.count;++p)h.push(d.getX(p)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(let u in s){let h=bM(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){let d=[];for(let m=0;m<o[u].length;++m)d.push(o[u][m][f]);let p=bM(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(p)}}return l}function bM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ue(s,t,r)}function SM(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},r=i.getIndex(),n=i.getAttribute("position"),s=r?r.count:n.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let m=0,g=a.length;m<g;m++){let v=a[m];l[v]=[];let y=i.morphAttributes[v];y&&(c[v]=new Array(y.length).fill().map(()=>[]))}let f=Math.log10(1/e),d=Math.pow(10,f);for(let m=0;m<s;m++){let g=r?r.getX(m):m,v="";for(let y=0,w=a.length;y<w;y++){let b=a[y],S=i.getAttribute(b),T=S.itemSize;for(let A=0;A<T;A++)v+=`${~~(S[h[A]](g)*d)},`}if(v in t)u.push(t[v]);else{for(let y=0,w=a.length;y<w;y++){let b=a[y],S=i.getAttribute(b),T=i.morphAttributes[b],A=S.itemSize,x=l[b],E=c[b];for(let _=0;_<A;_++){let C=h[_];if(x.push(S[C](g)),T)for(let P=0,B=T.length;P<B;P++)E[P].push(T[P][C](g))}}t[v]=o,u.push(o),o++}}let p=i.clone();for(let m=0,g=a.length;m<g;m++){let v=a[m],y=i.getAttribute(v),w=new y.array.constructor(l[v]),b=new Ue(w,y.itemSize,y.normalized);if(p.setAttribute(v,b),v in c)for(let S=0;S<c[v].length;S++){let T=i.morphAttributes[v][S],A=new T.array.constructor(c[v][S]),x=new Ue(A,T.itemSize,T.normalized);p.morphAttributes[v][S]=x}}return p.setIndex(u),p}var Vy={type:"change"},MM={type:"changeZoom"},uO={type:"changePan"},Al={type:"start"},Fu={type:"end"},Hy=new Ut,hO=new N,fO=2*Math.PI,dO=1e-8,pO=.01,AM=2,Wy=.125,TM=2,jy=1,qy=1,Yy=.1;var ap=class extends jt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,En.DOLLY_ROTATE,En.PAN];this.offset=new M;this.eye=new M;this.lastPosition=new M;this.lastQuaternion=new Ut;this.current=new N;this.overShoot=new N;this.overRatio=new N;this.spherical=new hu;this.sphericalDelta=new hu;this.panOffset=new M;this.panLeftV=new M;this.panUpV=new M;this.panV=new M;this.rotateStart=new N;this.rotateEnd=new N;this.rotateDelta=new N;this.panStart=new N;this.panEnd=new N;this.panDelta=new N;this.dollyStart=new N;this.dollyEnd=new N;this.dollyDelta=new N;this.rotationRangeFactor=new N;this.panRangeFactor=new N;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Hy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Hy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-Wy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%fO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-Wy,this.sphericalDelta.phi*=1-Wy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>pO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>dO?(this.dispatchEvent(Vy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,Mt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),gO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{_M(t),this.isPointerDown=!1,Mt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Fu),this.state=-1};this.onPointerCancel=t=>{_M(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!Cu(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(Cu(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(Cu(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Al)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(CM(t),this.touches[Mt.length-1]){case En.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case En.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case En.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case En.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Al)};this.onPointerMoveTouch=t=>{switch(CM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mu(()=>this.dispatchEvent(Fu),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(Al),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Al),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Fu)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(Mt[0]))};this.onPointerHover=t=>{if(!(Id||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Yy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Yy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Yy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,AM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Hy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=eo(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=eo(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=eo(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=eo(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=En.ROTATE),t.panTouches===1&&(this.touches[0]=En.PAN),t.orbitTouches===2&&(this.touches[1]=En.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=En.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=En.ROTATE),t.panTouches===3&&(this.touches[2]=En.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),_u||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),_u||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let u,h,f;t instanceof M?(u=t.x,h=t.y,this.current.set(this.target.x,this.target.y),f=!0):(u=t.theta,h=t.phi,this.current.set(eo(this.spherical.theta),eo(this.spherical.phi)),f=!1),n===0&&(this.current.x+=u,this.current.y+=h),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(u=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(h=0)),f||(this.overShoot.x=eo(this.overShoot.x),this.overShoot.y=eo(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=EM(Math.abs(this.overRatio.x)),this.overRatio.y=EM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(u*this.overShoot.x<0&&(u*=1-this.overRatio.x),h*this.overShoot.y<0&&(h*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(u=this.overShoot.x*.05,h=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(u+=this.overShoot.x,h+=this.overShoot.y),t instanceof M?(t.x=u,t.y=h):(t.theta=u,t.phi=h)}setEnableDampingSpeed(t){this.enableDamping=t,jy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*AM}getZoomScale(){return Math.pow(.95,TM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(uO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(Al),this.dollyOut(t),this.dispatchEvent(Fu)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(Al),this.dollyIn(t),this.dispatchEvent(Fu)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy*r).rotateAround(hO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(US===!1&&Cu(t)===!1&&mO(t)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(qy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartPan(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.panStart.set(t,r)}else this.panStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartDolly(){let t=Mt[0].pageX-Mt[1].pageX,r=Mt[0].pageY-Mt[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(Mt.length===2){let n=Xy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==Mt[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(Mt.length===2){let r=Xy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==Mt[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Xy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,TM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function eo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function EM(i){return 1-Math.pow(1-i,4)}function mO(i){return i.wheelDeltaY===0||i.deltaY===0?Eu&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var Mt=[],lp={};function gO(i){Mt.push(i)}function _M(i){delete lp[i.pointerId];for(let e=0;e<Mt.length;e++)if(Mt[e].pointerId===i.pointerId){Mt.splice(e,1);return}}function CM(i){let e=lp[i.pointerId];e===void 0&&(e=new N,lp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Xy(i){let e=i.pointerId===Mt[0].pointerId?Mt[1]:Mt[0];return lp[e.pointerId]}var to=class extends Wf{constructor(){super(),this.layers.enable(3)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new Ur({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new M().addVectors(t,r.multiplyScalar(n)),o=new Ie;return o.setFromPoints([t,s]),new ns(o,e)}};var DM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((u=t.depth)!=null?u:t.width),radiusTop:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:h,cornerSegments:f,hollow:d}=i.parameters,p;return h||d?p=new Uu(c,u,r,n,s,o,a,l*Math.PI/180,h,h,f,d):p=new Co(c,u,r,n,s,o,a,l*Math.PI/180),p.scale(1,1,t/e),Object.assign(p,{userData:be(se({},i),{type:"CylinderGeometry"})})}};function ro(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function LM(i){return new N(i.y,-i.x)}var Uu=class extends Ie{constructor(e,t,r,n,s,o,a,l,c,u,h,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let p=[],m=[],g=[],v=[],y=0,w=r/2,b=new M,S=new M;d&&e==0&&(e=c),d&&t==0&&(t=u);let T=new N(e,w),A=new N(t,-w),x=null,E=null,_=null,C=null,P=T.clone().sub(A),B=0,R=0,U=0;f>0&&(B=Math.min(e,t)*(1-f),R=e-B,U=t-B);let z=T.clone();z.x-=B;let J=Math.PI-P.angle(),Q=P.angle(),X=Math.tan(Q/2),F=Math.tan(J/2),k=X+F,O=f?k:F,j=f?k:X;if(c=Math.min(c,(e-R)/O,P.length()/k),u=Math.min(u,(t-U)/j,P.length()/k),c>0){let le=c/X;x=T.clone().sub(new N(le,c)),f&&(_=x.clone(),_.x-=B-k*c),T.sub(P.clone().setLength(le))}if(u>0){let le=u/F;E=A.clone().sub(new N(le,-u)),A.add(P.clone().setLength(le)),f&&(C=E.clone(),C.x-=B-k*u,z.sub(P.clone().setLength(le)))}P=T.clone().sub(A);let q=P.length()<.5,K=[];for(let le=0;le<=n;le++){let H=[],ue=le/n,Z=ue*l+a,V=new N(Math.sin(Z),Math.cos(Z));C&&E?(W(H,ue,V,J,u,C,-1,!0),W(H,ue,V,Q,u,E,-1,!1)):E?(ge(H,V,E.x,0,-1),W(H,ue,V,Q,u,E,-1,!1)):o||ge(H,V,t,U,-1);let $=LM(P).normalize();if(ro($,V,b),!q)for(let ce=0;ce<=s;ce++){let ie=ce/s,pe=P.clone().multiplyScalar(ie).add(A);ro(pe,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(ue,.5+S.y/r),H.push(y++)}if(_&&x?(W(H,ue,V,J,c,x,1,!1),W(H,ue,V,Q,c,_,1,!0)):x?(W(H,ue,V,J,c,x,1,!1),ge(H,V,x.x,0,1)):o||ge(H,V,e,R,1),f&&!q){let ce=LM(P).multiplyScalar(-1).normalize();ro(ce,V,b);for(let ie=0;ie<=s;ie++){let pe=ie/s,ve=P.clone().multiplyScalar(-pe).add(z);ro(ve,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(ue,.5+S.y/r),H.push(y++)}}f&&!o&&H.push(H[0]),K.push(H)}for(let le=0;le<K.length-1;le++)for(let H=0;H<K[0].length-1;H++){if(o&&f&&H==s)continue;let ue=K[le][H],Z=K[le+1][H],V=K[le+1][H+1],$=K[le][H+1],ce=m[V*3+0],ie=m[V*3+2];p.push(ue,Z,$),(ce!=0||ie!=0)&&p.push(Z,V,$)}l<Math.PI*2&&(oe(-1,K[0],a),oe(1,K[K.length-1],a+l)),this.setIndex(p),this.setAttribute("position",new Le(m,3)),this.setAttribute("normal",new Le(g,3)),this.setAttribute("uv",new Le(v,2));function W(le,H,ue,Z,V,$,ce,ie){for(let pe=0;pe<h+1;pe++){let ve=pe/h,me=ce<0?ve:1-ve;ie&&(me-=1),me*=Z;let De=new N(Math.sin(me),Math.cos(me)*ce),ke=De.clone().multiplyScalar(V).add($);ro(ke,ue,S),m.push(S.x,S.y,S.z),ro(De,ue,b),g.push(b.x,b.y,b.z),v.push(H,.5+S.y/r),le.push(y++)}}function ge(le,H,ue,Z,V){let $=new M,ce=new N,ie=[ue,Z];V<0&&ie.reverse();for(let pe of ie)ce.set(pe,w*V),ro(ce,H,$),m.push($.x,$.y,$.z),g.push(0,V,0),v.push(.5,.5),le.push(y++)}function oe(le,H,ue){let Z=new N(Math.sin(ue),Math.cos(ue)),V=new N(-Math.cos(ue),Math.sin(ue)),$=new M,ce=le<0?(ve,me,De)=>p.push(ve,me,De):(ve,me,De)=>p.push(ve,De,me),ie=new N((e+t+R+U)/4,0);ro(ie,Z,$),m.push($.x,$.y,$.z),g.push(V.x,0,V.y),v.push(.5,.5);let pe=y++;for(let ve of H){let me=m.slice(ve*3,ve*3+3);m.push(...me),g.push(V.x,0,V.y);let De=v.slice(ve*2,ve*2+2);v.push(...De),y++}for(let ve=pe+1;ve<y-1;ve++)ce(pe,ve,ve+1);ce(pe,y-1,pe+1)}}};var PM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:h}=i.parameters,f;return c>0||u>0||l<360?f=new Uu(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,h,0,!0):f=new Na(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:be(se({},i),{type:"ConeGeometry"})})}};var IM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new mn(e,t,r,n,s,o):c=new Qy(e,t,r,n,s,o,a,l),Object.assign(c,{userData:be(se({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Qy=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let u=[],h=[],f=[],d=[],p=0,m=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(v("z","y","x",-1,-1,1,r,t,e,o,0),v("z","y","x",1,-1,-1,r,t,e,o,1),v("z","y","x",-1,1,-1,r,t,e,o,1),v("z","y","x",1,1,1,r,t,e,o,0),v("x","y","z",-1,-1,-1,e,t,r,n,0),v("x","y","z",1,-1,1,e,t,r,n,1),v("x","y","z",-1,1,1,e,t,r,n,0),v("x","y","z",1,1,-1,e,t,r,n,1),v("y","x","z",-1,-1,1,t,e,r,s,0),v("y","x","z",1,-1,-1,t,e,r,s,1),v("y","x","z",1,1,1,t,e,r,s,1),v("y","x","z",-1,1,-1,t,e,r,s,0),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function g(w,b,S,T,A,x,E,_,C,P,B){let R=(x-2*a)/C,U=(E-2*a)/P,z=x/2-a,J=E/2-a,Q=_/2,X=C+1,F=P+1,k=0,O=0,j=new M;for(let q=0;q<F;q++){let K=q*U-J;for(let W=0;W<X;W++){let ge=W*R-z;j[w]=ge*T,j[b]=K*A,j[S]=Q,h.push(j.x,j.y,j.z),j[w]=0,j[b]=0,j[S]=_>0?1:-1,f.push(j.x,j.y,j.z),d.push(W/C),d.push(1-q/P),k+=1}}for(let q=0;q<P;q++)for(let K=0;K<C;K++){let W=p+K+X*q,ge=p+K+X*(q+1),oe=p+(K+1)+X*(q+1),le=p+(K+1)+X*q;u.push(W,ge,le),u.push(ge,oe,le),O+=6}c.addGroup(m,O,B),m+=O,p+=k}function v(w,b,S,T,A,x,E,_,C,P,B){let R=(E-2*a)/P,U=E/2-a,z=_/2-a,J=C/2,Q=P+1,X=0,F=0,k=new M,O=new M;for(let j=0;j<l+1;j++){let q=j/l*Jy,K=Math.sin(q)*a,W=(1-Math.cos(q))*a,ge=Math.sin(q),oe=Math.cos(q);k[b]=(z+K)*A,k[S]=(J-W)*x,O[w]=0,O[b]=ge*Math.sign(k[b]),O[S]=oe*Math.sign(k[S]);for(let le=0;le<Q;le++){let H=le*R-U;k[w]=H*T,h.push(k.x,k.y,k.z),f.push(O.x,O.y,O.z),d.push(le/P),d.push(0),X+=1}}for(let j=0;j<l;j++)for(let q=0;q<P;q++){let K=p+q+Q*j,W=p+q+Q*(j+1),ge=p+(q+1)+Q*(j+1),oe=p+(q+1)+Q*j;u.push(K,W,oe),u.push(W,ge,oe),F+=6}c.addGroup(m,F,B),m+=F,p+=X}function y(w,b,S){let T=new M,A=new M(e/2,t/2,r/2);A.subScalar(a);let x=[],E=w*b*S>0?(C,P,B)=>u.push(C,P,B):(C,P,B)=>u.push(C,B,P);for(let C=0;C<=l;C++){let P=[],B=Jy*(1-C/l),R=Math.cos(B),U=Math.sin(B),z=0;for(let J=0;J<=C;J++){let Q=Math.cos(z),X=Math.sin(z);T.x=R*Q,T.y=U,T.z=R*X;let F=A.clone().addScaledVector(T,a);h.push(w*F.x,b*F.y,S*F.z),f.push(w*T.x,b*T.y,S*T.z),d.push(0,0),P.push(p++),z+=Jy/C}x.push(P)}let _=x.length-1;for(let C=0;C<_;C++){let P=x[C],B=x[C+1],R=P.length-1;E(P[0],B[1],B[0]);for(let U=1;U<=R;U++)E(P[U-1],P[U],B[U]),E(P[U],B[U+1],B[U])}}}};var no=class extends Ie{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),h(),this.setAttribute("position",new Le(a,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(l,2));return;function u(){var X;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],p=new M,m=p.clone(),g=new Jt,v=s*n,y=n-v,w=o+1,b=new M,S=(F,k)=>b.subVectors(F,k).normalize(),T=(F,k)=>Array(F).fill(void 0).map(k),A=T(e.length/3,(F,k)=>new M().fromArray(e,k*3).setLength(n)),x=[],E=1e6;for(let F=0;F<A.length;F++){let k=A[F],O=[],j,q,K,W=1e10,ge=-1;for(;(ge=t.indexOf(F,ge+1))!=-1;){let ue=ge-ge%3;j=t[ue+(ge+1)%3],q=t[ue+(ge+2)%3],K=k.distanceToSquared(A[j]),W=Math.min(W,K),O.push([j,q,K])}W+=1e-6;let oe=[],le=0,H=O.length;for(let ue=0;ue<H;ue++){[j,q,K]=O[le];let Z=((X=x[j])==null?void 0:X.includes(F))==!0;K<=W&&oe.push(j+ +Z*E),le=O.findIndex(V=>V[0]==q)}x.push(oe)}let _=[];{let F=0,k=0,O,j,q=d==3;for(let K=0;K<=o;K++){O=K*(K+1)/2,j=(K+1)*(K+2)/2;for(let W=0;W<o-K;W++)[F,k]=[O+W+K+2,j+W+K+3],_.push(O,j,...q?[k,O]:[F,j],k,F),[O,j]=[F,k];_.push(O,j,O+o+2)}}let C=p.clone(),P=p.clone(),B=p.clone(),R=p.clone(),U=p.clone(),z=[],J=T(A.length,()=>T(d,()=>p.clone()));for(let F=0;F<A.length;F++){p.copy(A[F]).normalize(),C.copy(p).multiplyScalar(y);let k=x[F];for(let oe=0;oe<k.length;oe++){let le=k[oe],H=k[(oe+1)%d];g.setFromPointsAndIndices(A,F,le%E,H%E),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(C,J[F][oe])}let O=[],j=[],q=[],K=new M;o==0&&[...J[F]].reduce((oe,le)=>oe.add(le),K).multiplyScalar(1/d);for(let oe=0;oe<d;oe++){let le=[],H=(oe-1+d)%d,ue=J[F][H],Z=J[F][oe];p.copy(ue).sub(C),m.copy(Z).sub(C);let V=C.angleTo(p),$=p.angleTo(m),ce=Math.cos(V)*v;o==0?P.copy(K):P.copy(C).setLength(y+ce),j.push(ce);let ie=[P,ue,Z];for(let pe=0;pe<2;pe++){let ve=ie[pe],me=ie[pe+1];R.subVectors(ve,C),U.subVectors(me,C),B.crossVectors(R,U).normalize();for(let De=0;De<w;De++){let ke=[V,$][pe]*De/w;p.copy(R).applyAxisAngle(B,ke).add(C),O.push(p.clone()),pe&&(S(p,C),le.push([De==0?ve:p.clone(),b.clone()]))}pe&&(S(me,C),le.push([me,b.clone()]))}q.push(le)}z.push(q);let W=2*w,ge=2;for(let oe=0;oe<d;oe++){let le=W*oe,H=W*((oe+1)%d),ue=[O[le]];for(let V=1;V<w;V++){R=O[le+V],U=O[H+V],ue.push(R);for(let $=1,ce=V-ge+1;$<=ce;$++)p.lerpVectors(R,U,$/(ce+1)),p.sub(C).setLength(j[oe]).add(C),ue.push(p.clone());ue.push(U)}for(let V=0;V<w;V++)ue.push(O[V+w+le]);ue.push(O[H+w]);let Z=_.map(V=>ue[V]);a.push(...Z.map(V=>[V.x,V.y,V.z]).flat()),c.push(...Z.map(V=>(S(V,C),[b.x,b.y,b.z])).flat())}}let Q=[];for(let F=0;F<x.length;F++)for(let k=0;k<d;k++){let O=x[F][k];if(O<E){let j=x[O].findIndex(W=>W%E==F),q=z[F][k],K=z[O][j];for(let W=0;W<w;W++){let ge=q[W],oe=K[w-W],le=q[W+1],H=K[w-(W+1)];[ge,oe,le,le,oe,H].forEach(ue=>{a.push(ue[0].x,ue[0].y,ue[0].z),c.push(ue[1].x,ue[1].y,ue[1].z)})}Q.push(q[0][0],K[w][0],q[w][0],K[0][0])}}for(;Q.length;){let F,k,O,j;[F,k]=Q.splice(0,2);let q=[F];for(;F!=k;)q.push(k),O=Q.indexOf(k),j=O%2,k=Q.splice(O-j,2)[1-j];b.subVectors(q[0],q[1]).cross(p.subVectors(q[0],q[2])).normalize();let K=b.dot(q[0])<0;K&&b.negate();for(let W=1;W<=q.length-2;W++)[q[W+ +K],q[W+1-+K],q[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(b.x,b.y,b.z)})}}function h(){let f=new M;for(let A=0;A<a.length;A+=3){f.x=a[A+0],f.y=a[A+1],f.z=a[A+2];let x=S(f)/2/Math.PI+.5,E=T(f)/Math.PI+.5;l.push(x,1-E)}let d=new M,p=new M,m=new M,g=new M,v=new N,y=new N,w=new N,b=(A,x,E,_)=>{_<0&&A.x===1&&(l[x]=A.x-1),E.x===0&&E.z===0&&(l[x]=_/2/Math.PI+.5)};for(let A=0,x=0;A<a.length;A+=9,x+=6){d.set(a[A+0],a[A+1],a[A+2]),p.set(a[A+3],a[A+4],a[A+5]),m.set(a[A+6],a[A+7],a[A+8]),v.set(l[x+0],l[x+1]),y.set(l[x+2],l[x+3]),w.set(l[x+4],l[x+5]),g.copy(d).add(p).add(m).divideScalar(3);let E=S(g);b(v,x+0,d,E),b(y,x+2,p,E),b(w,x+4,m,E)}for(let A=0;A<l.length;A+=6){let x=l[A+0],E=l[A+2],_=l[A+4],C=Math.max(x,E,_),P=Math.min(x,E,_);C>.9&&P<.1&&(x<.2&&(l[A+0]+=1),E<.2&&(l[A+2]+=1),_<.2&&(l[A+4]+=1))}function S(A){return Math.atan2(A.z,-A.x)}function T(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}}static fromJSON(e){return new no(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var RM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new zu(e*.5,s,o):new Fa(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"DodecahedronGeometry"})})}},zu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,e,t,r),this.type=l}static fromJSON(e){return new zu(e.radius,e.corner,e.cornerSides)}};var Gu=1e-12,Tl=class{constructor(e){this.position=new N;this.startPosition=new N;this.uuid=tt.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Tl(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},El=class extends Tl{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new El(this.parent).copy(this)}},ci=class extends Tl{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new El(this),new El(this))}static create(t,r){let n=new ci(t,new N(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ci(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Ky=i=>i,Vu=new N,Zy=new N,yO=new N,vO=new N,xO=new N,bO=new N,BM=new M,NM=new M;function OM(i){let e=new N;e.addVectors(i.v0,Vu.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new N;return t.addVectors(i.v2,Zy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new sn(i.v0,e,t,i.v2)}function ku(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function wO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function SO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function $y(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function FM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function UM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function zM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),h;return $y(e,i,t)>Math.PI&&(u*=-1),ku(c,a)?h=(a+c)*(r/u-.5)*8/3/(o-l):h=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-h*a,e.y+h*o),s.set(t.x+h*c,t.y-h*l),[n,s]}function ev(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function GM(i,e,t,r,n=.5){let s=Vu.subVectors(e,i).multiplyScalar(n).add(i),o=Zy.subVectors(t,e).multiplyScalar(n).add(e),a=yO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=vO.subVectors(o,s).multiplyScalar(n).add(s),u=xO.subVectors(a,o).multiplyScalar(n).add(o),h=a,f=bO.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,u.x,u.y,h.x,h.y,r.x,r.y]}function kM(i,e,t=12,r=!0){let n=NM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Ky(e[l]),u=Vu,h=io(c,t);a.push(h);for(let f=0;f<=h;f++)if(c instanceof sn||c instanceof Gn||c instanceof on){if(c.getPoint(f/h,u),n.set(u.x,u.y,0),s!==void 0&&SO(s,n))continue;s===void 0&&(s=BM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function VM(i,e,t,r=12,n=!0){let s=NM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=Ky(e[l]),h=Vu,f=io(u,r);a.push(f);for(let d=0;d<=f;d++)if(u instanceof sn||u instanceof Gn||u instanceof on){if(u.getPoint(d/f,h),s.set(h.x,h.y,0),c!=null&&c.equals(s))continue;c===void 0?c=BM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function tv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=io(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=io(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=io(i[0].roundedCurveCorner,e)*.5),r}function io(i,e=12){return i&&i instanceof Bs?e*2:i&&(i instanceof on||i instanceof tu)?1:i&&i instanceof _o?e*i.points.length:e}function HM(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Ky(e[o]),l=io(a,t),c=Vu;for(let u=0;u<=l;u++)if(a instanceof sn||a instanceof Gn||a instanceof on){if(a.getPoint(u/l,c),n!==void 0&&wO(n,c,Gu))continue;n===void 0&&(n=Zy),n.copy(c),i.push(c.x,c.y),s++}}return ku(i[0],i[i.length-2],Gu)&&ku(i[1],i[i.length-1],Gu)&&(i.pop(),i.pop()),r&&s>1&&!(ku(i[s-1],i[1],Gu)&&ku(i[s-2],i[0],Gu))&&(i.push(i[0],i[1]),s++),i}var rv=new N,MO=new N,AO=new N,TO=new N,EO=new N,_O=new N,At=class extends en{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new jt;this.plane=new Fr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=tt.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new At;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ci.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>At.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){return this.points.findIndex(r=>r.uuid===t)}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=rv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=tt.generateUUID()){let s;t instanceof N?s=t:s=new N(t,r);let o=new ci(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return kM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=tv(this.points,t,!1),this.roundedCurveDivisions=tv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return VM(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),HM(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=io(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<n+u)return[l,(a-n+1)/u];n+=u}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(ev(s,o)){let h=s.position.distanceTo(o.position);return s.position.distanceTo(rv.set(n.x,n.y))/h}let c=0;for(let h=0;h<t;h++)c+=a[h];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){ev(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let u=l.curveBefore,h=l.curveAfter;if(u===void 0||h===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,p=u.getLength(),m=h.getLength(),g=Math.min(c,p*.499),v=Math.min(c,m*.499),y=Math.min(g,v),w=1-y/p,b=y/m,S=u.getPointAt(w,rv),T=h.getPointAt(b,MO);this._subSplitCurve(u,f,w,S,void 0),this._subSplitCurve(h,d,b,void 0,T);let A;if(this.useCubicForRoundedCorners){let x=$y(S,l.position,T)/2,E=Math.tan(x)*S.distanceTo(l.position),[_,C]=FM(S,T,E,AO,TO),P=UM(_,C,l.position),[B,R]=zM(P,S,T,E,EO,_O);A=new sn(S.clone(),B.clone(),R.clone(),T.clone())}else A=new Gn(S.clone(),l.position.clone(),T.clone());l.roundedCurveCorner=A,this.roundedCurves.splice(o+s,0,A),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof on)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),u=GM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return r}clone(){let t=new At(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],u=t.points[o+3],h=t.points[o+4],f=t.points[o+5],d=t.points[o+6],p=new ci(tt.generateUUID(),new N(a,l));p.controls[0].position.set(c,u),p.controls[1].position.set(h,f),p.roundness=d,this.points.push(p)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new At;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof sn&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof Gn&&(s[a]=OM(s[a]));for(a=0,l=s.length;a<l;a++){let h=s[a],f=a>0?s[a-1]:null,d;h instanceof sn?(d=this.createPoint(h.v0),d.controls[1].position.copy(h.v1)):h instanceof on&&(d=this.createPoint(h.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],u=!1;return c instanceof sn?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),u=!0):c instanceof on&&c.v2.equals(o[0].position)&&(u=!0),this.isClosed=u,o};return this.points=n(t.curves),t instanceof en&&(this.shapeHoles=t.holes.map(s=>{let o=new At;return o.fromShape(s),o})),this.update(),this}};var iv=Math.PI*2;function nv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function CO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function WM(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function LO(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),h=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),p=u*h-u*d-h*f;p<0&&(p=0),p/=u*d+h*f,p=Math.sqrt(p)*(l===c?-1:1);let m=p*n/s*a,g=p*-s/n*o,v=m+(i+t)/2,y=g+(e+r)/2,w=(o-m)/n,b=(a-g)/s,S=(-o-m)/n,T=(-a-g)/s,A=WM(1,0,w,b),x=WM(w,b,S,T);return!c&&x>0&&(x-=iv),c&&x<0&&(x+=iv),{centerx:v,centery:y,ang1:A,ang2:x}}function jM({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,u=(e-r)/2;if(c===0&&u===0)return[];n=Math.abs(n),s=Math.abs(s);let h=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);h>1&&(n*=Math.sqrt(h),s*=Math.sqrt(h));let f=LO(i,e,t,r,n,s,c,u,o,a),{ang1:d,ang2:p}=f,{centerx:m,centery:g}=f,v=Math.abs(p)/(iv/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);p/=y;for(let w=0;w<y;w++)l.push(CO(d,p)),d+=p;return l.map(w=>{let{x:b,y:S}=nv(w[0],n,s,m,g),{x:T,y:A}=nv(w[1],n,s,m,g),{x,y:E}=nv(w[2],n,s,m,g);return{x1:b,y1:S,x2:T,y2:A,x,y:E}})}var Kt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Kt||(Kt={}));var Mr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Mr||(Mr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Hu=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cp=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),_l=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),qM=function(){function i(){var e=new _l,t=new Hu,r=new cp(0),n=new cp(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new cp(0),r=new cp(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new _l,t=new _l,r=new Hu,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new _l;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Hu;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var n=new Hu;this.makeFace_(n,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new _l;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Hu;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),YM=function(){function i(){this.handle=null}return i}(),XM=function(){function i(){this.key=null,this.node=0}return i}(),DO=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new YM,this.handles[r]=new XM;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new YM;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new XM}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),sv=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),JM=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),PO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new JM,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new JM;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),IO=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new sv;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Kt.ODD:return(t&1)!==0;case Kt.NONZERO:return t!==0;case Kt.POSITIVE:return t>0;case Kt.NEGATIVE:return t<0;case Kt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,u,h=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,u=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!h&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),h=!1,l=a,u=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,u,h,f=new _l,d,p;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),h=Math.max(a.t,c.t),u>h))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),p=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,p,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new sv;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var u=e.mesh.connect(a.Dnext,t.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new sv,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},i.initEdgeDict=function(e){e.dict=new PO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new DO(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),RO=function(){function i(){this.mesh=new qM,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Kt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[null,null,null],p=[null,null,null],m=this.mesh.vHead;t=m.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,p[g]=t,l[g]=s,d[g]=t;for(t=m.next;t!==m;t=t.next)for(var v=0;v<3;++v)s=t.coords[v],s<c[v]&&(c[v]=s,p[v]=t),s>l[v]&&(l[v]=s,d[v]=t);var y=0;if(l[1]-c[1]>l[0]-c[0]&&(y=1),l[2]-c[2]>l[y]-c[y]&&(y=2),c[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=p[y],n=d[y],u[0]=r.coords[0]-n.coords[0],u[1]=r.coords[1]-n.coords[1],u[2]=r.coords[2]-n.coords[2],t=m.next;t!==m;t=t.next)h[0]=t.coords[0]-n.coords[0],h[1]=t.coords[1]-n.coords[1],h[2]=t.coords[2]-n.coords[2],f[0]=u[1]*h[2]-u[2]*h[1],f[1]=u[2]*h[0]-u[0]*h[2],f[2]=u[0]*h[1]-u[1]*h[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);s&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var u=e.fHead.next;u!==e.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>r)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===Mr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var h=c.n*n;this.vertices[h+0]=c.coords[0],this.vertices[h+1]=c.coords[1],n>2&&(this.vertices[h+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=0,u=e.fHead.next;u!==e.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[f++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Mr.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var p=l;p<r;++p)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=0,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new qM),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Kt.ODD),t===void 0&&(t=Mr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),IO.computeInterior(this,o);var a=this.mesh;return t===Mr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Mr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function Wo(i){var e=i.windingRule,t=e===void 0?Kt.ODD:e,r=i.elementType,n=r===void 0?Mr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,h=i.contours,f=h===void 0?[]:h,d=i.strict,p=d===void 0?!0:d,m=i.debug,g=m===void 0?!1:m;if(!f&&p)throw new Error("Contours can't be empty");if(!!f){var v=new RO;i.edgeCreateCallback&&(v.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(v.vertexIdCallback=i.vertexIdCallback);for(var y=0;y<f.length;y++)v.addContour(l||2,f[y]);return v.tesselate(t,n,o,l,u,p),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var t7=Kt.ODD,r7=Kt.NONZERO,n7=Kt.POSITIVE,i7=Kt.NEGATIVE,s7=Kt.ABS_GEQ_TWO,o7=Mr.POLYGONS,a7=Mr.CONNECTED_POLYGONS,l7=Mr.BOUNDARY_CONTOURS;var Cl=class extends Ie{constructor(t,r=12,n={}){var p,m,g;super();this.type="ShapeGeometry";this.windingRule=Kt.ODD;this.elementType=Mr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=t,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Kt.ODD,elementType:Mr.POLYGONS,polySize:3,vertexSize:2,strict:!0},n);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(v=>v.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,u,h;for(let v=0,y=s.length/2;v<y;v++){let w=v*2,b=s[w+0],S=s[w+1];if(u!==void 0&&b!==u&&(l=!1),h!==void 0&&S!==h&&(c=!1),u=b,h=S,!l&&!c)break}!l&&!c&&(a=Wo({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict}));let f=(p=a==null?void 0:a.vertexCount)!=null?p:1,d=(m=a==null?void 0:a.elementCount)!=null?m:1;if(this._positionAttribute=new Ue(new Float32Array(f*3),3),this._normalAttribute=new Ue(new Float32Array(f*3),3),this._uvAttribute=new Ue(new Float32Array(f*2),2),this._indexAttribute=new Ue(new Uint32Array(d*3),1),a){let v=1/0,y=-1/0,w=1/0,b=-1/0;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1];_<v&&(v=_),_>y&&(y=_),C<w&&(w=C),C>b&&(b=C)}let S=y-v,T=b-w;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1],P=(_-v)/S,B=(C-w)/T;this._positionAttribute.setXYZ(A,_,C,0),this._normalAttribute.setXYZ(A,0,0,1),this._uvAttribute.setXY(A,P,B)}for(let A=0,x=d;A<x;A++){let E=A*3,_=a.elements[E+0],C=a.elements[E+1],P=a.elements[E+2];this._indexAttribute.setX(E+0,_),this._indexAttribute.setX(E+1,C),this._indexAttribute.setX(E+2,P)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((g=a==null?void 0:a.elementCount)!=null?g:1)*3)}clone(){let t=new Cl(this._shape,this._curveSegments);return t.userData=Su(this.userData),t}};var up=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*up.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*up.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,o*s,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Wu=up;Wu.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var ov=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Ll=class extends Ie{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(A=>{let x=A.extractShapePointsToFlatArray([],s),E=[];for(let _=x.length-1;_>=1;_-=2){let C=x[_-1],P=x[_-0];E.push(C,P)}return E}),c=Wo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),u=Wo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let h=c.elementCount;if(u){c.elementCount+=u.elementCount;for(let A=0;A<u.elements.length;A++){let x=u.elements[A],E=A%2===0?c.vertexCount:0;c.elements.push(x+E)}for(let A=0;A<u.vertexIndices.length;A++){let x=u.vertexIndices[A],E=c.vertexCount;c.vertexIndices.push(x+E)}for(let A=0;A<u.vertices.length;A++){let x=u.vertices[A];c.vertices.push(x)}}let f=1/0,d=-1/0,p=1/0,m=-1/0;for(let A=0,x=c.vertexCount;A<x;A++){let E=A*2,_=c.vertices[E+0],C=c.vertices[E+1];_<f&&(f=_),_>d&&(d=_),C<p&&(p=C),C>m&&(m=C)}this._minX=f,this._minY=p,this._width=d-f,this._height=m-p;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Wu(g);let v=[],y=[];for(let A=c.elementCount-1;A>=0;A--){let x=A>=h,E=A*2,_=c.elements[E+0],C=c.elements[E+1],P=_+C,B={start:_,count:C,normals:[],continuous:[],concave:[]},R=_,U=P-1,z=_+1,J=this._shape.roundedCurves.length;do{let k=R-_,O=c.vertices[U*2+0],j=c.vertices[U*2+1],q=c.vertices[R*2+0],K=c.vertices[R*2+1],W=c.vertices[z*2+0],ge=c.vertices[z*2+1],oe=q-O,le=K-j,H=Math.sqrt(oe*oe+le*le);oe/=H,le/=H;let ue=q-W,Z=K-ge,V=Math.sqrt(ue*ue+Z*Z);ue/=V,Z/=V,B.normals[k*2+0]=-Z,B.normals[k*2+1]=ue,B.concave[k]=oe*Z-le*ue>0;let $=c.vertexIndices[R];if(Array.isArray($))B.continuous[k]=!1;else{let[ce,ie]=this._shape.getCurveIndexFromVertexId($-1,!0);if(ie>0&&ie<1)B.continuous[k]=!0;else{let pe=ie===1?ce+1:ce-1;pe=(pe+J)%J;let ve=ie===1?0:1,me=this._shape.roundedCurves[ce].getTangent(ie),De=this._shape.roundedCurves[pe].getTangent(ve);B.continuous[k]=me.dot(De)>.95}}x&&(B.normals[k*2+0]*=-1,B.normals[k*2+1]*=-1),[U,R,z]=[R,z,z+1],z>=P&&(z-=C)}while(z!==_+1);let Q=[];Q.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(_*2,P*2),vertexCount:C,vertexIndices:new Array(C).fill(!0).map((k,O)=>[O,O]),elements:[0,C],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(_*2,P*2)});for(let k=1;k<=this._bevelSegments;k++){let O=k/this._bevelSegments*Math.PI/2,j=(1-Math.cos(O))*this._bevelSize,q=[],K=[],W=[],ge=[],oe=0;for(let H=0;H<C;H++){let ue=H*2,Z=(H-1+C)%C*2,V=c.vertices[B.start*2+ue+0],$=c.vertices[B.start*2+ue+1],ce=-B.normals[Z+0]*j,ie=-B.normals[Z+1]*j,pe=-B.normals[ue+0]*j,ve=-B.normals[ue+1]*j;if(B.concave[H]||!B.concave[H]&&x){let me=Math.atan2(ie,ce),De=Math.atan2(ve,pe);De>me&&(De-=Math.PI*2);let ke=De-me;if(B.continuous[H]||x){let I=me+ke/2,L=Math.cos(I)*j,te=Math.sin(I)*j;q[2*oe+0]=V+L*(x?-1:1),q[2*oe+1]=$+te*(x?-1:1),ge[oe]=H,oe++}else{let I=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let L=0;L<=I;L++){let te=me+ke*(L/I),ye=Math.cos(te)*j,Se=Math.sin(te)*j;q[2*oe+0]=V+ye,q[2*oe+1]=$+Se,ge[oe]=H,oe++}}}else q[2*oe+0]=V+ce,q[2*oe+1]=$+ie,ge[oe]=H,K[H]=oe,oe++,q[2*oe+0]=V,q[2*oe+1]=$,ge[oe]=H,oe++,q[2*oe+0]=V+pe,q[2*oe+1]=$+ve,ge[oe]=H,W[H]=oe,oe++}let le=Wo({windingRule:Kt.POSITIVE,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:H=>{let Z=H.Org.idx,V=ge[Z],$=ge[(Z+1)%ge.length];H.idx=[V,$],H.Sym.idx=[$,V]},vertexIdCallback:H=>{let ue=H.Lprev.idx;return[ue?ue[1]:0,H.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${k}'th loop`);if(!le.vertexCount)break;for(let H=0;H<le.vertexIndices.length;H++){let[ue,Z]=le.vertexIndices[H];if(ue===Z)continue;let V=Z;Z<ue&&(V+=C);for(let $=ue;$<V;$++){let ce=$%C,ie=($+1)%C;if(!B.continuous[ce]||!B.continuous[ie]){le.vertexIndices[H]=[ue,ce],le.vertexIndices.splice(H+1,0,[ie,Z]),le.vertices.splice((H+1)*2,0,le.vertices[H*2],le.vertices[H*2+1]);break}}}Q.push({bevelI:k,angle:O,size:j,boundary:le,reverseMap:ge,insetPoints:q})}let X=(k,O,j)=>{let q=0,K=k.boundary.vertexIndices.length;for(;q<K&&j(k.boundary.vertexIndices[O]);)O=(O+1)%K,q++;return q},F=v.length;for(let k=1;k<Q.length;k++){let O=Q[k-1],j=Q[k],q=O.boundary.vertexIndices.length,K=j.boundary.vertexIndices.length;if(!q||!K)break;let W=B.concave.length,ge=0,oe=ov(ge,C);for(;!O.boundary.vertexIndices.filter(oe).length||!j.boundary.vertexIndices.filter(oe).length;)ge++,oe=ov(ge,C);let le=O.boundary.vertexIndices.findIndex(oe),H=j.boundary.vertexIndices.findIndex(oe);do le=(le+1)%q;while(oe(O.boundary.vertexIndices[le]));do H=(H+1)%K;while(oe(j.boundary.vertexIndices[H]));ge=(ge+1)%C;let ue=ge,Z=this.buildBevelVert(B,O,(le-1+q)%q),V=this.buildBevelVert(B,j,(H-1+K)%K),$=Z,ce=V,ie,pe,ve=!1;do{oe=ov(ge,C);let me=X(O,le,oe),De=X(j,H,oe),ke=ve;if(ve=!1,me&&!De){for(let I=0;I<me;I++)ie=this.buildBevelVert(B,O,(le+I)%q,I/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie;ve=!0}else if(!me&&De)for(let I=0;I<De;I++)pe=this.buildBevelVert(B,j,(H+I)%K,I/(De-1)),v.push(ce.topN,$.topP,pe.topP),v.push($.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&De)if(ie=this.buildBevelVert(B,O,le,0),pe=this.buildBevelVert(B,j,H,0),ke?(v.push($.topN,pe.topP,ce.topN),v.push($.topN,ie.topP,pe.topP),v.push(pe.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,$.bottomN,pe.bottomP)):(v.push($.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,pe.bottomP)),$=ie,ce=pe,me===De)for(let I=1;I<me;I++)ie=this.buildBevelVert(B,O,(le+I)%q,I/(me-1)),pe=this.buildBevelVert(B,j,(H+I)%K,I/(De-1)),v.push($.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,pe.bottomP),$=ie,ce=pe;else if(me>De){let I=me/De,L=0;for(let te=1;te<me;te++)ie=this.buildBevelVert(B,O,(le+te)%q,te/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie,te>(L+1)*I&&(L++,pe=this.buildBevelVert(B,j,(H+L)%K,L/(De-1)),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let I=De/me,L=0;for(let te=1;te<De;te++)pe=this.buildBevelVert(B,j,(H+te)%K,te/(De-1)),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe,te>(L+1)*I&&(L++,ie=this.buildBevelVert(B,O,(le+L)%q,L/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie)}le=(le+me)%q,H=(H+De)%K,ge=(ge+1)%W}while(ge!==ue)}{let k=Q[0];for(let O=0,j=k.boundary.vertexCount;O<j;O++){let q=this.buildBevelVert(B,k,O),K=this.buildBevelVert(B,k,(O+1)%j);v.push(K.topP,q.topN,q.bottomN),v.push(K.topP,q.bottomN,K.bottomP)}}if(x){let k=[];for(let O=v.length-1;O>=F+2;O-=3){let j=v[O-2],q=v[O-1],K=v[O-0];k.push(K,q,j)}v.splice(F,v.length-F,...k)}if(x){let k=[];for(let O=Q[Q.length-1].boundary.vertices.length-1;O>=1;O-=2){let j=Q[Q.length-1].boundary.vertices[O-1],q=Q[Q.length-1].boundary.vertices[O-0];k.push(j,q)}y.push(k)}if(!x){let k=Q[Q.length-1],O=Wo({windingRule:Q.length>1?Kt.POSITIVE:Kt.ODD,elementType:Mr.POLYGONS,vertexSize:2,strict:!0,contours:[k.insetPoints,...y]});if(!O)throw new Error("Error generating geometry for surface");for(let j=0;j<O.elementCount*3;j+=3){let q=this.buildSurfaceVert(O,O.elements[j+0]),K=this.buildSurfaceVert(O,O.elements[j+1]),W=this.buildSurfaceVert(O,O.elements[j+2]);v.push(q.top,K.top,W.top),v.push(W.bottom,K.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new Ue(Uint32Array.from(v),1),b=new Ue(this._buffer.positions,3),S=new Ue(this._buffer.normals,3),T=new Ue(this._buffer.uvs,2);b.needsUpdate=!0,S.needsUpdate=!0,T.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",S),this.setAttribute("uv",T),this.setIndex(w)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),u=c*3,h=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[u+0]=s,this._buffer.positions[u+1]=o,this._buffer.positions[u+2]=this._depth,this._buffer.normals[u+0]=0,this._buffer.normals[u+1]=0,this._buffer.normals[u+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=l,this._buffer.positions[u+3]=s,this._buffer.positions[u+4]=o,this._buffer.positions[u+5]=0,this._buffer.normals[u+3]=0,this._buffer.normals[u+4]=0,this._buffer.normals[u+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,u,h,f;a!==l?(u=a,c=l,f=!1,h=t.continuous[u]&&t.continuous[c]):(c=a,u=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,h=t.continuous[c]||f);let d=Math.cos(r.angle),p=Math.sin(r.angle),m=n*2,g=c*2,v=u*2,y=r.boundary.vertices[m+0],w=r.boundary.vertices[m+1],b=(1-p)*this._bevelSize,S=(y-this._minX)/this._width,T=(w-this._minY)/this._height,A=t.normals[g+0],x=t.normals[g+1],E=t.normals[v+0],_=t.normals[v+1];if(f){let U=E-A,z=_-x;A=A+U*(1-s),x=x+z*(1-s);let J=Math.sqrt(A*A+x*x);A/=J,x/=J}let C=this._buffer.get(h?2:4),P=C*3,B=C*2,R={i:n,fi:c,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[P+0]=y,this._buffer.positions[P+1]=w,this._buffer.positions[P+2]=this._depth-b,this._buffer.normals[P+0]=A*d,this._buffer.normals[P+1]=x*d,this._buffer.normals[P+2]=p,this._buffer.uvs[B+0]=S,this._buffer.uvs[B+1]=T,this._buffer.positions[P+3]=y,this._buffer.positions[P+4]=w,this._buffer.positions[P+5]=b,this._buffer.normals[P+3]=A*d,this._buffer.normals[P+4]=x*d,this._buffer.normals[P+5]=-p,this._buffer.uvs[B+2]=T,this._buffer.uvs[B+3]=S,h||(C+=2,P+=6,B+=4,R.topP=C+0,R.bottomP=C+1,this._buffer.positions[P+0]=y,this._buffer.positions[P+1]=w,this._buffer.positions[P+2]=this._depth-b,this._buffer.normals[P+0]=E*d,this._buffer.normals[P+1]=_*d,this._buffer.normals[P+2]=p,this._buffer.uvs[B+0]=S,this._buffer.uvs[B+1]=T,this._buffer.positions[P+3]=y,this._buffer.positions[P+4]=w,this._buffer.positions[P+5]=b,this._buffer.normals[P+3]=E*d,this._buffer.normals[P+4]=_*d,this._buffer.normals[P+5]=-p,this._buffer.uvs[B+2]=T,this._buffer.uvs[B+3]=S),this.vertexCache[o]=R,R}clone(){let t=new Ll(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Su(this.userData),t}};var Gr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,h,f,d,p,m;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((u=t.height)!=null?u:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(h=t.depth)!=null?h:0),o=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof At?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new At(r,n).fromJSON(o),((p=i.parameters)==null?void 0:p.roundness)!==void 0&&((m=i.parameters)==null?void 0:m.roundness)>0&&o.update(!1));let l=o!=null?o:new At(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s}=i.parameters;i.shape.roundness=s;let o;return e<=0?o=new Cl(i.shape,n):o=new Ll(i.shape,e,t,n,r),Object.assign(o,{userData:be(se({},i),{type:"VectorGeometry"})})}};var KM=Math.PI*2,ZM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c=i.shape,u=e*.5,h=t*.5,f=BO(c,u,h,n*Math.PI/180,r,s);c.isClosed=!0,c.update();let d=Gr.create({shape:c,parameters:{subdivisions:f,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:be(se({},i),{type:"EllipseGeometry"})})}};function BO(i,e,t,r,n,s){if(r>=KM)return n>30||n%4===0?(OO(i,e,t,s),Math.round(n/4)):QM(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=jM({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?NO(i,o.x,o.y,c,n,e,t,s):QM(i,r,n,e,t,s)}function NO(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Dl(e,t));for(let c=0,u=r.length;c<u;c++){let h=r[c],f=i.points[c],d=Dl(h.x,h.y);f.controls[1].position.set(h.x1,h.y1),d.controls[0].position.set(h.x2,h.y2),i.addPoint(d)}return a>0?$M(i,s,o,a):i.addPoint(Dl(0,0)),l}function QM(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,u=Math.cos(l)*n;i.addPoint(Dl(c,u))}return e<KM?s>0?$M(i,r,n,s):i.addPoint(Dl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&e1(i,r,n,s)),1}function OO(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(hp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(hp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(hp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(hp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&e1(i,e,t,r)}function Dl(i,e){return new ci(tt.generateUUID(),new N(i,e))}function hp(i,e,t,r,n,s){let o=Dl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function $M(i,e,t,r){t1(i,e,t,r).forEach(s=>i.addPoint(s))}function e1(i,e,t,r){let n=t1(i,e,t,r),s=new At;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function t1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new N(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=tt.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var r1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:h}=i.parameters,f=new ju(!1,e,t,r,n,s,o,a,l,c,u,h);return Object.assign(f,{userData:be(se({},i),{type:"HelixGeometry"})})}},ju=class extends Ie{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,u=1,h=1,f=1){super();let d=e&&o===1;d&&(f=0),h>100&&(h=100);let p=()=>new M,m=new M,g=p(),v=p(),y=p(),w,b,S,T,A,x,E,_,C=p(),P=p(),B=p(),R=p(),U=p(),z=p(),J=p(),Q=p(),X=r-2*l+.001,F=X/o,k=Math.ceil(a*o),O=k+1,j=X/k,q=-X/2,K=u+1,W=2*Math.PI/u,ge=Math.PI/2/f,oe=.01,le=Math.min((1-h/100)*l,l-oe),H=l-le,ue=0,Z=2,V=f*Z+Z,$=K*V/Z,ce=$+K*O,ie=K*(O+V),[pe,ve,me]=[3,3,2].map(Te=>Array(ie*Te).fill(0)),De=[],ke=s-l;function I(Te,G){let Me=Math.PI/2;x=G*j,_=2*Math.PI*(x%F)/F+Me,x+=q,E=Math.sin(_)*ke,A=Math.cos(_)*ke,e?Te.set(A,E,x):Te.set(A,x,E)}I(m,-1e-10),I(g,0),C.copy(m),I(m,1);let L=m.distanceTo(g),te=H+le,ye=L*k+2*te,Se=le,Pe=ye-te;for(let Te=0;Te<=k;Te++){I(v,Te),Q.subVectors(v,C).normalize(),C.copy(v),z.copy(v).setComponent(+e+1,0).normalize(),J.crossVectors(Q,z).normalize();let G=Te===0,Me=Te===k,Ce=G?3*Math.PI/2:ge,Ze=G?Se:Pe,Oe=G?K:ce,Qe=G?0:ie-K,Ae=Q.clone().multiplyScalar(G?-H:H).add(v),$e=Q.clone().multiplyScalar(G?-1:1).normalize();for(let at=0;at<K;at++){let ft=at*W;if(P.addVectors(m.copy(z).multiplyScalar(l*Math.cos(ft)),g.copy(J).multiplyScalar(l*Math.sin(ft))),B.copy(P).normalize(),G||Me){d||(ue=Qe+at,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=Ae.getComponent(Ot),ve[ue*3+Ot]=$e.getComponent(Ot)}),me[ue*2]=+Me,me[ue*2+1]=at/u),g.copy(B).multiplyScalar(le),y.addVectors(v,g);for(let Ot=0;Ot<f;Ot++){let Nr=Ot*ge+Ce;R.addVectors(m.copy(Q).multiplyScalar(H*Math.sin(Nr)),g.copy(B).multiplyScalar(H*Math.cos(Nr))),U.copy(R).normalize(),g.addVectors(y,R),R.normalize(),ue=Oe+Ot*K+at,[0,1,2].forEach(We=>{pe[ue*3+We]=g.getComponent(We),ve[ue*3+We]=U.getComponent(We)});let ea=+G+Math.sin(Nr);me[ue*2]=(Ze+H*ea)/ye,me[ue*2+1]=at/u}}g.addVectors(v,P),ue=$+Te*K+at,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=g.getComponent(Ot),ve[ue*3+Ot]=B.getComponent(Ot)}),me[ue*2]=(te+Te*L)/ye,me[ue*2+1]=at/u}}let Fe=O+2*f+Z,he=1,[nt,st]=d?[he,he+O-1]:[0,Fe-1];for(let Te=nt;Te<=st-1;Te++){let G=d&&Te===st-1;for(let Me=0;Me<K-1;Me++)w=Te*K+Me,b=w+1,S=(G?Me:w)+K,T=(G?Me+1:b)+K,Te===0?De.push(b,T,S):Te===Fe-2?De.push(w,b,S):De.push(w,b,S,b,T,S)}this.setIndex(De),this.setAttribute("position",new Le(pe,3)),this.setAttribute("normal",new Le(ve,3)),this.setAttribute("uv",new Le(me,2))}};var n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new qu(e*.5,s,o):new Ua(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"IcosahedronGeometry"})})}},qu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(s,o,a,e,t,r),this.type=a}static fromJSON(e){return new qu(e.radius,e.corner,e.cornerSides)}};var i1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new en;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Ba(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:be(se({},i),{type:"LatheGeometry"})})}};var Bi=new _e,av=new ot,fp=new M,so=class extends jt{constructor(){super(),this.uuid=tt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Nt().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];s.normal.applyMatrix3(t).normalize();for(let o=0,a=s.vertexNormals.length;o<a;o++)s.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Bi.makeRotationX(e),this.applyMatrix4(Bi),this}rotateY(e){return Bi.makeRotationY(e),this.applyMatrix4(Bi),this}rotateZ(e){return Bi.makeRotationZ(e),this.applyMatrix4(Bi),this}translate(e,t,r){return Bi.makeTranslation(e,t,r),this.applyMatrix4(Bi),this}scale(e,t,r){return Bi.makeScale(e,t,r),this.applyMatrix4(Bi),this}lookAt(e){return av.lookAt(e),av.updateMatrix(),this.applyMatrix4(av.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new M().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new xe().fromBufferAttribute(a,f));function u(f,d,p,m){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[p].clone()],v=o===void 0?[]:[new M().fromBufferAttribute(o,f),new M().fromBufferAttribute(o,d),new M().fromBufferAttribute(o,p)],y=new Pl(f,d,p,v,g,m);t.faces.push(y),l!==void 0&&t.faceVertexUvs[0].push([new N().fromBufferAttribute(l,f),new N().fromBufferAttribute(l,d),new N().fromBufferAttribute(l,p)]),c!==void 0&&t.faceVertexUvs[1].push([new N().fromBufferAttribute(c,f),new N().fromBufferAttribute(c,d),new N().fromBufferAttribute(c,p)])}let h=e.groups;if(h.length>0)for(let f=0;f<h.length;f++){let d=h[f],p=d.start,m=d.count;for(let g=p,v=p+m;g<v;g+=3)r!==void 0?u(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):u(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)u(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)u(f,f+1,f+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fp).negate(),this.translate(fp.x,fp.y,fp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new _e;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new M,t=new M;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new M;if(e){let r=new M,n=new M;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new so;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new M,u={a:new M,b:new M,c:new M};s.push(c),o.push(u)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Yr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,s=this.vertices.length,o=this.vertices,a=e.vertices,l=this.faces,c=e.faces,u=this.colors,h=e.colors;t!==void 0&&(n=new Nt().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let m=a[f].clone();t!==void 0&&m.applyMatrix4(t),o.push(m)}for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone());for(let f=0,d=c.length;f<d;f++){let p=c[f],m,g,v=p.vertexNormals,y=p.vertexColors,w=new Pl(p.a+s,p.b+s,p.c+s);w.normal.copy(p.normal),n!==void 0&&w.normal.applyMatrix3(n).normalize();for(let b=0,S=v.length;b<S;b++)m=v[b].clone(),n!==void 0&&m.applyMatrix3(n).normalize(),w.vertexNormals.push(m);w.color.copy(p.color);for(let b=0,S=y.length;b<S;b++)g=y[b],w.vertexColors.push(g.clone());w.materialIndex=p.materialIndex+r,l.push(w)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++)y.push(v[w].clone());this.faceVertexUvs[f].push(y)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},r=[],n=[],s=Math.pow(10,e);for(let l=0,c=this.vertices.length;l<c;l++){let u=this.vertices[l],h=Math.round(u.x*s)+"_"+Math.round(u.y*s)+"_"+Math.round(u.z*s);t[h]===void 0?(t[h]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[h]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let u=this.faces[l];u.a=n[u.a],u.b=n[u.b],u.c=n[u.c];let h=[u.a,u.b,u.c];for(let f=0;f<3;f++)if(h[f]===h[(f+1)%3]){o.push(l);break}}for(let l=o.length-1;l>=0;l--){let c=o[l];this.faces.splice(c,1);for(let u=0,h=this.faceVertexUvs.length;u<h;u++)this.faceVertexUvs[u].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new M(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let m in p)p[m]!==void 0&&(e[m]=p[m]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let m=this.vertices[p];t.push(m.x,m.y,m.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let p=0;p<this.faces.length;p++){let m=this.faces[p],g=!0,v=!1,y=this.faceVertexUvs[0][p]!==void 0,w=m.normal.length()>0,b=m.vertexNormals.length>0,S=m.color.r!==1||m.color.g!==1||m.color.b!==1,T=m.vertexColors.length>0,A=0;if(A=u(A,0,0),A=u(A,1,g),A=u(A,2,v),A=u(A,3,y),A=u(A,4,w),A=u(A,5,b),A=u(A,6,S),A=u(A,7,T),r.push(A),r.push(m.a,m.b,m.c),r.push(m.materialIndex),y){let x=this.faceVertexUvs[0][p];r.push(d(x[0]),d(x[1]),d(x[2]))}if(w&&r.push(h(m.normal)),b){let x=m.vertexNormals;r.push(h(x[0]),h(x[1]),h(x[2]))}if(S&&r.push(f(m.color)),T){let x=m.vertexColors;r.push(f(x[0]),f(x[1]),f(x[2]))}}function u(p,m,g){return g?p|1<<m:p&~(1<<m)}function h(p){let m=p.x.toString()+p.y.toString()+p.z.toString();return s[m]!==void 0||(s[m]=n.length/3,n.push(p.x,p.y,p.z)),s[m]}function f(p){let m=p.r.toString()+p.g.toString()+p.b.toString();return a[m]!==void 0||(a[m]=o.length,o.push(p.getHex())),a[m]}function d(p){let m=p.x.toString()+p.y.toString();return c[m]!==void 0||(c[m]=l.length/2,l.push(p.x,p.y)),c[m]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new so().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++){let S=v[w];y.push(S.clone())}this.faceVertexUvs[f].push(y)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let p={};if(p.name=s[f].name,s[f].vertices!==void 0){p.vertices=[];for(let m=0,g=s[f].vertices.length;m<g;m++)p.vertices.push(s[f].vertices[m].clone())}if(s[f].normals!==void 0){p.normals=[];for(let m=0,g=s[f].normals.length;m<g;m++)p.normals.push(s[f].normals[m].clone())}this.morphTargets.push(p)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let p={};if(o[f].vertexNormals!==void 0){p.vertexNormals=[];for(let m=0,g=o[f].vertexNormals.length;m<g;m++){let v=o[f].vertexNormals[m],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),p.vertexNormals.push(y)}}if(o[f].faceNormals!==void 0){p.faceNormals=[];for(let m=0,g=o[f].faceNormals.length;m<g;m++)p.faceNormals.push(o[f].faceNormals[m].clone())}this.morphNormals.push(p)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);let u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());let h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new lv().fromGeometry(this),t=new Ie,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ue(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ue(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ue(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ue(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ue(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],u=new Le(c.data.length*3,3);u.name=c.name,s.push(u.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Le(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Le(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new Ie,r=e.geometry;if(e.isPoints||e.isLine){let n=new Le(r.vertices.length*3,3),s=new Le(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Le(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};so.prototype.isGeometry=!0;var lv=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let v=0;v<l;v++)c[v]={name:a[v].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(let v=0;v<h;v++)f[v]={name:u[v].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,p=e.skinWeights,m=d.length===r.length,g=p.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let v=0;v<t.length;v++){let y=t[v];this.vertices.push(r[y.a],r[y.b],r[y.c]);let w=y.vertexNormals;if(w.length===3)this.normals.push(w[0],w[1],w[2]);else{let S=y.normal;this.normals.push(S,S,S)}let b=y.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let S=y.color;this.colors.push(S,S,S)}if(s===!0){let S=n[0][v];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new N,new N,new N))}if(o===!0){let S=n[1][v];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new N,new N,new N))}for(let S=0;S<l;S++){let T=a[S].vertices;c[S].data.push(T[y.a],T[y.b],T[y.c])}for(let S=0;S<h;S++){let T=u[S].vertexNormals[v];f[S].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(p[y.a],p[y.b],p[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},Pl=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new M,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new xe,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var FO=["a","b","c"];function UO(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function cv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let u=t[o],h=t[a];c={a:u,b:h,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function zO(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function dp(i,e,t,r,n){i.push(new Pl(e,t,r,void 0,void 0,n))}function Il(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function pp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var mp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Ie?e=new so().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],h=u!==void 0&&u.length>0,f=[],d=new Map;zO(l,c,f,d);let p=[],m,g,v,y,w,b,S;for(let oe of Array.from(d.keys())){for(g=d.get(oe),v=new M,w=3/8,b=1/8,S=g.faces.length,S!=2&&(w=.5,b=0,S!=1),v.addVectors(g.a,g.b).multiplyScalar(w),t.set(0,0,0),o=0;o<S;o++){for(y=g.faces[o],a=0;a<3&&(m=l[UO(y,FO[a])],!(m!==g.a&&m!==g.b));a++);m&&t.add(m)}t.multiplyScalar(b),v.add(t),g.newEdge=p.length,p.push(v)}let T,A,x,E,_,C,P,B=[];for(n=0,s=l.length;n<s;n++){for(C=l[n],_=f[n].edges,r=_.length,r==3?T=3/16:r>3&&(T=3/(8*r)),A=1-r*Number(T),x=T,r<=2&&(r==2?(A=3/4,x=1/8):r==1||r==0),P=C.clone().multiplyScalar(A),t.set(0,0,0),o=0;o<r;o++)E=_[o],m=E.a!==C?E.a:E.b,t.add(m);t.multiplyScalar(Number(x)),P.add(t),B.push(P)}let R=B.concat(p),U=B.length,z,J,Q,X=[],F=[],k,O,j,q,K=new N,W=new N,ge=new N;for(n=0,s=c.length;n<s;n++)y=c[n],z=Number(cv(y.a,y.b,d).newEdge)+U,J=Number(cv(y.b,y.c,d).newEdge)+U,Q=Number(cv(y.c,y.a,d).newEdge)+U,dp(X,z,J,Q,y.materialIndex),dp(X,y.a,z,Q,y.materialIndex),dp(X,y.b,J,z,y.materialIndex),dp(X,y.c,Q,J,y.materialIndex),h&&(k=u[n],O=k[0],j=k[1],q=k[2],K.set(Il(O.x,j.x),Il(O.y,j.y)),W.set(Il(j.x,q.x),Il(j.y,q.y)),ge.set(Il(O.x,q.x),Il(O.y,q.y)),pp(F,K,W,ge),pp(F,O,K,ge),pp(F,j,W,K),pp(F,q,ge,W));e.vertices=R,e.faces=X,h&&(e.faceVertexUvs[0]=F)}};var Ar=new M,s1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Ie().copy(new mn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Ar),r={width:Ar.x,height:Ar.y,depth:Ar.z,subdivisions:0}):r=e.parameters;let n=se(se({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Ie().copy(new mn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Ar)):Ar.set(o.width,o.height,o.depth),(e!==Ar.x||t!==Ar.y||r!==Ar.z)&&s.scale(Ar.x===0?1:e/Ar.x,Ar.y===0?1:t/Ar.y,Ar.z===0?1:r/Ar.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new mp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:be(se({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Gs(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Ar);let o=100/Ar.x;Object.assign(s.parameters,{width:100,height:Ar.y*o,depth:Ar.z*o}),e(this.build(s))})}};var o1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=i.parameters,l=i.shape,c=e*.5,u=t*.5,h=0,f=0,d=2*Math.PI/r;for(let m=0;m<r;m++){let g=d*m,v=h+Math.sin(g)*c,y=f+Math.cos(g)*u;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=n;l.roundness=n,l.update();let p=Gr.create({shape:l,parameters:{roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:be(se({},i),{type:"PolygonGeometry"})})}};var a1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new fv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:be(se({},i),{type:"PyramidGeometry"})})}};function Yu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function hv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function GO(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var fv=class extends Ie{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],u=[],h=[],f=0,d=t/2,p=Math.PI/r,m=e*Math.cos(Math.PI/r),g=2*Math.PI/r,v=(r-2)*Math.PI/r,y=Math.PI-v,w=new M(0,-d,0),b=new M(0,d,0),S=new N(e,-d),T=new N(m,-d),A=new N(0,b.y).sub(T),x=new N(0,b.y).sub(S),E=new N(A.y,-A.x).normalize(),_=new N(x.y,-x.x).normalize(),P=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-A.angle())/2)-1e-8;o=Math.min(o,P);let B;{let F=new M(E.x,E.y,0),k=new M(Math.cos(g)*F.x,F.y,Math.sin(g)*F.x);B=F.angleTo(k)}let R=o/Math.tan((Math.PI-A.angle())/2),U=o/Math.tan((Math.PI-B)/2),z=new M;if(!s){c.push(w.x,w.y,w.z),u.push(0,-1,0),h.push(0,0);let F=f++,k=[],O=S.clone(),j=R/Math.cos(Math.PI/r);O.x-=j;for(let q=0;q<r;q++){let K=q/r*Math.PI*2+p,W=new N(Math.sin(K),Math.cos(K));Yu(O,W,z),c.push(z.x,z.y,z.z),u.push(0,-1,0),h.push(0,0),k.push(f++)}for(let q=0;q<k.length;q++)l.push(k[q],F,k[(q+1)%k.length])}let J=[];{let F=new M,k=new M,O=new M,j=new M,q=new M,K=new M;for(let W=0;W<r;W++){let ge=W/r*Math.PI*2+p,oe=(W+.5)/r*Math.PI*2+p,le=(W+1)/r*Math.PI*2+p,H=new N(Math.sin(ge),Math.cos(ge)),ue=new N(Math.sin(oe),Math.cos(oe)),Z=new N(Math.sin(le),Math.cos(le));Yu(S,H,k),Yu(S,Z,O),Yu(E,ue,F),hv(b,k,O,U,U,j),c.push(j.x,j.y,j.z),hv(k,b,O,U,R,q),c.push(q.x,q.y,q.z),hv(O,k,b,R,U,K),c.push(K.x,K.y,K.z),u.push(F.x,F.y,F.z),u.push(F.x,F.y,F.z),u.push(F.x,F.y,F.z),h.push(0,0),h.push(0,0),h.push(0,0);let V=f++,$=f++,ce=f++;if(l.push(V,$,ce),o>0){{let ve=k.clone().add(O).multiplyScalar(.5),me=b.clone().sub(ve).normalize(),ke=w.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),I=K.clone().sub(q);Q(ve,I,ke,A.angle())}let ie,pe;{let ve=new M;Yu(_,Z,ve);let me=K.clone().add(j).multiplyScalar(.5);me=GO(me,O,b);let De=K.clone().sub(j);[ie,pe]=Q(me,De,ve,B,j.y)}{let ve=ie,me=ve.clone().setY(0).normalize(),De=new M(0,-1,0),ke=me.clone().cross(De);X(ve,me,De,ke)}J.concat(pe);{let ve=A.angle(),me=Math.PI-ve,De=b.clone();De.y-=o/Math.sin(ve-Math.PI/2);let ke=new M,I=[];for(let te=0;te<a;te++){let ye=[],Se=Math.PI/2-me*te/a,Pe=Math.cos(Se),Fe=Math.sin(Se),he=oe;for(let nt=0;nt<=te;nt++){let st=Math.cos(he),Te=Math.sin(he);F.x=Pe*Te,F.y=Fe,F.z=Pe*st,ke.copy(De).addScaledVector(F,o),c.push(ke.x,ke.y,ke.z),u.push(F.x,F.y,F.z),h.push(0,0),ye.push(f++),he+=Math.PI*2/te/r}I.push(ye)}pe.reverse(),I.push(pe);let L=I.length-1;for(let te=0;te<L;te++){let ye=I[te],Se=I[te+1],Pe=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Pe;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function Q(F,k,O,j,q){let K=-j/2,W=(Math.PI-j)/2,ge=k.clone().normalize().cross(O);F.addScaledVector(O,-o/Math.sin(W));let oe=new M,le=new M,H=1,ue=f,Z=[];for(let V=0;V<=a;V++){let $=K+V/a*j;le.set(0,0,0),le.addScaledVector(ge,Math.sin($)),le.addScaledVector(O,Math.cos($));for(let ce=0;ce<=H;ce++){let ie=ce/H-.5;if(oe.copy(F),oe.addScaledVector(k,ie),oe.addScaledVector(le,o),q!=null){let pe=Math.max(0,oe.y-q);oe.addScaledVector(k,-pe/k.y)}c.push(oe.x,oe.y,oe.z),u.push(le.x,le.y,le.z),h.push(0,0),ce===0&&Z.push(f),f++}}for(let V=0;V<a;V++)for(let $=0;$<H;$++){let ce=ue+$+(H+1)*V,ie=ce+(H+1),pe=ie+1,ve=ce+1;l.push(ce,ie,ve),l.push(ie,pe,ve)}return[F.clone().addScaledVector(k,.5),Z]}function X(F,k,O,j){let q=Math.PI/2,K=x.angle()-q,W=[],ge=new M,oe=new M;for(let H=0;H<=a;H++){let ue=[],Z=H/a;for(let V=0;V<=H;V++){let ce=((H?V/H:0)-.5)*y,ie=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan(K)*ie),me=(q+ve)*Z,De=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(k,ke*ie),ge.addScaledVector(O,De),ge.addScaledVector(j,ke*pe),oe.copy(F).addScaledVector(ge,o),c.push(oe.x,oe.y,oe.z),u.push(ge.x,ge.y,ge.z),h.push(0,0),ue.push(f++)}W.push(ue)}let le=W.length-1;for(let H=0;H<le;H++){let ue=W[H],Z=W[H+1],V=ue.length-1;l.push(ue[0],Z[1],Z[0]);for(let $=1;$<=V;$++)l.push(ue[$-1],ue[$],Z[$]),l.push(ue[$],Z[$+1],Z[$])}}}};var gp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o,a,l;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((o=e==null?void 0:e.ui)!=null?o:{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((a=t.height)!=null?a:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(l=t.depth)!=null?l:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c={x:t*.5,y:r*.5},u={x:-c.x,y:-c.y},h={x:c.x,y:c.y};function f(b,S,T){return S>t&&T>r?Math.min(b*t/S,b*r/T):S>t?b*t/S:T>r?b*r/T:b}let d=[];d[0]=n[0]===0?0:f(n[0],n[0]+n[3],n[0]+n[1]),d[1]=n[1]===0?0:f(n[1],n[1]+n[2],n[1]+n[0]),d[2]=n[2]===0?0:f(n[2],n[2]+n[1],n[2]+n[3]),d[3]=n[3]===0?0:f(n[3],n[3]+n[0],n[3]+n[2]);let p=u.x,m=h.x,g=h.y,v=u.y;e.addPoint(e.createPoint(p,g)),e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let y=!0;for(let b=0,S=e.points.length;b<S;b++)e.points[b].roundness=d[b],b>0&&d[b]!==d[b-1]&&(y=!1);y&&(e.roundness=d[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Gr.create({shape:e,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:be(se({},i),{type:"RectangleGeometry"})})}};var l1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u=new Do(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:be(se({},i),{type:"SphereGeometry"})})}};var c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new ts(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:be(se({},i),{type:"PlaneGeometry"})})}};var u1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,u=i.shape,h=e*.5,f=t*.5,d=0,p=0,m=o*Math.PI/360/n,g=Math.PI/2*3*-1,v=h*r/100,y=f*r/100;if(n===3&&r===50){m=2*Math.PI/n;for(let b=0;b<n;b++){let S=m*b,T=d+Math.sin(S)*h,A=p+Math.cos(S)*f;u.addPoint(u.createPoint(T,A))}}else for(let b=0;b<n;b++){let S=d+Math.cos(g)*h,T=p+Math.sin(g)*f;u.addPoint(u.createPoint(S,T)),g+=m,S=d+Math.cos(g)*v,T=p+Math.sin(g)*y,b<=n,u.addPoint(u.createPoint(S,T)),g+=m}u.isClosed=!0;for(let b=0,S=u.points.length;b<S;b++)u.points[b].roundness=s;u.roundness=s,u.update();let w=Gr.create({shape:u,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:be(se({},i),{type:"StarGeometry"})})}};var yp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new ts(e,t);return Object.assign(r,{userData:be(se({},i),{type:"TextFrameGeometry"})})}};var h1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),n=Math.abs((a=t.height)!=null?a:t.width),s=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=kO(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:be(se({},i),{type:"TorusGeometry"})})}};function kO(i,e,t,r,n,s,o,a,l,c,u){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new ju(!0,i,e,t,r,n,s,o,a,l,c,u)}var f1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new za(a,t,r,n,s,o);return Object.assign(l,{userData:be(se({},i),{type:"TorusKnotGeometry"})})}};var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=i.parameters,l=i.shape,c=e*.5,u=t*.5;a?(l.addPoint(l.createPoint(-c,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))):(l.addPoint(l.createPoint(0,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))),l.isClosed=!0;for(let f=0,d=l.points.length;f<d;f++)l.points[f].roundness=r;l.roundness=r,l.update();let h=Gr.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(h,{userData:be(se({},i),{type:"TriangleGeometry"})})}};var Xu={};pT(Xu,{addBarycentricAttribute:()=>WO,fixUvs:()=>qO,loadFromUrl:()=>jO,resizeGeometry:()=>HO,roundShapePolygon:()=>VO});var p1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},VO=(i,e,t)=>{let r,n,s,o,a,l,c,u,h,f,d,p,m,g,v=e.length;for(o=e[v-2],i.curves=[],r=1;r<v-1;r++){a=e[r%v],l=e[(r+1)%v];let y=p1(a,o),w=p1(a,l);c=y.nx*w.ny-y.ny*w.nx,u=y.nx*w.nx-y.ny*-w.ny,d=Math.asin(c),h=1,f=!1,u<0?d<0?d=Math.PI+d:(d=Math.PI-d,h=-1,f=!0):d>0&&(h=-1,f=!0),p=d/2,g=Math.abs(Math.cos(p)*t/Math.sin(p)),g>Math.min(y.len/2,w.len/2)?(g=Math.min(y.len/2,w.len/2),m=Math.abs(g*Math.sin(p)/Math.cos(p))):m=t,n=a.x+w.nx*g,s=a.y+w.ny*g,n+=-w.ny*m*h,s+=w.nx*m*h,i.absarc(n,s,m,y.ang+Math.PI/2*h,w.ang-Math.PI/2*h,f),o=a,a=l}i.closePath()},HO=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},WO=(i,e)=>{let t=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Le(n,3))},jO=i=>new Promise(e=>{new Gs().load(i,r=>e(r))}),qO=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var YO,vp=new Promise(i=>{YO=i});var Ye;vp.then(i=>{Ye=i});var m1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),g1=new Uint32Array([0,1,2,3]),y1=new Uint8Array([4]),Pn=class{static build(i,e,t,r,n){let s,o,a;if(i===void 0)s=Pn.allocate(n,t),Ye.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(Ye.free_bvh(e),Ye.free_subdivision_surface(e));try{s=Pn.allocate(n,void 0,i)}catch(l){console.error(l,i),s=Pn.allocate(n,void 0,{positionWASM:m1,indexWASM:g1,verticesPerFaceWASM:y1})}Ye.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r)}else s=e;if(i!==void 0&&i.subdivisions!==void 0){let l=XO(i.subdivisions,i.positionWASM.length);Ye.set_destination_refinement_level(s,l),l>0?a=Pn.buildLevel(s,!1,r):a=null}return{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var S;let r,n,s,o=[],a=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM):(r=m1,n=g1,s=y1);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let T=SM(e);r=T.attributes.position.array;let A=T.getIndex().array,x=A.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":n=new Uint32Array(x/3*2),s=new Uint8Array(x/6).fill(4);for(let U=0,z=0;U<x;U+=6)n[z++]=A[U],n[z++]=A[U+1],n[z++]=A[U+4],n[z++]=A[U+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let E,_,C;if(e.userData.type==="SphereGeometry")_=e.parameters.heightSegments,E=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(C=!0);else if(e.userData.type==="CylinderGeometry")_=e.parameters.heightSegments+2,E=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")_=e.parameters.heightSegments+1,E=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let U=e.userData.parameters;_=Math.ceil(U.tubularSegments*U.arc/(2*Math.PI))+2,E=U.radialSegments}else{let{pathSegments:U,segments:z,revolutions:J}=e.userData.parameters;_=Math.ceil(z*J)+2,E=U}C?(n=new Uint32Array(1*E*3+(_-1)*E*4),s=new Uint8Array(1*E+(_-1)*E)):(n=new Uint32Array(2*E*3+(_-2)*E*4),s=new Uint8Array(2*E+(_-2)*E));let P=0,B=0,R=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;B<3*E;)n[B++]=A[P++],n[B++]=A[P++],n[B++]=A[P++],s[R++]=3;let U=C?n.length:3*E+4*(_-2)*E;for(;B<U;P+=6)n[B++]=A[P],n[B++]=A[P+1],n[B++]=A[P+4],n[B++]=A[P+5],s[R++]=4}else for(;B<4*(_-2)*E;P+=6)n[B++]=A[P],n[B++]=A[P+1],n[B++]=A[P+4],n[B++]=A[P+5],s[R++]=4;for(;B<n.length;)n[B++]=A[P++],n[B++]=A[P++],n[B++]=A[P++],s[R++]=3;break;default:n=A,s=new Uint8Array(x/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,h=r.length+o.length+a.length,f=n.length+s.length,d=h*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,p=h*Float32Array.BYTES_PER_ELEMENT,m=f*Uint32Array.BYTES_PER_ELEMENT,g=Ye._malloc(d),v=new Float32Array(Ye.HEAPF32.buffer,g,h),y=new Uint32Array(Ye.HEAPU32.buffer,g+p,f);v.set(r,0),v.set(o,r.length),v.set(a,r.length+o.length),y.set(n,0),y.set(s,n.length);let w;(S=t==null?void 0:t.scaleBaked)!=null&&S.some(T=>T!==1)&&(w=new _e().makeScale(...t.scaleBaked)),i&&(w?w.premultiply(i):w=i);let b=w?Ye.alloc_subdivision_surface2(g,l,g+p,c,g+p+n.length*Uint32Array.BYTES_PER_ELEMENT,u,w.elements):Ye.alloc_subdivision_surface(g,l,g+p,c,g+p+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Ye._free(g),b}static buildLevel(i,e,t,r,n){let s=n?Ye.get_mesh_data2(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t!=null?t:!e,n.elements):Ye.get_mesh_data(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t!=null?t:!e),o=8,a=Ye.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=Ye.HEAPU32[a[c]>>2],h=Ye.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Ye.HEAPU32[a[c]>>2],d=Ye.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let p=Ye.HEAPU32[a[c]>>2],m=Ye.HEAPU32.subarray(p>>2,(p>>2)+l[c]);c++;let g=Ye.HEAPU32[a[c]>>2],v=Ye.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let y=new Ie;if(y.setIndex(new Is(v,1)),y.setAttribute("position",new Le(h,3)),y.setAttribute("normal",new Le(d,3)),e){y.setAttribute("faceMap",new Is(m,1));let w=new Float32Array(d.length/3*4).fill(0);y.setAttribute("color",new Ue(w,4))}return Ye.free_mesh_data(s),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Ye.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Ye.get_wireframe_data_for_base_level(i),n=4,s=Ye.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Ye.HEAPU32[s[a]>>2],c=Ye.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=Ye.HEAPU32[s[a]>>2],h=Ye.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let f=new Ie;f.setAttribute("position",new Le(c,3));let d=new Float32Array(c.length);for(let p=0,m=c.length;p<m;)d[p++]=t.r,d[p++]=t.g,d[p++]=t.b;return f.setAttribute("color",new Ue(d,3)),f.setIndex(new Is(h,1)),Ye.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Ye.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Ye.set_destination_refinement_level(i,1);let r=t?Ye.get_topological_data2(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t.elements):Ye.get_topological_data(i,e?Ye.Level.CONTROL:Ye.Level.REFINED),n=6,s=Ye.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Ye.HEAPU32[s[a]>>2],c=new Float32Array(Ye.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=Ye.HEAPU32[s[a]>>2],h=new Uint32Array(Ye.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let f=Ye.HEAPU32[s[a]>>2],d=new Uint8Array(Ye.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Ye.free_topological_data(r),{positions:c,indices:h,verticesPerFace:d}}};function XO(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var dv={ConeGeometry:PM,CubeGeometry:IM,CylinderGeometry:DM,DodecahedronGeometry:RM,EllipseGeometry:ZM,HelixGeometry:r1,IcosahedronGeometry:n1,LatheGeometry:i1,NonParametricGeometry:s1,PolygonGeometry:o1,PyramidGeometry:a1,RectangleGeometry:gp,SphereGeometry:l1,PlaneGeometry:c1,StarGeometry:u1,TextFrameGeometry:yp,TorusGeometry:h1,TorusKnotGeometry:f1,TriangleGeometry:d1,VectorGeometry:Gr},Ju=i=>dv[i.type].create(i);var kr=class extends xe{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};function fr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new kr(0,0,0,0))}else return"a"in i?new kr(i.r,i.g,i.b,i.a):new kr(i.r,i.g,i.b,1);return t}var jo=i=>"isEntity"in i,us=i=>"isAbstractMesh"in i,v1=i=>i.objectType==="CombinedCamera",x1=i=>jo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var hs=i=>"objectHelper"in i;function pv(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:_i.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function JO(i,e){pv(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function b1(i,e,t){JO(i,e),e.color!==void 0&&(i.color=fr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof zs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof zs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&hs(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function w1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Rl=new Qt,Vr=new M,Ge=new M,xr=new _e;function QO(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=t;u<r;u++){let h=e.getX(u),f=e.getY(u),d=e.getZ(u);h<n&&(n=h),f<s&&(s=f),d<o&&(o=d),h>a&&(a=h),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var S1=(i,e,t,r)=>{var n;if(us(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Vr.copy(i.originalGeometry.boundingSphere.center):(QO(Rl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Rl.getCenter(Vr)),i.forceComputeSize?Rl.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(hs(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Rl.setFromArray(s.array),Rl.getCenter(Vr),Rl.getSize(Ge).multiplyScalar(.5)}else Vr.setScalar(0),Ge.setScalar(0);xr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new M(Vr.x,Vr.y,Vr.z).applyMatrix4(xr)):t.push(new M(-Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr))},Qu=class extends Qt{constructor(){super(...arguments);this.matrix=new _e;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new _e().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&S1(o,r,s,t.enableHelper===!0)}):S1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(xr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Vr),xr.copy(this.matrix).setPosition(Vr),this.vertices=[new M(-Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new M(-Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new M(Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new M(Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new M(-Ge.x,Ge.y,-Ge.z).applyMatrix4(xr),new M(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new M(Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new M(Ge.x,Ge.y,-Ge.z).applyMatrix4(xr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Xr(this.vertices[0],this.vertices[3]),new Xr(this.vertices[1],this.vertices[2]),new Xr(this.vertices[5],this.vertices[6]),new Xr(this.vertices[4],this.vertices[7]),new Xr(this.vertices[0],this.vertices[1]),new Xr(this.vertices[3],this.vertices[2]),new Xr(this.vertices[7],this.vertices[6]),new Xr(this.vertices[4],this.vertices[5]),new Xr(this.vertices[0],this.vertices[4]),new Xr(this.vertices[1],this.vertices[5]),new Xr(this.vertices[2],this.vertices[6]),new Xr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new M().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new M().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new M().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new M().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new M().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new M().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function Ku(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function KO(i){let e=[];for(let t in i)e.push(i[t]);return e}var xp=i=>class extends i{hasEntityChild(){return this.children.some(t=>jo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new _e().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),jo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(jo(o)||o instanceof yn)&&s.children.push(o.toJSON(t).object)}if(r){let o=Ku(t.geometries),a=Ku(t.materials),l=Ku(t.textures),c=Ku(t.images),u=Ku(t.interactionStates),h=KO(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),h.length>0&&(n.nodes=h)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var Yn=i=>"isEntity"in i;var Xn=i=>class extends xp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new _e;this._singleBBox=new Qu;this._recursiveBBox=new Qu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Yn(n)&&n.traverseEntity(s=>{hs(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Yn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Yn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),n)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Yn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Yn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new _e,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Yn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new _e}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return yl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=se({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return yl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var Zu=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new M),s=.1;this.parameters=Od.defaultData(n.toArray(),s),zo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*tt.DEG2RAD,s=r.end*tt.DEG2RAD,o=n-s,a=new pn(r.rotation[0]*tt.DEG2RAD,r.rotation[1]*tt.DEG2RAD,r.rotation[2]*tt.DEG2RAD),l;switch(r.axis){case"z":l=new M(0,0,1);break;case"y":l=new M(0,1,0);break;default:case"x":l=new M(1,0,0);break}for(let[c,u]of this.children.entries()){u.hiddenMatrix.identity(),u.scale.x=r.scale[0],u.scale.y=r.scale[1],u.scale.z=r.scale[2],u.position.setScalar(0);let h=o/t.count*c-n;switch(r.axis){case"x":u.rotation.set(0,h,0);break;case"y":u.rotation.set(0,0,h);break;case"z":u.rotation.set(h,0,0);break}u.translateOnAxis(l,r.radius),u.position.x+=r.position[0],u.position.y+=r.position[1],u.position.z+=r.position[2],r.alignment===!0?(u.rotation.x+=a.x,u.rotation.y+=a.y,u.rotation.z+=a.z):u.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new pn(r.rotation[0]*tt.DEG2RAD,r.rotation[1]*tt.DEG2RAD,r.rotation[2]*tt.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new M(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let u=this.children[r++];u.hiddenMatrix.identity(),u.scale.setScalar(1),u.rotation.set(0,0,0),u.position.x=n.size[0]*a-o.x,u.position.y=n.size[1]*l-o.y,u.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),zo(this.parameters,t),this.update(),this}};var Yt=class extends Xn(Gt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=dv[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Xu.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=Ju(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new Zu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Zu(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0),this}};var $u=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};var He=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=tt.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof He&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var mv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},Tr=new mv;var Xe=class extends He{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=tt.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let u=this.generate(t,l,n);return t.addNodeCode(c+" = "+u+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var Ht=class extends Xe{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Ir=class extends Ht{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof N?t:new N(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rr=class extends Ht{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof M?t:new M(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var ui=class extends Ht{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof kr?t:new kr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var ZO=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,M1=/[a-z_0-9]+/gi,Ne=class extends Xe{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let u=[];for(;a=M1.exec(this.src);)u.push(a);for(let h=0;h<u.length;h++){let f=u[h],d=f[0],p=this.isMethod?!this.getInputByName(d):!0,m=d;if(this.keywords[d]||this.useKeywords&&p&&Tr.containsKeyword(d)){let g=this.keywords[d];if(!g){let v=Tr.getKeywordData(d);v.cache&&(g=t.keywords[d]),g=g||Tr.getKeyword(d,t),v.cache&&(t.keywords[d]=g)}m=g.build(t)}d!==m&&(c=c.substring(0,f.index+l)+m+c.substring(f.index+d.length+l),l+=m.length-d.length),this.getIncludeByName(m)===void 0&&Tr.contains(m)&&t.include(Tr.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=ZO.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(M1);if(a){let l=0;for(;l<a.length;){let c=a[l++],u;c==="in"||c==="out"||c==="inout"?u=a[l++]:(u=c,c="");let h=a[l++];this.inputs.push({name:h,type:u,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var $O=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,gv=class extends Xe{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||gv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",u=$O.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",u&&u.length>1?(l=u[1],a=u[2],c=u[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},bt=gv;bt.PI="PI",bt.PI2="PI2",bt.RECIPROCAL_PI="RECIPROCAL_PI",bt.RECIPROCAL_PI2="RECIPROCAL_PI2",bt.LOG2="LOG2",bt.EPSILON="EPSILON";var eF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2986
|
+
}`;function gb(i,e,t){let r=new Pa,n=new N,s=new N,o=new Ke,a=new Jc({depthPacking:uE}),l=new Qc,c={},u=t.maxTextureSize,h={0:Cr,1:ni,2:ir},f=new St({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new N},radius:{value:4}},vertexShader:tP,fragmentShader:rP}),d=f.clone();d.defines.HORIZONTAL_PASS=1;let p=new Ie;p.setAttribute("position",new Ue(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new Gt(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=eb,this.render=function(b,S,T){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;let A=i.getRenderTarget(),x=i.getActiveCubeFace(),E=i.getActiveMipmapLevel(),_=i.state;_.setBlending(kt),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);for(let C=0,P=b.length;C<P;C++){let B=b[C],R=B.shadow;if(R===void 0){console.warn("THREE.WebGLShadowMap:",B,"has no shadow.");continue}if(R.autoUpdate===!1&&R.needsUpdate===!1)continue;n.copy(R.mapSize);let U=R.getFrameExtents();if(n.multiply(U),s.copy(R.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/U.x),n.x=s.x*U.x,R.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/U.y),n.y=s.y*U.y,R.mapSize.y=s.y)),R.map===null&&!R.isPointLightShadow&&this.type===Bc&&(R.map=new mt(n.x,n.y),R.map.texture.name=B.name+".shadowMap",R.mapPass=new mt(n.x,n.y),R.camera.updateProjectionMatrix()),R.map===null){let J={minFilter:lr,magFilter:lr,format:On};R.map=new mt(n.x,n.y,J),R.map.texture.name=B.name+".shadowMap",R.camera.updateProjectionMatrix()}i.setRenderTarget(R.map),i.clear();let z=R.getViewportCount();for(let J=0;J<z;J++){let Q=R.getViewport(J);o.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),_.viewport(o),R.updateMatrices(B,J),r=R.getFrustum(),w(S,T,R.camera,B,this.type)}!R.isPointLightShadow&&this.type===Bc&&v(R,T),R.needsUpdate=!1}g.needsUpdate=!1,i.setRenderTarget(A,x,E)};function v(b,S){let T=e.update(m);f.defines.VSM_SAMPLES!==b.blurSamples&&(f.defines.VSM_SAMPLES=b.blurSamples,d.defines.VSM_SAMPLES=b.blurSamples,f.needsUpdate=!0,d.needsUpdate=!0),f.uniforms.shadow_pass.value=b.map.texture,f.uniforms.resolution.value=b.mapSize,f.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(S,null,T,f,m,null),d.uniforms.shadow_pass.value=b.mapPass.texture,d.uniforms.resolution.value=b.mapSize,d.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(S,null,T,d,m,null)}function y(b,S,T,A,x,E){let _=null,C=T.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(C!==void 0?_=C:_=T.isPointLight===!0?l:a,i.localClippingEnabled&&S.clipShadows===!0&&S.clippingPlanes.length!==0||S.displacementMap&&S.displacementScale!==0||S.alphaMap&&S.alphaTest>0){let P=_.uuid,B=S.uuid,R=c[P];R===void 0&&(R={},c[P]=R);let U=R[B];U===void 0&&(U=_.clone(),R[B]=U),_=U}return _.visible=S.visible,_.wireframe=S.wireframe,E===Bc?_.side=S.shadowSide!==null?S.shadowSide:S.side:_.side=S.shadowSide!==null?S.shadowSide:h[S.side],_.alphaMap=S.alphaMap,_.alphaTest=S.alphaTest,_.clipShadows=S.clipShadows,_.clippingPlanes=S.clippingPlanes,_.clipIntersection=S.clipIntersection,_.displacementMap=S.displacementMap,_.displacementScale=S.displacementScale,_.displacementBias=S.displacementBias,_.wireframeLinewidth=S.wireframeLinewidth,_.linewidth=S.linewidth,T.isPointLight===!0&&_.isMeshDistanceMaterial===!0&&(_.referencePosition.setFromMatrixPosition(T.matrixWorld),_.nearDistance=A,_.farDistance=x),_}function w(b,S,T,A,x){if(b.visible===!1)return;if(b.layers.test(S.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&x===Bc)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);let C=e.update(b),P=b.material;if(Array.isArray(P)){let B=C.groups;for(let R=0,U=B.length;R<U;R++){let z=B[R],J=P[z.materialIndex];if(J&&J.visible){let Q=y(b,J,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,Q,b,z)}}}else if(P.visible){let B=y(b,P,A,T.near,T.far,x);i.renderBufferDirect(T,null,C,B,b,null)}}let _=b.children;for(let C=0,P=_.length;C<P;C++)w(_[C],S,T,A,x)}}function nP(i,e,t){let r=t.isWebGL2;function n(){let G=!1,Me=new Ke,Ce=null,Ze=new Ke(0,0,0,0);return{setMask:function(Oe){Ce!==Oe&&!G&&(i.colorMask(Oe,Oe,Oe,Oe),Ce=Oe)},setLocked:function(Oe){G=Oe},setClear:function(Oe,Qe,Ae,$e,at){at===!0&&(Oe*=$e,Qe*=$e,Ae*=$e),Me.set(Oe,Qe,Ae,$e),Ze.equals(Me)===!1&&(i.clearColor(Oe,Qe,Ae,$e),Ze.copy(Me))},reset:function(){G=!1,Ce=null,Ze.set(-1,0,0,0)}}}function s(){let G=!1,Me=null,Ce=null,Ze=null;return{setTest:function(Oe){Oe?K(2929):W(2929)},setMask:function(Oe){Me!==Oe&&!G&&(i.depthMask(Oe),Me=Oe)},setFunc:function(Oe){if(Ce!==Oe){if(Oe)switch(Oe){case PT:i.depthFunc(512);break;case IT:i.depthFunc(519);break;case RT:i.depthFunc(513);break;case $m:i.depthFunc(515);break;case BT:i.depthFunc(514);break;case NT:i.depthFunc(518);break;case OT:i.depthFunc(516);break;case FT:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);Ce=Oe}},setLocked:function(Oe){G=Oe},setClear:function(Oe){Ze!==Oe&&(i.clearDepth(Oe),Ze=Oe)},reset:function(){G=!1,Me=null,Ce=null,Ze=null}}}function o(){let G=!1,Me=null,Ce=null,Ze=null,Oe=null,Qe=null,Ae=null,$e=null,at=null;return{setTest:function(ft){G||(ft?K(2960):W(2960))},setMask:function(ft){Me!==ft&&!G&&(i.stencilMask(ft),Me=ft)},setFunc:function(ft,Ot,Nr){(Ce!==ft||Ze!==Ot||Oe!==Nr)&&(i.stencilFunc(ft,Ot,Nr),Ce=ft,Ze=Ot,Oe=Nr)},setOp:function(ft,Ot,Nr){(Qe!==ft||Ae!==Ot||$e!==Nr)&&(i.stencilOp(ft,Ot,Nr),Qe=ft,Ae=Ot,$e=Nr)},setLocked:function(ft){G=ft},setClear:function(ft){at!==ft&&(i.clearStencil(ft),at=ft)},reset:function(){G=!1,Me=null,Ce=null,Ze=null,Oe=null,Qe=null,Ae=null,$e=null,at=null}}}let a=new n,l=new s,c=new o,u={},h={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,P=null,B=i.getParameter(35661),R=!1,U=0,z=i.getParameter(7938);z.indexOf("WebGL")!==-1?(U=parseFloat(/^WebGL (\d)/.exec(z)[1]),R=U>=1):z.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(z)[1]),R=U>=2);let J=null,Q={},X=i.getParameter(3088),F=i.getParameter(2978),k=new Ke().fromArray(X),O=new Ke().fromArray(F);function j(G,Me,Ce){let Ze=new Uint8Array(4),Oe=i.createTexture();i.bindTexture(G,Oe),i.texParameteri(G,10241,9728),i.texParameteri(G,10240,9728);for(let Qe=0;Qe<Ce;Qe++)i.texImage2D(Me+Qe,0,6408,1,1,0,6408,5121,Ze);return Oe}let q={};q[3553]=j(3553,3553,1),q[34067]=j(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),K(2929),l.setFunc($m),$(!1),ce(mx),K(2884),Z(kt);function K(G){u[G]!==!0&&(i.enable(G),u[G]=!0)}function W(G){u[G]!==!1&&(i.disable(G),u[G]=!1)}function ge(G,Me){return h[G]!==Me?(i.bindFramebuffer(G,Me),h[G]=Me,r&&(G===36009&&(h[36160]=Me),G===36160&&(h[36009]=Me)),!0):!1}function oe(G,Me){let Ce=d,Ze=!1;if(G)if(Ce=f.get(Me),Ce===void 0&&(Ce=[],f.set(Me,Ce)),G.isWebGLMultipleRenderTargets){let Oe=G.texture;if(Ce.length!==Oe.length||Ce[0]!==36064){for(let Qe=0,Ae=Oe.length;Qe<Ae;Qe++)Ce[Qe]=36064+Qe;Ce.length=Oe.length,Ze=!0}}else Ce[0]!==36064&&(Ce[0]=36064,Ze=!0);else Ce[0]!==1029&&(Ce[0]=1029,Ze=!0);Ze&&(t.isWebGL2?i.drawBuffers(Ce):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(Ce))}function le(G){return p!==G?(i.useProgram(G),p=G,!0):!1}let H={[Sa]:32774,[bT]:32778,[wT]:32779};if(r)H[xx]=32775,H[bx]=32776;else{let G=e.get("EXT_blend_minmax");G!==null&&(H[xx]=G.MIN_EXT,H[bx]=G.MAX_EXT)}let ue={[ST]:0,[MT]:1,[AT]:768,[rb]:770,[DT]:776,[CT]:774,[ET]:772,[TT]:769,[nb]:771,[LT]:775,[_T]:773};function Z(G,Me,Ce,Ze,Oe,Qe,Ae,$e){if(G===kt){m===!0&&(W(3042),m=!1);return}if(m===!1&&(K(3042),m=!0),G!==xT){if(G!==g||$e!==A){if((v!==Sa||b!==Sa)&&(i.blendEquation(32774),v=Sa,b=Sa),$e)switch(G){case Es:i.blendFuncSeparate(1,771,1,771);break;case gx:i.blendFunc(1,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}else switch(G){case Es:i.blendFuncSeparate(770,771,1,771);break;case gx:i.blendFunc(770,1);break;case yx:i.blendFuncSeparate(0,769,0,1);break;case vx:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",G);break}y=null,w=null,S=null,T=null,g=G,A=$e}return}Oe=Oe||Me,Qe=Qe||Ce,Ae=Ae||Ze,(Me!==v||Oe!==b)&&(i.blendEquationSeparate(H[Me],H[Oe]),v=Me,b=Oe),(Ce!==y||Ze!==w||Qe!==S||Ae!==T)&&(i.blendFuncSeparate(ue[Ce],ue[Ze],ue[Qe],ue[Ae]),y=Ce,w=Ze,S=Qe,T=Ae),g=G,A=null}function V(G,Me){G.side===ir?W(2884):K(2884);let Ce=G.side===Cr;Me&&(Ce=!Ce),$(Ce),G.blending===Es&&G.transparent===!1?Z(kt):Z(G.blending,G.blendEquation,G.blendSrc,G.blendDst,G.blendEquationAlpha,G.blendSrcAlpha,G.blendDstAlpha,G.premultipliedAlpha),l.setFunc(G.depthFunc),l.setTest(G.depthTest),l.setMask(G.depthWrite),a.setMask(G.colorWrite);let Ze=G.stencilWrite;c.setTest(Ze),Ze&&(c.setMask(G.stencilWriteMask),c.setFunc(G.stencilFunc,G.stencilRef,G.stencilFuncMask),c.setOp(G.stencilFail,G.stencilZFail,G.stencilZPass)),pe(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),G.alphaToCoverage===!0?K(32926):W(32926)}function $(G){x!==G&&(G?i.frontFace(2304):i.frontFace(2305),x=G)}function ce(G){G!==yT?(K(2884),G!==E&&(G===mx?i.cullFace(1029):G===vT?i.cullFace(1028):i.cullFace(1032))):W(2884),E=G}function ie(G){G!==_&&(R&&i.lineWidth(G),_=G)}function pe(G,Me,Ce){G?(K(32823),(C!==Me||P!==Ce)&&(i.polygonOffset(Me,Ce),C=Me,P=Ce)):W(32823)}function ve(G){G?K(3089):W(3089)}function me(G){G===void 0&&(G=33984+B-1),J!==G&&(i.activeTexture(G),J=G)}function De(G,Me){J===null&&me();let Ce=Q[J];Ce===void 0&&(Ce={type:void 0,texture:void 0},Q[J]=Ce),(Ce.type!==G||Ce.texture!==Me)&&(i.bindTexture(G,Me||q[G]),Ce.type=G,Ce.texture=Me)}function ke(){let G=Q[J];G!==void 0&&G.type!==void 0&&(i.bindTexture(G.type,null),G.type=void 0,G.texture=void 0)}function I(){try{i.compressedTexImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function L(){try{i.texSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function te(){try{i.texSubImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function ye(){try{i.compressedTexSubImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Se(){try{i.texStorage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Pe(){try{i.texStorage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function Fe(){try{i.texImage2D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function he(){try{i.texImage3D.apply(i,arguments)}catch(G){console.error("THREE.WebGLState:",G)}}function nt(G){k.equals(G)===!1&&(i.scissor(G.x,G.y,G.z,G.w),k.copy(G))}function st(G){O.equals(G)===!1&&(i.viewport(G.x,G.y,G.z,G.w),O.copy(G))}function Te(){i.disable(3042),i.disable(2884),i.disable(2929),i.disable(32823),i.disable(3089),i.disable(2960),i.disable(32926),i.blendEquation(32774),i.blendFunc(1,0),i.blendFuncSeparate(1,0,1,0),i.colorMask(!0,!0,!0,!0),i.clearColor(0,0,0,0),i.depthMask(!0),i.depthFunc(513),i.clearDepth(1),i.stencilMask(4294967295),i.stencilFunc(519,0,4294967295),i.stencilOp(7680,7680,7680),i.clearStencil(0),i.cullFace(1029),i.frontFace(2305),i.polygonOffset(0,0),i.activeTexture(33984),i.bindFramebuffer(36160,null),r===!0&&(i.bindFramebuffer(36009,null),i.bindFramebuffer(36008,null)),i.useProgram(null),i.lineWidth(1),i.scissor(0,0,i.canvas.width,i.canvas.height),i.viewport(0,0,i.canvas.width,i.canvas.height),u={},J=null,Q={},h={},f=new WeakMap,d=[],p=null,m=!1,g=null,v=null,y=null,w=null,b=null,S=null,T=null,A=!1,x=null,E=null,_=null,C=null,P=null,k.set(0,0,i.canvas.width,i.canvas.height),O.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:K,disable:W,bindFramebuffer:ge,drawBuffers:oe,useProgram:le,setBlending:Z,setMaterial:V,setFlipSided:$,setCullFace:ce,setLineWidth:ie,setPolygonOffset:pe,setScissorTest:ve,activeTexture:me,bindTexture:De,unbindTexture:ke,compressedTexImage2D:I,texImage2D:Fe,texImage3D:he,texStorage2D:Se,texStorage3D:Pe,texSubImage2D:L,texSubImage3D:te,compressedTexSubImage2D:ye,scissor:nt,viewport:st,reset:Te}}function iP(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,u=n.maxTextureSize,h=n.maxSamples,f=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,d=/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap,m,g=new WeakMap,v=!1;try{v=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(I,L){return v?new OffscreenCanvas(I,L):jc("canvas")}function w(I,L,te,ye){let Se=1;if((I.width>ye||I.height>ye)&&(Se=ye/Math.max(I.width,I.height)),Se<1||L===!0)if(typeof HTMLImageElement<"u"&&I instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&I instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&I instanceof ImageBitmap){let Pe=L?df:Math.floor,Fe=Pe(Se*I.width),he=Pe(Se*I.height);m===void 0&&(m=y(Fe,he));let nt=te?y(Fe,he):m;return nt.width=Fe,nt.height=he,nt.getContext("2d").drawImage(I,0,0,Fe,he),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+I.width+"x"+I.height+") to ("+Fe+"x"+he+")."),nt}else return"data"in I&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+I.width+"x"+I.height+")."),I;return I}function b(I){return ig(I.width)&&ig(I.height)}function S(I){return a?!1:I.wrapS!==_r||I.wrapT!==_r||I.minFilter!==lr&&I.minFilter!==ut}function T(I,L){return I.generateMipmaps&&L&&I.minFilter!==lr&&I.minFilter!==ut}function A(I){i.generateMipmap(I)}function x(I,L,te,ye,Se=!1){if(a===!1)return L;if(I!==null){if(i[I]!==void 0)return i[I];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+I+"'")}let Pe=L;return L===6403&&(te===5126&&(Pe=33326),te===5131&&(Pe=33325),te===5121&&(Pe=33321)),L===33319&&(te===5126&&(Pe=33328),te===5131&&(Pe=33327),te===5121&&(Pe=33323)),L===6408&&(te===5126&&(Pe=34836),te===5131&&(Pe=34842),te===5121&&(Pe=ye===je&&Se===!1?35907:32856),te===32819&&(Pe=32854),te===32820&&(Pe=32855)),(Pe===33325||Pe===33326||Pe===33327||Pe===33328||Pe===34842||Pe===34836)&&e.get("EXT_color_buffer_float"),Pe}function E(I,L,te){return T(I,te)===!0||I.isFramebufferTexture&&I.minFilter!==lr&&I.minFilter!==ut?Math.log2(Math.max(L.width,L.height))+1:I.mipmaps!==void 0&&I.mipmaps.length>0?I.mipmaps.length:I.isCompressedTexture&&Array.isArray(I.image)?L.mipmaps.length:1}function _(I){return I===lr||I===wx||I===Sx?9728:9729}function C(I){let L=I.target;L.removeEventListener("dispose",C),B(L),L.isVideoTexture&&p.delete(L)}function P(I){let L=I.target;L.removeEventListener("dispose",P),U(L)}function B(I){let L=r.get(I);if(L.__webglInit===void 0)return;let te=I.source,ye=g.get(te);if(ye){let Se=ye[L.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&R(I),Object.keys(ye).length===0&&g.delete(te)}r.remove(I)}function R(I){let L=r.get(I);i.deleteTexture(L.__webglTexture);let te=I.source,ye=g.get(te);delete ye[L.__cacheKey],o.memory.textures--}function U(I){let L=I.texture,te=r.get(I),ye=r.get(L);if(ye.__webglTexture!==void 0&&(i.deleteTexture(ye.__webglTexture),o.memory.textures--),I.depthTexture&&I.depthTexture.dispose(),I.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++)i.deleteFramebuffer(te.__webglFramebuffer[Se]),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer[Se]);else i.deleteFramebuffer(te.__webglFramebuffer),te.__webglDepthbuffer&&i.deleteRenderbuffer(te.__webglDepthbuffer),te.__webglMultisampledFramebuffer&&i.deleteFramebuffer(te.__webglMultisampledFramebuffer),te.__webglColorRenderbuffer&&i.deleteRenderbuffer(te.__webglColorRenderbuffer),te.__webglDepthRenderbuffer&&i.deleteRenderbuffer(te.__webglDepthRenderbuffer);if(I.isWebGLMultipleRenderTargets)for(let Se=0,Pe=L.length;Se<Pe;Se++){let Fe=r.get(L[Se]);Fe.__webglTexture&&(i.deleteTexture(Fe.__webglTexture),o.memory.textures--),r.remove(L[Se])}r.remove(L),r.remove(I)}let z=0;function J(){z=0}function Q(){let I=z;return I>=l&&console.warn("THREE.WebGLTextures: Trying to use "+I+" texture units while this GPU supports only "+l),z+=1,I}function X(I){let L=[];return L.push(I.wrapS),L.push(I.wrapT),L.push(I.magFilter),L.push(I.minFilter),L.push(I.anisotropy),L.push(I.internalFormat),L.push(I.format),L.push(I.type),L.push(I.generateMipmaps),L.push(I.premultiplyAlpha),L.push(I.flipY),L.push(I.unpackAlignment),L.push(I.encoding),L.join()}function F(I,L){let te=r.get(I);if(I.isVideoTexture&&De(I),I.isRenderTargetTexture===!1&&I.version>0&&te.__version!==I.version){let ye=I.image;if(ye===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ye.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{oe(te,I,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,te.__webglTexture)}function k(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){oe(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(35866,te.__webglTexture)}function O(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){oe(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(32879,te.__webglTexture)}function j(I,L){let te=r.get(I);if(I.version>0&&te.__version!==I.version){le(te,I,L);return}t.activeTexture(33984+L),t.bindTexture(34067,te.__webglTexture)}let q={[Ca]:10497,[_r]:33071,[rg]:33648},K={[lr]:9728,[wx]:9984,[Sx]:9986,[ut]:9729,[jT]:9985,[ks]:9987};function W(I,L,te){if(te?(i.texParameteri(I,10242,q[L.wrapS]),i.texParameteri(I,10243,q[L.wrapT]),(I===32879||I===35866)&&i.texParameteri(I,32882,q[L.wrapR]),i.texParameteri(I,10240,K[L.magFilter]),i.texParameteri(I,10241,K[L.minFilter])):(i.texParameteri(I,10242,33071),i.texParameteri(I,10243,33071),(I===32879||I===35866)&&i.texParameteri(I,32882,33071),(L.wrapS!==_r||L.wrapT!==_r)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(I,10240,_(L.magFilter)),i.texParameteri(I,10241,_(L.minFilter)),L.minFilter!==lr&&L.minFilter!==ut&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){let ye=e.get("EXT_texture_filter_anisotropic");if(L.type===Ts&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===Vc&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(i.texParameterf(I,ye.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function ge(I,L){let te=!1;I.__webglInit===void 0&&(I.__webglInit=!0,L.addEventListener("dispose",C));let ye=L.source,Se=g.get(ye);Se===void 0&&(Se={},g.set(ye,Se));let Pe=X(L);if(Pe!==I.__cacheKey){Se[Pe]===void 0&&(Se[Pe]={texture:i.createTexture(),usedTimes:0},o.memory.textures++,te=!0),Se[Pe].usedTimes++;let Fe=Se[I.__cacheKey];Fe!==void 0&&(Se[I.__cacheKey].usedTimes--,Fe.usedTimes===0&&R(L)),I.__cacheKey=Pe,I.__webglTexture=Se[Pe].texture}return te}function oe(I,L,te){let ye=3553;L.isDataArrayTexture&&(ye=35866),L.isData3DTexture&&(ye=32879);let Se=ge(I,L),Pe=L.source;if(t.activeTexture(33984+te),t.bindTexture(ye,I.__webglTexture),Pe.version!==Pe.__currentVersion||Se===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Fe=S(L)&&b(L.image)===!1,he=w(L.image,Fe,!1,u);he=ke(L,he);let nt=b(he)||a,st=s.convert(L.format,L.encoding),Te=s.convert(L.type),G=x(L.internalFormat,st,Te,L.encoding,L.isVideoTexture);W(ye,L,nt);let Me,Ce=L.mipmaps,Ze=a&&L.isVideoTexture!==!0,Oe=I.__version===void 0||Se===!0,Qe=E(L,he,nt);if(L.isDepthTexture)G=6402,a?L.type===Ts?G=36012:L.type===_a?G=33190:L.type===_s?G=35056:G=33189:L.type===Ts&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Mo&&G===6402&&L.type!==kc&&L.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=kc,Te=s.convert(L.type)),L.format===Ps&&G===6402&&(G=34041,L.type!==_s&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=_s,Te=s.convert(L.type))),Oe&&(Ze?t.texStorage2D(3553,1,G,he.width,he.height):t.texImage2D(3553,0,G,he.width,he.height,0,st,Te,null));else if(L.isDataTexture)if(Ce.length>0&&nt){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],Ze?t.texSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Te,Me.data):t.texImage2D(3553,Ae,G,Me.width,Me.height,0,st,Te,Me.data);L.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,he.width,he.height,st,Te,he.data)):t.texImage2D(3553,0,G,he.width,he.height,0,st,Te,he.data);else if(L.isCompressedTexture){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],L.format!==On?st!==null?Ze?t.compressedTexSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Me.data):t.compressedTexImage2D(3553,Ae,G,Me.width,Me.height,0,Me.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Ze?t.texSubImage2D(3553,Ae,0,0,Me.width,Me.height,st,Te,Me.data):t.texImage2D(3553,Ae,G,Me.width,Me.height,0,st,Te,Me.data)}else if(L.isDataArrayTexture)Ze?(Oe&&t.texStorage3D(35866,Qe,G,he.width,he.height,he.depth),t.texSubImage3D(35866,0,0,0,0,he.width,he.height,he.depth,st,Te,he.data)):t.texImage3D(35866,0,G,he.width,he.height,he.depth,0,st,Te,he.data);else if(L.isData3DTexture)Ze?(Oe&&t.texStorage3D(32879,Qe,G,he.width,he.height,he.depth),t.texSubImage3D(32879,0,0,0,0,he.width,he.height,he.depth,st,Te,he.data)):t.texImage3D(32879,0,G,he.width,he.height,he.depth,0,st,Te,he.data);else if(L.isFramebufferTexture){if(Oe)if(Ze)t.texStorage2D(3553,Qe,G,he.width,he.height);else{let Ae=he.width,$e=he.height;for(let at=0;at<Qe;at++)t.texImage2D(3553,at,G,Ae,$e,0,st,Te,null),Ae>>=1,$e>>=1}}else if(Ce.length>0&&nt){Ze&&Oe&&t.texStorage2D(3553,Qe,G,Ce[0].width,Ce[0].height);for(let Ae=0,$e=Ce.length;Ae<$e;Ae++)Me=Ce[Ae],Ze?t.texSubImage2D(3553,Ae,0,0,st,Te,Me):t.texImage2D(3553,Ae,G,st,Te,Me);L.generateMipmaps=!1}else Ze?(Oe&&t.texStorage2D(3553,Qe,G,he.width,he.height),t.texSubImage2D(3553,0,0,0,st,Te,he)):t.texImage2D(3553,0,G,st,Te,he);T(L,nt)&&A(ye),Pe.__currentVersion=Pe.version,L.onUpdate&&L.onUpdate(L)}I.__version=L.version}function le(I,L,te){if(L.image.length!==6)return;let ye=ge(I,L),Se=L.source;if(t.activeTexture(33984+te),t.bindTexture(34067,I.__webglTexture),Se.version!==Se.__currentVersion||ye===!0){i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let Pe=L.isCompressedTexture||L.image[0].isCompressedTexture,Fe=L.image[0]&&L.image[0].isDataTexture,he=[];for(let Ae=0;Ae<6;Ae++)!Pe&&!Fe?he[Ae]=w(L.image[Ae],!1,!0,c):he[Ae]=Fe?L.image[Ae].image:L.image[Ae],he[Ae]=ke(L,he[Ae]);let nt=he[0],st=b(nt)||a,Te=s.convert(L.format,L.encoding),G=s.convert(L.type),Me=x(L.internalFormat,Te,G,L.encoding),Ce=a&&L.isVideoTexture!==!0,Ze=I.__version===void 0,Oe=E(L,nt,st);W(34067,L,st);let Qe;if(Pe){Ce&&Ze&&t.texStorage2D(34067,Oe,Me,nt.width,nt.height);for(let Ae=0;Ae<6;Ae++){Qe=he[Ae].mipmaps;for(let $e=0;$e<Qe.length;$e++){let at=Qe[$e];L.format!==On?Te!==null?Ce?t.compressedTexSubImage2D(34069+Ae,$e,0,0,at.width,at.height,Te,at.data):t.compressedTexImage2D(34069+Ae,$e,Me,at.width,at.height,0,at.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):Ce?t.texSubImage2D(34069+Ae,$e,0,0,at.width,at.height,Te,G,at.data):t.texImage2D(34069+Ae,$e,Me,at.width,at.height,0,Te,G,at.data)}}}else{Qe=L.mipmaps,Ce&&Ze&&(Qe.length>0&&Oe++,t.texStorage2D(34067,Oe,Me,he[0].width,he[0].height));for(let Ae=0;Ae<6;Ae++)if(Fe){Ce?t.texSubImage2D(34069+Ae,0,0,0,he[Ae].width,he[Ae].height,Te,G,he[Ae].data):t.texImage2D(34069+Ae,0,Me,he[Ae].width,he[Ae].height,0,Te,G,he[Ae].data);for(let $e=0;$e<Qe.length;$e++){let ft=Qe[$e].image[Ae].image;Ce?t.texSubImage2D(34069+Ae,$e+1,0,0,ft.width,ft.height,Te,G,ft.data):t.texImage2D(34069+Ae,$e+1,Me,ft.width,ft.height,0,Te,G,ft.data)}}else{Ce?t.texSubImage2D(34069+Ae,0,0,0,Te,G,he[Ae]):t.texImage2D(34069+Ae,0,Me,Te,G,he[Ae]);for(let $e=0;$e<Qe.length;$e++){let at=Qe[$e];Ce?t.texSubImage2D(34069+Ae,$e+1,0,0,Te,G,at.image[Ae]):t.texImage2D(34069+Ae,$e+1,Me,Te,G,at.image[Ae])}}}T(L,st)&&A(34067),Se.__currentVersion=Se.version,L.onUpdate&&L.onUpdate(L)}I.__version=L.version}function H(I,L,te,ye,Se){let Pe=s.convert(te.format,te.encoding),Fe=s.convert(te.type),he=x(te.internalFormat,Pe,Fe,te.encoding);r.get(L).__hasExternalTextures||(Se===32879||Se===35866?t.texImage3D(Se,0,he,L.width,L.height,L.depth,0,Pe,Fe,null):t.texImage2D(Se,0,he,L.width,L.height,0,Pe,Fe,null)),t.bindFramebuffer(36160,I),me(L)?f.framebufferTexture2DMultisampleEXT(36160,ye,Se,r.get(te).__webglTexture,0,ve(L)):i.framebufferTexture2D(36160,ye,Se,r.get(te).__webglTexture,0),t.bindFramebuffer(36160,null)}function ue(I,L,te){if(i.bindRenderbuffer(36161,I),L.depthBuffer&&!L.stencilBuffer){let ye=33189;if(te||me(L)){let Se=L.depthTexture;Se&&Se.isDepthTexture&&(Se.type===Ts?ye=36012:Se.type===_a&&(ye=33190));let Pe=ve(L);me(L)?f.renderbufferStorageMultisampleEXT(36161,Pe,ye,L.width,L.height):i.renderbufferStorageMultisample(36161,Pe,ye,L.width,L.height)}else i.renderbufferStorage(36161,ye,L.width,L.height);i.framebufferRenderbuffer(36160,36096,36161,I)}else if(L.depthBuffer&&L.stencilBuffer){let ye=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,ye,35056,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,ye,35056,L.width,L.height):i.renderbufferStorage(36161,34041,L.width,L.height),i.framebufferRenderbuffer(36160,33306,36161,I)}else{let ye=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,Se=s.convert(ye.format,ye.encoding),Pe=s.convert(ye.type),Fe=x(ye.internalFormat,Se,Pe,ye.encoding),he=ve(L);te&&me(L)===!1?i.renderbufferStorageMultisample(36161,he,Fe,L.width,L.height):me(L)?f.renderbufferStorageMultisampleEXT(36161,he,Fe,L.width,L.height):i.renderbufferStorage(36161,Fe,L.width,L.height)}i.bindRenderbuffer(36161,null)}function Z(I,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,I),!(L.depthTexture&&L.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!r.get(L.depthTexture).__webglTexture||L.depthTexture.image.width!==L.width||L.depthTexture.image.height!==L.height)&&(L.depthTexture.image.width=L.width,L.depthTexture.image.height=L.height,L.depthTexture.needsUpdate=!0),F(L.depthTexture,0);let ye=r.get(L.depthTexture).__webglTexture,Se=ve(L);if(L.depthTexture.format===Mo)me(L)?f.framebufferTexture2DMultisampleEXT(36160,36096,3553,ye,0,Se):i.framebufferTexture2D(36160,36096,3553,ye,0);else if(L.depthTexture.format===Ps)me(L)?f.framebufferTexture2DMultisampleEXT(36160,33306,3553,ye,0,Se):i.framebufferTexture2D(36160,33306,3553,ye,0);else throw new Error("Unknown depthTexture format")}function V(I){let L=r.get(I),te=I.isWebGLCubeRenderTarget===!0;if(I.depthTexture&&!L.__autoAllocateDepthBuffer){if(te)throw new Error("target.depthTexture not supported in Cube render targets");Z(L.__webglFramebuffer,I)}else if(te){L.__webglDepthbuffer=[];for(let ye=0;ye<6;ye++)t.bindFramebuffer(36160,L.__webglFramebuffer[ye]),L.__webglDepthbuffer[ye]=i.createRenderbuffer(),ue(L.__webglDepthbuffer[ye],I,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=i.createRenderbuffer(),ue(L.__webglDepthbuffer,I,!1);t.bindFramebuffer(36160,null)}function $(I,L,te){let ye=r.get(I);L!==void 0&&H(ye.__webglFramebuffer,I,I.texture,36064,3553),te!==void 0&&V(I)}function ce(I){let L=I.texture,te=r.get(I),ye=r.get(L);I.addEventListener("dispose",P),I.isWebGLMultipleRenderTargets!==!0&&(ye.__webglTexture===void 0&&(ye.__webglTexture=i.createTexture()),ye.__version=L.version,o.memory.textures++);let Se=I.isWebGLCubeRenderTarget===!0,Pe=I.isWebGLMultipleRenderTargets===!0,Fe=b(I)||a;if(Se){te.__webglFramebuffer=[];for(let he=0;he<6;he++)te.__webglFramebuffer[he]=i.createFramebuffer()}else if(te.__webglFramebuffer=i.createFramebuffer(),Pe)if(n.drawBuffers){let he=I.texture;for(let nt=0,st=he.length;nt<st;nt++){let Te=r.get(he[nt]);Te.__webglTexture===void 0&&(Te.__webglTexture=i.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&I.samples>0&&me(I)===!1){te.__webglMultisampledFramebuffer=i.createFramebuffer(),te.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,te.__webglColorRenderbuffer);let he=s.convert(L.format,L.encoding),nt=s.convert(L.type),st=x(L.internalFormat,he,nt,L.encoding),Te=ve(I);i.renderbufferStorageMultisample(36161,Te,st,I.width,I.height),t.bindFramebuffer(36160,te.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,te.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),I.depthBuffer&&(te.__webglDepthRenderbuffer=i.createRenderbuffer(),ue(te.__webglDepthRenderbuffer,I,!0)),t.bindFramebuffer(36160,null)}if(Se){t.bindTexture(34067,ye.__webglTexture),W(34067,L,Fe);for(let he=0;he<6;he++)H(te.__webglFramebuffer[he],I,L,36064,34069+he);T(L,Fe)&&A(34067),t.unbindTexture()}else if(Pe){let he=I.texture;for(let nt=0,st=he.length;nt<st;nt++){let Te=he[nt],G=r.get(Te);t.bindTexture(3553,G.__webglTexture),W(3553,Te,Fe),H(te.__webglFramebuffer,I,Te,36064+nt,3553),T(Te,Fe)&&A(3553)}t.unbindTexture()}else{let he=3553;(I.isWebGL3DRenderTarget||I.isWebGLArrayRenderTarget)&&(a?he=I.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(he,ye.__webglTexture),W(he,L,Fe),H(te.__webglFramebuffer,I,L,36064,he),T(L,Fe)&&A(he),t.unbindTexture()}I.depthBuffer&&V(I)}function ie(I){let L=b(I)||a,te=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let ye=0,Se=te.length;ye<Se;ye++){let Pe=te[ye];if(T(Pe,L)){let Fe=I.isWebGLCubeRenderTarget?34067:3553,he=r.get(Pe).__webglTexture;t.bindTexture(Fe,he),A(Fe),t.unbindTexture()}}}function pe(I){if(a&&I.samples>0&&me(I)===!1){let L=I.width,te=I.height,ye=16384,Se=[36064],Pe=I.stencilBuffer?33306:36096;I.depthBuffer&&Se.push(Pe);let Fe=r.get(I),he=Fe.__ignoreDepthValues!==void 0?Fe.__ignoreDepthValues:!1;he===!1&&(I.depthBuffer&&(ye|=256),I.stencilBuffer&&(ye|=1024)),t.bindFramebuffer(36008,Fe.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,Fe.__webglFramebuffer),he===!0&&(i.invalidateFramebuffer(36008,[Pe]),i.invalidateFramebuffer(36009,[Pe])),i.blitFramebuffer(0,0,L,te,0,0,L,te,ye,9728),d&&i.invalidateFramebuffer(36008,Se),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,Fe.__webglMultisampledFramebuffer)}}function ve(I){return Math.min(h,I.samples)}function me(I){let L=r.get(I);return a&&I.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&L.__useRenderToTexture!==!1}function De(I){let L=o.render.frame;p.get(I)!==L&&(p.set(I,L),I.update())}function ke(I,L){let te=I.encoding,ye=I.format,Se=I.type;return I.isCompressedTexture===!0||I.isVideoTexture===!0||I.format===ng||te!==dn&&(te===je?a===!1?e.has("EXT_sRGB")===!0&&ye===On?(I.format=ng,I.minFilter=ut,I.generateMipmaps=!1):L=es.sRGBToLinear(L):(ye!==On||Se!==Wt)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",te)),L}this.allocateTextureUnit=Q,this.resetTextureUnits=J,this.setTexture2D=F,this.setTexture2DArray=k,this.setTexture3D=O,this.setTextureCube=j,this.rebindTextures=$,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ie,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=V,this.setupFrameBufferTexture=H,this.useMultisampledRTT=me}function sP(i,e,t){let r=t.isWebGL2;function n(s,o=null){let a;if(s===Wt)return 5121;if(s===JT)return 32819;if(s===QT)return 32820;if(s===qT)return 5120;if(s===YT)return 5122;if(s===kc)return 5123;if(s===XT)return 5124;if(s===_a)return 5125;if(s===Ts)return 5126;if(s===Vc)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===KT)return 6406;if(s===On)return 6408;if(s===$T)return 6409;if(s===eE)return 6410;if(s===Mo)return 6402;if(s===Ps)return 34041;if(s===tE)return 6403;if(s===ZT)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(s===ng)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===rE)return 36244;if(s===nE)return 33319;if(s===iE)return 33320;if(s===sE)return 36249;if(s===mm||s===gm||s===ym||s===vm)if(o===je)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===mm)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===mm)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===gm)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ym)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===vm)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Mx||s===Ax||s===Tx||s===Ex)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Mx)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Ax)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Tx)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Ex)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===oE)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===_x||s===Cx)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===_x)return o===je?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Cx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Lx||s===Dx||s===Px||s===Ix||s===Rx||s===Bx||s===Nx||s===Ox||s===Fx||s===Ux||s===zx||s===Gx||s===kx||s===Vx)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Lx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===Dx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Px)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===Ix)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Rx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Bx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Nx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Ox)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Fx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===Ux)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===zx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Gx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===kx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===Vx)return o===je?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Hx)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Hx)return o===je?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return s===_s?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):i[s]!==void 0?i[s]:null}return{convert:n}}var vf=class extends nr{constructor(e=[]){super(),this.cameras=e}};vf.prototype.isArrayCamera=!0;var Zi=class extends ot{constructor(){super(),this.type="Group"}};Zi.prototype.isGroup=!0;var oP={type:"move"},Uc=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Zi,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Zi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new M,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new M),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Zi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new M,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new M),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(oP))),c&&e.hand){o=!0;for(let m of e.hand.values()){let g=t.getJointPose(m,r);if(c.joints[m.jointName]===void 0){let y=new Zi;y.matrixAutoUpdate=!1,y.visible=!1,c.joints[m.jointName]=y,c.add(y)}let v=c.joints[m.jointName];g!==null&&(v.matrix.fromArray(g.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=g.radius),v.visible=g!==null}let u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,p=.005;c.inputState.pinching&&f>d+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=d-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));return a!==null&&(a.visible=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}},si=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u){if(u=u!==void 0?u:Mo,u!==Mo&&u!==Ps)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Mo&&(r=kc),r===void 0&&u===Ps&&(r=_s),super(null,n,s,o,a,l,u,r,c),this.image={width:e,height:t},this.magFilter=a!==void 0?a:lr,this.minFilter=l!==void 0?l:lr,this.flipY=!1,this.generateMipmaps=!1}};si.prototype.isDepthTexture=!0;var fg=class extends jt{constructor(e,t){super();let r=this,n=null,s=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,f=null,d=null,p=t.getContextAttributes(),m=null,g=null,v=[],y=new Map,w=new nr;w.layers.enable(1),w.viewport=new Ke;let b=new nr;b.layers.enable(2),b.viewport=new Ke;let S=[w,b],T=new vf;T.layers.enable(1),T.layers.enable(2);let A=null,x=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getTargetRaySpace()},this.getControllerGrip=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getGripSpace()},this.getHand=function(X){let F=v[X];return F===void 0&&(F=new Uc,v[X]=F),F.getHandSpace()};function E(X){let F=y.get(X.inputSource);F&&F.dispatchEvent({type:X.type,data:X.inputSource})}function _(){y.forEach(function(X,F){X.disconnect(F)}),y.clear(),A=null,x=null,e.setRenderTarget(m),f=null,h=null,u=null,n=null,g=null,Q.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){a=X,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(X){l=X},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return u},this.getFrame=function(){return d},this.getSession=function(){return n},this.setSession=async function(X){if(n=X,n!==null){if(m=e.getRenderTarget(),n.addEventListener("select",E),n.addEventListener("selectstart",E),n.addEventListener("selectend",E),n.addEventListener("squeeze",E),n.addEventListener("squeezestart",E),n.addEventListener("squeezeend",E),n.addEventListener("end",_),n.addEventListener("inputsourceschange",C),p.xrCompatible!==!0&&await t.makeXRCompatible(),n.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let F={antialias:n.renderState.layers===void 0?p.antialias:!0,alpha:p.alpha,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(n,t,F),n.updateRenderState({baseLayer:f}),g=new mt(f.framebufferWidth,f.framebufferHeight,{format:On,type:Wt,encoding:e.outputEncoding})}else{let F=null,k=null,O=null;p.depth&&(O=p.stencil?35056:33190,F=p.stencil?Ps:Mo,k=p.stencil?_s:kc);let j={colorFormat:e.outputEncoding===je?35907:32856,depthFormat:O,scaleFactor:s};u=new XRWebGLBinding(n,t),h=u.createProjectionLayer(j),n.updateRenderState({layers:[h]}),g=new mt(h.textureWidth,h.textureHeight,{format:On,type:Wt,depthTexture:new si(h.textureWidth,h.textureHeight,k,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:p.stencil,encoding:e.outputEncoding,samples:p.antialias?4:0});let q=e.properties.get(g);q.__ignoreDepthValues=h.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(1),o=await n.requestReferenceSpace(a),Q.setContext(n),Q.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function C(X){let F=n.inputSources;for(let k=0;k<F.length;k++){let O=F[k].handedness==="right"?1:0;y.set(F[k],v[O])}for(let k=0;k<X.removed.length;k++){let O=X.removed[k],j=y.get(O);j&&(j.dispatchEvent({type:"disconnected",data:O}),y.delete(O))}for(let k=0;k<X.added.length;k++){let O=X.added[k],j=y.get(O);j&&j.dispatchEvent({type:"connected",data:O})}}let P=new M,B=new M;function R(X,F,k){P.setFromMatrixPosition(F.matrixWorld),B.setFromMatrixPosition(k.matrixWorld);let O=P.distanceTo(B),j=F.projectionMatrix.elements,q=k.projectionMatrix.elements,K=j[14]/(j[10]-1),W=j[14]/(j[10]+1),ge=(j[9]+1)/j[5],oe=(j[9]-1)/j[5],le=(j[8]-1)/j[0],H=(q[8]+1)/q[0],ue=K*le,Z=K*H,V=O/(-le+H),$=V*-le;F.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX($),X.translateZ(V),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert();let ce=K+V,ie=W+V,pe=ue-$,ve=Z+(O-$),me=ge*W/ie*ce,De=oe*W/ie*ce;X.projectionMatrix.makePerspective(pe,ve,me,De,ce,ie)}function U(X,F){F===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(F.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(n===null)return;T.near=b.near=w.near=X.near,T.far=b.far=w.far=X.far,(A!==T.near||x!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),A=T.near,x=T.far);let F=X.parent,k=T.cameras;U(T,F);for(let j=0;j<k.length;j++)U(k[j],F);T.matrixWorld.decompose(T.position,T.quaternion,T.scale),X.position.copy(T.position),X.quaternion.copy(T.quaternion),X.scale.copy(T.scale),X.matrix.copy(T.matrix),X.matrixWorld.copy(T.matrixWorld);let O=X.children;for(let j=0,q=O.length;j<q;j++)O[j].updateMatrixWorld(!0);k.length===2?R(T,w,b):T.projectionMatrix.copy(w.projectionMatrix)},this.getCamera=function(){return T},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(f!==null)return f.fixedFoveation},this.setFoveation=function(X){h!==null&&(h.fixedFoveation=X),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=X)};let z=null;function J(X,F){if(c=F.getViewerPose(l||o),d=F,c!==null){let O=c.views;f!==null&&(e.setRenderTargetFramebuffer(g,f.framebuffer),e.setRenderTarget(g));let j=!1;O.length!==T.cameras.length&&(T.cameras.length=0,j=!0);for(let q=0;q<O.length;q++){let K=O[q],W=null;if(f!==null)W=f.getViewport(K);else{let oe=u.getViewSubImage(h,K);W=oe.viewport,q===0&&(e.setRenderTargetTextures(g,oe.colorTexture,h.ignoreDepthValues?void 0:oe.depthStencilTexture),e.setRenderTarget(g))}let ge=S[q];ge.matrix.fromArray(K.transform.matrix),ge.projectionMatrix.fromArray(K.projectionMatrix),ge.viewport.set(W.x,W.y,W.width,W.height),q===0&&T.matrix.copy(ge.matrix),j===!0&&T.cameras.push(ge)}}let k=n.inputSources;for(let O=0;O<v.length;O++){let j=k[O],q=y.get(j);q!==void 0&&q.update(j,F,l||o)}z&&z(X,F),d=null}let Q=new cb;Q.setAnimationLoop(J),this.setAnimationLoop=function(X){z=X},this.dispose=function(){}}};function aP(i,e){function t(m,g){m.fogColor.value.copy(g.color),g.isFog?(m.fogNear.value=g.near,m.fogFar.value=g.far):g.isFogExp2&&(m.fogDensity.value=g.density)}function r(m,g,v,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?n(m,g):g.isMeshToonMaterial?(n(m,g),u(m,g)):g.isMeshPhongMaterial?(n(m,g),c(m,g)):g.isMeshStandardMaterial?(n(m,g),h(m,g),g.isMeshPhysicalMaterial&&f(m,g,w)):g.isMeshMatcapMaterial?(n(m,g),d(m,g)):g.isMeshDepthMaterial?n(m,g):g.isMeshDistanceMaterial?(n(m,g),p(m,g)):g.isMeshNormalMaterial?n(m,g):g.isLineBasicMaterial?(s(m,g),g.isLineDashedMaterial&&o(m,g)):g.isPointsMaterial?a(m,g,v,y):g.isSpriteMaterial?l(m,g):g.isShadowMaterial?(m.color.value.copy(g.color),m.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function n(m,g){m.opacity.value=g.opacity,g.color&&m.diffuse.value.copy(g.color),g.emissive&&m.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.bumpMap&&(m.bumpMap.value=g.bumpMap,m.bumpScale.value=g.bumpScale,g.side===Cr&&(m.bumpScale.value*=-1)),g.displacementMap&&(m.displacementMap.value=g.displacementMap,m.displacementScale.value=g.displacementScale,m.displacementBias.value=g.displacementBias),g.emissiveMap&&(m.emissiveMap.value=g.emissiveMap),g.normalMap&&(m.normalMap.value=g.normalMap,m.normalScale.value.copy(g.normalScale),g.side===Cr&&m.normalScale.value.negate()),g.specularMap&&(m.specularMap.value=g.specularMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v=e.get(g).envMap;if(v&&(m.envMap.value=v,m.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=g.reflectivity,m.ior.value=g.ior,m.refractionRatio.value=g.refractionRatio),g.lightMap){m.lightMap.value=g.lightMap;let b=i.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=g.lightMapIntensity*b}g.aoMap&&(m.aoMap.value=g.aoMap,m.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),m.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uv2Transform.value.copy(w.matrix))}function s(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity}function o(m,g){m.dashSize.value=g.dashSize,m.totalSize.value=g.dashSize+g.gapSize,m.scale.value=g.scale}function a(m,g,v,y){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.size.value=g.size*v,m.scale.value=y*.5,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),m.uvTransform.value.copy(w.matrix))}function l(m,g){m.diffuse.value.copy(g.color),m.opacity.value=g.opacity,m.rotation.value=g.rotation,g.map&&(m.map.value=g.map),g.alphaMap&&(m.alphaMap.value=g.alphaMap),g.alphaTest>0&&(m.alphaTest.value=g.alphaTest);let v;g.map?v=g.map:g.alphaMap&&(v=g.alphaMap),v!==void 0&&(v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix))}function c(m,g){m.specular.value.copy(g.specular),m.shininess.value=Math.max(g.shininess,1e-4)}function u(m,g){g.gradientMap&&(m.gradientMap.value=g.gradientMap)}function h(m,g){m.roughness.value=g.roughness,m.metalness.value=g.metalness,g.roughnessMap&&(m.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(m.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(m.envMapIntensity.value=g.envMapIntensity)}function f(m,g,v){m.ior.value=g.ior,g.sheen>0&&(m.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),m.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(m.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(m.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(m.clearcoat.value=g.clearcoat,m.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(m.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),m.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Cr&&m.clearcoatNormalScale.value.negate())),g.transmission>0&&(m.transmission.value=g.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),g.transmissionMap&&(m.transmissionMap.value=g.transmissionMap),m.thickness.value=g.thickness,g.thicknessMap&&(m.thicknessMap.value=g.thicknessMap),m.attenuationDistance.value=g.attenuationDistance,m.attenuationColor.value.copy(g.attenuationColor)),m.specularIntensity.value=g.specularIntensity,m.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(m.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(m.specularColorMap.value=g.specularColorMap)}function d(m,g){g.matcap&&(m.matcap.value=g.matcap)}function p(m,g){m.referencePosition.value.copy(g.referencePosition),m.nearDistance.value=g.nearDistance,m.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function lP(){let i=jc("canvas");return i.style.display="block",i}function Ct(i={}){let e=i.canvas!==void 0?i.canvas:lP(),t=i.context!==void 0?i.context:null,r=i.depth!==void 0?i.depth:!0,n=i.stencil!==void 0?i.stencil:!0,s=i.antialias!==void 0?i.antialias:!1,o=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,a=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,l=i.powerPreference!==void 0?i.powerPreference:"default",c=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,u;t!==null?u=t.getContextAttributes().alpha:u=i.alpha!==void 0?i.alpha:!1;let h=null,f=null,d=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=dn,this.physicallyCorrectLights=!1,this.toneMapping=$i,this.toneMappingExposure=1;let m=this,g=!1,v=0,y=0,w=null,b=-1,S=null,T=new Ke,A=new Ke,x=null,E=e.width,_=e.height,C=1,P=null,B=null,R=new Ke(0,0,E,_),U=new Ke(0,0,E,_),z=!1,J=new Pa,Q=!1,X=!1,F=null,k=new _e,O=new N,j=new M,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function K(){return w===null?C:1}let W=t;function ge(D,Y){for(let ne=0;ne<D.length;ne++){let re=D[ne],fe=e.getContext(re,Y);if(fe!==null)return fe}return null}try{let D={alpha:!0,depth:r,stencil:n,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:c};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${No}`),e.addEventListener("webglcontextlost",G,!1),e.addEventListener("webglcontextrestored",Me,!1),W===null){let Y=["webgl2","webgl","experimental-webgl"];if(m.isWebGL1Renderer===!0&&Y.shift(),W=ge(Y,D),W===null)throw ge(Y)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}W.getShaderPrecisionFormat===void 0&&(W.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(D){throw console.error("THREE.WebGLRenderer: "+D.message),D}let oe,le,H,ue,Z,V,$,ce,ie,pe,ve,me,De,ke,I,L,te,ye,Se,Pe,Fe,he,nt;function st(){oe=new CL(W),le=new SL(W,oe,i),oe.init(le),he=new sP(W,oe,le),H=new nP(W,oe,le),ue=new PL(W),Z=new qD,V=new iP(W,oe,H,Z,le,he,ue),$=new AL(m),ce=new _L(m),ie=new jE(W,le),nt=new bL(W,oe,ie,le),pe=new LL(W,ie,ue,nt),ve=new NL(W,pe,ie,ue),Se=new BL(W,le,V),L=new ML(Z),me=new jD(m,$,ce,oe,le,nt,L),De=new aP(m,Z),ke=new XD,I=new eP(oe,le),ye=new xL(m,$,H,ve,u,o),te=new gb(m,ve,le),Pe=new wL(W,oe,ue,le),Fe=new DL(W,oe,ue,le),ue.programs=me.programs,m.capabilities=le,m.extensions=oe,m.properties=Z,m.renderLists=ke,m.shadowMap=te,m.state=H,m.info=ue}st();let Te=new fg(m,W);this.xr=Te,this.getContext=function(){return W},this.getContextAttributes=function(){return W.getContextAttributes()},this.forceContextLoss=function(){let D=oe.get("WEBGL_lose_context");D&&D.loseContext()},this.forceContextRestore=function(){let D=oe.get("WEBGL_lose_context");D&&D.restoreContext()},this.getPixelRatio=function(){return C},this.setPixelRatio=function(D){D!==void 0&&(C=D,this.setSize(E,_,!1))},this.getSize=function(D){return D.set(E,_)},this.setSize=function(D,Y,ne){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=D,_=Y,e.width=Math.floor(D*C),e.height=Math.floor(Y*C),ne!==!1&&(e.style.width=D+"px",e.style.height=Y+"px"),this.setViewport(0,0,D,Y)},this.getDrawingBufferSize=function(D){return D.set(E*C,_*C).floor()},this.setDrawingBufferSize=function(D,Y,ne){E=D,_=Y,C=ne,e.width=Math.floor(D*ne),e.height=Math.floor(Y*ne),this.setViewport(0,0,D,Y)},this.getCurrentViewport=function(D){return D.copy(T)},this.getViewport=function(D){return D.copy(R)},this.setViewport=function(D,Y,ne,re){D.isVector4?R.set(D.x,D.y,D.z,D.w):R.set(D,Y,ne,re),H.viewport(T.copy(R).multiplyScalar(C).floor())},this.getScissor=function(D){return D.copy(U)},this.setScissor=function(D,Y,ne,re){D.isVector4?U.set(D.x,D.y,D.z,D.w):U.set(D,Y,ne,re),H.scissor(A.copy(U).multiplyScalar(C).floor())},this.getScissorTest=function(){return z},this.setScissorTest=function(D){H.setScissorTest(z=D)},this.setOpaqueSort=function(D){P=D},this.setTransparentSort=function(D){B=D},this.getClearColor=function(D){return D.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(D=!0,Y=!0,ne=!0){let re=0;D&&(re|=16384),Y&&(re|=256),ne&&(re|=1024),W.clear(re)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",G,!1),e.removeEventListener("webglcontextrestored",Me,!1),ke.dispose(),I.dispose(),Z.dispose(),$.dispose(),ce.dispose(),ve.dispose(),nt.dispose(),me.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",$e),Te.removeEventListener("sessionend",at),F&&(F.dispose(),F=null),ft.stop()};function G(D){D.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),g=!0}function Me(){console.log("THREE.WebGLRenderer: Context Restored."),g=!1;let D=ue.autoReset,Y=te.enabled,ne=te.autoUpdate,re=te.needsUpdate,fe=te.type;st(),ue.autoReset=D,te.enabled=Y,te.autoUpdate=ne,te.needsUpdate=re,te.type=fe}function Ce(D){let Y=D.target;Y.removeEventListener("dispose",Ce),Ze(Y)}function Ze(D){Oe(D),Z.remove(D)}function Oe(D){let Y=Z.get(D).programs;Y!==void 0&&(Y.forEach(function(ne){me.releaseProgram(ne)}),D.isShaderMaterial&&me.releaseShaderCache(D))}this.renderBufferDirect=function(D,Y,ne,re,fe,Ve){Y===null&&(Y=q);let et=fe.isMesh&&fe.matrixWorld.determinant()<0,it=vt(D,Y,ne,re,fe);H.setMaterial(re,et);let ct=ne.index,Bt=ne.attributes.position;if(ct===null){if(Bt===void 0||Bt.count===0)return}else if(ct.count===0)return;let wt=1;re.wireframe===!0&&(ct=pe.getWireframeAttribute(ne),wt=2),nt.setup(fe,re,it,ne,ct);let Tt,tr=Pe;ct!==null&&(Tt=ie.get(ct),tr=Fe,tr.setIndex(Tt));let go=ct!==null?ct.count:Bt.count,ta=ne.drawRange.start*wt,ra=ne.drawRange.count*wt,vi=Ve!==null?Ve.start*wt:0,Dt=Ve!==null?Ve.count*wt:1/0,na=Math.max(ta,vi),mr=Math.min(go,ta+ra,vi+Dt)-1,xi=Math.max(0,mr-na+1);if(xi!==0){if(fe.isMesh)re.wireframe===!0?(H.setLineWidth(re.wireframeLinewidth*K()),tr.setMode(1)):tr.setMode(4);else if(fe.isLine){let gs=re.linewidth;gs===void 0&&(gs=1),H.setLineWidth(gs*K()),fe.isLineSegments?tr.setMode(1):fe.isLineLoop?tr.setMode(2):tr.setMode(3)}else fe.isPoints?tr.setMode(0):fe.isSprite&&tr.setMode(4);if(fe.isInstancedMesh)tr.renderInstances(na,xi,fe.count);else if(ne.isInstancedBufferGeometry){let gs=Math.min(ne.instanceCount,ne._maxInstanceCount);tr.renderInstances(na,xi,gs)}else tr.render(na,xi)}},this.compile=function(D,Y){f=I.get(D),f.init(),p.push(f),D.traverseVisible(function(ne){ne.isLight&&ne.layers.test(Y.layers)&&(f.pushLight(ne),ne.castShadow&&f.pushShadow(ne))}),f.setupLights(m.physicallyCorrectLights),D.traverse(function(ne){let re=ne.material;if(re)if(Array.isArray(re))for(let fe=0;fe<re.length;fe++){let Ve=re[fe];lt(Ve,D,ne)}else lt(re,D,ne)}),p.pop(),f=null};let Qe=null;function Ae(D){Qe&&Qe(D)}function $e(){ft.stop()}function at(){ft.start()}let ft=new cb;ft.setAnimationLoop(Ae),typeof self<"u"&&ft.setContext(self),this.setAnimationLoop=function(D){Qe=D,Te.setAnimationLoop(D),D===null?ft.stop():ft.start()},Te.addEventListener("sessionstart",$e),Te.addEventListener("sessionend",at),this.render=function(D,Y){if(Y!==void 0&&Y.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(g===!0)return;D.autoUpdate===!0&&D.updateMatrixWorld(),Y.parent===null&&Y.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(Y),Y=Te.getCamera()),D.isScene===!0&&D.onBeforeRender(m,D,Y,w),f=I.get(D,p.length),f.init(),p.push(f),k.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),J.setFromProjectionMatrix(k),X=this.localClippingEnabled,Q=L.init(this.clippingPlanes,X,Y),h=ke.get(D,d.length),h.init(),d.push(h),Ot(D,Y,0,m.sortObjects),h.finish(),m.sortObjects===!0&&h.sort(P,B),Q===!0&&L.beginShadows();let ne=f.state.shadowsArray;if(te.render(ne,D,Y),Q===!0&&L.endShadows(),this.info.autoReset===!0&&this.info.reset(),ye.render(h,D),f.setupLights(m.physicallyCorrectLights),Y.isArrayCamera){let re=Y.cameras;for(let fe=0,Ve=re.length;fe<Ve;fe++){let et=re[fe];Nr(h,D,et,et.viewport)}}else Nr(h,D,Y);w!==null&&(V.updateMultisampleRenderTarget(w),V.updateRenderTargetMipmap(w)),D.isScene===!0&&D.onAfterRender(m,D,Y),nt.resetDefaultState(),b=-1,S=null,p.pop(),p.length>0?f=p[p.length-1]:f=null,d.pop(),d.length>0?h=d[d.length-1]:h=null};function Ot(D,Y,ne,re){if(D.visible===!1)return;if(D.layers.test(Y.layers)){if(D.isGroup)ne=D.renderOrder;else if(D.isLOD)D.autoUpdate===!0&&D.update(Y);else if(D.isLight)f.pushLight(D),D.castShadow&&f.pushShadow(D);else if(D.isSprite){if(!D.frustumCulled||J.intersectsSprite(D)){re&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(k);let et=ve.update(D),it=D.material;it.visible&&h.push(D,et,it,ne,j.z,null)}}else if((D.isMesh||D.isLine||D.isPoints)&&(D.isSkinnedMesh&&D.skeleton.frame!==ue.render.frame&&(D.skeleton.update(),D.skeleton.frame=ue.render.frame),!D.frustumCulled||J.intersectsObject(D))){re&&j.setFromMatrixPosition(D.matrixWorld).applyMatrix4(k);let et=ve.update(D),it=D.material;if(Array.isArray(it)){let ct=et.groups;for(let Bt=0,wt=ct.length;Bt<wt;Bt++){let Tt=ct[Bt],tr=it[Tt.materialIndex];tr&&tr.visible&&h.push(D,et,tr,ne,j.z,Tt)}}else it.visible&&h.push(D,et,it,ne,j.z,null)}}let Ve=D.children;for(let et=0,it=Ve.length;et<it;et++)Ot(Ve[et],Y,ne,re)}function Nr(D,Y,ne,re){let fe=D.opaque,Ve=D.transmissive,et=D.transparent;f.setupLightsView(ne),Ve.length>0&&ea(fe,Y,ne),re&&H.viewport(T.copy(re)),fe.length>0&&We(fe,Y,ne),Ve.length>0&&We(Ve,Y,ne),et.length>0&&We(et,Y,ne),H.buffers.depth.setTest(!0),H.buffers.depth.setMask(!0),H.buffers.color.setMask(!0),H.setPolygonOffset(!1)}function ea(D,Y,ne){let re=le.isWebGL2;F===null&&(F=new mt(1,1,{generateMipmaps:!0,type:oe.has("EXT_color_buffer_half_float")?Vc:Wt,minFilter:ks,samples:re&&s===!0?4:0})),m.getDrawingBufferSize(O),re?F.setSize(O.x,O.y):F.setSize(df(O.x),df(O.y));let fe=m.getRenderTarget();m.setRenderTarget(F),m.clear();let Ve=m.toneMapping;m.toneMapping=$i,We(D,Y,ne),m.toneMapping=Ve,V.updateMultisampleRenderTarget(F),V.updateRenderTargetMipmap(F),m.setRenderTarget(fe)}function We(D,Y,ne){let re=Y.isScene===!0?Y.overrideMaterial:null;for(let fe=0,Ve=D.length;fe<Ve;fe++){let et=D[fe],it=et.object,ct=et.geometry,Bt=re===null?et.material:re,wt=et.group;it.layers.test(ne.layers)&&pt(it,Y,ne,ct,Bt,wt)}}function pt(D,Y,ne,re,fe,Ve){D.onBeforeRender(m,Y,ne,re,fe,Ve),D.modelViewMatrix.multiplyMatrices(ne.matrixWorldInverse,D.matrixWorld),D.normalMatrix.getNormalMatrix(D.modelViewMatrix),fe.onBeforeRender(m,Y,ne,re,D,Ve),fe.transparent===!0&&fe.side===ir?(fe.side=Cr,fe.needsUpdate=!0,m.renderBufferDirect(ne,Y,re,fe,D,Ve),fe.side=ni,fe.needsUpdate=!0,m.renderBufferDirect(ne,Y,re,fe,D,Ve),fe.side=ir):m.renderBufferDirect(ne,Y,re,fe,D,Ve),D.onAfterRender(m,Y,ne,re,fe,Ve)}function lt(D,Y,ne){Y.isScene!==!0&&(Y=q);let re=Z.get(D),fe=f.state.lights,Ve=f.state.shadowsArray,et=fe.state.version,it=me.getParameters(D,fe.state,Ve,Y,ne),ct=me.getProgramCacheKey(it),Bt=re.programs;re.environment=D.isMeshStandardMaterial?Y.environment:null,re.fog=Y.fog,re.envMap=(D.isMeshStandardMaterial?ce:$).get(D.envMap||re.environment),Bt===void 0&&(D.addEventListener("dispose",Ce),Bt=new Map,re.programs=Bt);let wt=Bt.get(ct);if(wt!==void 0){if(re.currentProgram===wt&&re.lightsStateVersion===et)return ht(D,it),wt}else it.uniforms=me.getUniforms(D),D.onBuild(ne,it,m),D.onBeforeCompile(it,m),wt=me.acquireProgram(it,ct),Bt.set(ct,wt),re.uniforms=it.uniforms;let Tt=re.uniforms;(!D.isShaderMaterial&&!D.isRawShaderMaterial||D.clipping===!0)&&(Tt.clippingPlanes=L.uniform),ht(D,it),re.needsLights=Ft(D),re.lightsStateVersion=et,re.needsLights&&(Tt.ambientLightColor.value=fe.state.ambient,Tt.lightProbe.value=fe.state.probe,Tt.directionalLights.value=fe.state.directional,Tt.directionalLightShadows.value=fe.state.directionalShadow,Tt.spotLights.value=fe.state.spot,Tt.spotLightShadows.value=fe.state.spotShadow,Tt.rectAreaLights.value=fe.state.rectArea,Tt.ltc_1.value=fe.state.rectAreaLTC1,Tt.ltc_2.value=fe.state.rectAreaLTC2,Tt.pointLights.value=fe.state.point,Tt.pointLightShadows.value=fe.state.pointShadow,Tt.hemisphereLights.value=fe.state.hemi,Tt.directionalShadowMap.value=fe.state.directionalShadowMap,Tt.directionalShadowMatrix.value=fe.state.directionalShadowMatrix,Tt.spotShadowMap.value=fe.state.spotShadowMap,Tt.spotShadowMatrix.value=fe.state.spotShadowMatrix,Tt.pointShadowMap.value=fe.state.pointShadowMap,Tt.pointShadowMatrix.value=fe.state.pointShadowMatrix);let tr=wt.getUniforms(),go=Cs.seqWithValue(tr.seq,Tt);return re.currentProgram=wt,re.uniformsList=go,wt}function ht(D,Y){let ne=Z.get(D);ne.outputEncoding=Y.outputEncoding,ne.instancing=Y.instancing,ne.skinning=Y.skinning,ne.morphTargets=Y.morphTargets,ne.morphNormals=Y.morphNormals,ne.morphColors=Y.morphColors,ne.morphTargetsCount=Y.morphTargetsCount,ne.numClippingPlanes=Y.numClippingPlanes,ne.numIntersection=Y.numClipIntersection,ne.vertexAlphas=Y.vertexAlphas,ne.vertexTangents=Y.vertexTangents,ne.toneMapping=Y.toneMapping}function vt(D,Y,ne,re,fe){Y.isScene!==!0&&(Y=q),V.resetTextureUnits();let Ve=Y.fog,et=re.isMeshStandardMaterial?Y.environment:null,it=w===null?m.outputEncoding:w.isXRRenderTarget===!0?w.texture.encoding:dn,ct=(re.isMeshStandardMaterial?ce:$).get(re.envMap||et),Bt=re.vertexColors===!0&&!!ne.attributes.color&&ne.attributes.color.itemSize===4,wt=!!re.normalMap&&!!ne.attributes.tangent,Tt=!!ne.morphAttributes.position,tr=!!ne.morphAttributes.normal,go=!!ne.morphAttributes.color,ta=re.toneMapped?m.toneMapping:$i,ra=ne.morphAttributes.position||ne.morphAttributes.normal||ne.morphAttributes.color,vi=ra!==void 0?ra.length:0,Dt=Z.get(re),na=f.state.lights;if(Q===!0&&(X===!0||D!==S)){let bi=D===S&&re.id===b;L.setState(re,D,bi)}let mr=!1;re.version===Dt.__version?(Dt.needsLights&&Dt.lightsStateVersion!==na.state.version||Dt.outputEncoding!==it||fe.isInstancedMesh&&Dt.instancing===!1||!fe.isInstancedMesh&&Dt.instancing===!0||fe.isSkinnedMesh&&Dt.skinning===!1||!fe.isSkinnedMesh&&Dt.skinning===!0||Dt.envMap!==ct||re.fog===!0&&Dt.fog!==Ve||Dt.numClippingPlanes!==void 0&&(Dt.numClippingPlanes!==L.numPlanes||Dt.numIntersection!==L.numIntersection)||Dt.vertexAlphas!==Bt||Dt.vertexTangents!==wt||Dt.morphTargets!==Tt||Dt.morphNormals!==tr||Dt.morphColors!==go||Dt.toneMapping!==ta||le.isWebGL2===!0&&Dt.morphTargetsCount!==vi)&&(mr=!0):(mr=!0,Dt.__version=re.version);let xi=Dt.currentProgram;mr===!0&&(xi=lt(re,Y,fe));let gs=!1,Ac=!1,fm=!1,Zr=xi.getUniforms(),Tc=Dt.uniforms;if(H.useProgram(xi.program)&&(gs=!0,Ac=!0,fm=!0),re.id!==b&&(b=re.id,Ac=!0),gs||S!==D){if(Zr.setValue(W,"projectionMatrix",D.projectionMatrix),le.logarithmicDepthBuffer&&Zr.setValue(W,"logDepthBufFC",2/(Math.log(D.far+1)/Math.LN2)),S!==D&&(S=D,Ac=!0,fm=!0),re.isShaderMaterial||re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshStandardMaterial||re.envMap){let bi=Zr.map.cameraPosition;bi!==void 0&&bi.setValue(W,j.setFromMatrixPosition(D.matrixWorld))}(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial)&&Zr.setValue(W,"isOrthographic",D.isOrthographicCamera===!0),(re.isMeshPhongMaterial||re.isMeshToonMaterial||re.isMeshLambertMaterial||re.isMeshBasicMaterial||re.isMeshStandardMaterial||re.isShaderMaterial||re.isShadowMaterial||fe.isSkinnedMesh)&&Zr.setValue(W,"viewMatrix",D.matrixWorldInverse)}if(fe.isSkinnedMesh){Zr.setOptional(W,fe,"bindMatrix"),Zr.setOptional(W,fe,"bindMatrixInverse");let bi=fe.skeleton;bi&&(le.floatVertexTextures?(bi.boneTexture===null&&bi.computeBoneTexture(),Zr.setValue(W,"boneTexture",bi.boneTexture,V),Zr.setValue(W,"boneTextureSize",bi.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."))}let dm=ne.morphAttributes;return(dm.position!==void 0||dm.normal!==void 0||dm.color!==void 0&&le.isWebGL2===!0)&&Se.update(fe,ne,re,xi),(Ac||Dt.receiveShadow!==fe.receiveShadow)&&(Dt.receiveShadow=fe.receiveShadow,Zr.setValue(W,"receiveShadow",fe.receiveShadow)),Ac&&(Zr.setValue(W,"toneMappingExposure",m.toneMappingExposure),Dt.needsLights&&Lt(Tc,fm),Ve&&re.fog===!0&&De.refreshFogUniforms(Tc,Ve),De.refreshMaterialUniforms(Tc,re,C,_,F),Cs.upload(W,Dt.uniformsList,Tc,V)),re.isShaderMaterial&&re.uniformsNeedUpdate===!0&&(Cs.upload(W,Dt.uniformsList,Tc,V),re.uniformsNeedUpdate=!1),re.isSpriteMaterial&&Zr.setValue(W,"center",fe.center),Zr.setValue(W,"modelViewMatrix",fe.modelViewMatrix),Zr.setValue(W,"normalMatrix",fe.normalMatrix),Zr.setValue(W,"modelMatrix",fe.matrixWorld),xi}function Lt(D,Y){D.ambientLightColor.needsUpdate=Y,D.lightProbe.needsUpdate=Y,D.directionalLights.needsUpdate=Y,D.directionalLightShadows.needsUpdate=Y,D.pointLights.needsUpdate=Y,D.pointLightShadows.needsUpdate=Y,D.spotLights.needsUpdate=Y,D.spotLightShadows.needsUpdate=Y,D.rectAreaLights.needsUpdate=Y,D.hemisphereLights.needsUpdate=Y}function Ft(D){return D.isMeshLambertMaterial||D.isMeshToonMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isShadowMaterial||D.isShaderMaterial&&D.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(D,Y,ne){Z.get(D.texture).__webglTexture=Y,Z.get(D.depthTexture).__webglTexture=ne;let re=Z.get(D);re.__hasExternalTextures=!0,re.__hasExternalTextures&&(re.__autoAllocateDepthBuffer=ne===void 0,re.__autoAllocateDepthBuffer||oe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),re.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(D,Y){let ne=Z.get(D);ne.__webglFramebuffer=Y,ne.__useDefaultFramebuffer=Y===void 0},this.setRenderTarget=function(D,Y=0,ne=0){w=D,v=Y,y=ne;let re=!0;if(D){let ct=Z.get(D);ct.__useDefaultFramebuffer!==void 0?(H.bindFramebuffer(36160,null),re=!1):ct.__webglFramebuffer===void 0?V.setupRenderTarget(D):ct.__hasExternalTextures&&V.rebindTextures(D,Z.get(D.texture).__webglTexture,Z.get(D.depthTexture).__webglTexture)}let fe=null,Ve=!1,et=!1;if(D){let ct=D.texture;(ct.isData3DTexture||ct.isDataArrayTexture)&&(et=!0);let Bt=Z.get(D).__webglFramebuffer;D.isWebGLCubeRenderTarget?(fe=Bt[Y],Ve=!0):le.isWebGL2&&D.samples>0&&V.useMultisampledRTT(D)===!1?fe=Z.get(D).__webglMultisampledFramebuffer:fe=Bt,T.copy(D.viewport),A.copy(D.scissor),x=D.scissorTest}else T.copy(R).multiplyScalar(C).floor(),A.copy(U).multiplyScalar(C).floor(),x=z;if(H.bindFramebuffer(36160,fe)&&le.drawBuffers&&re&&H.drawBuffers(D,fe),H.viewport(T),H.scissor(A),H.setScissorTest(x),Ve){let ct=Z.get(D.texture);W.framebufferTexture2D(36160,36064,34069+Y,ct.__webglTexture,ne)}else if(et){let ct=Z.get(D.texture),Bt=Y||0;W.framebufferTextureLayer(36160,36064,ct.__webglTexture,ne||0,Bt)}b=-1},this.readRenderTargetPixels=function(D,Y,ne,re,fe,Ve,et){if(!(D&&D.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let it=Z.get(D).__webglFramebuffer;if(D.isWebGLCubeRenderTarget&&et!==void 0&&(it=it[et]),it){H.bindFramebuffer(36160,it);try{let ct=D.texture,Bt=ct.format,wt=ct.type;if(Bt!==On&&he.convert(Bt)!==W.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Tt=wt===Vc&&(oe.has("EXT_color_buffer_half_float")||le.isWebGL2&&oe.has("EXT_color_buffer_float"));if(wt!==Wt&&he.convert(wt)!==W.getParameter(35738)&&!(wt===Ts&&(le.isWebGL2||oe.has("OES_texture_float")||oe.has("WEBGL_color_buffer_float")))&&!Tt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Y>=0&&Y<=D.width-re&&ne>=0&&ne<=D.height-fe&&W.readPixels(Y,ne,re,fe,he.convert(Bt),he.convert(wt),Ve)}finally{let ct=w!==null?Z.get(w).__webglFramebuffer:null;H.bindFramebuffer(36160,ct)}}},this.copyFramebufferToTexture=function(D,Y,ne=0){if(Y.isFramebufferTexture!==!0){console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");return}let re=Math.pow(2,-ne),fe=Math.floor(Y.image.width*re),Ve=Math.floor(Y.image.height*re);V.setTexture2D(Y,0),W.copyTexSubImage2D(3553,ne,0,0,D.x,D.y,fe,Ve),H.unbindTexture()},this.copyTextureToTexture=function(D,Y,ne,re=0){let fe=Y.image.width,Ve=Y.image.height,et=he.convert(ne.format),it=he.convert(ne.type);V.setTexture2D(ne,0),W.pixelStorei(37440,ne.flipY),W.pixelStorei(37441,ne.premultiplyAlpha),W.pixelStorei(3317,ne.unpackAlignment),Y.isDataTexture?W.texSubImage2D(3553,re,D.x,D.y,fe,Ve,et,it,Y.image.data):Y.isCompressedTexture?W.compressedTexSubImage2D(3553,re,D.x,D.y,Y.mipmaps[0].width,Y.mipmaps[0].height,et,Y.mipmaps[0].data):W.texSubImage2D(3553,re,D.x,D.y,et,it,Y.image),re===0&&ne.generateMipmaps&&W.generateMipmap(3553),H.unbindTexture()},this.copyTextureToTexture3D=function(D,Y,ne,re,fe=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ve=D.max.x-D.min.x+1,et=D.max.y-D.min.y+1,it=D.max.z-D.min.z+1,ct=he.convert(re.format),Bt=he.convert(re.type),wt;if(re.isData3DTexture)V.setTexture3D(re,0),wt=32879;else if(re.isDataArrayTexture)V.setTexture2DArray(re,0),wt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(37440,re.flipY),W.pixelStorei(37441,re.premultiplyAlpha),W.pixelStorei(3317,re.unpackAlignment);let Tt=W.getParameter(3314),tr=W.getParameter(32878),go=W.getParameter(3316),ta=W.getParameter(3315),ra=W.getParameter(32877),vi=ne.isCompressedTexture?ne.mipmaps[0]:ne.image;W.pixelStorei(3314,vi.width),W.pixelStorei(32878,vi.height),W.pixelStorei(3316,D.min.x),W.pixelStorei(3315,D.min.y),W.pixelStorei(32877,D.min.z),ne.isDataTexture||ne.isData3DTexture?W.texSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,Bt,vi.data):ne.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,vi.data)):W.texSubImage3D(wt,fe,Y.x,Y.y,Y.z,Ve,et,it,ct,Bt,vi),W.pixelStorei(3314,Tt),W.pixelStorei(32878,tr),W.pixelStorei(3316,go),W.pixelStorei(3315,ta),W.pixelStorei(32877,ra),fe===0&&re.generateMipmaps&&W.generateMipmap(wt),H.unbindTexture()},this.initTexture=function(D){V.setTexture2D(D,0),H.unbindTexture()},this.resetState=function(){v=0,y=0,w=null,H.reset(),nt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Ct.prototype.isWebGLRenderer=!0;var dg=class extends Ct{};dg.prototype.isWebGL1Renderer=!0;var Kc=class{constructor(e,t=25e-5){this.name="",this.color=new xe(e),this.density=t}clone(){return new Kc(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Kc.prototype.isFogExp2=!0;var Eo=class{constructor(e,t=1,r=1e3){this.name="",this.color=new xe(e),this.near=t,this.far=r}clone(){return new Eo(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};Eo.prototype.isFog=!0;var nn=class extends ot{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}};nn.prototype.isScene=!0;var rs=class{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Hc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Fn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let n=0,s=this.stride;n<s;n++)this.array[e+n]=t.array[r+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),r=new this.constructor(t,this.stride);return r.setUsage(this.usage),r}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Fn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}};rs.prototype.isInterleavedBuffer=!0;var $r=new M,Ai=class{constructor(e,t,r,n=!1){this.name="",this.data=e,this.itemSize=t,this.offset=r,this.normalized=n===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,r=this.data.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.applyMatrix4(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.applyNormalMatrix(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)$r.fromBufferAttribute(this,t),$r.transformDirection(e),this.setXYZ(t,$r.x,$r.y,$r.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this}setXYZ(e,t,r,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this}setXYZW(e,t,r,n,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=r,this.data.array[e+2]=n,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ue(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new Ai(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");let t=[];for(let r=0;r<this.count;r++){let n=r*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}};Ai.prototype.isInterleavedBufferAttribute=!0;var Zc=class extends cr{constructor(e){super(),this.type="SpriteMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};Zc.prototype.isSpriteMaterial=!0;var va,Lc=new M,xa=new M,ba=new M,wa=new N,Dc=new N,yb=new _e,qh=new M,Pc=new M,Yh=new M,A0=new N,qm=new N,T0=new N,pg=class extends ot{constructor(e){if(super(),this.type="Sprite",va===void 0){va=new Ie;let t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),r=new rs(t,5);va.setIndex([0,1,2,0,2,3]),va.setAttribute("position",new Ai(r,3,0,!1)),va.setAttribute("uv",new Ai(r,2,3,!1))}this.geometry=va,this.material=e!==void 0?e:new Zc,this.center=new N(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),xa.setFromMatrixScale(this.matrixWorld),yb.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),ba.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&xa.multiplyScalar(-ba.z);let r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;Xh(qh.set(-.5,-.5,0),ba,o,xa,n,s),Xh(Pc.set(.5,-.5,0),ba,o,xa,n,s),Xh(Yh.set(.5,.5,0),ba,o,xa,n,s),A0.set(0,0),qm.set(1,0),T0.set(1,1);let a=e.ray.intersectTriangle(qh,Pc,Yh,!1,Lc);if(a===null&&(Xh(Pc.set(-.5,.5,0),ba,o,xa,n,s),qm.set(0,1),a=e.ray.intersectTriangle(qh,Yh,Pc,!1,Lc),a===null))return;let l=e.ray.origin.distanceTo(Lc);l<e.near||l>e.far||t.push({distance:l,point:Lc.clone(),uv:Jt.getUV(Lc,qh,Pc,Yh,A0,qm,T0,new N),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};pg.prototype.isSprite=!0;function Xh(i,e,t,r,n,s){wa.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Dc.x=s*wa.x-n*wa.y,Dc.y=n*wa.x+s*wa.y):Dc.copy(wa),i.copy(e),i.x+=Dc.x,i.y+=Dc.y,i.applyMatrix4(yb)}var E0=new M,_0=new Ke,C0=new Ke,cP=new M,L0=new _e,xf=class extends Gt{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new _e,this.bindMatrixInverse=new _e}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Ke,t=this.geometry.attributes.skinWeight;for(let r=0,n=t.count;r<n;r++){e.fromBufferAttribute(t,r);let s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(r,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){let r=this.skeleton,n=this.geometry;_0.fromBufferAttribute(n.attributes.skinIndex,e),C0.fromBufferAttribute(n.attributes.skinWeight,e),E0.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=C0.getComponent(s);if(o!==0){let a=_0.getComponent(s);L0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(cP.copy(E0).applyMatrix4(L0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};xf.prototype.isSkinnedMesh=!0;var mg=class extends ot{constructor(){super(),this.type="Bone"}};mg.prototype.isBone=!0;var bf=class extends _t{constructor(e=null,t=1,r=1,n,s,o,a,l,c=lr,u=lr,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={data:e,width:t,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};bf.prototype.isDataTexture=!0;var Ia=class extends Ue{constructor(e,t,r,n=1){typeof r=="number"&&(n=r,r=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,r),this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}};Ia.prototype.isInstancedBufferAttribute=!0;var D0=new _e,P0=new _e,Jh=[],Ic=new Gt,gg=class extends Gt{constructor(e,t,r){super(e,t),this.instanceMatrix=new Ia(new Float32Array(r*16),16),this.instanceColor=null,this.count=r,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){let r=this.matrixWorld,n=this.count;if(Ic.geometry=this.geometry,Ic.material=this.material,Ic.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,D0),P0.multiplyMatrices(r,D0),Ic.matrixWorld=P0,Ic.raycast(e,Jh);for(let o=0,a=Jh.length;o<a;o++){let l=Jh[o];l.instanceId=s,l.object=this,t.push(l)}Jh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Ia(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}};gg.prototype.isInstancedMesh=!0;var Ur=class extends cr{constructor(e){super(),this.type="LineBasicMaterial",this.color=new xe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}};Ur.prototype.isLineBasicMaterial=!0;var I0=new M,R0=new M,B0=new _e,Ym=new ii,Qh=new Yr,ns=class extends ot{constructor(e=new Ie,t=new Ur){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[0];for(let n=1,s=t.count;n<s;n++)I0.fromBufferAttribute(t,n-1),R0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=I0.distanceTo(R0);e.setAttribute("lineDistance",new Le(r,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){let r=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Qh.copy(r.boundingSphere),Qh.applyMatrix4(n),Qh.radius+=s,e.ray.intersectsSphere(Qh)===!1)return;B0.copy(n).invert(),Ym.copy(e.ray).applyMatrix4(B0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new M,u=new M,h=new M,f=new M,d=this.isLineSegments?2:1;if(r.isBufferGeometry){let p=r.index,g=r.attributes.position;if(p!==null){let v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){let S=p.getX(w),T=p.getX(w+1);if(c.fromBufferAttribute(g,S),u.fromBufferAttribute(g,T),Ym.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let x=e.ray.origin.distanceTo(f);x<e.near||x>e.far||t.push({distance:x,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{let v=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=v,b=y-1;w<b;w+=d){if(c.fromBufferAttribute(g,w),u.fromBufferAttribute(g,w+1),Ym.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(f);T<e.near||T>e.far||t.push({distance:T,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}else r.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};ns.prototype.isLine=!0;var N0=new M,O0=new M,oi=class extends ns{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(e.isBufferGeometry)if(e.index===null){let t=e.attributes.position,r=[];for(let n=0,s=t.count;n<s;n+=2)N0.fromBufferAttribute(t,n),O0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+N0.distanceTo(O0);e.setAttribute("lineDistance",new Le(r,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}};oi.prototype.isLineSegments=!0;var yg=class extends ns{constructor(e,t){super(e,t),this.type="LineLoop"}};yg.prototype.isLineLoop=!0;var $c=class extends cr{constructor(e){super(),this.type="PointsMaterial",this.color=new xe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}};$c.prototype.isPointsMaterial=!0;var F0=new _e,vg=new ii,Kh=new Yr,Zh=new M,xg=class extends ot{constructor(e=new Ie,t=new $c){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){let r=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,o=r.drawRange;if(r.boundingSphere===null&&r.computeBoundingSphere(),Kh.copy(r.boundingSphere),Kh.applyMatrix4(n),Kh.radius+=s,e.ray.intersectsSphere(Kh)===!1)return;F0.copy(n).invert(),vg.copy(e.ray).applyMatrix4(F0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,h=r.attributes.position;if(c!==null){let f=Math.max(0,o.start),d=Math.min(c.count,o.start+o.count);for(let p=f,m=d;p<m;p++){let g=c.getX(p);Zh.fromBufferAttribute(h,g),U0(Zh,g,l,n,e,t,this)}}else{let f=Math.max(0,o.start),d=Math.min(h.count,o.start+o.count);for(let p=f,m=d;p<m;p++)Zh.fromBufferAttribute(h,p),U0(Zh,p,l,n,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){let e=this.geometry;if(e.isBufferGeometry){let t=e.morphAttributes,r=Object.keys(t);if(r.length>0){let n=t[r[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=n.length;s<o;s++){let a=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}else{let t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}};xg.prototype.isPoints=!0;function U0(i,e,t,r,n,s,o){let a=vg.distanceSqToPoint(i);if(a<t){let l=new M;vg.closestPointToPoint(i,l),l.applyMatrix4(r);let c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}var eu=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.minFilter=o!==void 0?o:ut,this.magFilter=s!==void 0?s:ut,this.generateMipmaps=!1;let u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}};eu.prototype.isVideoTexture=!0;var bg=class extends _t{constructor(e,t,r){super({width:e,height:t}),this.format=r,this.magFilter=lr,this.minFilter=lr,this.generateMipmaps=!1,this.needsUpdate=!0}};bg.prototype.isFramebufferTexture=!0;var wg=class extends _t{constructor(e,t,r,n,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,n,s,h,f),this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};wg.prototype.isCompressedTexture=!0;var Sg=class extends _t{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c),this.needsUpdate=!0}};Sg.prototype.isCanvasTexture=!0;var gn=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){let t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],r,n=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(n),t.push(s),n=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let r=this.getLengths(),n=0,s=r.length,o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(n=Math.floor(a+(l-a)/2),c=r[n]-o,c<0)a=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,r[n]===o)return n/(s-1);let u=r[n],f=r[n+1]-u,d=(o-u)/f;return(n+d)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new N:new M);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new M,n=[],s=[],o=[],a=new M,l=new _e;for(let d=0;d<=e;d++){let p=d/e;n[d]=this.getTangentAt(p,new M)}s[0]=new M,o[0]=new M;let c=Number.MAX_VALUE,u=Math.abs(n[0].x),h=Math.abs(n[0].y),f=Math.abs(n[0].z);u<=c&&(c=u,r.set(1,0,0)),h<=c&&(c=h,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(n[0],r).normalize(),s[0].crossVectors(n[0],a),o[0].crossVectors(n[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(n[d-1],n[d]),a.length()>Number.EPSILON){a.normalize();let p=Math.acos(yr(n[d-1].dot(n[d]),-1,1));s[d].applyMatrix4(l.makeRotationAxis(a,p))}o[d].crossVectors(n[d],s[d])}if(t===!0){let d=Math.acos(yr(s[0].dot(s[e]),-1,1));d/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(n[p],d*p)),o[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},Bs=class extends gn{constructor(e=0,t=0,r=1,n=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){let r=t||new N,n=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(o?s=0:s=n),this.aClockwise===!0&&!o&&(s===n?s=-n:s=s-n);let a=this.aStartAngle+e*s,l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,d=c-this.aY;l=f*u-d*h+this.aX,c=f*h+d*u+this.aY}return r.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}};Bs.prototype.isEllipseCurve=!0;var wf=class extends Bs{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o),this.type="ArcCurve"}};wf.prototype.isArcCurve=!0;function ey(){let i=0,e=0,t=0,r=0;function n(s,o,a,l){i=s,e=a,t=-3*s+3*o-2*a-l,r=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){n(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,d=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,d*=u,n(o,a,f,d)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var $h=new M,Xm=new ey,Jm=new ey,Qm=new ey,Sf=class extends gn{constructor(e=[],t=!1,r="centripetal",n=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new M){let r=t,n=this.points,s=n.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=n[(a-1)%s]:($h.subVectors(n[0],n[1]).add(n[0]),c=$h);let h=n[a%s],f=n[(a+1)%s];if(this.closed||a+2<s?u=n[(a+2)%s]:($h.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=$h),this.curveType==="centripetal"||this.curveType==="chordal"){let d=this.curveType==="chordal"?.5:.25,p=Math.pow(c.distanceToSquared(h),d),m=Math.pow(h.distanceToSquared(f),d),g=Math.pow(f.distanceToSquared(u),d);m<1e-4&&(m=1),p<1e-4&&(p=m),g<1e-4&&(g=m),Xm.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,p,m,g),Jm.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,p,m,g),Qm.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,p,m,g)}else this.curveType==="catmullrom"&&(Xm.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),Jm.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),Qm.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return r.set(Xm.calc(l),Jm.calc(l),Qm.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Sf.prototype.isCatmullRomCurve3=!0;function z0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function uP(i,e){let t=1-i;return t*t*e}function hP(i,e){return 2*(1-i)*i*e}function fP(i,e){return i*i*e}function zc(i,e,t,r){return uP(i,e)+hP(i,t)+fP(i,r)}function dP(i,e){let t=1-i;return t*t*t*e}function pP(i,e){let t=1-i;return 3*t*t*i*e}function mP(i,e){return 3*(1-i)*i*i*e}function gP(i,e){return i*i*i*e}function Gc(i,e,t,r,n){return dP(i,e)+pP(i,t)+mP(i,r)+gP(i,n)}var sn=class extends gn{constructor(e=new N,t=new N,r=new N,n=new N){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};sn.prototype.isCubicBezierCurve=!0;var Mf=class extends gn{constructor(e=new M,t=new M,r=new M,n=new M){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Gc(e,n.x,s.x,o.x,a.x),Gc(e,n.y,s.y,o.y,a.y),Gc(e,n.z,s.z,o.z,a.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}};Mf.prototype.isCubicBezierCurve3=!0;var on=class extends gn{constructor(e=new N,t=new N){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new N){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t){let r=t||new N;return r.copy(this.v2).sub(this.v1).normalize(),r}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};on.prototype.isLineCurve=!0;var tu=class extends gn{constructor(e=new M,t=new M){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new M){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Gn=class extends gn{constructor(e=new N,t=new N,r=new N){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new N){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Gn.prototype.isQuadraticBezierCurve=!0;var Af=class extends gn{constructor(e=new M,t=new M,r=new M){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new M){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(zc(e,n.x,s.x,o.x),zc(e,n.y,s.y,o.y),zc(e,n.z,s.z,o.z)),r}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}};Af.prototype.isQuadraticBezierCurve3=!0;var _o=class extends gn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new N){let r=t,n=this.points,s=(n.length-1)*e,o=Math.floor(s),a=s-o,l=n[o===0?o:o-1],c=n[o],u=n[o>n.length-2?n.length-1:o+1],h=n[o>n.length-3?n.length-1:o+2];return r.set(z0(a,l.x,c.x,u.x,h.x),z0(a,l.y,c.y,u.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new N().fromArray(n))}return this}};_o.prototype.isSplineCurve=!0;var vb=Object.freeze({__proto__:null,ArcCurve:wf,CatmullRomCurve3:Sf,CubicBezierCurve:sn,CubicBezierCurve3:Mf,EllipseCurve:Bs,LineCurve:on,LineCurve3:tu,QuadraticBezierCurve:Gn,QuadraticBezierCurve3:Af,SplineCurve:_o}),Mg=class extends gn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new on(t,e))}getPoint(e,t){let r=e*this.getLength(),n=this.getCurveLengths(),s=0;for(;s<n.length;){if(n[s]>=r){let o=n[s]-r,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let r=0,n=this.curves.length;r<n;r++)t+=this.curves[r].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],r;for(let n=0,s=this.curves;n<s.length;n++){let o=s[n],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){let u=l[c];r&&r.equals(u)||(t.push(u),r=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,r=this.curves.length;t<r;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,r=e.curves.length;t<r;t++){let n=e.curves[t];this.curves.push(new vb[n.type]().fromJSON(n))}return this}},Ra=class extends Mg{constructor(e){super(),this.type="Path",this.currentPoint=new N,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,r=e.length;t<r;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let r=new on(this.currentPoint.clone(),new N(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new Gn(this.currentPoint.clone(),new N(e,t),new N(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new sn(this.currentPoint.clone(),new N(e,t),new N(r,n),new N(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new _o(t);return this.curves.push(r),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,r,n,s,o){let a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,r,n,s,o),this}absarc(e,t,r,n,s,o){return this.absellipse(e,t,r,r,n,s,o),this}ellipse(e,t,r,n,s,o,a,l){let c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,r,n,s,o,a,l),this}absellipse(e,t,r,n,s,o,a,l){let c=new Bs(e,t,r,n,s,o,a,l);if(this.curves.length>0){let h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);let u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Ba=class extends Ie{constructor(e=[new N(0,.5),new N(.5,0),new N(0,-.5)],t=12,r=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:n},t=Math.floor(t),n=yr(n,0,Math.PI*2);let s=[],o=[],a=[],l=[],c=[],u=1/t,h=new M,f=new N,d=new M,p=new M,m=new M,g=0,v=0;for(let y=0;y<=e.length-1;y++)switch(y){case 0:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,m.copy(d),d.normalize(),l.push(d.x,d.y,d.z);break;case e.length-1:l.push(m.x,m.y,m.z);break;default:g=e[y+1].x-e[y].x,v=e[y+1].y-e[y].y,d.x=v*1,d.y=-g,d.z=v*0,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),l.push(d.x,d.y,d.z),m.copy(p)}for(let y=0;y<=t;y++){let w=r+y*u*n,b=Math.sin(w),S=Math.cos(w);for(let T=0;T<=e.length-1;T++){h.x=e[T].x*b,h.y=e[T].y,h.z=e[T].x*S,o.push(h.x,h.y,h.z),f.x=y/t,f.y=T/(e.length-1),a.push(f.x,f.y);let A=l[3*T+0]*b,x=l[3*T+1],E=l[3*T+0]*S;c.push(A,x,E)}}for(let y=0;y<t;y++)for(let w=0;w<e.length-1;w++){let b=w+y*e.length,S=b,T=b+e.length,A=b+e.length+1,x=b+1;s.push(S,T,x),s.push(A,x,T)}this.setIndex(s),this.setAttribute("position",new Le(o,3)),this.setAttribute("uv",new Le(a,2)),this.setAttribute("normal",new Le(c,3))}static fromJSON(e){return new Ba(e.points,e.segments,e.phiStart,e.phiLength)}};var Co=class extends Ie{constructor(e=1,t=1,r=1,n=8,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};let c=this;n=Math.floor(n),s=Math.floor(s);let u=[],h=[],f=[],d=[],p=0,m=[],g=r/2,v=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function y(){let b=new M,S=new M,T=0,A=(t-e)/r;for(let x=0;x<=s;x++){let E=[],_=x/s,C=_*(t-e)+e;for(let P=0;P<=n;P++){let B=P/n,R=B*l+a,U=Math.sin(R),z=Math.cos(R);S.x=C*U,S.y=-_*r+g,S.z=C*z,h.push(S.x,S.y,S.z),b.set(U,A,z).normalize(),f.push(b.x,b.y,b.z),d.push(B,1-_),E.push(p++)}m.push(E)}for(let x=0;x<n;x++)for(let E=0;E<s;E++){let _=m[E][x],C=m[E+1][x],P=m[E+1][x+1],B=m[E][x+1];u.push(_,C,B),u.push(C,P,B),T+=6}c.addGroup(v,T,0),v+=T}function w(b){let S=p,T=new N,A=new M,x=0,E=b===!0?e:t,_=b===!0?1:-1;for(let P=1;P<=n;P++)h.push(0,g*_,0),f.push(0,_,0),d.push(.5,.5),p++;let C=p;for(let P=0;P<=n;P++){let R=P/n*l+a,U=Math.cos(R),z=Math.sin(R);A.x=E*z,A.y=g*_,A.z=E*U,h.push(A.x,A.y,A.z),f.push(0,_,0),T.x=U*.5+.5,T.y=z*.5*_+.5,d.push(T.x,T.y),p++}for(let P=0;P<n;P++){let B=S+P,R=C+P;b===!0?u.push(R,R+1,B):u.push(R+1,R,B),x+=3}c.addGroup(v,x,b===!0?1:2),v+=x}}static fromJSON(e){return new Co(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Na=class extends Co{constructor(e=1,t=1,r=8,n=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,r,n,s,o,a),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:r,heightSegments:n,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new Na(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Oa=class extends Ie{constructor(e=[],t=[],r=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:r,detail:n};let s=[],o=[];a(n),c(r),u(),this.setAttribute("position",new Le(s,3)),this.setAttribute("normal",new Le(s.slice(),3)),this.setAttribute("uv",new Le(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(y){let w=new M,b=new M,S=new M;for(let T=0;T<t.length;T+=3)d(t[T+0],w),d(t[T+1],b),d(t[T+2],S),l(w,b,S,y)}function l(y,w,b,S){let T=S+1,A=[];for(let x=0;x<=T;x++){A[x]=[];let E=y.clone().lerp(b,x/T),_=w.clone().lerp(b,x/T),C=T-x;for(let P=0;P<=C;P++)P===0&&x===T?A[x][P]=E:A[x][P]=E.clone().lerp(_,P/C)}for(let x=0;x<T;x++)for(let E=0;E<2*(T-x)-1;E++){let _=Math.floor(E/2);E%2===0?(f(A[x][_+1]),f(A[x+1][_]),f(A[x][_])):(f(A[x][_+1]),f(A[x+1][_+1]),f(A[x+1][_]))}}function c(y){let w=new M;for(let b=0;b<s.length;b+=3)w.x=s[b+0],w.y=s[b+1],w.z=s[b+2],w.normalize().multiplyScalar(y),s[b+0]=w.x,s[b+1]=w.y,s[b+2]=w.z}function u(){let y=new M;for(let w=0;w<s.length;w+=3){y.x=s[w+0],y.y=s[w+1],y.z=s[w+2];let b=g(y)/2/Math.PI+.5,S=v(y)/Math.PI+.5;o.push(b,1-S)}p(),h()}function h(){for(let y=0;y<o.length;y+=6){let w=o[y+0],b=o[y+2],S=o[y+4],T=Math.max(w,b,S),A=Math.min(w,b,S);T>.9&&A<.1&&(w<.2&&(o[y+0]+=1),b<.2&&(o[y+2]+=1),S<.2&&(o[y+4]+=1))}}function f(y){s.push(y.x,y.y,y.z)}function d(y,w){let b=y*3;w.x=e[b+0],w.y=e[b+1],w.z=e[b+2]}function p(){let y=new M,w=new M,b=new M,S=new M,T=new N,A=new N,x=new N;for(let E=0,_=0;E<s.length;E+=9,_+=6){y.set(s[E+0],s[E+1],s[E+2]),w.set(s[E+3],s[E+4],s[E+5]),b.set(s[E+6],s[E+7],s[E+8]),T.set(o[_+0],o[_+1]),A.set(o[_+2],o[_+3]),x.set(o[_+4],o[_+5]),S.copy(y).add(w).add(b).divideScalar(3);let C=g(S);m(T,_+0,y,C),m(A,_+2,w,C),m(x,_+4,b,C)}}function m(y,w,b,S){S<0&&y.x===1&&(o[w]=y.x-1),b.x===0&&b.z===0&&(o[w]=S/2/Math.PI+.5)}function g(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}static fromJSON(e){return new Oa(e.vertices,e.indices,e.radius,e.details)}},Fa=class extends Oa{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=1/r,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-r,0,-n,r,0,n,-r,0,n,r,-n,-r,0,-n,r,0,n,-r,0,n,r,0,-r,0,-n,r,0,-n,-r,0,n,r,0,n],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Fa(e.radius,e.detail)}},zz=new M,Gz=new M,kz=new M,Vz=new Jt;var en=class extends Ra{constructor(e){super(e),this.uuid=Fn(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let r=0,n=this.holes.length;r<n;r++)t[r]=this.holes[r].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,r=this.holes.length;t<r;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,r=e.holes.length;t<r;t++){let n=e.holes[t];this.holes.push(new Ra().fromJSON(n))}return this}},yP={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=xb(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,d;if(r&&(s=SP(i,e,s,t)),i.length>80*t){a=c=i[0],l=u=i[1];for(let p=t;p<n;p+=t)h=i[p],f=i[p+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);d=Math.max(c-a,u-l),d=d!==0?1/d:0}return ru(s,o,t,a,l,d),o}};function xb(i,e,t,r,n){let s,o;if(n===RP(i,e,t,r)>0)for(s=e;s<t;s+=r)o=G0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=G0(s,i[s],i[s+1],o);return o&&$f(o,o.next)&&(iu(o),o=o.next),o}function Ns(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&($f(t,t.next)||$t(t.prev,t,t.next)===0)){if(iu(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function ru(i,e,t,r,n,s,o){if(!i)return;!o&&s&&_P(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?xP(i,r,n,s):vP(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),iu(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=bP(Ns(i),e,t),ru(i,e,t,r,n,s,2)):o===2&&wP(i,e,t,r,n,s):ru(Ns(i),e,t,r,n,s,1);break}}}function vP(i){let e=i.prev,t=i,r=i.next;if($t(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(Ea(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&$t(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function xP(i,e,t,r){let n=i.prev,s=i,o=i.next;if($t(n,s,o)>=0)return!1;let a=n.x<s.x?n.x<o.x?n.x:o.x:s.x<o.x?s.x:o.x,l=n.y<s.y?n.y<o.y?n.y:o.y:s.y<o.y?s.y:o.y,c=n.x>s.x?n.x>o.x?n.x:o.x:s.x>o.x?s.x:o.x,u=n.y>s.y?n.y>o.y?n.y:o.y:s.y>o.y?s.y:o.y,h=Ag(a,l,e,t,r),f=Ag(c,u,e,t,r),d=i.prevZ,p=i.nextZ;for(;d&&d.z>=h&&p&&p.z<=f;){if(d!==i.prev&&d!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0||(d=d.prevZ,p!==i.prev&&p!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&$t(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;d&&d.z>=h;){if(d!==i.prev&&d!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,d.x,d.y)&&$t(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;p&&p.z<=f;){if(p!==i.prev&&p!==i.next&&Ea(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&$t(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function bP(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!$f(n,s)&&bb(n,r,r.next,s)&&nu(n,s)&&nu(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),iu(r),iu(r.next),r=i=s),r=r.next}while(r!==i);return Ns(r)}function wP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&DP(o,a)){let l=wb(o,a);o=Ns(o,o.next),l=Ns(l,l.next),ru(o,e,t,r,n,s),ru(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function SP(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=xb(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(LP(c));for(n.sort(MP),s=0;s<n.length;s++)AP(n[s],t),t=Ns(t,t.next);return t}function MP(i,e){return i.x-e.x}function AP(i,e){if(e=TP(i,e),e){let t=wb(e,i);Ns(e,e.next),Ns(t,t.next)}}function TP(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let f=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=r&&f>s){if(s=f,f===r){if(n===t.y)return t;if(n===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(r===s)return o;let a=o,l=o.x,c=o.y,u=1/0,h;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&Ea(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(r-t.x),nu(t,i)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&EP(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function EP(i,e){return $t(i.prev,i,e.prev)<0&&$t(e.next,i,i.next)<0}function _P(i,e,t,r){let n=i;do n.z===null&&(n.z=Ag(n.x,n.y,e,t,r)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==i);n.prevZ.nextZ=null,n.prevZ=null,CP(n)}function CP(i){let e,t,r,n,s,o,a,l,c=1;do{for(t=i,i=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e<c&&(a++,r=r.nextZ,!!r);e++);for(l=c;a>0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(n=t,t=t.nextZ,a--):(n=r,r=r.nextZ,l--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;t=r}s.nextZ=null,c*=2}while(o>1);return i}function Ag(i,e,t,r,n){return i=32767*(i-t)*n,e=32767*(e-r)*n,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function LP(i){let e=i,t=i;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==i);return t}function Ea(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function DP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!PP(i,e)&&(nu(i,e)&&nu(e,i)&&IP(i,e)&&($t(i.prev,i,e.prev)||$t(i,e.prev,e))||$f(i,e)&&$t(i.prev,i,i.next)>0&&$t(e.prev,e,e.next)>0)}function $t(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function $f(i,e){return i.x===e.x&&i.y===e.y}function bb(i,e,t,r){let n=tf($t(i,e,t)),s=tf($t(i,e,r)),o=tf($t(t,r,i)),a=tf($t(t,r,e));return!!(n!==s&&o!==a||n===0&&ef(i,t,e)||s===0&&ef(i,r,e)||o===0&&ef(t,i,r)||a===0&&ef(t,e,r))}function ef(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function tf(i){return i>0?1:i<0?-1:0}function PP(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&bb(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function nu(i,e){return $t(i.prev,i,i.next)<0?$t(i,e,i.next)>=0&&$t(i,i.prev,e)>=0:$t(i,e,i.prev)<0||$t(i,i.next,e)<0}function IP(i,e){let t=i,r=!1,n=(i.x+e.x)/2,s=(i.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function wb(i,e){let t=new Tg(i.i,i.x,i.y),r=new Tg(e.i,e.x,e.y),n=i.next,s=e.prev;return i.next=e,e.prev=i,t.next=n,n.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function G0(i,e,t,r){let n=new Tg(i,e,t);return r?(n.next=r.next,n.prev=r,r.next.prev=n,r.next=n):(n.prev=n,n.next=n),n}function iu(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Tg(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function RP(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var ri=class{static area(e){let t=e.length,r=0;for(let n=t-1,s=0;s<t;n=s++)r+=e[n].x*e[s].y-e[s].x*e[n].y;return r*.5}static isClockWise(e){return ri.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];k0(e),V0(r,e);let o=e.length;t.forEach(k0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,V0(r,t[l]);let a=yP.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function k0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function V0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var Os=class extends Ie{constructor(e=new en([new N(.5,.5),new N(-.5,.5),new N(-.5,-.5),new N(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let r=this,n=[],s=[];for(let a=0,l=e.length;a<l;a++){let c=e[a];o(c)}this.setAttribute("position",new Le(n,3)),this.setAttribute("uv",new Le(s,2)),this.computeVertexNormals();function o(a){let l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,d=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:d-.1,m=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3,v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:BP;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let w,b=!1,S,T,A,x;v&&(w=v.getSpacedPoints(u),b=!0,f=!1,S=v.computeFrenetFrames(u,!1),T=new M,A=new M,x=new M),f||(g=0,d=0,p=0,m=0);let E=a.extractPoints(c),_=E.shape,C=E.holes;if(!ri.isClockWise(_)){_=_.reverse();for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];ri.isClockWise($)&&(C[Z]=$.reverse())}}let B=ri.triangulateShape(_,C),R=_;for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];_=_.concat($)}function U(Z,V,$){return V||console.error("THREE.ExtrudeGeometry: vec does not exist"),V.clone().multiplyScalar($).add(Z)}let z=_.length,J=B.length;function Q(Z,V,$){let ce,ie,pe,ve=Z.x-V.x,me=Z.y-V.y,De=$.x-Z.x,ke=$.y-Z.y,I=ve*ve+me*me,L=ve*ke-me*De;if(Math.abs(L)>Number.EPSILON){let te=Math.sqrt(I),ye=Math.sqrt(De*De+ke*ke),Se=V.x-me/te,Pe=V.y+ve/te,Fe=$.x-ke/ye,he=$.y+De/ye,nt=((Fe-Se)*ke-(he-Pe)*De)/(ve*ke-me*De);ce=Se+ve*nt-Z.x,ie=Pe+me*nt-Z.y;let st=ce*ce+ie*ie;if(st<=2)return new N(ce,ie);pe=Math.sqrt(st/2)}else{let te=!1;ve>Number.EPSILON?De>Number.EPSILON&&(te=!0):ve<-Number.EPSILON?De<-Number.EPSILON&&(te=!0):Math.sign(me)===Math.sign(ke)&&(te=!0),te?(ce=-me,ie=ve,pe=Math.sqrt(I)):(ce=ve,ie=me,pe=Math.sqrt(I/2))}return new N(ce/pe,ie/pe)}let X=[];for(let Z=0,V=R.length,$=V-1,ce=Z+1;Z<V;Z++,$++,ce++)$===V&&($=0),ce===V&&(ce=0),X[Z]=Q(R[Z],R[$],R[ce]);let F=[],k,O=X.concat();for(let Z=0,V=C.length;Z<V;Z++){let $=C[Z];k=[];for(let ce=0,ie=$.length,pe=ie-1,ve=ce+1;ce<ie;ce++,pe++,ve++)pe===ie&&(pe=0),ve===ie&&(ve=0),k[ce]=Q($[ce],$[pe],$[ve]);F.push(k),O=O.concat(k)}for(let Z=0;Z<g;Z++){let V=Z/g,$=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let ie=0,pe=R.length;ie<pe;ie++){let ve=U(R[ie],X[ie],ce);ge(ve.x,ve.y,-$)}for(let ie=0,pe=C.length;ie<pe;ie++){let ve=C[ie];k=F[ie];for(let me=0,De=ve.length;me<De;me++){let ke=U(ve[me],k[me],ce);ge(ke.x,ke.y,-$)}}}let j=p+m;for(let Z=0;Z<z;Z++){let V=f?U(_[Z],O[Z],j):_[Z];b?(A.copy(S.normals[0]).multiplyScalar(V.x),T.copy(S.binormals[0]).multiplyScalar(V.y),x.copy(w[0]).add(A).add(T),ge(x.x,x.y,x.z)):ge(V.x,V.y,0)}for(let Z=1;Z<=u;Z++)for(let V=0;V<z;V++){let $=f?U(_[V],O[V],j):_[V];b?(A.copy(S.normals[Z]).multiplyScalar($.x),T.copy(S.binormals[Z]).multiplyScalar($.y),x.copy(w[Z]).add(A).add(T),ge(x.x,x.y,x.z)):ge($.x,$.y,h/u*Z)}for(let Z=g-1;Z>=0;Z--){let V=Z/g,$=d*Math.cos(V*Math.PI/2),ce=p*Math.sin(V*Math.PI/2)+m;for(let ie=0,pe=R.length;ie<pe;ie++){let ve=U(R[ie],X[ie],ce);ge(ve.x,ve.y,h+$)}for(let ie=0,pe=C.length;ie<pe;ie++){let ve=C[ie];k=F[ie];for(let me=0,De=ve.length;me<De;me++){let ke=U(ve[me],k[me],ce);b?ge(ke.x,ke.y+w[u-1].y,w[u-1].x+$):ge(ke.x,ke.y,h+$)}}}q(),K();function q(){let Z=n.length/3;if(f){let V=0,$=z*V;for(let ce=0;ce<J;ce++){let ie=B[ce];oe(ie[2]+$,ie[1]+$,ie[0]+$)}V=u+g*2,$=z*V;for(let ce=0;ce<J;ce++){let ie=B[ce];oe(ie[0]+$,ie[1]+$,ie[2]+$)}}else{for(let V=0;V<J;V++){let $=B[V];oe($[2],$[1],$[0])}for(let V=0;V<J;V++){let $=B[V];oe($[0]+z*u,$[1]+z*u,$[2]+z*u)}}r.addGroup(Z,n.length/3-Z,0)}function K(){let Z=n.length/3,V=0;W(R,V),V+=R.length;for(let $=0,ce=C.length;$<ce;$++){let ie=C[$];W(ie,V),V+=ie.length}r.addGroup(Z,n.length/3-Z,1)}function W(Z,V){let $=Z.length;for(;--$>=0;){let ce=$,ie=$-1;ie<0&&(ie=Z.length-1);for(let pe=0,ve=u+g*2;pe<ve;pe++){let me=z*pe,De=z*(pe+1),ke=V+ce+me,I=V+ie+me,L=V+ie+De,te=V+ce+De;le(ke,I,L,te)}}}function ge(Z,V,$){l.push(Z),l.push(V),l.push($)}function oe(Z,V,$){H(Z),H(V),H($);let ce=n.length/3,ie=y.generateTopUV(r,n,ce-3,ce-2,ce-1);ue(ie[0]),ue(ie[1]),ue(ie[2])}function le(Z,V,$,ce){H(Z),H(V),H(ce),H(V),H($),H(ce);let ie=n.length/3,pe=y.generateSideWallUV(r,n,ie-6,ie-3,ie-2,ie-1);ue(pe[0]),ue(pe[1]),ue(pe[3]),ue(pe[1]),ue(pe[2]),ue(pe[3])}function H(Z){n.push(l[Z*3+0]),n.push(l[Z*3+1]),n.push(l[Z*3+2])}function ue(Z){s.push(Z.x),s.push(Z.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return NP(t,r,e)}static fromJSON(e,t){let r=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];r.push(a)}let n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new vb[n.type]().fromJSON(n)),new Os(r,e.options)}},BP={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],u=e[n*3+1];return[new N(s,o),new N(a,l),new N(c,u)]},generateSideWallUV:function(i,e,t,r,n,s){let o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[r*3],u=e[r*3+1],h=e[r*3+2],f=e[n*3],d=e[n*3+1],p=e[n*3+2],m=e[s*3],g=e[s*3+1],v=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new N(o,1-l),new N(c,1-h),new N(f,1-p),new N(m,1-v)]:[new N(a,1-l),new N(u,1-h),new N(d,1-p),new N(g,1-v)]}};function NP(i,e,t){if(t.shapes=[],Array.isArray(i))for(let r=0,n=i.length;r<n;r++){let s=i[r];t.shapes.push(s.uuid)}else t.shapes.push(i.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var Ua=class extends Oa{constructor(e=1,t=0){let r=(1+Math.sqrt(5))/2,n=[-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Ua(e.radius,e.detail)}};var Lo=class extends Ie{constructor(e=new en([new N(0,.5),new N(-.5,-.5),new N(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let r=[],n=[],s=[],o=[],a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(r),this.setAttribute("position",new Le(n,3)),this.setAttribute("normal",new Le(s,3)),this.setAttribute("uv",new Le(o,2));function c(u){let h=n.length/3,f=u.extractPoints(t),d=f.shape,p=f.holes;ri.isClockWise(d)===!1&&(d=d.reverse());for(let g=0,v=p.length;g<v;g++){let y=p[g];ri.isClockWise(y)===!0&&(p[g]=y.reverse())}let m=ri.triangulateShape(d,p);for(let g=0,v=p.length;g<v;g++){let y=p[g];d=d.concat(y)}for(let g=0,v=d.length;g<v;g++){let y=d[g];n.push(y.x,y.y,0),s.push(0,0,1),o.push(y.x,y.y)}for(let g=0,v=m.length;g<v;g++){let y=m[g],w=y[0]+h,b=y[1]+h,S=y[2]+h;r.push(w,b,S),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return OP(t,e)}static fromJSON(e,t){let r=[];for(let n=0,s=e.shapes.length;n<s;n++){let o=t[e.shapes[n]];r.push(o)}return new Lo(r,e.curveSegments)}};function OP(i,e){if(e.shapes=[],Array.isArray(i))for(let t=0,r=i.length;t<r;t++){let n=i[t];e.shapes.push(n.uuid)}else e.shapes.push(i.uuid);return e}var Do=class extends Ie{constructor(e=1,t=32,r=16,n=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:r,phiStart:n,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),r=Math.max(2,Math.floor(r));let l=Math.min(o+a,Math.PI),c=0,u=[],h=new M,f=new M,d=[],p=[],m=[],g=[];for(let v=0;v<=r;v++){let y=[],w=v/r,b=0;v==0&&o==0?b=.5/t:v==r&&l==Math.PI&&(b=-.5/t);for(let S=0;S<=t;S++){let T=S/t;h.x=-e*Math.cos(n+T*s)*Math.sin(o+w*a),h.y=e*Math.cos(o+w*a),h.z=e*Math.sin(n+T*s)*Math.sin(o+w*a),p.push(h.x,h.y,h.z),f.copy(h).normalize(),m.push(f.x,f.y,f.z),g.push(T+b,1-w),y.push(c++)}u.push(y)}for(let v=0;v<r;v++)for(let y=0;y<t;y++){let w=u[v][y+1],b=u[v][y],S=u[v+1][y],T=u[v+1][y+1];(v!==0||o>0)&&d.push(w,b,T),(v!==r-1||l<Math.PI)&&d.push(b,S,T)}this.setIndex(d),this.setAttribute("position",new Le(p,3)),this.setAttribute("normal",new Le(m,3)),this.setAttribute("uv",new Le(g,2))}static fromJSON(e){return new Do(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var za=class extends Ie{constructor(e=1,t=.4,r=64,n=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o},r=Math.floor(r),n=Math.floor(n);let a=[],l=[],c=[],u=[],h=new M,f=new M,d=new M,p=new M,m=new M,g=new M,v=new M;for(let w=0;w<=r;++w){let b=w/r*s*Math.PI*2;y(b,s,o,e,d),y(b+.01,s,o,e,p),g.subVectors(p,d),v.addVectors(p,d),m.crossVectors(g,v),v.crossVectors(m,g),m.normalize(),v.normalize();for(let S=0;S<=n;++S){let T=S/n*Math.PI*2,A=-t*Math.cos(T),x=t*Math.sin(T);h.x=d.x+(A*v.x+x*m.x),h.y=d.y+(A*v.y+x*m.y),h.z=d.z+(A*v.z+x*m.z),l.push(h.x,h.y,h.z),f.subVectors(h,d).normalize(),c.push(f.x,f.y,f.z),u.push(w/r),u.push(S/n)}}for(let w=1;w<=r;w++)for(let b=1;b<=n;b++){let S=(n+1)*(w-1)+(b-1),T=(n+1)*w+(b-1),A=(n+1)*w+b,x=(n+1)*(w-1)+b;a.push(S,T,x),a.push(T,A,x)}this.setIndex(a),this.setAttribute("position",new Le(l,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(u,2));function y(w,b,S,T,A){let x=Math.cos(w),E=Math.sin(w),_=S/b*w,C=Math.cos(_);A.x=T*(2+C)*.5*x,A.y=T*(2+C)*E*.5,A.z=T*Math.sin(_)*.5}}static fromJSON(e){return new za(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var Tf=class extends cr{constructor(e){super(),this.type="ShadowMaterial",this.color=new xe(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}};Tf.prototype.isShadowMaterial=!0;var Ef=class extends St{constructor(e){super(e),this.type="RawShaderMaterial"}};Ef.prototype.isRawShaderMaterial=!0;var su=class extends cr{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new xe(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};su.prototype.isMeshStandardMaterial=!0;var _f=class extends su{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new N(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return yr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new xe(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new xe(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new xe(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(e)}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}};_f.prototype.isMeshPhysicalMaterial=!0;var Cf=class extends cr{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new xe(16777215),this.specular=new xe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}};Cf.prototype.isMeshPhongMaterial=!0;var Lf=class extends cr{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new xe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Lf.prototype.isMeshToonMaterial=!0;var Df=class extends cr{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};Df.prototype.isMeshNormalMaterial=!0;var Pf=class extends cr{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new xe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new xe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Kf,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}};Pf.prototype.isMeshLambertMaterial=!0;var If=class extends cr{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new xe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wa,this.normalScale=new N(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}};If.prototype.isMeshMatcapMaterial=!0;var Rf=class extends Ur{constructor(e){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}};Rf.prototype.isLineDashedMaterial=!0;var FP={ShadowMaterial:Tf,SpriteMaterial:Zc,RawShaderMaterial:Ef,ShaderMaterial:St,PointsMaterial:$c,MeshPhysicalMaterial:_f,MeshStandardMaterial:su,MeshPhongMaterial:Cf,MeshToonMaterial:Lf,MeshNormalMaterial:Df,MeshLambertMaterial:Pf,MeshDepthMaterial:Jc,MeshDistanceMaterial:Qc,MeshBasicMaterial:Un,MeshMatcapMaterial:If,LineDashedMaterial:Rf,LineBasicMaterial:Ur,Material:cr};cr.fromType=function(i){return new FP[i]};var Xt={arraySlice:function(i,e,t){return Xt.isTypedArray(i)?new i.constructor(i.subarray(e,t!==void 0?t:i.length)):i.slice(e,t)},convertArray:function(i,e,t){return!i||!t&&i.constructor===e?i:typeof e.BYTES_PER_ELEMENT=="number"?new e(i):Array.prototype.slice.call(i)},isTypedArray:function(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)},getKeyframeOrder:function(i){function e(n,s){return i[n]-i[s]}let t=i.length,r=new Array(t);for(let n=0;n!==t;++n)r[n]=n;return r.sort(e),r},sortedArray:function(i,e,t){let r=i.length,n=new i.constructor(r);for(let s=0,o=0;o!==r;++s){let a=t[s]*e;for(let l=0;l!==e;++l)n[o++]=i[a+l]}return n},flattenJSON:function(i,e,t,r){let n=1,s=i[0];for(;s!==void 0&&s[r]===void 0;)s=i[n++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=i[n++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=i[n++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=i[n++];while(s!==void 0)},subclip:function(i,e,t,r,n=30){let s=i.clone();s.name=e;let o=[];for(let l=0;l<s.tracks.length;++l){let c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let d=0;d<c.times.length;++d){let p=c.times[d]*n;if(!(p<t||p>=r)){h.push(c.times[d]);for(let m=0;m<u;++m)f.push(c.values[d*u+m])}}h.length!==0&&(c.times=Xt.convertArray(h,c.times.constructor),c.values=Xt.convertArray(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===l});if(c===void 0)continue;let u=0,h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0,d=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=d/3);let p=a.times.length-1,m;if(s<=a.times[0]){let v=u,y=h-u;m=Xt.arraySlice(a.values,v,y)}else if(s>=a.times[p]){let v=p*h+u,y=v+h-u;m=Xt.arraySlice(a.values,v,y)}else{let v=a.createInterpolant(),y=u,w=h-u;v.evaluate(s),m=Xt.arraySlice(v.resultBuffer,y,w)}l==="quaternion"&&new Ut().fromArray(m).normalize().conjugate().toArray(m);let g=c.times.length;for(let v=0;v<g;++v){let y=v*d+f;if(l==="quaternion")Ut.multiplyQuaternionsFlat(c.values,y,m,0,c.values,y);else{let w=d-f*2;for(let b=0;b<w;++b)c.values[y+b]-=m[b]}}}return i.blendMode=sb,i}},Ti=class{constructor(e,t,r,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,r=this._cachedIndex,n=t[r],s=t[r-1];e:{t:{let o;r:{n:if(!(e<n)){for(let a=r+2;;){if(n===void 0){if(e<s)break n;return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,e,s)}if(r===a)break;if(s=n,n=t[++r],e<n)break t}o=t.length;break r}if(!(e>=s)){let a=t[1];e<a&&(r=2,s=a);for(let l=r-2;;){if(s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(r===l)break;if(n=s,s=t[--r-1],e>=s)break t}o=r,r=0;break r}break e}for(;r<o;){let a=r+o>>>1;e<t[a]?o=a:r=a+1}if(n=t[r],s=t[r-1],s===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,n);if(n===void 0)return r=t.length,this._cachedIndex=r,this.afterEnd_(r-1,s,e)}this._cachedIndex=r,this.intervalChanged_(r,s,n)}return this.interpolate_(r,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=e*n;for(let o=0;o!==n;++o)t[o]=r[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}};Ti.prototype.beforeStart_=Ti.prototype.copySampleValue_;Ti.prototype.afterEnd_=Ti.prototype.copySampleValue_;var Eg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ma,endingEnd:Ma}}intervalChanged_(e,t,r){let n=this.parameterPositions,s=e-2,o=e+1,a=n[s],l=n[o];if(a===void 0)switch(this.getSettings_().endingStart){case Aa:s=e,a=2*t-r;break;case hf:s=n.length-2,a=t+n[s]-n[s+1];break;default:s=e,a=r}if(l===void 0)switch(this.getSettings_().endingEnd){case Aa:o=e,l=2*r-t;break;case hf:o=1,l=r+n[1]-n[0];break;default:o=e-1,l=t}let c=(r-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-r),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,d=this._weightNext,p=(r-t)/(n-t),m=p*p,g=m*p,v=-f*g+2*f*m-f*p,y=(1+f)*g+(-1.5-2*f)*m+(-.5+f)*p+1,w=(-1-d)*g+(1.5+d)*m+.5*p,b=d*g-d*m;for(let S=0;S!==a;++S)s[S]=v*o[u+S]+y*o[c+S]+w*o[l+S]+b*o[h+S];return s}},Bf=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(r-t)/(n-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}},_g=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},kn=class{constructor(e,t,r,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Xt.convertArray(t,this.TimeBufferType),this.values=Xt.convertArray(r,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,r;if(t.toJSON!==this.toJSON)r=t.toJSON(e);else{r={name:e.name,times:Xt.convertArray(e.times,Array),values:Xt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new _g(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Bf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Eg(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case cf:t=this.InterpolantFactoryMethodDiscrete;break;case uf:t=this.InterpolantFactoryMethodLinear;break;case xm:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let r="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(r);return console.warn("THREE.KeyframeTrack:",r),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return cf;case this.InterpolantFactoryMethodLinear:return uf;case this.InterpolantFactoryMethodSmooth:return xm}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let r=0,n=t.length;r!==n;++r)t[r]*=e}return this}trim(e,t){let r=this.times,n=r.length,s=0,o=n-1;for(;s!==n&&r[s]<e;)++s;for(;o!==-1&&r[o]>t;)--o;if(++o,s!==0||o!==n){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=Xt.arraySlice(r,s,o),this.values=Xt.arraySlice(this.values,s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let r=this.times,n=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(n!==void 0&&Xt.isTypedArray(n))for(let a=0,l=n.length;a!==l;++a){let c=n[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){let e=Xt.arraySlice(this.times),t=Xt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===xm,s=e.length-1,o=1;for(let a=1;a<s;++a){let l=!1,c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(n)l=!0;else{let h=a*r,f=h-r,d=h+r;for(let p=0;p!==r;++p){let m=t[h+p];if(m!==t[f+p]||m!==t[d+p]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let h=a*r,f=o*r;for(let d=0;d!==r;++d)t[f+d]=t[h+d]}++o}}if(s>0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=Xt.arraySlice(e,0,o),this.values=Xt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Xt.arraySlice(this.times,0),t=Xt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};kn.prototype.TimeBufferType=Float32Array;kn.prototype.ValueBufferType=Float32Array;kn.prototype.DefaultInterpolation=uf;var Fs=class extends kn{};Fs.prototype.ValueTypeName="bool";Fs.prototype.ValueBufferType=Array;Fs.prototype.DefaultInterpolation=cf;Fs.prototype.InterpolantFactoryMethodLinear=void 0;Fs.prototype.InterpolantFactoryMethodSmooth=void 0;var Nf=class extends kn{};Nf.prototype.ValueTypeName="color";var Ga=class extends kn{};Ga.prototype.ValueTypeName="number";var Cg=class extends Ti{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e,t,r,n){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(n-t),c=e*a;for(let u=c+a;c!==u;c+=4)Ut.slerpFlat(s,0,o,c-a,o,c,l);return s}},Po=class extends kn{InterpolantFactoryMethodLinear(e){return new Cg(this.times,this.values,this.getValueSize(),e)}};Po.prototype.ValueTypeName="quaternion";Po.prototype.DefaultInterpolation=uf;Po.prototype.InterpolantFactoryMethodSmooth=void 0;var Us=class extends kn{};Us.prototype.ValueTypeName="string";Us.prototype.ValueBufferType=Array;Us.prototype.DefaultInterpolation=cf;Us.prototype.InterpolantFactoryMethodLinear=void 0;Us.prototype.InterpolantFactoryMethodSmooth=void 0;var ka=class extends kn{};ka.prototype.ValueTypeName="vector";var Of=class{constructor(e,t=-1,r,n=Kg){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Fn(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],r=e.tracks,n=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(zP(r[o]).scale(n));let s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){let t=[],r=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(kn.toJSON(r[s]));return n}static CreateFromMorphTargetSequence(e,t,r,n){let s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);let u=Xt.getKeyframeOrder(l);l=Xt.sortedArray(l,1,u),c=Xt.sortedArray(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Ga(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/r))}return new this(e,-1,o)}static findByName(e,t){let r=e;if(!Array.isArray(e)){let n=e;r=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<r.length;n++)if(r[n].name===t)return r[n];return null}static CreateClipsFromMorphTargetSequences(e,t,r){let n={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){let c=e[a],u=c.name.match(s);if(u&&u.length>1){let h=u[1],f=n[h];f||(n[h]=f=[]),f.push(c)}}let o=[];for(let a in n)o.push(this.CreateFromMorphTargetSequence(a,n[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let r=function(h,f,d,p,m){if(d.length!==0){let g=[],v=[];Xt.flattenJSON(d,g,v,p),g.length!==0&&m.push(new h(f,g,v))}},n=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let h=0;h<c.length;h++){let f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){let d={},p;for(p=0;p<f.length;p++)if(f[p].morphTargets)for(let m=0;m<f[p].morphTargets.length;m++)d[f[p].morphTargets[m]]=-1;for(let m in d){let g=[],v=[];for(let y=0;y!==f[p].morphTargets.length;++y){let w=f[p];g.push(w.time),v.push(w.morphTarget===m?1:0)}n.push(new Ga(".morphTargetInfluence["+m+"]",g,v))}l=d.length*o}else{let d=".bones["+t[h].name+"]";r(ka,d+".position",f,"pos",n),r(Po,d+".quaternion",f,"rot",n),r(ka,d+".scale",f,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function UP(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Ga;case"vector":case"vector2":case"vector3":case"vector4":return ka;case"color":return Nf;case"quaternion":return Po;case"bool":case"boolean":return Fs;case"string":return Us}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function zP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=UP(i.type);if(i.times===void 0){let t=[],r=[];Xt.flattenJSON(i.keys,t,r,"value"),i.times=t,i.values=r}return e.parse!==void 0?e.parse(i):new e(i.name,i.times,i.values,i.interpolation)}var Va={enabled:!1,files:{},add:function(i,e){this.enabled!==!1&&(this.files[i]=e)},get:function(i){if(this.enabled!==!1)return this.files[i]},remove:function(i){delete this.files[i]},clear:function(){this.files={}}},Io=class{constructor(e,t,r){let n=this,s=!1,o=0,a=0,l,c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(u){a++,s===!1&&n.onStart!==void 0&&n.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,n.onProgress!==void 0&&n.onProgress(u,o,a),o===a&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(u){n.onError!==void 0&&n.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){let h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){let d=c[h],p=c[h+1];if(d.global&&(d.lastIndex=0),d.test(u))return p}return null}}},GP=new Io,an=class{constructor(e){this.manager=e!==void 0?e:GP,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,s){r.load(e,n,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}},Qi={},is=class extends an{constructor(e){super(e)}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=Va.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Qi[e]!==void 0){Qi[e].push({onLoad:t,onProgress:r,onError:n});return}Qi[e]=[],Qi[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;let u=Qi[e],h=c.body.getReader(),f=c.headers.get("Content-Length"),d=f?parseInt(f):0,p=d!==0,m=0,g=new ReadableStream({start(v){y();function y(){h.read().then(({done:w,value:b})=>{if(w)v.close();else{m+=b.byteLength;let S=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:d});for(let T=0,A=u.length;T<A;T++){let x=u[T];x.onProgress&&x.onProgress(S)}v.enqueue(b),y()}})}}});return new Response(g)}else throw Error(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{let h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return c.arrayBuffer().then(p=>d.decode(p))}}}).then(c=>{Va.add(e,c);let u=Qi[e];delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onLoad&&d.onLoad(c)}}).catch(c=>{let u=Qi[e];if(u===void 0)throw this.manager.itemError(e),c;delete Qi[e];for(let h=0,f=u.length;h<f;h++){let d=u[h];d.onError&&d.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var Ff=class extends an{constructor(e){super(e)}load(e,t,r,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Va.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=jc("img");function l(){u(),Va.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),n&&n(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},Lg=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=new Rs,o=new Ff(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let c=0;c<e.length;++c)l(c);return s}};var Dg=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=new _t,o=new Ff(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,n),s}},yn=class extends ot{constructor(e,t=1){super(),this.type="Light",this.color=new xe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}};yn.prototype.isLight=!0;var zs=class extends yn{constructor(e,t,r){super(e,r),this.type="HemisphereLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.groundColor=new xe(t)}copy(e){return yn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};zs.prototype.isHemisphereLight=!0;var H0=new _e,W0=new M,j0=new M,ou=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new N(512,512),this.map=null,this.mapPass=null,this.matrix=new _e,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Pa,this._frameExtents=new N(1,1),this._viewportCount=1,this._viewports=[new Ke(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;W0.setFromMatrixPosition(e.matrixWorld),t.position.copy(W0),j0.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(j0),t.updateMatrixWorld(),H0.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(H0),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(t.projectionMatrix),r.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},Uf=class extends ou{constructor(){super(new nr(50,1,.5,500)),this.focus=1}updateMatrices(e){let t=this.camera,r=Wc*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}};Uf.prototype.isSpotLightShadow=!0;var au=class extends yn{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t),this.type="SpotLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Uf}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};au.prototype.isSpotLight=!0;var q0=new _e,Rc=new M,Km=new M,zf=class extends ou{constructor(){super(new nr(90,1,.5,500)),this._frameExtents=new N(4,2),this._viewportCount=6,this._viewports=[new Ke(2,1,1,1),new Ke(0,1,1,1),new Ke(3,1,1,1),new Ke(1,1,1,1),new Ke(3,0,1,1),new Ke(1,0,1,1)],this._cubeDirections=[new M(1,0,0),new M(-1,0,0),new M(0,0,1),new M(0,0,-1),new M(0,1,0),new M(0,-1,0)],this._cubeUps=[new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,1,0),new M(0,0,1),new M(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Rc.setFromMatrixPosition(e.matrixWorld),r.position.copy(Rc),Km.copy(r.position),Km.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Km),r.updateMatrixWorld(),n.makeTranslation(-Rc.x,-Rc.y,-Rc.z),q0.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(q0)}};zf.prototype.isPointLightShadow=!0;var lu=class extends yn{constructor(e,t,r=0,n=1){super(e,t),this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new zf}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}};lu.prototype.isPointLight=!0;var Gf=class extends ou{constructor(){super(new To(-5,5,5,-5,.5,500))}};Gf.prototype.isDirectionalLightShadow=!0;var cu=class extends yn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy(ot.DefaultUp),this.updateMatrix(),this.target=new ot,this.shadow=new Gf}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};cu.prototype.isDirectionalLight=!0;var Pg=class extends yn{constructor(e,t){super(e,t),this.type="AmbientLight"}};Pg.prototype.isAmbientLight=!0;var Ig=class extends yn{constructor(e,t,r=10,n=10){super(e,t),this.type="RectAreaLight",this.width=r,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){let t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}};Ig.prototype.isRectAreaLight=!0;var kf=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new M)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};kf.prototype.isSphericalHarmonics3=!0;var uu=class extends yn{constructor(e=new kf,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}};uu.prototype.isLightProbe=!0;var Rg=class{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,n=e.length;r<n;r++)t+=String.fromCharCode(e[r]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},Vf=class extends Ie{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){let e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}};Vf.prototype.isInstancedBufferGeometry=!0;var Gs=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}parse(e){let t={},r={};function n(d,p){if(t[p]!==void 0)return t[p];let g=d.interleavedBuffers[p],v=s(d,g.buffer),y=Th(g.type,v),w=new rs(y,g.stride);return w.uuid=g.uuid,t[p]=w,w}function s(d,p){if(r[p]!==void 0)return r[p];let g=d.arrayBuffers[p],v=new Uint32Array(g).buffer;return r[p]=v,v}let o=e.isInstancedBufferGeometry?new Vf:new Ie,a=e.data.index;if(a!==void 0){let d=Th(a.type,a.array);o.setIndex(new Ue(d,1))}let l=e.data.attributes;for(let d in l){let p=l[d],m;if(p.isInterleavedBufferAttribute){let g=n(e.data,p.data);m=new Ai(g,p.itemSize,p.offset,p.normalized)}else{let g=Th(p.type,p.array),v=p.isInstancedBufferAttribute?Ia:Ue;m=new v(g,p.itemSize,p.normalized)}p.name!==void 0&&(m.name=p.name),p.usage!==void 0&&m.setUsage(p.usage),p.updateRange!==void 0&&(m.updateRange.offset=p.updateRange.offset,m.updateRange.count=p.updateRange.count),o.setAttribute(d,m)}let c=e.data.morphAttributes;if(c)for(let d in c){let p=c[d],m=[];for(let g=0,v=p.length;g<v;g++){let y=p[g],w;if(y.isInterleavedBufferAttribute){let b=n(e.data,y.data);w=new Ai(b,y.itemSize,y.offset,y.normalized)}else{let b=Th(y.type,y.array);w=new Ue(b,y.itemSize,y.normalized)}y.name!==void 0&&(w.name=y.name),m.push(w)}o.morphAttributes[d]=m}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let d=0,p=h.length;d!==p;++d){let m=h[d];o.addGroup(m.start,m.count,m.materialIndex)}let f=e.data.boundingSphere;if(f!==void 0){let d=new M;f.center!==void 0&&d.fromArray(f.center),o.boundingSphere=new Yr(d,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var Bg=class extends an{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let s=this,o=Va.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Va.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){n&&n(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}};Bg.prototype.isImageBitmapLoader=!0;var rf,kP={getContext:function(){return rf===void 0&&(rf=new(window.AudioContext||window.webkitAudioContext)),rf},setContext:function(i){rf=i}},Ng=class extends an{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new is(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{let l=a.slice(0);kP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},Og=class extends uu{constructor(e,t,r=1){super(void 0,r);let n=new xe().set(e),s=new xe().set(t),o=new M(n.r,n.g,n.b),a=new M(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}};Og.prototype.isHemisphereLightProbe=!0;var Fg=class extends uu{constructor(e,t=1){super(void 0,t);let r=new xe().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};Fg.prototype.isAmbientLightProbe=!0;var Hf=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Y0(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=Y0();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function Y0(){return(typeof performance>"u"?Date:performance).now()}var Ug=class extends ot{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}};var zg=class{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}},Gg=class{constructor(e,t,r){this.binding=e,this.valueSize=r;let n,s,o;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:n=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){let r=this.buffer,n=this.valueSize,s=e*n+n,o=this.cumulativeWeight;if(o===0){for(let a=0;a!==n;++a)r[s+a]=r[a];o=t}else{o+=t;let a=t/o;this._mixBufferRegion(r,s,0,a,n)}this.cumulativeWeight=o}accumulateAdditive(e){let t=this.buffer,r=this.valueSize,n=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,r=this.buffer,n=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){let l=t*this._origIndex;this._mixBufferRegion(r,n,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,r=this.valueSize,n=r*this._origIndex;e.getValue(t,n);for(let s=r,o=n;s!==o;++s)t[s]=t[n+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r<t;r++)this.buffer[r]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let r=0;r<this.valueSize;r++)this.buffer[t+r]=this.buffer[e+r]}_select(e,t,r,n,s){if(n>=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,n){Ut.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ut.multiplyQuaternionsFlat(e,o,e,t,e,r),Ut.slerpFlat(e,t,e,t,e,o,n)}_lerp(e,t,r,n,s){let o=1-n;for(let a=0;a!==s;++a){let l=t+a;e[l]=e[l]*o+e[r+a]*n}}_lerpAdditive(e,t,r,n,s){for(let o=0;o!==s;++o){let a=t+o;e[a]=e[a]+e[r+o]*n}}},ty="\\[\\]\\.:\\/",VP=new RegExp("["+ty+"]","g"),ry="[^"+ty+"]",HP="[^"+ty.replace("\\.","")+"]",WP=/((?:WC+[\/:])*)/.source.replace("WC",ry),jP=/(WCOD+)?/.source.replace("WCOD",HP),qP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ry),YP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ry),XP=new RegExp("^"+WP+jP+qP+YP+"$"),JP=["material","materials","bones"],kg=class{constructor(e,t,r){let n=r||xt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let r=this._targetGroup.nCachedObjects_,n=this._bindings[r];n!==void 0&&n.getValue(e,t)}setValue(e,t){let r=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=r.length;n!==s;++n)r[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}},xt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||xt.parseTrackName(t),this.node=xt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new xt.Composite(e,t,r):new xt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(VP,"")}static parseTrackName(e){let t=XP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);JP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){let r=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let l=r(a.children);if(l)return l}return null},n=r(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)e[t++]=r[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let r=this.resolvedProperty;for(let n=0,s=r.length;n!==s;++n)r[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,r=t.objectName,n=t.propertyName,s=t.propertyIndex;if(e||(e=xt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(r){let c=t.objectIndex;switch(r){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;default:if(e[r]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[r]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}let o=e[n];if(o===void 0){let c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+n+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(n==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};xt.Composite=kg;xt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};xt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};xt.prototype.GetterByBindingType=[xt.prototype._getValue_direct,xt.prototype._getValue_array,xt.prototype._getValue_arrayElement,xt.prototype._getValue_toArray];xt.prototype.SetterByBindingTypeAndVersioning=[[xt.prototype._setValue_direct,xt.prototype._setValue_direct_setNeedsUpdate,xt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_array,xt.prototype._setValue_array_setNeedsUpdate,xt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_arrayElement,xt.prototype._setValue_arrayElement_setNeedsUpdate,xt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xt.prototype._setValue_fromArray,xt.prototype._setValue_fromArray_setNeedsUpdate,xt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Vg=class{constructor(){this.uuid=Fn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let e={};this._indicesByUUID=e;for(let r=0,n=arguments.length;r!==n;++r)e[arguments[r].uuid]=r;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){let e=this._objects,t=this._indicesByUUID,r=this._paths,n=this._parsedPaths,s=this._bindings,o=s.length,a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){let f=arguments[u],d=f.uuid,p=t[d];if(p===void 0){p=l++,t[d]=p,e.push(f);for(let m=0,g=o;m!==g;++m)s[m].push(new xt(f,r[m],n[m]))}else if(p<c){a=e[p];let m=--c,g=e[m];t[g.uuid]=p,e[p]=g,t[d]=m,e[m]=f;for(let v=0,y=o;v!==y;++v){let w=s[v],b=w[m],S=w[p];w[p]=b,S===void 0&&(S=new xt(f,r[v],n[v])),w[m]=S}}else e[p]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){let l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){let h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let d=0,p=n;d!==p;++d){let m=r[d],g=m[h],v=m[u];m[u]=g,m[h]=v}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){let f=--s,d=e[f],p=--o,m=e[p];t[d.uuid]=h,e[h]=d,t[m.uuid]=f,e[f]=m,e.pop();for(let g=0,v=n;g!==v;++g){let y=r[g],w=y[f],b=y[p];y[h]=w,y[f]=b,y.pop()}}else{let f=--o,d=e[f];f>0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let p=0,m=n;p!==m;++p){let g=r[p];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){let r=this._bindingsIndicesByPath,n=r[e],s=this._bindings;if(n!==void 0)return s[n];let o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(h);for(let f=u,d=l.length;f!==d;++f){let p=l[f];h[f]=new xt(p,e,t)}return h}unsubscribe_(e){let t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){let n=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),n[r]=n[a],n.pop()}}};Vg.prototype.isAnimationObjectGroup=!0;var Hg=class{constructor(e,t,r=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=n;let s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Ma,endingEnd:Ma};for(let c=0;c!==o;++c){let u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=lE,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){let n=this._clip.duration,s=e._clip.duration,o=s/n,a=n/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){let e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){let n=this._mixer,s=n.time,o=this.timeScale,a=this._timeScaleInterpolant;a===null&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);let l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+r,c[0]=e/o,c[1]=t/o,this}stopWarping(){let e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,n){if(!this.enabled){this._updateWeight(e);return}let s=this._startTime;if(s!==null){let l=(e-s)*r;if(l<0||r===0)return;this._startTime=null,t=r*l}t*=this._updateTimeScale(e);let o=this._updateTime(t),a=this._updateWeight(e);if(a>0){let l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case sb:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Kg:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(n,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let r=this._weightInterpolant;if(r!==null){let n=r.evaluate(e)[0];t*=n,e>r.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let r=this._timeScaleInterpolant;r!==null&&(t*=r.evaluate(e)[0],e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,r=this.loop,n=this.time+e,s=this._loopCount,o=r===cE;if(e===0)return s===-1?n:o&&(s&1)===1?t-n:n;if(r===aE){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),n>=t||n<0){let a=Math.floor(n/t);n-=t*a,s+=Math.abs(a);let l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){let c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=n;if(o&&(s&1)===1)return t-n}return n}_setEndings(e,t,r){let n=this._interpolantSettings;r?(n.endingStart=Aa,n.endingEnd=Aa):(e?n.endingStart=this.zeroSlopeAtStart?Aa:Ma:n.endingStart=hf,t?n.endingEnd=this.zeroSlopeAtEnd?Aa:Ma:n.endingEnd=hf)}_scheduleFading(e,t,r){let n=this._mixer,s=n.time,o=this._weightInterpolant;o===null&&(o=n._lendControlInterpolant(),this._weightInterpolant=o);let a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}},Wg=class extends jt{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){let r=e._localRoot||this._root,n=e._clip.tracks,s=n.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName,u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){let f=n[h],d=f.name,p=u[d];if(p!==void 0)++p.referenceCount,o[h]=p;else{if(p=o[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,d));continue}let m=t&&t._propertyBindings[h].binding.parsedPath;p=new Gg(xt.create(r,d,m),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,d),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){let r=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,r)}let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,r){let n=this._actions,s=this._actionsByClip,o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{let a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=n.length,n.push(e),o.actionByRoot[r]=e}_removeInactiveAction(e){let t=this._actions,r=t[t.length-1],n=e._cacheIndex;r._cacheIndex=n,t[n]=r,t.pop(),e._cacheIndex=null;let s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;let h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let r=0,n=t.length;r!==n;++r){let s=t[r];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){let t=this._actions,r=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackAction(e){let t=this._actions,r=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_addInactiveBinding(e,t,r){let n=this._bindingsByRootAndName,s=this._bindings,o=n[t];o===void 0&&(o={},n[t]=o),o[r]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){let t=this._bindings,r=e.binding,n=r.rootNode.uuid,s=r.path,o=this._bindingsByRootAndName,a=o[n],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[n]}_lendBinding(e){let t=this._bindings,r=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_takeBackBinding(e){let t=this._bindings,r=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=r,t[r]=s}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,r=e[t];return r===void 0&&(r=new Bf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),r.__cacheIndex=t,e[t]=r),r}_takeBackControlInterpolant(e){let t=this._controlInterpolants,r=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=r,t[r]=s}clipAction(e,t,r){let n=t||this._root,s=n.uuid,o=typeof e=="string"?Of.findByName(n,e):e,a=o!==null?o.uuid:e,l=this._actionsByClip[a],c=null;if(r===void 0&&(o!==null?r=o.blendMode:r=Kg),l!==void 0){let h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===r)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Hg(this,o,t,r);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){let r=t||this._root,n=r.uuid,s=typeof e=="string"?Of.findByName(r,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let r=t-1;r>=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;let t=this._actions,r=this._nActiveActions,n=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(n,e,s,o);let a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,r=e.uuid,n=this._actionsByClip,s=n[r];if(s!==void 0){let o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){let c=o[a];this._deactivateAction(c);let u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[r]}}uncacheRoot(e){let t=e.uuid,r=this._actionsByClip;for(let o in r){let a=r[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}let n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(let o in s){let a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){let r=this.existingAction(e,t);r!==null&&(this._deactivateAction(r),this._removeInactiveAction(r))}};Wg.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Ee=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Ee(this.value.clone===void 0?this.value:this.value.clone())}},jg=class extends rs{constructor(e,t,r=1){super(e,t),this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){let t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){let t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}};jg.prototype.isInstancedInterleavedBuffer=!0;var qg=class{constructor(e,t,r,n,s){this.buffer=e,this.type=t,this.itemSize=r,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}};qg.prototype.isGLBufferAttribute=!0;var Wf=class{constructor(e,t,r=0,n=1/0){this.ray=new ii(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Yc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}intersectObject(e,t=!0,r=[]){return Yg(e,this,r,t),r.sort(X0),r}intersectObjects(e,t=!0,r=[]){for(let n=0,s=e.length;n<s;n++)Yg(e[n],this,r,t);return r.sort(X0),r}};function X0(i,e){return i.distance-e.distance}function Yg(i,e,t,r){if(i.layers.test(e.layers)&&i.raycast(e,t),r===!0){let n=i.children;for(let s=0,o=n.length;s<o;s++)Yg(n[s],e,t,!0)}}var hu=class{constructor(e=1,t=0,r=0){return this.radius=e,this.phi=t,this.theta=r,this}set(e,t,r){return this.radius=e,this.phi=t,this.theta=r,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,r){return this.radius=Math.sqrt(e*e+t*t+r*r),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,r),this.phi=Math.acos(yr(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var J0=new N,Ro=class{constructor(e=new N(1/0,1/0),t=new N(-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=J0.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return J0.copy(e).clamp(this.min,this.max).sub(e).length()}intersect(e){return this.min.max(e.min),this.max.min(e.max),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}};Ro.prototype.isBox2=!0;var Q0=new M,nf=new M,Xr=class{constructor(e=new M,t=new M){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Q0.subVectors(e,this.start),nf.subVectors(this.end,this.start);let r=nf.dot(nf),s=nf.dot(Q0)/r;return t&&(s=yr(s,0,1)),s}closestPointToPoint(e,t,r){let n=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(n).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}},K0=new M,jf=class extends ot{constructor(e,t){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new Ie,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){let c=o/l*Math.PI*2,u=a/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}r.setAttribute("position",new Le(n,3));let s=new Ur({fog:!1,toneMapped:!1});this.cone=new oi(r,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();let e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),K0.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(K0),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},As=new M,sf=new _e,Zm=new _e,Xg=class extends oi{constructor(e){let t=Sb(e),r=new Ie,n=[],s=[],o=new xe(0,0,1),a=new xe(0,1,0);for(let c=0;c<t.length;c++){let u=t[c];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}r.setAttribute("position",new Le(n,3)),r.setAttribute("color",new Le(s,3));let l=new Ur({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(r,l),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){let t=this.bones,r=this.geometry,n=r.getAttribute("position");Zm.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(sf.multiplyMatrices(Zm,a.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o,As.x,As.y,As.z),sf.multiplyMatrices(Zm,a.parent.matrixWorld),As.setFromMatrixPosition(sf),n.setXYZ(o+1,As.x,As.y,As.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Sb(i){let e=[];i.isBone===!0&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Sb(i.children[t]));return e}var qf=class extends Gt{constructor(e,t,r){let n=new Do(t,4,2),s=new Un({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.light.updateMatrixWorld(),this.color=r,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}};var Jg=class extends oi{constructor(e=10,t=10,r=4473924,n=8947848){r=new xe(r),n=new xe(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,d=0,p=-a;f<=t;f++,p+=o){l.push(-a,0,p,a,0,p),l.push(p,0,-a,p,0,a);let m=f===s?r:n;m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3,m.toArray(c,d),d+=3}let u=new Ie;u.setAttribute("position",new Le(l,3)),u.setAttribute("color",new Le(c,3));let h=new Ur({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}};var Z0=new M,of=new M,$0=new M,Yf=class extends ot{constructor(e,t,r){super(),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=r,t===void 0&&(t=1);let n=new Ie;n.setAttribute("position",new Le([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new Ur({fog:!1,toneMapped:!1});this.lightPlane=new ns(n,s),this.add(this.lightPlane),n=new Ie,n.setAttribute("position",new Le([0,0,0,0,0,1],3)),this.targetLine=new ns(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){Z0.setFromMatrixPosition(this.light.matrixWorld),of.setFromMatrixPosition(this.light.target.matrixWorld),$0.subVectors(of,Z0),this.lightPlane.lookAt(of),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(of),this.targetLine.scale.z=$0.length()}},af=new M,rr=new zn,Vn=class extends oi{constructor(e){let t=new Ie,r=new Ur({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new xe(16755200),l=new xe(16711680),c=new xe(43775),u=new xe(16777215),h=new xe(3355443);f("n1","n2",a),f("n2","n4",a),f("n4","n3",a),f("n3","n1",a),f("f1","f2",a),f("f2","f4",a),f("f4","f3",a),f("f3","f1",a),f("n1","f1",a),f("n2","f2",a),f("n3","f3",a),f("n4","f4",a),f("p","n1",l),f("p","n2",l),f("p","n3",l),f("p","n4",l),f("u1","u2",c),f("u2","u3",c),f("u3","u1",c),f("c","t",u),f("p","c",h),f("cn1","cn2",h),f("cn3","cn4",h),f("cf1","cf2",h),f("cf3","cf4",h);function f(p,m,g){d(p,g),d(m,g)}function d(p,m){n.push(0,0,0),s.push(m.r,m.g,m.b),o[p]===void 0&&(o[p]=[]),o[p].push(n.length/3-1)}t.setAttribute("position",new Le(n,3)),t.setAttribute("color",new Le(s,3)),super(t,r),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update()}update(){let e=this.geometry,t=this.pointMap,r=1,n=1;rr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),ar("c",t,e,rr,0,0,-1),ar("t",t,e,rr,0,0,1),ar("n1",t,e,rr,-r,-n,-1),ar("n2",t,e,rr,r,-n,-1),ar("n3",t,e,rr,-r,n,-1),ar("n4",t,e,rr,r,n,-1),ar("f1",t,e,rr,-r,-n,1),ar("f2",t,e,rr,r,-n,1),ar("f3",t,e,rr,-r,n,1),ar("f4",t,e,rr,r,n,1),ar("u1",t,e,rr,r*.7,n*1.1,-1),ar("u2",t,e,rr,-r*.7,n*1.1,-1),ar("u3",t,e,rr,0,n*2,-1),ar("cf1",t,e,rr,-r,0,1),ar("cf2",t,e,rr,r,0,1),ar("cf3",t,e,rr,0,-n,1),ar("cf4",t,e,rr,0,n,1),ar("cn1",t,e,rr,-r,0,-1),ar("cn2",t,e,rr,r,0,-1),ar("cn3",t,e,rr,0,-n,-1),ar("cn4",t,e,rr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function ar(i,e,t,r,n,s,o){af.set(n,s,o).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],af.x,af.y,af.z)}}var Bo=class extends oi{constructor(e,t=16776960){let r=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ie;s.setIndex(new Ue(r,1)),s.setAttribute("position",new Le(n,3)),super(s,new Ur({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){let t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}};var Xf=class extends oi{constructor(e=1){let t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new Ie;n.setAttribute("position",new Le(t,3)),n.setAttribute("color",new Le(r,3));let s=new Ur({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,r){let n=new xe,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(r),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},Jf=class{constructor(){this.type="ShapePath",this.color=new xe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Ra,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,n){return this.currentPath.quadraticCurveTo(e,t,r,n),this}bezierCurveTo(e,t,r,n,s,o){return this.currentPath.bezierCurveTo(e,t,r,n,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e,t){function r(y){let w=[];for(let b=0,S=y.length;b<S;b++){let T=y[b],A=new en;A.curves=T.curves,w.push(A)}return w}function n(y,w){let b=w.length,S=!1;for(let T=b-1,A=0;A<b;T=A++){let x=w[T],E=w[A],_=E.x-x.x,C=E.y-x.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(x=w[A],_=-_,E=w[T],C=-C),y.y<x.y||y.y>E.y)continue;if(y.y===x.y){if(y.x===x.x)return!0}else{let P=C*(y.x-x.x)-_*(y.y-x.y);if(P===0)return!0;if(P<0)continue;S=!S}}else{if(y.y!==x.y)continue;if(E.x<=y.x&&y.x<=x.x||x.x<=y.x&&y.x<=E.x)return!0}}return S}let s=ri.isClockWise,o=this.subPaths;if(o.length===0)return[];if(t===!0)return r(o);let a,l,c,u=[];if(o.length===1)return l=o[0],c=new en,c.curves=l.curves,u.push(c),u;let h=!s(o[0].getPoints());h=e?!h:h;let f=[],d=[],p=[],m=0,g;d[m]=void 0,p[m]=[];for(let y=0,w=o.length;y<w;y++)l=o[y],g=l.getPoints(),a=s(g),a=e?!a:a,a?(!h&&d[m]&&m++,d[m]={s:new en,p:g},d[m].s.curves=l.curves,h&&m++,p[m]=[]):p[m].push({h:l,p:g[0]});if(!d[0])return r(o);if(d.length>1){let y=!1,w=0;for(let b=0,S=d.length;b<S;b++)f[b]=[];for(let b=0,S=d.length;b<S;b++){let T=p[b];for(let A=0;A<T.length;A++){let x=T[A],E=!0;for(let _=0;_<d.length;_++)n(x.p,d[_].p)&&(b!==_&&w++,E?(E=!1,f[_].push(x)):y=!0);E&&f[b].push(x)}}w>0&&y===!1&&(p=f)}let v;for(let y=0,w=d.length;y<w;y++){c=d[y].s,u.push(c),v=p[y];for(let b=0,S=v.length;b<S;b++)c.holes.push(v[b].h)}return u}};var Mb=new ArrayBuffer(4),Hz=new Float32Array(Mb),Wz=new Uint32Array(Mb),wi=new Uint32Array(512),Si=new Uint32Array(512);for(let i=0;i<256;++i){let e=i-127;e<-27?(wi[i]=0,wi[i|256]=32768,Si[i]=24,Si[i|256]=24):e<-14?(wi[i]=1024>>-e-14,wi[i|256]=1024>>-e-14|32768,Si[i]=-e-1,Si[i|256]=-e-1):e<=15?(wi[i]=e+15<<10,wi[i|256]=e+15<<10|32768,Si[i]=13,Si[i|256]=13):e<128?(wi[i]=31744,wi[i|256]=64512,Si[i]=24,Si[i|256]=24):(wi[i]=31744,wi[i|256]=64512,Si[i]=13,Si[i|256]=13)}var Ab=new Uint32Array(2048),fu=new Uint32Array(64),QP=new Uint32Array(64);for(let i=1;i<1024;++i){let e=i<<13,t=0;for(;(e&8388608)===0;)e<<=1,t-=8388608;e&=-8388609,t+=947912704,Ab[i]=e|t}for(let i=1024;i<2048;++i)Ab[i]=939524096+(i-1024<<13);for(let i=1;i<31;++i)fu[i]=i<<23;fu[31]=1199570944;fu[32]=2147483648;for(let i=33;i<63;++i)fu[i]=2147483648+(i-32<<23);fu[63]=3347054592;for(let i=1;i<64;++i)i!==32&&(QP[i]=1024);gn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(gn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Ra.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Jg.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Xg.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};an.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Rg.extractUrlBase(i)};an.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Ro.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};Ro.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Ro.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Ro.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};Qt.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Qt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Qt.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Qt.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Qt.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};pn.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")};Yr.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Pa.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};Xr.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Nt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Nt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Nt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Nt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Nt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};_e.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};_e.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};_e.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new M().setFromMatrixColumn(this,3)};_e.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};_e.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};_e.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};_e.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};_e.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};_e.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};_e.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};_e.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};_e.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};_e.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};_e.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};_e.prototype.makeFrustum=function(i,e,t,r,n,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(i,e,r,t,n,s)};_e.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Fr.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ut.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ut.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};ii.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};ii.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};ii.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};Jt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Jt.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};Jt.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};Jt.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};Jt.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};Jt.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Jt.getBarycoord(i,e,t,r,n)};Jt.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Jt.getNormal(i,e,t,r)};en.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};en.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Os(this,i)};en.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Lo(this,i)};N.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};N.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};N.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};M.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};M.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};M.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};M.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};M.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};M.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};M.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};M.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};M.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ke.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Ke.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};ot.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};ot.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};ot.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};ot.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};ot.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(ot.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(i){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=i}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Gt.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(Gt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),ob},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});xf.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};nr.prototype.setLens=function(i,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(i)};Object.defineProperties(yn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(i){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=i}},shadowCameraLeft:{set:function(i){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=i}},shadowCameraRight:{set:function(i){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=i}},shadowCameraTop:{set:function(i){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=i}},shadowCameraBottom:{set:function(i){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=i}},shadowCameraNear:{set:function(i){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=i}},shadowCameraFar:{set:function(i){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=i}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(i){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=i}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(i){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=i}},shadowMapHeight:{set:function(i){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=i}}});Object.defineProperties(Ue.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===ff},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(ff)}}});Ue.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};Ue.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Ue.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Ie.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};Ie.prototype.addAttribute=function(i,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(i,new Ue(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};Ie.prototype.addDrawCall=function(i,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(i,e)};Ie.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};Ie.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};Ie.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};Ie.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ie.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});rs.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?ff:Hc),this};rs.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};Os.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};Os.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};Os.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};nn.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Ee.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(cr.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new xe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(i){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=i===tb}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(i){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=i}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}});Object.defineProperties(St.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(i){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=i}}});Ct.prototype.clearTarget=function(i,e,t,r){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(i),this.clear(e,t,r)};Ct.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};Ct.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};Ct.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};Ct.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};Ct.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};Ct.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};Ct.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};Ct.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};Ct.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};Ct.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};Ct.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};Ct.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};Ct.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};Ct.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};Ct.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};Ct.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};Ct.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};Ct.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};Ct.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};Ct.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};Ct.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};Ct.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};Ct.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};Ct.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(Ct.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=i}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(i){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=i}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(i){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=i===!0?je:dn}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});Object.defineProperties(gb.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(mt.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=i}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(i){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=i}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=i}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(i){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=i}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(i){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=i}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(i){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=i}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(i){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=i}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(i){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=i}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(i){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=i}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(i){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=i}}});Ug.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new Ng().load(i,function(r){e.setBuffer(r)}),this};zg.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Xc.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Xc.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};es.crossOrigin=void 0;es.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new Dg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new Lg;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};es.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};es.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};var Qf=class extends mt{constructor(e,t,r){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(e,t,r),this.samples=4}};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:No}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=No);var qa=".",du=Symbol("target"),ny=Symbol("unsubscribe");function pu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function Tb(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var _n=Array.isArray;function Oo(i){return typeof i=="symbol"}var KP={after:(i,e)=>_n(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>_n(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=qa),Oo(e)?i+e.toString():i+e):i,initial:i=>{if(_n(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(qa);return e===-1?"":i.slice(0,e)},last:i=>{if(_n(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(qa);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(_n(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(qa);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(qa,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},ln=KP;function iy(i){return typeof i=="object"&&typeof i.next=="function"}function sy(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[du].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function ed(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&Oo(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var mu=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,ln.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function Ya(i){return toString.call(i)==="[object Object]"}function Xa(){return!0}function Vs(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var td=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var ZP=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),oy={push:Xa,pop:Xa,shift:Xa,unshift:Xa,copyWithin:Vs,reverse:Vs,sort:Vs,splice:Vs,flat:Vs,fill:Vs},Eb=new Set([...td,...ZP,...Object.keys(oy)]);function Ja(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var ay=["keys","values","entries"],ly=new Set(["has","toString"]),cy={add:Ja,clear:Ja,delete:Ja,forEach:Ja},_b=new Set([...ly,...Object.keys(cy),...ay]);function Qa(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var $P=new Set([...ly,"get"]),uy={set:Qa,clear:Qa,delete:Qa,forEach:Qa},Cb=new Set([...$P,...Object.keys(uy),...ay]);var Dr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return td.has(e)}_shallowClone(e){let t=e;if(Ya(e))t=se({},e);else if(_n(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(_n(n)?this._onIsChanged=oy[t]:n instanceof Set?this._onIsChanged=cy[t]:n instanceof Map&&(this._onIsChanged=uy[t]),n):r}update(e,t,r){let n=ln.after(e,this._path);if(t!=="length"){let s=this.clone;ln.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],ln.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var Ka=class extends Dr{static isHandledMethod(e){return Eb.has(e)}};var gu=class extends Dr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var Za=class extends Dr{static isHandledMethod(e){return _b.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var $a=class extends Dr{static isHandledMethod(e){return Cb.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var yu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var vu=class extends Dr{constructor(e,t,r,n){super(void 0,t,r,n),this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var li=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return Ya(e)||_n(e)||pu(e)}static isHandledMethod(e,t){return Ya(e)?Dr.isHandledMethod(t):_n(e)?Ka.isHandledMethod(t):e instanceof Set?Za.isHandledMethod(t):e instanceof Map?$a.isHandledMethod(t):pu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Dr;_n(e)?n=Ka:e instanceof Date?n=gu:e instanceof Set?n=Za:e instanceof Map?n=$a:e instanceof WeakSet?n=yu:e instanceof WeakMap&&(n=vu),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=li.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var e2={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},hy=(i,e,t={})=>{t=se(se({},e2),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new mu(n),c=typeof t.onValidate=="function",u=new li(c),h=(y,w,b,S,T)=>!c||u.isCloning||t.onValidate(ln.concat(l.getPath(y),w),b,S,T)===!0,f=(y,w,b,S)=>{!ed(l,t,w)&&!(o&&l.isDetached(y,i))&&d(l.getPath(y),w,b,S)},d=(y,w,b,S,T)=>{u.isCloning?u.update(y,w,S):e(ln.concat(y,w),b,S,T)},p=y=>y&&(y[r]||y),m=(y,w,b,S)=>Tb(y)||b==="constructor"||s&&!li.isHandledMethod(w,b)||ed(l,t,b)||l.isGetInvariant(w,b)||o&&l.isDetached(w,i)?y:(S===void 0&&(S=l.getPath(w)),l.getProxy(y,ln.concat(S,b),g,r)),g={get(y,w,b){if(Oo(w)){if(w===r||w===du)return y;if(w===ny&&!l.isUnsubscribed&&l.getPath(y).length===0)return l.unsubscribe(),y}let S=pu(y)?Reflect.get(y,w):Reflect.get(y,w,b);return m(S,y,w)},set(y,w,b,S){b=p(b);let T=y[r]||y,A=T[w];if(n(A,b)&&w in y)return!0;let x=h(y,w,b,A);return x&&l.setProperty(T,w,b,S,A)?(f(y,w,y[w],A),!0):!x},defineProperty(y,w,b){if(!l.isSameDescriptor(b,y,w)){let S=y[w];h(y,w,b.value,S)&&l.defineProperty(y,w,b,S)&&f(y,w,b.value,S)}return!0},deleteProperty(y,w){if(!Reflect.has(y,w))return!0;let b=Reflect.get(y,w),S=h(y,w,void 0,b);return S&&l.deleteProperty(y,w,b)?(f(y,w,void 0,b),!0):!S},apply(y,w,b){let S=w[r]||w;if(l.isUnsubscribed)return Reflect.apply(y,S,b);if((a===!1||a!==!0&&!a.includes(y.name))&&li.isHandledType(S)){let T=ln.initial(l.getPath(y)),A=li.isHandledMethod(S,y.name);u.start(S,T,b);let x=Reflect.apply(y,u.preferredThisArg(y,w,S),A?b.map(C=>p(C)):b),E=u.isChanged(S,n),_=u.stop();if(li.isHandledType(x)&&A&&(w instanceof Map&&y.name==="get"&&(T=ln.concat(T,b[0])),x=l.getProxy(x,T,g)),E){let C={name:y.name,args:b,result:x},P=u.isCloning?ln.initial(T):T,B=u.isCloning?ln.last(T):"";h(ln.get(i,P),B,S,_,C)?d(P,B,S,_,C):u.undo(S)}return(w instanceof Map||w instanceof Set)&&iy(x)?sy(x,y,w,T,m):x}return Reflect.apply(y,w,b)}},v=l.getProxy(i,t.pathAsArray?[]:"",g);return e=e.bind(v),c&&(t.onValidate=t.onValidate.bind(v)),v};hy.target=i=>i&&i[du]||i;hy.unsubscribe=i=>i[ny]||i;var fy=hy;var t2=typeof global=="object"&&global&&global.Object===Object&&global,rd=t2;var r2=typeof self=="object"&&self&&self.Object===Object&&self,n2=rd||r2||Function("return this")(),sr=n2;var i2=sr.Symbol,cn=i2;var Lb=Object.prototype,s2=Lb.hasOwnProperty,o2=Lb.toString,xu=cn?cn.toStringTag:void 0;function a2(i){var e=s2.call(i,xu),t=i[xu];try{i[xu]=void 0;var r=!0}catch{}var n=o2.call(i);return r&&(e?i[xu]=t:delete i[xu]),n}var Db=a2;var l2=Object.prototype,c2=l2.toString;function u2(i){return c2.call(i)}var Pb=u2;var h2="[object Null]",f2="[object Undefined]",Ib=cn?cn.toStringTag:void 0;function d2(i){return i==null?i===void 0?f2:h2:Ib&&Ib in Object(i)?Db(i):Pb(i)}var Cn=d2;function p2(i){return i!=null&&typeof i=="object"}var Jr=p2;var m2="[object Symbol]";function g2(i){return typeof i=="symbol"||Jr(i)&&Cn(i)==m2}var Hs=g2;function y2(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var nd=y2;var v2=Array.isArray,zr=v2;var x2=1/0,Rb=cn?cn.prototype:void 0,Bb=Rb?Rb.toString:void 0;function Nb(i){if(typeof i=="string")return i;if(zr(i))return nd(i,Nb)+"";if(Hs(i))return Bb?Bb.call(i):"";var e=i+"";return e=="0"&&1/i==-x2?"-0":e}var Ob=Nb;var b2=/\s/;function w2(i){for(var e=i.length;e--&&b2.test(i.charAt(e)););return e}var Fb=w2;var S2=/^\s+/;function M2(i){return i&&i.slice(0,Fb(i)+1).replace(S2,"")}var Ub=M2;function A2(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var ur=A2;var zb=0/0,T2=/^[-+]0x[0-9a-f]+$/i,E2=/^0b[01]+$/i,_2=/^0o[0-7]+$/i,C2=parseInt;function L2(i){if(typeof i=="number")return i;if(Hs(i))return zb;if(ur(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=ur(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Ub(i);var t=E2.test(i);return t||_2.test(i)?C2(i.slice(2),t?2:8):T2.test(i)?zb:+i}var dy=L2;function D2(i){return i}var id=D2;var P2="[object AsyncFunction]",I2="[object Function]",R2="[object GeneratorFunction]",B2="[object Proxy]";function N2(i){if(!ur(i))return!1;var e=Cn(i);return e==I2||e==R2||e==P2||e==B2}var el=N2;var O2=sr["__core-js_shared__"],sd=O2;var Gb=function(){var i=/[^.]+$/.exec(sd&&sd.keys&&sd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function F2(i){return!!Gb&&Gb in i}var kb=F2;var U2=Function.prototype,z2=U2.toString;function G2(i){if(i!=null){try{return z2.call(i)}catch{}try{return i+""}catch{}}return""}var ss=G2;var k2=/[\\^$.*+?()[\]{}|]/g,V2=/^\[object .+?Constructor\]$/,H2=Function.prototype,W2=Object.prototype,j2=H2.toString,q2=W2.hasOwnProperty,Y2=RegExp("^"+j2.call(q2).replace(k2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X2(i){if(!ur(i)||kb(i))return!1;var e=el(i)?Y2:V2;return e.test(ss(i))}var Vb=X2;function J2(i,e){return i==null?void 0:i[e]}var Hb=J2;function Q2(i,e){var t=Hb(i,e);return Vb(t)?t:void 0}var vn=Q2;var K2=vn(sr,"WeakMap"),od=K2;var Wb=Object.create,Z2=function(){function i(){}return function(e){if(!ur(e))return{};if(Wb)return Wb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),jb=Z2;function $2(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var qb=$2;function eI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var ad=eI;var tI=800,rI=16,nI=Date.now;function iI(i){var e=0,t=0;return function(){var r=nI(),n=rI-(r-t);if(t=r,n>0){if(++e>=tI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Yb=iI;function sI(i){return function(){return i}}var Xb=sI;var oI=function(){try{var i=vn(Object,"defineProperty");return i({},"",{}),i}catch{}}(),tl=oI;var aI=tl?function(i,e){return tl(i,"toString",{configurable:!0,enumerable:!1,value:Xb(e),writable:!0})}:id,Jb=aI;var lI=Yb(Jb),ld=lI;function cI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var Qb=cI;var uI=9007199254740991,hI=/^(?:0|[1-9]\d*)$/;function fI(i,e){var t=typeof i;return e=e==null?uI:e,!!e&&(t=="number"||t!="symbol"&&hI.test(i))&&i>-1&&i%1==0&&i<e}var cd=fI;function dI(i,e,t){e=="__proto__"&&tl?tl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var rl=dI;function pI(i,e){return i===e||i!==i&&e!==e}var Ws=pI;var mI=Object.prototype,gI=mI.hasOwnProperty;function yI(i,e,t){var r=i[e];(!(gI.call(i,e)&&Ws(r,t))||t===void 0&&!(e in i))&&rl(i,e,t)}var ud=yI;function vI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,o=e.length;++s<o;){var a=e[s],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),n?rl(t,a,l):ud(t,a,l)}return t}var Hn=vI;var Kb=Math.max;function xI(i,e,t){return e=Kb(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Kb(r.length-e,0),o=Array(s);++n<s;)o[n]=r[e+n];n=-1;for(var a=Array(e+1);++n<e;)a[n]=r[n];return a[e]=t(o),qb(i,this,a)}}var hd=xI;function bI(i,e){return ld(hd(i,e,id),i+"")}var Zb=bI;var wI=9007199254740991;function SI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=wI}var fd=SI;function MI(i){return i!=null&&fd(i.length)&&!el(i)}var js=MI;function AI(i,e,t){if(!ur(t))return!1;var r=typeof e;return(r=="number"?js(t)&&cd(e,t.length):r=="string"&&e in t)?Ws(t[e],i):!1}var $b=AI;function TI(i){return Zb(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,o&&$b(t[0],t[1],o)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var a=t[r];a&&i(e,a,r,s)}return e})}var ew=TI;var EI=Object.prototype;function _I(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||EI;return i===t}var nl=_I;function CI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var tw=CI;var LI="[object Arguments]";function DI(i){return Jr(i)&&Cn(i)==LI}var py=DI;var rw=Object.prototype,PI=rw.hasOwnProperty,II=rw.propertyIsEnumerable,RI=py(function(){return arguments}())?py:function(i){return Jr(i)&&PI.call(i,"callee")&&!II.call(i,"callee")},Fo=RI;function BI(){return!1}var nw=BI;var ow=typeof exports=="object"&&exports&&!exports.nodeType&&exports,iw=ow&&typeof module=="object"&&module&&!module.nodeType&&module,NI=iw&&iw.exports===ow,sw=NI?sr.Buffer:void 0,OI=sw?sw.isBuffer:void 0,FI=OI||nw,il=FI;var UI="[object Arguments]",zI="[object Array]",GI="[object Boolean]",kI="[object Date]",VI="[object Error]",HI="[object Function]",WI="[object Map]",jI="[object Number]",qI="[object Object]",YI="[object RegExp]",XI="[object Set]",JI="[object String]",QI="[object WeakMap]",KI="[object ArrayBuffer]",ZI="[object DataView]",$I="[object Float32Array]",eR="[object Float64Array]",tR="[object Int8Array]",rR="[object Int16Array]",nR="[object Int32Array]",iR="[object Uint8Array]",sR="[object Uint8ClampedArray]",oR="[object Uint16Array]",aR="[object Uint32Array]",qt={};qt[$I]=qt[eR]=qt[tR]=qt[rR]=qt[nR]=qt[iR]=qt[sR]=qt[oR]=qt[aR]=!0;qt[UI]=qt[zI]=qt[KI]=qt[GI]=qt[ZI]=qt[kI]=qt[VI]=qt[HI]=qt[WI]=qt[jI]=qt[qI]=qt[YI]=qt[XI]=qt[JI]=qt[QI]=!1;function lR(i){return Jr(i)&&fd(i.length)&&!!qt[Cn(i)]}var aw=lR;function cR(i){return function(e){return i(e)}}var sl=cR;var lw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bu=lw&&typeof module=="object"&&module&&!module.nodeType&&module,uR=bu&&bu.exports===lw,my=uR&&rd.process,hR=function(){try{var i=bu&&bu.require&&bu.require("util").types;return i||my&&my.binding&&my.binding("util")}catch{}}(),os=hR;var cw=os&&os.isTypedArray,fR=cw?sl(cw):aw,dd=fR;var dR=Object.prototype,pR=dR.hasOwnProperty;function mR(i,e){var t=zr(i),r=!t&&Fo(i),n=!t&&!r&&il(i),s=!t&&!r&&!n&&dd(i),o=t||r||n||s,a=o?tw(i.length,String):[],l=a.length;for(var c in i)(e||pR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||cd(c,l)))&&a.push(c);return a}var pd=mR;function gR(i,e){return function(t){return i(e(t))}}var md=gR;var yR=md(Object.keys,Object),uw=yR;var vR=Object.prototype,xR=vR.hasOwnProperty;function bR(i){if(!nl(i))return uw(i);var e=[];for(var t in Object(i))xR.call(i,t)&&t!="constructor"&&e.push(t);return e}var hw=bR;function wR(i){return js(i)?pd(i):hw(i)}var ol=wR;function SR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var fw=SR;var MR=Object.prototype,AR=MR.hasOwnProperty;function TR(i){if(!ur(i))return fw(i);var e=nl(i),t=[];for(var r in i)r=="constructor"&&(e||!AR.call(i,r))||t.push(r);return t}var dw=TR;function ER(i){return js(i)?pd(i,!0):dw(i)}var Ei=ER;var _R=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,CR=/^\w*$/;function LR(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Hs(i)?!0:CR.test(i)||!_R.test(i)||e!=null&&i in Object(e)}var pw=LR;var DR=vn(Object,"create"),as=DR;function PR(){this.__data__=as?as(null):{},this.size=0}var mw=PR;function IR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var gw=IR;var RR="__lodash_hash_undefined__",BR=Object.prototype,NR=BR.hasOwnProperty;function OR(i){var e=this.__data__;if(as){var t=e[i];return t===RR?void 0:t}return NR.call(e,i)?e[i]:void 0}var yw=OR;var FR=Object.prototype,UR=FR.hasOwnProperty;function zR(i){var e=this.__data__;return as?e[i]!==void 0:UR.call(e,i)}var vw=zR;var GR="__lodash_hash_undefined__";function kR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=as&&e===void 0?GR:e,this}var xw=kR;function al(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}al.prototype.clear=mw;al.prototype.delete=gw;al.prototype.get=yw;al.prototype.has=vw;al.prototype.set=xw;var gy=al;function VR(){this.__data__=[],this.size=0}var bw=VR;function HR(i,e){for(var t=i.length;t--;)if(Ws(i[t][0],e))return t;return-1}var qs=HR;var WR=Array.prototype,jR=WR.splice;function qR(i){var e=this.__data__,t=qs(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():jR.call(e,t,1),--this.size,!0}var ww=qR;function YR(i){var e=this.__data__,t=qs(e,i);return t<0?void 0:e[t][1]}var Sw=YR;function XR(i){return qs(this.__data__,i)>-1}var Mw=XR;function JR(i,e){var t=this.__data__,r=qs(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Aw=JR;function ll(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ll.prototype.clear=bw;ll.prototype.delete=ww;ll.prototype.get=Sw;ll.prototype.has=Mw;ll.prototype.set=Aw;var Ys=ll;var QR=vn(sr,"Map"),Xs=QR;function KR(){this.size=0,this.__data__={hash:new gy,map:new(Xs||Ys),string:new gy}}var Tw=KR;function ZR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Ew=ZR;function $R(i,e){var t=i.__data__;return Ew(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Js=$R;function eB(i){var e=Js(this,i).delete(i);return this.size-=e?1:0,e}var _w=eB;function tB(i){return Js(this,i).get(i)}var Cw=tB;function rB(i){return Js(this,i).has(i)}var Lw=rB;function nB(i,e){var t=Js(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Dw=nB;function cl(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}cl.prototype.clear=Tw;cl.prototype.delete=_w;cl.prototype.get=Cw;cl.prototype.has=Lw;cl.prototype.set=Dw;var wu=cl;var iB="Expected a function";function yy(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(iB);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var o=i.apply(this,r);return t.cache=s.set(n,o)||s,o};return t.cache=new(yy.Cache||wu),t}yy.Cache=wu;var Pw=yy;var sB=500;function oB(i){var e=Pw(i,function(r){return t.size===sB&&t.clear(),r}),t=e.cache;return e}var Iw=oB;var aB=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,lB=/\\(\\)?/g,cB=Iw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(aB,function(t,r,n,s){e.push(n?s.replace(lB,"$1"):r||t)}),e}),Rw=cB;function uB(i){return i==null?"":Ob(i)}var Bw=uB;function hB(i,e){return zr(i)?i:pw(i,e)?[i]:Rw(Bw(i))}var ul=hB;var fB=1/0;function dB(i){if(typeof i=="string"||Hs(i))return i;var e=i+"";return e=="0"&&1/i==-fB?"-0":e}var gd=dB;function pB(i,e){e=ul(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[gd(e[t++])];return t&&t==r?i:void 0}var Nw=pB;function mB(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var hl=mB;var Ow=cn?cn.isConcatSpreadable:void 0;function gB(i){return zr(i)||Fo(i)||!!(Ow&&i&&i[Ow])}var Fw=gB;function Uw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Fw),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Uw(a,e-1,t,r,n):hl(n,a):r||(n[n.length]=a)}return n}var zw=Uw;function yB(i){var e=i==null?0:i.length;return e?zw(i,1):[]}var Gw=yB;function vB(i){return ld(hd(i,void 0,Gw),i+"")}var kw=vB;var xB=md(Object.getPrototypeOf,Object),fl=xB;var bB="[object Object]",wB=Function.prototype,SB=Object.prototype,Vw=wB.toString,MB=SB.hasOwnProperty,AB=Vw.call(Object);function TB(i){if(!Jr(i)||Cn(i)!=bB)return!1;var e=fl(i);if(e===null)return!0;var t=MB.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Vw.call(t)==AB}var yd=TB;function EB(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var Hw=EB;function _B(){this.__data__=new Ys,this.size=0}var Ww=_B;function CB(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var jw=CB;function LB(i){return this.__data__.get(i)}var qw=LB;function DB(i){return this.__data__.has(i)}var Yw=DB;var PB=200;function IB(i,e){var t=this.__data__;if(t instanceof Ys){var r=t.__data__;if(!Xs||r.length<PB-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new wu(r)}return t.set(i,e),this.size=t.size,this}var Xw=IB;function dl(i){var e=this.__data__=new Ys(i);this.size=e.size}dl.prototype.clear=Ww;dl.prototype.delete=jw;dl.prototype.get=qw;dl.prototype.has=Yw;dl.prototype.set=Xw;var vd=dl;function RB(i,e){return i&&Hn(e,ol(e),i)}var Jw=RB;function BB(i,e){return i&&Hn(e,Ei(e),i)}var Qw=BB;var eS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kw=eS&&typeof module=="object"&&module&&!module.nodeType&&module,NB=Kw&&Kw.exports===eS,Zw=NB?sr.Buffer:void 0,$w=Zw?Zw.allocUnsafe:void 0;function OB(i,e){if(e)return i.slice();var t=i.length,r=$w?$w(t):new i.constructor(t);return i.copy(r),r}var xd=OB;function FB(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var o=i[t];e(o,t,i)&&(s[n++]=o)}return s}var tS=FB;function UB(){return[]}var bd=UB;var zB=Object.prototype,GB=zB.propertyIsEnumerable,rS=Object.getOwnPropertySymbols,kB=rS?function(i){return i==null?[]:(i=Object(i),tS(rS(i),function(e){return GB.call(i,e)}))}:bd,pl=kB;function VB(i,e){return Hn(i,pl(i),e)}var nS=VB;var HB=Object.getOwnPropertySymbols,WB=HB?function(i){for(var e=[];i;)hl(e,pl(i)),i=fl(i);return e}:bd,wd=WB;function jB(i,e){return Hn(i,wd(i),e)}var iS=jB;function qB(i,e,t){var r=e(i);return zr(i)?r:hl(r,t(i))}var Sd=qB;function YB(i){return Sd(i,ol,pl)}var sS=YB;function XB(i){return Sd(i,Ei,wd)}var Md=XB;var JB=vn(sr,"DataView"),Ad=JB;var QB=vn(sr,"Promise"),Td=QB;var KB=vn(sr,"Set"),Ed=KB;var oS="[object Map]",ZB="[object Object]",aS="[object Promise]",lS="[object Set]",cS="[object WeakMap]",uS="[object DataView]",$B=ss(Ad),eN=ss(Xs),tN=ss(Td),rN=ss(Ed),nN=ss(od),Uo=Cn;(Ad&&Uo(new Ad(new ArrayBuffer(1)))!=uS||Xs&&Uo(new Xs)!=oS||Td&&Uo(Td.resolve())!=aS||Ed&&Uo(new Ed)!=lS||od&&Uo(new od)!=cS)&&(Uo=function(i){var e=Cn(i),t=e==ZB?i.constructor:void 0,r=t?ss(t):"";if(r)switch(r){case $B:return uS;case eN:return oS;case tN:return aS;case rN:return lS;case nN:return cS}return e});var ml=Uo;var iN=Object.prototype,sN=iN.hasOwnProperty;function oN(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&sN.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var hS=oN;var aN=sr.Uint8Array,vy=aN;function lN(i){var e=new i.constructor(i.byteLength);return new vy(e).set(new vy(i)),e}var gl=lN;function cN(i,e){var t=e?gl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var fS=cN;var uN=/\w*$/;function hN(i){var e=new i.constructor(i.source,uN.exec(i));return e.lastIndex=i.lastIndex,e}var dS=hN;var pS=cn?cn.prototype:void 0,mS=pS?pS.valueOf:void 0;function fN(i){return mS?Object(mS.call(i)):{}}var gS=fN;function dN(i,e){var t=e?gl(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var _d=dN;var pN="[object Boolean]",mN="[object Date]",gN="[object Map]",yN="[object Number]",vN="[object RegExp]",xN="[object Set]",bN="[object String]",wN="[object Symbol]",SN="[object ArrayBuffer]",MN="[object DataView]",AN="[object Float32Array]",TN="[object Float64Array]",EN="[object Int8Array]",_N="[object Int16Array]",CN="[object Int32Array]",LN="[object Uint8Array]",DN="[object Uint8ClampedArray]",PN="[object Uint16Array]",IN="[object Uint32Array]";function RN(i,e,t){var r=i.constructor;switch(e){case SN:return gl(i);case pN:case mN:return new r(+i);case MN:return fS(i,t);case AN:case TN:case EN:case _N:case CN:case LN:case DN:case PN:case IN:return _d(i,t);case gN:return new r;case yN:case bN:return new r(i);case vN:return dS(i);case xN:return new r;case wN:return gS(i)}}var yS=RN;function BN(i){return typeof i.constructor=="function"&&!nl(i)?jb(fl(i)):{}}var Cd=BN;var NN="[object Map]";function ON(i){return Jr(i)&&ml(i)==NN}var vS=ON;var xS=os&&os.isMap,FN=xS?sl(xS):vS,bS=FN;var UN="[object Set]";function zN(i){return Jr(i)&&ml(i)==UN}var wS=zN;var SS=os&&os.isSet,GN=SS?sl(SS):wS,MS=GN;var kN=1,VN=2,HN=4,AS="[object Arguments]",WN="[object Array]",jN="[object Boolean]",qN="[object Date]",YN="[object Error]",TS="[object Function]",XN="[object GeneratorFunction]",JN="[object Map]",QN="[object Number]",ES="[object Object]",KN="[object RegExp]",ZN="[object Set]",$N="[object String]",e3="[object Symbol]",t3="[object WeakMap]",r3="[object ArrayBuffer]",n3="[object DataView]",i3="[object Float32Array]",s3="[object Float64Array]",o3="[object Int8Array]",a3="[object Int16Array]",l3="[object Int32Array]",c3="[object Uint8Array]",u3="[object Uint8ClampedArray]",h3="[object Uint16Array]",f3="[object Uint32Array]",Vt={};Vt[AS]=Vt[WN]=Vt[r3]=Vt[n3]=Vt[jN]=Vt[qN]=Vt[i3]=Vt[s3]=Vt[o3]=Vt[a3]=Vt[l3]=Vt[JN]=Vt[QN]=Vt[ES]=Vt[KN]=Vt[ZN]=Vt[$N]=Vt[e3]=Vt[c3]=Vt[u3]=Vt[h3]=Vt[f3]=!0;Vt[YN]=Vt[TS]=Vt[t3]=!1;function Ld(i,e,t,r,n,s){var o,a=e&kN,l=e&VN,c=e&HN;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!ur(i))return i;var u=zr(i);if(u){if(o=hS(i),!a)return ad(i,o)}else{var h=ml(i),f=h==TS||h==XN;if(il(i))return xd(i,a);if(h==ES||h==AS||f&&!n){if(o=l||f?{}:Cd(i),!a)return l?iS(i,Qw(o,i)):nS(i,Jw(o,i))}else{if(!Vt[h])return n?i:{};o=yS(i,h,a)}}s||(s=new vd);var d=s.get(i);if(d)return d;s.set(i,o),MS(i)?i.forEach(function(g){o.add(Ld(g,e,t,g,i,s))}):bS(i)&&i.forEach(function(g,v){o.set(v,Ld(g,e,t,v,i,s))});var p=c?l?Md:sS:l?Ei:ol,m=u?void 0:p(i);return Qb(m||i,function(g,v){m&&(v=g,g=i[v]),ud(o,v,Ld(g,e,t,v,i,s))}),o}var Dd=Ld;var d3=1,p3=4;function m3(i){return Dd(i,d3|p3)}var Su=m3;function g3(i){return function(e,t,r){for(var n=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[i?a:++n];if(t(s[l],l,s)===!1)break}return e}}var _S=g3;var y3=_S(),CS=y3;var v3=function(){return sr.Date.now()},Pd=v3;var x3="Expected a function",b3=Math.max,w3=Math.min;function S3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,h=!1,f=!0;if(typeof i!="function")throw new TypeError(x3);e=dy(e)||0,ur(t)&&(u=!!t.leading,h="maxWait"in t,s=h?b3(dy(t.maxWait)||0,e):s,f="trailing"in t?!!t.trailing:f);function d(T){var A=r,x=n;return r=n=void 0,c=T,o=i.apply(x,A),o}function p(T){return c=T,a=setTimeout(v,e),u?d(T):o}function m(T){var A=T-l,x=T-c,E=e-A;return h?w3(E,s-x):E}function g(T){var A=T-l,x=T-c;return l===void 0||A>=e||A<0||h&&x>=s}function v(){var T=Pd();if(g(T))return y(T);a=setTimeout(v,m(T))}function y(T){return a=void 0,f&&r?d(T):(r=n=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:y(Pd())}function S(){var T=Pd(),A=g(T);if(r=arguments,n=this,l=T,A){if(a===void 0)return p(l);if(h)return clearTimeout(a),a=setTimeout(v,e),d(l)}return a===void 0&&(a=setTimeout(v,e)),o}return S.cancel=w,S.flush=b,S}var Mu=S3;function M3(i,e,t){(t!==void 0&&!Ws(i[e],t)||t===void 0&&!(e in i))&&rl(i,e,t)}var Au=M3;function A3(i){return Jr(i)&&js(i)}var LS=A3;function T3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Tu=T3;function E3(i){return Hn(i,Ei(i))}var DS=E3;function _3(i,e,t,r,n,s,o){var a=Tu(i,t),l=Tu(e,t),c=o.get(l);if(c){Au(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,h=u===void 0;if(h){var f=zr(l),d=!f&&il(l),p=!f&&!d&&dd(l);u=l,f||d||p?zr(a)?u=a:LS(a)?u=ad(a):d?(h=!1,u=xd(l,!0)):p?(h=!1,u=_d(l,!0)):u=[]:yd(l)||Fo(l)?(u=a,Fo(a)?u=DS(a):(!ur(a)||el(a))&&(u=Cd(l))):h=!1}h&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Au(i,t,u)}var PS=_3;function IS(i,e,t,r,n){i!==e&&CS(e,function(s,o){if(n||(n=new vd),ur(s))PS(i,e,o,t,IS,r,n);else{var a=r?r(Tu(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Au(i,o,a)}},Ei)}var RS=IS;function C3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var BS=C3;function L3(i,e){return e.length<2?i:Nw(i,Hw(e,0,-1))}var NS=L3;var D3=ew(function(i,e,t){RS(i,e,t)}),zo=D3;function P3(i,e){return e=ul(e,i),i=NS(i,e),i==null||delete i[gd(BS(e))]}var OS=P3;function I3(i){return yd(i)?void 0:i}var FS=I3;var R3=1,B3=2,N3=4,O3=kw(function(i,e){var t={};if(i==null)return t;var r=!1;e=nd(e,function(s){return s=ul(s,i),r||(r=s.length>1),s}),Hn(i,Md(i),t),r&&(t=Dd(t,R3|B3|N3,FS));for(var n=e.length;n--;)OS(t,e[n]);return t}),yl=O3;var F3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),U3=()=>typeof window>"u"?!1:window.navigator.platform.toUpperCase().includes("MAC"),z3=()=>typeof window>"u"?!1:/iPad|iPhone|iPod/.test(window.navigator.userAgent)||Eu&&"ontouchend"in document,G3=()=>typeof window>"u"?!1:window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,k3=()=>typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0,V3=()=>{let i=navigator.userAgent,e=navigator.vendor;return/Safari/i.test(i)&&/Apple Computer/.test(e)},Tj=F3(),Eu=U3(),_u=z3(),US=G3(),Id=k3(),zS=V3();function GS(i){return Array.isArray(i)?i:[i]}function Cu(i){return Eu?i.metaKey:i.ctrlKey}var Qs;(t=>{t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(Qs||(Qs={}));var Go;(n=>{n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:1e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-1e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(Go||(Go={}));var ls;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(ls||(ls={}));var vr;(n=>{function i(s,o){return s[0]===o[0]&&s[1]===o[1]&&s[2]===o[2]}n.isEqual=i;function e(s,o){return[s[0]+o[0],s[1]+o[1],s[2]+o[2]]}n.add=e;function t(s,o){return[s[0]-o[0],s[1]-o[1],s[2]-o[2]]}n.sub=t;function r(s,o,a){return[s[0]+(o[0]-s[0])*a,s[1]+(o[1]-s[1])*a,s[2]+(o[2]-s[2])*a]}n.lerp=r})(vr||(vr={}));var Lu;(t=>{function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(Lu||(Lu={}));var _i;(s=>{s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(o,a){for(let l=0;l<16;l++)if(o[l]!==a[l])return!1;return!0}s.isEqual=e;function t(o){return o!=null?o:s.identity}s.simplify=t;function r(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3){let h=1/(o[3]*a[c]+o[7]*a[c+1]+o[11]*a[c+2]+o[15]);l[c]=(o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2]+o[12])*h,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*h,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*h}return l}s.applyMatrix4=r;function n(o,a){let l=a.slice(0);for(var c=0,u=a.length;c<u;c+=3)l[c]=o[0]*a[c]+o[4]*a[c+1]+o[8]*a[c+2],l[c+1]=o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2],l[c+2]=o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2];return l}s.applyMatrix3Components=n})(_i||(_i={}));var Sr;(l=>{l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function n(c){return{r:c.r,g:c.g,b:c.b}}l.clone=n;function s(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=s;function o(c,u){return c.r===u.r&&c.g===u.g&&c.b===u.b}l.equals=o;function a(c,u,h){return{r:c.r+(u.r-c.r)*h,g:c.g+(u.g-c.g)*h,b:c.b+(u.b-c.b)*h}}l.lerp=a})(Sr||(Sr={}));var Ln;(o=>{o.white=be(se({},Sr.white),{a:1});function e(a){return{r:a[0],g:a[1],b:a[2],a:a[3]}}o.from0to1=e;function t(a,l){return be(se({},Sr.fromHex(a)),{a:l})}o.fromHexAndA=t;function r(a){return{r:Math.round(a.r*255),g:Math.round(a.g*255),b:Math.round(a.b*255),a:a.a}}o.toRgb255a1=r;function n(a,l){return Sr.equals(a,l)&&a.a===l.a}o.equals=n;function s(a,l,c){return{r:a.r+(l.r-a.r)*c,g:a.g+(l.g-a.g)*c,b:a.b+(l.b-a.b)*c,a:a.a+(l.a-a.a)*c}}o.lerp=s})(Ln||(Ln={}));var Rd;(e=>e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]})(Rd||(Rd={}));var Bd;(e=>e.defaultData={mass:1,stiffness:80,damping:10,velocity:0})(Bd||(Bd={}));var Nd;(e=>e.defaultData={control1:[.5,.05],control2:[.1,.3]})(Nd||(Nd={}));var Od;(e=>{function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:"y",scale:[1,1,1],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[1,1,1],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(Od||(Od={}));var Wn=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=be(se({},r),{[e]:t});return Object.setPrototypeOf(s,Wn.prototype),s}}add(e,t){var n;let r=this.runOp({type:1,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===1){let r=t[e.id],n;r===void 0?n={type:2,id:e.id}:n={type:1,id:e.id,data:r};let{id:s,data:o}=e,a=be(se({},t),{[s]:o});return Object.setPrototypeOf(a,Wn.prototype),{data:a,actual:e,reverse:n}}else if(e.type===2){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=se({},t);return Object.setPrototypeOf(s,Wn.prototype),delete s[r],{data:s,actual:e,reverse:{type:1,id:r,data:n}}}}throw new Error("illegal arg")}};function Du(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&Du(r)}return Object.freeze(i)}function kS(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var Fd=class extends Error{};function Ci(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let o=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(o)}return r}function VS(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function HS(){return typeof process<"u"}function WS(i,e){for(let t of i)e(t.id,t.data),WS(t.children,e)}function jS(i,e){e(i.id,i.data);for(let t of i.children)jS(t,e)}var jn=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,jn.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t,r){this.objCaches.set(t.id,t),this.parentCaches.set(t.id,r);for(let n of t.children)this.fillCaches0(n,t.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let t of this)this.fillCaches0(t,null)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}isDescendantOf(t,r){for(;t;){let n=this.parent(t);if(n===r)return!0;t=n}return!1}data(t){var r;return(r=this.get(t))==null?void 0:r.data}has(t){return this.childrenOf(t)!==void 0}get(t){return this.fillCaches(),this.objCaches.get(t)}childrenOf(t){var r;return t===null?this:(r=this.get(t))==null?void 0:r.children}traverseFrom(t,r){if(t===null)this.traverse(r);else{let n=this.get(t);n&&jS(n,r)}}traverse(t){WS(this,t)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(t){return this.fillCaches(),this.parentCaches.get(t)}childrenArray(t){return t===null?this:this.get(t).children}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this.parent(t),o=this.childrenArray(s),a=o.findIndex(u=>u.id===t);if(a<0)throw new Error("not expected");let l=o[a];return o=[...o],o[a]=be(se({},l),{data:r}),this.modifyArrayBy(s,o)}}modifyArrayBy(t,r){let n=t,s=r;for(;n!==null;){let a=s,l=n;if(n=this.parent(n),n===void 0)throw new Error;s=this.childrenArray(n);let c=s.findIndex(u=>u.id===l);if(c<0)throw new Error;s=[...s],s[c]=be(se({},s[c]),{children:a})}Object.setPrototypeOf(s,jn.prototype);let o=s;return o.fillCaches(),o}runOp(t){switch(t.type){case 7:return this.addOp(t);case 8:return this.deleteOp(t);case 9:return this.moveOp(t)}}checkDuplicatedIdRec({id:t,children:r}){if(this.get(t)!==void 0)return!0;for(let n of r)if(this.checkDuplicatedIdRec(n))return!0;return!1}addOp(t){let{parent:r,fi:n,id:s,data:o,children:a}=t;if(r!==null&&this.get(r)===void 0)return null;if(this.checkDuplicatedIdRec(t))return null;{let l=r,c=this.childrenArray(l),u={fi:n,id:s,data:o,children:a};return c=[...c,u],c.sort((f,d)=>f.fi-d.fi),t.localIndex=c.indexOf(u),{data:this.modifyArrayBy(l,c),actual:t,reverse:{type:8,id:s}}}}deleteOp(t){let{id:r}=t;if(this.get(r)===null)return null;{let n=this.parent(r);if(n===void 0)return null;let s=this.childrenArray(n),o=s.findIndex(c=>c.id===r);t.localIndex=o,s=[...s];let a=s.splice(o,1)[0];return{data:this.modifyArrayBy(n,s),actual:t,reverse:be(se({type:7},a),{parent:n})}}}moveOp(t){let{parent:r,fi:n,id:s}=t;if(r!==null&&this.get(r)===void 0)return this.deleteOp({type:8,id:s});if(r!==null){let d=r;for(;d!==null;){if(d===void 0)throw new Error;if(d===s)throw new Fd("cyclic tree");d=this.parent(d)}}let o=this.parent(s);if(o===void 0)return null;let a=o,l=this.childrenArray(o),c=l.findIndex(d=>d.id===s);l=[...l];let u=l.splice(c,1)[0],h=this.modifyArrayBy(o,l);o=r,l=h.childrenArray(o);let f=u.fi;return u=be(se({},u),{fi:n}),l=[...l,u],l.sort((d,p)=>d.fi-p.fi),t.localIndex=l.indexOf(u),h=h.modifyArrayBy(o,l),{data:h,actual:t,reverse:{type:9,parent:a,fi:f,id:s}}}previous(t,r){if(r===null){let s=this.childrenArray(t);return s.length===0?null:s[s.length-1].id}let n=null;for(let s of this.childrenArray(t)){if(s.id===r)return n;n=s.id}return null}traverseSortNext(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)+1;if(s<n.length)return n[s].id;if(r)return this.traverseSortNext(r)}}sortNext(t){let r=this.childrenArray(t);return r.length>0?r[0].id:this.traverseSortNext(t)}traverseSortPrevious(t){let r=this.childrenArray(t);return r.length>0?this.traverseSortPrevious(r[r.length-1].id):t}sortPrevious(t){let r=this.parent(t);if(r!==void 0){let n=this.childrenArray(r),s=n.findIndex(o=>o.id===t)-1;return s>=0?this.traverseSortPrevious(n[s].id):r}}getAllSorted(t){let r=[];for(let n of t){let s=this.getWithSortKey(n.id);s!==void 0&&r.push(se(se({},n),s))}r.sort((n,s)=>kS(n.sortKey,s.sortKey));for(let n of r)delete n.sortKey;return r}getWithSortKey(t){var r=t;let n=[],s=this.get(r),o=s;if(s!==void 0){for(;r;)n.splice(0,0,s.fi),r=this.parent(r),r!==null&&(s=this.get(r));return be(se({},o),{sortKey:n})}}insertBeforeHelper(t,r,n){return this.insertAfterHelper(t,this.previous(t,r),n)}insertAfterHelper(t,r,n){let s=this.childrenArray(t);if(r===null){if(s.length===0)return Ci(0,n,n);{let o=s[0].fi;return Ci(o-n,o,n)}}else{let o=this.get(r);if(o===void 0||this.parent(r)!==t)throw new Error("illegal args");let a=s.find(l=>l.fi>o.fi);if(a===void 0){let l=s[s.length-1].fi;return Ci(l,l+n,n)}else return Ci(o.fi,a.fi,n)}}};var Ud;(e=>{function i(t,r){if(Array.isArray(t)){let n=r.props,s={},o=[...t],a=!1;if(n)for(let l of Object.keys(n)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");s[l]=o[c],o[c]=n[l],a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}else{let n=r.props,s={},o=se({},t),a=!1;if(n)for(let l of Object.keys(n)){s[l]=o[l];let c=n[l];c===void 0?delete o[l]:o[l]=c,a=!0}return a?{data:o,actual:r,reverse:{type:0,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var er=class extends Array{constructor(...t){super(...t);Object.setPrototypeOf(this,er.prototype)}deepFreeze(){let t=0;for(;t<this.length;)Du(this[t]),t++}fillCaches0(t){this.objCaches.set(t.id,t)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let t of this)this.fillCaches0(t)}}randomId(){this.fillCaches();let t=Array.from(this.objCaches.keys());if(t.length!==0)return t[Math.max(0,Math.floor(Math.random()*t.length)-1)]}data(t){var r;return(r=this.get(t))==null?void 0:r.data}get(t){return this.fillCaches(),this.objCaches.get(t)}modifyById(t,r){if(this.get(t)===void 0)throw new Error("not expected");{let s=this,o=s.findIndex(c=>c.id===t);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=be(se({},a),{data:r}),this.modifyArrayBy(s)}}modifyArrayBy(t){Object.setPrototypeOf(t,er.prototype);let r=t;return HS()||r.fillCaches(),r}runOp(t){switch(t.type){case 4:return this.addOp(t);case 5:return this.deleteOp(t);case 6:return this.moveOp(t)}}addOp(t){let{fi:r,id:n,data:s}=t,o=this,a={fi:r,id:n,data:s};return o=[...o,a],o.sort((c,u)=>c.fi-u.fi),t.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:t,reverse:{type:5,id:n}}}deleteOp(t){let{id:r}=t,n=this,s=n.findIndex(l=>l.id===r);if(s===-1)return null;t.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(n),actual:t,reverse:se({type:4},o)}}moveOp(t){let{fi:r,id:n}=t,s=this;s=[...s];let o=s.findIndex(u=>u.id===n);if(o===-1)return null;let a=s[o].fi,l=be(se({},s[o]),{fi:r});return s[o]=l,s.sort((u,h)=>u.fi-h.fi),t.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:t,reverse:{type:6,fi:a,id:n}}}previous(t){if(t===null)return this.length===0?null:this[this.length-1].id;let r=null;for(let n of this){if(n.id===t)return r;r=n.id}return null}insertBeforeHelper(t,r){return this.insertAfterHelper(this.previous(t),r)}insertAfterHelper(t,r){let n=this;if(t===null){if(n.length===0)return Ci(0,r,r);{let s=n[0].fi;return Ci(s-r,s,r)}}else{let s=this.get(t);if(s===void 0)throw new Error("illegal args");let o=n.find(a=>a.fi>s.fi);if(o===void 0){let a=n[n.length-1].fi;return Ci(a,a+r,r)}else return Ci(s.fi,o.fi,r)}}};var qS=Symbol(),Gd=Symbol(),vl=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof zd);){let s=r._path,o=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,o)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[Gd];r&&r(),delete this._children[e]}}}},by=class extends vl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=be(se({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},wy=class extends vl{constructor(e,t,r){super(),this._parent=e,this._path=t,this._current=r}update(e,t){this._current=be(se({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,Wn.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},YS={get(i,e){if(e===Gd)return()=>{i._parent=null};if(e===qS)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],o=kd(i,e,s);return o!==s?(r===void 0&&(r={},i._children=r),r[e]=o,o):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},H3=be(se({},YS),{set(i,e,t){var n;let r={type:0,props:{[e]:(n=Ay(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:0,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),W3=be(se({},YS),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:1,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:2,id:e}),!0}}),xl=class extends vl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}add(e,t,r,n,s){this.runOp({type:7,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:9,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.add(e,n[s],o.id,o.data,o.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let o=r[s];this.move(e,n[s],o)}}delete(e){this.deleteChildren(e),this.runOp({type:8,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},bl=class extends vl{constructor(e,t,r){super(),this._children={},this._parent=e,this._path=t,this._current=r,this[Gd]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return be(se({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(a=t.get(e))==null?void 0:a.data,o=kd(this,e,s);return o!==s?(r===void 0&&(r={},this._children=r),r[e]=o,o):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:4,fi:e,id:t,data:r})}move(e,t){this.runOp({type:6,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:5,id:e})}};function xy(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===0&&e.type===0&&Vd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(be(se({},e),{path:t}))}var zd=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){xy(this.ts,t,e),xy(this.actual,r,e),xy(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function kd(i,e,t){return t instanceof jn?new xl(i,e,t):t instanceof er?new bl(i,e,t):t instanceof Wn?new Proxy(new wy(i,e,t),W3):t!==null&&typeof t=="object"?VS(t)?t:new Proxy(new by(i,e,t),H3):t}function Sy(i){let e=new zd(i);return[kd(e,"",i),e]}function My(i,e){let[t,r]=Sy(i);return e(t),r.result()}function Ay(i){return i instanceof xl||i instanceof bl?i._current:i!==null&&typeof i=="object"?i[qS]:i}var Vd;(r=>{function i(n,s){if(s.length===n.length)for(var o=0;o<n.length;){if(n[o]!==s[o])return!1;o+=1}else return!1;return!0}r.equal=i;function e(n,s,o){let a=t(o,n);if(a!==void 0&&typeof a=="object"&&a!==null){let l=se({},s);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return s}r.removeOverridden=e;function t(n,s,o=0){if(s.length<=o)return n;if((n instanceof jn||n instanceof xl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof er||n instanceof bl)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if(typeof s[o]=="number"&&Array.isArray(n))return t(n[s[o]],s,o+1);if(typeof s[o]=="string"&&typeof n=="object")return t(n[s[o]],s,o+1)}r.zoom=t})(Vd||(Vd={}));var Hd=class{},Pu=class extends Hd{constructor(t){super();this.id=t}},Iu=class extends Hd{constructor(t){super();this.data=t}};var Ey;try{Ey=new TextDecoder}catch{}var Re,Zs,ee=0;var tM=[],_y=tM,Cy=0,xn={},Et,Ks,qn=0,Li=0,Dn,cs,un=[],Pt,XS={useRecords:!1,mapsAsObjects:!0},Ru=class{},Dy=new Ru;Dy.name="MessagePack 0xC1";var wl=!1,Di=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Re)return oM(()=>(jd(),this?this.unpack(e,t):Di.prototype.unpack.call(XS,e,t)));Zs=t>-1?t:e.length,ee=0,Cy=0,Li=0,Ks=null,_y=tM,Dn=null,Re=e;try{Pt=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Re=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Di){if(xn=this,this.structures)return Et=this.structures,Wd();(!Et||Et.length>0)&&(Et=[])}else xn=XS,(!Et||Et.length>0)&&(Et=[]);return Wd()}unpackMultiple(e,t){let r,n=0;try{wl=!0;let s=e.length,o=this?this.unpack(e,s):Xd.unpack(e,s);if(t){for(t(o);ee<s;)if(n=ee,t(Wd())===!1)return}else{for(r=[o];ee<s;)n=ee,r.push(Wd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{wl=!1,jd()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function Wd(){try{if(!xn.trusted&&!wl){let e=Et.sharedLength||0;e<Et.length&&(Et.length=e)}let i=or();if(ee==Zs)Et.restoreStructures&&JS(),Et=null,Re=null,cs&&(cs=null);else if(ee>Zs){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!wl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Et.restoreStructures&&JS(),jd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function JS(){for(let i in Et.restoreStructures)Et[i]=Et.restoreStructures[i];Et.restoreStructures=null}function or(){let i=Re[ee++];if(i<160)if(i<128){if(i<64)return i;{let e=Et[i&63]||xn.getStructures&&rM()[i&63];return e?(e.read||(e.read=Py(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}else if(i<192){let e=i-160;if(Li>=ee)return Ks.slice(ee-qn,(ee+=e)-qn);if(Li==0&&Zs<140){let t=e<16?Iy(e):nM(e);if(t!=null)return t}return Ly(e)}else{let e;switch(i){case 192:return null;case 193:return Dn?(e=or(),e>0?Dn[1].slice(Dn.position1,Dn.position1+=e):Dn[0].slice(Dn.position0,Dn.position0-=e)):Dy;case 194:return!1;case 195:return!0;case 196:return Ty(Re[ee++]);case 197:return e=Pt.getUint16(ee),ee+=2,Ty(e);case 198:return e=Pt.getUint32(ee),ee+=4,Ty(e);case 199:return ko(Re[ee++]);case 200:return e=Pt.getUint16(ee),ee+=2,ko(e);case 201:return e=Pt.getUint32(ee),ee+=4,ko(e);case 202:if(e=Pt.getFloat32(ee),xn.useFloat32>2){let t=Yd[(Re[ee]&127)<<1|Re[ee+1]>>7];return ee+=4,(t*e+(e>0?.5:-.5)>>0)/t}return ee+=4,e;case 203:return e=Pt.getFloat64(ee),ee+=8,e;case 204:return Re[ee++];case 205:return e=Pt.getUint16(ee),ee+=2,e;case 206:return e=Pt.getUint32(ee),ee+=4,e;case 207:return xn.int64AsNumber?(e=Pt.getUint32(ee)*4294967296,e+=Pt.getUint32(ee+4)):e=Pt.getBigUint64(ee),ee+=8,e;case 208:return Pt.getInt8(ee++);case 209:return e=Pt.getInt16(ee),ee+=2,e;case 210:return e=Pt.getInt32(ee),ee+=4,e;case 211:return xn.int64AsNumber?(e=Pt.getInt32(ee)*4294967296,e+=Pt.getUint32(ee+4)):e=Pt.getBigInt64(ee),ee+=8,e;case 212:if(e=Re[ee++],e==114)return eM(Re[ee++]&63);{let t=un[e];if(t)return t.read?(ee++,t.read(or())):t.noBuffer?(ee++,t()):t(Re.subarray(ee,++ee));throw new Error("Unknown extension "+e)}case 213:return e=Re[ee],e==114?(ee++,eM(Re[ee++]&63,Re[ee++])):ko(2);case 214:return ko(4);case 215:return ko(8);case 216:return ko(16);case 217:return e=Re[ee++],Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):q3(e);case 218:return e=Pt.getUint16(ee),ee+=2,Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):Y3(e);case 219:return e=Pt.getUint32(ee),ee+=4,Li>=ee?Ks.slice(ee-qn,(ee+=e)-qn):X3(e);case 220:return e=Pt.getUint16(ee),ee+=2,KS(e);case 221:return e=Pt.getUint32(ee),ee+=4,KS(e);case 222:return e=Pt.getUint16(ee),ee+=2,ZS(e);case 223:return e=Pt.getUint32(ee),ee+=4,ZS(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var j3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function Py(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>j3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(or);return i.highByte===0&&(i.read=QS(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=or()}return r}return t.count=0,i.highByte===0?QS(e,t):t}var QS=(i,e)=>function(){let t=Re[ee++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=Et[r]||rM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=Py(n,i)),n.read()};function rM(){let i=oM(()=>(Re=null,xn.getStructures()));return Et=xn._mergeStructures(i,Et)}var Ly=qd,q3=qd,Y3=qd,X3=qd;function qd(i){let e;if(i<16&&(e=Iy(i)))return e;if(i>64&&Ey)return Ey.decode(Re.subarray(ee,ee+=i));let t=ee+i,r=[];for(e="";ee<t;){let n=Re[ee++];if((n&128)===0)r.push(n);else if((n&224)===192){let s=Re[ee++]&63;r.push((n&31)<<6|s)}else if((n&240)===224){let s=Re[ee++]&63,o=Re[ee++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)===240){let s=Re[ee++]&63,o=Re[ee++]&63,a=Re[ee++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Pr.apply(String,r),r.length=0)}return r.length>0&&(e+=Pr.apply(String,r)),e}function KS(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=or();return e}function ZS(i){if(xn.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[iM()]=or();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(or(),or());return e}}var Pr=String.fromCharCode;function nM(i){let e=ee,t=new Array(i);for(let r=0;r<i;r++){let n=Re[ee++];if((n&128)>0){ee=e;return}t[r]=n}return Pr.apply(String,t)}function Iy(i){if(i<4)if(i<2){if(i===0)return"";{let e=Re[ee++];if((e&128)>1){ee-=1;return}return Pr(e)}}else{let e=Re[ee++],t=Re[ee++];if((e&128)>0||(t&128)>0){ee-=2;return}if(i<3)return Pr(e,t);let r=Re[ee++];if((r&128)>0){ee-=3;return}return Pr(e,t,r)}else{let e=Re[ee++],t=Re[ee++],r=Re[ee++],n=Re[ee++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){ee-=4;return}if(i<6){if(i===4)return Pr(e,t,r,n);{let s=Re[ee++];if((s&128)>0){ee-=5;return}return Pr(e,t,r,n,s)}}else if(i<8){let s=Re[ee++],o=Re[ee++];if((s&128)>0||(o&128)>0){ee-=6;return}if(i<7)return Pr(e,t,r,n,s,o);let a=Re[ee++];if((a&128)>0){ee-=7;return}return Pr(e,t,r,n,s,o,a)}else{let s=Re[ee++],o=Re[ee++],a=Re[ee++],l=Re[ee++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){ee-=8;return}if(i<10){if(i===8)return Pr(e,t,r,n,s,o,a,l);{let c=Re[ee++];if((c&128)>0){ee-=9;return}return Pr(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Re[ee++],u=Re[ee++];if((c&128)>0||(u&128)>0){ee-=10;return}if(i<11)return Pr(e,t,r,n,s,o,a,l,c,u);let h=Re[ee++];if((h&128)>0){ee-=11;return}return Pr(e,t,r,n,s,o,a,l,c,u,h)}else{let c=Re[ee++],u=Re[ee++],h=Re[ee++],f=Re[ee++];if((c&128)>0||(u&128)>0||(h&128)>0||(f&128)>0){ee-=12;return}if(i<14){if(i===12)return Pr(e,t,r,n,s,o,a,l,c,u,h,f);{let d=Re[ee++];if((d&128)>0){ee-=13;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d)}}else{let d=Re[ee++],p=Re[ee++];if((d&128)>0||(p&128)>0){ee-=14;return}if(i<15)return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,p);let m=Re[ee++];if((m&128)>0){ee-=15;return}return Pr(e,t,r,n,s,o,a,l,c,u,h,f,d,p,m)}}}}}function Ty(i){return xn.copyBuffers?Uint8Array.prototype.slice.call(Re,ee,ee+=i):Re.subarray(ee,ee+=i)}function ko(i){let e=Re[ee++];if(un[e])return un[e](Re.subarray(ee,ee+=i));throw new Error("Unknown extension type "+e)}var $S=new Array(4096);function iM(){let i=Re[ee++];if(i>=160&&i<192){if(i=i-160,Li>=ee)return Ks.slice(ee-qn,(ee+=i)-qn);if(!(Li==0&&Zs<180))return Ly(i)}else return ee--,or();let e=(i<<5^(i>1?Pt.getUint16(ee):i>0?Re[ee]:0))&4095,t=$S[e],r=ee,n=ee+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Pt.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Re[r++],s!=t[o++]){r=1879048192;break}if(r===n)return ee=r,t.string;n-=3,r=ee}for(t=[],$S[e]=t,t.bytes=i;r<n;)s=Pt.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Re[r++],t.push(s);let a=i<16?Iy(i):nM(i);return a!=null?t.string=a:t.string=Ly(i)}var eM=(i,e)=>{var t=or();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=Et[i];return n&&n.isShared&&((Et.restoreStructures||(Et.restoreStructures=[]))[i]=n),Et[i]=t,t.read=Py(t,r),t.read()},sM=typeof self=="object"?self:global;un[0]=()=>{};un[0].noBuffer=!0;un[101]=()=>{let i=or();return(sM[i[0]]||Error)(i[1])};un[105]=i=>{let e=Pt.getUint32(ee-4);cs||(cs=new Map);let t=Re[ee],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};cs.set(e,n);let s=or();return n.used?Object.assign(r,s):(n.target=s,s)};un[112]=i=>{let e=Pt.getUint32(ee-4),t=cs.get(e);return t.used=!0,t.target};un[115]=()=>new Set(or());var Ry=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");un[116]=i=>{let e=i[0],t=Ry[e];if(!t)throw new Error("Could not find typed array for code "+e);return new sM[t](Uint8Array.prototype.slice.call(i,1).buffer)};un[120]=()=>{let i=or();return new RegExp(i[0],i[1])};un[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=ee;ee+=e-4,Dn=[or(),or()],Dn.position0=0,Dn.position1=0;let r=ee;ee=t;try{return or()}finally{ee=r}};un[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function oM(i){let e=Zs,t=ee,r=Cy,n=qn,s=Li,o=Ks,a=_y,l=cs,c=Dn,u=new Uint8Array(Re.slice(0,Zs)),h=Et,f=Et.slice(0,Et.length),d=xn,p=wl,m=i();return Zs=e,ee=t,Cy=r,qn=n,Li=s,Ks=o,_y=a,cs=l,Dn=c,Re=u,wl=p,Et=h,Et.splice(0,Et.length,...f),xn=d,Pt=new DataView(Re.buffer,Re.byteOffset,Re.byteLength),m}function jd(){Re=null,cs=null,Et=null}function aM(i){i.unpack?un[i.type]=i.unpack:un[i.type]=i}var Yd=new Array(147);for(let i=0;i<256;i++)Yd[i]=+("1e"+Math.floor(45.15-i*.30103));var Xd=new Di({useRecords:!1}),J3=Xd.unpack,Q3=Xd.unpackMultiple,K3=Xd.unpack,Jd={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4},Z3=new Float32Array(1),n9=new Uint8Array(Z3.buffer,0,4);var Qd;try{Qd=new TextEncoder}catch{}var Kd,Ny,Zd=typeof Buffer<"u",By=Zd?Buffer.allocUnsafeSlow:Uint8Array,hM=Zd?Buffer:Uint8Array,lM=Zd?4294967296:2144337920,de,hr,ae=0,Pi,Ii=null,$3=/[\u0080-\uFFFF]/,Bu=Symbol("record-id"),Vo=class extends Di{constructor(e){super(e),this.offset=0;let t,r,n,s,o,a,l=0,c=hM.prototype.utf8Write?function(x,E,_){return de.utf8Write(x,E,_)}:Qd&&Qd.encodeInto?function(x,E){return Qd.encodeInto(x,de.subarray(E)).written}:!1,u=this;e||(e={});let h=e&&e.sequential,f=e.structures||e.saveStructures,d=e.maxSharedStructures;if(d==null&&(d=f?32:0),d>8160)throw new Error("Maximum maxSharedStructure is 8160");let p=e.maxOwnStructures;p==null&&(p=f?32:64),h&&!e.saveStructures&&(this.structures=[]);let m=d>32||p+d>64,g=d+64,v=d+p+64;if(v>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let y=[],w=0,b=0;this.pack=this.encode=function(x,E){if(de||(de=new By(8192),hr=new DataView(de.buffer,0,8192),ae=0),Pi=de.length-10,Pi-ae<2048?(de=new By(de.length),hr=new DataView(de.buffer,0,de.length),Pi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=u.structuredClone?new Map:null,u.bundleStrings?(Ii=["",""],de[ae++]=214,de[ae++]=98,Ii.position=ae-r,ae+=4):Ii=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let _=n.sharedLength||0;if(_>d)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let C=0;C<_;C++){let P=n[C];if(!P)continue;let B,R=n.transitions;for(let U=0,z=P.length;U<z;U++){let J=P[U];B=R[J],B||(B=R[J]=Object.create(null)),R=B}R[Bu]=C+64}l=_}h||(n.nextId=_+64)}s&&(s=!1),o=n||[];try{if(S(x),Ii){hr.setUint32(Ii.position+r,ae-Ii.position-r);let _=Ii;Ii=null,S(_[0]),S(_[1])}if(u.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Pi&&A(ae),u.offset=ae;let _=tO(de.subarray(r,ae),a.idsToInsert);return a=null,_}return E&dM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,w>1e4)n.transitions=null,b=0,w=0,y.length>0&&(y=[]);else if(y.length>0&&!h){for(let _=0,C=y.length;_<C;_++)y[_][Bu]=0;y=[]}if(s&&u.saveStructures){let _=n.sharedLength||d;n.length>_&&(n=n.slice(0,_));let C=de.subarray(r,ae);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(x)):(l=_,C)}}E&lO&&(ae=r)}};let S=x=>{ae>Pi&&(de=A(ae));var E=typeof x,_;if(E==="string"){let C=x.length;if(Ii&&C>=8&&C<4096){let R=$3.test(x);Ii[R?0:1]+=x,de[ae++]=193,S(R?-C:C);return}let P;C<32?P=1:C<256?P=2:C<65536?P=3:P=5;let B=C*3;if(ae+B>Pi&&(de=A(ae+B)),C<64||!c){let R,U,z,J=ae+P;for(R=0;R<C;R++)U=x.charCodeAt(R),U<128?de[J++]=U:U<2048?(de[J++]=U>>6|192,de[J++]=U&63|128):(U&64512)===55296&&((z=x.charCodeAt(R+1))&64512)===56320?(U=65536+((U&1023)<<10)+(z&1023),R++,de[J++]=U>>18|240,de[J++]=U>>12&63|128,de[J++]=U>>6&63|128,de[J++]=U&63|128):(de[J++]=U>>12|224,de[J++]=U>>6&63|128,de[J++]=U&63|128);_=J-ae-P}else _=c(x,ae+P,B);_<32?de[ae++]=160|_:_<256?(P<2&&de.copyWithin(ae+2,ae+1,ae+1+_),de[ae++]=217,de[ae++]=_):_<65536?(P<3&&de.copyWithin(ae+3,ae+2,ae+2+_),de[ae++]=218,de[ae++]=_>>8,de[ae++]=_&255):(P<5&&de.copyWithin(ae+5,ae+3,ae+3+_),de[ae++]=219,hr.setUint32(ae,_),ae+=4),ae+=_}else if(E==="number")if(x>>>0===x)x<64?de[ae++]=x:x<256?(de[ae++]=204,de[ae++]=x):x<65536?(de[ae++]=205,de[ae++]=x>>8,de[ae++]=x&255):(de[ae++]=206,hr.setUint32(ae,x),ae+=4);else if(x>>0===x)x>=-32?de[ae++]=256+x:x>=-128?(de[ae++]=208,de[ae++]=x+256):x>=-32768?(de[ae++]=209,hr.setInt16(ae,x),ae+=2):(de[ae++]=210,hr.setInt32(ae,x),ae+=4);else{let C;if((C=this.useFloat32)>0&&x<4294967296&&x>=-2147483648){de[ae++]=202,hr.setFloat32(ae,x);let P;if(C<4||(P=x*Yd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===P){ae+=4;return}else ae--}de[ae++]=203,hr.setFloat64(ae,x),ae+=8}else if(E==="object")if(!x)de[ae++]=192;else{if(a){let P=a.get(x);if(P){if(!P.id){let B=a.idsToInsert||(a.idsToInsert=[]);P.id=B.push(P)}de[ae++]=214,de[ae++]=112,hr.setUint32(ae,P.id),ae+=4;return}else a.set(x,{offset:ae-r})}let C=x.constructor;if(C===Object)T(x,!0);else if(C===Array){_=x.length,_<16?de[ae++]=144|_:_<65536?(de[ae++]=220,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=221,hr.setUint32(ae,_),ae+=4);for(let P=0;P<_;P++)S(x[P])}else if(C===Map){_=x.size,_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,hr.setUint32(ae,_),ae+=4);for(let[P,B]of x)S(P),S(B)}else{for(let P=0,B=Kd.length;P<B;P++){let R=Ny[P];if(x instanceof R){let U=Kd[P];if(U.write){U.type&&(de[ae++]=212,de[ae++]=U.type,de[ae++]=0),S(U.write.call(this,x));return}let z=de,J=hr,Q=ae;de=null;let X;try{X=U.pack.call(this,x,F=>(de=z,z=null,ae+=F,ae>Pi&&A(ae),{target:de,targetView:hr,position:ae-F}),S)}finally{z&&(de=z,hr=J,ae=Q,Pi=de.length-10)}X&&(X.length+ae>Pi&&A(X.length+ae),ae=eO(X,de,ae,U.type));return}}T(x,!x.hasOwnProperty)}}else if(E==="boolean")de[ae++]=x?195:194;else if(E==="bigint"){if(x<BigInt(1)<<BigInt(63)&&x>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,hr.setBigInt64(ae,x);else if(x<BigInt(1)<<BigInt(64)&&x>0)de[ae++]=207,hr.setBigUint64(ae,x);else if(this.largeBigIntToFloat)de[ae++]=203,hr.setFloat64(ae,Number(x));else throw new RangeError(x+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");ae+=8}else if(E==="undefined")this.encodeUndefinedAsNil?de[ae++]=192:(de[ae++]=212,de[ae++]=0,de[ae++]=0);else if(E==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?x=>{let E=Object.keys(x),_=E.length;_<16?de[ae++]=128|_:_<65536?(de[ae++]=222,de[ae++]=_>>8,de[ae++]=_&255):(de[ae++]=223,hr.setUint32(ae,_),ae+=4);let C;for(let P=0;P<_;P++)S(C=E[P]),S(x[C])}:(x,E)=>{de[ae++]=222;let _=ae-r;ae+=2;let C=0;for(let P in x)(E||x.hasOwnProperty(P))&&(S(P),S(x[P]),C++);de[_+++r]=C>>8,de[_+r]=C&255}:x=>{let E=Object.keys(x),_,C=o.transitions||(o.transitions=Object.create(null)),P=0;for(let R=0,U=E.length;R<U;R++){let z=E[R];_=C[z],_||(_=C[z]=Object.create(null),P++),C=_}let B=C[Bu];if(B)B>=96&&m?(de[ae++]=((B-=96)&31)+96,de[ae++]=B>>5):de[ae++]=B;else{B=o.nextId,B||(B=64),B<g&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(B=o.nextOwnId,B<v||(B=g),o.nextOwnId=B+1):(B>=v&&(B=g),o.nextId=B+1);let R=E.highByte=B>=96&&m?B-96>>5:-1;C[Bu]=B,o[B-64]=E,B<g?(E.isShared=!0,o.sharedLength=B-63,s=!0,R>=0?(de[ae++]=(B&31)+96,de[ae++]=R):de[ae++]=B):(R>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(B&31)+96,de[ae++]=R):(de[ae++]=212,de[ae++]=114,de[ae++]=B),P&&(w+=b*P),y.length>=p&&(y.shift()[Bu]=0),y.push(C),S(E))}for(let R=0,U=E.length;R<U;R++)S(x[E[R]])},A=x=>{let E;if(x>16777216){if(x-r>lM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(lM,Math.round(Math.max((x-r)*(x>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(x-r<<2,de.length-1)>>12)+1<<12;let _=new By(E);return hr=new DataView(_.buffer,0,E),de.copy?de.copy(_,0,r,x):_.set(de.slice(r,x)),ae-=r,r=0,Pi=_.length-10,de=_}}useBuffer(e){de=e,hr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Ny=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Ru];Kd=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:o}=e(6);n[o++]=214,n[o++]=255,s.setUint32(o,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:o}=e(10);n[o++]=215,n[o++]=255,s.setUint32(o,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(o+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:o}=e(3);n[o++]=212,n[o++]=255,n[o++]=255}else{let{target:n,targetView:s,position:o}=e(15);n[o++]=199,n[o++]=12,n[o++]=255,s.setUint32(o,i.getMilliseconds()*1e6),s.setBigInt64(o+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?cM(i,16,e):uM(Zd?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==hM&&this.structuredClone?cM(i,Ry.indexOf(t.name),e):uM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function cM(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:o}=t(4+n);s[o++]=199,s[o++]=n+1}else if(n+1<65536){var{target:s,position:o}=t(5+n);s[o++]=200,s[o++]=n+1>>8,s[o++]=n+1&255}else{var{target:s,position:o,targetView:a}=t(7+n);s[o++]=201,a.setUint32(o,n+1),o+=4}s[o++]=116,s[o++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),o)}function uM(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function eO(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function tO(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,o)=>s.offset>o.offset?1:-1);t=e.pop();){let s=t.offset,o=t.id;i.copyWithin(s+r,s,n),r-=6;let a=s+r;i[a++]=214,i[a++]=105,i[a++]=o>>24,i[a++]=o>>16&255,i[a++]=o>>8&255,i[a++]=o&255,n=s}return i}function Ho(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ny.unshift(i.Class),Kd.unshift(i)}aM(i)}var fM=new Vo({useRecords:!1}),rO=fM.pack,nO=fM.pack;var{NEVER:iO,ALWAYS:sO,DECIMAL_ROUND:oO,DECIMAL_FIT:aO}=Jd,dM=512,lO=1024;var pM=new Vo({structuredClone:!0});Ho({Class:Wn.prototype.constructor,type:1,write(i){return se({},i)},read(i){return Object.setPrototypeOf(i,Wn.prototype),i}});Ho({Class:er.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,er.prototype),i}});Ho({Class:jn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,jn.prototype),i}});Ho({Class:Pu.prototype.constructor,type:4,write(i){return i.id},read(i){return new Pu(i)}});Ho({Class:Iu.prototype.constructor,type:5,write(i){return i.data},read(i){return new Iu(i)}});function cO(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var $d;(r=>{function i(n){return pM.pack(n)}r.serialize=i;function e(n){return pM.unpack(n)}r.deserialize=e;function t(n){return cO(i(n)).toString()}r.checksum=t})($d||($d={}));var ep;(t=>{t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(ep||(ep={}));var tp;(t=>{function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ln.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Ln.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(tp||(tp={}));var Oy;(t=>{t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Oy||(Oy={}));var Fy;(t=>{t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(Fy||(Fy={}));var rp;(e=>e.defaultData=be(se(se({},Fy.defaultData),Oy.defaultData),{cloner:null}))(rp||(rp={}));var Uy=(n=>(n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify",n))(Uy||{}),zy=(r=>(r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom",r))(zy||{}),Gy=(r=>(r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower",r))(Gy||{}),np;(e=>e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ln.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"})(np||(np={}));var mM=["mode","gradientType","noiseType","displacementType","projection","cnormal","crop","axis"];var Sl;(r=>{function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:0,g:0,b:0,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:"x",type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Sr.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:be(se({},Sr.fromHex(6710886)),{a:1}),colorB:be(se({},Sr.fromHex(6710886)),{a:1}),colorC:be(se({},Sr.fromHex(16777215)),{a:1}),colorD:be(se({},Sr.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Ln.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Sl||(Sl={}));var Ri;(a=>{function i(l){return!l.layers.some(u=>{if(u.data.type==="texture"&&u.data.projection!==0||u.data.type==="depth"&&!u.data.isWorldSpace||u.data.type==="noise"||u.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(u=>{Object.entries(u.data).forEach(([h,f])=>{c+=`${h}${f}`,Array.isArray(f)?f.forEach(d=>c+=`${d}`):typeof f=="object"?Object.values(f).forEach(d=>{typeof d=="number"?c+=`${d.toFixed(4)}`:c+=`${d}`}):c+=`${f}`})}),c}a.getHash=e;function t(l){let c=0;for(let u of l.layers)"alpha"in u.data&&u.data.type!=="light"&&u.data.type!=="fresnel"&&(c+=(1-c)*u.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new er}}a.defaultEmptyData=r;function n(l="layer1",c="layer2"){return s("phong",l,c)}a.defaultData=n;function s(l,c="layer1",u="layer2"){let h=new er;return h.push({fi:0,data:Sl.defaultData("light",l),id:c}),h.push({fi:1,data:Sl.defaultData("color"),id:u}),{layers:h}}a.defaultTwoLayerData=s;function o(l,c="basic",u="layer1",h="layer2"){let f=Sl.defaultData("texture");Object.assign(f.texture,{image:l});let d=new er;return d.push({fi:0,data:f,id:u}),d.push({fi:1,data:Sl.defaultData("light",c),id:h}),{layers:d}}a.defaultTwoLayerTextureData=o})(Ri||(Ri={}));var Ml;(r=>{function i(){return{points:new er,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(n,s){let{points:o}=s;if(o){for(let a of o)if(a.data.position[0]===n[0]&&a.data.position[1]===n[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(n,s){let o=n.controlNext,a=s.controlPrevious;return n.position[0]===o.position[0]&&n.position[1]===o.position[1]&&s.position[0]===a.position[0]&&s.position[1]===a.position[1]}r.isStraightLine=t})(Ml||(Ml={}));var ip;(e=>{function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(ip||(ip={}));var sp;(e=>{function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};if(t==="VectorGeometry")return{width:1,height:1,type:t,subdivisions:12,shape:Ml.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1};throw new Error("not implemented")}e.defaultData=i})(sp||(sp={}));var Nu;(n=>{n.identity=be(se({},Rd.identity),{hiddenMatrix:_i.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,o){return{position:(o==null?void 0:o.position)||s.position,rotation:(o==null?void 0:o.rotation)||s.rotation,scale:(o==null?void 0:o.scale)||s.scale,hiddenMatrix:(o==null?void 0:o.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,o){return{position:vr.isEqual(s.position,o.position)?null:o.position,rotation:vr.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:vr.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:_i.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(Nu||(Nu={}));var $s;(e=>e.defaultData=se({states:new er,events:new er,visible:!0,raycastLock:!1},Nu.identity))($s||($s={}));var gM;(e=>e.defaultData=se({type:"Empty"},$s.defaultData))(gM||(gM={}));var ky;(e=>e.defaultData=se(se({type:"Mesh"},$s.defaultData),rp.defaultData))(ky||(ky={}));var yM;(e=>e.defaultData=se(se({type:"TextFrame"},$s.defaultData),np.defaultData))(yM||(yM={}));var op;(e=>e.defaultData=se(se(se({},$s.defaultData),Nu.identity),Go.defaultData))(op||(op={}));var vM;(e=>{function i(t){return se(se({},$s.defaultData),tp.defaultData(t))}e.defaultData=i})(vM||(vM={}));var xM;(t=>(t.defaultCamera=se({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:_i.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new er,events:new er},Go.defaultData),t.defaultMeshObject=be(se(se({name:"Rectangle"},$s.defaultData),ky.defaultData),{geometry:sp.defaultData("RectangleGeometry"),material:Ri.defaultTwoLayerData("basic","layer1","layer2")})))(xM||(xM={}));var Ou;(t=>{function i(r,n){if(n===void 0)return r;let s=se({},r);return"material"in s&&"material"in n&&n.material&&(s.material=My(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&zo(c,l)}}).data),s.materials&&n.materials&&(s.materials=My(s.materials,o=>{var a,l;for(let c=0;c<s.materials.length;c++){let u=n.materials[c];if(typeof u!="string")for(let[h,f]of Object.entries(u.layers)){let d=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(h);d&&zo(d,f)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=se({},r);if(Object.assign(s,Nu.merge(s,n)),Qs.is(r.type)){s.orthographic=se({},s.orthographic),s.perspective=se({},s.perspective);let l=n;((o=l.orthographic)==null?void 0:o.zoom)!==void 0&&(s.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(s.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")s.geometry=se({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(ep.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(typeof l.color=="string"?s.color=l.color:s.color=Sr.clone(l.color))}return s}t.patch=e})(Ou||(Ou={}));function wM(i,e=!1){let t=i[0].index!==null,r=new Set(Object.keys(i[0].attributes)),n=new Set(Object.keys(i[0].morphAttributes)),s={},o={},a=i[0].morphTargetsRelative,l=new Ie,c=0;for(let u=0;u<i.length;++u){let h=i[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in h.attributes){if(!r.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(h.attributes[d]),f++}if(f!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in h.morphAttributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(h.morphAttributes[d])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(h.userData),e){let d;if(t)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,d,u),c+=d}}if(t){let u=0,h=[];for(let f=0;f<i.length;++f){let d=i[f].index;for(let p=0;p<d.count;++p)h.push(d.getX(p)+u);u+=i[f].attributes.position.count}l.setIndex(h)}for(let u in s){let h=bM(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" attribute."),null;l.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[u]=[];for(let f=0;f<h;++f){let d=[];for(let m=0;m<o[u].length;++m)d.push(o[u][m][f]);let p=bM(d);if(!p)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+u+" morphAttribute."),null;l.morphAttributes[u].push(p)}}return l}function bM(i){let e,t,r,n=0;for(let a=0;a<i.length;++a){let l=i[a];if(l.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(e===void 0&&(e=l.array.constructor),e!==l.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=l.itemSize),t!==l.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(r===void 0&&(r=l.normalized),r!==l.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;n+=l.array.length}let s=new e(n),o=0;for(let a=0;a<i.length;++a)s.set(i[a].array,o),o+=i[a].array.length;return new Ue(s,t,r)}function SM(i,e=1e-4){e=Math.max(e,Number.EPSILON);let t={},r=i.getIndex(),n=i.getAttribute("position"),s=r?r.count:n.count,o=0,a=Object.keys(i.attributes),l={},c={},u=[],h=["getX","getY","getZ","getW"];for(let m=0,g=a.length;m<g;m++){let v=a[m];l[v]=[];let y=i.morphAttributes[v];y&&(c[v]=new Array(y.length).fill().map(()=>[]))}let f=Math.log10(1/e),d=Math.pow(10,f);for(let m=0;m<s;m++){let g=r?r.getX(m):m,v="";for(let y=0,w=a.length;y<w;y++){let b=a[y],S=i.getAttribute(b),T=S.itemSize;for(let A=0;A<T;A++)v+=`${~~(S[h[A]](g)*d)},`}if(v in t)u.push(t[v]);else{for(let y=0,w=a.length;y<w;y++){let b=a[y],S=i.getAttribute(b),T=i.morphAttributes[b],A=S.itemSize,x=l[b],E=c[b];for(let _=0;_<A;_++){let C=h[_];if(x.push(S[C](g)),T)for(let P=0,B=T.length;P<B;P++)E[P].push(T[P][C](g))}}t[v]=o,u.push(o),o++}}let p=i.clone();for(let m=0,g=a.length;m<g;m++){let v=a[m],y=i.getAttribute(v),w=new y.array.constructor(l[v]),b=new Ue(w,y.itemSize,y.normalized);if(p.setAttribute(v,b),v in c)for(let S=0;S<c[v].length;S++){let T=i.morphAttributes[v][S],A=new T.array.constructor(c[v][S]),x=new Ue(A,T.itemSize,T.normalized);p.morphAttributes[v][S]=x}}return p.setIndex(u),p}var Vy={type:"change"},MM={type:"changeZoom"},uO={type:"changePan"},Al={type:"start"},Fu={type:"end"},Hy=new Ut,hO=new N,fO=2*Math.PI,dO=1e-8,pO=.01,AM=2,Wy=.125,TM=2,jy=1,qy=1,Yy=.1;var ap=class extends jt{constructor(t,r){super();this.object=t;this.domElement=r;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=0;this.panLimitsMode=0;this.rotationSoftLimit=2;this.panSoftLimit=2;this.hoverRotatePanMode=0;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,En.DOLLY_ROTATE,En.PAN];this.offset=new M;this.eye=new M;this.lastPosition=new M;this.lastQuaternion=new Ut;this.current=new N;this.overShoot=new N;this.overRatio=new N;this.spherical=new hu;this.sphericalDelta=new hu;this.panOffset=new M;this.panLeftV=new M;this.panUpV=new M;this.panV=new M;this.rotateStart=new N;this.rotateEnd=new N;this.rotateDelta=new N;this.panStart=new N;this.panEnd=new N;this.panDelta=new N;this.dollyStart=new N;this.dollyEnd=new N;this.dollyDelta=new N;this.rotationRangeFactor=new N;this.panRangeFactor=new N;this.state=-1;this.zoomChanged=!1;this.isPointerDown=!1;this.isFirstHover=!0;this.isThetaFlipped=!1;this.prevScale=0;this.scale=1;this.gesture=!1;this.timer=-1;this.timerHover=-1;this.minDistance=0;this.maxDistance=1/0;this.minZoom=0;this.maxZoom=1/0;this.minPhi=0;this.maxPhi=Math.PI;this.minTheta=-1/0;this.maxTheta=1/0;this.minH=0;this.maxH=Math.PI;this.minV=-1/0;this.maxV=1/0;this.autoRotateClockwise=!0;this.isPanOverShoot=!1;this.isRotateOverShoot=!1;this.update=()=>{let t=this.object.position;this.offset.copy(t).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&this.state===-1&&this.rotateLeft((this.autoRotateClockwise===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==0&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),this.rotationLimitsMode!==2&&(this.spherical.phi+=this.sphericalDelta.phi),(this.rotationLimitsMode!==1||this.autoRotate===!0)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),this.panLimitsMode!==0&&(this.target.applyQuaternion(Hy.copy(this.object.quaternion).invert()),this.panOffset.applyQuaternion(Hy),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(this.object.quaternion),this.panOffset.applyQuaternion(this.object.quaternion)),this.panLimitsMode===2&&(this.panOffset.y=0),this.panLimitsMode===1&&(this.panOffset.x=0),this.state===-1&&!this.gesture?(this.panOffset.multiplyScalar(1-Wy),this.target.add(this.panOffset)):(this.target.add(this.panOffset),this.panOffset.set(0,0,0)),this.offset.setFromSpherical(this.spherical),t.copy(this.target).add(this.offset);let r=this.spherical.phi%fO;return this.eye.copy(this.offset).normalize(),this.object.up.copy(ot.DefaultUp).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),r>0&&r>Math.PI||r<0&&r>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),this.state===-1||this.enableDamping===!0?(this.sphericalDelta.theta*=1-Wy,this.sphericalDelta.phi*=1-Wy):this.sphericalDelta.set(0,0,0),this.scale=1,this.zoomChanged||this.lastPosition.distanceToSquared(this.object.position)>pO||8*(1-this.lastQuaternion.dot(this.object.quaternion))>dO?(this.dispatchEvent(Vy),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),this.zoomChanged=!1,!0):(this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),!1)};this.onPointerDown=t=>{this.enabled!==!1&&(this.isPointerDown=!0,Mt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),gO(t),t.pointerType==="touch"?this.onPointerDownTouch(t):this.onPointerDownMouse(t))};this.onPointerMove=t=>{this.enabled!==!1&&(t.pointerType==="touch"?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t))};this.onPointerUp=t=>{_M(t),this.isPointerDown=!1,Mt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(Fu),this.state=-1};this.onPointerCancel=t=>{_M(t)};this.onPointerDownMouse=t=>{let r;switch(this.useKeyEvents?r=this.mouseButtons[t.button]:r=this.mouseButtonsPlay[t.button],r){case 0:if(t.altKey===!0&&!t.shiftKey&&!Cu(t)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else if(this.key===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(Cu(t)||t.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(Cu(t)||t.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(t),this.state=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Al)};this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(t);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(t);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(t);break}};this.onPointerDownTouch=t=>{switch(CM(t),this.touches[Mt.length-1]){case En.ROTATE:if(this.enableRotate===!1){this.state=-1;return}this.handleTouchStartRotate(),this.state=3;break;case En.PAN:if(this.enablePan===!1){this.state=-1;return}this.handleTouchStartPan(),this.state=4;break;case En.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),this.state=5;break;case En.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}this.state!==-1&&this.dispatchEvent(Al)};this.onPointerMoveTouch=t=>{switch(CM(t),this.state){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(t),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}};this.dispatchEndDebounced=Mu(()=>this.dispatchEvent(Fu),33);this.onMouseWheel=t=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&t.preventDefault(),this.dispatchEvent(Al),this.handleMouseWheel(t),this.dispatchEndDebounced())};this.onGesture=t=>{if(this.enabled!==!1)if(t.preventDefault(),t.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Al),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update()}else this.dispatchEvent(Fu)};this.onContextMenu=t=>{this.enabled!==!1&&t.preventDefault()};this.onTouchMove=t=>{(t.touches.length>1||this.preventScroll)&&t.preventDefault()};this.onTouchEnd=t=>{t.preventDefault()};this.onKeyDown=t=>{this.enabled!==!1&&(this.key=t.key)};this.onKeyUp=()=>{this.enabled!==!1&&(this.key=void 0,this.state!==-1&&this.onPointerUp(Mt[0]))};this.onPointerHover=t=>{if(!(Id||this.enabled===!1||this.state!==-1||this.hoverRotatePanMode===2&&this.isPanOverShoot||this.hoverRotatePanMode===1&&this.isRotateOverShoot)){if(window.clearTimeout(this.timerHover),this.isPointerDown=!0,this.isFirstHover){let r={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===2?this.handleMouseDownPan(r):this.hoverRotatePanMode===1&&this.handleMouseDownRotate(r),this.isFirstHover=!1}this.hoverRotatePanMode===2?this.handleMouseMovePan(t,Yy):this.hoverRotatePanMode===1&&this.handleMouseMoveRotate(t,Yy),this.timerHover=window.setTimeout(()=>{this.isPointerDown=!1},30)}};this.object=t,this.domElement=r,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.connect(),this.update()}reset(){this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.isFirstHover=!0,this.update(),this.state=-1}resetTo(t,r,n){this.target.copy(t),this.object.position.copy(r),this.object.zoom=n,this.object.updateProjectionMatrix(),this.dispatchEvent(Vy),this.update(),this.state=-1}fromJSON(t){this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.isFirstHover=!0,this.hoverRotatePanMode!==0&&this.domElement.addEventListener("pointermove",this.onPointerHover),Yy=(t.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/t.zoomLimits.max,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,AM=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let n=this.object.getTarget().applyQuaternion(Hy.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+n.y,this.maxV=t.panVerticalOffset.max+n.y,this.minH=-t.panHorizontalOffset.min+n.x,this.maxH=t.panHorizontalOffset.max+n.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=eo(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=eo(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=eo(this.spherical.theta-t.rotationHorizontalOffset.min),this.maxTheta=eo(this.spherical.theta+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,this.preventScroll=t.preventScroll,t.orbitTouches===1&&(this.touches[0]=En.ROTATE),t.panTouches===1&&(this.touches[0]=En.PAN),t.orbitTouches===2&&(this.touches[1]=En.DOLLY_ROTATE),t.panTouches===2&&(this.touches[1]=En.DOLLY_PAN),t.orbitTouches===3&&(this.touches[2]=En.ROTATE),t.panTouches===3&&(this.touches[2]=En.PAN)}connect(){this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("pointercancel",this.onPointerCancel),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),_u||(this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture)),this.domElement.addEventListener("touchmove",this.onTouchMove),this.domElement.addEventListener("touchend",this.onTouchEnd)}dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerCancel),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),_u||(this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture)),this.domElement.removeEventListener("touchmove",this.onTouchMove),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,r,n,s,o,a,l,c){this.overShoot.set(0,0);let u,h,f;t instanceof M?(u=t.x,h=t.y,this.current.set(this.target.x,this.target.y),f=!0):(u=t.theta,h=t.phi,this.current.set(eo(this.spherical.theta),eo(this.spherical.phi)),f=!1),n===0&&(this.current.x+=u,this.current.y+=h),(r===3||r===2)&&(!f&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x),s===o&&(u=0)),(r===3||r===1)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<l&&(this.overShoot.y=l-this.current.y),a===l&&(h=0)),f||(this.overShoot.x=eo(this.overShoot.x),this.overShoot.y=eo(this.overShoot.y)),n!==0?(this.overRatio.copy(this.overShoot).divide(c),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),n===1&&(this.overRatio.x=EM(Math.abs(this.overRatio.x)),this.overRatio.y=EM(Math.abs(this.overRatio.y))),this.isPointerDown||n===1?n===2&&(this.overRatio.x>.9||this.overRatio.y>.9)?this.isPointerDown=!1:(u*this.overShoot.x<0&&(u*=1-this.overRatio.x),h*this.overShoot.y<0&&(h*=1-this.overRatio.y)):n===2&&(!f&&(this.overRatio.x>.002||this.overRatio.y>.002)||f&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(u=this.overShoot.x*.05,h=this.overShoot.y*.05,f?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):f?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(u+=this.overShoot.x,h+=this.overShoot.y),t instanceof M?(t.x=u,t.y=h):(t.theta=u,t.phi=h)}setEnableDampingSpeed(t){this.enableDamping=t,jy=t===!0?.2:1}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*AM}getZoomScale(){return Math.pow(.95,TM)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,r){this.panLeftV.setFromMatrixColumn(r,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,r){this.panUpV.setFromMatrixColumn(r,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,r){let n=this.domElement;if(n&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/n.clientHeight,this.object.matrix),this.panUp(2*r*o/n.clientHeight,this.object.matrix)}else n&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this.panUp(r*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix));this.dispatchEvent(uO)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(MM)}zoomOut(t=this.getZoomScale()){this.dispatchEvent(Al),this.dollyOut(t),this.dispatchEvent(Fu)}zoomIn(t=this.getZoomScale()){this.dispatchEvent(Al),this.dollyIn(t),this.dispatchEvent(Fu)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,r=1){this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy*r).rotateAround(hO,-this.object.angleOffsetFromUp);let n=this.domElement;this.rotateLeft(2*Math.PI*this.rotateDelta.x/n.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/n.clientHeight),this.rotateStart.copy(this.rotateEnd),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,r=1){this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy*r),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd),this.update()}handleMouseWheel(t){if(US===!1&&Cu(t)===!1&&mO(t)===!0){if(this.enablePan===!1)return;this.gesture?(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(qy),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()):(this.gesture=!0,this.isPointerDown=!0),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1},30)}else{if(this.enableZoom===!1)return;t.deltaY===0?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}}handleTouchStartRotate(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.rotateStart.set(t,r)}else this.rotateStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartPan(){if(Mt.length===2){let t=.5*(Mt[0].pageX+Mt[1].pageX),r=.5*(Mt[0].pageY+Mt[1].pageY);this.panStart.set(t,r)}else this.panStart.set(Mt[0].pageX,Mt[0].pageY)}handleTouchStartDolly(){let t=Mt[0].pageX-Mt[1].pageX,r=Mt[0].pageY-Mt[1].pageY,n=Math.sqrt(t*t+r*r);this.dollyStart.set(0,n)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(Mt.length===2){let n=Xy(t),s=.5*(t.pageX+n.x),o=.5*(t.pageY+n.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==Mt[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(jy);let r=this.domElement;r&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/r.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/r.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(Mt.length===2){let r=Xy(t),n=.5*(t.pageX+r.x),s=.5*(t.pageY+r.y);this.panEnd.set(n,s)}else{if(t.pointerId!==Mt[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(qy),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let r=Xy(t),n=t.pageX-r.x,s=t.pageY-r.y,o=Math.sqrt(n*n+s*s);this.dollyEnd.set(0,o),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,TM)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}};function eo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function EM(i){return 1-Math.pow(1-i,4)}function mO(i){return i.wheelDeltaY===0||i.deltaY===0?Eu&&i.shiftKey&&Math.abs(i.wheelDeltaX)>=120?!1:i.wheelDeltaX?i.wheelDeltaX===-3*i.deltaX:i.deltaMode===0:i.wheelDeltaY?i.wheelDeltaY===-3*i.deltaY:i.deltaMode===0}var Mt=[],lp={};function gO(i){Mt.push(i)}function _M(i){delete lp[i.pointerId];for(let e=0;e<Mt.length;e++)if(Mt[e].pointerId===i.pointerId){Mt.splice(e,1);return}}function CM(i){let e=lp[i.pointerId];e===void 0&&(e=new N,lp[i.pointerId]=e),e.set(i.pageX,i.pageY)}function Xy(i){let e=i.pointerId===Mt[0].pointerId?Mt[1]:Mt[0];return lp[e.pointerId]}var to=class extends Wf{constructor(){super(),this.layers.enable(3)}setFromCamera(e,t){t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):t.isPerspectiveCamera?(this.ray.origin.set(e.x,e.y,-1).unproject(t),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):console.error("Raycaster: Unsupported camera type.")}intersectVisibleObjects(e,t=!0,r=[]){return e.forEach(n=>{n.visible&&this.intersectObject(n,t,r)}),r}createRaycastLineHelper(){let e=new Ur({color:65280,linewidth:10}),t=new M(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new M(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new M().addVectors(t,r.multiplyScalar(n)),o=new Ie;return o.setFromPoints([t,s]),new ns(o,e)}};var DM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,n=(a=t.radiusTop)!=null?a:r,s=(l=t.radiusBottom)!=null?l:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((u=t.depth)!=null?u:t.width),radiusTop:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:u,cornerRadius:h,cornerSegments:f,hollow:d}=i.parameters,p;return h||d?p=new Uu(c,u,r,n,s,o,a,l*Math.PI/180,h,h,f,d):p=new Co(c,u,r,n,s,o,a,l*Math.PI/180),p.scale(1,1,t/e),Object.assign(p,{userData:be(se({},i),{type:"CylinderGeometry"})})}};function ro(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function LM(i){return new N(i.y,-i.x)}var Uu=class extends Ie{constructor(e,t,r,n,s,o,a,l,c,u,h,f,d=!1){super(),this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||8,s=Math.floor(s)||1,o=o!==void 0?o:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,o&&(c=0,u=0);let p=[],m=[],g=[],v=[],y=0,w=r/2,b=new M,S=new M;d&&e==0&&(e=c),d&&t==0&&(t=u);let T=new N(e,w),A=new N(t,-w),x=null,E=null,_=null,C=null,P=T.clone().sub(A),B=0,R=0,U=0;f>0&&(B=Math.min(e,t)*(1-f),R=e-B,U=t-B);let z=T.clone();z.x-=B;let J=Math.PI-P.angle(),Q=P.angle(),X=Math.tan(Q/2),F=Math.tan(J/2),k=X+F,O=f?k:F,j=f?k:X;if(c=Math.min(c,(e-R)/O,P.length()/k),u=Math.min(u,(t-U)/j,P.length()/k),c>0){let le=c/X;x=T.clone().sub(new N(le,c)),f&&(_=x.clone(),_.x-=B-k*c),T.sub(P.clone().setLength(le))}if(u>0){let le=u/F;E=A.clone().sub(new N(le,-u)),A.add(P.clone().setLength(le)),f&&(C=E.clone(),C.x-=B-k*u,z.sub(P.clone().setLength(le)))}P=T.clone().sub(A);let q=P.length()<.5,K=[];for(let le=0;le<=n;le++){let H=[],ue=le/n,Z=ue*l+a,V=new N(Math.sin(Z),Math.cos(Z));C&&E?(W(H,ue,V,J,u,C,-1,!0),W(H,ue,V,Q,u,E,-1,!1)):E?(ge(H,V,E.x,0,-1),W(H,ue,V,Q,u,E,-1,!1)):o||ge(H,V,t,U,-1);let $=LM(P).normalize();if(ro($,V,b),!q)for(let ce=0;ce<=s;ce++){let ie=ce/s,pe=P.clone().multiplyScalar(ie).add(A);ro(pe,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(ue,.5+S.y/r),H.push(y++)}if(_&&x?(W(H,ue,V,J,c,x,1,!1),W(H,ue,V,Q,c,_,1,!0)):x?(W(H,ue,V,J,c,x,1,!1),ge(H,V,x.x,0,1)):o||ge(H,V,e,R,1),f&&!q){let ce=LM(P).multiplyScalar(-1).normalize();ro(ce,V,b);for(let ie=0;ie<=s;ie++){let pe=ie/s,ve=P.clone().multiplyScalar(-pe).add(z);ro(ve,V,S),m.push(S.x,S.y,S.z),g.push(b.x,b.y,b.z),v.push(ue,.5+S.y/r),H.push(y++)}}f&&!o&&H.push(H[0]),K.push(H)}for(let le=0;le<K.length-1;le++)for(let H=0;H<K[0].length-1;H++){if(o&&f&&H==s)continue;let ue=K[le][H],Z=K[le+1][H],V=K[le+1][H+1],$=K[le][H+1],ce=m[V*3+0],ie=m[V*3+2];p.push(ue,Z,$),(ce!=0||ie!=0)&&p.push(Z,V,$)}l<Math.PI*2&&(oe(-1,K[0],a),oe(1,K[K.length-1],a+l)),this.setIndex(p),this.setAttribute("position",new Le(m,3)),this.setAttribute("normal",new Le(g,3)),this.setAttribute("uv",new Le(v,2));function W(le,H,ue,Z,V,$,ce,ie){for(let pe=0;pe<h+1;pe++){let ve=pe/h,me=ce<0?ve:1-ve;ie&&(me-=1),me*=Z;let De=new N(Math.sin(me),Math.cos(me)*ce),ke=De.clone().multiplyScalar(V).add($);ro(ke,ue,S),m.push(S.x,S.y,S.z),ro(De,ue,b),g.push(b.x,b.y,b.z),v.push(H,.5+S.y/r),le.push(y++)}}function ge(le,H,ue,Z,V){let $=new M,ce=new N,ie=[ue,Z];V<0&&ie.reverse();for(let pe of ie)ce.set(pe,w*V),ro(ce,H,$),m.push($.x,$.y,$.z),g.push(0,V,0),v.push(.5,.5),le.push(y++)}function oe(le,H,ue){let Z=new N(Math.sin(ue),Math.cos(ue)),V=new N(-Math.cos(ue),Math.sin(ue)),$=new M,ce=le<0?(ve,me,De)=>p.push(ve,me,De):(ve,me,De)=>p.push(ve,De,me),ie=new N((e+t+R+U)/4,0);ro(ie,Z,$),m.push($.x,$.y,$.z),g.push(V.x,0,V.y),v.push(.5,.5);let pe=y++;for(let ve of H){let me=m.slice(ve*3,ve*3+3);m.push(...me),g.push(V.x,0,V.y);let De=v.slice(ve*2,ve*2+2);v.push(...De),y++}for(let ve=pe+1;ve<y-1;ve++)ce(pe,ve,ve+1);ce(pe,y-1,pe+1)}}};var PM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:u,cornerSegments:h}=i.parameters,f;return c>0||u>0||l<360?f=new Uu(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,h,0,!0):f=new Na(e/2,r,n,s,o),f.scale(1,1,t/e),Object.assign(f,{userData:be(se({},i),{type:"ConeGeometry"})})}};var IM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:o,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new mn(e,t,r,n,s,o):c=new Qy(e,t,r,n,s,o,a,l),Object.assign(c,{userData:be(se({},i),{type:"CubeGeometry"})})}},Jy=Math.PI/2,Qy=class extends Ie{constructor(e=1,t=1,r=1,n=1,s=1,o=1,a=0,l=4){super(),this.type="BoxBufferGeometry";let c=this;n=Math.floor(n),s=Math.floor(s),o=Math.floor(o),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let u=[],h=[],f=[],d=[],p=0,m=0;g("z","y","x",-1,-1,r,t,e,o,s,0),g("z","y","x",1,-1,r,t,-e,o,s,1),g("x","z","y",1,1,e,r,t,n,o,2),g("x","z","y",1,-1,e,r,-t,n,o,3),g("x","y","z",1,-1,e,t,r,n,s,4),g("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(v("z","y","x",-1,-1,1,r,t,e,o,0),v("z","y","x",1,-1,-1,r,t,e,o,1),v("z","y","x",-1,1,-1,r,t,e,o,1),v("z","y","x",1,1,1,r,t,e,o,0),v("x","y","z",-1,-1,-1,e,t,r,n,0),v("x","y","z",1,-1,1,e,t,r,n,1),v("x","y","z",-1,1,1,e,t,r,n,0),v("x","y","z",1,1,-1,e,t,r,n,1),v("y","x","z",-1,-1,1,t,e,r,s,0),v("y","x","z",1,-1,-1,t,e,r,s,1),v("y","x","z",1,1,1,t,e,r,s,1),v("y","x","z",-1,1,-1,t,e,r,s,0),y(1,1,1),y(-1,1,1),y(1,-1,1),y(-1,-1,1),y(1,1,-1),y(-1,1,-1),y(1,-1,-1),y(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Le(h,3)),this.setAttribute("normal",new Le(f,3)),this.setAttribute("uv",new Le(d,2));function g(w,b,S,T,A,x,E,_,C,P,B){let R=(x-2*a)/C,U=(E-2*a)/P,z=x/2-a,J=E/2-a,Q=_/2,X=C+1,F=P+1,k=0,O=0,j=new M;for(let q=0;q<F;q++){let K=q*U-J;for(let W=0;W<X;W++){let ge=W*R-z;j[w]=ge*T,j[b]=K*A,j[S]=Q,h.push(j.x,j.y,j.z),j[w]=0,j[b]=0,j[S]=_>0?1:-1,f.push(j.x,j.y,j.z),d.push(W/C),d.push(1-q/P),k+=1}}for(let q=0;q<P;q++)for(let K=0;K<C;K++){let W=p+K+X*q,ge=p+K+X*(q+1),oe=p+(K+1)+X*(q+1),le=p+(K+1)+X*q;u.push(W,ge,le),u.push(ge,oe,le),O+=6}c.addGroup(m,O,B),m+=O,p+=k}function v(w,b,S,T,A,x,E,_,C,P,B){let R=(E-2*a)/P,U=E/2-a,z=_/2-a,J=C/2,Q=P+1,X=0,F=0,k=new M,O=new M;for(let j=0;j<l+1;j++){let q=j/l*Jy,K=Math.sin(q)*a,W=(1-Math.cos(q))*a,ge=Math.sin(q),oe=Math.cos(q);k[b]=(z+K)*A,k[S]=(J-W)*x,O[w]=0,O[b]=ge*Math.sign(k[b]),O[S]=oe*Math.sign(k[S]);for(let le=0;le<Q;le++){let H=le*R-U;k[w]=H*T,h.push(k.x,k.y,k.z),f.push(O.x,O.y,O.z),d.push(le/P),d.push(0),X+=1}}for(let j=0;j<l;j++)for(let q=0;q<P;q++){let K=p+q+Q*j,W=p+q+Q*(j+1),ge=p+(q+1)+Q*(j+1),oe=p+(q+1)+Q*j;u.push(K,W,oe),u.push(W,ge,oe),F+=6}c.addGroup(m,F,B),m+=F,p+=X}function y(w,b,S){let T=new M,A=new M(e/2,t/2,r/2);A.subScalar(a);let x=[],E=w*b*S>0?(C,P,B)=>u.push(C,P,B):(C,P,B)=>u.push(C,B,P);for(let C=0;C<=l;C++){let P=[],B=Jy*(1-C/l),R=Math.cos(B),U=Math.sin(B),z=0;for(let J=0;J<=C;J++){let Q=Math.cos(z),X=Math.sin(z);T.x=R*Q,T.y=U,T.z=R*X;let F=A.clone().addScaledVector(T,a);h.push(w*F.x,b*F.y,S*F.z),f.push(w*T.x,b*T.y,S*T.z),d.push(0,0),P.push(p++),z+=Jy/C}x.push(P)}let _=x.length-1;for(let C=0;C<_;C++){let P=x[C],B=x[C+1],R=P.length-1;E(P[0],B[1],B[0]);for(let U=1;U<=R;U++)E(P[U-1],P[U],B[U]),E(P[U],B[U+1],B[U])}}}};var no=class extends Ie{constructor(e=[],t=[],r="",n=1,s=.2,o=4){super(),this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),h(),this.setAttribute("position",new Le(a,3)),this.setAttribute("normal",new Le(c,3)),this.setAttribute("uv",new Le(l,2));return;function u(){var X;s=Math.min(1-1e-5,s),s==0&&(o=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],p=new M,m=p.clone(),g=new Jt,v=s*n,y=n-v,w=o+1,b=new M,S=(F,k)=>b.subVectors(F,k).normalize(),T=(F,k)=>Array(F).fill(void 0).map(k),A=T(e.length/3,(F,k)=>new M().fromArray(e,k*3).setLength(n)),x=[],E=1e6;for(let F=0;F<A.length;F++){let k=A[F],O=[],j,q,K,W=1e10,ge=-1;for(;(ge=t.indexOf(F,ge+1))!=-1;){let ue=ge-ge%3;j=t[ue+(ge+1)%3],q=t[ue+(ge+2)%3],K=k.distanceToSquared(A[j]),W=Math.min(W,K),O.push([j,q,K])}W+=1e-6;let oe=[],le=0,H=O.length;for(let ue=0;ue<H;ue++){[j,q,K]=O[le];let Z=((X=x[j])==null?void 0:X.includes(F))==!0;K<=W&&oe.push(j+ +Z*E),le=O.findIndex(V=>V[0]==q)}x.push(oe)}let _=[];{let F=0,k=0,O,j,q=d==3;for(let K=0;K<=o;K++){O=K*(K+1)/2,j=(K+1)*(K+2)/2;for(let W=0;W<o-K;W++)[F,k]=[O+W+K+2,j+W+K+3],_.push(O,j,...q?[k,O]:[F,j],k,F),[O,j]=[F,k];_.push(O,j,O+o+2)}}let C=p.clone(),P=p.clone(),B=p.clone(),R=p.clone(),U=p.clone(),z=[],J=T(A.length,()=>T(d,()=>p.clone()));for(let F=0;F<A.length;F++){p.copy(A[F]).normalize(),C.copy(p).multiplyScalar(y);let k=x[F];for(let oe=0;oe<k.length;oe++){let le=k[oe],H=k[(oe+1)%d];g.setFromPointsAndIndices(A,F,le%E,H%E),g.b.sub(g.a).setLength(1e10).add(g.a),g.c.sub(g.a).setLength(1e10).add(g.a),g.closestPointToPoint(C,J[F][oe])}let O=[],j=[],q=[],K=new M;o==0&&[...J[F]].reduce((oe,le)=>oe.add(le),K).multiplyScalar(1/d);for(let oe=0;oe<d;oe++){let le=[],H=(oe-1+d)%d,ue=J[F][H],Z=J[F][oe];p.copy(ue).sub(C),m.copy(Z).sub(C);let V=C.angleTo(p),$=p.angleTo(m),ce=Math.cos(V)*v;o==0?P.copy(K):P.copy(C).setLength(y+ce),j.push(ce);let ie=[P,ue,Z];for(let pe=0;pe<2;pe++){let ve=ie[pe],me=ie[pe+1];R.subVectors(ve,C),U.subVectors(me,C),B.crossVectors(R,U).normalize();for(let De=0;De<w;De++){let ke=[V,$][pe]*De/w;p.copy(R).applyAxisAngle(B,ke).add(C),O.push(p.clone()),pe&&(S(p,C),le.push([De==0?ve:p.clone(),b.clone()]))}pe&&(S(me,C),le.push([me,b.clone()]))}q.push(le)}z.push(q);let W=2*w,ge=2;for(let oe=0;oe<d;oe++){let le=W*oe,H=W*((oe+1)%d),ue=[O[le]];for(let V=1;V<w;V++){R=O[le+V],U=O[H+V],ue.push(R);for(let $=1,ce=V-ge+1;$<=ce;$++)p.lerpVectors(R,U,$/(ce+1)),p.sub(C).setLength(j[oe]).add(C),ue.push(p.clone());ue.push(U)}for(let V=0;V<w;V++)ue.push(O[V+w+le]);ue.push(O[H+w]);let Z=_.map(V=>ue[V]);a.push(...Z.map(V=>[V.x,V.y,V.z]).flat()),c.push(...Z.map(V=>(S(V,C),[b.x,b.y,b.z])).flat())}}let Q=[];for(let F=0;F<x.length;F++)for(let k=0;k<d;k++){let O=x[F][k];if(O<E){let j=x[O].findIndex(W=>W%E==F),q=z[F][k],K=z[O][j];for(let W=0;W<w;W++){let ge=q[W],oe=K[w-W],le=q[W+1],H=K[w-(W+1)];[ge,oe,le,le,oe,H].forEach(ue=>{a.push(ue[0].x,ue[0].y,ue[0].z),c.push(ue[1].x,ue[1].y,ue[1].z)})}Q.push(q[0][0],K[w][0],q[w][0],K[0][0])}}for(;Q.length;){let F,k,O,j;[F,k]=Q.splice(0,2);let q=[F];for(;F!=k;)q.push(k),O=Q.indexOf(k),j=O%2,k=Q.splice(O-j,2)[1-j];b.subVectors(q[0],q[1]).cross(p.subVectors(q[0],q[2])).normalize();let K=b.dot(q[0])<0;K&&b.negate();for(let W=1;W<=q.length-2;W++)[q[W+ +K],q[W+1-+K],q[0]].forEach(ge=>{a.push(ge.x,ge.y,ge.z),c.push(b.x,b.y,b.z)})}}function h(){let f=new M;for(let A=0;A<a.length;A+=3){f.x=a[A+0],f.y=a[A+1],f.z=a[A+2];let x=S(f)/2/Math.PI+.5,E=T(f)/Math.PI+.5;l.push(x,1-E)}let d=new M,p=new M,m=new M,g=new M,v=new N,y=new N,w=new N,b=(A,x,E,_)=>{_<0&&A.x===1&&(l[x]=A.x-1),E.x===0&&E.z===0&&(l[x]=_/2/Math.PI+.5)};for(let A=0,x=0;A<a.length;A+=9,x+=6){d.set(a[A+0],a[A+1],a[A+2]),p.set(a[A+3],a[A+4],a[A+5]),m.set(a[A+6],a[A+7],a[A+8]),v.set(l[x+0],l[x+1]),y.set(l[x+2],l[x+3]),w.set(l[x+4],l[x+5]),g.copy(d).add(p).add(m).divideScalar(3);let E=S(g);b(v,x+0,d,E),b(y,x+2,p,E),b(w,x+4,m,E)}for(let A=0;A<l.length;A+=6){let x=l[A+0],E=l[A+2],_=l[A+4],C=Math.max(x,E,_),P=Math.min(x,E,_);C>.9&&P<.1&&(x<.2&&(l[A+0]+=1),E<.2&&(l[A+2]+=1),_<.2&&(l[A+4]+=1))}function S(A){return Math.atan2(A.z,-A.x)}function T(A){return Math.atan2(-A.y,Math.sqrt(A.x*A.x+A.z*A.z))}}}static fromJSON(e){return new no(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};var RM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new zu(e*.5,s,o):new Fa(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"DodecahedronGeometry"})})}},zu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,o=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(o,a,l,e,t,r),this.type=l}static fromJSON(e){return new zu(e.radius,e.corner,e.cornerSides)}};var Gu=1e-12,Tl=class{constructor(e){this.position=new N;this.startPosition=new N;this.uuid=tt.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Tl(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},El=class extends Tl{constructor(t){super(t.position);this.parent=t}copy(t){return super.copy(t),this}clone(){return new El(this.parent).copy(this)}},ci=class extends Tl{constructor(t,r){super(r);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=t,this.controls.push(new El(this),new El(this))}static create(t,r){let n=new ci(t,new N(...r.position));return n.controls[0].position.set(...r.controlPrevious.position),n.controls[1].position.set(...r.controlNext.position),n.roundness=r.roundness,n.areControlsDirectionsMirrored=r.areControlsDirectionsMirrored,n}getOppositeControl(t){let r=this.controls.indexOf(t);return r===0?this.controls[1]:r===1?this.controls[0]:null}applyOffsetToControls(t,r=1){for(let n=0,s=this.controls.length;n<s;n++){let o=this.controls[n];this.position.distanceTo(o.position)<=r?o.position.copy(this.position):o.applyOffset(t)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(t){return super.copy(t),this.controls[0].copy(t.controls[0]),this.controls[1].copy(t.controls[1]),this.roundness=t.roundness,this.uuid=t.uuid,this}clone(){return new ci(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Ky=i=>i,Vu=new N,Zy=new N,yO=new N,vO=new N,xO=new N,bO=new N,BM=new M,NM=new M;function OM(i){let e=new N;e.addVectors(i.v0,Vu.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new N;return t.addVectors(i.v2,Zy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new sn(i.v0,e,t,i.v2)}function ku(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function wO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function SO(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function $y(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function FM(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,c=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(a+l,o+c),n.set(a-l,o-c),[r,n]}function UM(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function zM(i,e,t,r,n,s){let o=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,u=Math.sqrt((o+l)*(o+l)+(a+c)*(a+c)),h;return $y(e,i,t)>Math.PI&&(u*=-1),ku(c,a)?h=(a+c)*(r/u-.5)*8/3/(o-l):h=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-h*a,e.y+h*o),s.set(t.x+h*c,t.y-h*l),[n,s]}function ev(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function GM(i,e,t,r,n=.5){let s=Vu.subVectors(e,i).multiplyScalar(n).add(i),o=Zy.subVectors(t,e).multiplyScalar(n).add(e),a=yO.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=vO.subVectors(o,s).multiplyScalar(n).add(s),u=xO.subVectors(a,o).multiplyScalar(n).add(o),h=a,f=bO.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,f.x,f.y,u.x,u.y,h.x,h.y,r.x,r.y]}function kM(i,e,t=12,r=!0){let n=NM.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=Ky(e[l]),u=Vu,h=io(c,t);a.push(h);for(let f=0;f<=h;f++)if(c instanceof sn||c instanceof Gn||c instanceof on){if(c.getPoint(f/h,u),n.set(u.x,u.y,0),s!==void 0&&SO(s,n))continue;s===void 0&&(s=BM),s.copy(n),i.setXYZ(o,n.x,n.y,n.z),o++}}return r&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),i}function VM(i,e,t,r=12,n=!0){let s=NM.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=Ky(e[l]),h=Vu,f=io(u,r);a.push(f);for(let d=0;d<=f;d++)if(u instanceof sn||u instanceof Gn||u instanceof on){if(u.getPoint(d/f,h),s.set(h.x,h.y,0),c!=null&&c.equals(s))continue;c===void 0?c=BM:(i.setXYZ(o,c.x,c.y,c.z),o++,i.setXYZ(o,s.x,s.y,s.z),o++),c.copy(s)}}return n&&o>1&&!(i.getX(o-1)===i.getX(0)&&i.getY(o-1)===i.getY(0)&&i.getZ(o-1)===i.getZ(0))&&(i.setXYZ(o,i.getX(0),i.getY(0),i.getZ(0)),o++),a}function tv(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let o=i[n],a=0;if(t&&o.roundedCurveCorner!==void 0){let l=io(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=io(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=io(i[0].roundedCurveCorner,e)*.5),r}function io(i,e=12){return i&&i instanceof Bs?e*2:i&&(i instanceof on||i instanceof tu)?1:i&&i instanceof _o?e*i.points.length:e}function HM(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=Ky(e[o]),l=io(a,t),c=Vu;for(let u=0;u<=l;u++)if(a instanceof sn||a instanceof Gn||a instanceof on){if(a.getPoint(u/l,c),n!==void 0&&wO(n,c,Gu))continue;n===void 0&&(n=Zy),n.copy(c),i.push(c.x,c.y),s++}}return ku(i[0],i[i.length-2],Gu)&&ku(i[1],i[i.length-1],Gu)&&(i.pop(),i.pop()),r&&s>1&&!(ku(i[s-1],i[1],Gu)&&ku(i[s-2],i[0],Gu))&&(i.push(i[0],i[1]),s++),i}var rv=new N,MO=new N,AO=new N,TO=new N,EO=new N,_O=new N,At=class extends en{constructor(t=100,r=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new jt;this.plane=new Fr(new M(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=tt.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=t,this._height=r}static createFromState(t,r,n){let s=new At;return s.isClosed=t.isClosed,s.points=t.points.map(o=>ci.create(o.id,o.data)),typeof t.roundness=="number"&&(s.roundness=t.roundness),s.shapeHoles=t.shapeHoles.map(o=>At.createFromState(o)),r!==void 0&&n!==void 0&&s.applySize(r,n),s.update(),s}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(t){if(this._roundness!==t){this._roundness=t;for(let r=0,n=this.points.length;r<n;r++)this.points[r].roundness=t;this.needsUpdate=!0}}getPointsIndexesByIds(t){return t.map(r=>this.getPointIndexById(r)).filter(r=>r>=0)}getPointIndexById(t){return this.points.findIndex(r=>r.uuid===t)}getLineIndexById(t){return this.getPointIndexById(t)}getBezierPoint(t){if(t<=this.points.length-1)return this.points[t];if(this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=t-this.points.length;if(o<=s.points.length-1)return s.points[o]}throw new Error("This shape does not have a point for this index: "+t)}getBezierPointIndex(t){let r=this.points.indexOf(t);if(r>=0)return r;if(r=this.points.length,this.shapeHoles.length>0)for(let n=0,s=this.shapeHoles.length;n<s;n++){let o=this.shapeHoles[n],a=o.points.indexOf(t);if(a>=0)return r+a;r+=o.points.length}return-1}getAllPoints(){let t=[].concat(...this.shapeHoles.map(r=>r.points));return[...this.points,...t]}applySize(t,r){t===0&&(t=.001),r===0&&(r=.001),this._width=t,this._height=r}applyScale(t,r){let n=rv.set(t,r);for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];a.position.multiply(n),a.controls[0].position.multiply(n),a.controls[1].position.multiply(n)}for(let s=0,o=this.shapeHoles.length;s<o;s++)this.shapeHoles[s].applyScale(t,r);this._update(!1)}createPoint(t,r=0,n=tt.generateUUID()){let s;t instanceof N?s=t:s=new N(t,r);let o=new ci(n,s);return o.roundness=this.roundness,o}addPoint(t){this.points.push(t),this.needsUpdate=!0}addPointAt(t,r){this.points.splice(r,0,t),this.needsUpdate=!0}getPointByUuid(t){for(let r=0,n=this.points.length;r<n;r++){let s=this.points[r];if(s.uuid===t)return s}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(t){let r=this.points.indexOf(t);r>=0&&this.points.splice(r,1),this.needsUpdate=!0}removePointById(t){let r=this.points.find(n=>n.uuid===t);r&&this.removePoint(r)}update(t=!0){for(let r=0,n=this.shapeHoles.length;r<n;r++)this.shapeHoles[r].update(!1);this._update(t)}extractShapePointsToBuffer(t,r=12,n=!1){this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r);let s=n?this.roundedCurveDivisions:this.curveDivisions;return kM(t,n?this.roundedCurves:this.curves,r,this.autoClose),s.reduce((o,a)=>o+a,0)+1}computeCurveDivisions(t=12){return this.curveDivisions=tv(this.points,t,!1),this.roundedCurveDivisions=tv(this.points,t,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(t,r,n=12){return VM(t,this.curves,r,n,this.autoClose).reduce((o,a)=>o+a,0)*2}extractShapePointsToFlatArray(t,r=12){return this.subdivision=r,this.curveDivisions===void 0&&this.computeCurveDivisions(r),HM(t,this.roundedCurves,r,this.autoClose)}getCurveIndexFromVertexId(t,r=!1){let n=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let s=r?this.roundedCurveDivisions:this.curveDivisions,o=0;r&&this.points[0].roundedCurveCorner!==void 0&&(o=io(this.points[0].roundedCurveCorner,this.subdivision)*.5);let a=t-o;a<0&&(a+=s.reduce((l,c)=>l+c,0));for(let l=0,c=s.length;l<c;l++){let u=s[l];if(a<n+u)return[l,(a-n+1)/u];n+=u}return[0,1]}getCurveT(t,r,n){let s=this.points[t],o=this.points[t>=this.points.length-1?0:t+1],a=this.curveDivisions,l=a[t];if(ev(s,o)){let h=s.position.distanceTo(o.position);return s.position.distanceTo(rv.set(n.x,n.y))/h}let c=0;for(let h=0;h<t;h++)c+=a[h];return(r-c)/l}dispose(){this.eventDispatcher=null}_applyCurveForPoint(t,r){ev(r,t)?this.lineTo(t.position.x,t.position.y):this.bezierCurveTo(r.controls[1].position.x,r.controls[1].position.y,t.controls[0].position.x,t.controls[0].position.y,t.position.x,t.position.y);let n=this.curves[this.curves.length-1];t.curveBefore=n,r.curveAfter=n;let s=n.clone();t.roundedCurveBefore=s,r.roundedCurveAfter=s,t.roundedCurveCorner=void 0,this.roundedCurves.push(s)}_update(t=!0){var n;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s];if(s===0)this.moveTo(a.position.x,a.position.y);else{let l=this.points[s-1];this._applyCurveForPoint(a,l)}}let r=this.getLastPoint();if(r!=null&&r.curveAfter&&(r.curveAfter=void 0),this.isClosed){let s=this.points[0],o=this.points[this.points.length-1];this._applyCurveForPoint(s,o)}if(this.points.length>2){let s=0;for(let o=0,a=this.points.length;o<a;o++){let l=this.points[o],c=l.roundness;if(!l.controlsMoved()&&c>0){let u=l.curveBefore,h=l.curveAfter;if(u===void 0||h===void 0)continue;let f=l.roundedCurveBefore,d=l.roundedCurveAfter,p=u.getLength(),m=h.getLength(),g=Math.min(c,p*.499),v=Math.min(c,m*.499),y=Math.min(g,v),w=1-y/p,b=y/m,S=u.getPointAt(w,rv),T=h.getPointAt(b,MO);this._subSplitCurve(u,f,w,S,void 0),this._subSplitCurve(h,d,b,void 0,T);let A;if(this.useCubicForRoundedCorners){let x=$y(S,l.position,T)/2,E=Math.tan(x)*S.distanceTo(l.position),[_,C]=FM(S,T,E,AO,TO),P=UM(_,C,l.position),[B,R]=zM(P,S,T,E,EO,_O);A=new sn(S.clone(),B.clone(),R.clone(),T.clone())}else A=new Gn(S.clone(),l.position.clone(),T.clone());l.roundedCurveCorner=A,this.roundedCurves.splice(o+s,0,A),s++}}}t&&((n=this.eventDispatcher)==null||n.dispatchEvent({type:"update"}))}_subSplitCurve(t,r,n,s,o){if(t instanceof on)s!==void 0&&r.v2.copy(s),o!==void 0&&r.v1.copy(o);else{let a=t,l=r,c=a.getUtoTmapping(n,0),u=GM(a.v0,a.v1,a.v2,a.v3,c);return s!==void 0&&(l.v0.set(u[0],u[1]),l.v1.set(u[2],u[3]),l.v2.set(u[4],u[5]),l.v3.set(u[6],u[7])),o!==void 0&&(l.v0.set(u[6],u[7]),l.v1.set(u[8],u[9]),l.v2.set(u[10],u[11]),l.v3.set(u[12],u[13])),l}return r}clone(){let t=new At(this._width,this._height);return t.points=this.points.map(r=>r.clone()),t.isClosed=this.isClosed,t.roundness=this.roundness,t.isMesh2D=this.isMesh2D,t.shapeHoles=this.shapeHoles.map(r=>r.clone()),t}toJSON(){return{points:this.points.reduce((t,r)=>t.concat(r.toJSON()),[]),shapeHoles:this.shapeHoles.map(t=>t.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(t){var n;this.points=[],this.pointIDs=0;let r=t.points.length/7;for(let s=0;s<r;s++){let o=s*7,a=t.points[o+0],l=t.points[o+1],c=t.points[o+2],u=t.points[o+3],h=t.points[o+4],f=t.points[o+5],d=t.points[o+6],p=new ci(tt.generateUUID(),new N(a,l));p.controls[0].position.set(c,u),p.controls[1].position.set(h,f),p.roundness=d,this.points.push(p)}return this.shapeHoles=(n=t.shapeHoles)!=null&&n.length?t.shapeHoles.map(s=>{let o=new At;return o.fromJSON(s),o}):[],this.isClosed=t.isClosed,this._roundness=t.roundness,this._update(),this}fromShape(t){let r=(s,o)=>{o instanceof sn&&o.v3.equals(s.position)&&s.controls[0].position.copy(o.v2)},n=s=>{let o=[],a,l;for(a=0,l=s.length;a<l;a++)s[a]instanceof Gn&&(s[a]=OM(s[a]));for(a=0,l=s.length;a<l;a++){let h=s[a],f=a>0?s[a-1]:null,d;h instanceof sn?(d=this.createPoint(h.v0),d.controls[1].position.copy(h.v1)):h instanceof on&&(d=this.createPoint(h.v1)),d!==void 0&&(f!==null&&r(d,f),o.push(d))}let c=s[s.length-1],u=!1;return c instanceof sn?c.v3.equals(o[0].position)&&(o[0].controls[0].position.copy(c.v2),u=!0):c instanceof on&&c.v2.equals(o[0].position)&&(u=!0),this.isClosed=u,o};return this.points=n(t.curves),t instanceof en&&(this.shapeHoles=t.holes.map(s=>{let o=new At;return o.fromShape(s),o})),this.update(),this}};var iv=Math.PI*2;function nv({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function CO(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),o=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+o*t,y:o-s*t},{x:s,y:o}]}function WM(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function LO(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),h=Math.pow(s,2),f=Math.pow(o,2),d=Math.pow(a,2),p=u*h-u*d-h*f;p<0&&(p=0),p/=u*d+h*f,p=Math.sqrt(p)*(l===c?-1:1);let m=p*n/s*a,g=p*-s/n*o,v=m+(i+t)/2,y=g+(e+r)/2,w=(o-m)/n,b=(a-g)/s,S=(-o-m)/n,T=(-a-g)/s,A=WM(1,0,w,b),x=WM(w,b,S,T);return!c&&x>0&&(x-=iv),c&&x<0&&(x+=iv),{centerx:v,centery:y,ang1:A,ang2:x}}function jM({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:o,sweepFlag:a}){let l=[];if(n===0||s===0)return[];let c=(i-t)/2,u=(e-r)/2;if(c===0&&u===0)return[];n=Math.abs(n),s=Math.abs(s);let h=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);h>1&&(n*=Math.sqrt(h),s*=Math.sqrt(h));let f=LO(i,e,t,r,n,s,c,u,o,a),{ang1:d,ang2:p}=f,{centerx:m,centery:g}=f,v=Math.abs(p)/(iv/4);Math.abs(1-v)<1e-7&&(v=1);let y=Math.max(Math.ceil(v),1);p/=y;for(let w=0;w<y;w++)l.push(CO(d,p)),d+=p;return l.map(w=>{let{x:b,y:S}=nv(w[0],n,s,m,g),{x:T,y:A}=nv(w[1],n,s,m,g),{x,y:E}=nv(w[2],n,s,m,g);return{x1:b,y1:S,x2:T,y2:A,x,y:E}})}var Kt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Kt||(Kt={}));var Mr;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Mr||(Mr={}));function qe(i,e){if(!i)throw e||"Assertion Failed!"}var ze=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){qe(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){qe(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var o,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,n)||(l=r,r=n,n=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.vertLeq(r,t)?i.vertLeq(t,n)?(o=i.edgeEval(e,r,t),a=i.edgeEval(r,t,n),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,t.s)):(o=i.edgeSign(e,r,t),a=-i.edgeSign(e,n,t),o+a<0&&(o=-o,a=-a),s.s=i.interpolate(o,r.s,a,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,n)||(l=r,r=n,n=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=n,n=l),i.transLeq(r,t)?i.transLeq(t,n)?(o=i.transEval(e,r,t),a=i.transEval(r,t,n),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,t.t)):(o=i.transSign(e,r,t),a=-i.transSign(e,n,t),o+a<0&&(o=-o,a=-a),s.t=i.interpolate(o,r.t,a,n.t)):s.t=(r.t+t.t)/2},i}(),Hu=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),cp=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),_l=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),qM=function(){function i(){var e=new _l,t=new Hu,r=new cp(0),n=new cp(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new cp(0),r=new cp(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;qe(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var o=t;do o.Org=n,o=o.Onext;while(o!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;qe(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var o=t;do o.Lface=n,o=o.Lnext;while(o!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,o=e.next;o.prev=s,s.next=o},i.prototype.makeEdge=function(){var e=new _l,t=new _l,r=new Hu,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new _l;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new Hu;this.makeFace_(o,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var n=new Hu;this.makeFace_(n,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new _l;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var o=new Hu;this.makeFace_(o,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,o,a;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);o=e.prev,a=e.next,a.prev=o,o.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,o,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,o=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(s.Lface),a+l-2<=e&&ze.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&ze.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===o);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,o,a,l,c;for(s=e,s=e;(n=s.next)!==e;s=n){qe(n.prev===s),l=n.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(qe(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){qe(o.prev===a),l=o.anEdge;do qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l),qe(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(qe(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)qe(l.Sym.next===c.Sym),qe(l.Sym!==l),qe(l.Sym.Sym===l),qe(l.Org!==null),qe(l.Dst!==null),qe(l.Lnext.Onext.Sym===l),qe(l.Onext.Sym.Lnext===l);qe(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),YM=function(){function i(){this.handle=null}return i}(),XM=function(){function i(){this.key=null,this.node=0}return i}(),DO=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new YM,this.handles[r]=new XM;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e<<1,o<this.size&&this.leq(r[t[o+1].handle].key,r[t[o].handle].key)&&++o,qe(o<=this.max),s=t[o].handle,o>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,o;for(n=t[e].handle;;){if(o=e>>1,s=t[o].handle,o===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=o}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new YM;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new XM}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;qe(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),sv=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),JM=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),PO=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new JM,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new JM;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),IO=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,o=r.eUp;if(s.Dst===n)return o.Dst===n?ze.vertLeq(s.Org,o.Org)?ze.edgeSign(o.Dst,s.Org,o.Org)<=0:ze.edgeSign(s.Dst,o.Org,s.Org)>=0:ze.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return ze.edgeSign(s.Dst,n,s.Org)>=0;var a=ze.edgeEval(s.Dst,n,s.Org),l=ze.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&qe(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){qe(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new sv;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Kt.ODD:return(t&1)!==0;case Kt.NONZERO:return t!==0;case Kt.POSITIVE:return t>0;case Kt.NEGATIVE:return t<0;case Kt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,o=t,a=t.eUp;o!==r;){if(o.fixUpperEdge=!1,s=i.regionBelow(o),n=s.eUp,n.Org!=a.Org){if(!s.fixUpperEdge){i.finishRegion(e,o);break}n=e.mesh.connect(a.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}a.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(a,n)),i.finishRegion(e,o),a=s.eUp,o=s}return a},i.addRightEdges=function(e,t,r,n,s,o){var a,l,c,u,h=!0;c=r;do qe(ze.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),l=t,u=s;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===u.Org;)c.Onext!==u&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(u.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!h&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),h=!1,l=a,u=c;l.dirty=!0,qe(l.windingNumber-c.winding===a.windingNumber),o&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=ze.vertL1dist(t,e),s=ze.vertL1dist(r,e),o=.5*s/(n+s),a=.5*n/(n+s);e.coords[0]+=o*t.coords[0]+a*r.coords[0],e.coords[1]+=o*t.coords[1]+a*r.coords[1],e.coords[2]+=o*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,o){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,o)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(ze.vertLeq(n.Org,s.Org)){if(ze.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;ze.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(ze.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o;if(qe(!ze.vertEq(n.Dst,s.Dst)),ze.vertLeq(n.Dst,s.Dst)){if(ze.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,o=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,o),o.Lface.inside=t.inside}else{if(ze.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,o=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),o.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,o=n.Org,a=s.Org,l=n.Dst,c=s.Dst,u,h,f=new _l,d,p;if(qe(!ze.vertEq(c,l)),qe(ze.edgeSign(l,e.event,o)<=0),qe(ze.edgeSign(c,e.event,a)>=0),qe(o!==e.event&&a!==e.event),qe(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),h=Math.max(a.t,c.t),u>h))return!1;if(ze.vertLeq(o,a)){if(ze.edgeSign(c,o,a)>0)return!1}else if(ze.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),ze.intersect(l,o,c,a,f),qe(Math.min(o.t,l.t)<=f.t),qe(f.t<=Math.max(a.t,c.t)),qe(Math.min(c.s,l.s)<=f.s),qe(f.s<=Math.max(a.s,o.s)),ze.vertLeq(f,e.event)&&(f.s=e.event.s,f.t=e.event.t),d=ze.vertLeq(o,a)?o:a,ze.vertLeq(d,f)&&(f.s=d.s,f.t=d.t),ze.vertEq(f,o)||ze.vertEq(f,a)?(i.checkForRightSplice(e,t),!1):!ze.vertEq(l,e.event)&&ze.edgeSign(l,e.event,f)>=0||!ze.vertEq(c,e.event)&&ze.edgeSign(c,e.event,f)<=0?c===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):l===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),p=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,p,!0),!0):(ze.edgeSign(l,e.event,f)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),ze.edgeSign(c,e.event,f)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=f.s,n.Org.t=f.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,o,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,o=i.regionBelow(t),a=t.eUp,l=o.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ze.vertEq(a.Org,e.event)&&(e.mesh.splice(s.Oprev,a),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),o),c=!0),ze.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,o,null),c=!0),c){i.addRightEdges(e,t,r.Onext,s,s,!0);return}ze.vertLeq(l.Org,a.Org)?n=l.Oprev:n=a,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,o,a,l;if(n=t.eUp,ze.vertEq(n.Org,r)){qe(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!ze.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}qe(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(qe(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),ze.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,o.Onext,a,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,o,a,l,c=new sv;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,ze.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=ze.vertLeq(a.Dst,o.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)l=e.mesh.connect(t.anEdge.Sym,o.Lnext);else{var u=e.mesh.connect(a.Dnext,t.anEdge);l=u.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);qe(n!==null);var s=i.regionBelow(n),o=s.eUp,a=i.finishLeftRegions(e,s,null);a.Onext===o?i.connectRightVertex(e,n,a):i.addRightEdges(e,n,a.Onext,o,o,!0)},i.addSentinel=function(e,t,r,n){var s=new sv,o=e.mesh.makeEdge();o.Org.s=r,o.Org.t=n,o.Dst.s=t,o.Dst.t=n,e.event=o.Dst,s.eUp=o,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},i.initEdgeDict=function(e){e.dict=new PO(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,o=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,n,s,o),i.addSentinel(e,n,s,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(qe(t.fixUpperEdge),qe(++r===1)),qe(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,ze.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new DO(s,ze.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,qe(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!ze.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),RO=function(){function i(){this.mesh=new qM,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Kt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,n,s,o,a,l=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[null,null,null],p=[null,null,null],m=this.mesh.vHead;t=m.next;for(var g=0;g<3;++g)s=t.coords[g],c[g]=s,p[g]=t,l[g]=s,d[g]=t;for(t=m.next;t!==m;t=t.next)for(var v=0;v<3;++v)s=t.coords[v],s<c[v]&&(c[v]=s,p[v]=t),s>l[v]&&(l[v]=s,d[v]=t);var y=0;if(l[1]-c[1]>l[0]-c[0]&&(y=1),l[2]-c[2]>l[y]-c[y]&&(y=2),c[y]>=l[y]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=p[y],n=d[y],u[0]=r.coords[0]-n.coords[0],u[1]=r.coords[1]-n.coords[1],u[2]=r.coords[2]-n.coords[2],t=m.next;t!==m;t=t.next)h[0]=t.coords[0]-n.coords[0],h[1]=t.coords[1]-n.coords[1],h[2]=t.coords[2]-n.coords[2],f[0]=u[1]*h[2]-u[2]*h[1],f[1]=u[2]*h[0]-u[0]*h[2],f[2]=u[0]*h[1]-u[1]*h[0],o=f[0]*f[0]+f[1]*f[1]+f[2]*f[2],o>a&&(a=o,e[0]=f[0],e[1]=f[1],e[2]=f[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(u)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,o=e.next;o!==e;o=o.next)if(n=o.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==o.anEdge);if(s<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),r=this.sUnit,n=this.tUnit;var o=this.longAxis_(t);r[o]=0,r[(o+1)%3]=1,r[(o+2)%3]=0,n[o]=0,n[(o+1)%3]=0,n[(o+2)%3]=t[o]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,n);s&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ze.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ze.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(ze.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(ze.edgeGoesLeft(n.Lnext)||ze.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(ze.edgeGoesRight(r.Lprev)||ze.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,o=0,a=0,l;r>3&&e.mergeConvexFaces(r);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var u=e.fHead.next;u!==e.fHead;u=u.next)if(u.n=-1,!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;c.n===-1&&(c.n=a,a++),l++,s=s.Lnext}while(s!==u.anEdge);if(l>r)throw"Face vertex greater that support polygon";u.n=o,++o}this.elementCount=o,t===Mr.CONNECTED_POLYGONS&&(o*=2),this.elements=[],this.elements.length=o*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*n,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var h=c.n*n;this.vertices[h+0]=c.coords[0],this.vertices[h+1]=c.coords[1],n>2&&(this.vertices[h+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var f=0,u=e.fHead.next;u!==e.fHead;u=u.next)if(!!u.inside){s=u.anEdge,l=0;do{var c=s.Org;this.elements[f++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var d=l;d<r;++d)this.elements[f++]=-1;if(t===Mr.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[f++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var p=l;p<r;++p)this.elements[f++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,s=0,o=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){n=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,u=0;s=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=0,n=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,o++,r=r.Lnext;while(r!==n);this.elements[u++]=s,this.elements[u++]=o,s+=o}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new qM),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,o){if(e===void 0&&(e=Kt.ODD),t===void 0&&(t=Mr.POLYGONS),o===void 0&&(o=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),IO.computeInterior(this,o);var a=this.mesh;return t===Mr.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===Mr.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function Wo(i){var e=i.windingRule,t=e===void 0?Kt.ODD:e,r=i.elementType,n=r===void 0?Mr.POLYGONS:r,s=i.polySize,o=s===void 0?3:s,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,u=c===void 0?[0,0,1]:c,h=i.contours,f=h===void 0?[]:h,d=i.strict,p=d===void 0?!0:d,m=i.debug,g=m===void 0?!1:m;if(!f&&p)throw new Error("Contours can't be empty");if(!!f){var v=new RO;i.edgeCreateCallback&&(v.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(v.vertexIdCallback=i.vertexIdCallback);for(var y=0;y<f.length;y++)v.addContour(l||2,f[y]);return v.tesselate(t,n,o,l,u,p),{vertices:v.vertices,vertexIndices:v.vertexIndices,vertexCount:v.vertexCount,elements:v.elements,elementCount:v.elementCount,mesh:g?v.mesh:void 0}}}var t7=Kt.ODD,r7=Kt.NONZERO,n7=Kt.POSITIVE,i7=Kt.NEGATIVE,s7=Kt.ABS_GEQ_TWO,o7=Mr.POLYGONS,a7=Mr.CONNECTED_POLYGONS,l7=Mr.BOUNDARY_CONTOURS;var Cl=class extends Ie{constructor(t,r=12,n={}){var p,m,g;super();this.type="ShapeGeometry";this.windingRule=Kt.ODD;this.elementType=Mr.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._shape=t,this._curveSegments=r,this._triangulationOptions=Object.assign({windingRule:Kt.ODD,elementType:Mr.POLYGONS,polySize:3,vertexSize:2,strict:!0},n);let s=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(v=>v.extractShapePointsToFlatArray([],this._curveSegments)),a,l=!0,c=!0,u,h;for(let v=0,y=s.length/2;v<y;v++){let w=v*2,b=s[w+0],S=s[w+1];if(u!==void 0&&b!==u&&(l=!1),h!==void 0&&S!==h&&(c=!1),u=b,h=S,!l&&!c)break}!l&&!c&&(a=Wo({contours:[s,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict}));let f=(p=a==null?void 0:a.vertexCount)!=null?p:1,d=(m=a==null?void 0:a.elementCount)!=null?m:1;if(this._positionAttribute=new Ue(new Float32Array(f*3),3),this._normalAttribute=new Ue(new Float32Array(f*3),3),this._uvAttribute=new Ue(new Float32Array(f*2),2),this._indexAttribute=new Ue(new Uint32Array(d*3),1),a){let v=1/0,y=-1/0,w=1/0,b=-1/0;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1];_<v&&(v=_),_>y&&(y=_),C<w&&(w=C),C>b&&(b=C)}let S=y-v,T=b-w;for(let A=0,x=f;A<x;A++){let E=A*2,_=a.vertices[E+0],C=a.vertices[E+1],P=(_-v)/S,B=(C-w)/T;this._positionAttribute.setXYZ(A,_,C,0),this._normalAttribute.setXYZ(A,0,0,1),this._uvAttribute.setXY(A,P,B)}for(let A=0,x=d;A<x;A++){let E=A*3,_=a.elements[E+0],C=a.elements[E+1],P=a.elements[E+2];this._indexAttribute.setX(E+0,_),this._indexAttribute.setX(E+1,C),this._indexAttribute.setX(E+2,P)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,((g=a==null?void 0:a.elementCount)!=null?g:1)*3)}clone(){let t=new Cl(this._shape,this._curveSegments);return t.userData=Su(this.userData),t}};var up=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*up.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*up.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,o=0,a=new Float32Array(n,o*s,3*e);o+=3*e;let l=new Float32Array(n,o*s,3*e);o+=3*e;let c=new Float32Array(n,o*s,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Wu=up;Wu.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var ov=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),Ll=class extends Ie{constructor(t,r,n=0,s=12,o=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=t,this._depth=r,this._bevel=n,this._curveSegments=s,this._bevelSegmentsInput=o,n<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(n,r/2-1e-12),this._bevelSegments=Math.floor(o));let a=this._shape.extractShapePointsToFlatArray([],s),l=this._shape.shapeHoles.map(A=>{let x=A.extractShapePointsToFlatArray([],s),E=[];for(let _=x.length-1;_>=1;_-=2){let C=x[_-1],P=x[_-0];E.push(C,P)}return E}),c=Wo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[a]}),u=Wo({windingRule:Kt.ODD,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...l]});if(!c)throw new Error("error generating geometry");let h=c.elementCount;if(u){c.elementCount+=u.elementCount;for(let A=0;A<u.elements.length;A++){let x=u.elements[A],E=A%2===0?c.vertexCount:0;c.elements.push(x+E)}for(let A=0;A<u.vertexIndices.length;A++){let x=u.vertexIndices[A],E=c.vertexCount;c.vertexIndices.push(x+E)}for(let A=0;A<u.vertices.length;A++){let x=u.vertices[A];c.vertices.push(x)}}let f=1/0,d=-1/0,p=1/0,m=-1/0;for(let A=0,x=c.vertexCount;A<x;A++){let E=A*2,_=c.vertices[E+0],C=c.vertices[E+1];_<f&&(f=_),_>d&&(d=_),C<p&&(p=C),C>m&&(m=C)}this._minX=f,this._minY=p,this._width=d-f,this._height=m-p;let g=c.vertexCount*2*(2+this._bevelSegments);this._buffer=new Wu(g);let v=[],y=[];for(let A=c.elementCount-1;A>=0;A--){let x=A>=h,E=A*2,_=c.elements[E+0],C=c.elements[E+1],P=_+C,B={start:_,count:C,normals:[],continuous:[],concave:[]},R=_,U=P-1,z=_+1,J=this._shape.roundedCurves.length;do{let k=R-_,O=c.vertices[U*2+0],j=c.vertices[U*2+1],q=c.vertices[R*2+0],K=c.vertices[R*2+1],W=c.vertices[z*2+0],ge=c.vertices[z*2+1],oe=q-O,le=K-j,H=Math.sqrt(oe*oe+le*le);oe/=H,le/=H;let ue=q-W,Z=K-ge,V=Math.sqrt(ue*ue+Z*Z);ue/=V,Z/=V,B.normals[k*2+0]=-Z,B.normals[k*2+1]=ue,B.concave[k]=oe*Z-le*ue>0;let $=c.vertexIndices[R];if(Array.isArray($))B.continuous[k]=!1;else{let[ce,ie]=this._shape.getCurveIndexFromVertexId($-1,!0);if(ie>0&&ie<1)B.continuous[k]=!0;else{let pe=ie===1?ce+1:ce-1;pe=(pe+J)%J;let ve=ie===1?0:1,me=this._shape.roundedCurves[ce].getTangent(ie),De=this._shape.roundedCurves[pe].getTangent(ve);B.continuous[k]=me.dot(De)>.95}}x&&(B.normals[k*2+0]*=-1,B.normals[k*2+1]*=-1),[U,R,z]=[R,z,z+1],z>=P&&(z-=C)}while(z!==_+1);let Q=[];Q.push({bevelI:0,angle:0,size:0,boundary:{vertices:c.vertices.slice(_*2,P*2),vertexCount:C,vertexIndices:new Array(C).fill(!0).map((k,O)=>[O,O]),elements:[0,C],elementCount:1,mesh:null},reverseMap:[],insetPoints:c.vertices.slice(_*2,P*2)});for(let k=1;k<=this._bevelSegments;k++){let O=k/this._bevelSegments*Math.PI/2,j=(1-Math.cos(O))*this._bevelSize,q=[],K=[],W=[],ge=[],oe=0;for(let H=0;H<C;H++){let ue=H*2,Z=(H-1+C)%C*2,V=c.vertices[B.start*2+ue+0],$=c.vertices[B.start*2+ue+1],ce=-B.normals[Z+0]*j,ie=-B.normals[Z+1]*j,pe=-B.normals[ue+0]*j,ve=-B.normals[ue+1]*j;if(B.concave[H]||!B.concave[H]&&x){let me=Math.atan2(ie,ce),De=Math.atan2(ve,pe);De>me&&(De-=Math.PI*2);let ke=De-me;if(B.continuous[H]||x){let I=me+ke/2,L=Math.cos(I)*j,te=Math.sin(I)*j;q[2*oe+0]=V+L*(x?-1:1),q[2*oe+1]=$+te*(x?-1:1),ge[oe]=H,oe++}else{let I=Math.max(1,Math.floor(s/4*Math.abs(ke)/Math.PI));for(let L=0;L<=I;L++){let te=me+ke*(L/I),ye=Math.cos(te)*j,Se=Math.sin(te)*j;q[2*oe+0]=V+ye,q[2*oe+1]=$+Se,ge[oe]=H,oe++}}}else q[2*oe+0]=V+ce,q[2*oe+1]=$+ie,ge[oe]=H,K[H]=oe,oe++,q[2*oe+0]=V,q[2*oe+1]=$,ge[oe]=H,oe++,q[2*oe+0]=V+pe,q[2*oe+1]=$+ve,ge[oe]=H,W[H]=oe,oe++}let le=Wo({windingRule:Kt.POSITIVE,elementType:Mr.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:H=>{let Z=H.Org.idx,V=ge[Z],$=ge[(Z+1)%ge.length];H.idx=[V,$],H.Sym.idx=[$,V]},vertexIdCallback:H=>{let ue=H.Lprev.idx;return[ue?ue[1]:0,H.idx[0]]}});if(!le)throw console.log("Error"),new Error(`error generating bevel geometry for ${k}'th loop`);if(!le.vertexCount)break;for(let H=0;H<le.vertexIndices.length;H++){let[ue,Z]=le.vertexIndices[H];if(ue===Z)continue;let V=Z;Z<ue&&(V+=C);for(let $=ue;$<V;$++){let ce=$%C,ie=($+1)%C;if(!B.continuous[ce]||!B.continuous[ie]){le.vertexIndices[H]=[ue,ce],le.vertexIndices.splice(H+1,0,[ie,Z]),le.vertices.splice((H+1)*2,0,le.vertices[H*2],le.vertices[H*2+1]);break}}}Q.push({bevelI:k,angle:O,size:j,boundary:le,reverseMap:ge,insetPoints:q})}let X=(k,O,j)=>{let q=0,K=k.boundary.vertexIndices.length;for(;q<K&&j(k.boundary.vertexIndices[O]);)O=(O+1)%K,q++;return q},F=v.length;for(let k=1;k<Q.length;k++){let O=Q[k-1],j=Q[k],q=O.boundary.vertexIndices.length,K=j.boundary.vertexIndices.length;if(!q||!K)break;let W=B.concave.length,ge=0,oe=ov(ge,C);for(;!O.boundary.vertexIndices.filter(oe).length||!j.boundary.vertexIndices.filter(oe).length;)ge++,oe=ov(ge,C);let le=O.boundary.vertexIndices.findIndex(oe),H=j.boundary.vertexIndices.findIndex(oe);do le=(le+1)%q;while(oe(O.boundary.vertexIndices[le]));do H=(H+1)%K;while(oe(j.boundary.vertexIndices[H]));ge=(ge+1)%C;let ue=ge,Z=this.buildBevelVert(B,O,(le-1+q)%q),V=this.buildBevelVert(B,j,(H-1+K)%K),$=Z,ce=V,ie,pe,ve=!1;do{oe=ov(ge,C);let me=X(O,le,oe),De=X(j,H,oe),ke=ve;if(ve=!1,me&&!De){for(let I=0;I<me;I++)ie=this.buildBevelVert(B,O,(le+I)%q,I/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie;ve=!0}else if(!me&&De)for(let I=0;I<De;I++)pe=this.buildBevelVert(B,j,(H+I)%K,I/(De-1)),v.push(ce.topN,$.topP,pe.topP),v.push($.bottomP,ce.bottomN,pe.bottomP),ce=pe;else if(me&&De)if(ie=this.buildBevelVert(B,O,le,0),pe=this.buildBevelVert(B,j,H,0),ke?(v.push($.topN,pe.topP,ce.topN),v.push($.topN,ie.topP,pe.topP),v.push(pe.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,$.bottomN,pe.bottomP)):(v.push($.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,pe.bottomP)),$=ie,ce=pe,me===De)for(let I=1;I<me;I++)ie=this.buildBevelVert(B,O,(le+I)%q,I/(me-1)),pe=this.buildBevelVert(B,j,(H+I)%K,I/(De-1)),v.push($.topN,ie.topP,ce.topN),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,$.bottomN,ce.bottomN),v.push(ie.bottomP,ce.bottomN,pe.bottomP),$=ie,ce=pe;else if(me>De){let I=me/De,L=0;for(let te=1;te<me;te++)ie=this.buildBevelVert(B,O,(le+te)%q,te/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie,te>(L+1)*I&&(L++,pe=this.buildBevelVert(B,j,(H+L)%K,L/(De-1)),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe)}else{let I=De/me,L=0;for(let te=1;te<De;te++)pe=this.buildBevelVert(B,j,(H+te)%K,te/(De-1)),v.push(ce.topN,ie.topP,pe.topP),v.push(ie.bottomP,ce.bottomN,pe.bottomP),ce=pe,te>(L+1)*I&&(L++,ie=this.buildBevelVert(B,O,(le+L)%q,L/(me-1)),v.push($.topN,ie.topP,ce.topN),v.push(ie.bottomP,$.bottomN,ce.bottomN),$=ie)}le=(le+me)%q,H=(H+De)%K,ge=(ge+1)%W}while(ge!==ue)}{let k=Q[0];for(let O=0,j=k.boundary.vertexCount;O<j;O++){let q=this.buildBevelVert(B,k,O),K=this.buildBevelVert(B,k,(O+1)%j);v.push(K.topP,q.topN,q.bottomN),v.push(K.topP,q.bottomN,K.bottomP)}}if(x){let k=[];for(let O=v.length-1;O>=F+2;O-=3){let j=v[O-2],q=v[O-1],K=v[O-0];k.push(K,q,j)}v.splice(F,v.length-F,...k)}if(x){let k=[];for(let O=Q[Q.length-1].boundary.vertices.length-1;O>=1;O-=2){let j=Q[Q.length-1].boundary.vertices[O-1],q=Q[Q.length-1].boundary.vertices[O-0];k.push(j,q)}y.push(k)}if(!x){let k=Q[Q.length-1],O=Wo({windingRule:Q.length>1?Kt.POSITIVE:Kt.ODD,elementType:Mr.POLYGONS,vertexSize:2,strict:!0,contours:[k.insetPoints,...y]});if(!O)throw new Error("Error generating geometry for surface");for(let j=0;j<O.elementCount*3;j+=3){let q=this.buildSurfaceVert(O,O.elements[j+0]),K=this.buildSurfaceVert(O,O.elements[j+1]),W=this.buildSurfaceVert(O,O.elements[j+2]);v.push(q.top,K.top,W.top),v.push(W.bottom,K.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let w=new Ue(Uint32Array.from(v),1),b=new Ue(this._buffer.positions,3),S=new Ue(this._buffer.normals,3),T=new Ue(this._buffer.uvs,2);b.needsUpdate=!0,S.needsUpdate=!0,T.needsUpdate=!0,w.needsUpdate=!0,this.setAttribute("position",b),this.setAttribute("normal",S),this.setAttribute("uv",T),this.setIndex(w)}buildSurfaceVert(t,r){let n=r.toString();if(n in this.vertexCache)return this.vertexCache[n];let s=t.vertices[r*2+0],o=t.vertices[r*2+1],a=(s-this._minX)/this._width,l=(o-this._minY)/this._height,c=this._buffer.get(2),u=c*3,h=c*2,f={top:c+0,bottom:c+1};return this._buffer.positions[u+0]=s,this._buffer.positions[u+1]=o,this._buffer.positions[u+2]=this._depth,this._buffer.normals[u+0]=0,this._buffer.normals[u+1]=0,this._buffer.normals[u+2]=1,this._buffer.uvs[h+0]=a,this._buffer.uvs[h+1]=l,this._buffer.positions[u+3]=s,this._buffer.positions[u+4]=o,this._buffer.positions[u+5]=0,this._buffer.normals[u+3]=0,this._buffer.normals[u+4]=0,this._buffer.normals[u+5]=-1,this._buffer.uvs[h+2]=a,this._buffer.uvs[h+3]=l,this.vertexCache[n]=f,f}buildBevelVert(t,r,n,s=1){let o=`${r.bevelI}:${n}`;if(o in this.vertexCache)return this.vertexCache[o];let[a,l]=r.boundary.vertexIndices[n],c,u,h,f;a!==l?(u=a,c=l,f=!1,h=t.continuous[u]&&t.continuous[c]):(c=a,u=(c-1+t.count)%t.count,f=t.concave[c]&&r.bevelI>0,h=t.continuous[c]||f);let d=Math.cos(r.angle),p=Math.sin(r.angle),m=n*2,g=c*2,v=u*2,y=r.boundary.vertices[m+0],w=r.boundary.vertices[m+1],b=(1-p)*this._bevelSize,S=(y-this._minX)/this._width,T=(w-this._minY)/this._height,A=t.normals[g+0],x=t.normals[g+1],E=t.normals[v+0],_=t.normals[v+1];if(f){let U=E-A,z=_-x;A=A+U*(1-s),x=x+z*(1-s);let J=Math.sqrt(A*A+x*x);A/=J,x/=J}let C=this._buffer.get(h?2:4),P=C*3,B=C*2,R={i:n,fi:c,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[P+0]=y,this._buffer.positions[P+1]=w,this._buffer.positions[P+2]=this._depth-b,this._buffer.normals[P+0]=A*d,this._buffer.normals[P+1]=x*d,this._buffer.normals[P+2]=p,this._buffer.uvs[B+0]=S,this._buffer.uvs[B+1]=T,this._buffer.positions[P+3]=y,this._buffer.positions[P+4]=w,this._buffer.positions[P+5]=b,this._buffer.normals[P+3]=A*d,this._buffer.normals[P+4]=x*d,this._buffer.normals[P+5]=-p,this._buffer.uvs[B+2]=T,this._buffer.uvs[B+3]=S,h||(C+=2,P+=6,B+=4,R.topP=C+0,R.bottomP=C+1,this._buffer.positions[P+0]=y,this._buffer.positions[P+1]=w,this._buffer.positions[P+2]=this._depth-b,this._buffer.normals[P+0]=E*d,this._buffer.normals[P+1]=_*d,this._buffer.normals[P+2]=p,this._buffer.uvs[B+0]=S,this._buffer.uvs[B+1]=T,this._buffer.positions[P+3]=y,this._buffer.positions[P+4]=w,this._buffer.positions[P+5]=b,this._buffer.normals[P+3]=E*d,this._buffer.normals[P+4]=_*d,this._buffer.normals[P+5]=-p,this._buffer.uvs[B+2]=T,this._buffer.uvs[B+3]=S),this.vertexCache[o]=R,R}clone(){let t=new Ll(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return t.userData=Su(this.userData),t}};var Gr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,h,f,d,p,m;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((u=t.height)!=null?u:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(h=t.depth)!=null?h:0),o=(f=i.shape)!=null?f:e==null?void 0:e.shape,a=(d=o==null?void 0:o.roundness)!=null?d:t.roundness;o!==void 0&&(o instanceof At?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new At(r,n).fromJSON(o),((p=i.parameters)==null?void 0:p.roundness)!==void 0&&((m=i.parameters)==null?void 0:m.roundness)>0&&o.update(!1));let l=o!=null?o:new At(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s}=i.parameters;i.shape.roundness=s;let o;return e<=0?o=new Cl(i.shape,n):o=new Ll(i.shape,e,t,n,r),Object.assign(o,{userData:be(se({},i),{type:"VectorGeometry"})})}};var KM=Math.PI*2,ZM=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c=i.shape,u=e*.5,h=t*.5,f=BO(c,u,h,n*Math.PI/180,r,s);c.isClosed=!0,c.update();let d=Gr.create({shape:c,parameters:{subdivisions:f,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(d,{userData:be(se({},i),{type:"EllipseGeometry"})})}};function BO(i,e,t,r,n,s){if(r>=KM)return n>30||n%4===0?(OO(i,e,t,s),Math.round(n/4)):QM(i,r,n,e,t,s);let o={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=jM({px:o.x,py:o.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%c.length===0?NO(i,o.x,o.y,c,n,e,t,s):QM(i,r,n,e,t,s)}function NO(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Dl(e,t));for(let c=0,u=r.length;c<u;c++){let h=r[c],f=i.points[c],d=Dl(h.x,h.y);f.controls[1].position.set(h.x1,h.y1),d.controls[0].position.set(h.x2,h.y2),i.addPoint(d)}return a>0?$M(i,s,o,a):i.addPoint(Dl(0,0)),l}function QM(i,e,t,r,n,s){let o=-e/t;for(let a=0;a<=t;a++){let l=o*a,c=Math.sin(l)*r,u=Math.cos(l)*n;i.addPoint(Dl(c,u))}return e<KM?s>0?$M(i,r,n,s):i.addPoint(Dl(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&e1(i,r,n,s)),1}function OO(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(hp(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(hp(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(hp(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(hp(n,s-t,n+a,s-t,n-a,s-t)),r>0&&e1(i,e,t,r)}function Dl(i,e){return new ci(tt.generateUUID(),new N(i,e))}function hp(i,e,t,r,n,s){let o=Dl(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function $M(i,e,t,r){t1(i,e,t,r).forEach(s=>i.addPoint(s))}function e1(i,e,t,r){let n=t1(i,e,t,r),s=new At;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function t1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new N(n/e,s/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=tt.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(o);let c=l.controls[0].position.clone().multiply(o),u=l.controls[1].position.clone().multiply(o);l.controls[0].position.copy(u),l.controls[1].position.copy(c)}),a}var r1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),n=Math.abs((l=t.height)!=null?l:r),s=Math.abs((c=t.depth)!=null?c:r),o=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:o,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:o,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:u,cornerSegments:h}=i.parameters,f=new ju(!1,e,t,r,n,s,o,a,l,c,u,h);return Object.assign(f,{userData:be(se({},i),{type:"HelixGeometry"})})}},ju=class extends Ie{constructor(e=!0,t=1,r=1,n=1,s=1,o=1,a=1,l=1,c=1,u=1,h=1,f=1){super();let d=e&&o===1;d&&(f=0),h>100&&(h=100);let p=()=>new M,m=new M,g=p(),v=p(),y=p(),w,b,S,T,A,x,E,_,C=p(),P=p(),B=p(),R=p(),U=p(),z=p(),J=p(),Q=p(),X=r-2*l+.001,F=X/o,k=Math.ceil(a*o),O=k+1,j=X/k,q=-X/2,K=u+1,W=2*Math.PI/u,ge=Math.PI/2/f,oe=.01,le=Math.min((1-h/100)*l,l-oe),H=l-le,ue=0,Z=2,V=f*Z+Z,$=K*V/Z,ce=$+K*O,ie=K*(O+V),[pe,ve,me]=[3,3,2].map(Te=>Array(ie*Te).fill(0)),De=[],ke=s-l;function I(Te,G){let Me=Math.PI/2;x=G*j,_=2*Math.PI*(x%F)/F+Me,x+=q,E=Math.sin(_)*ke,A=Math.cos(_)*ke,e?Te.set(A,E,x):Te.set(A,x,E)}I(m,-1e-10),I(g,0),C.copy(m),I(m,1);let L=m.distanceTo(g),te=H+le,ye=L*k+2*te,Se=le,Pe=ye-te;for(let Te=0;Te<=k;Te++){I(v,Te),Q.subVectors(v,C).normalize(),C.copy(v),z.copy(v).setComponent(+e+1,0).normalize(),J.crossVectors(Q,z).normalize();let G=Te===0,Me=Te===k,Ce=G?3*Math.PI/2:ge,Ze=G?Se:Pe,Oe=G?K:ce,Qe=G?0:ie-K,Ae=Q.clone().multiplyScalar(G?-H:H).add(v),$e=Q.clone().multiplyScalar(G?-1:1).normalize();for(let at=0;at<K;at++){let ft=at*W;if(P.addVectors(m.copy(z).multiplyScalar(l*Math.cos(ft)),g.copy(J).multiplyScalar(l*Math.sin(ft))),B.copy(P).normalize(),G||Me){d||(ue=Qe+at,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=Ae.getComponent(Ot),ve[ue*3+Ot]=$e.getComponent(Ot)}),me[ue*2]=+Me,me[ue*2+1]=at/u),g.copy(B).multiplyScalar(le),y.addVectors(v,g);for(let Ot=0;Ot<f;Ot++){let Nr=Ot*ge+Ce;R.addVectors(m.copy(Q).multiplyScalar(H*Math.sin(Nr)),g.copy(B).multiplyScalar(H*Math.cos(Nr))),U.copy(R).normalize(),g.addVectors(y,R),R.normalize(),ue=Oe+Ot*K+at,[0,1,2].forEach(We=>{pe[ue*3+We]=g.getComponent(We),ve[ue*3+We]=U.getComponent(We)});let ea=+G+Math.sin(Nr);me[ue*2]=(Ze+H*ea)/ye,me[ue*2+1]=at/u}}g.addVectors(v,P),ue=$+Te*K+at,[0,1,2].forEach(Ot=>{pe[ue*3+Ot]=g.getComponent(Ot),ve[ue*3+Ot]=B.getComponent(Ot)}),me[ue*2]=(te+Te*L)/ye,me[ue*2+1]=at/u}}let Fe=O+2*f+Z,he=1,[nt,st]=d?[he,he+O-1]:[0,Fe-1];for(let Te=nt;Te<=st-1;Te++){let G=d&&Te===st-1;for(let Me=0;Me<K-1;Me++)w=Te*K+Me,b=w+1,S=(G?Me:w)+K,T=(G?Me+1:b)+K,Te===0?De.push(b,T,S):Te===Fe-2?De.push(w,b,S):De.push(w,b,S,b,T,S)}this.setIndex(De),this.setAttribute("position",new Le(pe,3)),this.setAttribute("normal",new Le(ve,3)),this.setAttribute("uv",new Le(me,2))}};var n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new qu(e*.5,s,o):new Ua(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:be(se({},i),{type:"IcosahedronGeometry"})})}},qu=class extends no{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],o=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(s,o,a,e,t,r),this.type=a}static fromJSON(e){return new qu(e.radius,e.corner,e.cornerSides)}};var i1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o,a;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new en;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new Ba(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:be(se({},i),{type:"LatheGeometry"})})}};var Bi=new _e,av=new ot,fp=new M,so=class extends jt{constructor(){super(),this.uuid=tt.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}applyMatrix4(e){let t=new Nt().getNormalMatrix(e);for(let r=0,n=this.vertices.length;r<n;r++)this.vertices[r].applyMatrix4(e);for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];s.normal.applyMatrix3(t).normalize();for(let o=0,a=s.vertexNormals.length;o<a;o++)s.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this}rotateX(e){return Bi.makeRotationX(e),this.applyMatrix4(Bi),this}rotateY(e){return Bi.makeRotationY(e),this.applyMatrix4(Bi),this}rotateZ(e){return Bi.makeRotationZ(e),this.applyMatrix4(Bi),this}translate(e,t,r){return Bi.makeTranslation(e,t,r),this.applyMatrix4(Bi),this}scale(e,t,r){return Bi.makeScale(e,t,r),this.applyMatrix4(Bi),this}lookAt(e){return av.lookAt(e),av.updateMatrix(),this.applyMatrix4(av.matrix),this}fromBufferGeometry(e){let t=this,r=e.index!==null?e.index:void 0,n=e.attributes;if(n.position===void 0)return console.error("THREE.Geometry.fromBufferGeometry(): Position attribute required for conversion."),this;let s=n.position,o=n.normal,a=n.color,l=n.uv,c=n.uv2;c!==void 0&&(this.faceVertexUvs[1]=[]);for(let f=0;f<s.count;f++)t.vertices.push(new M().fromBufferAttribute(s,f)),a!==void 0&&t.colors.push(new xe().fromBufferAttribute(a,f));function u(f,d,p,m){let g=a===void 0?[]:[t.colors[f].clone(),t.colors[d].clone(),t.colors[p].clone()],v=o===void 0?[]:[new M().fromBufferAttribute(o,f),new M().fromBufferAttribute(o,d),new M().fromBufferAttribute(o,p)],y=new Pl(f,d,p,v,g,m);t.faces.push(y),l!==void 0&&t.faceVertexUvs[0].push([new N().fromBufferAttribute(l,f),new N().fromBufferAttribute(l,d),new N().fromBufferAttribute(l,p)]),c!==void 0&&t.faceVertexUvs[1].push([new N().fromBufferAttribute(c,f),new N().fromBufferAttribute(c,d),new N().fromBufferAttribute(c,p)])}let h=e.groups;if(h.length>0)for(let f=0;f<h.length;f++){let d=h[f],p=d.start,m=d.count;for(let g=p,v=p+m;g<v;g+=3)r!==void 0?u(r.getX(g),r.getX(g+1),r.getX(g+2),d.materialIndex):u(g,g+1,g+2,d.materialIndex)}else if(r!==void 0)for(let f=0;f<r.count;f+=3)u(r.getX(f),r.getX(f+1),r.getX(f+2));else for(let f=0;f<s.count;f+=3)u(f,f+1,f+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(fp).negate(),this.translate(fp.x,fp.y,fp.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new _e;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new M,t=new M;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new M;if(e){let r=new M,n=new M;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new so;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new M,u={a:new M,b:new M,c:new M};s.push(c),o.push(u)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qt),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Yr),this.boundingSphere.setFromPoints(this.vertices)}merge(e,t,r=0){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}let n,s=this.vertices.length,o=this.vertices,a=e.vertices,l=this.faces,c=e.faces,u=this.colors,h=e.colors;t!==void 0&&(n=new Nt().getNormalMatrix(t));for(let f=0,d=a.length;f<d;f++){let m=a[f].clone();t!==void 0&&m.applyMatrix4(t),o.push(m)}for(let f=0,d=h.length;f<d;f++)u.push(h[f].clone());for(let f=0,d=c.length;f<d;f++){let p=c[f],m,g,v=p.vertexNormals,y=p.vertexColors,w=new Pl(p.a+s,p.b+s,p.c+s);w.normal.copy(p.normal),n!==void 0&&w.normal.applyMatrix3(n).normalize();for(let b=0,S=v.length;b<S;b++)m=v[b].clone(),n!==void 0&&m.applyMatrix3(n).normalize(),w.vertexNormals.push(m);w.color.copy(p.color);for(let b=0,S=y.length;b<S;b++)g=y[b],w.vertexColors.push(g.clone());w.materialIndex=p.materialIndex+r,l.push(w)}for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++)y.push(v[w].clone());this.faceVertexUvs[f].push(y)}}}mergeMesh(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)}mergeVertices(e=4){let t={},r=[],n=[],s=Math.pow(10,e);for(let l=0,c=this.vertices.length;l<c;l++){let u=this.vertices[l],h=Math.round(u.x*s)+"_"+Math.round(u.y*s)+"_"+Math.round(u.z*s);t[h]===void 0?(t[h]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[h]]}let o=[];for(let l=0,c=this.faces.length;l<c;l++){let u=this.faces[l];u.a=n[u.a],u.b=n[u.b],u.c=n[u.c];let h=[u.a,u.b,u.c];for(let f=0;f<3;f++)if(h[f]===h[(f+1)%3]){o.push(l);break}}for(let l=o.length-1;l>=0;l--){let c=o[l];this.faces.splice(c,1);for(let u=0,h=this.faceVertexUvs.length;u<h;u++)this.faceVertexUvs[u].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new M(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let p=this.parameters;for(let m in p)p[m]!==void 0&&(e[m]=p[m]);return e}let t=[];for(let p=0;p<this.vertices.length;p++){let m=this.vertices[p];t.push(m.x,m.y,m.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let p=0;p<this.faces.length;p++){let m=this.faces[p],g=!0,v=!1,y=this.faceVertexUvs[0][p]!==void 0,w=m.normal.length()>0,b=m.vertexNormals.length>0,S=m.color.r!==1||m.color.g!==1||m.color.b!==1,T=m.vertexColors.length>0,A=0;if(A=u(A,0,0),A=u(A,1,g),A=u(A,2,v),A=u(A,3,y),A=u(A,4,w),A=u(A,5,b),A=u(A,6,S),A=u(A,7,T),r.push(A),r.push(m.a,m.b,m.c),r.push(m.materialIndex),y){let x=this.faceVertexUvs[0][p];r.push(d(x[0]),d(x[1]),d(x[2]))}if(w&&r.push(h(m.normal)),b){let x=m.vertexNormals;r.push(h(x[0]),h(x[1]),h(x[2]))}if(S&&r.push(f(m.color)),T){let x=m.vertexColors;r.push(f(x[0]),f(x[1]),f(x[2]))}}function u(p,m,g){return g?p|1<<m:p&~(1<<m)}function h(p){let m=p.x.toString()+p.y.toString()+p.z.toString();return s[m]!==void 0||(s[m]=n.length/3,n.push(p.x,p.y,p.z)),s[m]}function f(p){let m=p.r.toString()+p.g.toString()+p.b.toString();return a[m]!==void 0||(a[m]=o.length,o.push(p.getHex())),a[m]}function d(p){let m=p.x.toString()+p.y.toString();return c[m]!==void 0||(c[m]=l.length/2,l.push(p.x,p.y)),c[m]}return e.data={},e.data.vertices=t,e.data.normals=n,o.length>0&&(e.data.colors=o),l.length>0&&(e.data.uvs=[l]),e.data.faces=r,e}clone(){return new so().copy(this)}copy(e){this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;let t=e.vertices;for(let f=0,d=t.length;f<d;f++)this.vertices.push(t[f].clone());let r=e.colors;for(let f=0,d=r.length;f<d;f++)this.colors.push(r[f].clone());let n=e.faces;for(let f=0,d=n.length;f<d;f++)this.faces.push(n[f].clone());for(let f=0,d=e.faceVertexUvs.length;f<d;f++){let p=e.faceVertexUvs[f];this.faceVertexUvs[f]===void 0&&(this.faceVertexUvs[f]=[]);for(let m=0,g=p.length;m<g;m++){let v=p[m],y=[];for(let w=0,b=v.length;w<b;w++){let S=v[w];y.push(S.clone())}this.faceVertexUvs[f].push(y)}}let s=e.morphTargets;for(let f=0,d=s.length;f<d;f++){let p={};if(p.name=s[f].name,s[f].vertices!==void 0){p.vertices=[];for(let m=0,g=s[f].vertices.length;m<g;m++)p.vertices.push(s[f].vertices[m].clone())}if(s[f].normals!==void 0){p.normals=[];for(let m=0,g=s[f].normals.length;m<g;m++)p.normals.push(s[f].normals[m].clone())}this.morphTargets.push(p)}let o=e.morphNormals;for(let f=0,d=o.length;f<d;f++){let p={};if(o[f].vertexNormals!==void 0){p.vertexNormals=[];for(let m=0,g=o[f].vertexNormals.length;m<g;m++){let v=o[f].vertexNormals[m],y={};y.a=v.a.clone(),y.b=v.b.clone(),y.c=v.c.clone(),p.vertexNormals.push(y)}}if(o[f].faceNormals!==void 0){p.faceNormals=[];for(let m=0,g=o[f].faceNormals.length;m<g;m++)p.faceNormals.push(o[f].faceNormals[m].clone())}this.morphNormals.push(p)}let a=e.skinWeights;for(let f=0,d=a.length;f<d;f++)this.skinWeights.push(a[f].clone());let l=e.skinIndices;for(let f=0,d=l.length;f<d;f++)this.skinIndices.push(l[f].clone());let c=e.lineDistances;for(let f=0,d=c.length;f<d;f++)this.lineDistances.push(c[f]);let u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());let h=e.boundingSphere;return h!==null&&(this.boundingSphere=h.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this}toBufferGeometry(){let e=new lv().fromGeometry(this),t=new Ie,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Ue(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Ue(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Ue(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Ue(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Ue(n,2).copyVector2sArray(e.uvs2))}t.groups=e.groups;for(let n in e.morphTargets){let s=[],o=e.morphTargets[n];for(let a=0,l=o.length;a<l;a++){let c=o[a],u=new Le(c.data.length*3,3);u.name=c.name,s.push(u.copyVector3sArray(c.data))}t.morphAttributes[n]=s}if(e.skinIndices.length>0){let n=new Le(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Le(e.skinWeights.length*4,4);t.setAttribute("skinWeight",n.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(t.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(t.boundingBox=e.boundingBox.clone()),t}computeTangents(){console.error("THREE.Geometry: .computeTangents() has been removed.")}computeLineDistances(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}applyMatrix(e){return console.warn("THREE.Geometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(e)}dispose(){this.dispatchEvent({type:"dispose"})}static createBufferGeometryFromObject(e){let t=new Ie,r=e.geometry;if(e.isPoints||e.isLine){let n=new Le(r.vertices.length*3,3),s=new Le(r.colors.length*3,3);if(t.setAttribute("position",n.copyVector3sArray(r.vertices)),t.setAttribute("color",s.copyColorsArray(r.colors)),r.lineDistances&&r.lineDistances.length===r.vertices.length){let o=new Le(r.lineDistances.length,1);t.setAttribute("lineDistance",o.copyArray(r.lineDistances))}r.boundingSphere!==null&&(t.boundingSphere=r.boundingSphere.clone()),r.boundingBox!==null&&(t.boundingBox=r.boundingBox.clone())}else e.isMesh&&(t=r.toBufferGeometry());return t}};so.prototype.isGeometry=!0;var lv=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let v=0;v<l;v++)c[v]={name:a[v].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,h=u.length,f;if(h>0){f=[];for(let v=0;v<h;v++)f[v]={name:u[v].name,data:[]};this.morphTargets.normal=f}let d=e.skinIndices,p=e.skinWeights,m=d.length===r.length,g=p.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let v=0;v<t.length;v++){let y=t[v];this.vertices.push(r[y.a],r[y.b],r[y.c]);let w=y.vertexNormals;if(w.length===3)this.normals.push(w[0],w[1],w[2]);else{let S=y.normal;this.normals.push(S,S,S)}let b=y.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let S=y.color;this.colors.push(S,S,S)}if(s===!0){let S=n[0][v];S!==void 0?this.uvs.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",v),this.uvs.push(new N,new N,new N))}if(o===!0){let S=n[1][v];S!==void 0?this.uvs2.push(S[0],S[1],S[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",v),this.uvs2.push(new N,new N,new N))}for(let S=0;S<l;S++){let T=a[S].vertices;c[S].data.push(T[y.a],T[y.b],T[y.c])}for(let S=0;S<h;S++){let T=u[S].vertexNormals[v];f[S].data.push(T.a,T.b,T.c)}m&&this.skinIndices.push(d[y.a],d[y.b],d[y.c]),g&&this.skinWeights.push(p[y.a],p[y.b],p[y.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}},Pl=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new M,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new xe,this.vertexColors=Array.isArray(s)?s:[],this.materialIndex=o}clone(){return new this.constructor().copy(this)}copy(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(let t=0,r=e.vertexNormals.length;t<r;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(let t=0,r=e.vertexColors.length;t<r;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}};var FO=["a","b","c"];function UO(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function cv(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function uv(i,e,t,r,n,s){let o=Math.min(i,e),a=Math.max(i,e),l=o+"_"+a,c;if(r.has(l))c=r.get(l);else{let u=t[o],h=t[a];c={a:u,b:h,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function zO(i,e,t,r){let n,s,o;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)o=e[n],uv(o.a,o.b,i,r,o,t),uv(o.b,o.c,i,r,o,t),uv(o.c,o.a,i,r,o,t)}function dp(i,e,t,r,n){i.push(new Pl(e,t,r,void 0,void 0,n))}function Il(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function pp(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var mp=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Ie?e=new so().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new M,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],h=u!==void 0&&u.length>0,f=[],d=new Map;zO(l,c,f,d);let p=[],m,g,v,y,w,b,S;for(let oe of Array.from(d.keys())){for(g=d.get(oe),v=new M,w=3/8,b=1/8,S=g.faces.length,S!=2&&(w=.5,b=0,S!=1),v.addVectors(g.a,g.b).multiplyScalar(w),t.set(0,0,0),o=0;o<S;o++){for(y=g.faces[o],a=0;a<3&&(m=l[UO(y,FO[a])],!(m!==g.a&&m!==g.b));a++);m&&t.add(m)}t.multiplyScalar(b),v.add(t),g.newEdge=p.length,p.push(v)}let T,A,x,E,_,C,P,B=[];for(n=0,s=l.length;n<s;n++){for(C=l[n],_=f[n].edges,r=_.length,r==3?T=3/16:r>3&&(T=3/(8*r)),A=1-r*Number(T),x=T,r<=2&&(r==2?(A=3/4,x=1/8):r==1||r==0),P=C.clone().multiplyScalar(A),t.set(0,0,0),o=0;o<r;o++)E=_[o],m=E.a!==C?E.a:E.b,t.add(m);t.multiplyScalar(Number(x)),P.add(t),B.push(P)}let R=B.concat(p),U=B.length,z,J,Q,X=[],F=[],k,O,j,q,K=new N,W=new N,ge=new N;for(n=0,s=c.length;n<s;n++)y=c[n],z=Number(cv(y.a,y.b,d).newEdge)+U,J=Number(cv(y.b,y.c,d).newEdge)+U,Q=Number(cv(y.c,y.a,d).newEdge)+U,dp(X,z,J,Q,y.materialIndex),dp(X,y.a,z,Q,y.materialIndex),dp(X,y.b,J,z,y.materialIndex),dp(X,y.c,Q,J,y.materialIndex),h&&(k=u[n],O=k[0],j=k[1],q=k[2],K.set(Il(O.x,j.x),Il(O.y,j.y)),W.set(Il(j.x,q.x),Il(j.y,q.y)),ge.set(Il(O.x,q.x),Il(O.y,q.y)),pp(F,K,W,ge),pp(F,O,K,ge),pp(F,j,W,K),pp(F,q,ge,W));e.vertices=R,e.faces=X,h&&(e.faceVertexUvs[0]=F)}};var Ar=new M,s1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o;let t=(o=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?o:new Ie().copy(new mn(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Ar),r={width:Ar.x,height:Ar.y,depth:Ar.z,subdivisions:0}):r=e.parameters;let n=se(se({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(l=i.geometry)!=null?l:new Ie().copy(new mn(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Ar)):Ar.set(o.width,o.height,o.depth),(e!==Ar.x||t!==Ar.y||r!==Ar.z)&&s.scale(Ar.x===0?1:e/Ar.x,Ar.y===0?1:t/Ar.y,Ar.z===0?1:r/Ar.z);let a=s.originalGeometry;return n>0?(a===void 0||(o==null?void 0:o.subdivisions)!==n)&&(a===void 0&&(a=s),s=new mp(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),a!==void 0&&Object.assign(s,{originalGeometry:a}),delete i.geometry,Object.assign(s,{userData:be(se({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Gs(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Ar);let o=100/Ar.x;Object.assign(s.parameters,{width:100,height:Ar.y*o,depth:Ar.z*o}),e(this.build(s))})}};var o1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}=i.parameters,l=i.shape,c=e*.5,u=t*.5,h=0,f=0,d=2*Math.PI/r;for(let m=0;m<r;m++){let g=d*m,v=h+Math.sin(g)*c,y=f+Math.cos(g)*u;l.addPoint(l.createPoint(v,y))}l.isClosed=!0;for(let m=0,g=l.points.length;m<g;m++)l.points[m].roundness=n;l.roundness=n,l.update();let p=Gr.create({shape:l,parameters:{roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(p,{userData:be(se({},i),{type:"PolygonGeometry"})})}};var a1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=new fv(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:be(se({},i),{type:"PyramidGeometry"})})}};function Yu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function hv(i,e,t,r,n,s){let o=e.clone().sub(i),a=t.clone().sub(i),l=o.angleTo(a);if(o.normalize(),a.normalize(),r===n){let c=o.add(a).normalize();s.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=o.angleTo(a);s.copy(i),s.addScaledVector(o,n/Math.sin(c)),s.addScaledVector(a,r/Math.sin(c))}}function GO(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var fv=class extends Ie{constructor(e=.5,t=1,r=4,n=1,s=!1,o=0,a=4){super(),r=Math.floor(Math.max(3,r)),n=Math.floor(n),a=Math.floor(a);let l=[],c=[],u=[],h=[],f=0,d=t/2,p=Math.PI/r,m=e*Math.cos(Math.PI/r),g=2*Math.PI/r,v=(r-2)*Math.PI/r,y=Math.PI-v,w=new M(0,-d,0),b=new M(0,d,0),S=new N(e,-d),T=new N(m,-d),A=new N(0,b.y).sub(T),x=new N(0,b.y).sub(S),E=new N(A.y,-A.x).normalize(),_=new N(x.y,-x.x).normalize(),P=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-A.angle())/2)-1e-8;o=Math.min(o,P);let B;{let F=new M(E.x,E.y,0),k=new M(Math.cos(g)*F.x,F.y,Math.sin(g)*F.x);B=F.angleTo(k)}let R=o/Math.tan((Math.PI-A.angle())/2),U=o/Math.tan((Math.PI-B)/2),z=new M;if(!s){c.push(w.x,w.y,w.z),u.push(0,-1,0),h.push(0,0);let F=f++,k=[],O=S.clone(),j=R/Math.cos(Math.PI/r);O.x-=j;for(let q=0;q<r;q++){let K=q/r*Math.PI*2+p,W=new N(Math.sin(K),Math.cos(K));Yu(O,W,z),c.push(z.x,z.y,z.z),u.push(0,-1,0),h.push(0,0),k.push(f++)}for(let q=0;q<k.length;q++)l.push(k[q],F,k[(q+1)%k.length])}let J=[];{let F=new M,k=new M,O=new M,j=new M,q=new M,K=new M;for(let W=0;W<r;W++){let ge=W/r*Math.PI*2+p,oe=(W+.5)/r*Math.PI*2+p,le=(W+1)/r*Math.PI*2+p,H=new N(Math.sin(ge),Math.cos(ge)),ue=new N(Math.sin(oe),Math.cos(oe)),Z=new N(Math.sin(le),Math.cos(le));Yu(S,H,k),Yu(S,Z,O),Yu(E,ue,F),hv(b,k,O,U,U,j),c.push(j.x,j.y,j.z),hv(k,b,O,U,R,q),c.push(q.x,q.y,q.z),hv(O,k,b,R,U,K),c.push(K.x,K.y,K.z),u.push(F.x,F.y,F.z),u.push(F.x,F.y,F.z),u.push(F.x,F.y,F.z),h.push(0,0),h.push(0,0),h.push(0,0);let V=f++,$=f++,ce=f++;if(l.push(V,$,ce),o>0){{let ve=k.clone().add(O).multiplyScalar(.5),me=b.clone().sub(ve).normalize(),ke=w.clone().sub(ve).normalize().add(me).normalize().multiplyScalar(-1),I=K.clone().sub(q);Q(ve,I,ke,A.angle())}let ie,pe;{let ve=new M;Yu(_,Z,ve);let me=K.clone().add(j).multiplyScalar(.5);me=GO(me,O,b);let De=K.clone().sub(j);[ie,pe]=Q(me,De,ve,B,j.y)}{let ve=ie,me=ve.clone().setY(0).normalize(),De=new M(0,-1,0),ke=me.clone().cross(De);X(ve,me,De,ke)}J.concat(pe);{let ve=A.angle(),me=Math.PI-ve,De=b.clone();De.y-=o/Math.sin(ve-Math.PI/2);let ke=new M,I=[];for(let te=0;te<a;te++){let ye=[],Se=Math.PI/2-me*te/a,Pe=Math.cos(Se),Fe=Math.sin(Se),he=oe;for(let nt=0;nt<=te;nt++){let st=Math.cos(he),Te=Math.sin(he);F.x=Pe*Te,F.y=Fe,F.z=Pe*st,ke.copy(De).addScaledVector(F,o),c.push(ke.x,ke.y,ke.z),u.push(F.x,F.y,F.z),h.push(0,0),ye.push(f++),he+=Math.PI*2/te/r}I.push(ye)}pe.reverse(),I.push(pe);let L=I.length-1;for(let te=0;te<L;te++){let ye=I[te],Se=I[te+1],Pe=ye.length-1;l.push(Se[1],ye[0],Se[0]);for(let Fe=1;Fe<=Pe;Fe++)l.push(ye[Fe],ye[Fe-1],Se[Fe]),l.push(Se[Fe+1],ye[Fe],Se[Fe])}}}}}this.setIndex(l),this.setAttribute("position",new Le(c,3)),this.setAttribute("normal",new Le(u,3)),this.setAttribute("uv",new Le(h,2));function Q(F,k,O,j,q){let K=-j/2,W=(Math.PI-j)/2,ge=k.clone().normalize().cross(O);F.addScaledVector(O,-o/Math.sin(W));let oe=new M,le=new M,H=1,ue=f,Z=[];for(let V=0;V<=a;V++){let $=K+V/a*j;le.set(0,0,0),le.addScaledVector(ge,Math.sin($)),le.addScaledVector(O,Math.cos($));for(let ce=0;ce<=H;ce++){let ie=ce/H-.5;if(oe.copy(F),oe.addScaledVector(k,ie),oe.addScaledVector(le,o),q!=null){let pe=Math.max(0,oe.y-q);oe.addScaledVector(k,-pe/k.y)}c.push(oe.x,oe.y,oe.z),u.push(le.x,le.y,le.z),h.push(0,0),ce===0&&Z.push(f),f++}}for(let V=0;V<a;V++)for(let $=0;$<H;$++){let ce=ue+$+(H+1)*V,ie=ce+(H+1),pe=ie+1,ve=ce+1;l.push(ce,ie,ve),l.push(ie,pe,ve)}return[F.clone().addScaledVector(k,.5),Z]}function X(F,k,O,j){let q=Math.PI/2,K=x.angle()-q,W=[],ge=new M,oe=new M;for(let H=0;H<=a;H++){let ue=[],Z=H/a;for(let V=0;V<=H;V++){let ce=((H?V/H:0)-.5)*y,ie=Math.cos(ce),pe=Math.sin(ce),ve=Math.atan(Math.tan(K)*ie),me=(q+ve)*Z,De=Math.cos(me),ke=Math.sin(me);ge.set(0,0,0),ge.addScaledVector(k,ke*ie),ge.addScaledVector(O,De),ge.addScaledVector(j,ke*pe),oe.copy(F).addScaledVector(ge,o),c.push(oe.x,oe.y,oe.z),u.push(ge.x,ge.y,ge.z),h.push(0,0),ue.push(f++)}W.push(ue)}let le=W.length-1;for(let H=0;H<le;H++){let ue=W[H],Z=W[H+1],V=ue.length-1;l.push(ue[0],Z[1],Z[0]);for(let $=1;$<=V;$++)l.push(ue[$-1],ue[$],Z[$]),l.push(ue[$],Z[$+1],Z[$])}}}};var gp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,o,a,l;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((o=e==null?void 0:e.ui)!=null?o:{enabledIndieCorners:!1},i.ui);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((a=t.height)!=null?a:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(l=t.depth)!=null?l:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}=i.parameters,c={x:t*.5,y:r*.5},u={x:-c.x,y:-c.y},h={x:c.x,y:c.y};function f(b,S,T){return S>t&&T>r?Math.min(b*t/S,b*r/T):S>t?b*t/S:T>r?b*r/T:b}let d=[];d[0]=n[0]===0?0:f(n[0],n[0]+n[3],n[0]+n[1]),d[1]=n[1]===0?0:f(n[1],n[1]+n[2],n[1]+n[0]),d[2]=n[2]===0?0:f(n[2],n[2]+n[1],n[2]+n[3]),d[3]=n[3]===0?0:f(n[3],n[3]+n[0],n[3]+n[2]);let p=u.x,m=h.x,g=h.y,v=u.y;e.addPoint(e.createPoint(p,g)),e.addPoint(e.createPoint(m,g)),e.addPoint(e.createPoint(m,v)),e.addPoint(e.createPoint(p,v)),e.isClosed=!0;let y=!0;for(let b=0,S=e.points.length;b<S;b++)e.points[b].roundness=d[b],b>0&&d[b]!==d[b-1]&&(y=!1);y&&(e.roundness=d[0]),e.useCubicForRoundedCorners=s!==1,e.update();let w=Gr.create({shape:e,parameters:{depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(w,{userData:be(se({},i),{type:"RectangleGeometry"})})}};var l1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:o,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,u=new Do(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:be(se({},i),{type:"SphereGeometry"})})}};var c1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new ts(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:be(se({},i),{type:"PlaneGeometry"})})}};var u1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}=i.parameters,u=i.shape,h=e*.5,f=t*.5,d=0,p=0,m=o*Math.PI/360/n,g=Math.PI/2*3*-1,v=h*r/100,y=f*r/100;if(n===3&&r===50){m=2*Math.PI/n;for(let b=0;b<n;b++){let S=m*b,T=d+Math.sin(S)*h,A=p+Math.cos(S)*f;u.addPoint(u.createPoint(T,A))}}else for(let b=0;b<n;b++){let S=d+Math.cos(g)*h,T=p+Math.sin(g)*f;u.addPoint(u.createPoint(S,T)),g+=m,S=d+Math.cos(g)*v,T=p+Math.sin(g)*y,b<=n,u.addPoint(u.createPoint(S,T)),g+=m}u.isClosed=!0;for(let b=0,S=u.points.length;b<S;b++)u.points[b].roundness=s;u.roundness=s,u.update();let w=Gr.create({shape:u,parameters:{roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(w,{userData:be(se({},i),{type:"StarGeometry"})})}};var yp=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new ts(e,t);return Object.assign(r,{userData:be(se({},i),{type:"TextFrameGeometry"})})}};var h1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),n=Math.abs((a=t.height)!=null?a:t.width),s=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:o,cornerRadius:a,cornerSegments:l}=i.parameters,c=kO(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:be(se({},i),{type:"TorusGeometry"})})}};function kO(i,e,t,r,n,s,o,a,l,c,u){return[e,t]=[t,e],o=e/2,n/=2*Math.PI,n==1&&(c=0),new ju(!0,i,e,t,r,n,s,o,a,l,c,u)}var f1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(o=t.tube)!=null?o:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:o}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new za(a,t,r,n,s,o);return Object.assign(l,{userData:be(se({},i),{type:"TorusKnotGeometry"})})}};var d1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof At?i.shape:new At,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a}=i.parameters,l=i.shape,c=e*.5,u=t*.5;a?(l.addPoint(l.createPoint(-c,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))):(l.addPoint(l.createPoint(0,u)),l.addPoint(l.createPoint(c,-u)),l.addPoint(l.createPoint(-c,-u))),l.isClosed=!0;for(let f=0,d=l.points.length;f<d;f++)l.points[f].roundness=r;l.roundness=r,l.update();let h=Gr.create({shape:l,parameters:{roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(h,{userData:be(se({},i),{type:"TriangleGeometry"})})}};var Xu={};pT(Xu,{addBarycentricAttribute:()=>WO,fixUvs:()=>qO,loadFromUrl:()=>jO,resizeGeometry:()=>HO,roundShapePolygon:()=>VO});var p1=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,o=r/n,a=Math.atan2(o,s);return{x:t,y:r,len:n,nx:s,ny:o,ang:a}},VO=(i,e,t)=>{let r,n,s,o,a,l,c,u,h,f,d,p,m,g,v=e.length;for(o=e[v-2],i.curves=[],r=1;r<v-1;r++){a=e[r%v],l=e[(r+1)%v];let y=p1(a,o),w=p1(a,l);c=y.nx*w.ny-y.ny*w.nx,u=y.nx*w.nx-y.ny*-w.ny,d=Math.asin(c),h=1,f=!1,u<0?d<0?d=Math.PI+d:(d=Math.PI-d,h=-1,f=!0):d>0&&(h=-1,f=!0),p=d/2,g=Math.abs(Math.cos(p)*t/Math.sin(p)),g>Math.min(y.len/2,w.len/2)?(g=Math.min(y.len/2,w.len/2),m=Math.abs(g*Math.sin(p)/Math.cos(p))):m=t,n=a.x+w.nx*g,s=a.y+w.ny*g,n+=-w.ny*m*h,s+=w.nx*m*h,i.absarc(n,s,m,y.ang+Math.PI/2*h,w.ang-Math.PI/2*h,f),o=a,a=l}i.closePath()},HO=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,o,a;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,o=1):o=t/n.height,r===0?(r=n.depth,a=1):a=r/n.depth,i.scale(s,o,a),n.width=e,n.height=t,n.depth=r},WO=(i,e)=>{let t=[new M(1,0,0),new M(0,1,0),new M(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Le(n,3))},jO=i=>new Promise(e=>{new Gs().load(i,r=>e(r))}),qO=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),o=r.getY(n);r.setXY(n,(s+e/2)/e,1-(o-t/2)/t*-1)}};var YO,vp=new Promise(i=>{YO=i});var Ye;vp.then(i=>{Ye=i});var m1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),g1=new Uint32Array([0,1,2,3]),y1=new Uint8Array([4]),Pn=class{static build(i,e,t,r,n){let s,o,a;if(i===void 0)s=Pn.allocate(n,t),Ye.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(Ye.free_bvh(e),Ye.free_subdivision_surface(e));try{s=Pn.allocate(n,void 0,i)}catch(l){console.error(l,i),s=Pn.allocate(n,void 0,{positionWASM:m1,indexWASM:g1,verticesPerFaceWASM:y1})}Ye.set_destination_refinement_level(s,0),o=Pn.buildLevel(s,!0,r)}else s=e;if(i!==void 0&&i.subdivisions!==void 0){let l=XO(i.subdivisions,i.positionWASM.length);Ye.set_destination_refinement_level(s,l),l>0?a=Pn.buildLevel(s,!1,r):a=null}return{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var S;let r,n,s,o=[],a=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM):(r=m1,n=g1,s=y1);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let T=SM(e);r=T.attributes.position.array;let A=T.getIndex().array,x=A.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":n=new Uint32Array(x/3*2),s=new Uint8Array(x/6).fill(4);for(let U=0,z=0;U<x;U+=6)n[z++]=A[U],n[z++]=A[U+1],n[z++]=A[U+4],n[z++]=A[U+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let E,_,C;if(e.userData.type==="SphereGeometry")_=e.parameters.heightSegments,E=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(C=!0);else if(e.userData.type==="CylinderGeometry")_=e.parameters.heightSegments+2,E=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")_=e.parameters.heightSegments+1,E=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let U=e.userData.parameters;_=Math.ceil(U.tubularSegments*U.arc/(2*Math.PI))+2,E=U.radialSegments}else{let{pathSegments:U,segments:z,revolutions:J}=e.userData.parameters;_=Math.ceil(z*J)+2,E=U}C?(n=new Uint32Array(1*E*3+(_-1)*E*4),s=new Uint8Array(1*E+(_-1)*E)):(n=new Uint32Array(2*E*3+(_-2)*E*4),s=new Uint8Array(2*E+(_-2)*E));let P=0,B=0,R=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;B<3*E;)n[B++]=A[P++],n[B++]=A[P++],n[B++]=A[P++],s[R++]=3;let U=C?n.length:3*E+4*(_-2)*E;for(;B<U;P+=6)n[B++]=A[P],n[B++]=A[P+1],n[B++]=A[P+4],n[B++]=A[P+5],s[R++]=4}else for(;B<4*(_-2)*E;P+=6)n[B++]=A[P],n[B++]=A[P+1],n[B++]=A[P+4],n[B++]=A[P+5],s[R++]=4;for(;B<n.length;)n[B++]=A[P++],n[B++]=A[P++],n[B++]=A[P++],s[R++]=3;break;default:n=A,s=new Uint8Array(x/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,h=r.length+o.length+a.length,f=n.length+s.length,d=h*Float32Array.BYTES_PER_ELEMENT+f*Uint32Array.BYTES_PER_ELEMENT,p=h*Float32Array.BYTES_PER_ELEMENT,m=f*Uint32Array.BYTES_PER_ELEMENT,g=Ye._malloc(d),v=new Float32Array(Ye.HEAPF32.buffer,g,h),y=new Uint32Array(Ye.HEAPU32.buffer,g+p,f);v.set(r,0),v.set(o,r.length),v.set(a,r.length+o.length),y.set(n,0),y.set(s,n.length);let w;(S=t==null?void 0:t.scaleBaked)!=null&&S.some(T=>T!==1)&&(w=new _e().makeScale(...t.scaleBaked)),i&&(w?w.premultiply(i):w=i);let b=w?Ye.alloc_subdivision_surface2(g,l,g+p,c,g+p+n.length*Uint32Array.BYTES_PER_ELEMENT,u,w.elements):Ye.alloc_subdivision_surface(g,l,g+p,c,g+p+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return Ye._free(g),b}static buildLevel(i,e,t,r,n){let s=n?Ye.get_mesh_data2(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t!=null?t:!e,n.elements):Ye.get_mesh_data(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t!=null?t:!e),o=8,a=Ye.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=Ye.HEAPU32[a[c]>>2],h=Ye.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let f=Ye.HEAPU32[a[c]>>2],d=Ye.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let p=Ye.HEAPU32[a[c]>>2],m=Ye.HEAPU32.subarray(p>>2,(p>>2)+l[c]);c++;let g=Ye.HEAPU32[a[c]>>2],v=Ye.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let y=new Ie;if(y.setIndex(new Is(v,1)),y.setAttribute("position",new Le(h,3)),y.setAttribute("normal",new Le(d,3)),e){y.setAttribute("faceMap",new Is(m,1));let w=new Float32Array(d.length/3*4).fill(0);y.setAttribute("color",new Ue(w,4))}return Ye.free_mesh_data(s),y.userData.type="SubdivGeometry",y}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Ye.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Ye.get_wireframe_data_for_base_level(i),n=4,s=Ye.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=Ye.HEAPU32[s[a]>>2],c=Ye.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=Ye.HEAPU32[s[a]>>2],h=Ye.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let f=new Ie;f.setAttribute("position",new Le(c,3));let d=new Float32Array(c.length);for(let p=0,m=c.length;p<m;)d[p++]=t.r,d[p++]=t.g,d[p++]=t.b;return f.setAttribute("color",new Ue(d,3)),f.setIndex(new Is(h,1)),Ye.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,Ye.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Ye.set_destination_refinement_level(i,1);let r=t?Ye.get_topological_data2(i,e?Ye.Level.CONTROL:Ye.Level.REFINED,t.elements):Ye.get_topological_data(i,e?Ye.Level.CONTROL:Ye.Level.REFINED),n=6,s=Ye.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=Ye.HEAPU32[s[a]>>2],c=new Float32Array(Ye.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=Ye.HEAPU32[s[a]>>2],h=new Uint32Array(Ye.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let f=Ye.HEAPU32[s[a]>>2],d=new Uint8Array(Ye.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return Ye.free_topological_data(r),{positions:c,indices:h,verticesPerFace:d}}};function XO(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var dv={ConeGeometry:PM,CubeGeometry:IM,CylinderGeometry:DM,DodecahedronGeometry:RM,EllipseGeometry:ZM,HelixGeometry:r1,IcosahedronGeometry:n1,LatheGeometry:i1,NonParametricGeometry:s1,PolygonGeometry:o1,PyramidGeometry:a1,RectangleGeometry:gp,SphereGeometry:l1,PlaneGeometry:c1,StarGeometry:u1,TextFrameGeometry:yp,TorusGeometry:h1,TorusKnotGeometry:f1,TriangleGeometry:d1,VectorGeometry:Gr},Ju=i=>dv[i.type].create(i);var kr=class extends xe{constructor(t,r,n,s){super(t,r,n);this.isColorA=!0;this.a=s}setRGBA(t,r,n,s){super.setRGB(t,r,n),this.a=s}copy(t){return super.copy(t),this.a="a"in t?t.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(t){this.r=t}set y(t){this.g=t}set z(t){this.b=t}set w(t){this.a=t}};function fr(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new kr(0,0,0,0))}else return"a"in i?new kr(i.r,i.g,i.b,i.a):new kr(i.r,i.g,i.b,1);return t}var jo=i=>"isEntity"in i,us=i=>"isAbstractMesh"in i,v1=i=>i.objectType==="CombinedCamera",x1=i=>jo(i)&&(i.objectType==="LightDirectional"||i.objectType==="LightSpot"||i.objectType==="LightPoint");var hs=i=>"objectHelper"in i;function pv(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:_i.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function JO(i,e){pv(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function b1(i,e,t){JO(i,e),e.color!==void 0&&(i.color=fr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof zs)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof zs)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&hs(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function w1(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var Rl=new Qt,Vr=new M,Ge=new M,xr=new _e;function QO(i,e,t=0,r=e.count){let n=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let u=t;u<r;u++){let h=e.getX(u),f=e.getY(u),d=e.getZ(u);h<n&&(n=h),f<s&&(s=f),d<o&&(o=d),h>a&&(a=h),f>l&&(l=f),d>c&&(c=d)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var S1=(i,e,t,r)=>{var n;if(us(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Vr.copy(i.originalGeometry.boundingSphere.center):(QO(Rl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Rl.getCenter(Vr)),i.forceComputeSize?Rl.getSize(Ge).multiplyScalar(.5):Ge.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(hs(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Rl.setFromArray(s.array),Rl.getCenter(Vr),Rl.getSize(Ge).multiplyScalar(.5)}else Vr.setScalar(0),Ge.setScalar(0);xr.copy(e).multiply(i.matrixWorld),Ge.x===0&&Ge.y===0&&Ge.z===0?t.push(new M(Vr.x,Vr.y,Vr.z).applyMatrix4(xr)):t.push(new M(-Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,-Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,Ge.y,Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(-Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,-Ge.y,-Ge.z).add(Vr).applyMatrix4(xr),new M(Ge.x,Ge.y,-Ge.z).add(Vr).applyMatrix4(xr))},Qu=class extends Qt{constructor(){super(...arguments);this.matrix=new _e;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let n=new _e().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,n,r)}expandByObjectSize(t,r,n=!1){let s=[];return n===!0?t.traverseEntity(o=>{o.visible&&S1(o,r,s,t.enableHelper===!0)}):S1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(xr.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(Ge).multiplyScalar(.5),this.getCenter(Vr),xr.copy(this.matrix).setPosition(Vr),this.vertices=[new M(-Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new M(-Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new M(Ge.x,-Ge.y,Ge.z).applyMatrix4(xr),new M(Ge.x,Ge.y,Ge.z).applyMatrix4(xr),new M(-Ge.x,Ge.y,-Ge.z).applyMatrix4(xr),new M(-Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new M(Ge.x,-Ge.y,-Ge.z).applyMatrix4(xr),new M(Ge.x,Ge.y,-Ge.z).applyMatrix4(xr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Xr(this.vertices[0],this.vertices[3]),new Xr(this.vertices[1],this.vertices[2]),new Xr(this.vertices[5],this.vertices[6]),new Xr(this.vertices[4],this.vertices[7]),new Xr(this.vertices[0],this.vertices[1]),new Xr(this.vertices[3],this.vertices[2]),new Xr(this.vertices[7],this.vertices[6]),new Xr(this.vertices[4],this.vertices[5]),new Xr(this.vertices[0],this.vertices[4]),new Xr(this.vertices[1],this.vertices[5]),new Xr(this.vertices[2],this.vertices[6]),new Xr(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(t=>t.getCenter(new M))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new M().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new M().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new M().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new M().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new M().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new M().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function Ku(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function KO(i){let e=[];for(let t in i)e.push(i[t]);return e}var xp=i=>class extends i{hasEntityChild(){return this.children.some(t=>jo(t))}isDescendantOf(t){t instanceof ot&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new _e().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),jo(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(jo(o)||o instanceof yn)&&s.children.push(o.toJSON(t).object)}if(r){let o=Ku(t.geometries),a=Ku(t.materials),l=Ku(t.textures),c=Ku(t.images),u=Ku(t.interactionStates),h=KO(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),h.length>0&&(n.nodes=h)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var Yn=i=>"isEntity"in i;var Xn=i=>class extends xp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new _e;this._singleBBox=new Qu;this._recursiveBBox=new Qu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let n of this.children)Yn(n)&&n.traverseEntity(s=>{hs(s)&&s.visible&&(s.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Yn(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let n of this.children)Yn(n)&&n.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let n of this.children)n.updateMatrixWorld(r)}updateWorldMatrix(r,n){let s=this.parent;if(r&&s!==null&&s.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),n)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Yn(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,n=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),n===!0)for(let s of r.children)Yn(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new _e,n=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(n);for(let s of this.children)Yn(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let n=super.toJSON(r),s=n.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),n}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let n=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new _e}),this.copy(r),r.children=n,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let n={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return yl(n,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let n=se({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return yl(n,r)}fromState(r,n){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};var Zu=class extends ot{constructor(t,r={}){super();this.object=t;let n=t.recursiveBBox.getSize(new M),s=.1;this.parameters=Od.defaultData(n.toArray(),s),zo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(t){let r=this.object.material.map(n=>n.clone());for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let n of this.children)n.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(t=>t.updateMatrix())}_updateCount(){let t=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==t)if(this.children.length<t)for(let r=0,n=t-this.children.length;r<n;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,n=this.children.length-t;r<n;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,n=r.start*tt.DEG2RAD,s=r.end*tt.DEG2RAD,o=n-s,a=new pn(r.rotation[0]*tt.DEG2RAD,r.rotation[1]*tt.DEG2RAD,r.rotation[2]*tt.DEG2RAD),l;switch(r.axis){case"z":l=new M(0,0,1);break;case"y":l=new M(0,1,0);break;default:case"x":l=new M(1,0,0);break}for(let[c,u]of this.children.entries()){u.hiddenMatrix.identity(),u.scale.x=r.scale[0],u.scale.y=r.scale[1],u.scale.z=r.scale[2],u.position.setScalar(0);let h=o/t.count*c-n;switch(r.axis){case"x":u.rotation.set(0,h,0);break;case"y":u.rotation.set(0,0,h);break;case"z":u.rotation.set(h,0,0);break}u.translateOnAxis(l,r.radius),u.position.x+=r.position[0],u.position.y+=r.position[1],u.position.z+=r.position[2],r.alignment===!0?(u.rotation.x+=a.x,u.rotation.y+=a.y,u.rotation.z+=a.z):u.rotation.copy(a)}}_updateLinear(t){if(t.type!=="linear")throw new Error;let r=t.linear,n=new pn(r.rotation[0]*tt.DEG2RAD,r.rotation[1]*tt.DEG2RAD,r.rotation[2]*tt.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=n.x*s,o.rotation.y=n.y*s,o.rotation.z=n.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,n=t.grid;if(n.useCenter===!0){let s={x:n.count[0]%2===0?2:1,y:n.count[1]%2===0?2:1,z:n.count[2]%2===0?2:1},o=new M(n.size[0]*(n.count[0]-s.x)*.5,n.size[1]*(n.count[1]-s.y)*.5,n.size[2]*(n.count[2]-s.z)*.5);for(let a=0;a<n.count[0];a++)for(let l=0;l<n.count[1];l++)for(let c=0;c<n.count[2];c++){let u=this.children[r++];u.hiddenMatrix.identity(),u.scale.setScalar(1),u.rotation.set(0,0,0),u.position.x=n.size[0]*a-o.x,u.position.y=n.size[1]*l-o.y,u.position.z=n.size[2]*c-o.z}}else for(let s=0;s<n.count[0];s++)for(let o=0;o<n.count[1];o++)for(let a=0;a<n.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=n.size[0]*s,l.position.y=-n.size[1]*o,l.position.z=-n.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),zo(this.parameters,t),this.update(),this}};var Yt=class extends Xn(Gt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),this.material[t!=null?t:this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,n=dv[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=n.build(n.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,n){Xu.resizeGeometry(this.geometry,{width:t,height:r,depth:n})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,n=Ju(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(n,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new Zu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Zu(this)),this.cloner.fromClonerState(t))}fromState(t,r){var n,s;return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=(n=t.castShadow)!=null?n:!0,this.receiveShadow=(s=t.receiveShadow)!=null?s:!0),this}};var $u=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};var He=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=tt.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,o){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof He&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var mv=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},Tr=new mv;var Xe=class extends He{constructor(t,r){super(t);this.scope="";r=r!=null?r:{},this.shared=r.shared!==void 0?r.shared:!0,this.unique=r.unique!==void 0?r.unique:!1}build(t,r,n,s){if(r=r!=null?r:this.getType(t),this.getShared(t,r)){let o=this.getUnique(t,r);o&&this.uuid===void 0&&(this.uuid=tt.generateUUID()),n=t.getUUID(n!=null?n:this.getUUID(),!o);let a=t.getNodeData(n),l=a.output||this.getType(t);if(t.analyzing)return(a.deps||0)>0||this.getLabel()?(this.appendDepsNode(t,a,r),this.generate(t,r,n)):super.build(t,r,n);if(o)return a.name=a.name||super.build(t,r,n),a.name;if(!this.getLabel()&&(!this.getShared(t,l)||t.context.ignoreCache||a.deps===1))return super.build(t,r,n);n=this.getUUID(!1);let c=this.getTemp(t,n);if(c)return t.format(c,l,r);{c=super.generate(t,r,n,a.output,s);let u=this.generate(t,l,n);return t.addNodeCode(c+" = "+u+";"),t.format(c,l,r)}}return super.build(t,r,n)}getShared(t,r){return r!=="sampler2D"&&r!=="samplerCube"&&this.shared}getUnique(t,r){return this.unique}setLabel(t){return this.label=t,this}getLabel(){return this.label}getUUID(t){let r=this.uuid;return typeof this.scope=="string"&&(r=this.scope+"-"+r),r}getTemp(t,r){r=r||this.uuid;let n=t.getVars()[r];return n?n.name:void 0}generate(t,r,n,s,o){return this.getShared(t,r)||console.error("TempNode is not shared"),n=n!=null?n:this.uuid,t.getTempVar(n,s!=null?s:this.getType(t),o,this.getLabel()).name}};var Ht=class extends Xe{constructor(t,r){r=r!=null?r:{},r.shared=r.shared!==void 0?r.shared:!1;super(t,r);this.readonly=!1}setReadonly(t){return this.readonly=t,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(t){let r=super.createJSONNode(t);return this.readonly===!0&&(r.readonly=this.readonly),r}fromJSON(t,r){return super.fromJSON(t,r),t.readonly!==void 0&&this.setReadonly(t.readonly),this}generate(t,r,n,s,o,a){n=t.getUUID(n!=null?n:this.getUUID()),s=s!=null?s:this.getType(t);let l=t.getNodeData(n);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(t,r,n,s,o,a):t.isShader("vertex")?(l.vertex||(l.vertex=t.createVertexUniform(s,this,o,a,this.getLabel())),t.format(l.vertex.name,s,r)):(l.fragment||(l.fragment=t.createFragmentUniform(s,this,o,a,this.getLabel())),t.format(l.fragment.name,s,r))}copy(t){return super.copy(t),this.readonly=t.readonly,this}};var Ir=class extends Ht{constructor(t=0,r){super("v2");this.nodeType="Vector2";this.value=t instanceof N?t:new N(t,r)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}generateReadonly(t,r,n,s,o,a){return t.format("vec2("+this.value.x+", "+this.value.y+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var Rr=class extends Ht{constructor(t=0,r,n){super("v3");this.nodeType="Vector3";this.value=t instanceof M?t:new M(t,r,n)}get x(){return this.value.x}set x(t){this.value.x=t}get y(){return this.value.y}set y(t){this.value.y=t}get z(){return this.value.z}set z(t){this.value.z=t}generateReadonly(t,r,n,s,o,a){return t.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var ui=class extends Ht{constructor(t){super("v4");this.nodeType="Vector4";this.value=t instanceof kr?t:new kr(t.r,t.g,t.b,t.a)}generateReadonly(t,r,n,s,o,a){return t.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",s,r)}copy(t){return super.copy(t),this.value.copy(t.value),this}};var ZO=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,M1=/[a-z_0-9]+/gi,Ne=class extends Xe{constructor(t,r,n,s,o){super(o);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=o===void 0,this.isInterface=!1,this.parse(t,r,n,s)}getShared(t,r){return!this.isMethod}getType(t){return t.getTypeByFormat(this.type)}getInputByName(t){if(this.inputs){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}}getIncludeByName(t){if(this.includes){let r=this.includes.length;for(;r--;)if(this.includes[r].name===t)return this.includes[r]}}generate(t,r,n,s,o){let a,l=0,c=this.src;if(this.includes)for(let h=0;h<this.includes.length;h++)t.include(this.includes[h],this);for(let h in this.extensions)t.extensions[h]=!0;let u=[];for(;a=M1.exec(this.src);)u.push(a);for(let h=0;h<u.length;h++){let f=u[h],d=f[0],p=this.isMethod?!this.getInputByName(d):!0,m=d;if(this.keywords[d]||this.useKeywords&&p&&Tr.containsKeyword(d)){let g=this.keywords[d];if(!g){let v=Tr.getKeywordData(d);v.cache&&(g=t.keywords[d]),g=g||Tr.getKeyword(d,t),v.cache&&(t.keywords[d]=g)}m=g.build(t)}d!==m&&(c=c.substring(0,f.index+l)+m+c.substring(f.index+d.length+l),l+=m.length-d.length),this.getIncludeByName(m)===void 0&&Tr.contains(m)&&t.include(Tr.get(m))}return r==="source"?c:this.isMethod?(this.isInterface||t.include(this,void 0,c),this.name):t.format("( "+c+" )",this.getType(t),r)}parse(t,r,n,s){if(this.src=t||"",this.includes=r!=null?r:[],this.extensions=n!=null?n:{},this.keywords=s!=null?s:{},this.isMethod){let o=ZO.exec(this.src);if(this.inputs=[],o&&o.length==4){this.type=o[1],this.name=o[2];let a=o[3].match(M1);if(a){let l=0;for(;l<a.length;){let c=a[l++],u;c==="in"||c==="out"||c==="inout"?u=a[l++]:(u=c,c="");let h=a[l++];this.inputs.push({name:h,type:u,qualifier:c})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(t){return super.copy(t),this.isMethod=t.isMethod,this.useKeywords=t.useKeywords,t.type!==void 0&&(this.type=t.type),this.parse(t.src,t.includes,t.extensions,t.keywords),this}toJSON(t){var n;let r=this.getJSONNode(t);if(!r){r=this.createJSONNode(t),r.src=this.src,r.isMethod=this.isMethod,r.useKeywords=this.useKeywords,this.isMethod||(r.type=this.type),r.extensions=JSON.parse(JSON.stringify(this.extensions));let s={};for(let o in this.keywords)s[o]=this.keywords[o].toJSON(t).uuid;if(r.keywords=s,(n=this.includes)!=null&&n.length){let o=[];for(let a=0;a<this.includes.length;a++)o.push(this.includes[a].toJSON(t).uuid);r.includes=o}r.isMethod=this.isMethod,r.inputs=this.inputs}return r.nodeType=this.nodeType,r}fromJSON(t,r){if(super.fromJSON(t,r),t.inputs!==void 0&&(this.inputs=t.inputs),t.isMethod!==void 0&&(this.isMethod=t.isMethod),t.src&&(this.src=t.src),t.isMethod&&(this.isMethod=t.isMethod),t.useKeywords&&(this.useKeywords=t.useKeywords),t.type&&(this.type=t.type),t.extensions&&(this.extensions=t.extensions),t.keywords&&r){this.keywords={};for(let n in t.keywords)this.keywords[n]=r.getNode(t.keywords[n])}return t.includes&&r&&(this.includes=t.includes.map(n=>r.getNode(n))),this}};var $O=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,gv=class extends Xe{constructor(t="",r){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(t||gv.PI,void 0,void 0,void 0,r)}getType(t){return t.getTypeByFormat(this.type)}parse(t,r,n,s,o){this.src=t||"";let a,l,c="",u=$O.exec(t);this.useDefine=o!=null?o:this.src.charAt(0)==="#",u&&u.length>1?(l=u[1],a=u[2],c=u[3]):(a=this.src,l="f"),this.name=a,this.type=l,this.value=c}build(t,r){if(r==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return t.include(this),t.format(this.name,this.getType(t),r)}generate(t,r,n,s,o){return t.format(this.name,this.getType(t),r)}copy(t){return super.copy(t),this.parse(t.src,void 0,void 0,void 0,t.useDefine),this}},bt=gv;bt.PI="PI",bt.PI2="PI2",bt.RECIPROCAL_PI="RECIPROCAL_PI",bt.RECIPROCAL_PI2="RECIPROCAL_PI2",bt.LOG2="LOG2",bt.EPSILON="EPSILON";var eF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2987
2987
|
)*?)}`,"gim"),tF=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Bl=class extends Xe{constructor(t=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(t)}getType(t){return t.getTypeByFormat(this.name)}getInputByName(t){let r=this.inputs.length;for(;r--;)if(this.inputs[r].name===t)return this.inputs[r]}generate(t,r,n,s,o){return r==="source"?this.src+";":t.format("( "+this.src+" )",this.getType(t),r)}parse(t=""){this.src=t,this.inputs=[];let r=eF.exec(t);if(r){let n=r[2],s;for(;s=tF.exec(n);)this.inputs.push({type:s[1],name:s[2]});this.name=r[1]}else this.name="";this.type=this.name}};var Nl=class extends Xe{constructor(t){super("v2",{shared:!1});this.nodeType="UV";this.index=t!=null?t:0}generate(t,r){t.requires.uv[this.index]=!0;let n=this.index>0?this.index+1:"",s=t.isShader("vertex")?"uv"+n:"vUv"+n;return t.format(s,this.getType(t),r)}copy(t){return super.copy(t),this.index=t.index,this}toJSON(t){let r=this.getJSONNode(t);return r||(r=this.createJSONNode(t),r.index=this.index),r.nodeType=this.nodeType,r}fromJSON(t,r){return super.fromJSON(t,r),t.index&&(this.index=t.index),this}};Tr.addKeyword("uv",function(){return new Nl});Tr.addKeyword("uv2",function(){return new Nl(1)});var qo=class extends Xe{constructor(t=new He,r){super("v4");this.nodeType="ColorSpace";this.factor=new He;this.input=t,this.method=r!=null?r:qo.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(t){switch(t){case dn:return["Linear"];case je:return["sRGB"];default:return[]}}generate(t,r){var l;let n=this.input.build(t,"v4"),s=this.getType(t),o=qo.Nodes[this.method],a=t.include(o);if(a===qo.LINEAR_TO_LINEAR)return t.format(n,s,r);if(((l=o.inputs)==null?void 0:l.length)===2){let c=this.factor.build(t,"f");return t.format(a+"( "+n+", "+c+" )",s,r)}else return t.format(a+"( "+n+" )",s,r)}fromEncoding(t){let r=qo.getEncodingComponents(t);this.method="LinearTo"+r[0],this.factor=r[1]}fromDecoding(t){let r=qo.getEncodingComponents(t);this.method=r[0]+"ToLinear",this.factor=r[1]}copy(t){return super.copy(t),this.input.copy(t.input),this.method=t.method,this.factor.copy(t.factor),this}},hn=qo;hn.Nodes={LinearToLinear:new Ne(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
2988
2988
|
`)),sRGBToLinear:new Ne(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
|
|
2989
2989
|
`)),LinearTosRGB:new Ne(["vec4 LinearTosRGB( in vec4 value ) {"," return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.w );","}"].join(`
|