@splinetool/runtime 0.9.5 → 0.9.6
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
|
@@ -3188,7 +3188,7 @@ void main() {
|
|
|
3188
3188
|
}`,eP=`void main() {
|
|
3189
3189
|
gl_Position = vec4( position, 1.0 );
|
|
3190
3190
|
}`;function u0(i,e,t){let r=new xc,n=new F,s=new F,o=new Qe,a=new wm({depthPacking:vE}),l=new Sm,c={},u=t.maxTextureSize,d={0:zt,1:oi,2:Yt},h=new Rt({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new F},radius:{value:4}},vertexShader:eP,fragmentShader:$2}),p=h.clone();p.defines.HORIZONTAL_PASS=1;let f=new _e;f.setAttribute("position",new Fe(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new Wt(f,h),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Jv,this.render=function(b,w,T){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||b.length===0)return;let S=i.getRenderTarget(),M=i.getActiveCubeFace(),E=i.getActiveMipmapLevel(),C=i.state;C.setBlending(Ut),C.buffers.color.setClear(1,1,1,1),C.buffers.depth.setTest(!0),C.setScissorTest(!1);for(let _=0,O=b.length;_<O;_++){let P=b[_],D=P.shadow;if(D===void 0){console.warn("THREE.WebGLShadowMap:",P,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;n.copy(D.mapSize);let G=D.getFrameExtents();if(n.multiply(G),s.copy(D.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/G.x),n.x=s.x*G.x,D.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/G.y),n.y=s.y*G.y,D.mapSize.y=s.y)),D.map===null&&!D.isPointLightShadow&&this.type===ac){let U={minFilter:tt,magFilter:tt,format:Qt};D.map=new xt(n.x,n.y,U),D.map.texture.name=P.name+".shadowMap",D.mapPass=new xt(n.x,n.y,U),D.camera.updateProjectionMatrix()}if(D.map===null){let U={minFilter:tr,magFilter:tr,format:Qt};D.map=new xt(n.x,n.y,U),D.map.texture.name=P.name+".shadowMap",D.camera.updateProjectionMatrix()}i.setRenderTarget(D.map),i.clear();let R=D.getViewportCount();for(let U=0;U<R;U++){let te=D.getViewport(U);o.set(s.x*te.x,s.y*te.y,s.x*te.z,s.y*te.w),C.viewport(o),D.updateMatrices(P,U),r=D.getFrustum(),x(w,T,D.camera,P,this.type)}!D.isPointLightShadow&&this.type===ac&&y(D,T),D.needsUpdate=!1}v.needsUpdate=!1,i.setRenderTarget(S,M,E)};function y(b,w){let T=e.update(g);h.uniforms.shadow_pass.value=b.map.texture,h.uniforms.resolution.value=b.mapSize,h.uniforms.radius.value=b.radius,i.setRenderTarget(b.mapPass),i.clear(),i.renderBufferDirect(w,null,T,h,g,null),p.uniforms.shadow_pass.value=b.mapPass.texture,p.uniforms.resolution.value=b.mapSize,p.uniforms.radius.value=b.radius,i.setRenderTarget(b.map),i.clear(),i.renderBufferDirect(w,null,T,p,g,null)}function m(b,w,T,S,M,E,C){let _=null,O=S.isPointLight===!0?b.customDistanceMaterial:b.customDepthMaterial;if(O!==void 0?_=O:_=S.isPointLight===!0?l:a,i.localClippingEnabled&&T.clipShadows===!0&&T.clippingPlanes.length!==0){let P=_.uuid,D=T.uuid,G=c[P];G===void 0&&(G={},c[P]=G);let R=G[D];R===void 0&&(R=_.clone(),G[D]=R),_=R}return _.visible=T.visible,_.wireframe=T.wireframe,C===ac?_.side=T.shadowSide!==null?T.shadowSide:T.side:_.side=T.shadowSide!==null?T.shadowSide:d[T.side],_.clipShadows=T.clipShadows,_.clippingPlanes=T.clippingPlanes,_.clipIntersection=T.clipIntersection,_.wireframeLinewidth=T.wireframeLinewidth,_.linewidth=T.linewidth,S.isPointLight===!0&&_.isMeshDistanceMaterial===!0&&(_.referencePosition.setFromMatrixPosition(S.matrixWorld),_.nearDistance=M,_.farDistance=E),_}function x(b,w,T,S,M){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===ac)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,b.matrixWorld);let _=e.update(b),O=b.material;if(Array.isArray(O)){let P=_.groups;for(let D=0,G=P.length;D<G;D++){let R=P[D],U=O[R.materialIndex];if(U&&U.visible){let te=m(b,_,U,S,T.near,T.far,M);i.renderBufferDirect(T,null,_,te,b,R)}}}else if(O.visible){let P=m(b,_,O,S,T.near,T.far,M);i.renderBufferDirect(T,null,_,P,b,null)}}let C=b.children;for(let _=0,O=C.length;_<O;_++)x(C[_],w,T,S,M)}}function tP(i,e,t){let r=t.isWebGL2;function n(){let j=!1,Se=new Qe,fe=null,Ne=new Qe(0,0,0,0);return{setMask:function(De){fe!==De&&!j&&(i.colorMask(De,De,De,De),fe=De)},setLocked:function(De){j=De},setClear:function(De,Be,gt,Mt,Cn){Cn===!0&&(De*=Mt,Be*=Mt,gt*=Mt),Se.set(De,Be,gt,Mt),Ne.equals(Se)===!1&&(i.clearColor(De,Be,gt,Mt),Ne.copy(Se))},reset:function(){j=!1,fe=null,Ne.set(-1,0,0,0)}}}function s(){let j=!1,Se=null,fe=null,Ne=null;return{setTest:function(De){De?q(2929):ee(2929)},setMask:function(De){Se!==De&&!j&&(i.depthMask(De),Se=De)},setFunc:function(De){if(fe!==De){if(De)switch(De){case c_:i.depthFunc(512);break;case u_:i.depthFunc(519);break;case h_:i.depthFunc(513);break;case Np:i.depthFunc(515);break;case d_:i.depthFunc(514);break;case f_:i.depthFunc(518);break;case p_:i.depthFunc(516);break;case m_:i.depthFunc(517);break;default:i.depthFunc(515)}else i.depthFunc(515);fe=De}},setLocked:function(De){j=De},setClear:function(De){Ne!==De&&(i.clearDepth(De),Ne=De)},reset:function(){j=!1,Se=null,fe=null,Ne=null}}}function o(){let j=!1,Se=null,fe=null,Ne=null,De=null,Be=null,gt=null,Mt=null,Cn=null;return{setTest:function(Gt){j||(Gt?q(2960):ee(2960))},setMask:function(Gt){Se!==Gt&&!j&&(i.stencilMask(Gt),Se=Gt)},setFunc:function(Gt,yn,vn){(fe!==Gt||Ne!==yn||De!==vn)&&(i.stencilFunc(Gt,yn,vn),fe=Gt,Ne=yn,De=vn)},setOp:function(Gt,yn,vn){(Be!==Gt||gt!==yn||Mt!==vn)&&(i.stencilOp(Gt,yn,vn),Be=Gt,gt=yn,Mt=vn)},setLocked:function(Gt){j=Gt},setClear:function(Gt){Cn!==Gt&&(i.clearStencil(Gt),Cn=Gt)},reset:function(){j=!1,Se=null,fe=null,Ne=null,De=null,Be=null,gt=null,Mt=null,Cn=null}}}let a=new n,l=new s,c=new o,u={},d=null,h={},p=null,f=!1,g=null,v=null,y=null,m=null,x=null,b=null,w=null,T=!1,S=null,M=null,E=null,C=null,_=null,O=i.getParameter(35661),P=!1,D=0,G=i.getParameter(7938);G.indexOf("WebGL")!==-1?(D=parseFloat(/^WebGL (\d)/.exec(G)[1]),P=D>=1):G.indexOf("OpenGL ES")!==-1&&(D=parseFloat(/^OpenGL ES (\d)/.exec(G)[1]),P=D>=2);let R=null,U={},te=i.getParameter(3088),he=i.getParameter(2978),H=new Qe().fromArray(te),z=new Qe().fromArray(he);function B(j,Se,fe){let Ne=new Uint8Array(4),De=i.createTexture();i.bindTexture(j,De),i.texParameteri(j,10241,9728),i.texParameteri(j,10240,9728);for(let Be=0;Be<fe;Be++)i.texImage2D(Se+Be,0,6408,1,1,0,6408,5121,Ne);return De}let Y={};Y[3553]=B(3553,3553,1),Y[34067]=B(34067,34069,6),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),q(2929),l.setFunc(Np),V(!1),K(Wv),q(2884),le(Ut);function q(j){u[j]!==!0&&(i.enable(j),u[j]=!0)}function ee(j){u[j]!==!1&&(i.disable(j),u[j]=!1)}function k(j){j!==d&&(i.bindFramebuffer(36160,j),d=j)}function pe(j,Se){return Se===null&&d!==null&&(Se=d),h[j]!==Se?(i.bindFramebuffer(j,Se),h[j]=Se,r&&(j===36009&&(h[36160]=Se),j===36160&&(h[36009]=Se)),!0):!1}function ce(j){return p!==j?(i.useProgram(j),p=j,!0):!1}let ne={[ga]:32774,[ZT]:32778,[$T]:32779};if(r)ne[Kv]=32775,ne[Zv]=32776;else{let j=e.get("EXT_blend_minmax");j!==null&&(ne[Kv]=j.MIN_EXT,ne[Zv]=j.MAX_EXT)}let X={[e_]:0,[t_]:1,[r_]:768,[$v]:770,[l_]:776,[o_]:774,[i_]:772,[n_]:769,[ex]:771,[a_]:775,[s_]:773};function le(j,Se,fe,Ne,De,Be,gt,Mt){if(j===Ut){f===!0&&(ee(3042),f=!1);return}if(f===!1&&(q(3042),f=!0),j!==KT){if(j!==g||Mt!==T){if((v!==ga||x!==ga)&&(i.blendEquation(32774),v=ga,x=ga),Mt)switch(j){case To:i.blendFuncSeparate(1,771,1,771);break;case Xv:i.blendFunc(1,1);break;case Yv:i.blendFuncSeparate(0,0,769,771);break;case Qv:i.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}else switch(j){case To:i.blendFuncSeparate(770,771,1,771);break;case Xv:i.blendFunc(770,1);break;case Yv:i.blendFunc(0,769);break;case Qv:i.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",j);break}y=null,m=null,b=null,w=null,g=j,T=Mt}return}De=De||Se,Be=Be||fe,gt=gt||Ne,(Se!==v||De!==x)&&(i.blendEquationSeparate(ne[Se],ne[De]),v=Se,x=De),(fe!==y||Ne!==m||Be!==b||gt!==w)&&(i.blendFuncSeparate(X[fe],X[Ne],X[Be],X[gt]),y=fe,m=Ne,b=Be,w=gt),g=j,T=null}function $(j,Se){j.side===Yt?ee(2884):q(2884);let fe=j.side===zt;Se&&(fe=!fe),V(fe),j.blending===To&&j.transparent===!1?le(Ut):le(j.blending,j.blendEquation,j.blendSrc,j.blendDst,j.blendEquationAlpha,j.blendSrcAlpha,j.blendDstAlpha,j.premultipliedAlpha),l.setFunc(j.depthFunc),l.setTest(j.depthTest),l.setMask(j.depthWrite),a.setMask(j.colorWrite);let Ne=j.stencilWrite;c.setTest(Ne),Ne&&(c.setMask(j.stencilWriteMask),c.setFunc(j.stencilFunc,j.stencilRef,j.stencilFuncMask),c.setOp(j.stencilFail,j.stencilZFail,j.stencilZPass)),ie(j.polygonOffset,j.polygonOffsetFactor,j.polygonOffsetUnits),j.alphaToCoverage===!0?q(32926):ee(32926)}function V(j){S!==j&&(j?i.frontFace(2304):i.frontFace(2305),S=j)}function K(j){j!==YT?(q(2884),j!==M&&(j===Wv?i.cullFace(1029):j===QT?i.cullFace(1028):i.cullFace(1032))):ee(2884),M=j}function ue(j){j!==E&&(P&&i.lineWidth(j),E=j)}function ie(j,Se,fe){j?(q(32823),(C!==Se||_!==fe)&&(i.polygonOffset(Se,fe),C=Se,_=fe)):ee(32823)}function N(j){j?q(3089):ee(3089)}function L(j){j===void 0&&(j=33984+O-1),R!==j&&(i.activeTexture(j),R=j)}function J(j,Se){R===null&&L();let fe=U[R];fe===void 0&&(fe={type:void 0,texture:void 0},U[R]=fe),(fe.type!==j||fe.texture!==Se)&&(i.bindTexture(j,Se||Y[j]),fe.type=j,fe.texture=Se)}function se(){let j=U[R];j!==void 0&&j.type!==void 0&&(i.bindTexture(j.type,null),j.type=void 0,j.texture=void 0)}function ye(){try{i.compressedTexImage2D.apply(i,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function me(){try{i.texImage2D.apply(i,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function Ie(){try{i.texImage3D.apply(i,arguments)}catch(j){console.error("THREE.WebGLState:",j)}}function we(j){H.equals(j)===!1&&(i.scissor(j.x,j.y,j.z,j.w),H.copy(j))}function Re(j){z.equals(j)===!1&&(i.viewport(j.x,j.y,j.z,j.w),z.copy(j))}function Ee(){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={},R=null,U={},d=null,h={},p=null,f=!1,g=null,v=null,y=null,m=null,x=null,b=null,w=null,T=!1,S=null,M=null,E=null,C=null,_=null,H.set(0,0,i.canvas.width,i.canvas.height),z.set(0,0,i.canvas.width,i.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:q,disable:ee,bindFramebuffer:pe,bindXRFramebuffer:k,useProgram:ce,setBlending:le,setMaterial:$,setFlipSided:V,setCullFace:K,setLineWidth:ue,setPolygonOffset:ie,setScissorTest:N,activeTexture:L,bindTexture:J,unbindTexture:se,compressedTexImage2D:ye,texImage2D:me,texImage3D:Ie,scissor:we,viewport:Re,reset:Ee}}function rP(i,e,t,r,n,s,o){let a=n.isWebGL2,l=n.maxTextures,c=n.maxCubemapSize,u=n.maxTextureSize,d=n.maxSamples,h=new WeakMap,p,f=!1;try{f=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(N){}function g(N,L){return f?new OffscreenCanvas(N,L):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function v(N,L,J,se){let ye=1;if((N.width>se||N.height>se)&&(ye=se/Math.max(N.width,N.height)),ye<1||L===!0)if(typeof HTMLImageElement!="undefined"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&N instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&N instanceof ImageBitmap){let me=L?mx:Math.floor,Ie=me(ye*N.width),we=me(ye*N.height);p===void 0&&(p=g(Ie,we));let Re=J?g(Ie,we):p;return Re.width=Ie,Re.height=we,Re.getContext("2d").drawImage(N,0,0,Ie,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+Ie+"x"+we+")."),Re}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function y(N){return kp(N.width)&&kp(N.height)}function m(N){return a?!1:N.wrapS!==ar||N.wrapT!==ar||N.minFilter!==tr&&N.minFilter!==tt}function x(N,L){return N.generateMipmaps&&L&&N.minFilter!==tr&&N.minFilter!==tt}function b(N,L,J,se,ye=1){i.generateMipmap(N);let me=r.get(L);me.__maxMipLevel=Math.log2(Math.max(J,se,ye))}function w(N,L,J){if(a===!1)return L;if(N!==null){if(i[N]!==void 0)return i[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let se=L;return L===6403&&(J===5126&&(se=33326),J===5131&&(se=33325),J===5121&&(se=33321)),L===6407&&(J===5126&&(se=34837),J===5131&&(se=34843),J===5121&&(se=32849)),L===6408&&(J===5126&&(se=34836),J===5131&&(se=34842),J===5121&&(se=32856)),(se===33325||se===33326||se===34842||se===34836)&&e.get("EXT_color_buffer_float"),se}function T(N){return N===tr||N===ih||N===sh?9728:9729}function S(N){let L=N.target;L.removeEventListener("dispose",S),E(L),L.isVideoTexture&&h.delete(L),o.memory.textures--}function M(N){let L=N.target;L.removeEventListener("dispose",M),C(L)}function E(N){let L=r.get(N);L.__webglInit!==void 0&&(i.deleteTexture(L.__webglTexture),r.remove(N))}function C(N){let L=N.texture,J=r.get(N),se=r.get(L);if(!!N){if(se.__webglTexture!==void 0&&(i.deleteTexture(se.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let ye=0;ye<6;ye++)i.deleteFramebuffer(J.__webglFramebuffer[ye]),J.__webglDepthbuffer&&i.deleteRenderbuffer(J.__webglDepthbuffer[ye]);else i.deleteFramebuffer(J.__webglFramebuffer),J.__webglDepthbuffer&&i.deleteRenderbuffer(J.__webglDepthbuffer),J.__webglMultisampledFramebuffer&&i.deleteFramebuffer(J.__webglMultisampledFramebuffer),J.__webglColorRenderbuffer&&i.deleteRenderbuffer(J.__webglColorRenderbuffer),J.__webglDepthRenderbuffer&&i.deleteRenderbuffer(J.__webglDepthRenderbuffer);if(N.isWebGLMultipleRenderTargets)for(let ye=0,me=L.length;ye<me;ye++){let Ie=r.get(L[ye]);Ie.__webglTexture&&(i.deleteTexture(Ie.__webglTexture),o.memory.textures--),r.remove(L[ye])}r.remove(L),r.remove(N)}}let _=0;function O(){_=0}function P(){let N=_;return N>=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),_+=1,N}function D(N,L){let J=r.get(N);if(N.isVideoTexture&&$(N),N.version>0&&J.__version!==N.version){let se=N.image;if(se===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{B(J,N,L);return}}t.activeTexture(33984+L),t.bindTexture(3553,J.__webglTexture)}function G(N,L){let J=r.get(N);if(N.version>0&&J.__version!==N.version){B(J,N,L);return}t.activeTexture(33984+L),t.bindTexture(35866,J.__webglTexture)}function R(N,L){let J=r.get(N);if(N.version>0&&J.__version!==N.version){B(J,N,L);return}t.activeTexture(33984+L),t.bindTexture(32879,J.__webglTexture)}function U(N,L){let J=r.get(N);if(N.version>0&&J.__version!==N.version){Y(J,N,L);return}t.activeTexture(33984+L),t.bindTexture(34067,J.__webglTexture)}let te={[Os]:10497,[ar]:33071,[cc]:33648},he={[tr]:9728,[ih]:9984,[sh]:9986,[tt]:9729,[Dp]:9985,[Li]:9987};function H(N,L,J){if(J?(i.texParameteri(N,10242,te[L.wrapS]),i.texParameteri(N,10243,te[L.wrapT]),(N===32879||N===35866)&&i.texParameteri(N,32882,te[L.wrapR]),i.texParameteri(N,10240,he[L.magFilter]),i.texParameteri(N,10241,he[L.minFilter])):(i.texParameteri(N,10242,33071),i.texParameteri(N,10243,33071),(N===32879||N===35866)&&i.texParameteri(N,32882,33071),(L.wrapS!==ar||L.wrapT!==ar)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),i.texParameteri(N,10240,T(L.magFilter)),i.texParameteri(N,10241,T(L.minFilter)),L.minFilter!==tr&&L.minFilter!==tt&&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 se=e.get("EXT_texture_filter_anisotropic");if(L.type===Bs&&e.has("OES_texture_float_linear")===!1||a===!1&&L.type===wa&&e.has("OES_texture_half_float_linear")===!1)return;(L.anisotropy>1||r.get(L).__currentAnisotropy)&&(i.texParameterf(N,se.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(L.anisotropy,n.getMaxAnisotropy())),r.get(L).__currentAnisotropy=L.anisotropy)}}function z(N,L){N.__webglInit===void 0&&(N.__webglInit=!0,L.addEventListener("dispose",S),N.__webglTexture=i.createTexture(),o.memory.textures++)}function B(N,L,J){let se=3553;L.isDataTexture2DArray&&(se=35866),L.isDataTexture3D&&(se=32879),z(N,L),t.activeTexture(33984+J),t.bindTexture(se,N.__webglTexture),i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let ye=m(L)&&y(L.image)===!1,me=v(L.image,ye,!1,u),Ie=y(me)||a,we=s.convert(L.format),Re=s.convert(L.type),Ee=w(L.internalFormat,we,Re);H(se,L,Ie);let j,Se=L.mipmaps;if(L.isDepthTexture)Ee=6402,a?L.type===Bs?Ee=36012:L.type===ba?Ee=33190:L.type===Eo?Ee=35056:Ee=33189:L.type===Bs&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),L.format===Sa&&Ee===6402&&L.type!==oh&&L.type!==ba&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),L.type=oh,Re=s.convert(L.type)),L.format===Co&&Ee===6402&&(Ee=34041,L.type!==Eo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),L.type=Eo,Re=s.convert(L.type))),t.texImage2D(3553,0,Ee,me.width,me.height,0,we,Re,null);else if(L.isDataTexture)if(Se.length>0&&Ie){for(let fe=0,Ne=Se.length;fe<Ne;fe++)j=Se[fe],t.texImage2D(3553,fe,Ee,j.width,j.height,0,we,Re,j.data);L.generateMipmaps=!1,N.__maxMipLevel=Se.length-1}else t.texImage2D(3553,0,Ee,me.width,me.height,0,we,Re,me.data),N.__maxMipLevel=0;else if(L.isCompressedTexture){for(let fe=0,Ne=Se.length;fe<Ne;fe++)j=Se[fe],L.format!==Qt&&L.format!==jt?we!==null?t.compressedTexImage2D(3553,fe,Ee,j.width,j.height,0,j.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,fe,Ee,j.width,j.height,0,we,Re,j.data);N.__maxMipLevel=Se.length-1}else if(L.isDataTexture2DArray)t.texImage3D(35866,0,Ee,me.width,me.height,me.depth,0,we,Re,me.data),N.__maxMipLevel=0;else if(L.isDataTexture3D)t.texImage3D(32879,0,Ee,me.width,me.height,me.depth,0,we,Re,me.data),N.__maxMipLevel=0;else if(Se.length>0&&Ie){for(let fe=0,Ne=Se.length;fe<Ne;fe++)j=Se[fe],t.texImage2D(3553,fe,Ee,we,Re,j);L.generateMipmaps=!1,N.__maxMipLevel=Se.length-1}else t.texImage2D(3553,0,Ee,we,Re,me),N.__maxMipLevel=0;x(L,Ie)&&b(se,L,me.width,me.height),N.__version=L.version,L.onUpdate&&L.onUpdate(L)}function Y(N,L,J){if(L.image.length!==6)return;z(N,L),t.activeTexture(33984+J),t.bindTexture(34067,N.__webglTexture),i.pixelStorei(37440,L.flipY),i.pixelStorei(37441,L.premultiplyAlpha),i.pixelStorei(3317,L.unpackAlignment),i.pixelStorei(37443,0);let se=L&&(L.isCompressedTexture||L.image[0].isCompressedTexture),ye=L.image[0]&&L.image[0].isDataTexture,me=[];for(let fe=0;fe<6;fe++)!se&&!ye?me[fe]=v(L.image[fe],!1,!0,c):me[fe]=ye?L.image[fe].image:L.image[fe];let Ie=me[0],we=y(Ie)||a,Re=s.convert(L.format),Ee=s.convert(L.type),j=w(L.internalFormat,Re,Ee);H(34067,L,we);let Se;if(se){for(let fe=0;fe<6;fe++){Se=me[fe].mipmaps;for(let Ne=0;Ne<Se.length;Ne++){let De=Se[Ne];L.format!==Qt&&L.format!==jt?Re!==null?t.compressedTexImage2D(34069+fe,Ne,j,De.width,De.height,0,De.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+fe,Ne,j,De.width,De.height,0,Re,Ee,De.data)}}N.__maxMipLevel=Se.length-1}else{Se=L.mipmaps;for(let fe=0;fe<6;fe++)if(ye){t.texImage2D(34069+fe,0,j,me[fe].width,me[fe].height,0,Re,Ee,me[fe].data);for(let Ne=0;Ne<Se.length;Ne++){let Be=Se[Ne].image[fe].image;t.texImage2D(34069+fe,Ne+1,j,Be.width,Be.height,0,Re,Ee,Be.data)}}else{t.texImage2D(34069+fe,0,j,Re,Ee,me[fe]);for(let Ne=0;Ne<Se.length;Ne++){let De=Se[Ne];t.texImage2D(34069+fe,Ne+1,j,Re,Ee,De.image[fe])}}N.__maxMipLevel=Se.length}x(L,we)&&b(34067,L,Ie.width,Ie.height),N.__version=L.version,L.onUpdate&&L.onUpdate(L)}function q(N,L,J,se,ye){let me=s.convert(J.format),Ie=s.convert(J.type),we=w(J.internalFormat,me,Ie);ye===32879||ye===35866?t.texImage3D(ye,0,we,L.width,L.height,L.depth,0,me,Ie,null):t.texImage2D(ye,0,we,L.width,L.height,0,me,Ie,null),t.bindFramebuffer(36160,N),i.framebufferTexture2D(36160,se,ye,r.get(J).__webglTexture,0),t.bindFramebuffer(36160,null)}function ee(N,L,J){if(i.bindRenderbuffer(36161,N),L.depthBuffer&&!L.stencilBuffer){let se=33189;if(J){let ye=L.depthTexture;ye&&ye.isDepthTexture&&(ye.type===Bs?se=36012:ye.type===ba&&(se=33190));let me=le(L);i.renderbufferStorageMultisample(36161,me,se,L.width,L.height)}else i.renderbufferStorage(36161,se,L.width,L.height);i.framebufferRenderbuffer(36160,36096,36161,N)}else if(L.depthBuffer&&L.stencilBuffer){if(J){let se=le(L);i.renderbufferStorageMultisample(36161,se,35056,L.width,L.height)}else i.renderbufferStorage(36161,34041,L.width,L.height);i.framebufferRenderbuffer(36160,33306,36161,N)}else{let se=L.isWebGLMultipleRenderTargets===!0?L.texture[0]:L.texture,ye=s.convert(se.format),me=s.convert(se.type),Ie=w(se.internalFormat,ye,me);if(J){let we=le(L);i.renderbufferStorageMultisample(36161,we,Ie,L.width,L.height)}else i.renderbufferStorage(36161,Ie,L.width,L.height)}i.bindRenderbuffer(36161,null)}function k(N,L){if(L&&L.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,N),!(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),D(L.depthTexture,0);let se=r.get(L.depthTexture).__webglTexture;if(L.depthTexture.format===Sa)i.framebufferTexture2D(36160,36096,3553,se,0);else if(L.depthTexture.format===Co)i.framebufferTexture2D(36160,33306,3553,se,0);else throw new Error("Unknown depthTexture format")}function pe(N){let L=r.get(N),J=N.isWebGLCubeRenderTarget===!0;if(N.depthTexture){if(J)throw new Error("target.depthTexture not supported in Cube render targets");k(L.__webglFramebuffer,N)}else if(J){L.__webglDepthbuffer=[];for(let se=0;se<6;se++)t.bindFramebuffer(36160,L.__webglFramebuffer[se]),L.__webglDepthbuffer[se]=i.createRenderbuffer(),ee(L.__webglDepthbuffer[se],N,!1)}else t.bindFramebuffer(36160,L.__webglFramebuffer),L.__webglDepthbuffer=i.createRenderbuffer(),ee(L.__webglDepthbuffer,N,!1);t.bindFramebuffer(36160,null)}function ce(N){let L=N.texture,J=r.get(N),se=r.get(L);N.addEventListener("dispose",M),N.isWebGLMultipleRenderTargets!==!0&&(se.__webglTexture=i.createTexture(),se.__version=L.version,o.memory.textures++);let ye=N.isWebGLCubeRenderTarget===!0,me=N.isWebGLMultipleRenderTargets===!0,Ie=N.isWebGLMultisampleRenderTarget===!0,we=L.isDataTexture3D||L.isDataTexture2DArray,Re=y(N)||a;if(a&&L.format===jt&&(L.type===Bs||L.type===wa)&&(L.format=Qt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),ye){J.__webglFramebuffer=[];for(let Ee=0;Ee<6;Ee++)J.__webglFramebuffer[Ee]=i.createFramebuffer()}else if(J.__webglFramebuffer=i.createFramebuffer(),me)if(n.drawBuffers){let Ee=N.texture;for(let j=0,Se=Ee.length;j<Se;j++){let fe=r.get(Ee[j]);fe.__webglTexture===void 0&&(fe.__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(Ie)if(a){J.__webglMultisampledFramebuffer=i.createFramebuffer(),J.__webglColorRenderbuffer=i.createRenderbuffer(),i.bindRenderbuffer(36161,J.__webglColorRenderbuffer);let Ee=s.convert(L.format),j=s.convert(L.type),Se=w(L.internalFormat,Ee,j),fe=le(N);i.renderbufferStorageMultisample(36161,fe,Se,N.width,N.height),t.bindFramebuffer(36160,J.__webglMultisampledFramebuffer),i.framebufferRenderbuffer(36160,36064,36161,J.__webglColorRenderbuffer),i.bindRenderbuffer(36161,null),N.depthBuffer&&(J.__webglDepthRenderbuffer=i.createRenderbuffer(),ee(J.__webglDepthRenderbuffer,N,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(ye){t.bindTexture(34067,se.__webglTexture),H(34067,L,Re);for(let Ee=0;Ee<6;Ee++)q(J.__webglFramebuffer[Ee],N,L,36064,34069+Ee);x(L,Re)&&b(34067,L,N.width,N.height),t.bindTexture(34067,null)}else if(me){let Ee=N.texture;for(let j=0,Se=Ee.length;j<Se;j++){let fe=Ee[j],Ne=r.get(fe);t.bindTexture(3553,Ne.__webglTexture),H(3553,fe,Re),q(J.__webglFramebuffer,N,fe,36064+j,3553),x(fe,Re)&&b(3553,fe,N.width,N.height)}t.bindTexture(3553,null)}else{let Ee=3553;we&&(a?Ee=L.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(Ee,se.__webglTexture),H(Ee,L,Re),q(J.__webglFramebuffer,N,L,36064,Ee),x(L,Re)&&b(Ee,L,N.width,N.height,N.depth),t.bindTexture(Ee,null)}N.depthBuffer&&pe(N)}function ne(N){let L=y(N)||a,J=N.isWebGLMultipleRenderTargets===!0?N.texture:[N.texture];for(let se=0,ye=J.length;se<ye;se++){let me=J[se];if(x(me,L)){let Ie=N.isWebGLCubeRenderTarget?34067:3553,we=r.get(me).__webglTexture;t.bindTexture(Ie,we),b(Ie,me,N.width,N.height),t.bindTexture(Ie,null)}}}function X(N){if(N.isWebGLMultisampleRenderTarget)if(a){let L=N.width,J=N.height,se=16384;N.depthBuffer&&(se|=256),N.stencilBuffer&&(se|=1024);let ye=r.get(N);t.bindFramebuffer(36008,ye.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,ye.__webglFramebuffer),i.blitFramebuffer(0,0,L,J,0,0,L,J,se,9728),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,ye.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function le(N){return a&&N.isWebGLMultisampleRenderTarget?Math.min(d,N.samples):0}function $(N){let L=o.render.frame;h.get(N)!==L&&(h.set(N,L),N.update())}let V=!1,K=!1;function ue(N,L){N&&N.isWebGLRenderTarget&&(V===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),V=!0),N=N.texture),D(N,L)}function ie(N,L){N&&N.isWebGLCubeRenderTarget&&(K===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),K=!0),N=N.texture),U(N,L)}this.allocateTextureUnit=P,this.resetTextureUnits=O,this.setTexture2D=D,this.setTexture2DArray=G,this.setTexture3D=R,this.setTextureCube=U,this.setupRenderTarget=ce,this.updateRenderTargetMipmap=ne,this.updateMultisampleRenderTarget=X,this.safeSetTexture2D=ue,this.safeSetTextureCube=ie}function nP(i,e,t){let r=t.isWebGL2;function n(s){let o;if(s===Nt)return 5121;if(s===__)return 32819;if(s===E_)return 32820;if(s===C_)return 33635;if(s===M_)return 5120;if(s===A_)return 5122;if(s===oh)return 5123;if(s===T_)return 5124;if(s===ba)return 5125;if(s===Bs)return 5126;if(s===wa)return r?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===L_)return 6406;if(s===jt)return 6407;if(s===Qt)return 6408;if(s===Rp)return 6409;if(s===N_)return 6410;if(s===Sa)return 6402;if(s===Co)return 34041;if(s===I_)return 6403;if(s===D_)return 36244;if(s===R_)return 33319;if(s===O_)return 33320;if(s===B_)return 36248;if(s===F_)return 36249;if(s===rx||s===nx||s===ix||s===sx)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===rx)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===nx)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===ix)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===sx)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===ox||s===ax||s===lx||s===cx)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===ox)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ax)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===lx)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===cx)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===G_)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((s===ux||s===hx)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(s===ux)return o.COMPRESSED_RGB8_ETC2;if(s===hx)return o.COMPRESSED_RGBA8_ETC2_EAC}if(s===z_||s===U_||s===k_||s===V_||s===H_||s===j_||s===W_||s===J_||s===q_||s===X_||s===Y_||s===Q_||s===K_||s===Z_||s===eE||s===tE||s===rE||s===nE||s===iE||s===sE||s===oE||s===aE||s===lE||s===cE||s===uE||s===hE||s===dE||s===fE)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===$_)return o=e.get("EXT_texture_compression_bptc"),o!==null?s:null;if(s===Eo)return r?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:n}}var Mm=class extends dr{constructor(e=[]){super();this.cameras=e}};Mm.prototype.isArrayCamera=!0;var Oi=class extends Ze{constructor(){super();this.type="Group"}};Oi.prototype.isGroup=!0;var iP={type:"move"},Oh=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Oi,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 Oi,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new A,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new A),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Oi,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new A,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new A),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let n=null,s=null,o=null,a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(n=t.getPose(e.targetRaySpace,r),n!==null&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(iP))),c&&e.hand){o=!0;for(let g of e.hand.values()){let v=t.getJointPose(g,r);if(c.joints[g.jointName]===void 0){let m=new Oi;m.matrixAutoUpdate=!1,m.visible=!1,c.joints[g.jointName]=m,c.add(m)}let y=c.joints[g.jointName];v!==null&&(y.matrix.fromArray(v.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.jointRadius=v.radius),y.visible=v!==null}let u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),p=.02,f=.005;c.inputState.pinching&&h>p+f?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-f&&(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}},h0=class extends xr{constructor(e,t){super();let r=this,n=e.state,s=null,o=1,a=null,l="local-floor",c=null,u=null,d=null,h=null,p=null,f=[],g=new Map,v=new dr;v.layers.enable(1),v.viewport=new Qe;let y=new dr;y.layers.enable(2),y.viewport=new Qe;let m=[v,y],x=new Mm;x.layers.enable(1),x.layers.enable(2);let b=null,w=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(R){let U=f[R];return U===void 0&&(U=new Oh,f[R]=U),U.getTargetRaySpace()},this.getControllerGrip=function(R){let U=f[R];return U===void 0&&(U=new Oh,f[R]=U),U.getGripSpace()},this.getHand=function(R){let U=f[R];return U===void 0&&(U=new Oh,f[R]=U),U.getHandSpace()};function T(R){let U=g.get(R.inputSource);U&&U.dispatchEvent({type:R.type,data:R.inputSource})}function S(){g.forEach(function(R,U){R.disconnect(U)}),g.clear(),b=null,w=null,n.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),G.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(R){o=R,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(R){l=R,r.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a},this.getSession=function(){return s},this.setSession=async function(R){if(s=R,s!==null){s.addEventListener("select",T),s.addEventListener("selectstart",T),s.addEventListener("selectend",T),s.addEventListener("squeeze",T),s.addEventListener("squeezestart",T),s.addEventListener("squeezeend",T),s.addEventListener("end",S),s.addEventListener("inputsourceschange",M);let U=t.getContextAttributes();if(U.xrCompatible!==!0&&await t.makeXRCompatible(),s.renderState.layers===void 0){let te={antialias:U.antialias,alpha:U.alpha,depth:U.depth,stencil:U.stencil,framebufferScaleFactor:o};p=new XRWebGLLayer(s,t,te),s.updateRenderState({baseLayer:p})}else{let te=0;if(U.antialias){let he={antialias:!0,alpha:U.alpha,depth:U.depth,stencil:U.stencil,framebufferScaleFactor:o};p=new XRWebGLLayer(s,t,he),s.updateRenderState({layers:[p]})}else{U.depth&&(te=U.stencil?34041:6402);let he={colorFormat:U.alpha?6408:6407,depthFormat:te,scaleFactor:o};u=new XRWebGLBinding(s,t),h=u.createProjectionLayer(he),d=t.createFramebuffer(),s.updateRenderState({layers:[h]})}}a=await s.requestReferenceSpace(l),G.setContext(s),G.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}};function M(R){let U=s.inputSources;for(let te=0;te<f.length;te++)g.set(U[te],f[te]);for(let te=0;te<R.removed.length;te++){let he=R.removed[te],H=g.get(he);H&&(H.dispatchEvent({type:"disconnected",data:he}),g.delete(he))}for(let te=0;te<R.added.length;te++){let he=R.added[te],H=g.get(he);H&&H.dispatchEvent({type:"connected",data:he})}}let E=new A,C=new A;function _(R,U,te){E.setFromMatrixPosition(U.matrixWorld),C.setFromMatrixPosition(te.matrixWorld);let he=E.distanceTo(C),H=U.projectionMatrix.elements,z=te.projectionMatrix.elements,B=H[14]/(H[10]-1),Y=H[14]/(H[10]+1),q=(H[9]+1)/H[5],ee=(H[9]-1)/H[5],k=(H[8]-1)/H[0],pe=(z[8]+1)/z[0],ce=B*k,ne=B*pe,X=he/(-k+pe),le=X*-k;U.matrixWorld.decompose(R.position,R.quaternion,R.scale),R.translateX(le),R.translateZ(X),R.matrixWorld.compose(R.position,R.quaternion,R.scale),R.matrixWorldInverse.copy(R.matrixWorld).invert();let $=B+X,V=Y+X,K=ce-le,ue=ne+(he-le),ie=q*Y/V*$,N=ee*Y/V*$;R.projectionMatrix.makePerspective(K,ue,ie,N,$,V)}function O(R,U){U===null?R.matrixWorld.copy(R.matrix):R.matrixWorld.multiplyMatrices(U.matrixWorld,R.matrix),R.matrixWorldInverse.copy(R.matrixWorld).invert()}this.updateCamera=function(R){if(s===null)return;x.near=y.near=v.near=R.near,x.far=y.far=v.far=R.far,(b!==x.near||w!==x.far)&&(s.updateRenderState({depthNear:x.near,depthFar:x.far}),b=x.near,w=x.far);let U=R.parent,te=x.cameras;O(x,U);for(let H=0;H<te.length;H++)O(te[H],U);x.matrixWorld.decompose(x.position,x.quaternion,x.scale),R.position.copy(x.position),R.quaternion.copy(x.quaternion),R.scale.copy(x.scale),R.matrix.copy(x.matrix),R.matrixWorld.copy(x.matrixWorld);let he=R.children;for(let H=0,z=he.length;H<z;H++)he[H].updateMatrixWorld(!0);te.length===2?_(x,v,y):x.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return x},this.getFoveation=function(){if(h!==null)return h.fixedFoveation;if(p!==null)return p.fixedFoveation},this.setFoveation=function(R){h!==null&&(h.fixedFoveation=R),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=R)};let P=null;function D(R,U){if(c=U.getViewerPose(a),c!==null){let he=c.views;p!==null&&n.bindXRFramebuffer(p.framebuffer);let H=!1;he.length!==x.cameras.length&&(x.cameras.length=0,H=!0);for(let z=0;z<he.length;z++){let B=he[z],Y=null;if(p!==null)Y=p.getViewport(B);else{let ee=u.getViewSubImage(h,B);n.bindXRFramebuffer(d),ee.depthStencilTexture!==void 0&&t.framebufferTexture2D(36160,36096,3553,ee.depthStencilTexture,0),t.framebufferTexture2D(36160,36064,3553,ee.colorTexture,0),Y=ee.viewport}let q=m[z];q.matrix.fromArray(B.transform.matrix),q.projectionMatrix.fromArray(B.projectionMatrix),q.viewport.set(Y.x,Y.y,Y.width,Y.height),z===0&&x.matrix.copy(q.matrix),H===!0&&x.cameras.push(q)}}let te=s.inputSources;for(let he=0;he<f.length;he++){let H=f[he],z=te[he];H.update(z,U,a)}P&&P(R,U)}let G=new Px;G.setAnimationLoop(D),this.setAnimationLoop=function(R){P=R},this.dispose=function(){}}};function sP(i){function e(y,m){y.fogColor.value.copy(m.color),m.isFog?(y.fogNear.value=m.near,y.fogFar.value=m.far):m.isFogExp2&&(y.fogDensity.value=m.density)}function t(y,m,x,b,w){m.isMeshBasicMaterial?r(y,m):m.isMeshLambertMaterial?(r(y,m),l(y,m)):m.isMeshToonMaterial?(r(y,m),u(y,m)):m.isMeshPhongMaterial?(r(y,m),c(y,m)):m.isMeshStandardMaterial?(r(y,m),m.isMeshPhysicalMaterial?h(y,m,w):d(y,m)):m.isMeshMatcapMaterial?(r(y,m),p(y,m)):m.isMeshDepthMaterial?(r(y,m),f(y,m)):m.isMeshDistanceMaterial?(r(y,m),g(y,m)):m.isMeshNormalMaterial?(r(y,m),v(y,m)):m.isLineBasicMaterial?(n(y,m),m.isLineDashedMaterial&&s(y,m)):m.isPointsMaterial?o(y,m,x,b):m.isSpriteMaterial?a(y,m):m.isShadowMaterial?(y.color.value.copy(m.color),y.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function r(y,m){y.opacity.value=m.opacity,m.color&&y.diffuse.value.copy(m.color),m.emissive&&y.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap),m.specularMap&&(y.specularMap.value=m.specularMap);let x=i.get(m).envMap;if(x){y.envMap.value=x,y.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=m.reflectivity,y.refractionRatio.value=m.refractionRatio;let T=i.get(x).__maxMipLevel;T!==void 0&&(y.maxMipLevel.value=T)}m.lightMap&&(y.lightMap.value=m.lightMap,y.lightMapIntensity.value=m.lightMapIntensity),m.aoMap&&(y.aoMap.value=m.aoMap,y.aoMapIntensity.value=m.aoMapIntensity);let b;m.map?b=m.map:m.specularMap?b=m.specularMap:m.displacementMap?b=m.displacementMap:m.normalMap?b=m.normalMap:m.bumpMap?b=m.bumpMap:m.roughnessMap?b=m.roughnessMap:m.metalnessMap?b=m.metalnessMap:m.alphaMap?b=m.alphaMap:m.emissiveMap?b=m.emissiveMap:m.clearcoatMap?b=m.clearcoatMap:m.clearcoatNormalMap?b=m.clearcoatNormalMap:m.clearcoatRoughnessMap?b=m.clearcoatRoughnessMap:m.specularIntensityMap?b=m.specularIntensityMap:m.specularTintMap&&(b=m.specularTintMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),y.uvTransform.value.copy(b.matrix));let w;m.aoMap?w=m.aoMap:m.lightMap&&(w=m.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),y.uv2Transform.value.copy(w.matrix))}function n(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity}function s(y,m){y.dashSize.value=m.dashSize,y.totalSize.value=m.dashSize+m.gapSize,y.scale.value=m.scale}function o(y,m,x,b){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.size.value=m.size*x,y.scale.value=b*.5,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap);let w;m.map?w=m.map:m.alphaMap&&(w=m.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),y.uvTransform.value.copy(w.matrix))}function a(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.rotation.value=m.rotation,m.map&&(y.map.value=m.map),m.alphaMap&&(y.alphaMap.value=m.alphaMap);let x;m.map?x=m.map:m.alphaMap&&(x=m.alphaMap),x!==void 0&&(x.matrixAutoUpdate===!0&&x.updateMatrix(),y.uvTransform.value.copy(x.matrix))}function l(y,m){m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap)}function c(y,m){y.specular.value.copy(m.specular),y.shininess.value=Math.max(m.shininess,1e-4),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===zt&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===zt&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function u(y,m){m.gradientMap&&(y.gradientMap.value=m.gradientMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===zt&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===zt&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function d(y,m){y.roughness.value=m.roughness,y.metalness.value=m.metalness,m.roughnessMap&&(y.roughnessMap.value=m.roughnessMap),m.metalnessMap&&(y.metalnessMap.value=m.metalnessMap),m.emissiveMap&&(y.emissiveMap.value=m.emissiveMap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===zt&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===zt&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),i.get(m).envMap&&(y.envMapIntensity.value=m.envMapIntensity)}function h(y,m,x){d(y,m),y.reflectivity.value=m.reflectivity,y.clearcoat.value=m.clearcoat,y.clearcoatRoughness.value=m.clearcoatRoughness,m.sheen&&y.sheen.value.copy(m.sheen),m.clearcoatMap&&(y.clearcoatMap.value=m.clearcoatMap),m.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap),m.clearcoatNormalMap&&(y.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),y.clearcoatNormalMap.value=m.clearcoatNormalMap,m.side===zt&&y.clearcoatNormalScale.value.negate()),y.transmission.value=m.transmission,m.transmissionMap&&(y.transmissionMap.value=m.transmissionMap),m.transmission>0&&(y.transmissionSamplerMap.value=x.texture,y.transmissionSamplerSize.value.set(x.width,x.height)),y.thickness.value=m.thickness,m.thicknessMap&&(y.thicknessMap.value=m.thicknessMap),y.attenuationDistance.value=m.attenuationDistance,y.attenuationTint.value.copy(m.attenuationTint),y.specularIntensity.value=m.specularIntensity,y.specularTint.value.copy(m.specularTint),m.specularIntensityMap&&(y.specularIntensityMap.value=m.specularIntensityMap),m.specularTintMap&&(y.specularTintMap.value=m.specularTintMap)}function p(y,m){m.matcap&&(y.matcap.value=m.matcap),m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===zt&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===zt&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function f(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}function g(y,m){m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias),y.referencePosition.value.copy(m.referencePosition),y.nearDistance.value=m.nearDistance,y.farDistance.value=m.farDistance}function v(y,m){m.bumpMap&&(y.bumpMap.value=m.bumpMap,y.bumpScale.value=m.bumpScale,m.side===zt&&(y.bumpScale.value*=-1)),m.normalMap&&(y.normalMap.value=m.normalMap,y.normalScale.value.copy(m.normalScale),m.side===zt&&y.normalScale.value.negate()),m.displacementMap&&(y.displacementMap.value=m.displacementMap,y.displacementScale.value=m.displacementScale,y.displacementBias.value=m.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function oP(){let i=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return i.style.display="block",i}function _t(i={}){let e=i.canvas!==void 0?i.canvas:oP(),t=i.context!==void 0?i.context:null,r=i.alpha!==void 0?i.alpha:!1,n=i.depth!==void 0?i.depth:!0,s=i.stencil!==void 0?i.stencil:!0,o=i.antialias!==void 0?i.antialias:!1,a=i.premultipliedAlpha!==void 0?i.premultipliedAlpha:!0,l=i.preserveDrawingBuffer!==void 0?i.preserveDrawingBuffer:!1,c=i.powerPreference!==void 0?i.powerPreference:"default",u=i.failIfMajorPerformanceCaveat!==void 0?i.failIfMajorPerformanceCaveat:!1,d=null,h=null,p=[],f=[];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.gammaFactor=2,this.outputEncoding=vr,this.physicallyCorrectLights=!1,this.toneMapping=_o,this.toneMappingExposure=1;let g=this,v=!1,y=0,m=0,x=null,b=-1,w=null,T=new Qe,S=new Qe,M=null,E=e.width,C=e.height,_=1,O=null,P=null,D=new Qe(0,0,E,C),G=new Qe(0,0,E,C),R=!1,U=[],te=new xc,he=!1,H=!1,z=null,B=new Me,Y=new A,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ee(){return x===null?_:1}let k=t;function pe(I,Q){for(let W=0;W<I.length;W++){let oe=I[W],ge=e.getContext(oe,Q);if(ge!==null)return ge}return null}try{let I={alpha:r,depth:n,stencil:s,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",gt,!1),e.addEventListener("webglcontextrestored",Mt,!1),k===null){let Q=["webgl2","webgl","experimental-webgl"];if(g.isWebGL1Renderer===!0&&Q.shift(),k=pe(Q,I),k===null)throw pe(Q)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}k.getShaderPrecisionFormat===void 0&&(k.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(I){throw console.error("THREE.WebGLRenderer: "+I.message),I}let ce,ne,X,le,$,V,K,ue,ie,N,L,J,se,ye,me,Ie,we,Re,Ee,j,Se,fe,Ne;function De(){ce=new NN(k),ne=new SN(k,ce,i),ce.init(ne),fe=new nP(k,ce,ne),X=new tP(k,ce,ne),U[0]=1029,le=new DN(k),$=new j2,V=new rP(k,ce,X,$,ne,fe,le),K=new AN(g),ue=new LN(g),ie=new KE(k,ne),Ne=new bN(k,ce,ie,ne),N=new PN(k,ie,le,Ne),L=new FN(k,N,ie,le),Ee=new BN(k),Ie=new MN($),J=new H2(g,K,ue,ce,ne,Ne,Ie),se=new sP($),ye=new J2($),me=new Z2(ce,ne),Re=new xN(g,K,X,L,a),we=new u0(g,L,ne),j=new wN(k,ce,le,ne),Se=new IN(k,ce,le,ne),le.programs=J.programs,g.capabilities=ne,g.extensions=ce,g.properties=$,g.renderLists=ye,g.shadowMap=we,g.state=X,g.info=le}De();let Be=new h0(g,k);this.xr=Be,this.getContext=function(){return k},this.getContextAttributes=function(){return k.getContextAttributes()},this.forceContextLoss=function(){let I=ce.get("WEBGL_lose_context");I&&I.loseContext()},this.forceContextRestore=function(){let I=ce.get("WEBGL_lose_context");I&&I.restoreContext()},this.getPixelRatio=function(){return _},this.setPixelRatio=function(I){I!==void 0&&(_=I,this.setSize(E,C,!1))},this.getSize=function(I){return I.set(E,C)},this.setSize=function(I,Q,W){if(Be.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=I,C=Q,e.width=Math.floor(I*_),e.height=Math.floor(Q*_),W!==!1&&(e.style.width=I+"px",e.style.height=Q+"px"),this.setViewport(0,0,I,Q)},this.getDrawingBufferSize=function(I){return I.set(E*_,C*_).floor()},this.setDrawingBufferSize=function(I,Q,W){E=I,C=Q,_=W,e.width=Math.floor(I*W),e.height=Math.floor(Q*W),this.setViewport(0,0,I,Q)},this.getCurrentViewport=function(I){return I.copy(T)},this.getViewport=function(I){return I.copy(D)},this.setViewport=function(I,Q,W,oe){I.isVector4?D.set(I.x,I.y,I.z,I.w):D.set(I,Q,W,oe),X.viewport(T.copy(D).multiplyScalar(_).floor())},this.getScissor=function(I){return I.copy(G)},this.setScissor=function(I,Q,W,oe){I.isVector4?G.set(I.x,I.y,I.z,I.w):G.set(I,Q,W,oe),X.scissor(S.copy(G).multiplyScalar(_).floor())},this.getScissorTest=function(){return R},this.setScissorTest=function(I){X.setScissorTest(R=I)},this.setOpaqueSort=function(I){O=I},this.setTransparentSort=function(I){P=I},this.getClearColor=function(I){return I.copy(Re.getClearColor())},this.setClearColor=function(){Re.setClearColor.apply(Re,arguments)},this.getClearAlpha=function(){return Re.getClearAlpha()},this.setClearAlpha=function(){Re.setClearAlpha.apply(Re,arguments)},this.clear=function(I,Q,W){let oe=0;(I===void 0||I)&&(oe|=16384),(Q===void 0||Q)&&(oe|=256),(W===void 0||W)&&(oe|=1024),k.clear(oe)},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",gt,!1),e.removeEventListener("webglcontextrestored",Mt,!1),ye.dispose(),me.dispose(),$.dispose(),K.dispose(),ue.dispose(),L.dispose(),Ne.dispose(),Be.dispose(),Be.removeEventListener("sessionstart",an),Be.removeEventListener("sessionend",Is),z&&(z.dispose(),z=null),Ht.stop()};function gt(I){I.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),v=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),v=!1;let I=le.autoReset,Q=we.enabled,W=we.autoUpdate,oe=we.needsUpdate,ge=we.type;De(),le.autoReset=I,we.enabled=Q,we.autoUpdate=W,we.needsUpdate=oe,we.type=ge}function Cn(I){let Q=I.target;Q.removeEventListener("dispose",Cn),Gt(Q)}function Gt(I){yn(I),$.remove(I)}function yn(I){let Q=$.get(I).programs;Q!==void 0&&Q.forEach(function(W){J.releaseProgram(W)})}function vn(I,Q){I.render(function(W){g.renderBufferImmediate(W,Q)})}this.renderBufferImmediate=function(I,Q){Ne.initAttributes();let W=$.get(I);I.hasPositions&&!W.position&&(W.position=k.createBuffer()),I.hasNormals&&!W.normal&&(W.normal=k.createBuffer()),I.hasUvs&&!W.uv&&(W.uv=k.createBuffer()),I.hasColors&&!W.color&&(W.color=k.createBuffer());let oe=Q.getAttributes();I.hasPositions&&(k.bindBuffer(34962,W.position),k.bufferData(34962,I.positionArray,35048),Ne.enableAttribute(oe.position),k.vertexAttribPointer(oe.position,3,5126,!1,0,0)),I.hasNormals&&(k.bindBuffer(34962,W.normal),k.bufferData(34962,I.normalArray,35048),Ne.enableAttribute(oe.normal),k.vertexAttribPointer(oe.normal,3,5126,!1,0,0)),I.hasUvs&&(k.bindBuffer(34962,W.uv),k.bufferData(34962,I.uvArray,35048),Ne.enableAttribute(oe.uv),k.vertexAttribPointer(oe.uv,2,5126,!1,0,0)),I.hasColors&&(k.bindBuffer(34962,W.color),k.bufferData(34962,I.colorArray,35048),Ne.enableAttribute(oe.color),k.vertexAttribPointer(oe.color,3,5126,!1,0,0)),Ne.disableUnusedAttributes(),k.drawArrays(4,0,I.count),I.count=0},this.renderBufferDirect=function(I,Q,W,oe,ge,Ue){Q===null&&(Q=q);let ke=ge.isMesh&&ge.matrixWorld.determinant()<0,Oe=ht(I,Q,oe,ge);X.setMaterial(oe,ke);let $e=W.index,wt=W.attributes.position;if($e===null){if(wt===void 0||wt.count===0)return}else if($e.count===0)return;let st=1;oe.wireframe===!0&&($e=N.getWireframeAttribute(W),st=2),(W.morphAttributes.position!==void 0||W.morphAttributes.normal!==void 0)&&Ee.update(ge,W,oe,Oe),Ne.setup(ge,oe,Oe,W,$e);let mt,Ye=j;$e!==null&&(mt=ie.get($e),Ye=Se,Ye.setIndex(mt));let os=$e!==null?$e.count:wt.count,or=W.drawRange.start*st,Ds=W.drawRange.count*st,si=Ue!==null?Ue.start*st:0,Ao=Ue!==null?Ue.count*st:1/0,Rs=Math.max(or,si),Nr=Math.min(os,or+Ds,si+Ao)-1,Ci=Math.max(0,Nr-Rs+1);if(Ci!==0){if(ge.isMesh)oe.wireframe===!0?(X.setLineWidth(oe.wireframeLinewidth*ee()),Ye.setMode(1)):Ye.setMode(4);else if(ge.isLine){let Rr=oe.linewidth;Rr===void 0&&(Rr=1),X.setLineWidth(Rr*ee()),ge.isLineSegments?Ye.setMode(1):ge.isLineLoop?Ye.setMode(2):Ye.setMode(3)}else ge.isPoints?Ye.setMode(0):ge.isSprite&&Ye.setMode(4);if(ge.isInstancedMesh)Ye.renderInstances(Rs,Ci,ge.count);else if(W.isInstancedBufferGeometry){let Rr=Math.min(W.instanceCount,W._maxInstanceCount);Ye.renderInstances(Rs,Ci,Rr)}else Ye.render(Rs,Ci)}},this.compile=function(I,Q){h=me.get(I),h.init(),f.push(h),I.traverseVisible(function(W){W.isLight&&W.layers.test(Q.layers)&&(h.pushLight(W),W.castShadow&&h.pushShadow(W))}),h.setupLights(),I.traverse(function(W){let oe=W.material;if(oe)if(Array.isArray(oe))for(let ge=0;ge<oe.length;ge++){let Ue=oe[ge];et(Ue,I,W)}else et(oe,I,W)}),f.pop(),h=null};let Ps=null;function pa(I){Ps&&Ps(I)}function an(){Ht.stop()}function Is(){Ht.start()}let Ht=new Px;Ht.setAnimationLoop(pa),typeof window!="undefined"&&Ht.setContext(window),this.setAnimationLoop=function(I){Ps=I,Be.setAnimationLoop(I),I===null?Ht.stop():Ht.start()},Be.addEventListener("sessionstart",an),Be.addEventListener("sessionend",Is),this.render=function(I,Q){if(Q!==void 0&&Q.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(v===!0)return;I.autoUpdate===!0&&I.updateMatrixWorld(),Q.parent===null&&Q.updateMatrixWorld(),Be.enabled===!0&&Be.isPresenting===!0&&(Be.cameraAutoUpdate===!0&&Be.updateCamera(Q),Q=Be.getCamera()),I.isScene===!0&&I.onBeforeRender(g,I,Q,x),h=me.get(I,f.length),h.init(),f.push(h),B.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),te.setFromProjectionMatrix(B),H=this.localClippingEnabled,he=Ie.init(this.clippingPlanes,H,Q),d=ye.get(I,p.length),d.init(),p.push(d),ss(I,Q,0,g.sortObjects),d.finish(),g.sortObjects===!0&&d.sort(O,P),he===!0&&Ie.beginShadows();let W=h.state.shadowsArray;we.render(W,I,Q),h.setupLights(),h.setupLightsView(Q),he===!0&&Ie.endShadows(),this.info.autoReset===!0&&this.info.reset(),Re.render(d,I);let oe=d.opaque,ge=d.transmissive,Ue=d.transparent;oe.length>0&&Ve(oe,I,Q),ge.length>0&&ma(oe,ge,I,Q),Ue.length>0&&Ve(Ue,I,Q),x!==null&&(V.updateMultisampleRenderTarget(x),V.updateRenderTargetMipmap(x)),I.isScene===!0&&I.onAfterRender(g,I,Q),X.buffers.depth.setTest(!0),X.buffers.depth.setMask(!0),X.buffers.color.setMask(!0),X.setPolygonOffset(!1),Ne.resetDefaultState(),b=-1,w=null,f.pop(),f.length>0?h=f[f.length-1]:h=null,p.pop(),p.length>0?d=p[p.length-1]:d=null};function ss(I,Q,W,oe){if(I.visible===!1)return;if(I.layers.test(Q.layers)){if(I.isGroup)W=I.renderOrder;else if(I.isLOD)I.autoUpdate===!0&&I.update(Q);else if(I.isLight)h.pushLight(I),I.castShadow&&h.pushShadow(I);else if(I.isSprite){if(!I.frustumCulled||te.intersectsSprite(I)){oe&&Y.setFromMatrixPosition(I.matrixWorld).applyMatrix4(B);let ke=L.update(I),Oe=I.material;Oe.visible&&d.push(I,ke,Oe,W,Y.z,null)}}else if(I.isImmediateRenderObject)oe&&Y.setFromMatrixPosition(I.matrixWorld).applyMatrix4(B),d.push(I,null,I.material,W,Y.z,null);else if((I.isMesh||I.isLine||I.isPoints)&&(I.isSkinnedMesh&&I.skeleton.frame!==le.render.frame&&(I.skeleton.update(),I.skeleton.frame=le.render.frame),!I.frustumCulled||te.intersectsObject(I))){oe&&Y.setFromMatrixPosition(I.matrixWorld).applyMatrix4(B);let ke=L.update(I),Oe=I.material;if(Array.isArray(Oe)){let $e=ke.groups;for(let wt=0,st=$e.length;wt<st;wt++){let mt=$e[wt],Ye=Oe[mt.materialIndex];Ye&&Ye.visible&&d.push(I,ke,Ye,W,Y.z,mt)}}else Oe.visible&&d.push(I,ke,Oe,W,Y.z,null)}}let Ue=I.children;for(let ke=0,Oe=Ue.length;ke<Oe;ke++)ss(Ue[ke],Q,W,oe)}function ma(I,Q,W,oe){if(z===null){let Oe=o===!0&&ne.isWebGL2===!0?Gs:xt;z=new Oe(1024,1024,{generateMipmaps:!0,type:fe.convert(wa)!==null?wa:Nt,minFilter:Li,magFilter:tr,wrapS:ar,wrapT:ar})}let ge=g.getRenderTarget();g.setRenderTarget(z),g.clear();let Ue=g.toneMapping;g.toneMapping=_o,Ve(I,W,oe),g.toneMapping=Ue,V.updateMultisampleRenderTarget(z),V.updateRenderTargetMipmap(z),g.setRenderTarget(ge),Ve(Q,W,oe)}function Ve(I,Q,W){let oe=Q.isScene===!0?Q.overrideMaterial:null;if(W.isArrayCamera){let ge=W.cameras;for(let Ue=0,ke=ge.length;Ue<ke;Ue++){let Oe=ge[Ue];X.viewport(T.copy(Oe.viewport)),h.setupLightsView(Oe);for(let $e=0,wt=I.length;$e<wt;$e++){let st=I[$e],mt=st.object,Ye=st.geometry,os=oe===null?st.material:oe,or=st.group;mt.layers.test(Oe.layers)&&nt(mt,Q,Oe,Ye,os,or)}}}else for(let ge=0,Ue=I.length;ge<Ue;ge++){let ke=I[ge],Oe=ke.object,$e=ke.geometry,wt=oe===null?ke.material:oe,st=ke.group;nt(Oe,Q,W,$e,wt,st)}}function nt(I,Q,W,oe,ge,Ue){if(I.onBeforeRender(g,Q,W,oe,ge,Ue),I.modelViewMatrix.multiplyMatrices(W.matrixWorldInverse,I.matrixWorld),I.normalMatrix.getNormalMatrix(I.modelViewMatrix),I.isImmediateRenderObject){let ke=ht(W,Q,ge,I);X.setMaterial(ge),Ne.reset(),vn(I,ke)}else ge.transparent===!0&&ge.side===Yt?(ge.side=zt,ge.needsUpdate=!0,g.renderBufferDirect(W,Q,oe,ge,I,Ue),ge.side=oi,ge.needsUpdate=!0,g.renderBufferDirect(W,Q,oe,ge,I,Ue),ge.side=Yt):g.renderBufferDirect(W,Q,oe,ge,I,Ue);I.onAfterRender(g,Q,W,oe,ge,Ue)}function et(I,Q,W){Q.isScene!==!0&&(Q=q);let oe=$.get(I),ge=h.state.lights,Ue=h.state.shadowsArray,ke=ge.state.version,Oe=J.getParameters(I,ge.state,Ue,Q,W),$e=J.getProgramCacheKey(Oe),wt=oe.programs;oe.environment=I.isMeshStandardMaterial?Q.environment:null,oe.fog=Q.fog,oe.envMap=(I.isMeshStandardMaterial?ue:K).get(I.envMap||oe.environment),wt===void 0&&(I.addEventListener("dispose",Cn),wt=new Map,oe.programs=wt);let st=wt.get($e);if(st!==void 0){if(oe.currentProgram===st&&oe.lightsStateVersion===ke)return it(I,Oe),st}else Oe.uniforms=J.getUniforms(I),I.onBuild(Oe,g),I.onBeforeCompile(Oe,g),st=J.acquireProgram(Oe,$e),wt.set($e,st),oe.uniforms=Oe.uniforms;let mt=oe.uniforms;(!I.isShaderMaterial&&!I.isRawShaderMaterial||I.clipping===!0)&&(mt.clippingPlanes=Ie.uniform),it(I,Oe),oe.needsLights=Tt(I),oe.lightsStateVersion=ke,oe.needsLights&&(mt.ambientLightColor.value=ge.state.ambient,mt.lightProbe.value=ge.state.probe,mt.directionalLights.value=ge.state.directional,mt.directionalLightShadows.value=ge.state.directionalShadow,mt.spotLights.value=ge.state.spot,mt.spotLightShadows.value=ge.state.spotShadow,mt.rectAreaLights.value=ge.state.rectArea,mt.ltc_1.value=ge.state.rectAreaLTC1,mt.ltc_2.value=ge.state.rectAreaLTC2,mt.pointLights.value=ge.state.point,mt.pointLightShadows.value=ge.state.pointShadow,mt.hemisphereLights.value=ge.state.hemi,mt.directionalShadowMap.value=ge.state.directionalShadowMap,mt.directionalShadowMatrix.value=ge.state.directionalShadowMatrix,mt.spotShadowMap.value=ge.state.spotShadowMap,mt.spotShadowMatrix.value=ge.state.spotShadowMatrix,mt.pointShadowMap.value=ge.state.pointShadowMap,mt.pointShadowMatrix.value=ge.state.pointShadowMatrix);let Ye=st.getUniforms(),os=Xs.seqWithValue(Ye.seq,mt);return oe.currentProgram=st,oe.uniformsList=os,st}function it(I,Q){let W=$.get(I);W.outputEncoding=Q.outputEncoding,W.instancing=Q.instancing,W.skinning=Q.skinning,W.morphTargets=Q.morphTargets,W.morphNormals=Q.morphNormals,W.numClippingPlanes=Q.numClippingPlanes,W.numIntersection=Q.numClipIntersection,W.vertexAlphas=Q.vertexAlphas,W.vertexTangents=Q.vertexTangents}function ht(I,Q,W,oe){Q.isScene!==!0&&(Q=q),V.resetTextureUnits();let ge=Q.fog,Ue=W.isMeshStandardMaterial?Q.environment:null,ke=x===null?g.outputEncoding:x.texture.encoding,Oe=(W.isMeshStandardMaterial?ue:K).get(W.envMap||Ue),$e=W.vertexColors===!0&&!!oe.geometry&&!!oe.geometry.attributes.color&&oe.geometry.attributes.color.itemSize===4,wt=!!oe.geometry&&!!oe.geometry.attributes.tangent,st=!!oe.geometry&&!!oe.geometry.morphAttributes.position,mt=!!oe.geometry&&!!oe.geometry.morphAttributes.normal,Ye=$.get(W),os=h.state.lights;if(he===!0&&(H===!0||I!==w)){let Rr=I===w&&W.id===b;Ie.setState(W,I,Rr)}let or=!1;W.version===Ye.__version?(Ye.needsLights&&Ye.lightsStateVersion!==os.state.version||Ye.outputEncoding!==ke||oe.isInstancedMesh&&Ye.instancing===!1||!oe.isInstancedMesh&&Ye.instancing===!0||oe.isSkinnedMesh&&Ye.skinning===!1||!oe.isSkinnedMesh&&Ye.skinning===!0||Ye.envMap!==Oe||W.fog&&Ye.fog!==ge||Ye.numClippingPlanes!==void 0&&(Ye.numClippingPlanes!==Ie.numPlanes||Ye.numIntersection!==Ie.numIntersection)||Ye.vertexAlphas!==$e||Ye.vertexTangents!==wt||Ye.morphTargets!==st||Ye.morphNormals!==mt)&&(or=!0):(or=!0,Ye.__version=W.version);let Ds=Ye.currentProgram;or===!0&&(Ds=et(W,Q,oe));let si=!1,Ao=!1,Rs=!1,Nr=Ds.getUniforms(),Ci=Ye.uniforms;if(X.useProgram(Ds.program)&&(si=!0,Ao=!0,Rs=!0),W.id!==b&&(b=W.id,Ao=!0),si||w!==I){if(Nr.setValue(k,"projectionMatrix",I.projectionMatrix),ne.logarithmicDepthBuffer&&Nr.setValue(k,"logDepthBufFC",2/(Math.log(I.far+1)/Math.LN2)),w!==I&&(w=I,Ao=!0,Rs=!0),W.isShaderMaterial||W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshStandardMaterial||W.envMap){let Rr=Nr.map.cameraPosition;Rr!==void 0&&Rr.setValue(k,Y.setFromMatrixPosition(I.matrixWorld))}(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial)&&Nr.setValue(k,"isOrthographic",I.isOrthographicCamera===!0),(W.isMeshPhongMaterial||W.isMeshToonMaterial||W.isMeshLambertMaterial||W.isMeshBasicMaterial||W.isMeshStandardMaterial||W.isShaderMaterial||W.isShadowMaterial||oe.isSkinnedMesh)&&Nr.setValue(k,"viewMatrix",I.matrixWorldInverse)}if(oe.isSkinnedMesh){Nr.setOptional(k,oe,"bindMatrix"),Nr.setOptional(k,oe,"bindMatrixInverse");let Rr=oe.skeleton;Rr&&(ne.floatVertexTextures?(Rr.boneTexture===null&&Rr.computeBoneTexture(),Nr.setValue(k,"boneTexture",Rr.boneTexture,V),Nr.setValue(k,"boneTextureSize",Rr.boneTextureSize)):Nr.setOptional(k,Rr,"boneMatrices"))}return(Ao||Ye.receiveShadow!==oe.receiveShadow)&&(Ye.receiveShadow=oe.receiveShadow,Nr.setValue(k,"receiveShadow",oe.receiveShadow)),Ao&&(Nr.setValue(k,"toneMappingExposure",g.toneMappingExposure),Ye.needsLights&&At(Ci,Rs),ge&&W.fog&&se.refreshFogUniforms(Ci,ge),se.refreshMaterialUniforms(Ci,W,_,C,z),Xs.upload(k,Ye.uniformsList,Ci,V)),W.isShaderMaterial&&W.uniformsNeedUpdate===!0&&(Xs.upload(k,Ye.uniformsList,Ci,V),W.uniformsNeedUpdate=!1),W.isSpriteMaterial&&Nr.setValue(k,"center",oe.center),Nr.setValue(k,"modelViewMatrix",oe.modelViewMatrix),Nr.setValue(k,"normalMatrix",oe.normalMatrix),Nr.setValue(k,"modelMatrix",oe.matrixWorld),Ds}function At(I,Q){I.ambientLightColor.needsUpdate=Q,I.lightProbe.needsUpdate=Q,I.directionalLights.needsUpdate=Q,I.directionalLightShadows.needsUpdate=Q,I.pointLights.needsUpdate=Q,I.pointLightShadows.needsUpdate=Q,I.spotLights.needsUpdate=Q,I.spotLightShadows.needsUpdate=Q,I.rectAreaLights.needsUpdate=Q,I.hemisphereLights.needsUpdate=Q}function Tt(I){return I.isMeshLambertMaterial||I.isMeshToonMaterial||I.isMeshPhongMaterial||I.isMeshStandardMaterial||I.isShadowMaterial||I.isShaderMaterial&&I.lights===!0}this.getActiveCubeFace=function(){return y},this.getActiveMipmapLevel=function(){return m},this.getRenderTarget=function(){return x},this.setRenderTarget=function(I,Q=0,W=0){x=I,y=Q,m=W,I&&$.get(I).__webglFramebuffer===void 0&&V.setupRenderTarget(I);let oe=null,ge=!1,Ue=!1;if(I){let Oe=I.texture;(Oe.isDataTexture3D||Oe.isDataTexture2DArray)&&(Ue=!0);let $e=$.get(I).__webglFramebuffer;I.isWebGLCubeRenderTarget?(oe=$e[Q],ge=!0):I.isWebGLMultisampleRenderTarget?oe=$.get(I).__webglMultisampledFramebuffer:oe=$e,T.copy(I.viewport),S.copy(I.scissor),M=I.scissorTest}else T.copy(D).multiplyScalar(_).floor(),S.copy(G).multiplyScalar(_).floor(),M=R;if(X.bindFramebuffer(36160,oe)&&ne.drawBuffers){let Oe=!1;if(I)if(I.isWebGLMultipleRenderTargets){let $e=I.texture;if(U.length!==$e.length||U[0]!==36064){for(let wt=0,st=$e.length;wt<st;wt++)U[wt]=36064+wt;U.length=$e.length,Oe=!0}}else(U.length!==1||U[0]!==36064)&&(U[0]=36064,U.length=1,Oe=!0);else(U.length!==1||U[0]!==1029)&&(U[0]=1029,U.length=1,Oe=!0);Oe&&(ne.isWebGL2?k.drawBuffers(U):ce.get("WEBGL_draw_buffers").drawBuffersWEBGL(U))}if(X.viewport(T),X.scissor(S),X.setScissorTest(M),ge){let Oe=$.get(I.texture);k.framebufferTexture2D(36160,36064,34069+Q,Oe.__webglTexture,W)}else if(Ue){let Oe=$.get(I.texture),$e=Q||0;k.framebufferTextureLayer(36160,36064,Oe.__webglTexture,W||0,$e)}},this.readRenderTargetPixels=function(I,Q,W,oe,ge,Ue,ke){if(!(I&&I.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Oe=$.get(I).__webglFramebuffer;if(I.isWebGLCubeRenderTarget&&ke!==void 0&&(Oe=Oe[ke]),Oe){X.bindFramebuffer(36160,Oe);try{let $e=I.texture,wt=$e.format,st=$e.type;if(wt!==Qt&&fe.convert(wt)!==k.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let mt=st===wa&&(ce.has("EXT_color_buffer_half_float")||ne.isWebGL2&&ce.has("EXT_color_buffer_float"));if(st!==Nt&&fe.convert(st)!==k.getParameter(35738)&&!(st===Bs&&(ne.isWebGL2||ce.has("OES_texture_float")||ce.has("WEBGL_color_buffer_float")))&&!mt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}k.checkFramebufferStatus(36160)===36053?Q>=0&&Q<=I.width-oe&&W>=0&&W<=I.height-ge&&k.readPixels(Q,W,oe,ge,fe.convert(wt),fe.convert(st),Ue):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{let $e=x!==null?$.get(x).__webglFramebuffer:null;X.bindFramebuffer(36160,$e)}}},this.copyFramebufferToTexture=function(I,Q,W=0){let oe=Math.pow(2,-W),ge=Math.floor(Q.image.width*oe),Ue=Math.floor(Q.image.height*oe),ke=fe.convert(Q.format);ne.isWebGL2&&(ke===6407&&(ke=32849),ke===6408&&(ke=32856)),V.setTexture2D(Q,0),k.copyTexImage2D(3553,W,ke,I.x,I.y,ge,Ue,0),X.unbindTexture()},this.copyTextureToTexture=function(I,Q,W,oe=0){let ge=Q.image.width,Ue=Q.image.height,ke=fe.convert(W.format),Oe=fe.convert(W.type);V.setTexture2D(W,0),k.pixelStorei(37440,W.flipY),k.pixelStorei(37441,W.premultiplyAlpha),k.pixelStorei(3317,W.unpackAlignment),Q.isDataTexture?k.texSubImage2D(3553,oe,I.x,I.y,ge,Ue,ke,Oe,Q.image.data):Q.isCompressedTexture?k.compressedTexSubImage2D(3553,oe,I.x,I.y,Q.mipmaps[0].width,Q.mipmaps[0].height,ke,Q.mipmaps[0].data):k.texSubImage2D(3553,oe,I.x,I.y,ke,Oe,Q.image),oe===0&&W.generateMipmaps&&k.generateMipmap(3553),X.unbindTexture()},this.copyTextureToTexture3D=function(I,Q,W,oe,ge=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ue=I.max.x-I.min.x+1,ke=I.max.y-I.min.y+1,Oe=I.max.z-I.min.z+1,$e=fe.convert(oe.format),wt=fe.convert(oe.type),st;if(oe.isDataTexture3D)V.setTexture3D(oe,0),st=32879;else if(oe.isDataTexture2DArray)V.setTexture2DArray(oe,0),st=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}k.pixelStorei(37440,oe.flipY),k.pixelStorei(37441,oe.premultiplyAlpha),k.pixelStorei(3317,oe.unpackAlignment);let mt=k.getParameter(3314),Ye=k.getParameter(32878),os=k.getParameter(3316),or=k.getParameter(3315),Ds=k.getParameter(32877),si=W.isCompressedTexture?W.mipmaps[0]:W.image;k.pixelStorei(3314,si.width),k.pixelStorei(32878,si.height),k.pixelStorei(3316,I.min.x),k.pixelStorei(3315,I.min.y),k.pixelStorei(32877,I.min.z),W.isDataTexture||W.isDataTexture3D?k.texSubImage3D(st,ge,Q.x,Q.y,Q.z,Ue,ke,Oe,$e,wt,si.data):W.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),k.compressedTexSubImage3D(st,ge,Q.x,Q.y,Q.z,Ue,ke,Oe,$e,si.data)):k.texSubImage3D(st,ge,Q.x,Q.y,Q.z,Ue,ke,Oe,$e,wt,si),k.pixelStorei(3314,mt),k.pixelStorei(32878,Ye),k.pixelStorei(3316,os),k.pixelStorei(3315,or),k.pixelStorei(32877,Ds),ge===0&&oe.generateMipmaps&&k.generateMipmap(st),X.unbindTexture()},this.initTexture=function(I){V.setTexture2D(I,0),X.unbindTexture()},this.resetState=function(){y=0,m=0,x=null,X.reset(),Ne.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}var d0=class extends _t{};d0.prototype.isWebGL1Renderer=!0;var Bh=class{constructor(e,t=25e-5){this.name="",this.color=new ve(e),this.density=t}clone(){return new Bh(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}};Bh.prototype.isFogExp2=!0;var Xa=class{constructor(e,t=1,r=1e3){this.name="",this.color=new ve(e),this.near=t,this.far=r}clone(){return new Xa(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}};Xa.prototype.isFog=!0;var Gr=class extends Ze{constructor(){super();this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__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}};Gr.prototype.isScene=!0;var ds=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=Hn()}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=Hn()),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=Hn()),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}}};ds.prototype.isInterleavedBuffer=!0;var fr=new A,Bi=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++)fr.x=this.getX(t),fr.y=this.getY(t),fr.z=this.getZ(t),fr.applyMatrix4(e),this.setXYZ(t,fr.x,fr.y,fr.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)fr.x=this.getX(t),fr.y=this.getY(t),fr.z=this.getZ(t),fr.applyNormalMatrix(e),this.setXYZ(t,fr.x,fr.y,fr.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)fr.x=this.getX(t),fr.y=this.getY(t),fr.z=this.getZ(t),fr.transformDirection(e),this.setXYZ(t,fr.x,fr.y,fr.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 Fe(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 Bi(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}}};Bi.prototype.isInterleavedBufferAttribute=!0;var Am=class extends Fr{constructor(e){super();this.type="SpriteMaterial",this.color=new ve(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this}};Am.prototype.isSpriteMaterial=!0;var Ya,Mc=new A,Qa=new A,Ka=new A,Za=new F,Ac=new F,f0=new Me,Fh=new A,Tc=new A,Gh=new A,p0=new F,Tm=new F,m0=new F,g0=class extends Ze{constructor(e){super();if(this.type="Sprite",Ya===void 0){Ya=new _e;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 ds(t,5);Ya.setIndex([0,1,2,0,2,3]),Ya.setAttribute("position",new Bi(r,3,0,!1)),Ya.setAttribute("uv",new Bi(r,2,3,!1))}this.geometry=Ya,this.material=e!==void 0?e:new Am,this.center=new F(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Qa.setFromMatrixScale(this.matrixWorld),f0.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Ka.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Qa.multiplyScalar(-Ka.z);let r=this.material.rotation,n,s;r!==0&&(s=Math.cos(r),n=Math.sin(r));let o=this.center;zh(Fh.set(-.5,-.5,0),Ka,o,Qa,n,s),zh(Tc.set(.5,-.5,0),Ka,o,Qa,n,s),zh(Gh.set(.5,.5,0),Ka,o,Qa,n,s),p0.set(0,0),Tm.set(1,0),m0.set(1,1);let a=e.ray.intersectTriangle(Fh,Tc,Gh,!1,Mc);if(a===null&&(zh(Tc.set(-.5,.5,0),Ka,o,Qa,n,s),Tm.set(0,1),a=e.ray.intersectTriangle(Fh,Gh,Tc,!1,Mc),a===null))return;let l=e.ray.origin.distanceTo(Mc);l<e.near||l>e.far||t.push({distance:l,point:Mc.clone(),uv:nr.getUV(Mc,Fh,Tc,Gh,p0,Tm,m0,new F),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}};g0.prototype.isSprite=!0;function zh(i,e,t,r,n,s){Za.subVectors(i,t).addScalar(.5).multiply(r),n!==void 0?(Ac.x=s*Za.x-n*Za.y,Ac.y=n*Za.x+s*Za.y):Ac.copy(Za),i.copy(e),i.x+=Ac.x,i.y+=Ac.y,i.applyMatrix4(f0)}var y0=new A,v0=new Qe,x0=new Qe,aP=new A,b0=new Me,_m=class extends Wt{constructor(e,t){super(e,t);this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Me,this.bindMatrixInverse=new Me}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new Qe,t=this.geometry.attributes.skinWeight;for(let r=0,n=t.count;r<n;r++){e.x=t.getX(r),e.y=t.getY(r),e.z=t.getZ(r),e.w=t.getW(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;v0.fromBufferAttribute(n.attributes.skinIndex,e),x0.fromBufferAttribute(n.attributes.skinWeight,e),y0.fromBufferAttribute(n.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){let o=x0.getComponent(s);if(o!==0){let a=v0.getComponent(s);b0.multiplyMatrices(r.bones[a].matrixWorld,r.boneInverses[a]),t.addScaledVector(aP.copy(y0).applyMatrix4(b0),o)}}return t.applyMatrix4(this.bindMatrixInverse)}};_m.prototype.isSkinnedMesh=!0;var w0=class extends Ze{constructor(){super();this.type="Bone"}};w0.prototype.isBone=!0;var Em=class extends Pt{constructor(e=null,t=1,r=1,n,s,o,a,l,c=tr,u=tr,d,h){super(null,o,a,l,c,u,n,s,d,h);this.image={data:e,width:t,height:r},this.magFilter=c,this.minFilter=u,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}};Em.prototype.isDataTexture=!0;var S0=new Me,M0=new Me,Uh=[],_c=new Wt,A0=class extends Wt{constructor(e,t,r){super(e,t);this.instanceMatrix=new Fe(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(_c.geometry=this.geometry,_c.material=this.material,_c.material!==void 0)for(let s=0;s<n;s++){this.getMatrixAt(s,S0),M0.multiplyMatrices(r,S0),_c.matrixWorld=M0,_c.raycast(e,Uh);for(let o=0,a=Uh.length;o<a;o++){let l=Uh[o];l.instanceId=s,l.object=this,t.push(l)}Uh.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Fe(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"})}};A0.prototype.isInstancedMesh=!0;var un=class extends Fr{constructor(e){super();this.type="LineBasicMaterial",this.color=new ve(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this}};un.prototype.isLineBasicMaterial=!0;var T0=new A,_0=new A,E0=new Me,Cm=new Ni,kh=new ln,Ys=class extends Ze{constructor(e=new _e,t=new un){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++)T0.fromBufferAttribute(t,n-1),_0.fromBufferAttribute(t,n),r[n]=r[n-1],r[n]+=T0.distanceTo(_0);e.setAttribute("lineDistance",new Ae(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(),kh.copy(r.boundingSphere),kh.applyMatrix4(n),kh.radius+=s,e.ray.intersectsSphere(kh)===!1)return;E0.copy(n).invert(),Cm.copy(e.ray).applyMatrix4(E0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new A,u=new A,d=new A,h=new A,p=this.isLineSegments?2:1;if(r.isBufferGeometry){let f=r.index,v=r.attributes.position;if(f!==null){let y=Math.max(0,o.start),m=Math.min(f.count,o.start+o.count);for(let x=y,b=m-1;x<b;x+=p){let w=f.getX(x),T=f.getX(x+1);if(c.fromBufferAttribute(v,w),u.fromBufferAttribute(v,T),Cm.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);let M=e.ray.origin.distanceTo(h);M<e.near||M>e.far||t.push({distance:M,point:d.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{let y=Math.max(0,o.start),m=Math.min(v.count,o.start+o.count);for(let x=y,b=m-1;x<b;x+=p){if(c.fromBufferAttribute(v,x),u.fromBufferAttribute(v,x+1),Cm.distanceSqToSegment(c,u,h,d)>l)continue;h.applyMatrix4(this.matrixWorld);let T=e.ray.origin.distanceTo(h);T<e.near||T>e.far||t.push({distance:T,point:d.clone().applyMatrix4(this.matrixWorld),index:x,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.")}}};Ys.prototype.isLine=!0;var C0=new A,L0=new A,Fi=class extends Ys{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)C0.fromBufferAttribute(t,n),L0.fromBufferAttribute(t,n+1),r[n]=n===0?0:r[n-1],r[n+1]=r[n]+C0.distanceTo(L0);e.setAttribute("lineDistance",new Ae(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}};Fi.prototype.isLineSegments=!0;var N0=class extends Ys{constructor(e,t){super(e,t);this.type="LineLoop"}};N0.prototype.isLineLoop=!0;var Lm=class extends Fr{constructor(e){super();this.type="PointsMaterial",this.color=new ve(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this}};Lm.prototype.isPointsMaterial=!0;var P0=new Me,Nm=new Ni,Vh=new ln,Hh=new A,I0=class extends Ze{constructor(e=new _e,t=new Lm){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(),Vh.copy(r.boundingSphere),Vh.applyMatrix4(n),Vh.radius+=s,e.ray.intersectsSphere(Vh)===!1)return;P0.copy(n).invert(),Nm.copy(e.ray).applyMatrix4(P0);let a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a;if(r.isBufferGeometry){let c=r.index,d=r.attributes.position;if(c!==null){let h=Math.max(0,o.start),p=Math.min(c.count,o.start+o.count);for(let f=h,g=p;f<g;f++){let v=c.getX(f);Hh.fromBufferAttribute(d,v),D0(Hh,v,l,n,e,t,this)}}else{let h=Math.max(0,o.start),p=Math.min(d.count,o.start+o.count);for(let f=h,g=p;f<g;f++)Hh.fromBufferAttribute(d,f),D0(Hh,f,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.")}}};I0.prototype.isPoints=!0;function D0(i,e,t,r,n,s,o){let a=Nm.distanceSqToPoint(i);if(a<t){let l=new A;Nm.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 jh=class extends Pt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c);this.format=a!==void 0?a:jt,this.minFilter=o!==void 0?o:tt,this.magFilter=s!==void 0?s:tt,this.generateMipmaps=!1;let u=this;function d(){u.needsUpdate=!0,e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(d)}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)}};jh.prototype.isVideoTexture=!0;var R0=class extends Pt{constructor(e,t,r,n,s,o,a,l,c,u,d,h){super(null,o,a,l,c,u,n,s,d,h);this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}};R0.prototype.isCompressedTexture=!0;var O0=class extends Pt{constructor(e,t,r,n,s,o,a,l,c){super(e,t,r,n,s,o,a,l,c);this.needsUpdate=!0}};O0.prototype.isCanvasTexture=!0;var fs=class extends Pt{constructor(e,t,r,n,s,o,a,l,c,u){if(u=u!==void 0?u:Sa,u!==Sa&&u!==Co)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&u===Sa&&(r=oh),r===void 0&&u===Co&&(r=Eo);super(null,n,s,o,a,l,u,r,c);this.image={width:e,height:t},this.magFilter=a!==void 0?a:tr,this.minFilter=l!==void 0?l:tr,this.flipY=!1,this.generateMipmaps=!1}};fs.prototype.isDepthTexture=!0;var $a=class extends _e{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=[],d=[],h=[],p=[],f=0,g=[],v=r/2,y=0;m(),o===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Ae(d,3)),this.setAttribute("normal",new Ae(h,3)),this.setAttribute("uv",new Ae(p,2));function m(){let b=new A,w=new A,T=0,S=(t-e)/r;for(let M=0;M<=s;M++){let E=[],C=M/s,_=C*(t-e)+e;for(let O=0;O<=n;O++){let P=O/n,D=P*l+a,G=Math.sin(D),R=Math.cos(D);w.x=_*G,w.y=-C*r+v,w.z=_*R,d.push(w.x,w.y,w.z),b.set(G,S,R).normalize(),h.push(b.x,b.y,b.z),p.push(P,1-C),E.push(f++)}g.push(E)}for(let M=0;M<n;M++)for(let E=0;E<s;E++){let C=g[E][M],_=g[E+1][M],O=g[E+1][M+1],P=g[E][M+1];u.push(C,_,P),u.push(_,O,P),T+=6}c.addGroup(y,T,0),y+=T}function x(b){let w=f,T=new F,S=new A,M=0,E=b===!0?e:t,C=b===!0?1:-1;for(let O=1;O<=n;O++)d.push(0,v*C,0),h.push(0,C,0),p.push(.5,.5),f++;let _=f;for(let O=0;O<=n;O++){let D=O/n*l+a,G=Math.cos(D),R=Math.sin(D);S.x=E*R,S.y=v*C,S.z=E*G,d.push(S.x,S.y,S.z),h.push(0,C,0),T.x=G*.5+.5,T.y=R*.5*C+.5,p.push(T.x,T.y),f++}for(let O=0;O<n;O++){let P=w+O,D=_+O;b===!0?u.push(D,D+1,P):u.push(D+1,D,P),M+=3}c.addGroup(y,M,b===!0?1:2),y+=M}}static fromJSON(e){return new $a(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Ec=class extends $a{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 Ec(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}},Cc=class extends _e{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 Ae(s,3)),this.setAttribute("normal",new Ae(s.slice(),3)),this.setAttribute("uv",new Ae(o,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function a(m){let x=new A,b=new A,w=new A;for(let T=0;T<t.length;T+=3)p(t[T+0],x),p(t[T+1],b),p(t[T+2],w),l(x,b,w,m)}function l(m,x,b,w){let T=w+1,S=[];for(let M=0;M<=T;M++){S[M]=[];let E=m.clone().lerp(b,M/T),C=x.clone().lerp(b,M/T),_=T-M;for(let O=0;O<=_;O++)O===0&&M===T?S[M][O]=E:S[M][O]=E.clone().lerp(C,O/_)}for(let M=0;M<T;M++)for(let E=0;E<2*(T-M)-1;E++){let C=Math.floor(E/2);E%2==0?(h(S[M][C+1]),h(S[M+1][C]),h(S[M][C])):(h(S[M][C+1]),h(S[M+1][C+1]),h(S[M+1][C]))}}function c(m){let x=new A;for(let b=0;b<s.length;b+=3)x.x=s[b+0],x.y=s[b+1],x.z=s[b+2],x.normalize().multiplyScalar(m),s[b+0]=x.x,s[b+1]=x.y,s[b+2]=x.z}function u(){let m=new A;for(let x=0;x<s.length;x+=3){m.x=s[x+0],m.y=s[x+1],m.z=s[x+2];let b=v(m)/2/Math.PI+.5,w=y(m)/Math.PI+.5;o.push(b,1-w)}f(),d()}function d(){for(let m=0;m<o.length;m+=6){let x=o[m+0],b=o[m+2],w=o[m+4],T=Math.max(x,b,w),S=Math.min(x,b,w);T>.9&&S<.1&&(x<.2&&(o[m+0]+=1),b<.2&&(o[m+2]+=1),w<.2&&(o[m+4]+=1))}}function h(m){s.push(m.x,m.y,m.z)}function p(m,x){let b=m*3;x.x=e[b+0],x.y=e[b+1],x.z=e[b+2]}function f(){let m=new A,x=new A,b=new A,w=new A,T=new F,S=new F,M=new F;for(let E=0,C=0;E<s.length;E+=9,C+=6){m.set(s[E+0],s[E+1],s[E+2]),x.set(s[E+3],s[E+4],s[E+5]),b.set(s[E+6],s[E+7],s[E+8]),T.set(o[C+0],o[C+1]),S.set(o[C+2],o[C+3]),M.set(o[C+4],o[C+5]),w.copy(m).add(x).add(b).divideScalar(3);let _=v(w);g(T,C+0,m,_),g(S,C+2,x,_),g(M,C+4,b,_)}}function g(m,x,b,w){w<0&&m.x===1&&(o[x]=m.x-1),b.x===0&&b.z===0&&(o[x]=w/2/Math.PI+.5)}function v(m){return Math.atan2(m.z,-m.x)}function y(m){return Math.atan2(-m.y,Math.sqrt(m.x*m.x+m.z*m.z))}}static fromJSON(e){return new Cc(e.vertices,e.indices,e.radius,e.details)}},Lc=class extends Cc{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 Lc(e.radius,e.detail)}},SU=new A,MU=new A,AU=new A,TU=new nr;var Dn=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],h=r[n+1]-u,p=(o-u)/h;return(n+p)/(s-1)}getTangent(e,t){let r=1e-4,n=e-r,s=e+r;n<0&&(n=0),s>1&&(s=1);let o=this.getPoint(n),a=this.getPoint(s),l=t||(o.isVector2?new F:new A);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){let r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){let r=new A,n=[],s=[],o=[],a=new A,l=new Me;for(let p=0;p<=e;p++){let f=p/e;n[p]=this.getTangentAt(f,new A),n[p].normalize()}s[0]=new A,o[0]=new A;let c=Number.MAX_VALUE,u=Math.abs(n[0].x),d=Math.abs(n[0].y),h=Math.abs(n[0].z);u<=c&&(c=u,r.set(1,0,0)),d<=c&&(c=d,r.set(0,1,0)),h<=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 p=1;p<=e;p++){if(s[p]=s[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(n[p-1],n[p]),a.length()>Number.EPSILON){a.normalize();let f=Math.acos(Br(n[p-1].dot(n[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(a,f))}o[p].crossVectors(n[p],s[p])}if(t===!0){let p=Math.acos(Br(s[0].dot(s[e]),-1,1));p/=e,n[0].dot(a.crossVectors(s[0],s[e]))>0&&(p=-p);for(let f=1;f<=e;f++)s[f].applyMatrix4(l.makeRotationAxis(n[f],p*f)),o[f].crossVectors(n[f],s[f])}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}},Go=class extends Dn{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 F,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),d=Math.sin(this.aRotation),h=l-this.aX,p=c-this.aY;l=h*u-p*d+this.aX,c=h*d+p*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}};Go.prototype.isEllipseCurve=!0;var Pm=class extends Go{constructor(e,t,r,n,s,o){super(e,t,r,r,n,s,o);this.type="ArcCurve"}};Pm.prototype.isArcCurve=!0;function Im(){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,d){let h=(o-s)/c-(a-s)/(c+u)+(a-o)/u,p=(a-o)/u-(l-o)/(u+d)+(l-a)/d;h*=u,p*=u,n(o,a,h,p)},calc:function(s){let o=s*s,a=o*s;return i+e*s+t*o+r*a}}}var Wh=new A,Dm=new Im,Rm=new Im,Om=new Im,Bm=class extends Dn{constructor(e=[],t=!1,r="centripetal",n=.5){super();this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=r,this.tension=n}getPoint(e,t=new A){let r=t,n=this.points,s=n.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=n[(a-1)%s]:(Wh.subVectors(n[0],n[1]).add(n[0]),c=Wh);let d=n[a%s],h=n[(a+1)%s];if(this.closed||a+2<s?u=n[(a+2)%s]:(Wh.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=Wh),this.curveType==="centripetal"||this.curveType==="chordal"){let p=this.curveType==="chordal"?.5:.25,f=Math.pow(c.distanceToSquared(d),p),g=Math.pow(d.distanceToSquared(h),p),v=Math.pow(h.distanceToSquared(u),p);g<1e-4&&(g=1),f<1e-4&&(f=g),v<1e-4&&(v=g),Dm.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,f,g,v),Rm.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,f,g,v),Om.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,f,g,v)}else this.curveType==="catmullrom"&&(Dm.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),Rm.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),Om.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return r.set(Dm.calc(l),Rm.calc(l),Om.calc(l)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,r=e.points.length;t<r;t++){let n=e.points[t];this.points.push(new A().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};Bm.prototype.isCatmullRomCurve3=!0;function B0(i,e,t,r,n){let s=(r-e)*.5,o=(n-t)*.5,a=i*i,l=i*a;return(2*t-2*r+s+o)*l+(-3*t+3*r-2*s-o)*a+s*i+t}function lP(i,e){let t=1-i;return t*t*e}function cP(i,e){return 2*(1-i)*i*e}function uP(i,e){return i*i*e}function Nc(i,e,t,r){return lP(i,e)+cP(i,t)+uP(i,r)}function hP(i,e){let t=1-i;return t*t*t*e}function dP(i,e){let t=1-i;return 3*t*t*i*e}function fP(i,e){return 3*(1-i)*i*i*e}function pP(i,e){return i*i*i*e}function Pc(i,e,t,r,n){return hP(i,e)+dP(i,t)+fP(i,r)+pP(i,n)}var bn=class extends Dn{constructor(e=new F,t=new F,r=new F,n=new F){super();this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new F){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Pc(e,n.x,s.x,o.x,a.x),Pc(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}};bn.prototype.isCubicBezierCurve=!0;var Fm=class extends Dn{constructor(e=new A,t=new A,r=new A,n=new A){super();this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=r,this.v3=n}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2,a=this.v3;return r.set(Pc(e,n.x,s.x,o.x,a.x),Pc(e,n.y,s.y,o.y,a.y),Pc(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}};Fm.prototype.isCubicBezierCurve3=!0;var wn=class extends Dn{constructor(e=new F,t=new F){super();this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new F){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 F;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}};wn.prototype.isLineCurve=!0;var Jh=class extends Dn{constructor(e=new A,t=new A){super();this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new A){let r=t;return e===1?r.copy(this.v2):(r.copy(this.v2).sub(this.v1),r.multiplyScalar(e).add(this.v1)),r}getPointAt(e,t){return this.getPoint(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},di=class extends Dn{constructor(e=new F,t=new F,r=new F){super();this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new F){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Nc(e,n.x,s.x,o.x),Nc(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}};di.prototype.isQuadraticBezierCurve=!0;var Gm=class extends Dn{constructor(e=new A,t=new A,r=new A){super();this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=r}getPoint(e,t=new A){let r=t,n=this.v0,s=this.v1,o=this.v2;return r.set(Nc(e,n.x,s.x,o.x),Nc(e,n.y,s.y,o.y),Nc(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}};Gm.prototype.isQuadraticBezierCurve3=!0;var el=class extends Dn{constructor(e=[]){super();this.type="SplineCurve",this.points=e}getPoint(e,t=new F){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],d=n[o>n.length-3?n.length-1:o+2];return r.set(B0(a,l.x,c.x,u.x,d.x),B0(a,l.y,c.y,u.y,d.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 F().fromArray(n))}return this}};el.prototype.isSplineCurve=!0;var F0=Object.freeze({__proto__:null,ArcCurve:Pm,CatmullRomCurve3:Bm,CubicBezierCurve:bn,CubicBezierCurve3:Fm,EllipseCurve:Go,LineCurve:wn,LineCurve3:Jh,QuadraticBezierCurve:di,QuadraticBezierCurve3:Gm,SplineCurve:el}),mP={triangulate:function(i,e,t=2){let r=e&&e.length,n=r?e[0]*t:i.length,s=G0(i,0,n,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,d,h,p;if(r&&(s=bP(i,e,s,t)),i.length>80*t){a=c=i[0],l=u=i[1];for(let f=t;f<n;f+=t)d=i[f],h=i[f+1],d<a&&(a=d),h<l&&(l=h),d>c&&(c=d),h>u&&(u=h);p=Math.max(c-a,u-l),p=p!==0?1/p:0}return Ic(s,o,t,a,l,p),o}};function G0(i,e,t,r,n){let s,o;if(n===PP(i,e,t,r)>0)for(s=e;s<t;s+=r)o=k0(s,i[s],i[s+1],o);else for(s=t-r;s>=e;s-=r)o=k0(s,i[s],i[s+1],o);return o&&qh(o,o.next)&&(Rc(o),o=o.next),o}function Qs(i,e){if(!i)return i;e||(e=i);let t=i,r;do if(r=!1,!t.steiner&&(qh(t,t.next)||ir(t.prev,t,t.next)===0)){if(Rc(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Ic(i,e,t,r,n,s,o){if(!i)return;!o&&s&&TP(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?yP(i,r,n,s):gP(i)){e.push(l.i/t),e.push(i.i/t),e.push(c.i/t),Rc(i),i=c.next,a=c.next;continue}if(i=c,i===a){o?o===1?(i=vP(Qs(i),e,t),Ic(i,e,t,r,n,s,2)):o===2&&xP(i,e,t,r,n,s):Ic(Qs(i),e,t,r,n,s,1);break}}}function gP(i){let e=i.prev,t=i,r=i.next;if(ir(e,t,r)>=0)return!1;let n=i.next.next;for(;n!==i.prev;){if(tl(e.x,e.y,t.x,t.y,r.x,r.y,n.x,n.y)&&ir(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function yP(i,e,t,r){let n=i.prev,s=i,o=i.next;if(ir(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,d=zm(a,l,e,t,r),h=zm(c,u,e,t,r),p=i.prevZ,f=i.nextZ;for(;p&&p.z>=d&&f&&f.z<=h;){if(p!==i.prev&&p!==i.next&&tl(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&ir(p.prev,p,p.next)>=0||(p=p.prevZ,f!==i.prev&&f!==i.next&&tl(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&ir(f.prev,f,f.next)>=0))return!1;f=f.nextZ}for(;p&&p.z>=d;){if(p!==i.prev&&p!==i.next&&tl(n.x,n.y,s.x,s.y,o.x,o.y,p.x,p.y)&&ir(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=h;){if(f!==i.prev&&f!==i.next&&tl(n.x,n.y,s.x,s.y,o.x,o.y,f.x,f.y)&&ir(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function vP(i,e,t){let r=i;do{let n=r.prev,s=r.next.next;!qh(n,s)&&z0(n,r,r.next,s)&&Dc(n,s)&&Dc(s,n)&&(e.push(n.i/t),e.push(r.i/t),e.push(s.i/t),Rc(r),Rc(r.next),r=i=s),r=r.next}while(r!==i);return Qs(r)}function xP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&CP(o,a)){let l=U0(o,a);o=Qs(o,o.next),l=Qs(l,l.next),Ic(o,e,t,r,n,s),Ic(l,e,t,r,n,s);return}a=a.next}o=o.next}while(o!==i)}function bP(i,e,t,r){let n=[],s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*r,l=s<o-1?e[s+1]*r:i.length,c=G0(i,a,l,r,!1),c===c.next&&(c.steiner=!0),n.push(EP(c));for(n.sort(wP),s=0;s<n.length;s++)SP(n[s],t),t=Qs(t,t.next);return t}function wP(i,e){return i.x-e.x}function SP(i,e){if(e=MP(i,e),e){let t=U0(e,i);Qs(e,e.next),Qs(t,t.next)}}function MP(i,e){let t=e,r=i.x,n=i.y,s=-1/0,o;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){let h=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(h<=r&&h>s){if(s=h,h===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,d;t=o;do r>=t.x&&t.x>=l&&r!==t.x&&tl(n<c?r:s,n,l,c,n<c?s:r,n,t.x,t.y)&&(d=Math.abs(n-t.y)/(r-t.x),Dc(t,i)&&(d<u||d===u&&(t.x>o.x||t.x===o.x&&AP(o,t)))&&(o=t,u=d)),t=t.next;while(t!==a);return o}function AP(i,e){return ir(i.prev,i,e.prev)<0&&ir(e.next,i,i.next)<0}function TP(i,e,t,r){let n=i;do n.z===null&&(n.z=zm(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,_P(n)}function _P(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 zm(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 EP(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 tl(i,e,t,r,n,s,o,a){return(n-o)*(e-a)-(i-o)*(s-a)>=0&&(i-o)*(r-a)-(t-o)*(e-a)>=0&&(t-o)*(s-a)-(n-o)*(r-a)>=0}function CP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!LP(i,e)&&(Dc(i,e)&&Dc(e,i)&&NP(i,e)&&(ir(i.prev,i,e.prev)||ir(i,e.prev,e))||qh(i,e)&&ir(i.prev,i,i.next)>0&&ir(e.prev,e,e.next)>0)}function ir(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function qh(i,e){return i.x===e.x&&i.y===e.y}function z0(i,e,t,r){let n=Yh(ir(i,e,t)),s=Yh(ir(i,e,r)),o=Yh(ir(t,r,i)),a=Yh(ir(t,r,e));return!!(n!==s&&o!==a||n===0&&Xh(i,t,e)||s===0&&Xh(i,r,e)||o===0&&Xh(t,i,r)||a===0&&Xh(t,e,r))}function Xh(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 Yh(i){return i>0?1:i<0?-1:0}function LP(i,e){let t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&z0(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Dc(i,e){return ir(i.prev,i,i.next)<0?ir(i,e,i.next)>=0&&ir(i,i.prev,e)>=0:ir(i,e,i.prev)<0||ir(i,i.next,e)<0}function NP(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 U0(i,e){let t=new Um(i.i,i.x,i.y),r=new Um(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 k0(i,e,t,r){let n=new Um(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 Rc(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 Um(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function PP(i,e,t,r){let n=0;for(let s=e,o=t-r;s<t;s+=r)n+=(i[o]-i[s])*(i[s+1]+i[o+1]),o=s;return n}var Gi=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 Gi.area(e)<0}static triangulateShape(e,t){let r=[],n=[],s=[];V0(e),H0(r,e);let o=e.length;t.forEach(V0);for(let l=0;l<t.length;l++)n.push(o),o+=t[l].length,H0(r,t[l]);let a=mP.triangulate(r,n);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}};function V0(i){let e=i.length;e>2&&i[e-1].equals(i[0])&&i.pop()}function H0(i,e){for(let t=0;t<e.length;t++)i.push(e[t].x),i.push(e[t].y)}var zo=class extends _e{constructor(e,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 Ae(n,3)),this.setAttribute("uv",new Ae(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,d=t.depth!==void 0?t.depth:100,h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,p=t.bevelThickness!==void 0?t.bevelThickness:6,f=t.bevelSize!==void 0?t.bevelSize:p-2,g=t.bevelOffset!==void 0?t.bevelOffset:0,v=t.bevelSegments!==void 0?t.bevelSegments:3,y=t.extrudePath,m=t.UVGenerator!==void 0?t.UVGenerator:IP;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),d=t.amount);let x,b=!1,w,T,S,M;y&&(x=y.getSpacedPoints(u),b=!0,h=!1,w=y.computeFrenetFrames(u,!1),T=new A,S=new A,M=new A),h||(v=0,p=0,f=0,g=0);let E=a.extractPoints(c),C=E.shape,_=E.holes;if(!Gi.isClockWise(C)){C=C.reverse();for(let $=0,V=_.length;$<V;$++){let K=_[$];Gi.isClockWise(K)&&(_[$]=K.reverse())}}let P=Gi.triangulateShape(C,_),D=C;for(let $=0,V=_.length;$<V;$++){let K=_[$];C=C.concat(K)}function G($,V,K){return V||console.error("THREE.ExtrudeGeometry: vec does not exist"),V.clone().multiplyScalar(K).add($)}let R=C.length,U=P.length;function te($,V,K){let ue,ie,N,L=$.x-V.x,J=$.y-V.y,se=K.x-$.x,ye=K.y-$.y,me=L*L+J*J,Ie=L*ye-J*se;if(Math.abs(Ie)>Number.EPSILON){let we=Math.sqrt(me),Re=Math.sqrt(se*se+ye*ye),Ee=V.x-J/we,j=V.y+L/we,Se=K.x-ye/Re,fe=K.y+se/Re,Ne=((Se-Ee)*ye-(fe-j)*se)/(L*ye-J*se);ue=Ee+L*Ne-$.x,ie=j+J*Ne-$.y;let De=ue*ue+ie*ie;if(De<=2)return new F(ue,ie);N=Math.sqrt(De/2)}else{let we=!1;L>Number.EPSILON?se>Number.EPSILON&&(we=!0):L<-Number.EPSILON?se<-Number.EPSILON&&(we=!0):Math.sign(J)===Math.sign(ye)&&(we=!0),we?(ue=-J,ie=L,N=Math.sqrt(me)):(ue=L,ie=J,N=Math.sqrt(me/2))}return new F(ue/N,ie/N)}let he=[];for(let $=0,V=D.length,K=V-1,ue=$+1;$<V;$++,K++,ue++)K===V&&(K=0),ue===V&&(ue=0),he[$]=te(D[$],D[K],D[ue]);let H=[],z,B=he.concat();for(let $=0,V=_.length;$<V;$++){let K=_[$];z=[];for(let ue=0,ie=K.length,N=ie-1,L=ue+1;ue<ie;ue++,N++,L++)N===ie&&(N=0),L===ie&&(L=0),z[ue]=te(K[ue],K[N],K[L]);H.push(z),B=B.concat(z)}for(let $=0;$<v;$++){let V=$/v,K=p*Math.cos(V*Math.PI/2),ue=f*Math.sin(V*Math.PI/2)+g;for(let ie=0,N=D.length;ie<N;ie++){let L=G(D[ie],he[ie],ue);pe(L.x,L.y,-K)}for(let ie=0,N=_.length;ie<N;ie++){let L=_[ie];z=H[ie];for(let J=0,se=L.length;J<se;J++){let ye=G(L[J],z[J],ue);pe(ye.x,ye.y,-K)}}}let Y=f+g;for(let $=0;$<R;$++){let V=h?G(C[$],B[$],Y):C[$];b?(S.copy(w.normals[0]).multiplyScalar(V.x),T.copy(w.binormals[0]).multiplyScalar(V.y),M.copy(x[0]).add(S).add(T),pe(M.x,M.y,M.z)):pe(V.x,V.y,0)}for(let $=1;$<=u;$++)for(let V=0;V<R;V++){let K=h?G(C[V],B[V],Y):C[V];b?(S.copy(w.normals[$]).multiplyScalar(K.x),T.copy(w.binormals[$]).multiplyScalar(K.y),M.copy(x[$]).add(S).add(T),pe(M.x,M.y,M.z)):pe(K.x,K.y,d/u*$)}for(let $=v-1;$>=0;$--){let V=$/v,K=p*Math.cos(V*Math.PI/2),ue=f*Math.sin(V*Math.PI/2)+g;for(let ie=0,N=D.length;ie<N;ie++){let L=G(D[ie],he[ie],ue);pe(L.x,L.y,d+K)}for(let ie=0,N=_.length;ie<N;ie++){let L=_[ie];z=H[ie];for(let J=0,se=L.length;J<se;J++){let ye=G(L[J],z[J],ue);b?pe(ye.x,ye.y+x[u-1].y,x[u-1].x+K):pe(ye.x,ye.y,d+K)}}}q(),ee();function q(){let $=n.length/3;if(h){let V=0,K=R*V;for(let ue=0;ue<U;ue++){let ie=P[ue];ce(ie[2]+K,ie[1]+K,ie[0]+K)}V=u+v*2,K=R*V;for(let ue=0;ue<U;ue++){let ie=P[ue];ce(ie[0]+K,ie[1]+K,ie[2]+K)}}else{for(let V=0;V<U;V++){let K=P[V];ce(K[2],K[1],K[0])}for(let V=0;V<U;V++){let K=P[V];ce(K[0]+R*u,K[1]+R*u,K[2]+R*u)}}r.addGroup($,n.length/3-$,0)}function ee(){let $=n.length/3,V=0;k(D,V),V+=D.length;for(let K=0,ue=_.length;K<ue;K++){let ie=_[K];k(ie,V),V+=ie.length}r.addGroup($,n.length/3-$,1)}function k($,V){let K=$.length;for(;--K>=0;){let ue=K,ie=K-1;ie<0&&(ie=$.length-1);for(let N=0,L=u+v*2;N<L;N++){let J=R*N,se=R*(N+1),ye=V+ue+J,me=V+ie+J,Ie=V+ie+se,we=V+ue+se;ne(ye,me,Ie,we)}}}function pe($,V,K){l.push($),l.push(V),l.push(K)}function ce($,V,K){X($),X(V),X(K);let ue=n.length/3,ie=m.generateTopUV(r,n,ue-3,ue-2,ue-1);le(ie[0]),le(ie[1]),le(ie[2])}function ne($,V,K,ue){X($),X(V),X(ue),X(V),X(K),X(ue);let ie=n.length/3,N=m.generateSideWallUV(r,n,ie-6,ie-3,ie-2,ie-1);le(N[0]),le(N[1]),le(N[3]),le(N[1]),le(N[2]),le(N[3])}function X($){n.push(l[$*3+0]),n.push(l[$*3+1]),n.push(l[$*3+2])}function le($){s.push($.x),s.push($.y)}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,r=this.parameters.options;return DP(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 F0[n.type]().fromJSON(n)),new zo(r,e.options)}},IP={generateTopUV:function(i,e,t,r,n){let s=e[t*3],o=e[t*3+1],a=e[r*3],l=e[r*3+1],c=e[n*3],u=e[n*3+1];return[new F(s,o),new F(a,l),new F(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],d=e[r*3+2],h=e[n*3],p=e[n*3+1],f=e[n*3+2],g=e[s*3],v=e[s*3+1],y=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new F(o,1-l),new F(c,1-d),new F(h,1-f),new F(g,1-y)]:[new F(a,1-l),new F(u,1-d),new F(p,1-f),new F(v,1-y)]}};function DP(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 Oc=class extends Cc{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 Oc(e.radius,e.detail)}},Bc=class extends _e{constructor(e,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=Br(n,0,Math.PI*2);let s=[],o=[],a=[],l=1/t,c=new A,u=new F;for(let d=0;d<=t;d++){let h=r+d*l*n,p=Math.sin(h),f=Math.cos(h);for(let g=0;g<=e.length-1;g++)c.x=e[g].x*p,c.y=e[g].y,c.z=e[g].x*f,o.push(c.x,c.y,c.z),u.x=d/t,u.y=g/(e.length-1),a.push(u.x,u.y)}for(let d=0;d<t;d++)for(let h=0;h<e.length-1;h++){let p=h+d*e.length,f=p,g=p+e.length,v=p+e.length+1,y=p+1;s.push(f,g,y),s.push(g,v,y)}if(this.setIndex(s),this.setAttribute("position",new Ae(o,3)),this.setAttribute("uv",new Ae(a,2)),this.computeVertexNormals(),n===Math.PI*2){let d=this.attributes.normal.array,h=new A,p=new A,f=new A,g=t*e.length*3;for(let v=0,y=0;v<e.length;v++,y+=3)h.x=d[y+0],h.y=d[y+1],h.z=d[y+2],p.x=d[g+y+0],p.y=d[g+y+1],p.z=d[g+y+2],f.addVectors(h,p).normalize(),d[y+0]=d[g+y+0]=f.x,d[y+1]=d[g+y+1]=f.y,d[y+2]=d[g+y+2]=f.z}}static fromJSON(e){return new Bc(e.points,e.segments,e.phiStart,e.phiLength)}};var rl=class extends _e{constructor(e,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 Ae(n,3)),this.setAttribute("normal",new Ae(s,3)),this.setAttribute("uv",new Ae(o,2));function c(u){let d=n.length/3,h=u.extractPoints(t),p=h.shape,f=h.holes;Gi.isClockWise(p)===!1&&(p=p.reverse());for(let v=0,y=f.length;v<y;v++){let m=f[v];Gi.isClockWise(m)===!0&&(f[v]=m.reverse())}let g=Gi.triangulateShape(p,f);for(let v=0,y=f.length;v<y;v++){let m=f[v];p=p.concat(m)}for(let v=0,y=p.length;v<y;v++){let m=p[v];n.push(m.x,m.y,0),s.push(0,0,1),o.push(m.x,m.y)}for(let v=0,y=g.length;v<y;v++){let m=g[v],x=m[0]+d,b=m[1]+d,w=m[2]+d;r.push(x,b,w),l+=3}}}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return RP(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 rl(r,e.curveSegments)}};function RP(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 nl=class extends _e{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=[],d=new A,h=new A,p=[],f=[],g=[],v=[];for(let y=0;y<=r;y++){let m=[],x=y/r,b=0;y==0&&o==0?b=.5/t:y==r&&l==Math.PI&&(b=-.5/t);for(let w=0;w<=t;w++){let T=w/t;d.x=-e*Math.cos(n+T*s)*Math.sin(o+x*a),d.y=e*Math.cos(o+x*a),d.z=e*Math.sin(n+T*s)*Math.sin(o+x*a),f.push(d.x,d.y,d.z),h.copy(d).normalize(),g.push(h.x,h.y,h.z),v.push(T+b,1-x),m.push(c++)}u.push(m)}for(let y=0;y<r;y++)for(let m=0;m<t;m++){let x=u[y][m+1],b=u[y][m],w=u[y+1][m],T=u[y+1][m+1];(y!==0||o>0)&&p.push(x,b,T),(y!==r-1||l<Math.PI)&&p.push(b,w,T)}this.setIndex(p),this.setAttribute("position",new Ae(f,3)),this.setAttribute("normal",new Ae(g,3)),this.setAttribute("uv",new Ae(v,2))}static fromJSON(e){return new nl(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}};var Fc=class extends _e{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=[],d=new A,h=new A,p=new A,f=new A,g=new A,v=new A,y=new A;for(let x=0;x<=r;++x){let b=x/r*s*Math.PI*2;m(b,s,o,e,p),m(b+.01,s,o,e,f),v.subVectors(f,p),y.addVectors(f,p),g.crossVectors(v,y),y.crossVectors(g,v),g.normalize(),y.normalize();for(let w=0;w<=n;++w){let T=w/n*Math.PI*2,S=-t*Math.cos(T),M=t*Math.sin(T);d.x=p.x+(S*y.x+M*g.x),d.y=p.y+(S*y.y+M*g.y),d.z=p.z+(S*y.z+M*g.z),l.push(d.x,d.y,d.z),h.subVectors(d,p).normalize(),c.push(h.x,h.y,h.z),u.push(x/r),u.push(w/n)}}for(let x=1;x<=r;x++)for(let b=1;b<=n;b++){let w=(n+1)*(x-1)+(b-1),T=(n+1)*x+(b-1),S=(n+1)*x+b,M=(n+1)*(x-1)+b;a.push(w,T,M),a.push(T,S,M)}this.setIndex(a),this.setAttribute("position",new Ae(l,3)),this.setAttribute("normal",new Ae(c,3)),this.setAttribute("uv",new Ae(u,2));function m(x,b,w,T,S){let M=Math.cos(x),E=Math.sin(x),C=w/b*x,_=Math.cos(C);S.x=T*(2+_)*.5*M,S.y=T*(2+_)*E*.5,S.z=T*Math.sin(C)*.5}}static fromJSON(e){return new Fc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}};var j0=class extends Fr{constructor(e){super();this.type="ShadowMaterial",this.color=new ve(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}};j0.prototype.isShadowMaterial=!0;var il=class extends Fr{constructor(e){super();this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ve(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 ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ea,this.normalScale=new F(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.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.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.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};il.prototype.isMeshStandardMaterial=!0;var W0=class extends il{constructor(e){super();this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new F(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=Br(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationTint=new ve(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularTint=new ve(1,1,1),this.specularTintMap=null,this.setValues(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.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new ve).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationTint.copy(e.attenuationTint),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularTint.copy(e.specularTint),this.specularTintMap=e.specularTintMap,this}};W0.prototype.isMeshPhysicalMaterial=!0;var J0=class extends Fr{constructor(e){super();this.type="MeshPhongMaterial",this.color=new ve(16777215),this.specular=new ve(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ea,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=nh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this}};J0.prototype.isMeshPhongMaterial=!0;var q0=class extends Fr{constructor(e){super();this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ve(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ea,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};q0.prototype.isMeshToonMaterial=!0;var X0=class extends Fr{constructor(e){super();this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ea,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}};X0.prototype.isMeshNormalMaterial=!0;var Y0=class extends Fr{constructor(e){super();this.type="MeshLambertMaterial",this.color=new ve(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ve(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=nh,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this}};Y0.prototype.isMeshLambertMaterial=!0;var Q0=class extends Fr{constructor(e){super();this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ve(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ea,this.normalScale=new F(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this}};Q0.prototype.isMeshMatcapMaterial=!0;var K0=class extends un{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}};K0.prototype.isLineDashedMaterial=!0;var Kt={arraySlice:function(i,e,t){return Kt.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(),d=[],h=[];for(let p=0;p<c.times.length;++p){let f=c.times[p]*n;if(!(f<t||f>=r)){d.push(c.times[p]);for(let g=0;g<u;++g)h.push(c.values[p*u+g])}}d.length!==0&&(c.times=Kt.convertArray(d,c.times.constructor),c.values=Kt.convertArray(h,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(i,e=0,t=i,r=30){r<=0&&(r=30);let n=t.tracks.length,s=e/r;for(let o=0;o<n;++o){let a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;let c=i.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(c===void 0)continue;let u=0,d=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let h=0,p=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=p/3);let f=a.times.length-1,g;if(s<=a.times[0]){let y=u,m=d-u;g=Kt.arraySlice(a.values,y,m)}else if(s>=a.times[f]){let y=f*d+u,m=y+d-u;g=Kt.arraySlice(a.values,y,m)}else{let y=a.createInterpolant(),m=u,x=d-u;y.evaluate(s),g=Kt.arraySlice(y.resultBuffer,m,x)}l==="quaternion"&&new Ft().fromArray(g).normalize().conjugate().toArray(g);let v=c.times.length;for(let y=0;y<v;++y){let m=y*p+h;if(l==="quaternion")Ft.multiplyQuaternionsFlat(c.values,m,g,0,c.values,m);else{let x=p-h*2;for(let b=0;b<x;++b)c.values[m+b]-=g[b]}}}return i.blendMode=dx,i}},ps=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_(){}};ps.prototype.beforeStart_=ps.prototype.copySampleValue_;ps.prototype.afterEnd_=ps.prototype.copySampleValue_;var Z0=class extends ps{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:Ta,endingEnd:Ta}}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 _a:s=e,a=2*t-r;break;case ah: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 _a:o=e,l=2*r-t;break;case ah: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,d=this._offsetNext,h=this._weightPrev,p=this._weightNext,f=(r-t)/(n-t),g=f*f,v=g*f,y=-h*v+2*h*g-h*f,m=(1+h)*v+(-1.5-2*h)*g+(-.5+h)*f+1,x=(-1-p)*v+(1.5+p)*g+.5*f,b=p*v-p*g;for(let w=0;w!==a;++w)s[w]=y*o[u+w]+m*o[c+w]+x*o[l+w]+b*o[d+w];return s}},km=class extends ps{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),d=1-u;for(let h=0;h!==a;++h)s[h]=o[c+h]*d+o[l+h]*u;return s}},$0=class extends ps{constructor(e,t,r,n){super(e,t,r,n)}interpolate_(e){return this.copySampleValue_(e-1)}},fi=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=Kt.convertArray(t,this.TimeBufferType),this.values=Kt.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:Kt.convertArray(e.times,Array),values:Kt.convertArray(e.values,Array)};let n=e.getInterpolation();n!==e.DefaultInterpolation&&(r.interpolation=n)}return r.type=e.ValueTypeName,r}InterpolantFactoryMethodDiscrete(e){return new $0(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new km(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Z0(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ma:t=this.InterpolantFactoryMethodDiscrete;break;case Aa:t=this.InterpolantFactoryMethodLinear;break;case Op: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 Ma;case this.InterpolantFactoryMethodLinear:return Aa;case this.InterpolantFactoryMethodSmooth:return Op}}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=Kt.arraySlice(r,s,o),this.values=Kt.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&&Kt.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=Kt.arraySlice(this.times),t=Kt.arraySlice(this.values),r=this.getValueSize(),n=this.getInterpolation()===Op,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 d=a*r,h=d-r,p=d+r;for(let f=0;f!==r;++f){let g=t[d+f];if(g!==t[h+f]||g!==t[p+f]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];let d=a*r,h=o*r;for(let p=0;p!==r;++p)t[h+p]=t[d+p]}++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=Kt.arraySlice(e,0,o),this.values=Kt.arraySlice(t,0,o*r)):(this.times=e,this.values=t),this}clone(){let e=Kt.arraySlice(this.times,0),t=Kt.arraySlice(this.values,0),r=this.constructor,n=new r(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}};fi.prototype.TimeBufferType=Float32Array;fi.prototype.ValueBufferType=Float32Array;fi.prototype.DefaultInterpolation=Aa;var Uo=class extends fi{};Uo.prototype.ValueTypeName="bool";Uo.prototype.ValueBufferType=Array;Uo.prototype.DefaultInterpolation=Ma;Uo.prototype.InterpolantFactoryMethodLinear=void 0;Uo.prototype.InterpolantFactoryMethodSmooth=void 0;var Vm=class extends fi{};Vm.prototype.ValueTypeName="color";var Gc=class extends fi{};Gc.prototype.ValueTypeName="number";var eb=class extends ps{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)Ft.slerpFlat(s,0,o,c-a,o,c,l);return s}},sl=class extends fi{InterpolantFactoryMethodLinear(e){return new eb(this.times,this.values,this.getValueSize(),e)}};sl.prototype.ValueTypeName="quaternion";sl.prototype.DefaultInterpolation=Aa;sl.prototype.InterpolantFactoryMethodSmooth=void 0;var ko=class extends fi{};ko.prototype.ValueTypeName="string";ko.prototype.ValueBufferType=Array;ko.prototype.DefaultInterpolation=Ma;ko.prototype.InterpolantFactoryMethodLinear=void 0;ko.prototype.InterpolantFactoryMethodSmooth=void 0;var zc=class extends fi{};zc.prototype.ValueTypeName="vector";var Hm=class{constructor(e,t=-1,r,n=Bp){this.name=e,this.tracks=r,this.duration=t,this.blendMode=n,this.uuid=Hn(),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(BP(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(fi.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=Kt.getKeyframeOrder(l);l=Kt.sortedArray(l,1,u),c=Kt.sortedArray(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new Gc(".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 d=u[1],h=n[d];h||(n[d]=h=[]),h.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(d,h,p,f,g){if(p.length!==0){let v=[],y=[];Kt.flattenJSON(p,v,y,f),v.length!==0&&g.push(new d(h,v,y))}},n=[],s=e.name||"default",o=e.fps||30,a=e.blendMode,l=e.length||-1,c=e.hierarchy||[];for(let d=0;d<c.length;d++){let h=c[d].keys;if(!(!h||h.length===0))if(h[0].morphTargets){let p={},f;for(f=0;f<h.length;f++)if(h[f].morphTargets)for(let g=0;g<h[f].morphTargets.length;g++)p[h[f].morphTargets[g]]=-1;for(let g in p){let v=[],y=[];for(let m=0;m!==h[f].morphTargets.length;++m){let x=h[f];v.push(x.time),y.push(x.morphTarget===g?1:0)}n.push(new Gc(".morphTargetInfluence["+g+"]",v,y))}l=p.length*(o||1)}else{let p=".bones["+t[d].name+"]";r(zc,p+".position",h,"pos",n),r(sl,p+".quaternion",h,"rot",n),r(zc,p+".scale",h,"scl",n)}}return n.length===0?null:new this(s,l,n,a)}resetDuration(){let e=this.tracks,t=0;for(let r=0,n=e.length;r!==n;++r){let s=this.tracks[r];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}};function OP(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Gc;case"vector":case"vector2":case"vector3":case"vector4":return zc;case"color":return Vm;case"quaternion":return sl;case"bool":case"boolean":return Uo;case"string":return ko}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}function BP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=OP(i.type);if(i.times===void 0){let t=[],r=[];Kt.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 ol={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={}}},al=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,d){return c.push(u,d),this},this.removeHandler=function(u){let d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,h=c.length;d<h;d+=2){let p=c[d],f=c[d+1];if(p.global&&(p.lastIndex=0),p.test(u))return f}return null}}},FP=new al,Rn=class{constructor(e){this.manager=e!==void 0?e:FP,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}},pi={},Qh=class extends Rn{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=this,o=ol.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;if(pi[e]!==void 0){pi[e].push({onLoad:t,onProgress:r,onError:n});return}let a=/^data:(.*?)(;base64)?,(.*)$/,l=e.match(a),c;if(l){let u=l[1],d=!!l[2],h=l[3];h=decodeURIComponent(h),d&&(h=atob(h));try{let p,f=(this.responseType||"").toLowerCase();switch(f){case"arraybuffer":case"blob":let g=new Uint8Array(h.length);for(let y=0;y<h.length;y++)g[y]=h.charCodeAt(y);f==="blob"?p=new Blob([g.buffer],{type:u}):p=g.buffer;break;case"document":p=new DOMParser().parseFromString(h,u);break;case"json":p=JSON.parse(h);break;default:p=h;break}setTimeout(function(){t&&t(p),s.manager.itemEnd(e)},0)}catch(p){setTimeout(function(){n&&n(p),s.manager.itemError(e),s.manager.itemEnd(e)},0)}}else{pi[e]=[],pi[e].push({onLoad:t,onProgress:r,onError:n}),c=new XMLHttpRequest,c.open("GET",e,!0),c.addEventListener("load",function(u){let d=this.response,h=pi[e];if(delete pi[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ol.add(e,d);for(let p=0,f=h.length;p<f;p++){let g=h[p];g.onLoad&&g.onLoad(d)}s.manager.itemEnd(e)}else{for(let p=0,f=h.length;p<f;p++){let g=h[p];g.onError&&g.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)}},!1),c.addEventListener("progress",function(u){let d=pi[e];for(let h=0,p=d.length;h<p;h++){let f=d[h];f.onProgress&&f.onProgress(u)}},!1),c.addEventListener("error",function(u){let d=pi[e];delete pi[e];for(let h=0,p=d.length;h<p;h++){let f=d[h];f.onError&&f.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),c.addEventListener("abort",function(u){let d=pi[e];delete pi[e];for(let h=0,p=d.length;h<p;h++){let f=d[h];f.onError&&f.onError(u)}s.manager.itemError(e),s.manager.itemEnd(e)},!1),this.responseType!==void 0&&(c.responseType=this.responseType),this.withCredentials!==void 0&&(c.withCredentials=this.withCredentials),c.overrideMimeType&&c.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(let u in this.requestHeader)c.setRequestHeader(u,this.requestHeader[u]);c.send(null)}return s.manager.itemStart(e),c}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}};var jm=class extends Rn{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=ol.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;let a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function l(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1),ol.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1),n&&n(u),s.manager.itemError(e),s.manager.itemEnd(e)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}},tb=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=new Oo,o=new jm(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 rb=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=new Pt,o=new jm(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a;let l=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;s.format=l?jt:Qt,s.needsUpdate=!0,t!==void 0&&t(s)},r,n),s}},nb=class extends Dn{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 wn(t,e))}getPoint(e){let t=e*this.getLength(),r=this.getCurveLengths(),n=0;for(;n<r.length;){if(r[n]>=t){let s=r[n]-t,o=this.curves[n],a=o.getLength(),l=a===0?0:1-s/a;return o.getPointAt(l)}n++}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&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&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 F0[n.type]().fromJSON(n))}return this}},Uc=class extends nb{constructor(e){super();this.type="Path",this.currentPoint=new F,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 wn(this.currentPoint.clone(),new F(e,t));return this.curves.push(r),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,r,n){let s=new di(this.currentPoint.clone(),new F(e,t),new F(r,n));return this.curves.push(s),this.currentPoint.set(r,n),this}bezierCurveTo(e,t,r,n,s,o){let a=new bn(this.currentPoint.clone(),new F(e,t),new F(r,n),new F(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),r=new el(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 Go(e,t,r,n,s,o,a,l);if(this.curves.length>0){let d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.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}},Jn=class extends Uc{constructor(e){super(e);this.uuid=Hn(),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 Uc().fromJSON(n))}return this}},On=class extends Ze{constructor(e,t=1){super();this.type="Light",this.color=new ve(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}};On.prototype.isLight=!0;var Vo=class extends On{constructor(e,t,r){super(e,r);this.type="HemisphereLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.groundColor=new ve(t)}copy(e){return On.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}};Vo.prototype.isHemisphereLight=!0;var ib=new Me,sb=new A,ob=new A,Kh=class{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new F(512,512),this.map=null,this.mapPass=null,this.matrix=new Me,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xc,this._frameExtents=new F(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,r=this.matrix;sb.setFromMatrixPosition(e.matrixWorld),t.position.copy(sb),ob.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(ob),t.updateMatrixWorld(),ib.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ib),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}},Wm=class extends Kh{constructor(){super(new dr(50,1,.5,500));this.focus=1}updateMatrices(e){let t=this.camera,r=fc*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}};Wm.prototype.isSpotLightShadow=!0;var Zh=class extends On{constructor(e,t,r=0,n=Math.PI/3,s=0,o=1){super(e,t);this.type="SpotLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.target=new Ze,this.distance=r,this.angle=n,this.penumbra=s,this.decay=o,this.shadow=new Wm}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}};Zh.prototype.isSpotLight=!0;var ab=new Me,kc=new A,Jm=new A,qm=class extends Kh{constructor(){super(new dr(90,1,.5,500));this._frameExtents=new F(4,2),this._viewportCount=6,this._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],this._cubeDirections=[new A(1,0,0),new A(-1,0,0),new A(0,0,1),new A(0,0,-1),new A(0,1,0),new A(0,-1,0)],this._cubeUps=[new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,1,0),new A(0,0,1),new A(0,0,-1)]}updateMatrices(e,t=0){let r=this.camera,n=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),kc.setFromMatrixPosition(e.matrixWorld),r.position.copy(kc),Jm.copy(r.position),Jm.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(Jm),r.updateMatrixWorld(),n.makeTranslation(-kc.x,-kc.y,-kc.z),ab.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ab)}};qm.prototype.isPointLightShadow=!0;var $h=class extends On{constructor(e,t,r=0,n=1){super(e,t);this.type="PointLight",this.distance=r,this.decay=n,this.shadow=new qm}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}};$h.prototype.isPointLight=!0;var Xm=class extends Kh{constructor(){super(new Va(-5,5,5,-5,.5,500))}};Xm.prototype.isDirectionalLightShadow=!0;var ed=class extends On{constructor(e,t){super(e,t);this.type="DirectionalLight",this.position.copy(Ze.DefaultUp),this.updateMatrix(),this.target=new Ze,this.shadow=new Xm}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}};ed.prototype.isDirectionalLight=!0;var lb=class extends On{constructor(e,t){super(e,t);this.type="AmbientLight"}};lb.prototype.isAmbientLight=!0;var cb=class extends On{constructor(e,t,r=10,n=10){super(e,t);this.type="RectAreaLight",this.width=r,this.height=n}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}};cb.prototype.isRectAreaLight=!0;var Ym=class{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new A)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*n),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*r),t.addScaledVector(o[4],1.092548*(r*n)),t.addScaledVector(o[5],1.092548*(n*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(r*s)),t.addScaledVector(o[8],.546274*(r*r-n*n)),t}getIrradianceAt(e,t){let r=e.x,n=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*n),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*r),t.addScaledVector(o[4],2*.429043*r*n),t.addScaledVector(o[5],2*.429043*n*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*r*s),t.addScaledVector(o[8],.429043*(r*r-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let r=0;r<9;r++)this.coefficients[r].addScaledVector(e.coefficients[r],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let r=0;r<9;r++)this.coefficients[r].lerp(e.coefficients[r],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){let r=this.coefficients;for(let n=0;n<9;n++)r[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){let r=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*r,t[4]=1.092548*r*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*r*s,t[8]=.546274*(r*r-n*n)}};Ym.prototype.isSphericalHarmonics3=!0;var td=class extends On{constructor(e=new Ym,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}};td.prototype.isLightProbe=!0;var ub=class{static decodeText(e){if(typeof TextDecoder!="undefined")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(r){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}},Qm=class extends _e{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}};Qm.prototype.isInstancedBufferGeometry=!0;var Km=class extends Fe{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}};Km.prototype.isInstancedBufferAttribute=!0;var Ho=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new Qh(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(p,f){if(t[f]!==void 0)return t[f];let v=p.interleavedBuffers[f],y=s(p,v.buffer),m=wh(v.type,y),x=new ds(m,v.stride);return x.uuid=v.uuid,t[f]=x,x}function s(p,f){if(r[f]!==void 0)return r[f];let v=p.arrayBuffers[f],y=new Uint32Array(v).buffer;return r[f]=y,y}let o=e.isInstancedBufferGeometry?new Qm:new _e,a=e.data.index;if(a!==void 0){let p=wh(a.type,a.array);o.setIndex(new Fe(p,1))}let l=e.data.attributes;for(let p in l){let f=l[p],g;if(f.isInterleavedBufferAttribute){let v=n(e.data,f.data);g=new Bi(v,f.itemSize,f.offset,f.normalized)}else{let v=wh(f.type,f.array),y=f.isInstancedBufferAttribute?Km:Fe;g=new y(v,f.itemSize,f.normalized)}f.name!==void 0&&(g.name=f.name),f.usage!==void 0&&g.setUsage(f.usage),f.updateRange!==void 0&&(g.updateRange.offset=f.updateRange.offset,g.updateRange.count=f.updateRange.count),o.setAttribute(p,g)}let c=e.data.morphAttributes;if(c)for(let p in c){let f=c[p],g=[];for(let v=0,y=f.length;v<y;v++){let m=f[v],x;if(m.isInterleavedBufferAttribute){let b=n(e.data,m.data);x=new Bi(b,m.itemSize,m.offset,m.normalized)}else{let b=wh(m.type,m.array);x=new Fe(b,m.itemSize,m.normalized)}m.name!==void 0&&(x.name=m.name),g.push(x)}o.morphAttributes[p]=g}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);let d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let p=0,f=d.length;p!==f;++p){let g=d[p];o.addGroup(g.start,g.count,g.materialIndex)}let h=e.data.boundingSphere;if(h!==void 0){let p=new A;h.center!==void 0&&p.fromArray(h.center),o.boundingSphere=new ln(p,h.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}};var hb=class extends Rn{constructor(e){super(e);typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&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=ol.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){ol.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)}};hb.prototype.isImageBitmapLoader=!0;var db=class{constructor(){this.type="ShapePath",this.color=new ve,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Uc,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(m){let x=[];for(let b=0,w=m.length;b<w;b++){let T=m[b],S=new Jn;S.curves=T.curves,x.push(S)}return x}function n(m,x){let b=x.length,w=!1;for(let T=b-1,S=0;S<b;T=S++){let M=x[T],E=x[S],C=E.x-M.x,_=E.y-M.y;if(Math.abs(_)>Number.EPSILON){if(_<0&&(M=x[S],C=-C,E=x[T],_=-_),m.y<M.y||m.y>E.y)continue;if(m.y===M.y){if(m.x===M.x)return!0}else{let O=_*(m.x-M.x)-C*(m.y-M.y);if(O===0)return!0;if(O<0)continue;w=!w}}else{if(m.y!==M.y)continue;if(E.x<=m.x&&m.x<=M.x||M.x<=m.x&&m.x<=E.x)return!0}}return w}let s=Gi.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 Jn,c.curves=l.curves,u.push(c),u;let d=!s(o[0].getPoints());d=e?!d:d;let h=[],p=[],f=[],g=0,v;p[g]=void 0,f[g]=[];for(let m=0,x=o.length;m<x;m++)l=o[m],v=l.getPoints(),a=s(v),a=e?!a:a,a?(!d&&p[g]&&g++,p[g]={s:new Jn,p:v},p[g].s.curves=l.curves,d&&g++,f[g]=[]):f[g].push({h:l,p:v[0]});if(!p[0])return r(o);if(p.length>1){let m=!1,x=[];for(let b=0,w=p.length;b<w;b++)h[b]=[];for(let b=0,w=p.length;b<w;b++){let T=f[b];for(let S=0;S<T.length;S++){let M=T[S],E=!0;for(let C=0;C<p.length;C++)n(M.p,p[C].p)&&(b!==C&&x.push({froms:b,tos:C,hole:S}),E?(E=!1,h[C].push(M)):m=!0);E&&h[b].push(M)}}x.length>0&&(m||(f=h))}let y;for(let m=0,x=p.length;m<x;m++){c=p[m].s,u.push(c),y=f[m];for(let b=0,w=y.length;b<w;b++)c.holes.push(y[b].h)}return u}},Zm=class{constructor(e){this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],n=GP(e,t,this.data);for(let s=0,o=n.length;s<o;s++)Array.prototype.push.apply(r,n[s].toShapes());return r}};function GP(i,e,t){let r=Array.from(i),n=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*n,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let u=r[c];if(u===`
|
|
3191
|
-
`)a=0,l-=s;else{let d=zP(u,n,a,l,t);a+=d.offsetX,o.push(d.path)}}return o}function zP(i,e,t,r,n){let s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}let o=new db,a,l,c,u,d,h,p,f;if(s.o){let g=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let v=0,y=g.length;v<y;)switch(g[v++]){case"m":a=g[v++]*e+t,l=g[v++]*e+r,o.moveTo(a,l);break;case"l":a=g[v++]*e+t,l=g[v++]*e+r,o.lineTo(a,l);break;case"q":c=g[v++]*e+t,u=g[v++]*e+r,d=g[v++]*e+t,h=g[v++]*e+r,o.quadraticCurveTo(d,h,c,u);break;case"b":c=g[v++]*e+t,u=g[v++]*e+r,d=g[v++]*e+t,h=g[v++]*e+r,p=g[v++]*e+t,f=g[v++]*e+r,o.bezierCurveTo(d,h,p,f,c,u);break}}return{offsetX:s.ha*e,path:o}}Zm.prototype.isFont=!0;var $m=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new Qh(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch(u){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,n)}parse(e){return new Zm(e)}},rd,UP={getContext:function(){return rd===void 0&&(rd=new(window.AudioContext||window.webkitAudioContext)),rd},setContext:function(i){rd=i}},fb=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new Qh(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);UP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},pb=class extends td{constructor(e,t,r=1){super(void 0,r);let n=new ve().set(e),s=new ve().set(t),o=new A(n.r,n.g,n.b),a=new A(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}};pb.prototype.isHemisphereLightProbe=!0;var mb=class extends td{constructor(e,t=1){super(void 0,t);let r=new ve().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};mb.prototype.isAmbientLightProbe=!0;var eg=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gb(),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=gb();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function gb(){return(typeof performance=="undefined"?Date:performance).now()}var yb=class extends Ze{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 vb=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}},xb=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){Ft.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ft.multiplyQuaternionsFlat(e,o,e,t,e,r),Ft.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}}},tg="\\[\\]\\.:\\/",kP=new RegExp("["+tg+"]","g"),rg="[^"+tg+"]",VP="[^"+tg.replace("\\.","")+"]",HP=/((?:WC+[\/:])*)/.source.replace("WC",rg),jP=/(WCOD+)?/.source.replace("WCOD",VP),WP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rg),JP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rg),qP=new RegExp("^"+HP+jP+WP+JP+"$"),XP=["material","materials","bones"],bb=class{constructor(e,t,r){let n=r||lt.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()}},lt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||lt.parseTrackName(t),this.node=lt.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 lt.Composite(e,t,r):new lt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(kP,"")}static parseTrackName(e){let t=qP.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);XP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(!t||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.node[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=lt.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}};lt.Composite=bb;lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};lt.prototype.GetterByBindingType=[lt.prototype._getValue_direct,lt.prototype._getValue_array,lt.prototype._getValue_arrayElement,lt.prototype._getValue_toArray];lt.prototype.SetterByBindingTypeAndVersioning=[[lt.prototype._setValue_direct,lt.prototype._setValue_direct_setNeedsUpdate,lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_array,lt.prototype._setValue_array_setNeedsUpdate,lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_arrayElement,lt.prototype._setValue_arrayElement_setNeedsUpdate,lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_fromArray,lt.prototype._setValue_fromArray_setNeedsUpdate,lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var wb=class{constructor(){this.uuid=Hn(),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,d=arguments.length;u!==d;++u){let h=arguments[u],p=h.uuid,f=t[p];if(f===void 0){f=l++,t[p]=f,e.push(h);for(let g=0,v=o;g!==v;++g)s[g].push(new lt(h,r[g],n[g]))}else if(f<c){a=e[f];let g=--c,v=e[g];t[v.uuid]=f,e[f]=v,t[p]=g,e[g]=h;for(let y=0,m=o;y!==m;++y){let x=s[y],b=x[g],w=x[f];x[f]=b,w===void 0&&(w=new lt(h,r[y],n[y])),x[g]=w}}else e[f]!==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 d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let p=0,f=n;p!==f;++p){let g=r[p],v=g[d],y=g[u];g[u]=v,g[d]=y}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){let h=--s,p=e[h],f=--o,g=e[f];t[p.uuid]=d,e[d]=p,t[g.uuid]=h,e[h]=g,e.pop();for(let v=0,y=n;v!==y;++v){let m=r[v],x=m[h],b=m[f];m[d]=x,m[h]=b,m.pop()}}else{let h=--o,p=e[h];h>0&&(t[p.uuid]=d),e[d]=p,e.pop();for(let f=0,g=n;f!==g;++f){let v=r[f];v[d]=v[h],v.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_,d=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(d);for(let h=u,p=l.length;h!==p;++h){let f=l[h];d[h]=new lt(f,e,t)}return d}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()}}};wb.prototype.isAnimationObjectGroup=!0;var Sb=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:Ta,endingEnd:Ta};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=mE,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 dx:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Bp:default:for(let u=0,d=l.length;u!==d;++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===gE;if(e===0)return s===-1?n:o&&(s&1)==1?t-n:n;if(r===pE){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=_a,n.endingEnd=_a):(e?n.endingStart=this.zeroSlopeAtStart?_a:Ta:n.endingStart=ah,t?n.endingEnd=this.zeroSlopeAtEnd?_a:Ta:n.endingEnd=ah)}_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}},Mb=class extends xr{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 d=0;d!==s;++d){let h=n[d],p=h.name,f=u[p];if(f!==void 0)o[d]=f;else{if(f=o[d],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,l,p));continue}let g=t&&t._propertyBindings[d].binding.parsedPath;f=new xb(lt.create(r,p,g),h.ValueTypeName,h.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,l,p),o[d]=f}a[d].resultBuffer=f.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 d=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],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 km(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"?Hm.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=Bp),l!==void 0){let d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===r)return d;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Sb(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"?Hm.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,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,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))}};Mb.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Te=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Te(this.value.clone===void 0?this.value:this.value.clone())}},Ab=class extends ds{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}};Ab.prototype.isInstancedInterleavedBuffer=!0;var Tb=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}};Tb.prototype.isGLBufferAttribute=!0;var ng=class{constructor(e,t,r=0,n=1/0){this.ray=new Ni(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Kp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){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&&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=!1,r=[]){return ig(e,this,r,t),r.sort(_b),r}intersectObjects(e,t=!1,r=[]){for(let n=0,s=e.length;n<s;n++)ig(e[n],this,r,t);return r.sort(_b),r}};function _b(i,e){return i.distance-e.distance}function ig(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++)ig(n[s],e,t,!0)}}var nd=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(){let e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,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(Br(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var Eb=new F,ll=class{constructor(e=new F(1/0,1/0),t=new F(-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=Eb.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 Eb.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)}};ll.prototype.isBox2=!0;var Cb=new A,id=new A,hn=class{constructor(e=new A,t=new A){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Cb.subVectors(e,this.start),id.subVectors(this.end,this.start);let r=id.dot(id),s=id.dot(Cb)/r;return t&&(s=Br(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)}},Lb=class extends Ze{constructor(e){super();this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}};Lb.prototype.isImmediateRenderObject=!0;var Nb=new A,sg=class extends Ze{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new _e,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 Ae(n,3));let s=new un({fog:!1,toneMapped:!1});this.cone=new Fi(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),Nb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Ks=new A,sd=new Me,og=new Me,Pb=class extends Fi{constructor(e){let t=Ib(e),r=new _e,n=[],s=[],o=new ve(0,0,1),a=new ve(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 Ae(n,3)),r.setAttribute("color",new Ae(s,3));let l=new un({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");og.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(sd.multiplyMatrices(og,a.matrixWorld),Ks.setFromMatrixPosition(sd),n.setXYZ(o,Ks.x,Ks.y,Ks.z),sd.multiplyMatrices(og,a.parent.matrixWorld),Ks.setFromMatrixPosition(sd),n.setXYZ(o+1,Ks.x,Ks.y,Ks.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Ib(i){let e=[];i&&i.isBone&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Ib(i.children[t]));return e}var ag=class extends Wt{constructor(e,t,r){let n=new nl(t,4,2),s=new Pi({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 Db=class extends Fi{constructor(e=10,t=10,r=4473924,n=8947848){r=new ve(r),n=new ve(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let h=0,p=0,f=-a;h<=t;h++,f+=o){l.push(-a,0,f,a,0,f),l.push(f,0,-a,f,0,a);let g=h===s?r:n;g.toArray(c,p),p+=3,g.toArray(c,p),p+=3,g.toArray(c,p),p+=3,g.toArray(c,p),p+=3}let u=new _e;u.setAttribute("position",new Ae(l,3)),u.setAttribute("color",new Ae(c,3));let d=new un({vertexColors:!0,toneMapped:!1});super(u,d);this.type="GridHelper"}};var Rb=new A,od=new A,Ob=new A,lg=class extends Ze{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 _e;n.setAttribute("position",new Ae([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new un({fog:!1,toneMapped:!1});this.lightPlane=new Ys(n,s),this.add(this.lightPlane),n=new _e,n.setAttribute("position",new Ae([0,0,0,0,0,1],3)),this.targetLine=new Ys(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(){Rb.setFromMatrixPosition(this.light.matrixWorld),od.setFromMatrixPosition(this.light.target.matrixWorld),Ob.subVectors(od,Rb),this.lightPlane.lookAt(od),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(od),this.targetLine.scale.z=Ob.length()}},ad=new A,lr=new hi,mi=class extends Fi{constructor(e){let t=new _e,r=new un({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new ve(16755200),l=new ve(16711680),c=new ve(43775),u=new ve(16777215),d=new ve(3355443);h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",l),h("p","n2",l),h("p","n3",l),h("p","n4",l),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",u),h("p","c",d),h("cn1","cn2",d),h("cn3","cn4",d),h("cf1","cf2",d),h("cf3","cf4",d);function h(f,g,v){p(f,v),p(g,v)}function p(f,g){n.push(0,0,0),s.push(g.r,g.g,g.b),o[f]===void 0&&(o[f]=[]),o[f].push(n.length/3-1)}t.setAttribute("position",new Ae(n,3)),t.setAttribute("color",new Ae(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;lr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),pr("c",t,e,lr,0,0,-1),pr("t",t,e,lr,0,0,1),pr("n1",t,e,lr,-r,-n,-1),pr("n2",t,e,lr,r,-n,-1),pr("n3",t,e,lr,-r,n,-1),pr("n4",t,e,lr,r,n,-1),pr("f1",t,e,lr,-r,-n,1),pr("f2",t,e,lr,r,-n,1),pr("f3",t,e,lr,-r,n,1),pr("f4",t,e,lr,r,n,1),pr("u1",t,e,lr,r*.7,n*1.1,-1),pr("u2",t,e,lr,-r*.7,n*1.1,-1),pr("u3",t,e,lr,0,n*2,-1),pr("cf1",t,e,lr,-r,0,1),pr("cf2",t,e,lr,r,0,1),pr("cf3",t,e,lr,0,-n,1),pr("cf4",t,e,lr,0,n,1),pr("cn1",t,e,lr,-r,0,-1),pr("cn2",t,e,lr,r,0,-1),pr("cn3",t,e,lr,0,-n,-1),pr("cn4",t,e,lr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function pr(i,e,t,r,n,s,o){ad.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],ad.x,ad.y,ad.z)}}var cl=class extends Fi{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 _e;s.setIndex(new Fe(r,1)),s.setAttribute("position",new Ae(n,3));super(s,new un({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 cg=class extends Fi{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 _e;n.setAttribute("position",new Ae(t,3)),n.setAttribute("color",new Ae(r,3));let s=new un({vertexColors:!0,toneMapped:!1});super(n,s);this.type="AxesHelper"}setColors(e,t,r){let n=new ve,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()}},YP=new Float32Array(1),_U=new Int32Array(YP.buffer);Dn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(Dn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Uc.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Db.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Pb.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Rn.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ub.extractUrlBase(i)};Rn.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.")}};ll.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};ll.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};ll.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};ll.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};rr.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};rr.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};rr.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};rr.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};rr.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};ln.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};xc.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};hn.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Dt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Dt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Dt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Dt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Dt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Dt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Me.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Me.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Me.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new A().setFromMatrixColumn(this,3)};Me.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Me.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Me.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Me.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Me.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Me.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Me.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Me.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Me.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Me.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Me.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)};Me.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};xn.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ft.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ft.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Ni.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Ni.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};Ni.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};nr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};nr.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};nr.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};nr.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};nr.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};nr.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),nr.getBarycoord(i,e,t,r,n)};nr.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),nr.getNormal(i,e,t,r)};Jn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};Jn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new zo(this,i)};Jn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new rl(this,i)};F.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};F.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};F.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};A.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};A.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};A.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};A.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};A.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};A.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};A.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};A.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};A.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ze.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};Ze.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Ze.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};Ze.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Ze.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ze.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.")}}});Wt.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(Wt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Fp},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.")}}});_m.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};dr.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(On.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(Fe.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===hh},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(hh)}}});Fe.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hh:hc),this};Fe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Fe.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};_e.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};_e.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 Fe(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};_e.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)};_e.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};_e.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};_e.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};_e.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(_e.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}}});ds.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hh:hc),this};ds.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};zo.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};zo.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};zo.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};Gr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Te.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(Fr.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 ve}},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===qv}},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(Rt.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}}});_t.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)};_t.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};_t.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};_t.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};_t.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};_t.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};_t.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};_t.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};_t.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};_t.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};_t.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};_t.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};_t.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};_t.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};_t.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};_t.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};_t.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};_t.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};_t.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};_t.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};_t.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};_t.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};_t.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};_t.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};_t.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(_t.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?Lo:vr}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(u0.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(xt.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}}});yb.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new fb().load(i,function(r){e.setBuffer(r)}),this};vb.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Nh.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Nh.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};Po.crossOrigin=void 0;Po.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new rb;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};Po.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new tb;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};Po.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Po.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:jv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=jv);var QP=()=>typeof window=="undefined"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),KP=()=>typeof window=="undefined"?!1:window.navigator.platform.toUpperCase().includes("MAC"),CU=QP(),Vc=KP();function Bb(i){return Array.isArray(i)?i:[i]}function Hc(i){return Vc?i.metaKey:i.ctrlKey}var ZP=typeof global=="object"&&global&&global.Object===Object&&global,ld=ZP;var $P=typeof self=="object"&&self&&self.Object===Object&&self,eI=ld||$P||Function("return this")(),cr=eI;var tI=cr.Symbol,dn=tI;var Fb=Object.prototype,rI=Fb.hasOwnProperty,nI=Fb.toString,jc=dn?dn.toStringTag:void 0;function iI(i){var e=rI.call(i,jc),t=i[jc];try{i[jc]=void 0;var r=!0}catch(s){}var n=nI.call(i);return r&&(e?i[jc]=t:delete i[jc]),n}var Gb=iI;var sI=Object.prototype,oI=sI.toString;function aI(i){return oI.call(i)}var zb=aI;var lI="[object Null]",cI="[object Undefined]",Ub=dn?dn.toStringTag:void 0;function uI(i){return i==null?i===void 0?cI:lI:Ub&&Ub in Object(i)?Gb(i):zb(i)}var Bn=uI;function hI(i){return i!=null&&typeof i=="object"}var Zr=hI;var dI="[object Symbol]";function fI(i){return typeof i=="symbol"||Zr(i)&&Bn(i)==dI}var Zs=fI;function pI(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 cd=pI;var mI=Array.isArray,zr=mI;var gI=1/0,kb=dn?dn.prototype:void 0,Vb=kb?kb.toString:void 0;function Hb(i){if(typeof i=="string")return i;if(zr(i))return cd(i,Hb)+"";if(Zs(i))return Vb?Vb.call(i):"";var e=i+"";return e=="0"&&1/i==-gI?"-0":e}var jb=Hb;var yI=/\s/;function vI(i){for(var e=i.length;e--&&yI.test(i.charAt(e)););return e}var Wb=vI;var xI=/^\s+/;function bI(i){return i&&i.slice(0,Wb(i)+1).replace(xI,"")}var Jb=bI;function wI(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var mr=wI;var qb=0/0,SI=/^[-+]0x[0-9a-f]+$/i,MI=/^0b[01]+$/i,AI=/^0o[0-7]+$/i,TI=parseInt;function _I(i){if(typeof i=="number")return i;if(Zs(i))return qb;if(mr(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=mr(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Jb(i);var t=MI.test(i);return t||AI.test(i)?TI(i.slice(2),t?2:8):SI.test(i)?qb:+i}var ug=_I;function EI(i){return i}var ud=EI;var CI="[object AsyncFunction]",LI="[object Function]",NI="[object GeneratorFunction]",PI="[object Proxy]";function II(i){if(!mr(i))return!1;var e=Bn(i);return e==LI||e==NI||e==CI||e==PI}var ul=II;var DI=cr["__core-js_shared__"],hd=DI;var Xb=function(){var i=/[^.]+$/.exec(hd&&hd.keys&&hd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function RI(i){return!!Xb&&Xb in i}var Yb=RI;var OI=Function.prototype,BI=OI.toString;function FI(i){if(i!=null){try{return BI.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var ms=FI;var GI=/[\\^$.*+?()[\]{}|]/g,zI=/^\[object .+?Constructor\]$/,UI=Function.prototype,kI=Object.prototype,VI=UI.toString,HI=kI.hasOwnProperty,jI=RegExp("^"+VI.call(HI).replace(GI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function WI(i){if(!mr(i)||Yb(i))return!1;var e=ul(i)?jI:zI;return e.test(ms(i))}var Qb=WI;function JI(i,e){return i==null?void 0:i[e]}var Kb=JI;function qI(i,e){var t=Kb(i,e);return Qb(t)?t:void 0}var Sn=qI;var XI=Sn(cr,"WeakMap"),dd=XI;var Zb=Object.create,YI=function(){function i(){}return function(e){if(!mr(e))return{};if(Zb)return Zb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),$b=YI;function QI(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 ew=QI;function KI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var fd=KI;var ZI=800,$I=16,eD=Date.now;function tD(i){var e=0,t=0;return function(){var r=eD(),n=$I-(r-t);if(t=r,n>0){if(++e>=ZI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var tw=tD;function rD(i){return function(){return i}}var rw=rD;var nD=function(){try{var i=Sn(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),hl=nD;var iD=hl?function(i,e){return hl(i,"toString",{configurable:!0,enumerable:!1,value:rw(e),writable:!0})}:ud,nw=iD;var sD=tw(nw),pd=sD;function oD(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var iw=oD;var aD=9007199254740991,lD=/^(?:0|[1-9]\d*)$/;function cD(i,e){var t=typeof i;return e=e==null?aD:e,!!e&&(t=="number"||t!="symbol"&&lD.test(i))&&i>-1&&i%1==0&&i<e}var md=cD;function uD(i,e,t){e=="__proto__"&&hl?hl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var dl=uD;function hD(i,e){return i===e||i!==i&&e!==e}var $s=hD;var dD=Object.prototype,fD=dD.hasOwnProperty;function pD(i,e,t){var r=i[e];(!(fD.call(i,e)&&$s(r,t))||t===void 0&&!(e in i))&&dl(i,e,t)}var gd=pD;function mD(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?dl(t,a,l):gd(t,a,l)}return t}var qn=mD;var sw=Math.max;function gD(i,e,t){return e=sw(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=sw(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),ew(i,this,a)}}var yd=gD;function yD(i,e){return pd(yd(i,e,ud),i+"")}var ow=yD;var vD=9007199254740991;function xD(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=vD}var vd=xD;function bD(i){return i!=null&&vd(i.length)&&!ul(i)}var eo=bD;function wD(i,e,t){if(!mr(t))return!1;var r=typeof e;return(r=="number"?eo(t)&&md(e,t.length):r=="string"&&e in t)?$s(t[e],i):!1}var aw=wD;function SD(i){return ow(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&&aw(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 lw=SD;var MD=Object.prototype;function AD(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||MD;return i===t}var fl=AD;function TD(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var cw=TD;var _D="[object Arguments]";function ED(i){return Zr(i)&&Bn(i)==_D}var hg=ED;var uw=Object.prototype,CD=uw.hasOwnProperty,LD=uw.propertyIsEnumerable,ND=hg(function(){return arguments}())?hg:function(i){return Zr(i)&&CD.call(i,"callee")&&!LD.call(i,"callee")},jo=ND;function PD(){return!1}var hw=PD;var dw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fw=dw&&typeof module=="object"&&module&&!module.nodeType&&module,ID=fw&&fw.exports===dw,pw=ID?cr.Buffer:void 0,DD=pw?pw.isBuffer:void 0,RD=DD||hw,pl=RD;var OD="[object Arguments]",BD="[object Array]",FD="[object Boolean]",GD="[object Date]",zD="[object Error]",UD="[object Function]",kD="[object Map]",VD="[object Number]",HD="[object Object]",jD="[object RegExp]",WD="[object Set]",JD="[object String]",qD="[object WeakMap]",XD="[object ArrayBuffer]",YD="[object DataView]",QD="[object Float32Array]",KD="[object Float64Array]",ZD="[object Int8Array]",$D="[object Int16Array]",eR="[object Int32Array]",tR="[object Uint8Array]",rR="[object Uint8ClampedArray]",nR="[object Uint16Array]",iR="[object Uint32Array]",Jt={};Jt[QD]=Jt[KD]=Jt[ZD]=Jt[$D]=Jt[eR]=Jt[tR]=Jt[rR]=Jt[nR]=Jt[iR]=!0;Jt[OD]=Jt[BD]=Jt[XD]=Jt[FD]=Jt[YD]=Jt[GD]=Jt[zD]=Jt[UD]=Jt[kD]=Jt[VD]=Jt[HD]=Jt[jD]=Jt[WD]=Jt[JD]=Jt[qD]=!1;function sR(i){return Zr(i)&&vd(i.length)&&!!Jt[Bn(i)]}var mw=sR;function oR(i){return function(e){return i(e)}}var ml=oR;var gw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wc=gw&&typeof module=="object"&&module&&!module.nodeType&&module,aR=Wc&&Wc.exports===gw,dg=aR&&ld.process,lR=function(){try{var i=Wc&&Wc.require&&Wc.require("util").types;return i||dg&&dg.binding&&dg.binding("util")}catch(e){}}(),gs=lR;var yw=gs&&gs.isTypedArray,cR=yw?ml(yw):mw,xd=cR;var uR=Object.prototype,hR=uR.hasOwnProperty;function dR(i,e){var t=zr(i),r=!t&&jo(i),n=!t&&!r&&pl(i),s=!t&&!r&&!n&&xd(i),o=t||r||n||s,a=o?cw(i.length,String):[],l=a.length;for(var c in i)(e||hR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||md(c,l)))&&a.push(c);return a}var bd=dR;function fR(i,e){return function(t){return i(e(t))}}var wd=fR;var pR=wd(Object.keys,Object),vw=pR;var mR=Object.prototype,gR=mR.hasOwnProperty;function yR(i){if(!fl(i))return vw(i);var e=[];for(var t in Object(i))gR.call(i,t)&&t!="constructor"&&e.push(t);return e}var xw=yR;function vR(i){return eo(i)?bd(i):xw(i)}var gl=vR;function xR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var bw=xR;var bR=Object.prototype,wR=bR.hasOwnProperty;function SR(i){if(!mr(i))return bw(i);var e=fl(i),t=[];for(var r in i)r=="constructor"&&(e||!wR.call(i,r))||t.push(r);return t}var ww=SR;function MR(i){return eo(i)?bd(i,!0):ww(i)}var zi=MR;var AR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,TR=/^\w*$/;function _R(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Zs(i)?!0:TR.test(i)||!AR.test(i)||e!=null&&i in Object(e)}var Sw=_R;var ER=Sn(Object,"create"),ys=ER;function CR(){this.__data__=ys?ys(null):{},this.size=0}var Mw=CR;function LR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Aw=LR;var NR="__lodash_hash_undefined__",PR=Object.prototype,IR=PR.hasOwnProperty;function DR(i){var e=this.__data__;if(ys){var t=e[i];return t===NR?void 0:t}return IR.call(e,i)?e[i]:void 0}var Tw=DR;var RR=Object.prototype,OR=RR.hasOwnProperty;function BR(i){var e=this.__data__;return ys?e[i]!==void 0:OR.call(e,i)}var _w=BR;var FR="__lodash_hash_undefined__";function GR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=ys&&e===void 0?FR:e,this}var Ew=GR;function yl(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])}}yl.prototype.clear=Mw;yl.prototype.delete=Aw;yl.prototype.get=Tw;yl.prototype.has=_w;yl.prototype.set=Ew;var fg=yl;function zR(){this.__data__=[],this.size=0}var Cw=zR;function UR(i,e){for(var t=i.length;t--;)if($s(i[t][0],e))return t;return-1}var to=UR;var kR=Array.prototype,VR=kR.splice;function HR(i){var e=this.__data__,t=to(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():VR.call(e,t,1),--this.size,!0}var Lw=HR;function jR(i){var e=this.__data__,t=to(e,i);return t<0?void 0:e[t][1]}var Nw=jR;function WR(i){return to(this.__data__,i)>-1}var Pw=WR;function JR(i,e){var t=this.__data__,r=to(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Iw=JR;function vl(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])}}vl.prototype.clear=Cw;vl.prototype.delete=Lw;vl.prototype.get=Nw;vl.prototype.has=Pw;vl.prototype.set=Iw;var ro=vl;var qR=Sn(cr,"Map"),no=qR;function XR(){this.size=0,this.__data__={hash:new fg,map:new(no||ro),string:new fg}}var Dw=XR;function YR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Rw=YR;function QR(i,e){var t=i.__data__;return Rw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var io=QR;function KR(i){var e=io(this,i).delete(i);return this.size-=e?1:0,e}var Ow=KR;function ZR(i){return io(this,i).get(i)}var Bw=ZR;function $R(i){return io(this,i).has(i)}var Fw=$R;function eO(i,e){var t=io(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Gw=eO;function xl(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])}}xl.prototype.clear=Dw;xl.prototype.delete=Ow;xl.prototype.get=Bw;xl.prototype.has=Fw;xl.prototype.set=Gw;var Jc=xl;var tO="Expected a function";function pg(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(tO);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(pg.Cache||Jc),t}pg.Cache=Jc;var zw=pg;var rO=500;function nO(i){var e=zw(i,function(r){return t.size===rO&&t.clear(),r}),t=e.cache;return e}var Uw=nO;var iO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sO=/\\(\\)?/g,oO=Uw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(iO,function(t,r,n,s){e.push(n?s.replace(sO,"$1"):r||t)}),e}),kw=oO;function aO(i){return i==null?"":jb(i)}var Vw=aO;function lO(i,e){return zr(i)?i:Sw(i,e)?[i]:kw(Vw(i))}var bl=lO;var cO=1/0;function uO(i){if(typeof i=="string"||Zs(i))return i;var e=i+"";return e=="0"&&1/i==-cO?"-0":e}var Sd=uO;function hO(i,e){e=bl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[Sd(e[t++])];return t&&t==r?i:void 0}var Hw=hO;function dO(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var wl=dO;var jw=dn?dn.isConcatSpreadable:void 0;function fO(i){return zr(i)||jo(i)||!!(jw&&i&&i[jw])}var Ww=fO;function Jw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Ww),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Jw(a,e-1,t,r,n):wl(n,a):r||(n[n.length]=a)}return n}var qw=Jw;function pO(i){var e=i==null?0:i.length;return e?qw(i,1):[]}var Xw=pO;function mO(i){return pd(yd(i,void 0,Xw),i+"")}var Yw=mO;var gO=wd(Object.getPrototypeOf,Object),Sl=gO;var yO="[object Object]",vO=Function.prototype,xO=Object.prototype,Qw=vO.toString,bO=xO.hasOwnProperty,wO=Qw.call(Object);function SO(i){if(!Zr(i)||Bn(i)!=yO)return!1;var e=Sl(i);if(e===null)return!0;var t=bO.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Qw.call(t)==wO}var Md=SO;function MO(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 Kw=MO;function AO(){this.__data__=new ro,this.size=0}var Zw=AO;function TO(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var $w=TO;function _O(i){return this.__data__.get(i)}var eS=_O;function EO(i){return this.__data__.has(i)}var tS=EO;var CO=200;function LO(i,e){var t=this.__data__;if(t instanceof ro){var r=t.__data__;if(!no||r.length<CO-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new Jc(r)}return t.set(i,e),this.size=t.size,this}var rS=LO;function Ml(i){var e=this.__data__=new ro(i);this.size=e.size}Ml.prototype.clear=Zw;Ml.prototype.delete=$w;Ml.prototype.get=eS;Ml.prototype.has=tS;Ml.prototype.set=rS;var Ad=Ml;function NO(i,e){return i&&qn(e,gl(e),i)}var nS=NO;function PO(i,e){return i&&qn(e,zi(e),i)}var iS=PO;var sS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oS=sS&&typeof module=="object"&&module&&!module.nodeType&&module,IO=oS&&oS.exports===sS,aS=IO?cr.Buffer:void 0,lS=aS?aS.allocUnsafe:void 0;function DO(i,e){if(e)return i.slice();var t=i.length,r=lS?lS(t):new i.constructor(t);return i.copy(r),r}var Td=DO;function RO(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 cS=RO;function OO(){return[]}var _d=OO;var BO=Object.prototype,FO=BO.propertyIsEnumerable,uS=Object.getOwnPropertySymbols,GO=uS?function(i){return i==null?[]:(i=Object(i),cS(uS(i),function(e){return FO.call(i,e)}))}:_d,Al=GO;function zO(i,e){return qn(i,Al(i),e)}var hS=zO;var UO=Object.getOwnPropertySymbols,kO=UO?function(i){for(var e=[];i;)wl(e,Al(i)),i=Sl(i);return e}:_d,Ed=kO;function VO(i,e){return qn(i,Ed(i),e)}var dS=VO;function HO(i,e,t){var r=e(i);return zr(i)?r:wl(r,t(i))}var Cd=HO;function jO(i){return Cd(i,gl,Al)}var fS=jO;function WO(i){return Cd(i,zi,Ed)}var Ld=WO;var JO=Sn(cr,"DataView"),Nd=JO;var qO=Sn(cr,"Promise"),Pd=qO;var XO=Sn(cr,"Set"),Id=XO;var pS="[object Map]",YO="[object Object]",mS="[object Promise]",gS="[object Set]",yS="[object WeakMap]",vS="[object DataView]",QO=ms(Nd),KO=ms(no),ZO=ms(Pd),$O=ms(Id),eB=ms(dd),Wo=Bn;(Nd&&Wo(new Nd(new ArrayBuffer(1)))!=vS||no&&Wo(new no)!=pS||Pd&&Wo(Pd.resolve())!=mS||Id&&Wo(new Id)!=gS||dd&&Wo(new dd)!=yS)&&(Wo=function(i){var e=Bn(i),t=e==YO?i.constructor:void 0,r=t?ms(t):"";if(r)switch(r){case QO:return vS;case KO:return pS;case ZO:return mS;case $O:return gS;case eB:return yS}return e});var Tl=Wo;var tB=Object.prototype,rB=tB.hasOwnProperty;function nB(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&rB.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var xS=nB;var iB=cr.Uint8Array,mg=iB;function sB(i){var e=new i.constructor(i.byteLength);return new mg(e).set(new mg(i)),e}var _l=sB;function oB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var bS=oB;var aB=/\w*$/;function lB(i){var e=new i.constructor(i.source,aB.exec(i));return e.lastIndex=i.lastIndex,e}var wS=lB;var SS=dn?dn.prototype:void 0,MS=SS?SS.valueOf:void 0;function cB(i){return MS?Object(MS.call(i)):{}}var AS=cB;function uB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=uB;var hB="[object Boolean]",dB="[object Date]",fB="[object Map]",pB="[object Number]",mB="[object RegExp]",gB="[object Set]",yB="[object String]",vB="[object Symbol]",xB="[object ArrayBuffer]",bB="[object DataView]",wB="[object Float32Array]",SB="[object Float64Array]",MB="[object Int8Array]",AB="[object Int16Array]",TB="[object Int32Array]",_B="[object Uint8Array]",EB="[object Uint8ClampedArray]",CB="[object Uint16Array]",LB="[object Uint32Array]";function NB(i,e,t){var r=i.constructor;switch(e){case xB:return _l(i);case hB:case dB:return new r(+i);case bB:return bS(i,t);case wB:case SB:case MB:case AB:case TB:case _B:case EB:case CB:case LB:return Dd(i,t);case fB:return new r;case pB:case yB:return new r(i);case mB:return wS(i);case gB:return new r;case vB:return AS(i)}}var TS=NB;function PB(i){return typeof i.constructor=="function"&&!fl(i)?$b(Sl(i)):{}}var Rd=PB;var IB="[object Map]";function DB(i){return Zr(i)&&Tl(i)==IB}var _S=DB;var ES=gs&&gs.isMap,RB=ES?ml(ES):_S,CS=RB;var OB="[object Set]";function BB(i){return Zr(i)&&Tl(i)==OB}var LS=BB;var NS=gs&&gs.isSet,FB=NS?ml(NS):LS,PS=FB;var GB=1,zB=2,UB=4,IS="[object Arguments]",kB="[object Array]",VB="[object Boolean]",HB="[object Date]",jB="[object Error]",DS="[object Function]",WB="[object GeneratorFunction]",JB="[object Map]",qB="[object Number]",RS="[object Object]",XB="[object RegExp]",YB="[object Set]",QB="[object String]",KB="[object Symbol]",ZB="[object WeakMap]",$B="[object ArrayBuffer]",e3="[object DataView]",t3="[object Float32Array]",r3="[object Float64Array]",n3="[object Int8Array]",i3="[object Int16Array]",s3="[object Int32Array]",o3="[object Uint8Array]",a3="[object Uint8ClampedArray]",l3="[object Uint16Array]",c3="[object Uint32Array]",Vt={};Vt[IS]=Vt[kB]=Vt[$B]=Vt[e3]=Vt[VB]=Vt[HB]=Vt[t3]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[s3]=Vt[JB]=Vt[qB]=Vt[RS]=Vt[XB]=Vt[YB]=Vt[QB]=Vt[KB]=Vt[o3]=Vt[a3]=Vt[l3]=Vt[c3]=!0;Vt[jB]=Vt[DS]=Vt[ZB]=!1;function Od(i,e,t,r,n,s){var o,a=e&GB,l=e&zB,c=e&UB;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!mr(i))return i;var u=zr(i);if(u){if(o=xS(i),!a)return fd(i,o)}else{var d=Tl(i),h=d==DS||d==WB;if(pl(i))return Td(i,a);if(d==RS||d==IS||h&&!n){if(o=l||h?{}:Rd(i),!a)return l?dS(i,iS(o,i)):hS(i,nS(o,i))}else{if(!Vt[d])return n?i:{};o=TS(i,d,a)}}s||(s=new Ad);var p=s.get(i);if(p)return p;s.set(i,o),PS(i)?i.forEach(function(v){o.add(Od(v,e,t,v,i,s))}):CS(i)&&i.forEach(function(v,y){o.set(y,Od(v,e,t,y,i,s))});var f=c?l?Ld:fS:l?zi:gl,g=u?void 0:f(i);return iw(g||i,function(v,y){g&&(y=v,v=i[y]),gd(o,y,Od(v,e,t,y,i,s))}),o}var Bd=Od;var u3=1,h3=4;function d3(i){return Bd(i,u3|h3)}var gg=d3;function f3(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 OS=f3;var p3=OS(),BS=p3;var m3=function(){return cr.Date.now()},Fd=m3;var g3="Expected a function",y3=Math.max,v3=Math.min;function x3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,d=!1,h=!0;if(typeof i!="function")throw new TypeError(g3);e=ug(e)||0,mr(t)&&(u=!!t.leading,d="maxWait"in t,s=d?y3(ug(t.maxWait)||0,e):s,h="trailing"in t?!!t.trailing:h);function p(T){var S=r,M=n;return r=n=void 0,c=T,o=i.apply(M,S),o}function f(T){return c=T,a=setTimeout(y,e),u?p(T):o}function g(T){var S=T-l,M=T-c,E=e-S;return d?v3(E,s-M):E}function v(T){var S=T-l,M=T-c;return l===void 0||S>=e||S<0||d&&M>=s}function y(){var T=Fd();if(v(T))return m(T);a=setTimeout(y,g(T))}function m(T){return a=void 0,h&&r?p(T):(r=n=void 0,o)}function x(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:m(Fd())}function w(){var T=Fd(),S=v(T);if(r=arguments,n=this,l=T,S){if(a===void 0)return f(l);if(d)return clearTimeout(a),a=setTimeout(y,e),p(l)}return a===void 0&&(a=setTimeout(y,e)),o}return w.cancel=x,w.flush=b,w}var qc=x3;function b3(i,e,t){(t!==void 0&&!$s(i[e],t)||t===void 0&&!(e in i))&&dl(i,e,t)}var Xc=b3;function w3(i){return Zr(i)&&eo(i)}var FS=w3;function S3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Yc=S3;function M3(i){return qn(i,zi(i))}var GS=M3;function A3(i,e,t,r,n,s,o){var a=Yc(i,t),l=Yc(e,t),c=o.get(l);if(c){Xc(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,d=u===void 0;if(d){var h=zr(l),p=!h&&pl(l),f=!h&&!p&&xd(l);u=l,h||p||f?zr(a)?u=a:FS(a)?u=fd(a):p?(d=!1,u=Td(l,!0)):f?(d=!1,u=Dd(l,!0)):u=[]:Md(l)||jo(l)?(u=a,jo(a)?u=GS(a):(!mr(a)||ul(a))&&(u=Rd(l))):d=!1}d&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Xc(i,t,u)}var zS=A3;function US(i,e,t,r,n){i!==e&&BS(e,function(s,o){if(n||(n=new Ad),mr(s))zS(i,e,o,t,US,r,n);else{var a=r?r(Yc(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Xc(i,o,a)}},zi)}var kS=US;function T3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var VS=T3;function _3(i,e){return e.length<2?i:Hw(i,Kw(e,0,-1))}var HS=_3;var E3=lw(function(i,e,t){kS(i,e,t)}),Jo=E3;function C3(i,e){return e=bl(e,i),i=HS(i,e),i==null||delete i[Sd(VS(e))]}var jS=C3;function L3(i){return Md(i)?void 0:i}var WS=L3;var N3=1,P3=2,I3=4,D3=Yw(function(i,e){var t={};if(i==null)return t;var r=!1;e=cd(e,function(s){return s=bl(s,i),r||(r=s.length>1),s}),qn(i,Ld(i),t),r&&(t=Bd(t,N3|P3|I3,WS));for(var n=e.length;n--;)jS(t,e[n]);return t}),El=D3;var so;(function(t){t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(so||(so={}));var qo;(function(n){n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:5e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-5e5,zoom:1},up:n.DefaultUp,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(qo||(qo={}));var Cl;(function(r){r.x="x",r.y="y",r.z="z"})(Cl||(Cl={}));var JS;(function(s){s.Top="top",s.Right="right",s.Bottom="bottom",s.Left="left",s.Center="center"})(JS||(JS={}));var Ll;(function(r){function i(n,s){return n[0]===s[0]&&n[1]===s[1]&&n[2]===s[2]}r.isEqual=i;function e(n,s){return[n[0]+s[0],n[1]+s[1],n[2]+s[2]]}r.add=e;function t(n,s){return[n[0]-s[0],n[1]-s[1],n[2]-s[2]]}r.sub=t})(Ll||(Ll={}));var oo;(function(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 d=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])*d,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*d,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*d}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})(oo||(oo={}));var Ur;(function(a){a.white={r:1,g:1,b:1},a.red={r:1,g:0,b:0},a.black={r:0,g:0,b:0};function r(l){return{r:Math.round(l.r*255),g:Math.round(l.g*255),b:Math.round(l.b*255),a:1}}a.toRgb255a1=r;function n(l){return{r:l.r,g:l.g,b:l.b}}a.clone=n;function s(l){return l=Math.floor(l),{r:(l>>16&255)/255,g:(l>>8&255)/255,b:(l&255)/255}}a.fromHex=s;function o(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b}a.equals=o})(Ur||(Ur={}));var Ui;(function(s){s.white=xe(re({},Ur.white),{a:1});function e(o){return{r:o[0],g:o[1],b:o[2],a:o[3]}}s.from0to1=e;function t(o,a){return xe(re({},Ur.fromHex(o)),{a})}s.fromHexAndA=t;function r(o){return{r:Math.round(o.r*255),g:Math.round(o.g*255),b:Math.round(o.b*255),a:o.a}}s.toRgb255a1=r;function n(o,a){return Ur.equals(o,a)&&o.a===a.a}s.equals=n})(Ui||(Ui={}));var Gd;(function(e){e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}})(Gd||(Gd={}));var qS;(function(x){x[x.SKIP=0]="SKIP",x[x.ADD=1]="ADD",x[x.ALPHA=2]="ALPHA",x[x.AVERAGE=3]="AVERAGE",x[x.COLOR_BURN=4]="COLOR_BURN",x[x.COLOR_DODGE=5]="COLOR_DODGE",x[x.DARKEN=6]="DARKEN",x[x.DIFFERENCE=7]="DIFFERENCE",x[x.EXCLUSION=8]="EXCLUSION",x[x.LIGHTEN=9]="LIGHTEN",x[x.MULTIPLY=10]="MULTIPLY",x[x.DIVIDE=11]="DIVIDE",x[x.NEGATION=12]="NEGATION",x[x.NORMAL=13]="NORMAL",x[x.OVERLAY=14]="OVERLAY",x[x.REFLECT=15]="REFLECT",x[x.SCREEN=16]="SCREEN",x[x.SOFT_LIGHT=17]="SOFT_LIGHT",x[x.SUBTRACT=18]="SUBTRACT"})(qS||(qS={}));var Qc;(function(a){a[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING"})(Qc||(Qc={}));var XS;(function(e){e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}})(XS||(XS={}));var YS;(function(e){e.defaultData={control1:[.5,.05],control2:[.1,.3]}})(YS||(YS={}));var zd;(function(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:Cl.y,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[0,0,0],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})(zd||(zd={}));var vs;(function(e){e[e.Update=0]="Update"})(vs||(vs={}));var Xn;(function(r){r[r.Add=1]="Add",r[r.Delete=2]="Delete",r[r.Unlink=3]="Unlink"})(Xn||(Xn={}));var Fn;(function(r){r[r.Add=4]="Add",r[r.Delete=5]="Delete",r[r.Move=6]="Move"})(Fn||(Fn={}));var Mn;(function(r){r[r.Add=7]="Add",r[r.Delete=8]="Delete",r[r.Move=9]="Move"})(Mn||(Mn={}));var gi=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=xe(re({},r),{[e]:t});return Object.setPrototypeOf(s,gi.prototype),s}}add(e,t){var n;let r=this.runOp({type:Xn.Add,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===Xn.Add){let r=t[e.id],n;r===void 0?n={type:Xn.Delete,id:e.id}:n={type:Xn.Add,id:e.id,data:r};let{id:s,data:o}=e,a=xe(re({},t),{[s]:o});return Object.setPrototypeOf(a,gi.prototype),{data:a,actual:e,reverse:n}}else if(e.type===Xn.Delete){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=re({},t);return Object.setPrototypeOf(s,gi.prototype),delete s[r],{data:s,actual:e,reverse:{type:Xn.Add,id:r,data:n}}}}throw new Error("illegal arg")}};function Kc(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"&&Kc(r)}return Object.freeze(i)}function QS(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 yg=class extends Error{};function ki(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 KS(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 ZS(){return typeof process!="undefined"}function $S(i,e){for(let t of i)e(t.id,t.data),$S(t.children,e)}function eM(i,e){e(i.id,i.data);for(let t of i.children)eM(t,e)}var yi=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,yi.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Kc(this[e]),e++}fillCaches0(e,t){var r;if((r=this.objCaches)==null?void 0:r.has(e.id))throw new Error("duplicated item");this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let n of e.children)this.fillCaches0(n,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}isDescendantOf(e,t){for(;e;){let r=this.parent(e);if(r===t)return!0;e=r}return!1}data(e){var t;return(t=this.get(e))==null?void 0:t.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){var t;return e===null?this:(t=this.get(e))==null?void 0:t.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let r=this.get(e);r&&eM(r,t)}}traverse(e){$S(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this.parent(e),s=this.childrenArray(n),o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=xe(re({},a),{data:t}),this.modifyArrayBy(n,s)}}modifyArrayBy(e,t){let r=e,n=t;for(;r!==null;){let o=n,a=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(c=>c.id===a);if(l<0)throw new Error;n=[...n],n[l]=xe(re({},n[l]),{children:o})}Object.setPrototypeOf(n,yi.prototype);let s=n;return s.fillCaches(),s}runOp(e){switch(e.type){case Mn.Add:return this.addOp(e);case Mn.Delete:return this.deleteOp(e);case Mn.Move:return this.moveOp(e)}}addOp(e){let{parent:t,fi:r,id:n,data:s,children:o}=e;if(t!==null&&this.get(t)===void 0)return null;if(this.get(n)!==void 0)return null;{let a=t,l=this.childrenArray(a),c={fi:r,id:n,data:s,children:o};return l=[...l,c],l.sort((d,h)=>d.fi-h.fi),e.localIndex=l.indexOf(c),{data:this.modifyArrayBy(a,l),actual:e,reverse:{type:Mn.Delete,id:n}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let r=this.parent(t);if(r===void 0)return null;let n=this.childrenArray(r),s=n.findIndex(l=>l.id===t);e.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(r,n),actual:e,reverse:xe(re({type:Mn.Add},o),{parent:r})}}}moveOp(e){let{parent:t,fi:r,id:n}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:Mn.Delete,id:n});if(t!==null){let h=t;for(;h!==null;){if(h===void 0)throw new Error;if(h===n)throw new yg("cyclic tree");h=this.parent(h)}}let s=this.parent(n);if(s===void 0)return null;let o=s,a=this.childrenArray(s),l=a.findIndex(h=>h.id===n);a=[...a];let c=a.splice(l,1)[0],u=this.modifyArrayBy(s,a);s=t,a=u.childrenArray(s);let d=c.fi;return c=xe(re({},c),{fi:r}),a=[...a,c],a.sort((h,p)=>h.fi-p.fi),e.localIndex=a.indexOf(c),u=u.modifyArrayBy(s,a),{data:u,actual:e,reverse:{type:Mn.Move,parent:o,fi:d,id:n}}}previous(e,t){if(t===null){let n=this.childrenArray(e);return n.length===0?null:n[n.length-1].id}let r=null;for(let n of this.childrenArray(e)){if(n.id===t)return r;r=n.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)+1;if(n<r.length)return r[n].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)-1;return n>=0?this.traverseSortPrevious(r[n].id):t}}getAllSorted(e){let t=[];for(let r of e){let n=this.getWithSortKey(r.id);n!==void 0&&t.push(re(re({},r),n))}t.sort((r,n)=>QS(r.sortKey,n.sortKey));for(let r of t)delete r.sortKey;return t}getWithSortKey(e){var t=e;let r=[],n=this.get(t),s=n;if(n!==void 0){for(;t;)r.splice(0,0,n.fi),t=this.parent(t),t!==null&&(n=this.get(t));return xe(re({},s),{sortKey:r})}}insertBeforeHelper(e,t,r){return this.insertAfterHelper(e,this.previous(e,t),r)}insertAfterHelper(e,t,r){let n=this.childrenArray(e);if(t===null){if(n.length===0)return ki(0,r,r);{let s=n[0].fi;return ki(s-r,s,r)}}else{let s=this.get(t);if(s===void 0||this.parent(t)!==e)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 ki(a,a+r,r)}else return ki(s.fi,o.fi,r)}}};var Ud;(function(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:vs.Update,props:s}}:null}else{let n=r.props,s={},o=re({},t),a=!1;if(n)for(let l of Object.keys(n))s[l]=o[l],o[l]=n[l],a=!0;return a?{data:o,actual:r,reverse:{type:vs.Update,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var ur=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,ur.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Kc(this[e]),e++}fillCaches0(e){var t;if((t=this.objCaches)==null?void 0:t.has(e.id))throw new Error("duplicated item");this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){var t;return(t=this.get(e))==null?void 0:t.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this,s=n.findIndex(l=>l.id===e);if(s<0)throw new Error("not expected");let o=n[s];return n=[...n],n[s]=xe(re({},o),{data:t}),this.modifyArrayBy(n)}}modifyArrayBy(e){Object.setPrototypeOf(e,ur.prototype);let t=e;return ZS()||t.fillCaches(),t}runOp(e){switch(e.type){case Fn.Add:return this.addOp(e);case Fn.Delete:return this.deleteOp(e);case Fn.Move:return this.moveOp(e)}}addOp(e){let{fi:t,id:r,data:n}=e,s=this,o={fi:t,id:r,data:n};return s=[...s,o],s.sort((l,c)=>l.fi-c.fi),e.localIndex=s.indexOf(o),{data:this.modifyArrayBy(s),actual:e,reverse:{type:Fn.Delete,id:r}}}deleteOp(e){let{id:t}=e,r=this,n=r.findIndex(a=>a.id===t);if(n===-1)return null;e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:re({type:Fn.Add},s)}}moveOp(e){let{fi:t,id:r}=e,n=this;n=[...n];let s=n.findIndex(c=>c.id===r);if(s===-1)return null;let o=n[s].fi,a=xe(re({},n[s]),{fi:t});return n[s]=a,n.sort((c,u)=>c.fi-u.fi),e.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:e,reverse:{type:Fn.Move,fi:o,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let r of this){if(r.id===e)return t;t=r.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let r=this;if(e===null){if(r.length===0)return ki(0,t,t);{let n=r[0].fi;return ki(n-t,n,t)}}else{let n=this.get(e);if(n===void 0)throw new Error("illegal args");let s=r.find(o=>o.fi>n.fi);if(s===void 0){let o=r[r.length-1].fi;return ki(o,o+t,t)}else return ki(n.fi,s.fi,t)}}};var tM=Symbol(),kd=Symbol(),Zc=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof xg);){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[kd];r&&r(),delete this._children[e]}}}},rM=class extends Zc{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=xe(re({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},nM=class extends Zc{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){this._current=xe(re({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,gi.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},iM={get(i,e){if(e===kd)return()=>{i._parent=null};if(e===tM)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=Vd(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]}}},R3=xe(re({},iM),{set(i,e,t){var n;let r;if(t===void 0)throw new Error("set to undefined is not supported!");return r={type:vs.Update,props:{[e]:(n=F3(t))!=null?n:t}},i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){throw new Error("set to undefined is not supported!")}}),O3=xe(re({},iM),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:Xn.Add,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:Xn.Delete,id:e}),!0}}),$c=class extends Zc{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[kd]=()=>{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)}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=Vd(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:Mn.Add,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:Mn.Move,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:Mn.Delete,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},eu=class extends Zc{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[kd]=()=>{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 xe(re({},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=Vd(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:Fn.Add,fi:e,id:t,data:r})}move(e,t){this.runOp({type:Fn.Move,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:Fn.Delete,id:e})}};function vg(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===vs.Update&&e.type===vs.Update&&Hd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(xe(re({},e),{path:t}))}var xg=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){vg(this.ts,t,e),vg(this.actual,r,e),vg(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Vd(i,e,t){return t instanceof yi?new $c(i,e,t):t instanceof ur?new eu(i,e,t):t instanceof gi?new Proxy(new nM(i,e,t),O3):t!==null&&typeof t=="object"?KS(t)?t:new Proxy(new rM(i,e,t),R3):t}function B3(i){let e=new xg(i);return[Vd(e,"",i),e]}function bg(i,e){let[t,r]=B3(i);return e(t),r.result()}function F3(i){return i instanceof $c||i instanceof eu?i._current:i!==null&&typeof i=="object"?i[tM]:i}var Hd;(function(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=re({},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 yi||n instanceof $c)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof ur||n instanceof eu)&&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})(Hd||(Hd={}));var wg=class{},jd=class extends wg{constructor(e){super();this.id=e}},Wd=class extends wg{constructor(e){super();this.data=e}};"use strict";var Sg;try{Sg=new TextDecoder}catch(i){}var Pe,ao,Z=0;var sM=[],Mg=sM,Ag=0,An={},bt,lo,Yn=0,Vi=0,Gn,xs,fn=[],Et,oM={useRecords:!1,mapsAsObjects:!0},Jd=class{},Tg=new Jd;Tg.name="MessagePack 0xC1";var Nl=!1,bs=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(Pe)return yM(()=>(Yd(),this?this.unpack(e,t):bs.prototype.unpack.call(oM,e,t)));ao=t>-1?t:e.length,Z=0,Ag=0,Vi=0,lo=null,Mg=sM,Gn=null,Pe=e;try{Et=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Pe=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 bs){if(An=this,this.structures)return bt=this.structures,qd();(!bt||bt.length>0)&&(bt=[])}else An=oM,(!bt||bt.length>0)&&(bt=[]);return qd()}unpackMultiple(e,t){let r,n=0;try{Nl=!0;let s=e.length,o=this?this.unpack(e,s):Kd.unpack(e,s);if(t){for(t(o);Z<s;)if(n=Z,t(qd())===!1)return}else{for(r=[o];Z<s;)n=Z,r.push(qd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Nl=!1,Yd()}}_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 qd(){try{if(!An.trusted&&!Nl){let e=bt.sharedLength||0;e<bt.length&&(bt.length=e)}let i=hr();if(Z==ao)bt.restoreStructures&&aM(),bt=null,Pe=null,xs&&(xs=null);else if(Z>ao){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Nl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw bt.restoreStructures&&aM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function aM(){for(let i in bt.restoreStructures)bt[i]=bt.restoreStructures[i];bt.restoreStructures=null}function hr(){let i=Pe[Z++];if(i<160)if(i<128){if(i<64)return i;{let e=bt[i&63]||An.getStructures&&cM()[i&63];return e?(e.read||(e.read=_g(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[pM()]=hr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(hr(),hr());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}else if(i<192){let e=i-160;if(Vi>=Z)return lo.slice(Z-Yn,(Z+=e)-Yn);if(Vi==0&&ao<140){let t=e<16?Cg(e):dM(e);if(t!=null)return t}return Eg(e)}else{let e;switch(i){case 192:return null;case 193:return Gn?(e=hr(),e>0?Gn[1].slice(Gn.position1,Gn.position1+=e):Gn[0].slice(Gn.position0,Gn.position0-=e)):Tg;case 194:return!1;case 195:return!0;case 196:return Lg(Pe[Z++]);case 197:return e=Et.getUint16(Z),Z+=2,Lg(e);case 198:return e=Et.getUint32(Z),Z+=4,Lg(e);case 199:return Xo(Pe[Z++]);case 200:return e=Et.getUint16(Z),Z+=2,Xo(e);case 201:return e=Et.getUint32(Z),Z+=4,Xo(e);case 202:if(e=Et.getFloat32(Z),An.useFloat32>2){let t=Qd[(Pe[Z]&127)<<1|Pe[Z+1]>>7];return Z+=4,(t*e+(e>0?.5:-.5)>>0)/t}return Z+=4,e;case 203:return e=Et.getFloat64(Z),Z+=8,e;case 204:return Pe[Z++];case 205:return e=Et.getUint16(Z),Z+=2,e;case 206:return e=Et.getUint32(Z),Z+=4,e;case 207:return An.int64AsNumber?(e=Et.getUint32(Z)*4294967296,e+=Et.getUint32(Z+4)):e=Et.getBigUint64(Z),Z+=8,e;case 208:return Et.getInt8(Z++);case 209:return e=Et.getInt16(Z),Z+=2,e;case 210:return e=Et.getInt32(Z),Z+=4,e;case 211:return An.int64AsNumber?(e=Et.getInt32(Z)*4294967296,e+=Et.getUint32(Z+4)):e=Et.getBigInt64(Z),Z+=8,e;case 212:if(e=Pe[Z++],e==114)return mM(Pe[Z++]&63);{let t=fn[e];if(t)return t.read?(Z++,t.read(hr())):t.noBuffer?(Z++,t()):t(Pe.subarray(Z,++Z));throw new Error("Unknown extension "+e)}case 213:return e=Pe[Z],e==114?(Z++,mM(Pe[Z++]&63,Pe[Z++])):Xo(2);case 214:return Xo(4);case 215:return Xo(8);case 216:return Xo(16);case 217:return e=Pe[Z++],Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):z3(e);case 218:return e=Et.getUint16(Z),Z+=2,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):U3(e);case 219:return e=Et.getUint32(Z),Z+=4,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):k3(e);case 220:return e=Et.getUint16(Z),Z+=2,uM(e);case 221:return e=Et.getUint32(Z),Z+=4,uM(e);case 222:return e=Et.getUint16(Z),Z+=2,hM(e);case 223:return e=Et.getUint32(Z),Z+=4,hM(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 G3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function _g(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>G3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(hr);return i.highByte===0&&(i.read=lM(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=hr()}return r}return t.count=0,i.highByte===0?lM(e,t):t}var lM=(i,e)=>function(){let t=Pe[Z++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=bt[r]||cM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=_g(n,i)),n.read()};function cM(){let i=yM(()=>(Pe=null,An.getStructures()));return bt=An._mergeStructures(i,bt)}var Eg=Xd,z3=Xd,U3=Xd,k3=Xd;function Xd(i){let e;if(i<16&&(e=Cg(i)))return e;if(i>64&&Sg)return Sg.decode(Pe.subarray(Z,Z+=i));let t=Z+i,r=[];for(e="";Z<t;){let n=Pe[Z++];if((n&128)==0)r.push(n);else if((n&224)==192){let s=Pe[Z++]&63;r.push((n&31)<<6|s)}else if((n&240)==224){let s=Pe[Z++]&63,o=Pe[Z++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)==240){let s=Pe[Z++]&63,o=Pe[Z++]&63,a=Pe[Z++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Ir.apply(String,r),r.length=0)}return r.length>0&&(e+=Ir.apply(String,r)),e}function uM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}function hM(i){if(An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[pM()]=hr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(hr(),hr());return e}}var Ir=String.fromCharCode;function dM(i){let e=Z,t=new Array(i);for(let r=0;r<i;r++){let n=Pe[Z++];if((n&128)>0){Z=e;return}t[r]=n}return Ir.apply(String,t)}function Cg(i){if(i<4)if(i<2){if(i===0)return"";{let e=Pe[Z++];if((e&128)>1){Z-=1;return}return Ir(e)}}else{let e=Pe[Z++],t=Pe[Z++];if((e&128)>0||(t&128)>0){Z-=2;return}if(i<3)return Ir(e,t);let r=Pe[Z++];if((r&128)>0){Z-=3;return}return Ir(e,t,r)}else{let e=Pe[Z++],t=Pe[Z++],r=Pe[Z++],n=Pe[Z++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){Z-=4;return}if(i<6){if(i===4)return Ir(e,t,r,n);{let s=Pe[Z++];if((s&128)>0){Z-=5;return}return Ir(e,t,r,n,s)}}else if(i<8){let s=Pe[Z++],o=Pe[Z++];if((s&128)>0||(o&128)>0){Z-=6;return}if(i<7)return Ir(e,t,r,n,s,o);let a=Pe[Z++];if((a&128)>0){Z-=7;return}return Ir(e,t,r,n,s,o,a)}else{let s=Pe[Z++],o=Pe[Z++],a=Pe[Z++],l=Pe[Z++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){Z-=8;return}if(i<10){if(i===8)return Ir(e,t,r,n,s,o,a,l);{let c=Pe[Z++];if((c&128)>0){Z-=9;return}return Ir(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Pe[Z++],u=Pe[Z++];if((c&128)>0||(u&128)>0){Z-=10;return}if(i<11)return Ir(e,t,r,n,s,o,a,l,c,u);let d=Pe[Z++];if((d&128)>0){Z-=11;return}return Ir(e,t,r,n,s,o,a,l,c,u,d)}else{let c=Pe[Z++],u=Pe[Z++],d=Pe[Z++],h=Pe[Z++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){Z-=12;return}if(i<14){if(i===12)return Ir(e,t,r,n,s,o,a,l,c,u,d,h);{let p=Pe[Z++];if((p&128)>0){Z-=13;return}return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p)}}else{let p=Pe[Z++],f=Pe[Z++];if((p&128)>0||(f&128)>0){Z-=14;return}if(i<15)return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p,f);let g=Pe[Z++];if((g&128)>0){Z-=15;return}return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p,f,g)}}}}}function Lg(i){return An.copyBuffers?Uint8Array.prototype.slice.call(Pe,Z,Z+=i):Pe.subarray(Z,Z+=i)}function Xo(i){let e=Pe[Z++];if(fn[e])return fn[e](Pe.subarray(Z,Z+=i));throw new Error("Unknown extension type "+e)}var fM=new Array(4096);function pM(){let i=Pe[Z++];if(i>=160&&i<192){if(i=i-160,Vi>=Z)return lo.slice(Z-Yn,(Z+=i)-Yn);if(!(Vi==0&&ao<180))return Eg(i)}else return Z--,hr();let e=(i<<5^(i>1?Et.getUint16(Z):i>0?Pe[Z]:0))&4095,t=fM[e],r=Z,n=Z+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Et.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Pe[r++],s!=t[o++]){r=1879048192;break}if(r===n)return Z=r,t.string;n-=3,r=Z}for(t=[],fM[e]=t,t.bytes=i;r<n;)s=Et.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Pe[r++],t.push(s);let a=i<16?Cg(i):dM(i);return a!=null?t.string=a:t.string=Eg(i)}var mM=(i,e)=>{var t=hr();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=bt[i];return n&&n.isShared&&((bt.restoreStructures||(bt.restoreStructures=[]))[i]=n),bt[i]=t,t.read=_g(t,r),t.read()},gM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=hr();return(gM[i[0]]||Error)(i[1])};fn[105]=i=>{let e=Et.getUint32(Z-4);xs||(xs=new Map);let t=Pe[Z],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};xs.set(e,n);let s=hr();return n.used?Object.assign(r,s):(n.target=s,s)};fn[112]=i=>{let e=Et.getUint32(Z-4),t=xs.get(e);return t.used=!0,t.target};fn[115]=()=>new Set(hr());var Ng=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");fn[116]=i=>{let e=i[0],t=Ng[e];if(!t)throw new Error("Could not find typed array for code "+e);return new gM[t](Uint8Array.prototype.slice.call(i,1).buffer)};fn[120]=()=>{let i=hr();return new RegExp(i[0],i[1])};fn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=Z;Z+=e-4,Gn=[hr(),hr()],Gn.position0=0,Gn.position1=0;let r=Z;Z=t;try{return hr()}finally{Z=r}};fn[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 yM(i){let e=ao,t=Z,r=Ag,n=Yn,s=Vi,o=lo,a=Mg,l=xs,c=Gn,u=new Uint8Array(Pe.slice(0,ao)),d=bt,h=bt.slice(0,bt.length),p=An,f=Nl,g=i();return ao=e,Z=t,Ag=r,Yn=n,Vi=s,lo=o,Mg=a,xs=l,Gn=c,Pe=u,Nl=f,bt=d,bt.splice(0,bt.length,...h),An=p,Et=new DataView(Pe.buffer,Pe.byteOffset,Pe.byteLength),g}function Yd(){Pe=null,xs=null,bt=null}function vM(i){i.unpack?fn[i.type]=i.unpack:fn[i.type]=i}var Qd=new Array(147);for(let i=0;i<256;i++)Qd[i]=+("1e"+Math.floor(45.15-i*.30103));var Kd=new bs({useRecords:!1}),V3=Kd.unpack,H3=Kd.unpackMultiple,j3=Kd.unpack;var W3=new Float32Array(1),E6=new Uint8Array(W3.buffer,0,4);"use strict";var Zd;try{Zd=new TextEncoder}catch(i){}var $d,Pg,ef=typeof Buffer!="undefined",Ig=ef?Buffer.allocUnsafeSlow:Uint8Array,bM=ef?Buffer:Uint8Array,wM=ef?4294967296:2144337920,de,gr,ae=0,Hi,ji=null,J3=/[\u0080-\uFFFF]/,tu=Symbol("record-id"),Pl=class extends bs{constructor(e){super(e);this.offset=0;let t,r,n,s,o,a,l=0,c=bM.prototype.utf8Write?function(M,E,C){return de.utf8Write(M,E,C)}:Zd&&Zd.encodeInto?function(M,E){return Zd.encodeInto(M,de.subarray(E)).written}:!1,u=this;e||(e={});let d=e&&e.sequential,h=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=h?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");let f=e.maxOwnStructures;f==null&&(f=h?32:64),d&&!e.saveStructures&&(this.structures=[]);let g=p>32||f+p>64,v=p+64,y=p+f+64;if(y>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let m=[],x=0,b=0;this.pack=this.encode=function(M,E){if(de||(de=new Ig(8192),gr=new DataView(de.buffer,0,8192),ae=0),Hi=de.length-10,Hi-ae<2048?(de=new Ig(de.length),gr=new DataView(de.buffer,0,de.length),Hi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=u.structuredClone?new Map:null,u.bundleStrings?(ji=["",""],de[ae++]=214,de[ae++]=98,ji.position=ae-r,ae+=4):ji=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let C=n.sharedLength||0;if(C>p)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 _=0;_<C;_++){let O=n[_];if(!O)continue;let P,D=n.transitions;for(let G=0,R=O.length;G<R;G++){let U=O[G];P=D[U],P||(P=D[U]=Object.create(null)),D=P}D[tu]=_+64}l=C}d||(n.nextId=C+64)}s&&(s=!1),o=n||[];try{if(w(M),ji){gr.setUint32(ji.position+r,ae-ji.position-r);let C=ji;ji=null,w(C[0]),w(C[1])}if(u.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Hi&&S(ae),u.offset=ae;let C=X3(de.subarray(r,ae),a.idsToInsert);return a=null,C}return E&TM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,x>1e4)n.transitions=null,b=0,x=0,m.length>0&&(m=[]);else if(m.length>0&&!d){for(let C=0,_=m.length;C<_;C++)m[C][tu]=0;m=[]}if(s&&u.saveStructures){let C=n.sharedLength||p;n.length>C&&(n=n.slice(0,C));let _=de.subarray(r,ae);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(M)):(l=C,_)}}E&K3&&(ae=r)}};let w=M=>{ae>Hi&&(de=S(ae));var E=typeof M,C;if(E==="string"){let _=M.length;if(ji&&_>=8&&_<4096){let D=J3.test(M);ji[D?0:1]+=M,de[ae++]=193,w(D?-_:_);return}let O;_<32?O=1:_<256?O=2:_<65536?O=3:O=5;let P=_*3;if(ae+P>Hi&&(de=S(ae+P)),_<64||!c){let D,G,R,U=ae+O;for(D=0;D<_;D++)G=M.charCodeAt(D),G<128?de[U++]=G:G<2048?(de[U++]=G>>6|192,de[U++]=G&63|128):(G&64512)==55296&&((R=M.charCodeAt(D+1))&64512)==56320?(G=65536+((G&1023)<<10)+(R&1023),D++,de[U++]=G>>18|240,de[U++]=G>>12&63|128,de[U++]=G>>6&63|128,de[U++]=G&63|128):(de[U++]=G>>12|224,de[U++]=G>>6&63|128,de[U++]=G&63|128);C=U-ae-O}else C=c(M,ae+O,P);C<32?de[ae++]=160|C:C<256?(O<2&&de.copyWithin(ae+2,ae+1,ae+1+C),de[ae++]=217,de[ae++]=C):C<65536?(O<3&&de.copyWithin(ae+3,ae+2,ae+2+C),de[ae++]=218,de[ae++]=C>>8,de[ae++]=C&255):(O<5&&de.copyWithin(ae+5,ae+3,ae+3+C),de[ae++]=219,gr.setUint32(ae,C),ae+=4),ae+=C}else if(E==="number")if(M>>>0===M)M<64?de[ae++]=M:M<256?(de[ae++]=204,de[ae++]=M):M<65536?(de[ae++]=205,de[ae++]=M>>8,de[ae++]=M&255):(de[ae++]=206,gr.setUint32(ae,M),ae+=4);else if(M>>0===M)M>=-32?de[ae++]=256+M:M>=-128?(de[ae++]=208,de[ae++]=M+256):M>=-32768?(de[ae++]=209,gr.setInt16(ae,M),ae+=2):(de[ae++]=210,gr.setInt32(ae,M),ae+=4);else{let _;if((_=this.useFloat32)>0&&M<4294967296&&M>=-2147483648){de[ae++]=202,gr.setFloat32(ae,M);let O;if(_<4||(O=M*Qd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===O){ae+=4;return}else ae--}de[ae++]=203,gr.setFloat64(ae,M),ae+=8}else if(E==="object")if(!M)de[ae++]=192;else{if(a){let O=a.get(M);if(O){if(!O.id){let P=a.idsToInsert||(a.idsToInsert=[]);O.id=P.push(O)}de[ae++]=214,de[ae++]=112,gr.setUint32(ae,O.id),ae+=4;return}else a.set(M,{offset:ae-r})}let _=M.constructor;if(_===Object)T(M,!0);else if(_===Array){C=M.length,C<16?de[ae++]=144|C:C<65536?(de[ae++]=220,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=221,gr.setUint32(ae,C),ae+=4);for(let O=0;O<C;O++)w(M[O])}else if(_===Map){C=M.size,C<16?de[ae++]=128|C:C<65536?(de[ae++]=222,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=223,gr.setUint32(ae,C),ae+=4);for(let[O,P]of M)w(O),w(P)}else{for(let O=0,P=$d.length;O<P;O++){let D=Pg[O];if(M instanceof D){let G=$d[O];if(G.write){G.type&&(de[ae++]=212,de[ae++]=G.type,de[ae++]=0),w(G.write.call(this,M));return}let R=de,U=gr,te=ae;de=null;let he;try{he=G.pack.call(this,M,H=>(de=R,R=null,ae+=H,ae>Hi&&S(ae),{target:de,targetView:gr,position:ae-H}),w)}finally{R&&(de=R,gr=U,ae=te,Hi=de.length-10)}he&&(he.length+ae>Hi&&S(he.length+ae),ae=q3(he,de,ae,G.type));return}}T(M,!M.hasOwnProperty)}}else if(E==="boolean")de[ae++]=M?195:194;else if(E==="bigint"){if(M<BigInt(1)<<BigInt(63)&&M>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,gr.setBigInt64(ae,M);else if(M<BigInt(1)<<BigInt(64)&&M>0)de[ae++]=207,gr.setBigUint64(ae,M);else if(this.largeBigIntToFloat)de[ae++]=203,gr.setFloat64(ae,Number(M));else throw new RangeError(M+" 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")w(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?M=>{let E=Object.keys(M),C=E.length;C<16?de[ae++]=128|C:C<65536?(de[ae++]=222,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=223,gr.setUint32(ae,C),ae+=4);let _;for(let O=0;O<C;O++)w(_=E[O]),w(M[_])}:(M,E)=>{de[ae++]=222;let C=ae-r;ae+=2;let _=0;for(let O in M)(E||M.hasOwnProperty(O))&&(w(O),w(M[O]),_++);de[C+++r]=_>>8,de[C+r]=_&255}:M=>{let E=Object.keys(M),C,_=o.transitions||(o.transitions=Object.create(null)),O=0;for(let D=0,G=E.length;D<G;D++){let R=E[D];C=_[R],C||(C=_[R]=Object.create(null),O++),_=C}let P=_[tu];if(P)P>=96&&g?(de[ae++]=((P-=96)&31)+96,de[ae++]=P>>5):de[ae++]=P;else{P=o.nextId,P||(P=64),P<v&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(P=o.nextOwnId,P<y||(P=v),o.nextOwnId=P+1):(P>=y&&(P=v),o.nextId=P+1);let D=E.highByte=P>=96&&g?P-96>>5:-1;_[tu]=P,o[P-64]=E,P<v?(E.isShared=!0,o.sharedLength=P-63,s=!0,D>=0?(de[ae++]=(P&31)+96,de[ae++]=D):de[ae++]=P):(D>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(P&31)+96,de[ae++]=D):(de[ae++]=212,de[ae++]=114,de[ae++]=P),O&&(x+=b*O),m.length>=f&&(m.shift()[tu]=0),m.push(_),w(E))}for(let D=0,G=E.length;D<G;D++)w(M[E[D]])},S=M=>{let E;if(M>16777216){if(M-r>wM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(wM,Math.round(Math.max((M-r)*(M>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(M-r<<2,de.length-1)>>12)+1<<12;let C=new Ig(E);return gr=new DataView(C.buffer,0,E),de.copy?de.copy(C,0,r,M):C.set(de.slice(r,M)),ae-=r,r=0,Hi=C.length-10,de=C}}useBuffer(e){de=e,gr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Pg=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Jd];$d=[{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?SM(i,16,e):MM(ef?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==bM&&this.structuredClone?SM(i,Ng.indexOf(t.name),e):MM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function SM(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 MM(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 q3(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 X3(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 Yo(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)");Pg.unshift(i.Class),$d.unshift(i)}vM(i)}var AM=new Pl({useRecords:!1}),Y3=AM.pack,Q3=AM.pack;var TM=512,K3=1024;var _M=new Pl({structuredClone:!0});Yo({Class:gi.prototype.constructor,type:1,write(i){return re({},i)},read(i){return Object.setPrototypeOf(i,gi.prototype),i}});Yo({Class:ur.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ur.prototype),i}});Yo({Class:yi.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,yi.prototype),i}});Yo({Class:jd.prototype.constructor,type:4,write(i){return i.id},read(i){return new jd(i)}});Yo({Class:Wd.prototype.constructor,type:5,write(i){return i.data},read(i){return new Wd(i)}});function Z3(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 tf;(function(r){function i(n){return _M.pack(n)}r.serialize=i;function e(n){return _M.unpack(n)}r.deserialize=e;function t(n){return Z3(i(n)).toString()}r.checksum=t})(tf||(tf={}));var Il;(function(t){t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(Il||(Il={}));var rf;(function(t){function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ui.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ui.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:Ui.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(rf||(rf={}));var Dl;(function(r){r[r.Front=0]="Front",r[r.Back=1]="Back",r[r.Double=2]="Double"})(Dl||(Dl={}));var Dg;(function(t){t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Dg||(Dg={}));var Rg;(function(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})(Rg||(Rg={}));var nf;(function(e){e.defaultData=xe(re(re({},Rg.defaultData),Dg.defaultData),{cloner:null})})(nf||(nf={}));var pn;(function(n){n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify"})(pn||(pn={}));var ws;(function(r){r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom"})(ws||(ws={}));var co;(function(r){r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower"})(co||(co={}));var sf;(function(e){e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ui.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"}})(sf||(sf={}));var Ar;(function(n){n[n.Normal=0]="Normal",n[n.Multiply=1]="Multiply",n[n.Screen=2]="Screen",n[n.Overlay=3]="Overlay"})(Ar||(Ar={}));var of;(function(r){r[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar"})(of||(of={}));var af;(function(r){r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping"})(af||(af={}));var Og;(function(n){n[n.UV=0]="UV",n[n.Planar=1]="Planar",n[n.Spherical=2]="Spherical",n[n.Cylindrical=3]="Cylindrical"})(Og||(Og={}));var lf;(function(s){s[s.Simplex=0]="Simplex",s[s.SimplexFractal=1]="SimplexFractal",s[s.Ashima=2]="Ashima",s[s.Fbm=3]="Fbm",s[s.Perlin=4]="Perlin"})(lf||(lf={}));var Rl;(function(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:.2,g:.2,b:.2,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:[1,1],mode:0,axis:Cl.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:Ur.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:xe(re({},Ur.fromHex(6710886)),{a:1}),colorB:xe(re({},Ur.fromHex(6710886)),{a:1}),colorC:xe(re({},Ur.fromHex(16777215)),{a:1}),colorD:xe(re({},Ur.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:Ui.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}}}})(Rl||(Rl={}));var cf;(function(n){function i(){return{layers:new ur}}n.defaultEmptyData=i;function e(s="layer1",o="layer2"){return t("phong",s,o)}n.defaultData=e;function t(s,o="layer1",a="layer2"){let l=new ur;return l.push({fi:0,data:Rl.defaultData("light",s),id:o}),l.push({fi:1,data:Rl.defaultData("color"),id:a}),{layers:l}}n.defaultTwoLayerData=t;function r(s,o="basic",a="layer1",l="layer2"){let c=Rl.defaultData("texture");Object.assign(c.texture,{image:s});let u=new ur;return u.push({fi:0,data:c,id:a}),u.push({fi:1,data:Rl.defaultData("light",o),id:l}),{layers:u}}n.defaultTwoLayerTextureData=r})(cf||(cf={}));var uf;(function(r){function i(){return{points:new ur,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})(uf||(uf={}));var hf;(function(e){function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(hf||(hf={}));var df;(function(e){function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:uf.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(df||(df={}));var ru;(function(n){n.identity=xe(re({},Gd.identity),{hiddenMatrix:oo.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:Ll.isEqual(s.position,o.position)?null:o.position,rotation:Ll.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:Ll.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:oo.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(ru||(ru={}));var uo;(function(e){e.defaultData=re({states:new ur,events:new ur,visible:!0,raycastLock:!1},ru.identity)})(uo||(uo={}));var EM;(function(e){e.defaultData=re({type:"Empty"},uo.defaultData)})(EM||(EM={}));var Bg;(function(e){e.defaultData=re(re({type:"Mesh"},uo.defaultData),nf.defaultData)})(Bg||(Bg={}));var CM;(function(e){e.defaultData=re(re({type:"TextFrame"},uo.defaultData),sf.defaultData)})(CM||(CM={}));var ff;(function(e){e.defaultData=re(re(re({},uo.defaultData),ru.identity),qo.defaultData)})(ff||(ff={}));var LM;(function(e){function i(t){return re(re({},uo.defaultData),rf.defaultData(t))}e.defaultData=i})(LM||(LM={}));var NM;(function(t){t.defaultCamera=re({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:oo.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new ur,events:new ur},qo.defaultData),t.defaultMeshObject=xe(re(re({name:"Rectangle"},uo.defaultData),Bg.defaultData),{geometry:df.defaultData("RectangleGeometry"),material:cf.defaultTwoLayerData("basic","layer1","layer2")})})(NM||(NM={}));var nu;(function(t){function i(r,n){if(n===void 0)return r;let s=re({},r);return"material"in s&&"material"in n&&n.material&&(s.material=bg(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Jo(c,l)}}).data),s.materials&&n.materials&&(s.materials=bg(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[d,h]of Object.entries(u.layers)){let p=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(d);p&&Jo(p,h)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=re({},r);if(Object.assign(s,ru.merge(s,n)),so.is(r.type)){s.orthographic=re({},s.orthographic),s.perspective=re({},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=re({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(Il.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(s.color=Ur.clone(l.color))}return s}t.patch=e})(nu||(nu={}));var kr;(function(n){n[n.DEFAULT=0]="DEFAULT",n[n.VERTICAL=1]="VERTICAL",n[n.HORIZONTAL=2]="HORIZONTAL",n[n.BOTH=3]="BOTH"})(kr||(kr={}));var Wi;(function(r){r[r.OFF=0]="OFF",r[r.ROTATE=1]="ROTATE",r[r.PAN=2]="PAN"})(Wi||(Wi={}));var zn;(function(r){r[r.NONE=0]="NONE",r[r.EASE=1]="EASE",r[r.BOUNCE=2]="BOUNCE"})(zn||(zn={}));var PM;(function(e){e.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,preventScroll:!1,isTouchZoom:!0,orbitTouches:2,panTouches:3}})(PM||(PM={}));var Fg=class{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,t=!1){let r=e[0].index!==null,n=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),o={},a={},l=e[0].morphTargetsRelative,c=new _e,u=0;for(let d=0;d<e.length;++d){let h=e[d],p=0;if(r!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let f in h.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;o[f]===void 0&&(o[f]=[]),o[f].push(h.attributes[f]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(l!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let f in h.morphAttributes){if(!s.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(h.morphAttributes[f])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(h.userData),t){let f;if(r)f=h.index.count;else if(h.attributes.position!==void 0)f=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;c.addGroup(u,f,d),u+=f}}if(r){let d=0,h=[];for(let p=0;p<e.length;++p){let f=e[p].index;for(let g=0;g<f.count;++g)h.push(f.getX(g)+d);d+=e[p].attributes.position.count}c.setIndex(h)}for(let d in o){let h=this.mergeBufferAttributes(o[d]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+d+" attribute."),null;c.setAttribute(d,h)}for(let d in a){let h=a[d][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[d]=[];for(let p=0;p<h;++p){let f=[];for(let v=0;v<a[d].length;++v)f.push(a[d][v][p]);let g=this.mergeBufferAttributes(f);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+d+" morphAttribute."),null;c.morphAttributes[d].push(g)}}return c}static mergeBufferAttributes(e){let t,r,n,s=0;for(let l=0;l<e.length;++l){let c=e[l];if(c.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(t===void 0&&(t=c.array.constructor),t!==c.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=c.itemSize),r!==c.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=c.normalized),n!==c.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=c.array.length}let o=new t(s),a=0;for(let l=0;l<e.length;++l)o.set(e[l].array,a),a+=e[l].array.length;return new Fe(o,r,n)}static interleaveAttributes(e){let t,r=0,n=0;for(let u=0,d=e.length;u<d;++u){let h=e[u];if(t===void 0&&(t=h.array.constructor),t!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;r+=h.array.length,n+=h.itemSize}let s=new ds(new t(r),n),o=0,a=[],l=["getX","getY","getZ","getW"],c=["setX","setY","setZ","setW"];for(let u=0,d=e.length;u<d;u++){let h=e[u],p=h.itemSize,f=h.count,g=new Bi(s,p,o,h.normalized);a.push(g),o+=p;for(let v=0;v<f;v++)for(let y=0;y<p;y++)g[c[y]](v,h[l[y]](v))}return a}static estimateBytesUsed(e){let t=0;for(let n in e.attributes){let s=e.getAttribute(n);t+=s.count*s.itemSize*s.array.BYTES_PER_ELEMENT}let r=e.getIndex();return t+=r?r.count*r.itemSize*r.array.BYTES_PER_ELEMENT:0,t}static mergeVertices(e,t=1e-4){t=Math.max(t,Number.EPSILON);let r={},n=e.getIndex(),s=e.getAttribute("position"),o=n?n.count:s.count,a=0,l=Object.keys(e.attributes),c={},u={},d=[],h=["getX","getY","getZ","getW"];for(let v=0,y=l.length;v<y;v++){let m=l[v];c[m]=[];let x=e.morphAttributes[m];x&&(u[m]=new Array(x.length).fill().map(()=>[]))}let p=Math.log10(1/t),f=Math.pow(10,p);for(let v=0;v<o;v++){let y=n?n.getX(v):v,m="";for(let x=0,b=l.length;x<b;x++){let w=l[x],T=e.getAttribute(w),S=T.itemSize;for(let M=0;M<S;M++)m+=`${~~(T[h[M]](y)*f)},`}if(m in r)d.push(r[m]);else{for(let x=0,b=l.length;x<b;x++){let w=l[x],T=e.getAttribute(w),S=e.morphAttributes[w],M=T.itemSize,E=c[w],C=u[w];for(let _=0;_<M;_++){let O=h[_];if(E.push(T[O](y)),S)for(let P=0,D=S.length;P<D;P++)C[P].push(S[P][O](y))}}r[m]=a,d.push(a),a++}}let g=e.clone();for(let v=0,y=l.length;v<y;v++){let m=l[v],x=e.getAttribute(m),b=new x.array.constructor(c[m]),w=new Fe(b,x.itemSize,x.normalized);if(g.setAttribute(m,w),m in u)for(let T=0;T<u[m].length;T++){let S=e.morphAttributes[m][T],M=new S.array.constructor(u[m][T]),E=new Fe(M,S.itemSize,S.normalized);g.morphAttributes[m][T]=E}}return g.setIndex(d),g}static toTrianglesDrawMode(e,t){if(t===Fp)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Gp||t===fx){let r=e.getIndex();if(r===null){let a=[],l=e.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)a.push(c);e.setIndex(a),r=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let n=r.count-2,s=[];if(t===Gp)for(let a=1;a<=n;a++)s.push(r.getX(0)),s.push(r.getX(a)),s.push(r.getX(a+1));else for(let a=0;a<n;a++)a%2==0?(s.push(r.getX(a)),s.push(r.getX(a+1)),s.push(r.getX(a+2))):(s.push(r.getX(a+2)),s.push(r.getX(a+1)),s.push(r.getX(a)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=e.clone();return o.setIndex(s),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}static computeMorphedAttributes(e){if(e.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;let t=new A,r=new A,n=new A,s=new A,o=new A,a=new A,l=new A,c=new A,u=new A;function d(z,B,Y,q,ee,k,pe,ce,ne){t.fromBufferAttribute(Y,k),r.fromBufferAttribute(Y,pe),n.fromBufferAttribute(Y,ce);let X=z.morphTargetInfluences;if(B.morphTargets&&q&&X){l.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(let le=0,$=q.length;le<$;le++){let V=X[le],K=q[le];V!==0&&(s.fromBufferAttribute(K,k),o.fromBufferAttribute(K,pe),a.fromBufferAttribute(K,ce),ee?(l.addScaledVector(s,V),c.addScaledVector(o,V),u.addScaledVector(a,V)):(l.addScaledVector(s.sub(t),V),c.addScaledVector(o.sub(r),V),u.addScaledVector(a.sub(n),V)))}t.add(l),r.add(c),n.add(u)}z.isSkinnedMesh&&(z.boneTransform(k,t),z.boneTransform(pe,r),z.boneTransform(ce,n)),ne[k*3+0]=t.x,ne[k*3+1]=t.y,ne[k*3+2]=t.z,ne[pe*3+0]=r.x,ne[pe*3+1]=r.y,ne[pe*3+2]=r.z,ne[ce*3+0]=n.x,ne[ce*3+1]=n.y,ne[ce*3+2]=n.z}let h=e.geometry,p=e.material,f,g,v,y=h.index,m=h.attributes.position,x=h.morphAttributes.position,b=h.morphTargetsRelative,w=h.attributes.normal,T=h.morphAttributes.position,S=h.groups,M=h.drawRange,E,C,_,O,P,D,G,R,U=new Float32Array(m.count*m.itemSize),te=new Float32Array(w.count*w.itemSize);if(y!==null)if(Array.isArray(p))for(E=0,_=S.length;E<_;E++)for(P=S[E],D=p[P.materialIndex],G=Math.max(P.start,M.start),R=Math.min(P.start+P.count,M.start+M.count),C=G,O=R;C<O;C+=3)f=y.getX(C),g=y.getX(C+1),v=y.getX(C+2),d(e,D,m,x,b,f,g,v,U),d(e,D,w,T,b,f,g,v,te);else for(G=Math.max(0,M.start),R=Math.min(y.count,M.start+M.count),E=G,_=R;E<_;E+=3)f=y.getX(E),g=y.getX(E+1),v=y.getX(E+2),d(e,p,m,x,b,f,g,v,U),d(e,p,w,T,b,f,g,v,te);else if(m!==void 0)if(Array.isArray(p))for(E=0,_=S.length;E<_;E++)for(P=S[E],D=p[P.materialIndex],G=Math.max(P.start,M.start),R=Math.min(P.start+P.count,M.start+M.count),C=G,O=R;C<O;C+=3)f=C,g=C+1,v=C+2,d(e,D,m,x,b,f,g,v,U),d(e,D,w,T,b,f,g,v,te);else for(G=Math.max(0,M.start),R=Math.min(m.count,M.start+M.count),E=G,_=R;E<_;E+=3)f=E,g=E+1,v=E+2,d(e,p,m,x,b,f,g,v,U),d(e,p,w,T,b,f,g,v,te);let he=new Ae(U,3),H=new Ae(te,3);return{positionAttribute:m,normalAttribute:w,morphedPositionAttribute:he,morphedNormalAttribute:H}}};var Gg={type:"change"},IM={type:"changeZoom"},$3={type:"changePan"},Ol={type:"start"},iu={type:"end"},DM=/iPad|iPhone|iPod/.test(navigator.userAgent)||Vc&&"ontouchend"in document,su=new A,RM=new A,eF=new F,OM=new A,BM=new Ft,zg=new Ft,Dr=new F,br=new F,Vr=new F,$r=new nd,vi=new nd,Qn=new A,Ug=new A,kg=new A,FM=new A,Qo=new F,Ko=new F,Bl=new F,Zo=new F,$o=new F,Hr=new F,Fl=new F,Gl=new F,ou=new F,GM=new F,zM=new F,tF=2*Math.PI,rF=1e-8,nF=.01,UM=2,Vg=.125,kM=2,Hg=1,jg=1,Wg=.1,xi;(function(o){o[o.LEFT=0]="LEFT",o[o.MIDDLE=1]="MIDDLE",o[o.RIGHT=2]="RIGHT",o[o.ROTATE=3]="ROTATE",o[o.DOLLY=4]="DOLLY",o[o.PAN=5]="PAN"})(xi||(xi={}));var ft;(function(l){l[l.NONE=-1]="NONE",l[l.ROTATE=0]="ROTATE",l[l.DOLLY=1]="DOLLY",l[l.PAN=2]="PAN",l[l.TOUCH_ROTATE=3]="TOUCH_ROTATE",l[l.TOUCH_PAN=4]="TOUCH_PAN",l[l.TOUCH_DOLLY_PAN=5]="TOUCH_DOLLY_PAN",l[l.TOUCH_DOLLY_ROTATE=6]="TOUCH_DOLLY_ROTATE"})(ft||(ft={}));var Ot=-1,pf=!1,ho=!1,mf=!0,VM=!1,Jg=0,gf=1,qg,yf=!1,HM=-1,jM=-1,Xg,Yg=0,WM=1/0,Qg=0,Kg=1/0,JM=0,qM=Math.PI,Zg=-1/0,$g=1/0,ey=0,ty=Math.PI,ry=-1/0,ny=1/0,XM=zn.BOUNCE,YM=zn.BOUNCE,QM=!0,iy=class extends xr{constructor(e,t){super();this.object=e;this.domElement=t;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=kr.DEFAULT;this.panLimitsMode=kr.DEFAULT;this.hoverRotatePanMode=Wi.OFF;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,Ln.DOLLY_ROTATE,Ln.PAN];this.update=()=>{let e=this.object.position;su.copy(e).sub(this.target),$r.setFromVector3(su),this.object.isUpVectorFlipped&&($r.phi*=-1,$r.theta-=Math.PI),this.autoRotate&&Ot===-1&&this.rotateLeft((QM===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==kr.DEFAULT&&this.applyLimits(vi,this.rotationLimitsMode,XM,$g,Zg,qM,JM,GM),this.rotationLimitsMode!==kr.HORIZONTAL&&($r.phi+=vi.phi),(this.rotationLimitsMode!==kr.VERTICAL||this.autoRotate===!0)&&($r.theta+=vi.theta),$r.radius*=gf,this.zoomLimitsEnabled&&($r.radius=Math.max(Yg,Math.min(WM,$r.radius))),this.panLimitsMode!==kr.DEFAULT&&(this.target.applyQuaternion(zg.copy(this.object.quaternion).invert()),Qn.applyQuaternion(zg),this.applyLimits(Qn,this.panLimitsMode,YM,ty,ey,ny,ry,zM),this.target.applyQuaternion(this.object.quaternion),Qn.applyQuaternion(this.object.quaternion)),this.panLimitsMode===kr.HORIZONTAL&&(Qn.y=0),this.panLimitsMode===kr.VERTICAL&&(Qn.x=0),Ot===-1&&!yf?(Qn.multiplyScalar(1-Vg),this.target.add(Qn)):(this.target.add(Qn),Qn.set(0,0,0)),su.setFromSpherical($r),e.copy(this.target).add(su);let t=$r.phi%tF;return RM.copy(su).normalize(),this.object.up.copy(Ze.DefaultUp).applyAxisAngle(RM,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),Ot===-1||this.enableDamping===!0?(vi.theta*=1-Vg,vi.phi*=1-Vg):vi.set(0,0,0),gf=1,pf||Vr.x>.05||Vr.y>.05||OM.distanceToSquared(this.object.position)>nF||8*(1-BM.dot(this.object.quaternion))>rF?(this.dispatchEvent(Gg),OM.copy(this.object.position),BM.copy(this.object.quaternion),pf=!1,!0):(vi.set(0,0,0),Qn.set(0,0,0),!1)};this.onPointerDown=e=>{this.enabled!==!1&&(ho=!0,yt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),sF(e),e.pointerType==="touch"?this.onPointerDownTouch(e):this.onPointerDownMouse(e))};this.onPointerMove=e=>{this.enabled!==!1&&(e.pointerType==="touch"?this.onPointerMoveTouch(e):this.onPointerMoveMouse(e))};this.onPointerUp=e=>{ZM(e),ho=!1,yt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(iu),Ot=-1};this.onPointerCancel=e=>{ZM(e)};this.onPointerDownMouse=e=>{let t;switch(this.useKeyEvents?t=this.mouseButtons[e.button]:t=this.mouseButtonsPlay[e.button],t){case 0:if(e.altKey===!0&&!e.shiftKey&&!Hc(e)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}else if(qg===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2;break;case 3:if(Hc(e)||e.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}break;case 5:if(Hc(e)||e.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}break;default:Ot=-1}Ot!==-1&&this.dispatchEvent(Ol)};this.onPointerMoveMouse=e=>{switch(Ot){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(e);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(e);break}};this.onPointerDownTouch=e=>{switch($M(e),this.touches[yt.length-1]){case Ln.ROTATE:if(this.enableRotate===!1){Ot=-1;return}this.handleTouchStartRotate(),Ot=3;break;case Ln.PAN:if(this.enablePan===!1){Ot=-1;return}this.handleTouchStartPan(),Ot=4;break;case Ln.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),Ot=5;break;case Ln.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),Ot=6;break;default:Ot=-1}Ot!==-1&&this.dispatchEvent(Ol)};this.onPointerMoveTouch=e=>{switch($M(e),Ot){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(e),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:Ot=-1}};this.dispatchEndDebounced=qc(()=>this.dispatchEvent(iu),33);this.onMouseWheel=e=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&e.preventDefault(),this.dispatchEvent(Ol),this.handleMouseWheel(e),this.dispatchEndDebounced())};this.onGesture=e=>{if(this.enabled!==!1)if(e.preventDefault(),e.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Ol),e.scale>Jg?this.dollyIn(this.getZoomScale()):e.scale<Jg&&this.dollyOut(this.getZoomScale()),Jg=e.scale,this.update()}else this.dispatchEvent(iu)};this.onContextMenu=e=>{this.enabled!==!1&&e.preventDefault()};this.onTouchMove=e=>{(e.touches.length>1||this.preventScroll)&&e.preventDefault()};this.onTouchEnd=e=>{e.preventDefault()};this.onKeyDown=e=>{this.enabled!==!1&&(qg=e.key)};this.onKeyUp=()=>{this.enabled!==!1&&(qg=void 0,Ot!==-1&&this.onPointerUp(yt[0]))};this.onPointerHover=e=>{if(!(this.enabled===!1||Ot!==-1)){if(window.clearTimeout(jM),ho=!0,mf){let t={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===Wi.PAN?this.handleMouseDownPan(t):this.hoverRotatePanMode===Wi.ROTATE&&this.handleMouseDownRotate(t),mf=!1}this.hoverRotatePanMode===Wi.PAN?this.handleMouseMovePan(e,Wg):this.hoverRotatePanMode===Wi.ROTATE&&this.handleMouseMoveRotate(e,Wg),jM=window.setTimeout(()=>{ho=!1},30),this.update()}};this.object=e,this.domElement=t,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.isPerspectiveCamera?this.object.zoom:1,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(Gg),mf=!0,this.update(),Ot=-1}resetTo(e,t,r){this.target.copy(e),this.object.position.copy(t),this.object.zoom=r,this.object.updateProjectionMatrix(),this.dispatchEvent(Gg),this.update(),Ot=-1}fromJSON(e){this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.panLimitsMode=e.panLimitsMode,YM=e.panSoftLimit,XM=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,mf=!0,this.hoverRotatePanMode!==Wi.OFF&&this.domElement.addEventListener("pointermove",this.onPointerHover),Wg=(e.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,Qg=e.zoomLimits.min,Kg=Math.max(e.zoomLimits.min,e.zoomLimits.max),Yg=1e3/e.zoomLimits.max,WM=Math.max(Yg,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,UM=e.autoRotateSpeed,QM=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(zg.copy(this.object.quaternion).invert());ry=-e.panVerticalOffset.min+r.y,ny=e.panVerticalOffset.max+r.y,ey=-e.panHorizontalOffset.min+r.x,ty=e.panHorizontalOffset.max+r.x,zM.set(ty-ey,ny-ry).divideScalar(2),GM.setScalar(Math.PI).divideScalar(4),JM=fo($r.phi-e.rotationVerticalOffset.min),qM=fo($r.phi+e.rotationVerticalOffset.max),Zg=fo($r.theta-e.rotationHorizontalOffset.min),$g=fo($r.theta+e.rotationHorizontalOffset.max),VM=Zg>$g,this.preventScroll=e.preventScroll,e.orbitTouches===1&&(this.touches[0]=Ln.ROTATE),e.panTouches===1&&(this.touches[0]=Ln.PAN),e.orbitTouches===2&&(this.touches[1]=Ln.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=Ln.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=Ln.ROTATE),e.panTouches===3&&(this.touches[2]=Ln.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),DM||(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),DM||(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(e,t,r,n,s,o,a,l){br.set(0,0);let c,u,d;e instanceof A?(c=e.x,u=e.y,Dr.set(this.target.x,this.target.y),d=!0):(c=e.theta,u=e.phi,Dr.set(fo($r.theta),fo($r.phi)),d=!1),r===zn.NONE&&(Dr.x+=c,Dr.y+=u),(t===kr.BOTH||t===kr.HORIZONTAL)&&(!d&&VM?Dr.x>n&&Dr.x<0?br.x=n-Dr.x:Dr.x<s&&Dr.x>0&&(br.x=s-Dr.x):Dr.x>n?br.x=n-Dr.x:Dr.x<s&&(br.x=s-Dr.x),n===s&&(c=0)),(t===kr.BOTH||t===kr.VERTICAL)&&(Dr.y>o?br.y=o-Dr.y:Dr.y<a&&(br.y=a-Dr.y),o===a&&(u=0)),d||(br.x=fo(br.x),br.y=fo(br.y)),r!==zn.NONE?(Vr.copy(br).divide(l),r===zn.BOUNCE?(Vr.x=Math.min(Math.abs(Vr.x),1),Vr.y=Math.min(Math.abs(Vr.y),1)):r===zn.EASE&&(Vr.x=Math.min(KM(Math.abs(Vr.x)),1),Vr.y=Math.min(KM(Math.abs(Vr.y)),1)),ho?r===zn.BOUNCE&&(Vr.x>.9||Vr.y>.9)?ho=!1:(c*br.x<0&&(c*=1-Vr.x),u*br.y<0&&(u*=1-Vr.y)):r===zn.BOUNCE&&(!d&&(Vr.x>.002||Vr.y>.002)||d&&(Math.abs(br.x)>2||Math.abs(br.y)>2))&&(c=br.x*.05,u=br.y*.05)):(c+=br.x,u+=br.y),e instanceof A?(e.x=c,e.y=u):(e.theta=c,e.phi=u)}setEnableDampingSpeed(e){this.enableDamping=e,Hg=e===!0?.2:1}stopDamping(){vi.theta=0,vi.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*UM}getZoomScale(){return Math.pow(.95,kM)}rotateLeft(e){vi.theta-=e}rotateUp(e){vi.phi-=e}panLeft(e,t){Ug.setFromMatrixColumn(t,0),Ug.multiplyScalar(-e),Qn.add(Ug)}panUp(e,t){kg.setFromMatrixColumn(t,1),kg.multiplyScalar(e),Qn.add(kg)}pan(e,t){let r=this.domElement;if(r&&this.object.isPerspectiveCamera){let n=this.object.position;FM.copy(n).sub(this.target);let s=FM.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*s/r.clientHeight,this.object.matrix),this.panUp(2*t*s/r.clientHeight,this.object.matrix)}else r&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix));this.dispatchEvent($3)}dollyOut(e){this.object.isPerspectiveCamera?gf/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Qg,Math.min(Kg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(IM)}dollyIn(e){this.object.isPerspectiveCamera?gf*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Qg,Math.min(Kg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(IM)}zoomOut(e=this.getZoomScale()){this.dispatchEvent(Ol),this.dollyOut(e),this.dispatchEvent(iu)}zoomIn(e=this.getZoomScale()){this.dispatchEvent(Ol),this.dollyIn(e),this.dispatchEvent(iu)}handleMouseDownRotate(e){Qo.set(e.clientX,e.clientY)}handleMouseDownDolly(e){Fl.set(e.clientX,e.clientY)}handleMouseDownPan(e){Zo.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){Ko.set(e.clientX,e.clientY),Bl.subVectors(Ko,Qo).multiplyScalar(Hg*t).rotateAround(eF,-this.object.angleOffsetFromUp);let r=this.domElement;this.rotateLeft(2*Math.PI*Bl.x/r.clientHeight),this.rotateUp(2*Math.PI*Bl.y/r.clientHeight),Qo.copy(Ko),this.update()}handleMouseMoveDolly(e){Gl.set(e.clientX,e.clientY),ou.subVectors(Gl,Fl),ou.y>0?this.dollyOut(this.getZoomScale()):ou.y<0&&this.dollyIn(this.getZoomScale()),Fl.copy(Gl),this.update()}handleMouseMovePan(e,t=1){$o.set(e.clientX,e.clientY),Hr.subVectors($o,Zo).multiplyScalar(jg*t),this.pan(Hr.x,Hr.y),Zo.copy($o),this.update()}handleMouseWheel(e){if(!yf)yf=!0,Xg=iF(e),ho=!0;else{if(Xg===!1||Hc(e)){if(this.enableZoom===!1)return;e.deltaY===0?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale())}else{if(this.enablePan===!1)return;Hr.set(-e.deltaX,-e.deltaY).multiplyScalar(jg),Hr.x=Math.min(Math.abs(Hr.x),100)*(Hr.x<0?-1:1),Hr.y=Math.min(Math.abs(Hr.y),100)*(Hr.y<0?-1:1),e.altKey?this.pan(0,Hr.y):e.shiftKey?this.pan(Hr.x,0):this.pan(Hr.x,Hr.y)}this.update()}window.clearTimeout(HM),HM=window.setTimeout(()=>{ho=!1,yf=!1,Xg=!1},30)}handleTouchStartRotate(){if(yt.length===2){let e=.5*(yt[0].pageX+yt[1].pageX),t=.5*(yt[0].pageY+yt[1].pageY);Qo.set(e,t)}else Qo.set(yt[0].pageX,yt[0].pageY)}handleTouchStartPan(){if(yt.length===2){let e=.5*(yt[0].pageX+yt[1].pageX),t=.5*(yt[0].pageY+yt[1].pageY);Zo.set(e,t)}else Zo.set(yt[0].pageX,yt[0].pageY)}handleTouchStartDolly(){let e=yt[0].pageX-yt[1].pageX,t=yt[0].pageY-yt[1].pageY,r=Math.sqrt(e*e+t*t);Fl.set(0,r)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(yt.length===2){let r=sy(e),n=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);Ko.set(n,s)}else{if(e.pointerId!==yt[0].pointerId)return;Ko.set(e.pageX,e.pageY)}Bl.subVectors(Ko,Qo).multiplyScalar(Hg);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*Bl.x/t.clientHeight),this.rotateUp(2*Math.PI*Bl.y/t.clientHeight)),Qo.copy(Ko)}handleTouchMovePan(e){if(yt.length===2){let t=sy(e),r=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);$o.set(r,n)}else{if(e.pointerId!==yt[0].pointerId)return;$o.set(e.pageX,e.pageY)}Hr.subVectors($o,Zo).multiplyScalar(jg),this.pan(Hr.x,Hr.y),Zo.copy($o)}handleTouchMoveDolly(e){let t=sy(e),r=e.pageX-t.x,n=e.pageY-t.y,s=Math.sqrt(r*r+n*n);Gl.set(0,s),ou.set(0,Math.pow(Gl.y/Fl.y,kM)),this.dollyOut(ou.y),Fl.copy(Gl)}handleTouchMoveDollyPan(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}};function fo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function KM(i){return 1-Math.pow(1-i,4)}function iF(i){return i.wheelDeltaY===0||i.deltaY===0?Vc&&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 yt=[],vf={};function sF(i){yt.push(i)}function ZM(i){delete vf[i.pointerId];for(let e=0;e<yt.length;e++)if(yt[e].pointerId===i.pointerId){yt.splice(e,1);return}}function $M(i){let e=vf[i.pointerId];e===void 0&&(e=new F,vf[i.pointerId]=e),e.set(i.pageX,i.pageY)}function sy(i){let e=i.pointerId===yt[0].pointerId?yt[1]:yt[0];return vf[e.pointerId]}var e1=3,Tr=5855577;var t1=2857471;var oy=15711266;var ay=class extends ng{constructor(){super();this.layers.enable(e1)}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 un({color:65280,linewidth:10}),t=new A(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new A(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new A().addVectors(t,r.multiplyScalar(n)),o=new _e;return o.setFromPoints([t,s]),new Ys(o,e)}};var yr=class extends Wt{constructor({char:e,originalChar:t,fontFamily:r,letterSpacing:n,fontSize:s,LOD:o=16},a=new Pi({color:0,opacity:1,visible:!0,transparent:!0,side:Yt})){let l=yr.loadChar(e,r,o);super(l.geometry,a);this.char=e,this.originalChar=t!=null?t:e,this.fontFamily=r,this.letterSpacing=n,this.fontSize=s,this.LOD=o,this.resolution=l.resolution,this.glyphsHa=l.glyphsHa,this.localPosition=new F,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return yr._fontPath}static set FONTS_PATH(e){yr._fontPath=e}updatePosition(e,t){this.localPosition.copy(e);let r=new A(this.localPosition.x,-this.localPosition.y,0);this.position.copy(r).add(t)}updateFontSize(e){let t=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*t*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let t=yr.loadChar(this.char,e,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let t=yr.loadChar(e,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let t=yr.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new yr(e).copy(this)}static loadFont(e){return new Promise(function(t,r){yr.fontCache[e]?t(yr.fontCache[e]):new $m().load(yr.FONTS_PATH+e+".json",s=>{yr.fontCache[e]=s,t(s)},void 0,r)})}static loadChar(e,t,r){if(yr.charCache[e]){if(yr.charCache[e][r]&&yr.charCache[e][r].fontFamily===t)return yr.charCache[e][r]}else yr.charCache[e]={};let n=yr.fontCache[t],s=n.generateShapes(e,1);return yr.charCache[e][r]={geometry:new rl(s,r),fontFamily:t,resolution:n.data.resolution,glyphsHa:n.data.glyphs[e].ha},yr.charCache[e][r]}},en=yr;en.charCache={},en.fontCache={},en._fontPath="/_assets/_fonts/";var r1=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:d,cornerSegments:h,hollow:p}=i.parameters,f;return d||p?f=new xf(c,u,r,n,s,o,a,l*Math.PI/180,d,d,h,p):f=new $a(c,u,r,n,s,o,a,l*Math.PI/180),f.scale(1,1,t/e),Object.assign(f,{userData:xe(re({},i),{type:"CylinderGeometry"})})}};function po(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function n1(i){return new F(i.y,-i.x)}var xf=class extends _e{constructor(e,t,r,n,s,o,a,l,c,u,d,h,p=!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 f=[],g=[],v=[],y=[],m=0,x=r/2,b=new A,w=new A;p&&e==0&&(e=c),p&&t==0&&(t=u);let T=new F(e,x),S=new F(t,-x),M=null,E=null,C=null,_=null,O=T.clone().sub(S),P=0,D=0,G=0;h>0&&(P=Math.min(e,t)*(1-h),D=e-P,G=t-P);let R=T.clone();R.x-=P;let U=Math.PI-O.angle(),te=O.angle(),he=Math.tan(te/2),H=Math.tan(U/2),z=he+H,B=h?z:H,Y=h?z:he;if(c=Math.min(c,(e-D)/B,O.length()/z),u=Math.min(u,(t-G)/Y,O.length()/z),c>0){let ne=c/he;M=T.clone().sub(new F(ne,c)),h&&(C=M.clone(),C.x-=P-z*c),T.sub(O.clone().setLength(ne))}if(u>0){let ne=u/H;E=S.clone().sub(new F(ne,-u)),S.add(O.clone().setLength(ne)),h&&(_=E.clone(),_.x-=P-z*u,R.sub(O.clone().setLength(ne)))}O=T.clone().sub(S);let q=O.length()<.5,ee=[];for(let ne=0;ne<=n;ne++){let X=[],le=ne/n,$=le*l+a,V=new F(Math.sin($),Math.cos($));_&&E?(k(X,le,V,U,u,_,-1,!0),k(X,le,V,te,u,E,-1,!1)):E?(pe(X,V,E.x,0,-1),k(X,le,V,te,u,E,-1,!1)):o||pe(X,V,t,G,-1);let K=n1(O).normalize();if(po(K,V,b),!q)for(let ue=0;ue<=s;ue++){let ie=ue/s,N=O.clone().multiplyScalar(ie).add(S);po(N,V,w),g.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),y.push(le,.5+w.y/r),X.push(m++)}if(C&&M?(k(X,le,V,U,c,M,1,!1),k(X,le,V,te,c,C,1,!0)):M?(k(X,le,V,U,c,M,1,!1),pe(X,V,M.x,0,1)):o||pe(X,V,e,D,1),h&&!q){let ue=n1(O).multiplyScalar(-1).normalize();po(ue,V,b);for(let ie=0;ie<=s;ie++){let N=ie/s,L=O.clone().multiplyScalar(-N).add(R);po(L,V,w),g.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),y.push(le,.5+w.y/r),X.push(m++)}}h&&!o&&X.push(X[0]),ee.push(X)}for(let ne=0;ne<ee.length-1;ne++)for(let X=0;X<ee[0].length-1;X++){if(o&&h&&X==s)continue;let le=ee[ne][X],$=ee[ne+1][X],V=ee[ne+1][X+1],K=ee[ne][X+1],ue=g[V*3+0],ie=g[V*3+2];f.push(le,$,K),(ue!=0||ie!=0)&&f.push($,V,K)}l<Math.PI*2&&(ce(-1,ee[0],a),ce(1,ee[ee.length-1],a+l)),this.setIndex(f),this.setAttribute("position",new Ae(g,3)),this.setAttribute("normal",new Ae(v,3)),this.setAttribute("uv",new Ae(y,2));function k(ne,X,le,$,V,K,ue,ie){for(let N=0;N<d+1;N++){let L=N/d,J=ue<0?L:1-L;ie&&(J-=1),J*=$;let se=new F(Math.sin(J),Math.cos(J)*ue),ye=se.clone().multiplyScalar(V).add(K);po(ye,le,w),g.push(w.x,w.y,w.z),po(se,le,b),v.push(b.x,b.y,b.z),y.push(X,.5+w.y/r),ne.push(m++)}}function pe(ne,X,le,$,V){let K=new A,ue=new F,ie=[le,$];V<0&&ie.reverse();for(let N of ie)ue.set(N,x*V),po(ue,X,K),g.push(K.x,K.y,K.z),v.push(0,V,0),y.push(.5,.5),ne.push(m++)}function ce(ne,X,le){let $=new F(Math.sin(le),Math.cos(le)),V=new F(-Math.cos(le),Math.sin(le)),K=new A,ue=ne<0?(L,J,se)=>f.push(L,J,se):(L,J,se)=>f.push(L,se,J),ie=new F((e+t+D+G)/4,0);po(ie,$,K),g.push(K.x,K.y,K.z),v.push(V.x,0,V.y),y.push(.5,.5);let N=m++;for(let L of X){let J=g.slice(L*3,L*3+3);g.push(...J),v.push(V.x,0,V.y);let se=y.slice(L*2,L*2+2);y.push(...se),m++}for(let L=N+1;L<m-1;L++)ue(N,L,L+1);ue(N,m-1,N+1)}}};var i1=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:d}=i.parameters,h;return c>0||u>0||l<360?h=new xf(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,d,0,!0):h=new Ec(e/2,r,n,s,o),h.scale(1,1,t/e),Object.assign(h,{userData:xe(re({},i),{type:"ConeGeometry"})})}};var s1=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 In(e,t,r,n,s,o):c=new o1(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(re({},i),{type:"CubeGeometry"})})}},ly=Math.PI/2,o1=class extends _e{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=[],d=[],h=[],p=[],f=0,g=0;v("z","y","x",-1,-1,r,t,e,o,s,0),v("z","y","x",1,-1,r,t,-e,o,s,1),v("x","z","y",1,1,e,r,t,n,o,2),v("x","z","y",1,-1,e,r,-t,n,o,3),v("x","y","z",1,-1,e,t,r,n,s,4),v("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(y("z","y","x",-1,-1,1,r,t,e,o,0),y("z","y","x",1,-1,-1,r,t,e,o,1),y("z","y","x",-1,1,-1,r,t,e,o,1),y("z","y","x",1,1,1,r,t,e,o,0),y("x","y","z",-1,-1,-1,e,t,r,n,0),y("x","y","z",1,-1,1,e,t,r,n,1),y("x","y","z",-1,1,1,e,t,r,n,0),y("x","y","z",1,1,-1,e,t,r,n,1),y("y","x","z",-1,-1,1,t,e,r,s,0),y("y","x","z",1,-1,-1,t,e,r,s,1),y("y","x","z",1,1,1,t,e,r,s,1),y("y","x","z",-1,1,-1,t,e,r,s,0),m(1,1,1),m(-1,1,1),m(1,-1,1),m(-1,-1,1),m(1,1,-1),m(-1,1,-1),m(1,-1,-1),m(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Ae(d,3)),this.setAttribute("normal",new Ae(h,3)),this.setAttribute("uv",new Ae(p,2));function v(x,b,w,T,S,M,E,C,_,O,P){let D=(M-2*a)/_,G=(E-2*a)/O,R=M/2-a,U=E/2-a,te=C/2,he=_+1,H=O+1,z=0,B=0,Y=new A;for(let q=0;q<H;q++){let ee=q*G-U;for(let k=0;k<he;k++){let pe=k*D-R;Y[x]=pe*T,Y[b]=ee*S,Y[w]=te,d.push(Y.x,Y.y,Y.z),Y[x]=0,Y[b]=0,Y[w]=C>0?1:-1,h.push(Y.x,Y.y,Y.z),p.push(k/_),p.push(1-q/O),z+=1}}for(let q=0;q<O;q++)for(let ee=0;ee<_;ee++){let k=f+ee+he*q,pe=f+ee+he*(q+1),ce=f+(ee+1)+he*(q+1),ne=f+(ee+1)+he*q;u.push(k,pe,ne),u.push(pe,ce,ne),B+=6}c.addGroup(g,B,P),g+=B,f+=z}function y(x,b,w,T,S,M,E,C,_,O,P){let D=(E-2*a)/O,G=E/2-a,R=C/2-a,U=_/2,te=O+1,he=0,H=0,z=new A,B=new A;for(let Y=0;Y<l+1;Y++){let q=Y/l*ly,ee=Math.sin(q)*a,k=(1-Math.cos(q))*a,pe=Math.sin(q),ce=Math.cos(q);z[b]=(R+ee)*S,z[w]=(U-k)*M,B[x]=0,B[b]=pe*Math.sign(z[b]),B[w]=ce*Math.sign(z[w]);for(let ne=0;ne<te;ne++){let X=ne*D-G;z[x]=X*T,d.push(z.x,z.y,z.z),h.push(B.x,B.y,B.z),p.push(ne/O),p.push(0),he+=1}}for(let Y=0;Y<l;Y++)for(let q=0;q<O;q++){let ee=f+q+te*Y,k=f+q+te*(Y+1),pe=f+(q+1)+te*(Y+1),ce=f+(q+1)+te*Y;u.push(ee,k,ce),u.push(k,pe,ce),H+=6}c.addGroup(g,H,P),g+=H,f+=he}function m(x,b,w){let T=new A,S=new A(e/2,t/2,r/2);S.subScalar(a);let M=[],E=x*b*w>0?(_,O,P)=>u.push(_,O,P):(_,O,P)=>u.push(_,P,O);for(let _=0;_<=l;_++){let O=[],P=ly*(1-_/l),D=Math.cos(P),G=Math.sin(P),R=0;for(let U=0;U<=_;U++){let te=Math.cos(R),he=Math.sin(R);T.x=D*te,T.y=G,T.z=D*he;let H=S.clone().addScaledVector(T,a);d.push(x*H.x,b*H.y,w*H.z),h.push(x*T.x,b*T.y,w*T.z),p.push(0,0),O.push(f++),R+=ly/_}M.push(O)}let C=M.length-1;for(let _=0;_<C;_++){let O=M[_],P=M[_+1],D=O.length-1;E(O[0],P[1],P[0]);for(let G=1;G<=D;G++)E(O[G-1],O[G],P[G]),E(O[G],P[G+1],P[G])}}}};var ea=class extends _e{constructor(e,t,r,n=1,s=.2,o=4){super();this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),d(),this.setAttribute("position",new Ae(a,3)),this.setAttribute("normal",new Ae(c,3)),this.setAttribute("uv",new Ae(l,2));return;function u(){var he;s=Math.min(1-1e-5,s),s==0&&(o=0);let p={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],f=new A,g=f.clone(),v=new nr,y=s*n,m=n-y,x=o+1,b=new A,w=(H,z)=>b.subVectors(H,z).normalize(),T=(H,z)=>Array(H).fill(void 0).map(z),S=T(e.length/3,(H,z)=>new A().fromArray(e,z*3).setLength(n)),M=[],E=1e6;for(let H=0;H<S.length;H++){let z=S[H],B=[],Y,q,ee,k=1e10,pe=-1;for(;(pe=t.indexOf(H,pe+1))!=-1;){let le=pe-pe%3;Y=t[le+(pe+1)%3],q=t[le+(pe+2)%3],ee=z.distanceToSquared(S[Y]),k=Math.min(k,ee),B.push([Y,q,ee])}k+=1e-6;let ce=[],ne=0,X=B.length;for(let le=0;le<X;le++){[Y,q,ee]=B[ne];let $=((he=M[Y])==null?void 0:he.includes(H))==!0;ee<=k&&ce.push(Y+ +$*E),ne=B.findIndex(V=>V[0]==q)}M.push(ce)}let C=[];{let H=0,z=0,B,Y,q=p==3;for(let ee=0;ee<=o;ee++){B=ee*(ee+1)/2,Y=(ee+1)*(ee+2)/2;for(let k=0;k<o-ee;k++)[H,z]=[B+k+ee+2,Y+k+ee+3],C.push(B,Y,...q?[z,B]:[H,Y],z,H),[B,Y]=[H,z];C.push(B,Y,B+o+2)}}let _=f.clone(),O=f.clone(),P=f.clone(),D=f.clone(),G=f.clone(),R=[],U=T(S.length,()=>T(p,()=>f.clone()));for(let H=0;H<S.length;H++){f.copy(S[H]).normalize(),_.copy(f).multiplyScalar(m);let z=M[H];for(let ce=0;ce<z.length;ce++){let ne=z[ce],X=z[(ce+1)%p];v.setFromPointsAndIndices(S,H,ne%E,X%E),v.b.sub(v.a).setLength(1e10).add(v.a),v.c.sub(v.a).setLength(1e10).add(v.a),v.closestPointToPoint(_,U[H][ce])}let B=[],Y=[],q=[],ee=new A;o==0&&[...U[H]].reduce((ce,ne)=>ce.add(ne),ee).multiplyScalar(1/p);for(let ce=0;ce<p;ce++){let ne=[],X=(ce-1+p)%p,le=U[H][X],$=U[H][ce];f.copy(le).sub(_),g.copy($).sub(_);let V=_.angleTo(f),K=f.angleTo(g),ue=Math.cos(V)*y;o==0?O.copy(ee):O.copy(_).setLength(m+ue),Y.push(ue);let ie=[O,le,$];for(let N=0;N<2;N++){let L=ie[N],J=ie[N+1];D.subVectors(L,_),G.subVectors(J,_),P.crossVectors(D,G).normalize();for(let se=0;se<x;se++){let ye=[V,K][N]*se/x;f.copy(D).applyAxisAngle(P,ye).add(_),B.push(f.clone()),N&&(w(f,_),ne.push([se==0?L:f.clone(),b.clone()]))}N&&(w(J,_),ne.push([J,b.clone()]))}q.push(ne)}R.push(q);let k=2*x,pe=2;for(let ce=0;ce<p;ce++){let ne=k*ce,X=k*((ce+1)%p),le=[B[ne]];for(let V=1;V<x;V++){D=B[ne+V],G=B[X+V],le.push(D);for(let K=1,ue=V-pe+1;K<=ue;K++)f.lerpVectors(D,G,K/(ue+1)),f.sub(_).setLength(Y[ce]).add(_),le.push(f.clone());le.push(G)}for(let V=0;V<x;V++)le.push(B[V+x+ne]);le.push(B[X+x]);let $=C.map(V=>le[V]);a.push(...$.map(V=>[V.x,V.y,V.z]).flat()),c.push(...$.map(V=>(w(V,_),[b.x,b.y,b.z])).flat())}}let te=[];for(let H=0;H<M.length;H++)for(let z=0;z<p;z++){let B=M[H][z];if(B<E){let Y=M[B].findIndex(k=>k%E==H),q=R[H][z],ee=R[B][Y];for(let k=0;k<x;k++){let pe=q[k],ce=ee[x-k],ne=q[k+1],X=ee[x-(k+1)];[pe,ce,ne,ne,ce,X].forEach(le=>{a.push(le[0].x,le[0].y,le[0].z),c.push(le[1].x,le[1].y,le[1].z)})}te.push(q[0][0],ee[x][0],q[x][0],ee[0][0])}}for(;te.length;){let H,z,B,Y;[H,z]=te.splice(0,2);let q=[H];for(;H!=z;)q.push(z),B=te.indexOf(z),Y=B%2,z=te.splice(B-Y,2)[1-Y];b.subVectors(q[0],q[1]).cross(f.subVectors(q[0],q[2])).normalize();let ee=b.dot(q[0])<0;ee&&b.negate();for(let k=1;k<=q.length-2;k++)[q[k+ +ee],q[k+1-+ee],q[0]].forEach(pe=>{a.push(pe.x,pe.y,pe.z),c.push(b.x,b.y,b.z)})}}function d(){let h=new A;for(let S=0;S<a.length;S+=3){h.x=a[S+0],h.y=a[S+1],h.z=a[S+2];let M=w(h)/2/Math.PI+.5,E=T(h)/Math.PI+.5;l.push(M,1-E)}let p=new A,f=new A,g=new A,v=new A,y=new F,m=new F,x=new F,b=(S,M,E,C)=>{C<0&&S.x===1&&(l[M]=S.x-1),E.x===0&&E.z===0&&(l[M]=C/2/Math.PI+.5)};for(let S=0,M=0;S<a.length;S+=9,M+=6){p.set(a[S+0],a[S+1],a[S+2]),f.set(a[S+3],a[S+4],a[S+5]),g.set(a[S+6],a[S+7],a[S+8]),y.set(l[M+0],l[M+1]),m.set(l[M+2],l[M+3]),x.set(l[M+4],l[M+5]),v.copy(p).add(f).add(g).divideScalar(3);let E=w(v);b(y,M+0,p,E),b(m,M+2,f,E),b(x,M+4,g,E)}for(let S=0;S<l.length;S+=6){let M=l[S+0],E=l[S+2],C=l[S+4],_=Math.max(M,E,C),O=Math.min(M,E,C);_>.9&&O<.1&&(M<.2&&(l[S+0]+=1),E<.2&&(l[S+2]+=1),C<.2&&(l[S+4]+=1))}function w(S){return Math.atan2(S.z,-S.x)}function T(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}}static fromJSON(e){return new ea(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};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,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 bf(e*.5,s,o):new Lc(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(re({},i),{type:"DodecahedronGeometry"})})}},bf=class extends ea{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 bf(e.radius,e.corner,e.cornerSides)}};var au=1e-12,lu=class{constructor(e){this.position=new F;this.startPosition=new F;this.uuid=rt.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 lu(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},cu=class extends lu{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new cu(this.parent).copy(this)}},Ji=class extends lu{constructor(e,t){super(t);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new cu(this),new cu(this))}static create(e,t){let r=new Ji(e,new F(...t.position));return r.controls[0].position.set(...t.controlPrevious.position),r.controls[1].position.set(...t.controlNext.position),r.roundness=t.roundness,r.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,r}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let r=0,n=this.controls.length;r<n;r++){let s=this.controls[r];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new Ji(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},cy=i=>i,uu=new F,uy=new F,oF=new F,aF=new F,lF=new F,cF=new F,l1=new A,c1=new A;function u1(i){let e=new F;e.addVectors(i.v0,uu.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new F;return t.addVectors(i.v2,uy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new bn(i.v0,e,t,i.v2)}function hu(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function uF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function hF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function hy(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 h1(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 d1(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function f1(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)),d;return hy(e,i,t)>Math.PI&&(u*=-1),hu(c,a)?d=(a+c)*(r/u-.5)*8/3/(o-l):d=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-d*a,e.y+d*o),s.set(t.x+d*c,t.y-d*l),[n,s]}function dy(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function p1(i,e,t,r,n=.5){let s=uu.subVectors(e,i).multiplyScalar(n).add(i),o=uy.subVectors(t,e).multiplyScalar(n).add(e),a=oF.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=aF.subVectors(o,s).multiplyScalar(n).add(s),u=lF.subVectors(a,o).multiplyScalar(n).add(o),d=a,h=cF.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,h.x,h.y,u.x,u.y,d.x,d.y,r.x,r.y]}function m1(i,e,t=12,r=!0){let n=c1.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=cy(e[l]),u=uu,d=mo(c,t);a.push(d);for(let h=0;h<=d;h++)if(c instanceof bn||c instanceof di||c instanceof wn){if(c.getPoint(h/d,u),n.set(u.x,u.y,0),s!==void 0&&hF(s,n))continue;s===void 0&&(s=l1),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 g1(i,e,t,r=12,n=!0){let s=c1.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=cy(e[l]),d=uu,h=mo(u,r);a.push(h);for(let p=0;p<=h;p++)if(u instanceof bn||u instanceof di||u instanceof wn){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c==null?void 0:c.equals(s))continue;c===void 0?c=l1:(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 fy(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=mo(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=mo(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=mo(i[0].roundedCurveCorner,e)*.5),r}function mo(i,e=12){return i&&i instanceof Go?e*2:i&&(i instanceof wn||i instanceof Jh)?1:i&&i instanceof el?e*i.points.length:e}function y1(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=cy(e[o]),l=mo(a,t),c=uu;for(let u=0;u<=l;u++)if(a instanceof bn||a instanceof di||a instanceof wn){if(a.getPoint(u/l,c),n!==void 0&&uF(n,c,au))continue;n===void 0&&(n=uy),n.copy(c),i.push(c.x,c.y),s++}}return hu(i[0],i[i.length-2],au)&&hu(i[1],i[i.length-1],au)&&(i.pop(),i.pop()),r&&s>1&&!(hu(i[s-1],i[1],au)&&hu(i[s-2],i[0],au))&&(i.push(i[0],i[1]),s++),i}var py=new F,dF=new F,fF=new F,pF=new F,mF=new F,gF=new F,St=class extends Jn{constructor(e=100,t=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new xr;this.plane=new xn(new A(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=rt.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=t}static createFromState(e,t,r){let n=new St;return n.isClosed=e.isClosed,n.points=e.points.map(s=>Ji.create(s.id,s.data)),typeof e.roundness=="number"&&(n.roundness=e.roundness),n.shapeHoles=e.shapeHoles.map(s=>St.createFromState(s)),t!==void 0&&r!==void 0&&n.applySize(t,r),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,r=this.points.length;t<r;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){return this.points.findIndex(t=>t.uuid===e)}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0)for(let t=0,r=this.shapeHoles.length;t<r;t++){let n=this.shapeHoles[t],s=e-this.points.length;if(s<=n.points.length-1)return n.points[s]}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=s.points.indexOf(e);if(o>=0)return t+o;t+=s.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this.applyScale(e/this.width,t/this.height),this._width=e,this._height=t}applyScale(e,t){let r=py.set(e,t);for(let n=0,s=this.points.length;n<s;n++){let o=this.points[n];o.position.multiply(r),o.controls[0].position.multiply(r),o.controls[1].position.multiply(r)}for(let n=0,s=this.shapeHoles.length;n<s;n++)this.shapeHoles[n].applyScale(e,t);this._update(!1)}createPoint(e,t=0,r=rt.generateUUID()){let n;e instanceof F?n=e:n=new F(e,t);let s=new Ji(r,n);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];if(n.uuid===e)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(r=>r.uuid===e);t&&this.removePoint(t)}update(e=!0){for(let t=0,r=this.shapeHoles.length;t<r;t++)this.shapeHoles[t].update(!1);this._update(e)}extractShapePointsToBuffer(e,t=12,r=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let n=r?this.roundedCurveDivisions:this.curveDivisions;return m1(e,r?this.roundedCurves:this.curves,t,this.autoClose),n.reduce((s,o)=>s+o,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=fy(this.points,e,!1),this.roundedCurveDivisions=fy(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,r=12){return g1(e,this.curves,t,r,this.autoClose).reduce((s,o)=>s+o,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),y1(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&this.points[0].roundedCurveCorner!==void 0&&(s=mo(this.points[0].roundedCurveCorner,this.subdivision)*.5);let o=e-s;o<0&&(o+=n.reduce((a,l)=>a+l,0));for(let a=0,l=n.length;a<l;a++){let c=n[a];if(o<r+c)return[a,(o-r+1)/c];r+=c}return[0,1]}getCurveT(e,t,r){let n=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],o=this.curveDivisions,a=o[e];if(dy(n,s)){let u=n.position.distanceTo(s.position);return n.position.distanceTo(py.set(r.x,r.y))/u}let l=0;for(let u=0;u<e;u++)l+=o[u];return(t-l)/a}dispose(){this.eventDispatcher=null}_applyCurveForPoint(e,t){dy(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,t.curveAfter=r;let n=r.clone();e.roundedCurveBefore=n,t.roundedCurveAfter=n,e.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(e=!0){var r;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,s=this.points.length;n<s;n++){let o=this.points[n];if(n===0)this.moveTo(o.position.x,o.position.y);else{let a=this.points[n-1];this._applyCurveForPoint(o,a)}}let t=this.getLastPoint();if((t==null?void 0:t.curveAfter)&&(t.curveAfter=void 0),this.isClosed){let n=this.points[0],s=this.points[this.points.length-1];this._applyCurveForPoint(n,s)}if(this.points.length>2){let n=0;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s],l=a.roundness;if(!a.controlsMoved()&&l>0){let c=a.curveBefore,u=a.curveAfter;if(c===void 0||u===void 0)continue;let d=a.roundedCurveBefore,h=a.roundedCurveAfter,p=c.getLength(),f=u.getLength(),g=Math.min(l,p*.499),v=Math.min(l,f*.499),y=Math.min(g,v),m=1-y/p,x=y/f,b=c.getPointAt(m,py),w=u.getPointAt(x,dF);this._subSplitCurve(c,d,m,b,void 0),this._subSplitCurve(u,h,x,void 0,w);let T;if(this.useCubicForRoundedCorners){let S=hy(b,a.position,w)/2,M=Math.tan(S)*b.distanceTo(a.position),[E,C]=h1(b,w,M,fF,pF),_=d1(E,C,a.position),[O,P]=f1(_,b,w,M,mF,gF);T=new bn(b.clone(),O.clone(),P.clone(),w.clone())}else T=new di(b.clone(),a.position.clone(),w.clone());a.roundedCurveCorner=T,this.roundedCurves.splice(s+n,0,T),n++}}}e&&((r=this.eventDispatcher)==null||r.dispatchEvent({type:"update"}))}_subSplitCurve(e,t,r,n,s){if(e instanceof wn)n!==void 0&&t.v2.copy(n),s!==void 0&&t.v1.copy(s);else{let o=e,a=t,l=o.getUtoTmapping(r,0),c=p1(o.v0,o.v1,o.v2,o.v3,l);return n!==void 0&&(a.v0.set(c[0],c[1]),a.v1.set(c[2],c[3]),a.v2.set(c[4],c[5]),a.v3.set(c[6],c[7])),s!==void 0&&(a.v0.set(c[6],c[7]),a.v1.set(c[8],c[9]),a.v2.set(c[10],c[11]),a.v3.set(c[12],c[13])),a}return t}clone(){let e=new St(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var r;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let n=0;n<t;n++){let s=n*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new Ji(rt.generateUUID(),new F(o,a));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=((r=e.shapeHoles)==null?void 0:r.length)?e.shapeHoles.map(n=>{let s=new St;return s.fromJSON(n),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){let t=(n,s)=>{s instanceof bn&&s.v3.equals(n.position)&&n.controls[0].position.copy(s.v2)},r=n=>{let s=[],o,a;for(o=0,a=n.length;o<a;o++)n[o]instanceof di&&(n[o]=u1(n[o]));for(o=0,a=n.length;o<a;o++){let u=n[o],d=o>0?n[o-1]:null,h;u instanceof bn?(h=this.createPoint(u.v0),h.controls[1].position.copy(u.v1)):u instanceof wn&&(h=this.createPoint(u.v1)),h!==void 0&&(d!==null&&t(h,d),s.push(h))}let l=n[n.length-1],c=!1;return l instanceof bn?l.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(l.v2),c=!0):l instanceof wn&&l.v2.equals(s[0].position)&&(c=!0),this.isClosed=c,s};return this.points=r(e.curves),e instanceof Jn&&(this.shapeHoles=e.holes.map(n=>{let s=new St;return s.fromShape(n),s})),this.update(),this}};var my=Math.PI*2;function gy({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function yF(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:4/3*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 v1(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 vF(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),d=Math.pow(s,2),h=Math.pow(o,2),p=Math.pow(a,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let g=f*n/s*a,v=f*-s/n*o,y=g+(i+t)/2,m=v+(e+r)/2,x=(o-g)/n,b=(a-v)/s,w=(-o-g)/n,T=(-a-v)/s,S=v1(1,0,x,b),M=v1(x,b,w,T);return!c&&M>0&&(M-=my),c&&M<0&&(M+=my),{centerx:y,centery:m,ang1:S,ang2:M}}function x1({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 d=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(n*=Math.sqrt(d),s*=Math.sqrt(d));let h=vF(i,e,t,r,n,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:g,centery:v}=h,y=Math.abs(f)/(my/4);Math.abs(1-y)<1e-7&&(y=1);let m=Math.max(Math.ceil(y),1);f/=m;for(let x=0;x<m;x++)l.push(yF(p,f)),p+=f;return l.map(x=>{let{x:b,y:w}=gy(x[0],n,s,g,v),{x:T,y:S}=gy(x[1],n,s,g,v),{x:M,y:E}=gy(x[2],n,s,g,v);return{x1:b,y1:w,x2:T,y2:S,x:M,y:E}})}var Zt;(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"})(Zt||(Zt={}));var _r;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(_r||(_r={}));function He(i,e){if(!i)throw e||"Assertion Failed!"}var Ge=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){He(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){He(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){He(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){He(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}(),du=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}(),wf=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}(),zl=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}(),b1=function(){function i(){var e=new zl,t=new du,r=new wf(0),n=new wf(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 wf(0),r=new wf(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;He(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;He(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 zl,t=new zl,r=new du,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 zl;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new du;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 du;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 zl;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 du;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&&Ge.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&Ge.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){He(n.prev===s),l=n.anEdge;do He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l),He(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(He(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){He(o.prev===a),l=o.anEdge;do He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l),He(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(He(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)He(l.Sym.next===c.Sym),He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Org!==null),He(l.Dst!==null),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l);He(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}(),w1=function(){function i(){this.handle=null}return i}(),S1=function(){function i(){this.key=null,this.node=0}return i}(),xF=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 w1,this.handles[r]=new S1;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,He(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 w1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new S1}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;He(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}(),yy=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}(),M1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),bF=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new M1,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 M1;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}(),wF=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?Ge.vertLeq(s.Org,o.Org)?Ge.edgeSign(o.Dst,s.Org,o.Org)<=0:Ge.edgeSign(s.Dst,o.Org,s.Org)>=0:Ge.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return Ge.edgeSign(s.Dst,n,s.Org)>=0;var a=Ge.edgeEval(s.Dst,n,s.Org),l=Ge.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&He(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){He(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 yy;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 Zt.ODD:return(t&1)!=0;case Zt.NONZERO:return t!==0;case Zt.POSITIVE:return t>0;case Zt.NEGATIVE:return t<0;case Zt.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,d=!0;c=r;do He(Ge.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,!d&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),d=!1,l=a,u=c;l.dirty=!0,He(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=Ge.vertL1dist(t,e),s=Ge.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(Ge.vertLeq(n.Org,s.Org)){if(Ge.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;Ge.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(Ge.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(He(!Ge.vertEq(n.Dst,s.Dst)),Ge.vertLeq(n.Dst,s.Dst)){if(Ge.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(Ge.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,d,h=new zl,p,f;if(He(!Ge.vertEq(c,l)),He(Ge.edgeSign(l,e.event,o)<=0),He(Ge.edgeSign(c,e.event,a)>=0),He(o!==e.event&&a!==e.event),He(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),d=Math.max(a.t,c.t),u>d))return!1;if(Ge.vertLeq(o,a)){if(Ge.edgeSign(c,o,a)>0)return!1}else if(Ge.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),Ge.intersect(l,o,c,a,h),He(Math.min(o.t,l.t)<=h.t),He(h.t<=Math.max(a.t,c.t)),He(Math.min(c.s,l.s)<=h.s),He(h.s<=Math.max(a.s,o.s)),Ge.vertLeq(h,e.event)&&(h.s=e.event.s,h.t=e.event.t),p=Ge.vertLeq(o,a)?o:a,Ge.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),Ge.vertEq(h,o)||Ge.vertEq(h,a)?(i.checkForRightSplice(e,t),!1):!Ge.vertEq(l,e.event)&&Ge.edgeSign(l,e.event,h)>=0||!Ge.vertEq(c,e.event)&&Ge.edgeSign(c,e.event,h)<=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),f=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,f,!0),!0):(Ge.edgeSign(l,e.event,h)>=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),Ge.edgeSign(c,e.event,h)<=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=h.s,n.Org.t=h.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),Ge.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),Ge.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}Ge.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,Ge.vertEq(n.Org,r)){He(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!Ge.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}He(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(He(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),Ge.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 yy;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,Ge.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=Ge.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);He(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 yy,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 bF(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||(He(t.fixUpperEdge),He(++r==1)),He(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,Ge.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 xF(s,Ge.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,He(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||!Ge.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}(),SF=function(){function i(){this.mesh=new b1,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=Zt.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],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],g=this.mesh.vHead;t=g.next;for(var v=0;v<3;++v)s=t.coords[v],c[v]=s,f[v]=t,l[v]=s,p[v]=t;for(t=g.next;t!==g;t=t.next)for(var y=0;y<3;++y)s=t.coords[y],s<c[y]&&(c[y]=s,f[y]=t),s>l[y]&&(l[y]=s,p[y]=t);var m=0;if(l[1]-c[1]>l[0]-c[0]&&(m=1),l[2]-c[2]>l[m]-c[m]&&(m=2),c[m]>=l[m]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=f[m],n=p[m],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=g.next;t!==g;t=t.next)d[0]=t.coords[0]-n.coords[0],d[1]=t.coords[1]-n.coords[1],d[2]=t.coords[2]-n.coords[2],h[0]=u[1]*d[2]-u[2]*d[1],h[1]=u[2]*d[0]-u[0]*d[2],h[2]=u[0]*d[1]-u[1]*d[0],o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],o>a&&(a=o,e[0]=h[0],e[1]=h[1],e[2]=h[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(;Ge.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Ge.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(Ge.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(Ge.edgeGoesLeft(n.Lnext)||Ge.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&&(Ge.edgeGoesRight(r.Lprev)||Ge.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===_r.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 d=c.n*n;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],n>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=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[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<r;++p)this.elements[h++]=-1;if(t===_r.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<r;++f)this.elements[h++]=-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 b1),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=Zt.ODD),t===void 0&&(t=_r.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_(),wF.computeInterior(this,o);var a=this.mesh;return t===_r.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===_r.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function ta(i){var e=i.windingRule,t=e===void 0?Zt.ODD:e,r=i.elementType,n=r===void 0?_r.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,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,g=i.debug,v=g===void 0?!1:g;if(!h&&f)throw new Error("Contours can't be empty");if(!!h){var y=new SF;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var m=0;m<h.length;m++)y.addContour(l||2,h[m]);return y.tesselate(t,n,o,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:v?y.mesh:void 0}}}var E9=Zt.ODD,C9=Zt.NONZERO,L9=Zt.POSITIVE,N9=Zt.NEGATIVE,P9=Zt.ABS_GEQ_TWO,I9=_r.POLYGONS,D9=_r.CONNECTED_POLYGONS,R9=_r.BOUNDARY_CONTOURS;var fu=class extends _e{constructor(e,t=12,r=100,n={}){super();this.type="ShapeGeometry";this.windingRule=Zt.ODD;this.elementType=_r.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=e,this._curveSegments=t,this._maxCount=r,this._maxDrawCount=r*3,this._triangulationOptions=Object.assign({windingRule:Zt.ODD,elementType:_r.POLYGONS,polySize:3,vertexSize:2,strict:!0},n),this._positionAttribute=new Fe(new Float32Array(r*3),3),this._normalAttribute=new Fe(new Float32Array(r*3),3),this._uvAttribute=new Fe(new Float32Array(r*2),2),this._indexAttribute=new Fe(new Uint32Array(r*3),1),this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.updateFromShape()}copy(e){return this._drawCount=e.drawCount,this._maxDrawCount=e._maxDrawCount,this._maxCount=e.maxCount,super.copy(e)}get curveSegments(){return this._curveSegments}set curveSegments(e){this._curveSegments=e,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let e=this._shape.extractShapePointsToFlatArray([],this._curveSegments),t=this._shape.shapeHoles.map(l=>l.extractShapePointsToFlatArray([],this._curveSegments)),r,n=!0,s=!0,o,a;for(let l=0,c=e.length/2;l<c;l++){let u=l*2,d=e[u+0],h=e[u+1];if(o!==void 0&&d!==o&&(n=!1),a!==void 0&&h!==a&&(s=!1),o=d,a=h,!n&&!s)break}if(!n&&!s&&(r=ta({contours:[e,...t],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})),this._positionAttribute.array.fill(0),this._normalAttribute.array.fill(0),this._uvAttribute.array.fill(0),this._indexAttribute.array.fill(0),this._drawCount=0,r){let l=1/0,c=-1/0,u=1/0,d=-1/0;for(let f=0,g=r.vertexCount;f<g;f++){let v=f*2,y=r.vertices[v+0],m=r.vertices[v+1];y<l&&(l=y),y>c&&(c=y),m<u&&(u=m),m>d&&(d=m)}let h=c-l,p=d-u;for(let f=0,g=r.vertexCount;f<g;f++){let v=f*2,y=r.vertices[v+0],m=r.vertices[v+1],x=(y-l)/h,b=(m-u)/p;this._positionAttribute.setXYZ(f,y,m,0),this._normalAttribute.setXYZ(f,0,0,1),this._uvAttribute.setXY(f,x,b)}for(let f=0,g=r.elementCount;f<g;f++){let v=f*3,y=r.elements[v+0],m=r.elements[v+1],x=r.elements[v+2];this._indexAttribute.setX(v+0,y),this._indexAttribute.setX(v+1,m),this._indexAttribute.setX(v+2,x),this._drawCount+=3}}return this._positionAttribute.needsUpdate=!0,this._normalAttribute.needsUpdate=!0,this._uvAttribute.needsUpdate=!0,this._indexAttribute.needsUpdate=!0,this.setDrawRange(0,this._drawCount),this._drawCount>this._maxDrawCount}};var Mf=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*Mf.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*Mf.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)}},Sf=Mf;Sf.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var vy=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),xy=class extends _e{constructor(e,t,r=0,n=12,s=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=t,r<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(r,t/2-1e-12),this._bevelSegments=Math.floor(s));let o=this._shape.extractShapePointsToFlatArray([],n),a=this._shape.shapeHoles.map(T=>{let S=T.extractShapePointsToFlatArray([],n),M=[];for(let E=S.length-1;E>=1;E-=2){let C=S[E-1],_=S[E-0];M.push(C,_)}return M}),l=ta({windingRule:Zt.ODD,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]}),c=ta({windingRule:Zt.ODD,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]});if(!l)throw new Error("error generating geometry");let u=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let T=0;T<c.elements.length;T++){let S=c.elements[T],M=T%2==0?l.vertexCount:0;l.elements.push(S+M)}for(let T=0;T<c.vertexIndices.length;T++){let S=c.vertexIndices[T],M=l.vertexCount;l.vertexIndices.push(S+M)}for(let T=0;T<c.vertices.length;T++){let S=c.vertices[T];l.vertices.push(S)}}let d=1/0,h=-1/0,p=1/0,f=-1/0;for(let T=0,S=l.vertexCount;T<S;T++){let M=T*2,E=l.vertices[M+0],C=l.vertices[M+1];E<d&&(d=E),E>h&&(h=E),C<p&&(p=C),C>f&&(f=C)}this._minX=d,this._minY=p,this._width=h-d,this._height=f-p;let g=l.vertexCount*2*(2+this._bevelSegments);this._buffer=new Sf(g);let v=[],y=[];for(let T=l.elementCount-1,S=l.elementCount;T>=0;T--){let M=T>=u,E=T*2,C=l.elements[E+0],_=l.elements[E+1],O=C+_,P={start:C,count:_,normals:[],continuous:[],concave:[]},D=C,G=O-1,R=C+1,U=this._shape.roundedCurves.length;do{let z=D-C,B=l.vertices[G*2+0],Y=l.vertices[G*2+1],q=l.vertices[D*2+0],ee=l.vertices[D*2+1],k=l.vertices[R*2+0],pe=l.vertices[R*2+1],ce=q-B,ne=ee-Y,X=Math.sqrt(ce*ce+ne*ne);ce/=X,ne/=X;let le=q-k,$=ee-pe,V=Math.sqrt(le*le+$*$);le/=V,$/=V,P.normals[z*2+0]=-$,P.normals[z*2+1]=le,P.concave[z]=ce*$-ne*le>0;let K=l.vertexIndices[D];if(Array.isArray(K))P.continuous[z]=!1;else{let[ue,ie]=this._shape.getCurveIndexFromVertexId(K-1,!0);if(ie>0&&ie<1)P.continuous[z]=!0;else{let N=ie===1?ue+1:ue-1;N=(N+U)%U;let L=ie===1?0:1,J=this._shape.roundedCurves[ue].getTangent(ie),se=this._shape.roundedCurves[N].getTangent(L);P.continuous[z]=J.dot(se)>.95}}M&&(P.normals[z*2+0]*=-1,P.normals[z*2+1]*=-1),[G,D,R]=[D,R,R+1],R>=O&&(R-=_)}while(R!==C+1);let te=[];te.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(C*2,O*2),vertexCount:_,vertexIndices:new Array(_).fill(!0).map((z,B)=>[B,B]),elements:[0,_],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(C*2,O*2)});for(let z=1;z<=this._bevelSegments;z++){let B=z/this._bevelSegments*Math.PI/2,Y=(1-Math.cos(B))*this._bevelSize,q=[],ee=[],k=[],pe=[],ce=0;for(let X=0;X<_;X++){let le=X*2,$=(X-1+_)%_*2,V=l.vertices[P.start*2+le+0],K=l.vertices[P.start*2+le+1],ue=-P.normals[$+0]*Y,ie=-P.normals[$+1]*Y,N=-P.normals[le+0]*Y,L=-P.normals[le+1]*Y;if(P.concave[X]||!P.concave[X]&&M){let J=Math.atan2(ie,ue),se=Math.atan2(L,N);se>J&&(se-=Math.PI*2);let ye=se-J;if(P.continuous[X]||M){let me=J+ye/2,Ie=Math.cos(me)*Y,we=Math.sin(me)*Y;q[2*ce+0]=V+Ie*(M?-1:1),q[2*ce+1]=K+we*(M?-1:1),pe[ce]=X,ce++}else{let me=Math.max(1,Math.floor(n/4*Math.abs(ye)/Math.PI));for(let Ie=0;Ie<=me;Ie++){let we=J+ye*(Ie/me),Re=Math.cos(we)*Y,Ee=Math.sin(we)*Y;q[2*ce+0]=V+Re,q[2*ce+1]=K+Ee,pe[ce]=X,ce++}}}else q[2*ce+0]=V+ue,q[2*ce+1]=K+ie,pe[ce]=X,ee[X]=ce,ce++,q[2*ce+0]=V,q[2*ce+1]=K,pe[ce]=X,ce++,q[2*ce+0]=V+N,q[2*ce+1]=K+L,pe[ce]=X,k[X]=ce,ce++}let ne=ta({windingRule:Zt.POSITIVE,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:X=>{let $=X.Org.idx,V=pe[$],K=pe[($+1)%pe.length];X.idx=[V,K],X.Sym.idx=[K,V]},vertexIdCallback:X=>{let le=X.Lprev.idx;return[le?le[1]:0,X.idx[0]]}});if(!ne)throw console.log("Error"),new Error(`error generating bevel geometry for ${z}'th loop`);if(!ne.vertexCount)break;for(let X=0;X<ne.vertexIndices.length;X++){let[le,$]=ne.vertexIndices[X];if(le===$)continue;let V=$;$<le&&(V+=_);for(let K=le;K<V;K++){let ue=K%_,ie=(K+1)%_;if(!P.continuous[ue]||!P.continuous[ie]){ne.vertexIndices[X]=[le,ue],ne.vertexIndices.splice(X+1,0,[ie,$]),ne.vertices.splice((X+1)*2,0,ne.vertices[X*2],ne.vertices[X*2+1]);break}}}te.push({bevelI:z,angle:B,size:Y,boundary:ne,reverseMap:pe,insetPoints:q})}let he=(z,B,Y)=>{let q=0,ee=z.boundary.vertexIndices.length;for(;q<ee&&Y(z.boundary.vertexIndices[B]);)B=(B+1)%ee,q++;return q},H=v.length;for(let z=1;z<te.length;z++){let B=te[z-1],Y=te[z],q=B.boundary.vertexIndices.length,ee=Y.boundary.vertexIndices.length;if(!q||!ee)break;let k=P.concave.length,pe=0,ce=vy(pe,_);for(;!B.boundary.vertexIndices.filter(ce).length||!Y.boundary.vertexIndices.filter(ce).length;)pe++,ce=vy(pe,_);let ne=B.boundary.vertexIndices.findIndex(ce),X=Y.boundary.vertexIndices.findIndex(ce);do ne=(ne+1)%q;while(ce(B.boundary.vertexIndices[ne]));do X=(X+1)%ee;while(ce(Y.boundary.vertexIndices[X]));pe=(pe+1)%_;let le=pe,$=this.buildBevelVert(P,B,(ne-1+q)%q),V=this.buildBevelVert(P,Y,(X-1+ee)%ee),K=$,ue=V,ie,N,L=!1;do{ce=vy(pe,_);let J=he(B,ne,ce),se=he(Y,X,ce),ye=L;if(L=!1,J&&!se){for(let me=0;me<J;me++)ie=this.buildBevelVert(P,B,(ne+me)%q,me/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie;L=!0}else if(!J&&se)for(let me=0;me<se;me++)N=this.buildBevelVert(P,Y,(X+me)%ee,me/(se-1)),v.push(ue.topN,K.topP,N.topP),v.push(K.bottomP,ue.bottomN,N.bottomP),ue=N;else if(J&&se)if(ie=this.buildBevelVert(P,B,ne,0),N=this.buildBevelVert(P,Y,X,0),ye?(v.push(K.topN,N.topP,ue.topN),v.push(K.topN,ie.topP,N.topP),v.push(N.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,K.bottomN,N.bottomP)):(v.push(K.topN,ie.topP,ue.topN),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,ue.bottomN,N.bottomP)),K=ie,ue=N,J===se)for(let me=1;me<J;me++)ie=this.buildBevelVert(P,B,(ne+me)%q,me/(J-1)),N=this.buildBevelVert(P,Y,(X+me)%ee,me/(se-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,ue.bottomN,N.bottomP),K=ie,ue=N;else if(J>se){let me=J/se,Ie=0;for(let we=1;we<J;we++)ie=this.buildBevelVert(P,B,(ne+we)%q,we/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie,we>(Ie+1)*me&&(Ie++,N=this.buildBevelVert(P,Y,(X+Ie)%ee,Ie/(se-1)),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,ue.bottomN,N.bottomP),ue=N)}else{let me=se/J,Ie=0;for(let we=1;we<se;we++)N=this.buildBevelVert(P,Y,(X+we)%ee,we/(se-1)),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,ue.bottomN,N.bottomP),ue=N,we>(Ie+1)*me&&(Ie++,ie=this.buildBevelVert(P,B,(ne+Ie)%q,Ie/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie)}ne=(ne+J)%q,X=(X+se)%ee,pe=(pe+1)%k}while(pe!==le)}{let z=te[0];for(let B=0,Y=z.boundary.vertexCount;B<Y;B++){let q=this.buildBevelVert(P,z,B),ee=this.buildBevelVert(P,z,(B+1)%Y);v.push(ee.topP,q.topN,q.bottomN),v.push(ee.topP,q.bottomN,ee.bottomP)}}if(M){let z=[];for(let B=v.length-1;B>=H+2;B-=3){let Y=v[B-2],q=v[B-1],ee=v[B-0];z.push(ee,q,Y)}v.splice(H,v.length-H,...z)}if(M){let z=[];for(let B=te[te.length-1].boundary.vertices.length-1;B>=1;B-=2){let Y=te[te.length-1].boundary.vertices[B-1],q=te[te.length-1].boundary.vertices[B-0];z.push(Y,q)}y.push(z)}if(!M){let z=te[te.length-1],B=ta({windingRule:te.length>1?Zt.POSITIVE:Zt.ODD,elementType:_r.POLYGONS,vertexSize:2,strict:!0,contours:[z.insetPoints,...y]});if(!B)throw new Error("Error generating geometry for surface");for(let Y=0;Y<B.elementCount*3;Y+=3){let q=this.buildSurfaceVert(B,B.elements[Y+0]),ee=this.buildSurfaceVert(B,B.elements[Y+1]),k=this.buildSurfaceVert(B,B.elements[Y+2]);v.push(q.top,ee.top,k.top),v.push(k.bottom,ee.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let m=new Fe(Uint32Array.from(v),1),x=new Fe(this._buffer.positions,3),b=new Fe(this._buffer.normals,3),w=new Fe(this._buffer.uvs,2);x.needsUpdate=!0,b.needsUpdate=!0,w.needsUpdate=!0,m.needsUpdate=!0,this.setAttribute("position",x),this.setAttribute("normal",b),this.setAttribute("uv",w),this.setIndex(m)}buildSurfaceVert(e,t){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let n=e.vertices[t*2+0],s=e.vertices[t*2+1],o=(n-this._minX)/this._width,a=(s-this._minY)/this._height,l=this._buffer.get(2),c=l*3,u=l*2,d={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=n,this._buffer.positions[c+1]=s,this._buffer.positions[c+2]=this._depth,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[u+0]=o,this._buffer.uvs[u+1]=a,this._buffer.positions[c+3]=n,this._buffer.positions[c+4]=s,this._buffer.positions[c+5]=0,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[u+2]=o,this._buffer.uvs[u+3]=a,this.vertexCache[r]=d,d}buildBevelVert(e,t,r,n=1){let s=`${t.bevelI}:${r}`;if(s in this.vertexCache)return this.vertexCache[s];let[o,a]=t.boundary.vertexIndices[r],l,c,u,d;o!==a?(c=o,l=a,d=!1,u=e.continuous[c]&&e.continuous[l]):(l=o,c=(l-1+e.count)%e.count,d=e.concave[l]&&t.bevelI>0,u=e.continuous[l]||d);let h=Math.cos(t.angle),p=Math.sin(t.angle),f=r*2,g=l*2,v=c*2,y=t.boundary.vertices[f+0],m=t.boundary.vertices[f+1],x=(1-p)*this._bevelSize,b=(y-this._minX)/this._width,w=(m-this._minY)/this._height,T=e.normals[g+0],S=e.normals[g+1],M=e.normals[v+0],E=e.normals[v+1];if(d){let D=M-T,G=E-S;T=T+D*(1-n),S=S+G*(1-n);let R=Math.sqrt(T*T+S*S);T/=R,S/=R}let C=this._buffer.get(u?2:4),_=C*3,O=C*2,P={i:r,fi:l,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=m,this._buffer.positions[_+2]=this._depth-x,this._buffer.normals[_+0]=T*h,this._buffer.normals[_+1]=S*h,this._buffer.normals[_+2]=p,this._buffer.uvs[O+0]=b,this._buffer.uvs[O+1]=w,this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=m,this._buffer.positions[_+5]=x,this._buffer.normals[_+3]=T*h,this._buffer.normals[_+4]=S*h,this._buffer.normals[_+5]=-p,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=b,u||(C+=2,_+=6,O+=4,P.topP=C+0,P.bottomP=C+1,this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=m,this._buffer.positions[_+2]=this._depth-x,this._buffer.normals[_+0]=M*h,this._buffer.normals[_+1]=E*h,this._buffer.normals[_+2]=p,this._buffer.uvs[O+0]=b,this._buffer.uvs[O+1]=w,this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=m,this._buffer.positions[_+5]=x,this._buffer.normals[_+3]=M*h,this._buffer.normals[_+4]=E*h,this._buffer.normals[_+5]=-p,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=b),this.vertexCache[s]=P,P}};var jr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,d,h,p,f,g;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((u=t.height)!=null?u:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(d=t.depth)!=null?d:0),o=(h=i.shape)!=null?h:e==null?void 0:e.shape,a=(p=o==null?void 0:o.roundness)!=null?p:t.roundness;o!==void 0&&(o instanceof St?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new St(r,n).fromJSON(o),((f=i.parameters)==null?void 0:f.roundness)!==void 0&&((g=i.parameters)==null?void 0:g.roundness)>0&&o.update(!1));let l=o!=null?o:new St(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s,surfaceMaxCount:o}=i.parameters;i.shape.roundness=s;let a;return e<=0?a=new fu(i.shape,n,o):a=new xy(i.shape,e,t,n,r),Object.assign(a,{userData:xe(re({},i),{type:"VectorGeometry"})})}};var A1=Math.PI*2,T1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u=i.shape,d=e*.5,h=t*.5,p=MF(u,d,h,n*Math.PI/180,r,s);u.isClosed=!0,u.update();let f=jr.create({shape:u,parameters:{subdivisions:p,surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(f,{userData:xe(re({},i),{type:"EllipseGeometry"})})}};function MF(i,e,t,r,n,s){if(r>=A1)return n>30||n%4==0?(TF(i,e,t,s),Math.round(n/4)):_1(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=x1({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?AF(i,o.x,o.y,c,n,e,t,s):_1(i,r,n,e,t,s)}function AF(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Ul(e,t));for(let c=0,u=r.length;c<u;c++){let d=r[c],h=i.points[c],p=Ul(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return a>0?E1(i,s,o,a):i.addPoint(Ul(0,0)),l}function _1(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(Ul(c,u))}return e<A1?s>0?E1(i,r,n,s):i.addPoint(Ul(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&C1(i,r,n,s)),1}function TF(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(Af(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(Af(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(Af(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(Af(n,s-t,n+a,s-t,n-a,s-t)),r>0&&C1(i,e,t,r)}function Ul(i,e){return new Ji(rt.generateUUID(),new F(i,e))}function Af(i,e,t,r,n,s){let o=Ul(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function E1(i,e,t,r){L1(i,e,t,r).forEach(s=>i.addPoint(s))}function C1(i,e,t,r){let n=L1(i,e,t,r),s=new St;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function L1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new F(n/e,s/t),a=i.points.map(l=>l.clone()).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 N1=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:d}=i.parameters,h=new Tf(!1,e,t,r,n,s,o,a,l,c,u,d);return Object.assign(h,{userData:xe(re({},i),{type:"HelixGeometry"})})}},Tf=class extends _e{constructor(e,t,r,n,s,o,a,l,c,u,d,h){super();let p=e&&o===1;p&&(h=0),d>100&&(d=100);let f=()=>new A,g=new A,v=f(),y=f(),m=f(),x,b,w,T,S,M,E,C,_=f(),O=f(),P=f(),D=f(),G=f(),R=f(),U=f(),te=f(),he=r-2*l+.001,H=he/o,z=Math.ceil(a*o),B=z+1,Y=he/z,q=-he/2,ee=u+1,k=2*Math.PI/u,pe=Math.PI/2/h,ce=.01,ne=Math.min((1-d/100)*l,l-ce),X=l-ne,le=0,$=2,V=h*$+$,K=ee*V/$,ue=K+ee*B,ie=ee*(B+V),[N,L,J]=[3,3,2].map(Be=>Array(ie*Be).fill(0)),se=[],ye=s-l;function me(Be,gt){let Mt=Math.PI/2;M=gt*Y,C=2*Math.PI*(M%H)/H+Mt,M+=q,E=Math.sin(C)*ye,S=Math.cos(C)*ye,e?Be.set(S,E,M):Be.set(S,M,E)}me(g,-1e-10),me(v,0),_.copy(g),me(g,1);let Ie=g.distanceTo(v),we=X+ne,Re=Ie*z+2*we,Ee=ne,j=Re-we;for(let Be=0;Be<=z;Be++){me(y,Be),te.subVectors(y,_).normalize(),_.copy(y),R.copy(y).setComponent(+e+1,0).normalize(),U.crossVectors(te,R).normalize();let gt=Be===0,Mt=Be===z,Cn=gt?3*Math.PI/2:pe,Gt=gt?Ee:j,yn=gt?ee:ue,vn=gt?0:ie-ee,Ps=te.clone().multiplyScalar(gt?-X:X).add(y),pa=te.clone().multiplyScalar(gt?-1:1).normalize();for(let an=0;an<ee;an++){let Is=an*k;if(O.addVectors(g.copy(R).multiplyScalar(l*Math.cos(Is)),v.copy(U).multiplyScalar(l*Math.sin(Is))),P.copy(O).normalize(),gt||Mt){p||(le=vn+an,[0,1,2].forEach(Ht=>{N[le*3+Ht]=Ps.getComponent(Ht),L[le*3+Ht]=pa.getComponent(Ht)}),J[le*2]=+Mt,J[le*2+1]=an/u),v.copy(P).multiplyScalar(ne),m.addVectors(y,v);for(let Ht=0;Ht<h;Ht++){let ss=Ht*pe+Cn;D.addVectors(g.copy(te).multiplyScalar(X*Math.sin(ss)),v.copy(P).multiplyScalar(X*Math.cos(ss))),G.copy(D).normalize(),v.addVectors(m,D),D.normalize(),le=yn+Ht*ee+an,[0,1,2].forEach(Ve=>{N[le*3+Ve]=v.getComponent(Ve),L[le*3+Ve]=G.getComponent(Ve)});let ma=+gt+Math.sin(ss);J[le*2]=(Gt+X*ma)/Re,J[le*2+1]=an/u}}v.addVectors(y,O),le=K+Be*ee+an,[0,1,2].forEach(Ht=>{N[le*3+Ht]=v.getComponent(Ht),L[le*3+Ht]=P.getComponent(Ht)}),J[le*2]=(we+Be*Ie)/Re,J[le*2+1]=an/u}}let Se=B+2*h+$,fe=1,[Ne,De]=p?[fe,fe+B-1]:[0,Se-1];for(let Be=Ne;Be<=De-1;Be++){let gt=p&&Be===De-1;for(let Mt=0;Mt<ee-1;Mt++)x=Be*ee+Mt,b=x+1,w=(gt?Mt:x)+ee,T=(gt?Mt+1:b)+ee,Be===0?se.push(b,T,w):Be===Se-2?se.push(x,b,w):se.push(x,b,w,b,T,w)}this.setIndex(se),this.setAttribute("position",new Ae(N,3)),this.setAttribute("normal",new Ae(L,3)),this.setAttribute("uv",new Ae(J,2))}};var P1=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 _f(e*.5,s,o):new Oc(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(re({},i),{type:"IcosahedronGeometry"})})}},_f=class extends ea{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 _f(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 Jn;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 Bc(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:xe(re({},i),{type:"LatheGeometry"})})}};var qi=new Me,by=new Ze,Ef=new A,ra=class extends xr{constructor(){super();this.uuid=rt.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 Dt().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 qi.makeRotationX(e),this.applyMatrix4(qi),this}rotateY(e){return qi.makeRotationY(e),this.applyMatrix4(qi),this}rotateZ(e){return qi.makeRotationZ(e),this.applyMatrix4(qi),this}translate(e,t,r){return qi.makeTranslation(e,t,r),this.applyMatrix4(qi),this}scale(e,t,r){return qi.makeScale(e,t,r),this.applyMatrix4(qi),this}lookAt(e){return by.lookAt(e),by.updateMatrix(),this.applyMatrix4(by.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 h=0;h<s.count;h++)t.vertices.push(new A().fromBufferAttribute(s,h)),a!==void 0&&t.colors.push(new ve().fromBufferAttribute(a,h));function u(h,p,f,g){let v=a===void 0?[]:[t.colors[h].clone(),t.colors[p].clone(),t.colors[f].clone()],y=o===void 0?[]:[new A().fromBufferAttribute(o,h),new A().fromBufferAttribute(o,p),new A().fromBufferAttribute(o,f)],m=new pu(h,p,f,y,v,g);t.faces.push(m),l!==void 0&&t.faceVertexUvs[0].push([new F().fromBufferAttribute(l,h),new F().fromBufferAttribute(l,p),new F().fromBufferAttribute(l,f)]),c!==void 0&&t.faceVertexUvs[1].push([new F().fromBufferAttribute(c,h),new F().fromBufferAttribute(c,p),new F().fromBufferAttribute(c,f)])}let d=e.groups;if(d.length>0)for(let h=0;h<d.length;h++){let p=d[h],f=p.start,g=p.count;for(let v=f,y=f+g;v<y;v+=3)r!==void 0?u(r.getX(v),r.getX(v+1),r.getX(v+2),p.materialIndex):u(v,v+1,v+2,p.materialIndex)}else if(r!==void 0)for(let h=0;h<r.count;h+=3)u(r.getX(h),r.getX(h+1),r.getX(h+2));else for(let h=0;h<s.count;h+=3)u(h,h+1,h+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(Ef).negate(),this.translate(Ef.x,Ef.y,Ef.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Me;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new A,t=new A;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new A;if(e){let r=new A,n=new A;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new ra;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new A,u={a:new A,b:new A,c:new A};s.push(c),o.push(u)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ln),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,d=e.colors;t!==void 0&&(n=new Dt().getNormalMatrix(t));for(let h=0,p=a.length;h<p;h++){let g=a[h].clone();t!==void 0&&g.applyMatrix4(t),o.push(g)}for(let h=0,p=d.length;h<p;h++)u.push(d[h].clone());for(let h=0,p=c.length;h<p;h++){let f=c[h],g,v,y=f.vertexNormals,m=f.vertexColors,x=new pu(f.a+s,f.b+s,f.c+s);x.normal.copy(f.normal),n!==void 0&&x.normal.applyMatrix3(n).normalize();for(let b=0,w=y.length;b<w;b++)g=y[b].clone(),n!==void 0&&g.applyMatrix3(n).normalize(),x.vertexNormals.push(g);x.color.copy(f.color);for(let b=0,w=m.length;b<w;b++)v=m[b],x.vertexColors.push(v.clone());x.materialIndex=f.materialIndex+r,l.push(x)}for(let h=0,p=e.faceVertexUvs.length;h<p;h++){let f=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let g=0,v=f.length;g<v;g++){let y=f[g],m=[];for(let x=0,b=y.length;x<b;x++)m.push(y[x].clone());this.faceVertexUvs[h].push(m)}}}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],d=Math.round(u.x*s)+"_"+Math.round(u.y*s)+"_"+Math.round(u.z*s);t[d]===void 0?(t[d]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[d]]}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 d=[u.a,u.b,u.c];for(let h=0;h<3;h++)if(d[h]===d[(h+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,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new A(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let f=this.parameters;for(let g in f)f[g]!==void 0&&(e[g]=f[g]);return e}let t=[];for(let f=0;f<this.vertices.length;f++){let g=this.vertices[f];t.push(g.x,g.y,g.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let f=0;f<this.faces.length;f++){let g=this.faces[f],v=!0,y=!1,m=this.faceVertexUvs[0][f]!==void 0,x=g.normal.length()>0,b=g.vertexNormals.length>0,w=g.color.r!==1||g.color.g!==1||g.color.b!==1,T=g.vertexColors.length>0,S=0;if(S=u(S,0,0),S=u(S,1,v),S=u(S,2,y),S=u(S,3,m),S=u(S,4,x),S=u(S,5,b),S=u(S,6,w),S=u(S,7,T),r.push(S),r.push(g.a,g.b,g.c),r.push(g.materialIndex),m){let M=this.faceVertexUvs[0][f];r.push(p(M[0]),p(M[1]),p(M[2]))}if(x&&r.push(d(g.normal)),b){let M=g.vertexNormals;r.push(d(M[0]),d(M[1]),d(M[2]))}if(w&&r.push(h(g.color)),T){let M=g.vertexColors;r.push(h(M[0]),h(M[1]),h(M[2]))}}function u(f,g,v){return v?f|1<<g:f&~(1<<g)}function d(f){let g=f.x.toString()+f.y.toString()+f.z.toString();return s[g]!==void 0||(s[g]=n.length/3,n.push(f.x,f.y,f.z)),s[g]}function h(f){let g=f.r.toString()+f.g.toString()+f.b.toString();return a[g]!==void 0||(a[g]=o.length,o.push(f.getHex())),a[g]}function p(f){let g=f.x.toString()+f.y.toString();return c[g]!==void 0||(c[g]=l.length/2,l.push(f.x,f.y)),c[g]}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 ra().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 h=0,p=t.length;h<p;h++)this.vertices.push(t[h].clone());let r=e.colors;for(let h=0,p=r.length;h<p;h++)this.colors.push(r[h].clone());let n=e.faces;for(let h=0,p=n.length;h<p;h++)this.faces.push(n[h].clone());for(let h=0,p=e.faceVertexUvs.length;h<p;h++){let f=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let g=0,v=f.length;g<v;g++){let y=f[g],m=[];for(let x=0,b=y.length;x<b;x++){let w=y[x];m.push(w.clone())}this.faceVertexUvs[h].push(m)}}let s=e.morphTargets;for(let h=0,p=s.length;h<p;h++){let f={};if(f.name=s[h].name,s[h].vertices!==void 0){f.vertices=[];for(let g=0,v=s[h].vertices.length;g<v;g++)f.vertices.push(s[h].vertices[g].clone())}if(s[h].normals!==void 0){f.normals=[];for(let g=0,v=s[h].normals.length;g<v;g++)f.normals.push(s[h].normals[g].clone())}this.morphTargets.push(f)}let o=e.morphNormals;for(let h=0,p=o.length;h<p;h++){let f={};if(o[h].vertexNormals!==void 0){f.vertexNormals=[];for(let g=0,v=o[h].vertexNormals.length;g<v;g++){let y=o[h].vertexNormals[g],m={};m.a=y.a.clone(),m.b=y.b.clone(),m.c=y.c.clone(),f.vertexNormals.push(m)}}if(o[h].faceNormals!==void 0){f.faceNormals=[];for(let g=0,v=o[h].faceNormals.length;g<v;g++)f.faceNormals.push(o[h].faceNormals[g].clone())}this.morphNormals.push(f)}let a=e.skinWeights;for(let h=0,p=a.length;h<p;h++)this.skinWeights.push(a[h].clone());let l=e.skinIndices;for(let h=0,p=l.length;h<p;h++)this.skinIndices.push(l[h].clone());let c=e.lineDistances;for(let h=0,p=c.length;h<p;h++)this.lineDistances.push(c[h]);let u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());let d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.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 D1().fromGeometry(this),t=new _e,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Fe(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Fe(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Fe(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Fe(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Fe(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 Ae(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 Ae(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Ae(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 _e,r=e.geometry;if(e.isPoints||e.isLine){let n=new Ae(r.vertices.length*3,3),s=new Ae(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 Ae(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}};ra.prototype.isGeometry=!0;var D1=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let y=0;y<l;y++)c[y]={name:a[y].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,d=u.length,h;if(d>0){h=[];for(let y=0;y<d;y++)h[y]={name:u[y].name,data:[]};this.morphTargets.normal=h}let p=e.skinIndices,f=e.skinWeights,g=p.length===r.length,v=f.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let y=0;y<t.length;y++){let m=t[y];this.vertices.push(r[m.a],r[m.b],r[m.c]);let x=m.vertexNormals;if(x.length===3)this.normals.push(x[0],x[1],x[2]);else{let w=m.normal;this.normals.push(w,w,w)}let b=m.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let w=m.color;this.colors.push(w,w,w)}if(s===!0){let w=n[0][y];w!==void 0?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new F,new F,new F))}if(o===!0){let w=n[1][y];w!==void 0?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new F,new F,new F))}for(let w=0;w<l;w++){let T=a[w].vertices;c[w].data.push(T[m.a],T[m.b],T[m.c])}for(let w=0;w<d;w++){let T=u[w].vertexNormals[y];h[w].data.push(T.a,T.b,T.c)}g&&this.skinIndices.push(p[m.a],p[m.b],p[m.c]),v&&this.skinWeights.push(f[m.a],f[m.b],f[m.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}},pu=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new A,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new ve,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 _F=["a","b","c"];function EF(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function wy(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function Sy(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],d=t[a];c={a:u,b:d,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function CF(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],Sy(o.a,o.b,i,r,o,t),Sy(o.b,o.c,i,r,o,t),Sy(o.c,o.a,i,r,o,t)}function Cf(i,e,t,r,n){i.push(new pu(e,t,r,void 0,void 0,n))}function kl(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function Lf(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var My=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof _e?e=new ra().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new A,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],d=u!==void 0&&u.length>0,h=[],p=new Map;CF(l,c,h,p);let f=[],g,v,y,m,x,b,w;for(let ce of Array.from(p.keys())){for(v=p.get(ce),y=new A,x=3/8,b=1/8,w=v.faces.length,w!=2&&(x=.5,b=0,w!=1),y.addVectors(v.a,v.b).multiplyScalar(x),t.set(0,0,0),o=0;o<w;o++){for(m=v.faces[o],a=0;a<3&&(g=l[EF(m,_F[a])],!(g!==v.a&&g!==v.b));a++);g&&t.add(g)}t.multiplyScalar(b),y.add(t),v.newEdge=f.length,f.push(y)}let T,S,M,E,C,_,O,P=[];for(n=0,s=l.length;n<s;n++){for(_=l[n],C=h[n].edges,r=C.length,r==3?T=3/16:r>3&&(T=3/(8*r)),S=1-r*Number(T),M=T,r<=2&&(r==2?(S=3/4,M=1/8):r==1||r==0),O=_.clone().multiplyScalar(S),t.set(0,0,0),o=0;o<r;o++)E=C[o],g=E.a!==_?E.a:E.b,t.add(g);t.multiplyScalar(Number(M)),O.add(t),P.push(O)}let D=P.concat(f),G=P.length,R,U,te,he=[],H=[],z,B,Y,q,ee=new F,k=new F,pe=new F;for(n=0,s=c.length;n<s;n++)m=c[n],R=Number(wy(m.a,m.b,p).newEdge)+G,U=Number(wy(m.b,m.c,p).newEdge)+G,te=Number(wy(m.c,m.a,p).newEdge)+G,Cf(he,R,U,te,m.materialIndex),Cf(he,m.a,R,te,m.materialIndex),Cf(he,m.b,U,R,m.materialIndex),Cf(he,m.c,te,U,m.materialIndex),d&&(z=u[n],B=z[0],Y=z[1],q=z[2],ee.set(kl(B.x,Y.x),kl(B.y,Y.y)),k.set(kl(Y.x,q.x),kl(Y.y,q.y)),pe.set(kl(B.x,q.x),kl(B.y,q.y)),Lf(H,ee,k,pe),Lf(H,B,ee,pe),Lf(H,Y,k,ee),Lf(H,q,pe,k));e.vertices=D,e.faces=he,d&&(e.faceVertexUvs[0]=H)}};var Er=new A,Nf=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 _e().copy(new In(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Er),r={width:Er.x,height:Er.y,depth:Er.z,subdivisions:0}):r=e.parameters;let n=re(re({},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 _e().copy(new In(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Er)):Er.set(o.width,o.height,o.depth),(e!==Er.x||t!==Er.y||r!==Er.z)&&s.scale(Er.x===0?1:e/Er.x,Er.y===0?1:t/Er.y,Er.z===0?1:r/Er.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 My(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:xe(re({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Ho(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Er);let o=100/Er.x;Object.assign(s.parameters,{width:100,height:Er.y*o,depth:Er.z*o}),e(this.build(s))})}};var R1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,d=t*.5,h=0,p=0,f=2*Math.PI/r;for(let v=0;v<r;v++){let y=f*v,m=h+Math.sin(y)*u,x=p+Math.cos(y)*d;c.addPoint(c.createPoint(m,x))}c.isClosed=!0;for(let v=0,y=c.points.length;v<y;v++)c.points[v].roundness=n;c.roundness=n,c.update();let g=jr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(g,{userData:xe(re({},i),{type:"PolygonGeometry"})})}};var O1=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 B1(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:xe(re({},i),{type:"PyramidGeometry"})})}};function mu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function Ay(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 LF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var B1=class extends _e{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=[],d=[],h=0,p=t/2,f=Math.PI/r,g=e*Math.cos(Math.PI/r),v=2*Math.PI/r,y=(r-2)*Math.PI/r,m=Math.PI-y,x=new A(0,-p,0),b=new A(0,p,0),w=new F(e,-p),T=new F(g,-p),S=new F(0,b.y).sub(T),M=new F(0,b.y).sub(w),E=new F(S.y,-S.x).normalize(),C=new F(M.y,-M.x).normalize(),O=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-S.angle())/2)-1e-8;o=Math.min(o,O);let P;{let H=new A(E.x,E.y,0),z=new A(Math.cos(v)*H.x,H.y,Math.sin(v)*H.x);P=H.angleTo(z)}let D=o/Math.tan((Math.PI-S.angle())/2),G=o/Math.tan((Math.PI-P)/2),R=new A;if(!s){c.push(x.x,x.y,x.z),u.push(0,-1,0),d.push(0,0);let H=h++,z=[],B=w.clone(),Y=D/Math.cos(Math.PI/r);B.x-=Y;for(let q=0;q<r;q++){let ee=q/r*Math.PI*2+f,k=new F(Math.sin(ee),Math.cos(ee));mu(B,k,R),c.push(R.x,R.y,R.z),u.push(0,-1,0),d.push(0,0),z.push(h++)}for(let q=0;q<z.length;q++)l.push(z[q],H,z[(q+1)%z.length])}let U=[];{let H=new A,z=new A,B=new A,Y=new A,q=new A,ee=new A;for(let k=0;k<r;k++){let pe=k/r*Math.PI*2+f,ce=(k+.5)/r*Math.PI*2+f,ne=(k+1)/r*Math.PI*2+f,X=new F(Math.sin(pe),Math.cos(pe)),le=new F(Math.sin(ce),Math.cos(ce)),$=new F(Math.sin(ne),Math.cos(ne));mu(w,X,z),mu(w,$,B),mu(E,le,H),Ay(b,z,B,G,G,Y),c.push(Y.x,Y.y,Y.z),Ay(z,b,B,G,D,q),c.push(q.x,q.y,q.z),Ay(B,z,b,D,G,ee),c.push(ee.x,ee.y,ee.z),u.push(H.x,H.y,H.z),u.push(H.x,H.y,H.z),u.push(H.x,H.y,H.z),d.push(0,0),d.push(0,0),d.push(0,0);let V=h++,K=h++,ue=h++;if(l.push(V,K,ue),o>0){{let L=z.clone().add(B).multiplyScalar(.5),J=b.clone().sub(L).normalize(),ye=x.clone().sub(L).normalize().add(J).normalize().multiplyScalar(-1),me=ee.clone().sub(q);te(L,me,ye,S.angle())}let ie,N;{let L=new A;mu(C,$,L);let J=ee.clone().add(Y).multiplyScalar(.5);J=LF(J,B,b);let se=ee.clone().sub(Y);[ie,N]=te(J,se,L,P,Y.y)}{let L=ie,J=L.clone().setY(0).normalize(),se=new A(0,-1,0),ye=J.clone().cross(se);he(L,J,se,ye)}U.concat(N);{let L=S.angle(),J=Math.PI-L,se=b.clone();se.y-=o/Math.sin(L-Math.PI/2);let ye=new A,me=[];for(let we=0;we<a;we++){let Re=[],Ee=Math.PI/2-J*we/a,j=Math.cos(Ee),Se=Math.sin(Ee),fe=ce;for(let Ne=0;Ne<=we;Ne++){let De=Math.cos(fe),Be=Math.sin(fe);H.x=j*Be,H.y=Se,H.z=j*De,ye.copy(se).addScaledVector(H,o),c.push(ye.x,ye.y,ye.z),u.push(H.x,H.y,H.z),d.push(0,0),Re.push(h++),fe+=Math.PI*2/we/r}me.push(Re)}N.reverse(),me.push(N);let Ie=me.length-1;for(let we=0;we<Ie;we++){let Re=me[we],Ee=me[we+1],j=Re.length-1;l.push(Ee[1],Re[0],Ee[0]);for(let Se=1;Se<=j;Se++)l.push(Re[Se],Re[Se-1],Ee[Se]),l.push(Ee[Se+1],Re[Se],Ee[Se])}}}}}this.setIndex(l),this.setAttribute("position",new Ae(c,3)),this.setAttribute("normal",new Ae(u,3)),this.setAttribute("uv",new Ae(d,2));function te(H,z,B,Y,q){let ee=-Y/2,k=(Math.PI-Y)/2,pe=z.clone().normalize().cross(B);H.addScaledVector(B,-o/Math.sin(k));let ce=new A,ne=new A,X=1,le=h,$=[];for(let V=0;V<=a;V++){let K=ee+V/a*Y;ne.set(0,0,0),ne.addScaledVector(pe,Math.sin(K)),ne.addScaledVector(B,Math.cos(K));for(let ue=0;ue<=X;ue++){let ie=ue/X-.5;if(ce.copy(H),ce.addScaledVector(z,ie),ce.addScaledVector(ne,o),q!=null){let N=Math.max(0,ce.y-q);ce.addScaledVector(z,-N/z.y)}c.push(ce.x,ce.y,ce.z),u.push(ne.x,ne.y,ne.z),d.push(0,0),ue===0&&$.push(h),h++}}for(let V=0;V<a;V++)for(let K=0;K<X;K++){let ue=le+K+(X+1)*V,ie=ue+(X+1),N=ie+1,L=ue+1;l.push(ue,ie,L),l.push(ie,N,L)}return[H.clone().addScaledVector(z,.5),$]}function he(H,z,B,Y){let q=Math.PI/2,ee=M.angle()-q,k=[],pe=new A,ce=new A;for(let X=0;X<=a;X++){let le=[],$=X/a;for(let V=0;V<=X;V++){let ue=((X?V/X:0)-.5)*m,ie=Math.cos(ue),N=Math.sin(ue),L=Math.atan(Math.tan(ee)*ie),J=(q+L)*$,se=Math.cos(J),ye=Math.sin(J);pe.set(0,0,0),pe.addScaledVector(z,ye*ie),pe.addScaledVector(B,se),pe.addScaledVector(Y,ye*N),ce.copy(H).addScaledVector(pe,o),c.push(ce.x,ce.y,ce.z),u.push(pe.x,pe.y,pe.z),d.push(0,0),le.push(h++)}k.push(le)}let ne=k.length-1;for(let X=0;X<ne;X++){let le=k[X],$=k[X+1],V=le.length-1;l.push(le[0],$[1],$[0]);for(let K=1;K<=V;K++)l.push(le[K-1],le[K],$[K]),l.push(le[K],$[K+1],$[K])}}}};var Pf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},i.ui),n=t.cornerRadius.reduce((d,h)=>d+h,0);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:n>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(u=t.depth)!=null?u:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u={x:t*.5,y:r*.5},d={x:-u.x,y:-u.y},h={x:u.x,y:u.y};function p(w,T,S){return T>t&&S>r?Math.min(w*t/T,w*r/S):T>t?w*t/T:S>r?w*r/S:w}let f=[];f[0]=n[0]===0?0:p(n[0],n[0]+n[3],n[0]+n[1]),f[1]=n[1]===0?0:p(n[1],n[1]+n[2],n[1]+n[0]),f[2]=n[2]===0?0:p(n[2],n[2]+n[1],n[2]+n[3]),f[3]=n[3]===0?0:p(n[3],n[3]+n[0],n[3]+n[2]);let g=d.x,v=h.x,y=h.y,m=d.y;e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(v,y)),e.addPoint(e.createPoint(v,m)),e.addPoint(e.createPoint(g,m)),e.isClosed=!0;let x=!0;for(let w=0,T=e.points.length;w<T;w++)e.points[w].roundness=f[w],w>0&&f[w]!==f[w-1]&&(x=!1);x&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=jr.create({shape:e,parameters:{surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(b,{userData:xe(re({},i),{type:"RectangleGeometry"})})}};var F1=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 nl(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:xe(re({},i),{type:"SphereGeometry"})})}};var G1=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 Js(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:xe(re({},i),{type:"PlaneGeometry"})})}};var z1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:u}=i.parameters,d=i.shape,h=e*.5,p=t*.5,f=0,g=0,v=o*Math.PI/360/n,y=Math.PI/2*3*-1,m=h*r/100,x=p*r/100;if(n==3&&r==50){v=2*Math.PI/n;for(let w=0;w<n;w++){let T=v*w,S=f+Math.sin(T)*h,M=g+Math.cos(T)*p;d.addPoint(d.createPoint(S,M))}}else for(let w=0;w<n;w++){let T=f+Math.cos(y)*h,S=g+Math.sin(y)*p;d.addPoint(d.createPoint(T,S)),y+=v,T=f+Math.cos(y)*m,S=g+Math.sin(y)*x,w<=n,d.addPoint(d.createPoint(T,S)),y+=v}d.isClosed=!0;for(let w=0,T=d.points.length;w<T;w++)d.points[w].roundness=s;d.roundness=s,d.update();let b=jr.create({shape:d,parameters:{surfaceMaxCount:u,roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(b,{userData:xe(re({},i),{type:"StarGeometry"})})}};var If=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 Js(e,t);return Object.assign(r,{userData:xe(re({},i),{type:"TextFrameGeometry"})})}};var U1=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=NF(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:xe(re({},i),{type:"TorusGeometry"})})}};function NF(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 Tf(!0,i,e,t,r,n,s,o,a,l,c,u)}var k1=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 Fc(a,t,r,n,s,o);return Object.assign(l,{userData:xe(re({},i),{type:"TorusKnotGeometry"})})}};var V1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,d=t*.5;a?(c.addPoint(c.createPoint(-u,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=r;c.roundness=r,c.update();let h=jr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(h,{userData:xe(re({},i),{type:"TriangleGeometry"})})}};var gu={};qT(gu,{addBarycentricAttribute:()=>DF,fixUvs:()=>OF,loadFromUrl:()=>RF,resizeGeometry:()=>IF,roundShapePolygon:()=>PF});var H1=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}},PF=(i,e,t)=>{let r,n,s,o,a,l,c,u,d,h,p,f,g,v,y=e.length;for(o=e[y-2],i.curves=[],r=1;r<y-1;r++){a=e[r%y],l=e[(r+1)%y];let m=H1(a,o),x=H1(a,l);c=m.nx*x.ny-m.ny*x.nx,u=m.nx*x.nx-m.ny*-x.ny,p=Math.asin(c),d=1,h=!1,u<0?p<0?p=Math.PI+p:(p=Math.PI-p,d=-1,h=!0):p>0&&(d=-1,h=!0),f=p/2,v=Math.abs(Math.cos(f)*t/Math.sin(f)),v>Math.min(m.len/2,x.len/2)?(v=Math.min(m.len/2,x.len/2),g=Math.abs(v*Math.sin(f)/Math.cos(f))):g=t,n=a.x+x.nx*v,s=a.y+x.ny*v,n+=-x.ny*g*d,s+=x.nx*g*d,i.absarc(n,s,g,m.ang+Math.PI/2*d,x.ang-Math.PI/2*d,h),o=a,a=l}i.closePath()},IF=(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},DF=(i,e)=>{let t=[new A(1,0,0),new A(0,1,0),new A(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Ae(n,3))},RF=i=>new Promise(e=>{new Ho().load(i,r=>e(r))}),OF=(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 BF,Df=new Promise(i=>{BF=i});var je;Df.then(i=>{je=i});var Kn=class{static build(i,e,t,r,n){let s,o,a;return i===void 0?(s=Kn.allocate(n,t),je.set_destination_refinement_level(s,0),o=Kn.buildLevel(s,!0,r)):i.positionWASM!==void 0?(e&&e!==0&&(je.free_bvh(e),je.free_subdivision_surface(e)),s=Kn.allocate(n,void 0,i),je.set_destination_refinement_level(s,0),o=Kn.buildLevel(s,!0,r)):s=e,i!==void 0&&i.subdivisions!==void 0&&(je.set_destination_refinement_level(s,i.subdivisions),i.subdivisions>0?a=Kn.buildLevel(s,!1,r):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var w;let r,n,s,o=[],a=[];if(t)r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM;else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let T=Fg.mergeVertices(e);r=T.attributes.position.array;let S=T.getIndex().array,M=S.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(M/3*2),s=new Uint8Array(M/6).fill(4);for(let G=0,R=0;G<M;G+=6)n[R++]=S[G],n[R++]=S[G+1],n[R++]=S[G+4],n[R++]=S[G+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let E,C,_;if(e.userData.type==="SphereGeometry")C=e.parameters.heightSegments,E=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(_=!0);else if(e.userData.type==="CylinderGeometry")C=e.parameters.heightSegments+2,E=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")C=e.parameters.heightSegments+1,E=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let G=e.userData.parameters;C=Math.ceil(G.tubularSegments*G.arc/(2*Math.PI))+2,E=G.radialSegments}else{let{pathSegments:G,segments:R,revolutions:U}=e.userData.parameters;C=Math.ceil(R*U)+2,E=G}_?(n=new Uint32Array(1*E*3+(C-1)*E*4),s=new Uint8Array(1*E+(C-1)*E)):(n=new Uint32Array(2*E*3+(C-2)*E*4),s=new Uint8Array(2*E+(C-2)*E));let O=0,P=0,D=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;P<3*E;)n[P++]=S[O++],n[P++]=S[O++],n[P++]=S[O++],s[D++]=3;let G=_?n.length:3*E+4*(C-2)*E;for(;P<G;O+=6)n[P++]=S[O],n[P++]=S[O+1],n[P++]=S[O+4],n[P++]=S[O+5],s[D++]=4}else for(;P<4*(C-2)*E;O+=6)n[P++]=S[O],n[P++]=S[O+1],n[P++]=S[O+4],n[P++]=S[O+5],s[D++]=4;for(;P<n.length;)n[P++]=S[O++],n[P++]=S[O++],n[P++]=S[O++],s[D++]=3;break;default:n=S,s=new Uint8Array(M/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,d=r.length+o.length+a.length,h=n.length+s.length,p=d*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=h*Uint32Array.BYTES_PER_ELEMENT,v=je._malloc(p),y=new Float32Array(je.HEAPF32.buffer,v,d),m=new Uint32Array(je.HEAPU32.buffer,v+f,h);y.set(r,0),y.set(o,r.length),y.set(a,r.length+o.length),m.set(n,0),m.set(s,n.length);let x;((w=t==null?void 0:t.scaleBaked)==null?void 0:w.some(T=>T!==1))&&(x=new Me().makeScale(...t.scaleBaked)),i&&(x?x.premultiply(i):x=i);let b=x?je.alloc_subdivision_surface2(v,l,v+f,c,v+f+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):je.alloc_subdivision_surface(v,l,v+f,c,v+f+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return je._free(v),b}static buildLevel(i,e,t,r,n){let s=n?je.get_mesh_data2(i,e?je.Level.CONTROL:je.Level.REFINED,t!=null?t:!e,n.elements):je.get_mesh_data(i,e?je.Level.CONTROL:je.Level.REFINED,t!=null?t:!e),o=8,a=je.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=je.HEAPU32[a[c]>>2],d=je.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=je.HEAPU32[a[c]>>2],p=je.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=je.HEAPU32[a[c]>>2],g=je.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let v=je.HEAPU32[a[c]>>2],y=je.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,r===void 0){let m=new _e;if(m.setIndex(new Ro(y,1)),m.setAttribute("position",new Ae(d,3)),m.setAttribute("normal",new Ae(p,3)),e){m.setAttribute("faceMap",new Ro(g,1));let x=new Float32Array(p.length/3*4).fill(0);m.setAttribute("color",new Fe(x,4))}return je.free_mesh_data(s),m.userData.type="SubdivGeometry",m}r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,je.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=je.get_wireframe_data_for_base_level(i),n=4,s=je.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=je.HEAPU32[s[a]>>2],c=je.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=je.HEAPU32[s[a]>>2],d=je.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let h=new _e;h.setAttribute("position",new Ae(c,3));let p=new Float32Array(c.length);for(let f=0,g=c.length;f<g;)p[f++]=t.r,p[f++]=t.g,p[f++]=t.b;return h.setAttribute("color",new Fe(p,3)),h.setIndex(new Ro(d,1)),je.free_wireframe_data_for_base_level(r),h}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,je.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||je.set_destination_refinement_level(i,1);let r=t?je.get_topological_data2(i,e?je.Level.CONTROL:je.Level.REFINED,t.elements):je.get_topological_data(i,e?je.Level.CONTROL:je.Level.REFINED),n=6,s=je.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=je.HEAPU32[s[a]>>2],c=new Float32Array(je.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=je.HEAPU32[s[a]>>2],d=new Uint32Array(je.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let h=je.HEAPU32[s[a]>>2],p=new Uint8Array(je.HEAPU32.subarray(h>>2,(h>>2)+o[a]));return je.free_topological_data(r),{positions:c,indices:d,verticesPerFace:p}}};var Ty={ConeGeometry:i1,CubeGeometry:s1,CylinderGeometry:r1,DodecahedronGeometry:a1,EllipseGeometry:T1,HelixGeometry:N1,IcosahedronGeometry:P1,LatheGeometry:I1,NonParametricGeometry:Nf,PolygonGeometry:R1,PyramidGeometry:O1,RectangleGeometry:Pf,SphereGeometry:F1,PlaneGeometry:G1,StarGeometry:z1,TextFrameGeometry:If,TorusGeometry:U1,TorusKnotGeometry:k1,TriangleGeometry:V1,VectorGeometry:jr},Rf=i=>Ty[i.type].create(i);var tn=class extends ve{constructor(e,t,r,n){super(e,t,r);this.a=n}setRGBA(e,t,r,n){super.setRGB(e,t,r),this.a=n}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};function sr(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 tn(0,0,0,0))}else return"a"in i?new tn(i.r,i.g,i.b,i.a):new tn(i.r,i.g,i.b,1);return t}var Of=i=>"isEntity"in i,Bf=i=>"isAbstractMesh"in i;var Ss=i=>"objectHelper"in i;function _y(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:oo.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&i.updateUp()}function FF(i,e){_y(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 j1(i,e,t){FF(i,e),e.color!==void 0&&(i.color=sr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof Vo)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof Vo)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&Ss(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 Vl=new rr,Wr=new A,ze=new A,wr=new Me;function GF(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 d=e.getX(u),h=e.getY(u),p=e.getZ(u);d<n&&(n=d),h<s&&(s=h),p<o&&(o=p),d>a&&(a=d),h>l&&(l=h),p>c&&(c=p)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var J1=(i,e,t,r)=>{var n;if(Bf(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Wr.copy(i.originalGeometry.boundingSphere.center):(GF(Vl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Vl.getCenter(Wr)),i.forceComputeSize?Vl.getSize(ze).multiplyScalar(.5):ze.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(Ss(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Vl.setFromArray(s.array),Vl.getCenter(Wr),Vl.getSize(ze).multiplyScalar(.5)}else Wr.setScalar(0),ze.setScalar(0);wr.copy(e).multiply(i.matrixWorld),ze.x===0&&ze.y===0&&ze.z===0?t.push(new A(Wr.x,Wr.y,Wr.z).applyMatrix4(wr)):t.push(new A(-ze.x,ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,-ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,-ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,-ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,-ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,ze.y,-ze.z).add(Wr).applyMatrix4(wr))},Ff=class extends rr{constructor(){super(...arguments);this.matrix=new Me;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new Me().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,t)}expandByObjectSize(e,t,r=!1){let n=[];return r===!0?e.traverseEntity(s=>J1(s,t,n,e.enableHelper===!0)):J1(e,t,n,e.enableHelper===!0),this.setFromPoints(n)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(wr.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(ze).multiplyScalar(.5),this.getCenter(Wr),wr.copy(this.matrix).setPosition(Wr),this.vertices=[new A(-ze.x,ze.y,ze.z).applyMatrix4(wr),new A(-ze.x,-ze.y,ze.z).applyMatrix4(wr),new A(ze.x,-ze.y,ze.z).applyMatrix4(wr),new A(ze.x,ze.y,ze.z).applyMatrix4(wr),new A(-ze.x,ze.y,-ze.z).applyMatrix4(wr),new A(-ze.x,-ze.y,-ze.z).applyMatrix4(wr),new A(ze.x,-ze.y,-ze.z).applyMatrix4(wr),new A(ze.x,ze.y,-ze.z).applyMatrix4(wr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new hn(this.vertices[0],this.vertices[3]),new hn(this.vertices[1],this.vertices[2]),new hn(this.vertices[5],this.vertices[6]),new hn(this.vertices[4],this.vertices[7]),new hn(this.vertices[0],this.vertices[1]),new hn(this.vertices[3],this.vertices[2]),new hn(this.vertices[7],this.vertices[6]),new hn(this.vertices[4],this.vertices[5]),new hn(this.vertices[0],this.vertices[4]),new hn(this.vertices[1],this.vertices[5]),new hn(this.vertices[2],this.vertices[6]),new hn(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new A().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new A().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new A().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new A().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new A().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new A().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function q1(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}var Gf=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 We=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=rt.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 We&&(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 X1=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}},Cr=new X1;var Xe=class extends We{constructor(e,t){super(e);this.scope="";t=t!=null?t:{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,r,n){if(t=t!=null?t:this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&this.uuid===void 0&&(this.uuid=rt.generateUUID()),r=e.getUUID(r!=null?r:this.getUUID(),!s);let o=e.getNodeData(r),a=o.output||this.getType(e);if(e.analyzing)return(o.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,o,t),this.generate(e,t,r)):super.build(e,t,r);if(s)return o.name=o.name||super.build(e,t,r),o.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||o.deps===1))return super.build(e,t,r);r=this.getUUID(!1);let l=this.getTemp(e,r);if(l)return e.format(l,a,t);{l=super.generate(e,t,r,o.output,n);let c=this.generate(e,a,r);return e.addNodeCode(l+" = "+c+";"),e.format(l,a,t)}}return super.build(e,t,r)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let r=e.getVars()[t];return r?r.name:void 0}generate(e,t,r,n,s){return this.getShared(e,t)||console.error("TempNode is not shared"),r=r!=null?r:this.uuid,e.getTempVar(r,n!=null?n:this.getType(e),s,this.getLabel()).name}};var qt=class extends Xe{constructor(e,t){t=t!=null?t:{},t.shared=t.shared!==void 0?t.shared:!1;super(e,t);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){let t=super.createJSONNode(e);return this.readonly===!0&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),e.readonly!==void 0&&this.setReadonly(e.readonly),this}generate(e,t,r,n,s,o){r=e.getUUID(r!=null?r:this.getUUID()),n=n!=null?n:this.getType(e);let a=e.getNodeData(r);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,r,n,s,o):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(n,this,s,o,this.getLabel())),e.format(a.vertex.name,n,t)):(a.fragment||(a.fragment=e.createFragmentUniform(n,this,s,o,this.getLabel())),e.format(a.fragment.name,n,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}};var Jr=class extends qt{constructor(e=0,t){super("v2");this.nodeType="Vector2";this.value=e instanceof F?e:new F(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,r,n,s,o){return e.format("vec2("+this.value.x+", "+this.value.y+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),this}};var qr=class extends qt{constructor(e=0,t,r){super("v3");this.nodeType="Vector3";this.value=e instanceof A?e:new A(e,t,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,r,n,s,o){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,t.z=this.value.z,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),e.z&&(this.value.z=e.z),this}};var Xi=class extends qt{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof tn?e:new tn(e.r,e.g,e.b,e.a)}generateReadonly(e,t,r,n,s,o){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var zF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Y1=/[a-z_0-9]+/gi,Ce=class extends Xe{constructor(e,t,r,n,s){super(s);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=s===void 0,this.isInterface=!1,this.parse(e,t,r,n)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,r,n,s){let o,a=0,l=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)e.include(this.includes[u],this);for(let u in this.extensions)e.extensions[u]=!0;let c=[];for(;o=Y1.exec(this.src);)c.push(o);for(let u=0;u<c.length;u++){let d=c[u],h=d[0],p=this.isMethod?!this.getInputByName(h):!0,f=h;if(this.keywords[h]||this.useKeywords&&p&&Cr.containsKeyword(h)){let g=this.keywords[h];if(!g){let v=Cr.getKeywordData(h);v.cache&&(g=e.keywords[h]),g=g||Cr.getKeyword(h,e),v.cache&&(e.keywords[h]=g)}f=g.build(e)}h!==f&&(l=l.substring(0,d.index+a)+f+l.substring(d.index+h.length+a),a+=f.length-h.length),this.getIncludeByName(f)===void 0&&Cr.contains(f)&&e.include(Cr.get(f))}return t==="source"?l:this.isMethod?(this.isInterface||e.include(this,void 0,l),this.name):e.format("( "+l+" )",this.getType(e),t)}parse(e,t,r,n){if(this.src=e||"",this.includes=t!=null?t:[],this.extensions=r!=null?r:{},this.keywords=n!=null?n:{},this.isMethod){let s=zF.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let o=s[3].match(Y1);if(o){let a=0;for(;a<o.length;){let l=o[a++],c;l==="in"||l==="out"||l==="inout"?c=o[a++]:(c=l,l="");let u=o[a++];this.inputs.push({name:u,type:c,qualifier:l})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(e){return super.copy(e),this.isMethod=e.isMethod,this.useKeywords=e.useKeywords,e.type!==void 0&&(this.type=e.type),this.parse(e.src,e.includes,e.extensions,e.keywords),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){t=this.createJSONNode(e),t.src=this.src,t.isMethod=this.isMethod,t.useKeywords=this.useKeywords,this.isMethod||(t.type=this.type),t.extensions=JSON.parse(JSON.stringify(this.extensions));let n={};for(let s in this.keywords)n[s]=this.keywords[s].toJSON(e).uuid;if(t.keywords=n,(r=this.includes)==null?void 0:r.length){let s=[];for(let o=0;o<this.includes.length;o++)s.push(this.includes[o].toJSON(e).uuid);t.includes=s}t.isMethod=this.isMethod,t.inputs=this.inputs}return t.nodeType=this.nodeType,t}fromJSON(e,t){if(super.fromJSON(e,t),e.inputs!==void 0&&(this.inputs=e.inputs),e.isMethod!==void 0&&(this.isMethod=e.isMethod),e.src&&(this.src=e.src),e.isMethod&&(this.isMethod=e.isMethod),e.useKeywords&&(this.useKeywords=e.useKeywords),e.type&&(this.type=e.type),e.extensions&&(this.extensions=e.extensions),e.keywords&&t){this.keywords={};for(let r in e.keywords)this.keywords[r]=t.getNode(e.keywords[r])}return e.includes&&t&&(this.includes=e.includes.map(r=>t.getNode(r))),this}};var UF=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,Ey=class extends Xe{constructor(e="",t){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Ey.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,r,n,s){this.src=e||"";let o,a,l="",c=UF.exec(e);this.useDefine=s!=null?s:this.src.charAt(0)==="#",c&&c.length>1?(a=c[1],o=c[2],l=c[3]):(o=this.src,a="f"),this.name=o,this.type=a,this.value=l}build(e,t){if(t==="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 e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,r,n,s){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src,t.useDefine=this.useDefine,t.value=this.value,t.name=this.name),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src),e.value&&(this.value=e.value),e.name&&(this.name=e.name),e.useDefine!==void 0&&(this.useDefine=e.useDefine),this}},ct=Ey;ct.PI="PI",ct.PI2="PI2",ct.RECIPROCAL_PI="RECIPROCAL_PI",ct.RECIPROCAL_PI2="RECIPROCAL_PI2",ct.LOG2="LOG2",ct.EPSILON="EPSILON";var kF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
3191
|
+
`)a=0,l-=s;else{let d=zP(u,n,a,l,t);a+=d.offsetX,o.push(d.path)}}return o}function zP(i,e,t,r,n){let s=n.glyphs[i]||n.glyphs["?"];if(!s){console.error('THREE.Font: character "'+i+'" does not exists in font family '+n.familyName+".");return}let o=new db,a,l,c,u,d,h,p,f;if(s.o){let g=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let v=0,y=g.length;v<y;)switch(g[v++]){case"m":a=g[v++]*e+t,l=g[v++]*e+r,o.moveTo(a,l);break;case"l":a=g[v++]*e+t,l=g[v++]*e+r,o.lineTo(a,l);break;case"q":c=g[v++]*e+t,u=g[v++]*e+r,d=g[v++]*e+t,h=g[v++]*e+r,o.quadraticCurveTo(d,h,c,u);break;case"b":c=g[v++]*e+t,u=g[v++]*e+r,d=g[v++]*e+t,h=g[v++]*e+r,p=g[v++]*e+t,f=g[v++]*e+r,o.bezierCurveTo(d,h,p,f,c,u);break}}return{offsetX:s.ha*e,path:o}}Zm.prototype.isFont=!0;var $m=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new Qh(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch(u){console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,n)}parse(e){return new Zm(e)}},rd,UP={getContext:function(){return rd===void 0&&(rd=new(window.AudioContext||window.webkitAudioContext)),rd},setContext:function(i){rd=i}},fb=class extends Rn{constructor(e){super(e)}load(e,t,r,n){let s=this,o=new Qh(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);UP.getContext().decodeAudioData(l,function(u){t(u)})}catch(l){n?n(l):console.error(l),s.manager.itemError(e)}},r,n)}},pb=class extends td{constructor(e,t,r=1){super(void 0,r);let n=new ve().set(e),s=new ve().set(t),o=new A(n.r,n.g,n.b),a=new A(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}};pb.prototype.isHemisphereLightProbe=!0;var mb=class extends td{constructor(e,t=1){super(void 0,t);let r=new ve().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}};mb.prototype.isAmbientLightProbe=!0;var eg=class{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=gb(),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=gb();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}};function gb(){return(typeof performance=="undefined"?Date:performance).now()}var yb=class extends Ze{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 vb=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}},xb=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){Ft.slerpFlat(e,t,e,t,e,r,n)}_slerpAdditive(e,t,r,n,s){let o=this._workIndex*s;Ft.multiplyQuaternionsFlat(e,o,e,t,e,r),Ft.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}}},tg="\\[\\]\\.:\\/",kP=new RegExp("["+tg+"]","g"),rg="[^"+tg+"]",VP="[^"+tg.replace("\\.","")+"]",HP=/((?:WC+[\/:])*)/.source.replace("WC",rg),jP=/(WCOD+)?/.source.replace("WCOD",VP),WP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rg),JP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rg),qP=new RegExp("^"+HP+jP+WP+JP+"$"),XP=["material","materials","bones"],bb=class{constructor(e,t,r){let n=r||lt.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()}},lt=class{constructor(e,t,r){this.path=t,this.parsedPath=r||lt.parseTrackName(t),this.node=lt.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 lt.Composite(e,t,r):new lt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(kP,"")}static parseTrackName(e){let t=qP.exec(e);if(!t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=r.nodeName&&r.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){let s=r.nodeName.substring(n+1);XP.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,n),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(!t||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.node[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=lt.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}};lt.Composite=bb;lt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};lt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};lt.prototype.GetterByBindingType=[lt.prototype._getValue_direct,lt.prototype._getValue_array,lt.prototype._getValue_arrayElement,lt.prototype._getValue_toArray];lt.prototype.SetterByBindingTypeAndVersioning=[[lt.prototype._setValue_direct,lt.prototype._setValue_direct_setNeedsUpdate,lt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_array,lt.prototype._setValue_array_setNeedsUpdate,lt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_arrayElement,lt.prototype._setValue_arrayElement_setNeedsUpdate,lt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[lt.prototype._setValue_fromArray,lt.prototype._setValue_fromArray_setNeedsUpdate,lt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var wb=class{constructor(){this.uuid=Hn(),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,d=arguments.length;u!==d;++u){let h=arguments[u],p=h.uuid,f=t[p];if(f===void 0){f=l++,t[p]=f,e.push(h);for(let g=0,v=o;g!==v;++g)s[g].push(new lt(h,r[g],n[g]))}else if(f<c){a=e[f];let g=--c,v=e[g];t[v.uuid]=f,e[f]=v,t[p]=g,e[g]=h;for(let y=0,m=o;y!==m;++y){let x=s[y],b=x[g],w=x[f];x[f]=b,w===void 0&&(w=new lt(h,r[y],n[y])),x[g]=w}}else e[f]!==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 d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let p=0,f=n;p!==f;++p){let g=r[p],v=g[d],y=g[u];g[u]=v,g[d]=y}}}this.nCachedObjects_=s}uncache(){let e=this._objects,t=this._indicesByUUID,r=this._bindings,n=r.length,s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){let c=arguments[a],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){let h=--s,p=e[h],f=--o,g=e[f];t[p.uuid]=d,e[d]=p,t[g.uuid]=h,e[h]=g,e.pop();for(let v=0,y=n;v!==y;++v){let m=r[v],x=m[h],b=m[f];m[d]=x,m[h]=b,m.pop()}}else{let h=--o,p=e[h];h>0&&(t[p.uuid]=d),e[d]=p,e.pop();for(let f=0,g=n;f!==g;++f){let v=r[f];v[d]=v[h],v.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_,d=new Array(c);n=s.length,r[e]=n,o.push(e),a.push(t),s.push(d);for(let h=u,p=l.length;h!==p;++h){let f=l[h];d[h]=new lt(f,e,t)}return d}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()}}};wb.prototype.isAnimationObjectGroup=!0;var Sb=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:Ta,endingEnd:Ta};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=mE,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 dx:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Bp:default:for(let u=0,d=l.length;u!==d;++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===gE;if(e===0)return s===-1?n:o&&(s&1)==1?t-n:n;if(r===pE){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=_a,n.endingEnd=_a):(e?n.endingStart=this.zeroSlopeAtStart?_a:Ta:n.endingStart=ah,t?n.endingEnd=this.zeroSlopeAtEnd?_a:Ta:n.endingEnd=ah)}_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}},Mb=class extends xr{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 d=0;d!==s;++d){let h=n[d],p=h.name,f=u[p];if(f!==void 0)o[d]=f;else{if(f=o[d],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,l,p));continue}let g=t&&t._propertyBindings[d].binding.parsedPath;f=new xb(lt.create(r,p,g),h.ValueTypeName,h.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,l,p),o[d]=f}a[d].resultBuffer=f.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 d=a.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],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 km(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"?Hm.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=Bp),l!==void 0){let d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===r)return d;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;let u=new Sb(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"?Hm.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,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,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))}};Mb.prototype._controlInterpolantsResultBuffer=new Float32Array(1);var Te=class{constructor(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}clone(){return new Te(this.value.clone===void 0?this.value:this.value.clone())}},Ab=class extends ds{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}};Ab.prototype.isInstancedInterleavedBuffer=!0;var Tb=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}};Tb.prototype.isGLBufferAttribute=!0;var ng=class{constructor(e,t,r=0,n=1/0){this.ray=new Ni(e,t),this.near=r,this.far=n,this.camera=null,this.layers=new Kp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){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&&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=!1,r=[]){return ig(e,this,r,t),r.sort(_b),r}intersectObjects(e,t=!1,r=[]){for(let n=0,s=e.length;n<s;n++)ig(e[n],this,r,t);return r.sort(_b),r}};function _b(i,e){return i.distance-e.distance}function ig(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++)ig(n[s],e,t,!0)}}var nd=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(){let e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,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(Br(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}};var Eb=new F,ll=class{constructor(e=new F(1/0,1/0),t=new F(-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=Eb.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 Eb.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)}};ll.prototype.isBox2=!0;var Cb=new A,id=new A,hn=class{constructor(e=new A,t=new A){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Cb.subVectors(e,this.start),id.subVectors(this.end,this.start);let r=id.dot(id),s=id.dot(Cb)/r;return t&&(s=Br(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)}},Lb=class extends Ze{constructor(e){super();this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}};Lb.prototype.isImmediateRenderObject=!0;var Nb=new A,sg=class extends Ze{constructor(e,t){super();this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;let r=new _e,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 Ae(n,3));let s=new un({fog:!1,toneMapped:!1});this.cone=new Fi(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),Nb.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Nb),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Ks=new A,sd=new Me,og=new Me,Pb=class extends Fi{constructor(e){let t=Ib(e),r=new _e,n=[],s=[],o=new ve(0,0,1),a=new ve(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 Ae(n,3)),r.setAttribute("color",new Ae(s,3));let l=new un({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");og.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){let a=t[s];a.parent&&a.parent.isBone&&(sd.multiplyMatrices(og,a.matrixWorld),Ks.setFromMatrixPosition(sd),n.setXYZ(o,Ks.x,Ks.y,Ks.z),sd.multiplyMatrices(og,a.parent.matrixWorld),Ks.setFromMatrixPosition(sd),n.setXYZ(o+1,Ks.x,Ks.y,Ks.z),o+=2)}r.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}};function Ib(i){let e=[];i&&i.isBone&&e.push(i);for(let t=0;t<i.children.length;t++)e.push.apply(e,Ib(i.children[t]));return e}var ag=class extends Wt{constructor(e,t,r){let n=new nl(t,4,2),s=new Pi({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 Db=class extends Fi{constructor(e=10,t=10,r=4473924,n=8947848){r=new ve(r),n=new ve(n);let s=t/2,o=e/t,a=e/2,l=[],c=[];for(let h=0,p=0,f=-a;h<=t;h++,f+=o){l.push(-a,0,f,a,0,f),l.push(f,0,-a,f,0,a);let g=h===s?r:n;g.toArray(c,p),p+=3,g.toArray(c,p),p+=3,g.toArray(c,p),p+=3,g.toArray(c,p),p+=3}let u=new _e;u.setAttribute("position",new Ae(l,3)),u.setAttribute("color",new Ae(c,3));let d=new un({vertexColors:!0,toneMapped:!1});super(u,d);this.type="GridHelper"}};var Rb=new A,od=new A,Ob=new A,lg=class extends Ze{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 _e;n.setAttribute("position",new Ae([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));let s=new un({fog:!1,toneMapped:!1});this.lightPlane=new Ys(n,s),this.add(this.lightPlane),n=new _e,n.setAttribute("position",new Ae([0,0,0,0,0,1],3)),this.targetLine=new Ys(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(){Rb.setFromMatrixPosition(this.light.matrixWorld),od.setFromMatrixPosition(this.light.target.matrixWorld),Ob.subVectors(od,Rb),this.lightPlane.lookAt(od),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(od),this.targetLine.scale.z=Ob.length()}},ad=new A,lr=new hi,mi=class extends Fi{constructor(e){let t=new _e,r=new un({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new ve(16755200),l=new ve(16711680),c=new ve(43775),u=new ve(16777215),d=new ve(3355443);h("n1","n2",a),h("n2","n4",a),h("n4","n3",a),h("n3","n1",a),h("f1","f2",a),h("f2","f4",a),h("f4","f3",a),h("f3","f1",a),h("n1","f1",a),h("n2","f2",a),h("n3","f3",a),h("n4","f4",a),h("p","n1",l),h("p","n2",l),h("p","n3",l),h("p","n4",l),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c),h("c","t",u),h("p","c",d),h("cn1","cn2",d),h("cn3","cn4",d),h("cf1","cf2",d),h("cf3","cf4",d);function h(f,g,v){p(f,v),p(g,v)}function p(f,g){n.push(0,0,0),s.push(g.r,g.g,g.b),o[f]===void 0&&(o[f]=[]),o[f].push(n.length/3-1)}t.setAttribute("position",new Ae(n,3)),t.setAttribute("color",new Ae(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;lr.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),pr("c",t,e,lr,0,0,-1),pr("t",t,e,lr,0,0,1),pr("n1",t,e,lr,-r,-n,-1),pr("n2",t,e,lr,r,-n,-1),pr("n3",t,e,lr,-r,n,-1),pr("n4",t,e,lr,r,n,-1),pr("f1",t,e,lr,-r,-n,1),pr("f2",t,e,lr,r,-n,1),pr("f3",t,e,lr,-r,n,1),pr("f4",t,e,lr,r,n,1),pr("u1",t,e,lr,r*.7,n*1.1,-1),pr("u2",t,e,lr,-r*.7,n*1.1,-1),pr("u3",t,e,lr,0,n*2,-1),pr("cf1",t,e,lr,-r,0,1),pr("cf2",t,e,lr,r,0,1),pr("cf3",t,e,lr,0,-n,1),pr("cf4",t,e,lr,0,n,1),pr("cn1",t,e,lr,-r,0,-1),pr("cn2",t,e,lr,r,0,-1),pr("cn3",t,e,lr,0,-n,-1),pr("cn4",t,e,lr,0,n,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function pr(i,e,t,r,n,s,o){ad.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],ad.x,ad.y,ad.z)}}var cl=class extends Fi{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 _e;s.setIndex(new Fe(r,1)),s.setAttribute("position",new Ae(n,3));super(s,new un({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 cg=class extends Fi{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 _e;n.setAttribute("position",new Ae(t,3)),n.setAttribute("color",new Ae(r,3));let s=new un({vertexColors:!0,toneMapped:!1});super(n,s);this.type="AxesHelper"}setColors(e,t,r){let n=new ve,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()}},YP=new Float32Array(1),_U=new Int32Array(YP.buffer);Dn.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(Dn.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Uc.prototype.fromPoints=function(i){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(i)};Db.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};Pb.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Rn.prototype.extractUrlBase=function(i){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),ub.extractUrlBase(i)};Rn.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.")}};ll.prototype.center=function(i){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(i)};ll.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()};ll.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};ll.prototype.size=function(i){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(i)};rr.prototype.center=function(i){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(i)};rr.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};rr.prototype.isIntersectionBox=function(i){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};rr.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};rr.prototype.size=function(i){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(i)};ln.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};xc.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};hn.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Dt.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Dt.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Dt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Dt.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),i.applyMatrix3(this)};Dt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Dt.prototype.getInverse=function(i){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};Me.prototype.extractPosition=function(i){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(i)};Me.prototype.flattenToArrayOffset=function(i,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(i,e)};Me.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new A().setFromMatrixColumn(this,3)};Me.prototype.setRotationFromQuaternion=function(i){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(i)};Me.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};Me.prototype.multiplyVector3=function(i){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.multiplyVector4=function(i){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};Me.prototype.rotateAxis=function(i){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),i.transformDirection(this)};Me.prototype.crossVector=function(i){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};Me.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};Me.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};Me.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};Me.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};Me.prototype.applyToBufferAttribute=function(i){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),i.applyMatrix4(this)};Me.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};Me.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)};Me.prototype.getInverse=function(i){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(i).invert()};xn.prototype.isIntersectionLine=function(i){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(i)};Ft.prototype.multiplyVector3=function(i){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),i.applyQuaternion(this)};Ft.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};Ni.prototype.isIntersectionBox=function(i){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(i)};Ni.prototype.isIntersectionPlane=function(i){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(i)};Ni.prototype.isIntersectionSphere=function(i){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(i)};nr.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};nr.prototype.barycoordFromPoint=function(i,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(i,e)};nr.prototype.midpoint=function(i){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(i)};nr.prototypenormal=function(i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(i)};nr.prototype.plane=function(i){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(i)};nr.barycoordFromPoint=function(i,e,t,r,n){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),nr.getBarycoord(i,e,t,r,n)};nr.normal=function(i,e,t,r){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),nr.getNormal(i,e,t,r)};Jn.prototype.extractAllPoints=function(i){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(i)};Jn.prototype.extrude=function(i){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new zo(this,i)};Jn.prototype.makeGeometry=function(i){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new rl(this,i)};F.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};F.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};F.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};A.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};A.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};A.prototype.getPositionFromMatrix=function(i){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(i)};A.prototype.getScaleFromMatrix=function(i){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(i)};A.prototype.getColumnFromMatrix=function(i,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,i)};A.prototype.applyProjection=function(i){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(i)};A.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};A.prototype.distanceToManhattan=function(i){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(i)};A.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Qe.prototype.fromAttribute=function(i,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(i,e,t)};Qe.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};Ze.prototype.getChildByName=function(i){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(i)};Ze.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};Ze.prototype.translate=function(i,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,i)};Ze.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};Ze.prototype.applyMatrix=function(i){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(Ze.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.")}}});Wt.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(Wt.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Fp},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.")}}});_m.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};dr.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(On.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(Fe.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===hh},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(hh)}}});Fe.prototype.setDynamic=function(i){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hh:hc),this};Fe.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Fe.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};_e.prototype.addIndex=function(i){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(i)};_e.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 Fe(arguments[1],arguments[2]))):i==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(i,e)};_e.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)};_e.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};_e.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};_e.prototype.removeAttribute=function(i){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(i)};_e.prototype.applyMatrix=function(i){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(i)};Object.defineProperties(_e.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}}});ds.prototype.setDynamic=function(i){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(i===!0?hh:hc),this};ds.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};zo.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};zo.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};zo.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};Gr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Te.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this};Object.defineProperties(Fr.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 ve}},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===qv}},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(Rt.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}}});_t.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)};_t.prototype.animate=function(i){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(i)};_t.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};_t.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};_t.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};_t.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};_t.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};_t.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};_t.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};_t.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};_t.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};_t.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};_t.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};_t.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};_t.prototype.enableScissorTest=function(i){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(i)};_t.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};_t.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};_t.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};_t.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};_t.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")};_t.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};_t.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};_t.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};_t.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};_t.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(_t.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?Lo:vr}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(u0.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(xt.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}}});yb.prototype.load=function(i){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");let e=this;return new fb().load(i,function(r){e.setBuffer(r)}),this};vb.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Nh.prototype.updateCubeMap=function(i,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(i,e)};Nh.prototype.clear=function(i,e,t,r){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(i,e,t,r)};Po.crossOrigin=void 0;Po.loadTexture=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");let n=new rb;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};Po.loadTextureCube=function(i,e,t,r){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");let n=new tb;n.setCrossOrigin(this.crossOrigin);let s=n.load(i,t,void 0,r);return e&&(s.mapping=e),s};Po.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Po.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:jv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=jv);var QP=()=>typeof window=="undefined"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),KP=()=>typeof window=="undefined"?!1:window.navigator.platform.toUpperCase().includes("MAC"),CU=QP(),Vc=KP();function Bb(i){return Array.isArray(i)?i:[i]}function Hc(i){return Vc?i.metaKey:i.ctrlKey}var ZP=typeof global=="object"&&global&&global.Object===Object&&global,ld=ZP;var $P=typeof self=="object"&&self&&self.Object===Object&&self,eI=ld||$P||Function("return this")(),cr=eI;var tI=cr.Symbol,dn=tI;var Fb=Object.prototype,rI=Fb.hasOwnProperty,nI=Fb.toString,jc=dn?dn.toStringTag:void 0;function iI(i){var e=rI.call(i,jc),t=i[jc];try{i[jc]=void 0;var r=!0}catch(s){}var n=nI.call(i);return r&&(e?i[jc]=t:delete i[jc]),n}var Gb=iI;var sI=Object.prototype,oI=sI.toString;function aI(i){return oI.call(i)}var zb=aI;var lI="[object Null]",cI="[object Undefined]",Ub=dn?dn.toStringTag:void 0;function uI(i){return i==null?i===void 0?cI:lI:Ub&&Ub in Object(i)?Gb(i):zb(i)}var Bn=uI;function hI(i){return i!=null&&typeof i=="object"}var Zr=hI;var dI="[object Symbol]";function fI(i){return typeof i=="symbol"||Zr(i)&&Bn(i)==dI}var Zs=fI;function pI(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 cd=pI;var mI=Array.isArray,zr=mI;var gI=1/0,kb=dn?dn.prototype:void 0,Vb=kb?kb.toString:void 0;function Hb(i){if(typeof i=="string")return i;if(zr(i))return cd(i,Hb)+"";if(Zs(i))return Vb?Vb.call(i):"";var e=i+"";return e=="0"&&1/i==-gI?"-0":e}var jb=Hb;var yI=/\s/;function vI(i){for(var e=i.length;e--&&yI.test(i.charAt(e)););return e}var Wb=vI;var xI=/^\s+/;function bI(i){return i&&i.slice(0,Wb(i)+1).replace(xI,"")}var Jb=bI;function wI(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var mr=wI;var qb=0/0,SI=/^[-+]0x[0-9a-f]+$/i,MI=/^0b[01]+$/i,AI=/^0o[0-7]+$/i,TI=parseInt;function _I(i){if(typeof i=="number")return i;if(Zs(i))return qb;if(mr(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=mr(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=Jb(i);var t=MI.test(i);return t||AI.test(i)?TI(i.slice(2),t?2:8):SI.test(i)?qb:+i}var ug=_I;function EI(i){return i}var ud=EI;var CI="[object AsyncFunction]",LI="[object Function]",NI="[object GeneratorFunction]",PI="[object Proxy]";function II(i){if(!mr(i))return!1;var e=Bn(i);return e==LI||e==NI||e==CI||e==PI}var ul=II;var DI=cr["__core-js_shared__"],hd=DI;var Xb=function(){var i=/[^.]+$/.exec(hd&&hd.keys&&hd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function RI(i){return!!Xb&&Xb in i}var Yb=RI;var OI=Function.prototype,BI=OI.toString;function FI(i){if(i!=null){try{return BI.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var ms=FI;var GI=/[\\^$.*+?()[\]{}|]/g,zI=/^\[object .+?Constructor\]$/,UI=Function.prototype,kI=Object.prototype,VI=UI.toString,HI=kI.hasOwnProperty,jI=RegExp("^"+VI.call(HI).replace(GI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function WI(i){if(!mr(i)||Yb(i))return!1;var e=ul(i)?jI:zI;return e.test(ms(i))}var Qb=WI;function JI(i,e){return i==null?void 0:i[e]}var Kb=JI;function qI(i,e){var t=Kb(i,e);return Qb(t)?t:void 0}var Sn=qI;var XI=Sn(cr,"WeakMap"),dd=XI;var Zb=Object.create,YI=function(){function i(){}return function(e){if(!mr(e))return{};if(Zb)return Zb(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),$b=YI;function QI(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 ew=QI;function KI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var fd=KI;var ZI=800,$I=16,eD=Date.now;function tD(i){var e=0,t=0;return function(){var r=eD(),n=$I-(r-t);if(t=r,n>0){if(++e>=ZI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var tw=tD;function rD(i){return function(){return i}}var rw=rD;var nD=function(){try{var i=Sn(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),hl=nD;var iD=hl?function(i,e){return hl(i,"toString",{configurable:!0,enumerable:!1,value:rw(e),writable:!0})}:ud,nw=iD;var sD=tw(nw),pd=sD;function oD(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var iw=oD;var aD=9007199254740991,lD=/^(?:0|[1-9]\d*)$/;function cD(i,e){var t=typeof i;return e=e==null?aD:e,!!e&&(t=="number"||t!="symbol"&&lD.test(i))&&i>-1&&i%1==0&&i<e}var md=cD;function uD(i,e,t){e=="__proto__"&&hl?hl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var dl=uD;function hD(i,e){return i===e||i!==i&&e!==e}var $s=hD;var dD=Object.prototype,fD=dD.hasOwnProperty;function pD(i,e,t){var r=i[e];(!(fD.call(i,e)&&$s(r,t))||t===void 0&&!(e in i))&&dl(i,e,t)}var gd=pD;function mD(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?dl(t,a,l):gd(t,a,l)}return t}var qn=mD;var sw=Math.max;function gD(i,e,t){return e=sw(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=sw(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),ew(i,this,a)}}var yd=gD;function yD(i,e){return pd(yd(i,e,ud),i+"")}var ow=yD;var vD=9007199254740991;function xD(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=vD}var vd=xD;function bD(i){return i!=null&&vd(i.length)&&!ul(i)}var eo=bD;function wD(i,e,t){if(!mr(t))return!1;var r=typeof e;return(r=="number"?eo(t)&&md(e,t.length):r=="string"&&e in t)?$s(t[e],i):!1}var aw=wD;function SD(i){return ow(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&&aw(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 lw=SD;var MD=Object.prototype;function AD(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||MD;return i===t}var fl=AD;function TD(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var cw=TD;var _D="[object Arguments]";function ED(i){return Zr(i)&&Bn(i)==_D}var hg=ED;var uw=Object.prototype,CD=uw.hasOwnProperty,LD=uw.propertyIsEnumerable,ND=hg(function(){return arguments}())?hg:function(i){return Zr(i)&&CD.call(i,"callee")&&!LD.call(i,"callee")},jo=ND;function PD(){return!1}var hw=PD;var dw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fw=dw&&typeof module=="object"&&module&&!module.nodeType&&module,ID=fw&&fw.exports===dw,pw=ID?cr.Buffer:void 0,DD=pw?pw.isBuffer:void 0,RD=DD||hw,pl=RD;var OD="[object Arguments]",BD="[object Array]",FD="[object Boolean]",GD="[object Date]",zD="[object Error]",UD="[object Function]",kD="[object Map]",VD="[object Number]",HD="[object Object]",jD="[object RegExp]",WD="[object Set]",JD="[object String]",qD="[object WeakMap]",XD="[object ArrayBuffer]",YD="[object DataView]",QD="[object Float32Array]",KD="[object Float64Array]",ZD="[object Int8Array]",$D="[object Int16Array]",eR="[object Int32Array]",tR="[object Uint8Array]",rR="[object Uint8ClampedArray]",nR="[object Uint16Array]",iR="[object Uint32Array]",Jt={};Jt[QD]=Jt[KD]=Jt[ZD]=Jt[$D]=Jt[eR]=Jt[tR]=Jt[rR]=Jt[nR]=Jt[iR]=!0;Jt[OD]=Jt[BD]=Jt[XD]=Jt[FD]=Jt[YD]=Jt[GD]=Jt[zD]=Jt[UD]=Jt[kD]=Jt[VD]=Jt[HD]=Jt[jD]=Jt[WD]=Jt[JD]=Jt[qD]=!1;function sR(i){return Zr(i)&&vd(i.length)&&!!Jt[Bn(i)]}var mw=sR;function oR(i){return function(e){return i(e)}}var ml=oR;var gw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wc=gw&&typeof module=="object"&&module&&!module.nodeType&&module,aR=Wc&&Wc.exports===gw,dg=aR&&ld.process,lR=function(){try{var i=Wc&&Wc.require&&Wc.require("util").types;return i||dg&&dg.binding&&dg.binding("util")}catch(e){}}(),gs=lR;var yw=gs&&gs.isTypedArray,cR=yw?ml(yw):mw,xd=cR;var uR=Object.prototype,hR=uR.hasOwnProperty;function dR(i,e){var t=zr(i),r=!t&&jo(i),n=!t&&!r&&pl(i),s=!t&&!r&&!n&&xd(i),o=t||r||n||s,a=o?cw(i.length,String):[],l=a.length;for(var c in i)(e||hR.call(i,c))&&!(o&&(c=="length"||n&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||md(c,l)))&&a.push(c);return a}var bd=dR;function fR(i,e){return function(t){return i(e(t))}}var wd=fR;var pR=wd(Object.keys,Object),vw=pR;var mR=Object.prototype,gR=mR.hasOwnProperty;function yR(i){if(!fl(i))return vw(i);var e=[];for(var t in Object(i))gR.call(i,t)&&t!="constructor"&&e.push(t);return e}var xw=yR;function vR(i){return eo(i)?bd(i):xw(i)}var gl=vR;function xR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var bw=xR;var bR=Object.prototype,wR=bR.hasOwnProperty;function SR(i){if(!mr(i))return bw(i);var e=fl(i),t=[];for(var r in i)r=="constructor"&&(e||!wR.call(i,r))||t.push(r);return t}var ww=SR;function MR(i){return eo(i)?bd(i,!0):ww(i)}var zi=MR;var AR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,TR=/^\w*$/;function _R(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Zs(i)?!0:TR.test(i)||!AR.test(i)||e!=null&&i in Object(e)}var Sw=_R;var ER=Sn(Object,"create"),ys=ER;function CR(){this.__data__=ys?ys(null):{},this.size=0}var Mw=CR;function LR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Aw=LR;var NR="__lodash_hash_undefined__",PR=Object.prototype,IR=PR.hasOwnProperty;function DR(i){var e=this.__data__;if(ys){var t=e[i];return t===NR?void 0:t}return IR.call(e,i)?e[i]:void 0}var Tw=DR;var RR=Object.prototype,OR=RR.hasOwnProperty;function BR(i){var e=this.__data__;return ys?e[i]!==void 0:OR.call(e,i)}var _w=BR;var FR="__lodash_hash_undefined__";function GR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=ys&&e===void 0?FR:e,this}var Ew=GR;function yl(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])}}yl.prototype.clear=Mw;yl.prototype.delete=Aw;yl.prototype.get=Tw;yl.prototype.has=_w;yl.prototype.set=Ew;var fg=yl;function zR(){this.__data__=[],this.size=0}var Cw=zR;function UR(i,e){for(var t=i.length;t--;)if($s(i[t][0],e))return t;return-1}var to=UR;var kR=Array.prototype,VR=kR.splice;function HR(i){var e=this.__data__,t=to(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():VR.call(e,t,1),--this.size,!0}var Lw=HR;function jR(i){var e=this.__data__,t=to(e,i);return t<0?void 0:e[t][1]}var Nw=jR;function WR(i){return to(this.__data__,i)>-1}var Pw=WR;function JR(i,e){var t=this.__data__,r=to(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var Iw=JR;function vl(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])}}vl.prototype.clear=Cw;vl.prototype.delete=Lw;vl.prototype.get=Nw;vl.prototype.has=Pw;vl.prototype.set=Iw;var ro=vl;var qR=Sn(cr,"Map"),no=qR;function XR(){this.size=0,this.__data__={hash:new fg,map:new(no||ro),string:new fg}}var Dw=XR;function YR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Rw=YR;function QR(i,e){var t=i.__data__;return Rw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var io=QR;function KR(i){var e=io(this,i).delete(i);return this.size-=e?1:0,e}var Ow=KR;function ZR(i){return io(this,i).get(i)}var Bw=ZR;function $R(i){return io(this,i).has(i)}var Fw=$R;function eO(i,e){var t=io(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var Gw=eO;function xl(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])}}xl.prototype.clear=Dw;xl.prototype.delete=Ow;xl.prototype.get=Bw;xl.prototype.has=Fw;xl.prototype.set=Gw;var Jc=xl;var tO="Expected a function";function pg(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(tO);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(pg.Cache||Jc),t}pg.Cache=Jc;var zw=pg;var rO=500;function nO(i){var e=zw(i,function(r){return t.size===rO&&t.clear(),r}),t=e.cache;return e}var Uw=nO;var iO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,sO=/\\(\\)?/g,oO=Uw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(iO,function(t,r,n,s){e.push(n?s.replace(sO,"$1"):r||t)}),e}),kw=oO;function aO(i){return i==null?"":jb(i)}var Vw=aO;function lO(i,e){return zr(i)?i:Sw(i,e)?[i]:kw(Vw(i))}var bl=lO;var cO=1/0;function uO(i){if(typeof i=="string"||Zs(i))return i;var e=i+"";return e=="0"&&1/i==-cO?"-0":e}var Sd=uO;function hO(i,e){e=bl(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[Sd(e[t++])];return t&&t==r?i:void 0}var Hw=hO;function dO(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var wl=dO;var jw=dn?dn.isConcatSpreadable:void 0;function fO(i){return zr(i)||jo(i)||!!(jw&&i&&i[jw])}var Ww=fO;function Jw(i,e,t,r,n){var s=-1,o=i.length;for(t||(t=Ww),n||(n=[]);++s<o;){var a=i[s];e>0&&t(a)?e>1?Jw(a,e-1,t,r,n):wl(n,a):r||(n[n.length]=a)}return n}var qw=Jw;function pO(i){var e=i==null?0:i.length;return e?qw(i,1):[]}var Xw=pO;function mO(i){return pd(yd(i,void 0,Xw),i+"")}var Yw=mO;var gO=wd(Object.getPrototypeOf,Object),Sl=gO;var yO="[object Object]",vO=Function.prototype,xO=Object.prototype,Qw=vO.toString,bO=xO.hasOwnProperty,wO=Qw.call(Object);function SO(i){if(!Zr(i)||Bn(i)!=yO)return!1;var e=Sl(i);if(e===null)return!0;var t=bO.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Qw.call(t)==wO}var Md=SO;function MO(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 Kw=MO;function AO(){this.__data__=new ro,this.size=0}var Zw=AO;function TO(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var $w=TO;function _O(i){return this.__data__.get(i)}var eS=_O;function EO(i){return this.__data__.has(i)}var tS=EO;var CO=200;function LO(i,e){var t=this.__data__;if(t instanceof ro){var r=t.__data__;if(!no||r.length<CO-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new Jc(r)}return t.set(i,e),this.size=t.size,this}var rS=LO;function Ml(i){var e=this.__data__=new ro(i);this.size=e.size}Ml.prototype.clear=Zw;Ml.prototype.delete=$w;Ml.prototype.get=eS;Ml.prototype.has=tS;Ml.prototype.set=rS;var Ad=Ml;function NO(i,e){return i&&qn(e,gl(e),i)}var nS=NO;function PO(i,e){return i&&qn(e,zi(e),i)}var iS=PO;var sS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oS=sS&&typeof module=="object"&&module&&!module.nodeType&&module,IO=oS&&oS.exports===sS,aS=IO?cr.Buffer:void 0,lS=aS?aS.allocUnsafe:void 0;function DO(i,e){if(e)return i.slice();var t=i.length,r=lS?lS(t):new i.constructor(t);return i.copy(r),r}var Td=DO;function RO(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 cS=RO;function OO(){return[]}var _d=OO;var BO=Object.prototype,FO=BO.propertyIsEnumerable,uS=Object.getOwnPropertySymbols,GO=uS?function(i){return i==null?[]:(i=Object(i),cS(uS(i),function(e){return FO.call(i,e)}))}:_d,Al=GO;function zO(i,e){return qn(i,Al(i),e)}var hS=zO;var UO=Object.getOwnPropertySymbols,kO=UO?function(i){for(var e=[];i;)wl(e,Al(i)),i=Sl(i);return e}:_d,Ed=kO;function VO(i,e){return qn(i,Ed(i),e)}var dS=VO;function HO(i,e,t){var r=e(i);return zr(i)?r:wl(r,t(i))}var Cd=HO;function jO(i){return Cd(i,gl,Al)}var fS=jO;function WO(i){return Cd(i,zi,Ed)}var Ld=WO;var JO=Sn(cr,"DataView"),Nd=JO;var qO=Sn(cr,"Promise"),Pd=qO;var XO=Sn(cr,"Set"),Id=XO;var pS="[object Map]",YO="[object Object]",mS="[object Promise]",gS="[object Set]",yS="[object WeakMap]",vS="[object DataView]",QO=ms(Nd),KO=ms(no),ZO=ms(Pd),$O=ms(Id),eB=ms(dd),Wo=Bn;(Nd&&Wo(new Nd(new ArrayBuffer(1)))!=vS||no&&Wo(new no)!=pS||Pd&&Wo(Pd.resolve())!=mS||Id&&Wo(new Id)!=gS||dd&&Wo(new dd)!=yS)&&(Wo=function(i){var e=Bn(i),t=e==YO?i.constructor:void 0,r=t?ms(t):"";if(r)switch(r){case QO:return vS;case KO:return pS;case ZO:return mS;case $O:return gS;case eB:return yS}return e});var Tl=Wo;var tB=Object.prototype,rB=tB.hasOwnProperty;function nB(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&rB.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var xS=nB;var iB=cr.Uint8Array,mg=iB;function sB(i){var e=new i.constructor(i.byteLength);return new mg(e).set(new mg(i)),e}var _l=sB;function oB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var bS=oB;var aB=/\w*$/;function lB(i){var e=new i.constructor(i.source,aB.exec(i));return e.lastIndex=i.lastIndex,e}var wS=lB;var SS=dn?dn.prototype:void 0,MS=SS?SS.valueOf:void 0;function cB(i){return MS?Object(MS.call(i)):{}}var AS=cB;function uB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=uB;var hB="[object Boolean]",dB="[object Date]",fB="[object Map]",pB="[object Number]",mB="[object RegExp]",gB="[object Set]",yB="[object String]",vB="[object Symbol]",xB="[object ArrayBuffer]",bB="[object DataView]",wB="[object Float32Array]",SB="[object Float64Array]",MB="[object Int8Array]",AB="[object Int16Array]",TB="[object Int32Array]",_B="[object Uint8Array]",EB="[object Uint8ClampedArray]",CB="[object Uint16Array]",LB="[object Uint32Array]";function NB(i,e,t){var r=i.constructor;switch(e){case xB:return _l(i);case hB:case dB:return new r(+i);case bB:return bS(i,t);case wB:case SB:case MB:case AB:case TB:case _B:case EB:case CB:case LB:return Dd(i,t);case fB:return new r;case pB:case yB:return new r(i);case mB:return wS(i);case gB:return new r;case vB:return AS(i)}}var TS=NB;function PB(i){return typeof i.constructor=="function"&&!fl(i)?$b(Sl(i)):{}}var Rd=PB;var IB="[object Map]";function DB(i){return Zr(i)&&Tl(i)==IB}var _S=DB;var ES=gs&&gs.isMap,RB=ES?ml(ES):_S,CS=RB;var OB="[object Set]";function BB(i){return Zr(i)&&Tl(i)==OB}var LS=BB;var NS=gs&&gs.isSet,FB=NS?ml(NS):LS,PS=FB;var GB=1,zB=2,UB=4,IS="[object Arguments]",kB="[object Array]",VB="[object Boolean]",HB="[object Date]",jB="[object Error]",DS="[object Function]",WB="[object GeneratorFunction]",JB="[object Map]",qB="[object Number]",RS="[object Object]",XB="[object RegExp]",YB="[object Set]",QB="[object String]",KB="[object Symbol]",ZB="[object WeakMap]",$B="[object ArrayBuffer]",e3="[object DataView]",t3="[object Float32Array]",r3="[object Float64Array]",n3="[object Int8Array]",i3="[object Int16Array]",s3="[object Int32Array]",o3="[object Uint8Array]",a3="[object Uint8ClampedArray]",l3="[object Uint16Array]",c3="[object Uint32Array]",Vt={};Vt[IS]=Vt[kB]=Vt[$B]=Vt[e3]=Vt[VB]=Vt[HB]=Vt[t3]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[s3]=Vt[JB]=Vt[qB]=Vt[RS]=Vt[XB]=Vt[YB]=Vt[QB]=Vt[KB]=Vt[o3]=Vt[a3]=Vt[l3]=Vt[c3]=!0;Vt[jB]=Vt[DS]=Vt[ZB]=!1;function Od(i,e,t,r,n,s){var o,a=e&GB,l=e&zB,c=e&UB;if(t&&(o=n?t(i,r,n,s):t(i)),o!==void 0)return o;if(!mr(i))return i;var u=zr(i);if(u){if(o=xS(i),!a)return fd(i,o)}else{var d=Tl(i),h=d==DS||d==WB;if(pl(i))return Td(i,a);if(d==RS||d==IS||h&&!n){if(o=l||h?{}:Rd(i),!a)return l?dS(i,iS(o,i)):hS(i,nS(o,i))}else{if(!Vt[d])return n?i:{};o=TS(i,d,a)}}s||(s=new Ad);var p=s.get(i);if(p)return p;s.set(i,o),PS(i)?i.forEach(function(v){o.add(Od(v,e,t,v,i,s))}):CS(i)&&i.forEach(function(v,y){o.set(y,Od(v,e,t,y,i,s))});var f=c?l?Ld:fS:l?zi:gl,g=u?void 0:f(i);return iw(g||i,function(v,y){g&&(y=v,v=i[y]),gd(o,y,Od(v,e,t,y,i,s))}),o}var Bd=Od;var u3=1,h3=4;function d3(i){return Bd(i,u3|h3)}var gg=d3;function f3(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 OS=f3;var p3=OS(),BS=p3;var m3=function(){return cr.Date.now()},Fd=m3;var g3="Expected a function",y3=Math.max,v3=Math.min;function x3(i,e,t){var r,n,s,o,a,l,c=0,u=!1,d=!1,h=!0;if(typeof i!="function")throw new TypeError(g3);e=ug(e)||0,mr(t)&&(u=!!t.leading,d="maxWait"in t,s=d?y3(ug(t.maxWait)||0,e):s,h="trailing"in t?!!t.trailing:h);function p(T){var S=r,M=n;return r=n=void 0,c=T,o=i.apply(M,S),o}function f(T){return c=T,a=setTimeout(y,e),u?p(T):o}function g(T){var S=T-l,M=T-c,E=e-S;return d?v3(E,s-M):E}function v(T){var S=T-l,M=T-c;return l===void 0||S>=e||S<0||d&&M>=s}function y(){var T=Fd();if(v(T))return m(T);a=setTimeout(y,g(T))}function m(T){return a=void 0,h&&r?p(T):(r=n=void 0,o)}function x(){a!==void 0&&clearTimeout(a),c=0,r=l=n=a=void 0}function b(){return a===void 0?o:m(Fd())}function w(){var T=Fd(),S=v(T);if(r=arguments,n=this,l=T,S){if(a===void 0)return f(l);if(d)return clearTimeout(a),a=setTimeout(y,e),p(l)}return a===void 0&&(a=setTimeout(y,e)),o}return w.cancel=x,w.flush=b,w}var qc=x3;function b3(i,e,t){(t!==void 0&&!$s(i[e],t)||t===void 0&&!(e in i))&&dl(i,e,t)}var Xc=b3;function w3(i){return Zr(i)&&eo(i)}var FS=w3;function S3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Yc=S3;function M3(i){return qn(i,zi(i))}var GS=M3;function A3(i,e,t,r,n,s,o){var a=Yc(i,t),l=Yc(e,t),c=o.get(l);if(c){Xc(i,t,c);return}var u=s?s(a,l,t+"",i,e,o):void 0,d=u===void 0;if(d){var h=zr(l),p=!h&&pl(l),f=!h&&!p&&xd(l);u=l,h||p||f?zr(a)?u=a:FS(a)?u=fd(a):p?(d=!1,u=Td(l,!0)):f?(d=!1,u=Dd(l,!0)):u=[]:Md(l)||jo(l)?(u=a,jo(a)?u=GS(a):(!mr(a)||ul(a))&&(u=Rd(l))):d=!1}d&&(o.set(l,u),n(u,l,r,s,o),o.delete(l)),Xc(i,t,u)}var zS=A3;function US(i,e,t,r,n){i!==e&&BS(e,function(s,o){if(n||(n=new Ad),mr(s))zS(i,e,o,t,US,r,n);else{var a=r?r(Yc(i,o),s,o+"",i,e,n):void 0;a===void 0&&(a=s),Xc(i,o,a)}},zi)}var kS=US;function T3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var VS=T3;function _3(i,e){return e.length<2?i:Hw(i,Kw(e,0,-1))}var HS=_3;var E3=lw(function(i,e,t){kS(i,e,t)}),Jo=E3;function C3(i,e){return e=bl(e,i),i=HS(i,e),i==null||delete i[Sd(VS(e))]}var jS=C3;function L3(i){return Md(i)?void 0:i}var WS=L3;var N3=1,P3=2,I3=4,D3=Yw(function(i,e){var t={};if(i==null)return t;var r=!1;e=cd(e,function(s){return s=bl(s,i),r||(r=s.length>1),s}),qn(i,Ld(i),t),r&&(t=Bd(t,N3|P3|I3,WS));for(var n=e.length;n--;)jS(t,e[n]);return t}),El=D3;var so;(function(t){t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(so||(so={}));var qo;(function(n){n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:5e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-5e5,zoom:1},up:n.DefaultUp,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(qo||(qo={}));var Cl;(function(r){r.x="x",r.y="y",r.z="z"})(Cl||(Cl={}));var JS;(function(s){s.Top="top",s.Right="right",s.Bottom="bottom",s.Left="left",s.Center="center"})(JS||(JS={}));var Ll;(function(r){function i(n,s){return n[0]===s[0]&&n[1]===s[1]&&n[2]===s[2]}r.isEqual=i;function e(n,s){return[n[0]+s[0],n[1]+s[1],n[2]+s[2]]}r.add=e;function t(n,s){return[n[0]-s[0],n[1]-s[1],n[2]-s[2]]}r.sub=t})(Ll||(Ll={}));var oo;(function(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 d=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])*d,l[c+1]=(o[1]*a[c]+o[5]*a[c+1]+o[9]*a[c+2]+o[13])*d,l[c+2]=(o[2]*a[c]+o[6]*a[c+1]+o[10]*a[c+2]+o[14])*d}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})(oo||(oo={}));var Ur;(function(a){a.white={r:1,g:1,b:1},a.red={r:1,g:0,b:0},a.black={r:0,g:0,b:0};function r(l){return{r:Math.round(l.r*255),g:Math.round(l.g*255),b:Math.round(l.b*255),a:1}}a.toRgb255a1=r;function n(l){return{r:l.r,g:l.g,b:l.b}}a.clone=n;function s(l){return l=Math.floor(l),{r:(l>>16&255)/255,g:(l>>8&255)/255,b:(l&255)/255}}a.fromHex=s;function o(l,c){return l.r===c.r&&l.g===c.g&&l.b===c.b}a.equals=o})(Ur||(Ur={}));var Ui;(function(s){s.white=xe(re({},Ur.white),{a:1});function e(o){return{r:o[0],g:o[1],b:o[2],a:o[3]}}s.from0to1=e;function t(o,a){return xe(re({},Ur.fromHex(o)),{a})}s.fromHexAndA=t;function r(o){return{r:Math.round(o.r*255),g:Math.round(o.g*255),b:Math.round(o.b*255),a:o.a}}s.toRgb255a1=r;function n(o,a){return Ur.equals(o,a)&&o.a===a.a}s.equals=n})(Ui||(Ui={}));var Gd;(function(e){e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}})(Gd||(Gd={}));var qS;(function(x){x[x.SKIP=0]="SKIP",x[x.ADD=1]="ADD",x[x.ALPHA=2]="ALPHA",x[x.AVERAGE=3]="AVERAGE",x[x.COLOR_BURN=4]="COLOR_BURN",x[x.COLOR_DODGE=5]="COLOR_DODGE",x[x.DARKEN=6]="DARKEN",x[x.DIFFERENCE=7]="DIFFERENCE",x[x.EXCLUSION=8]="EXCLUSION",x[x.LIGHTEN=9]="LIGHTEN",x[x.MULTIPLY=10]="MULTIPLY",x[x.DIVIDE=11]="DIVIDE",x[x.NEGATION=12]="NEGATION",x[x.NORMAL=13]="NORMAL",x[x.OVERLAY=14]="OVERLAY",x[x.REFLECT=15]="REFLECT",x[x.SCREEN=16]="SCREEN",x[x.SOFT_LIGHT=17]="SOFT_LIGHT",x[x.SUBTRACT=18]="SUBTRACT"})(qS||(qS={}));var Qc;(function(a){a[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING"})(Qc||(Qc={}));var XS;(function(e){e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}})(XS||(XS={}));var YS;(function(e){e.defaultData={control1:[.5,.05],control2:[.1,.3]}})(YS||(YS={}));var zd;(function(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:Cl.y,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[0,0,0],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})(zd||(zd={}));var vs;(function(e){e[e.Update=0]="Update"})(vs||(vs={}));var Xn;(function(r){r[r.Add=1]="Add",r[r.Delete=2]="Delete",r[r.Unlink=3]="Unlink"})(Xn||(Xn={}));var Fn;(function(r){r[r.Add=4]="Add",r[r.Delete=5]="Delete",r[r.Move=6]="Move"})(Fn||(Fn={}));var Mn;(function(r){r[r.Add=7]="Add",r[r.Delete=8]="Delete",r[r.Move=9]="Move"})(Mn||(Mn={}));var gi=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=xe(re({},r),{[e]:t});return Object.setPrototypeOf(s,gi.prototype),s}}add(e,t){var n;let r=this.runOp({type:Xn.Add,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===Xn.Add){let r=t[e.id],n;r===void 0?n={type:Xn.Delete,id:e.id}:n={type:Xn.Add,id:e.id,data:r};let{id:s,data:o}=e,a=xe(re({},t),{[s]:o});return Object.setPrototypeOf(a,gi.prototype),{data:a,actual:e,reverse:n}}else if(e.type===Xn.Delete){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=re({},t);return Object.setPrototypeOf(s,gi.prototype),delete s[r],{data:s,actual:e,reverse:{type:Xn.Add,id:r,data:n}}}}throw new Error("illegal arg")}};function Kc(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"&&Kc(r)}return Object.freeze(i)}function QS(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 yg=class extends Error{};function ki(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 KS(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 ZS(){return typeof process!="undefined"}function $S(i,e){for(let t of i)e(t.id,t.data),$S(t.children,e)}function eM(i,e){e(i.id,i.data);for(let t of i.children)eM(t,e)}var yi=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,yi.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Kc(this[e]),e++}fillCaches0(e,t){var r;if((r=this.objCaches)==null?void 0:r.has(e.id))throw new Error("duplicated item");this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let n of e.children)this.fillCaches0(n,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}isDescendantOf(e,t){for(;e;){let r=this.parent(e);if(r===t)return!0;e=r}return!1}data(e){var t;return(t=this.get(e))==null?void 0:t.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){var t;return e===null?this:(t=this.get(e))==null?void 0:t.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let r=this.get(e);r&&eM(r,t)}}traverse(e){$S(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this.parent(e),s=this.childrenArray(n),o=s.findIndex(c=>c.id===e);if(o<0)throw new Error("not expected");let a=s[o];return s=[...s],s[o]=xe(re({},a),{data:t}),this.modifyArrayBy(n,s)}}modifyArrayBy(e,t){let r=e,n=t;for(;r!==null;){let o=n,a=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let l=n.findIndex(c=>c.id===a);if(l<0)throw new Error;n=[...n],n[l]=xe(re({},n[l]),{children:o})}Object.setPrototypeOf(n,yi.prototype);let s=n;return s.fillCaches(),s}runOp(e){switch(e.type){case Mn.Add:return this.addOp(e);case Mn.Delete:return this.deleteOp(e);case Mn.Move:return this.moveOp(e)}}addOp(e){let{parent:t,fi:r,id:n,data:s,children:o}=e;if(t!==null&&this.get(t)===void 0)return null;if(this.get(n)!==void 0)return null;{let a=t,l=this.childrenArray(a),c={fi:r,id:n,data:s,children:o};return l=[...l,c],l.sort((d,h)=>d.fi-h.fi),e.localIndex=l.indexOf(c),{data:this.modifyArrayBy(a,l),actual:e,reverse:{type:Mn.Delete,id:n}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let r=this.parent(t);if(r===void 0)return null;let n=this.childrenArray(r),s=n.findIndex(l=>l.id===t);e.localIndex=s,n=[...n];let o=n.splice(s,1)[0];return{data:this.modifyArrayBy(r,n),actual:e,reverse:xe(re({type:Mn.Add},o),{parent:r})}}}moveOp(e){let{parent:t,fi:r,id:n}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:Mn.Delete,id:n});if(t!==null){let h=t;for(;h!==null;){if(h===void 0)throw new Error;if(h===n)throw new yg("cyclic tree");h=this.parent(h)}}let s=this.parent(n);if(s===void 0)return null;let o=s,a=this.childrenArray(s),l=a.findIndex(h=>h.id===n);a=[...a];let c=a.splice(l,1)[0],u=this.modifyArrayBy(s,a);s=t,a=u.childrenArray(s);let d=c.fi;return c=xe(re({},c),{fi:r}),a=[...a,c],a.sort((h,p)=>h.fi-p.fi),e.localIndex=a.indexOf(c),u=u.modifyArrayBy(s,a),{data:u,actual:e,reverse:{type:Mn.Move,parent:o,fi:d,id:n}}}previous(e,t){if(t===null){let n=this.childrenArray(e);return n.length===0?null:n[n.length-1].id}let r=null;for(let n of this.childrenArray(e)){if(n.id===t)return r;r=n.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)+1;if(n<r.length)return r[n].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)-1;return n>=0?this.traverseSortPrevious(r[n].id):t}}getAllSorted(e){let t=[];for(let r of e){let n=this.getWithSortKey(r.id);n!==void 0&&t.push(re(re({},r),n))}t.sort((r,n)=>QS(r.sortKey,n.sortKey));for(let r of t)delete r.sortKey;return t}getWithSortKey(e){var t=e;let r=[],n=this.get(t),s=n;if(n!==void 0){for(;t;)r.splice(0,0,n.fi),t=this.parent(t),t!==null&&(n=this.get(t));return xe(re({},s),{sortKey:r})}}insertBeforeHelper(e,t,r){return this.insertAfterHelper(e,this.previous(e,t),r)}insertAfterHelper(e,t,r){let n=this.childrenArray(e);if(t===null){if(n.length===0)return ki(0,r,r);{let s=n[0].fi;return ki(s-r,s,r)}}else{let s=this.get(t);if(s===void 0||this.parent(t)!==e)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 ki(a,a+r,r)}else return ki(s.fi,o.fi,r)}}};var Ud;(function(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:vs.Update,props:s}}:null}else{let n=r.props,s={},o=re({},t),a=!1;if(n)for(let l of Object.keys(n))s[l]=o[l],o[l]=n[l],a=!0;return a?{data:o,actual:r,reverse:{type:vs.Update,props:s}}:null}}e.runOp=i})(Ud||(Ud={}));var ur=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,ur.prototype)}deepFreeze(){let e=0;for(;e<this.length;)Kc(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){var t;return(t=this.get(e))==null?void 0:t.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this,s=n.findIndex(l=>l.id===e);if(s<0)throw new Error("not expected");let o=n[s];return n=[...n],n[s]=xe(re({},o),{data:t}),this.modifyArrayBy(n)}}modifyArrayBy(e){Object.setPrototypeOf(e,ur.prototype);let t=e;return ZS()||t.fillCaches(),t}runOp(e){switch(e.type){case Fn.Add:return this.addOp(e);case Fn.Delete:return this.deleteOp(e);case Fn.Move:return this.moveOp(e)}}addOp(e){let{fi:t,id:r,data:n}=e,s=this,o={fi:t,id:r,data:n};return s=[...s,o],s.sort((l,c)=>l.fi-c.fi),e.localIndex=s.indexOf(o),{data:this.modifyArrayBy(s),actual:e,reverse:{type:Fn.Delete,id:r}}}deleteOp(e){let{id:t}=e,r=this,n=r.findIndex(a=>a.id===t);if(n===-1)return null;e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:re({type:Fn.Add},s)}}moveOp(e){let{fi:t,id:r}=e,n=this;n=[...n];let s=n.findIndex(c=>c.id===r);if(s===-1)return null;let o=n[s].fi,a=xe(re({},n[s]),{fi:t});return n[s]=a,n.sort((c,u)=>c.fi-u.fi),e.localIndex=n.indexOf(a),{data:this.modifyArrayBy(n),actual:e,reverse:{type:Fn.Move,fi:o,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let r of this){if(r.id===e)return t;t=r.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let r=this;if(e===null){if(r.length===0)return ki(0,t,t);{let n=r[0].fi;return ki(n-t,n,t)}}else{let n=this.get(e);if(n===void 0)throw new Error("illegal args");let s=r.find(o=>o.fi>n.fi);if(s===void 0){let o=r[r.length-1].fi;return ki(o,o+t,t)}else return ki(n.fi,s.fi,t)}}};var tM=Symbol(),kd=Symbol(),Zc=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof xg);){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[kd];r&&r(),delete this._children[e]}}}},rM=class extends Zc{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=xe(re({},this._current),{[e]:t})}runOp(e){this.reportOp(e,Ud.runOp(this._current,e))}},nM=class extends Zc{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){this._current=xe(re({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,gi.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},iM={get(i,e){if(e===kd)return()=>{i._parent=null};if(e===tM)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=Vd(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]}}},R3=xe(re({},iM),{set(i,e,t){var n;let r;if(t===void 0)throw new Error("set to undefined is not supported!");return r={type:vs.Update,props:{[e]:(n=F3(t))!=null?n:t}},i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){throw new Error("set to undefined is not supported!")}}),O3=xe(re({},iM),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:Xn.Add,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:Xn.Delete,id:e}),!0}}),$c=class extends Zc{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[kd]=()=>{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)}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=Vd(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:Mn.Add,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:Mn.Move,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:Mn.Delete,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},eu=class extends Zc{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[kd]=()=>{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 xe(re({},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=Vd(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:Fn.Add,fi:e,id:t,data:r})}move(e,t){this.runOp({type:Fn.Move,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:Fn.Delete,id:e})}};function vg(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===vs.Update&&e.type===vs.Update&&Hd.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(xe(re({},e),{path:t}))}var xg=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){vg(this.ts,t,e),vg(this.actual,r,e),vg(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Vd(i,e,t){return t instanceof yi?new $c(i,e,t):t instanceof ur?new eu(i,e,t):t instanceof gi?new Proxy(new nM(i,e,t),O3):t!==null&&typeof t=="object"?KS(t)?t:new Proxy(new rM(i,e,t),R3):t}function B3(i){let e=new xg(i);return[Vd(e,"",i),e]}function bg(i,e){let[t,r]=B3(i);return e(t),r.result()}function F3(i){return i instanceof $c||i instanceof eu?i._current:i!==null&&typeof i=="object"?i[tM]:i}var Hd;(function(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=re({},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 yi||n instanceof $c)&&typeof s[o]=="string")return t(n.data(s[o]),s,o+1);if((n instanceof ur||n instanceof eu)&&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})(Hd||(Hd={}));var wg=class{},jd=class extends wg{constructor(e){super();this.id=e}},Wd=class extends wg{constructor(e){super();this.data=e}};"use strict";var Sg;try{Sg=new TextDecoder}catch(i){}var Pe,ao,Z=0;var sM=[],Mg=sM,Ag=0,An={},bt,lo,Yn=0,Vi=0,Gn,xs,fn=[],Et,oM={useRecords:!1,mapsAsObjects:!0},Jd=class{},Tg=new Jd;Tg.name="MessagePack 0xC1";var Nl=!1,bs=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(Pe)return yM(()=>(Yd(),this?this.unpack(e,t):bs.prototype.unpack.call(oM,e,t)));ao=t>-1?t:e.length,Z=0,Ag=0,Vi=0,lo=null,Mg=sM,Gn=null,Pe=e;try{Et=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Pe=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 bs){if(An=this,this.structures)return bt=this.structures,qd();(!bt||bt.length>0)&&(bt=[])}else An=oM,(!bt||bt.length>0)&&(bt=[]);return qd()}unpackMultiple(e,t){let r,n=0;try{Nl=!0;let s=e.length,o=this?this.unpack(e,s):Kd.unpack(e,s);if(t){for(t(o);Z<s;)if(n=Z,t(qd())===!1)return}else{for(r=[o];Z<s;)n=Z,r.push(qd());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{Nl=!1,Yd()}}_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 qd(){try{if(!An.trusted&&!Nl){let e=bt.sharedLength||0;e<bt.length&&(bt.length=e)}let i=hr();if(Z==ao)bt.restoreStructures&&aM(),bt=null,Pe=null,xs&&(xs=null);else if(Z>ao){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!Nl)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw bt.restoreStructures&&aM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function aM(){for(let i in bt.restoreStructures)bt[i]=bt.restoreStructures[i];bt.restoreStructures=null}function hr(){let i=Pe[Z++];if(i<160)if(i<128){if(i<64)return i;{let e=bt[i&63]||An.getStructures&&cM()[i&63];return e?(e.read||(e.read=_g(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[pM()]=hr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(hr(),hr());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}else if(i<192){let e=i-160;if(Vi>=Z)return lo.slice(Z-Yn,(Z+=e)-Yn);if(Vi==0&&ao<140){let t=e<16?Cg(e):dM(e);if(t!=null)return t}return Eg(e)}else{let e;switch(i){case 192:return null;case 193:return Gn?(e=hr(),e>0?Gn[1].slice(Gn.position1,Gn.position1+=e):Gn[0].slice(Gn.position0,Gn.position0-=e)):Tg;case 194:return!1;case 195:return!0;case 196:return Lg(Pe[Z++]);case 197:return e=Et.getUint16(Z),Z+=2,Lg(e);case 198:return e=Et.getUint32(Z),Z+=4,Lg(e);case 199:return Xo(Pe[Z++]);case 200:return e=Et.getUint16(Z),Z+=2,Xo(e);case 201:return e=Et.getUint32(Z),Z+=4,Xo(e);case 202:if(e=Et.getFloat32(Z),An.useFloat32>2){let t=Qd[(Pe[Z]&127)<<1|Pe[Z+1]>>7];return Z+=4,(t*e+(e>0?.5:-.5)>>0)/t}return Z+=4,e;case 203:return e=Et.getFloat64(Z),Z+=8,e;case 204:return Pe[Z++];case 205:return e=Et.getUint16(Z),Z+=2,e;case 206:return e=Et.getUint32(Z),Z+=4,e;case 207:return An.int64AsNumber?(e=Et.getUint32(Z)*4294967296,e+=Et.getUint32(Z+4)):e=Et.getBigUint64(Z),Z+=8,e;case 208:return Et.getInt8(Z++);case 209:return e=Et.getInt16(Z),Z+=2,e;case 210:return e=Et.getInt32(Z),Z+=4,e;case 211:return An.int64AsNumber?(e=Et.getInt32(Z)*4294967296,e+=Et.getUint32(Z+4)):e=Et.getBigInt64(Z),Z+=8,e;case 212:if(e=Pe[Z++],e==114)return mM(Pe[Z++]&63);{let t=fn[e];if(t)return t.read?(Z++,t.read(hr())):t.noBuffer?(Z++,t()):t(Pe.subarray(Z,++Z));throw new Error("Unknown extension "+e)}case 213:return e=Pe[Z],e==114?(Z++,mM(Pe[Z++]&63,Pe[Z++])):Xo(2);case 214:return Xo(4);case 215:return Xo(8);case 216:return Xo(16);case 217:return e=Pe[Z++],Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):z3(e);case 218:return e=Et.getUint16(Z),Z+=2,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):U3(e);case 219:return e=Et.getUint32(Z),Z+=4,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):k3(e);case 220:return e=Et.getUint16(Z),Z+=2,uM(e);case 221:return e=Et.getUint32(Z),Z+=4,uM(e);case 222:return e=Et.getUint16(Z),Z+=2,hM(e);case 223:return e=Et.getUint32(Z),Z+=4,hM(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 G3=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function _g(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>G3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(hr);return i.highByte===0&&(i.read=lM(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let o=i[n];r[o]=hr()}return r}return t.count=0,i.highByte===0?lM(e,t):t}var lM=(i,e)=>function(){let t=Pe[Z++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=bt[r]||cM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=_g(n,i)),n.read()};function cM(){let i=yM(()=>(Pe=null,An.getStructures()));return bt=An._mergeStructures(i,bt)}var Eg=Xd,z3=Xd,U3=Xd,k3=Xd;function Xd(i){let e;if(i<16&&(e=Cg(i)))return e;if(i>64&&Sg)return Sg.decode(Pe.subarray(Z,Z+=i));let t=Z+i,r=[];for(e="";Z<t;){let n=Pe[Z++];if((n&128)==0)r.push(n);else if((n&224)==192){let s=Pe[Z++]&63;r.push((n&31)<<6|s)}else if((n&240)==224){let s=Pe[Z++]&63,o=Pe[Z++]&63;r.push((n&31)<<12|s<<6|o)}else if((n&248)==240){let s=Pe[Z++]&63,o=Pe[Z++]&63,a=Pe[Z++]&63,l=(n&7)<<18|s<<12|o<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(n);r.length>=4096&&(e+=Ir.apply(String,r),r.length=0)}return r.length>0&&(e+=Ir.apply(String,r)),e}function uM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}function hM(i){if(An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[pM()]=hr();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(hr(),hr());return e}}var Ir=String.fromCharCode;function dM(i){let e=Z,t=new Array(i);for(let r=0;r<i;r++){let n=Pe[Z++];if((n&128)>0){Z=e;return}t[r]=n}return Ir.apply(String,t)}function Cg(i){if(i<4)if(i<2){if(i===0)return"";{let e=Pe[Z++];if((e&128)>1){Z-=1;return}return Ir(e)}}else{let e=Pe[Z++],t=Pe[Z++];if((e&128)>0||(t&128)>0){Z-=2;return}if(i<3)return Ir(e,t);let r=Pe[Z++];if((r&128)>0){Z-=3;return}return Ir(e,t,r)}else{let e=Pe[Z++],t=Pe[Z++],r=Pe[Z++],n=Pe[Z++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){Z-=4;return}if(i<6){if(i===4)return Ir(e,t,r,n);{let s=Pe[Z++];if((s&128)>0){Z-=5;return}return Ir(e,t,r,n,s)}}else if(i<8){let s=Pe[Z++],o=Pe[Z++];if((s&128)>0||(o&128)>0){Z-=6;return}if(i<7)return Ir(e,t,r,n,s,o);let a=Pe[Z++];if((a&128)>0){Z-=7;return}return Ir(e,t,r,n,s,o,a)}else{let s=Pe[Z++],o=Pe[Z++],a=Pe[Z++],l=Pe[Z++];if((s&128)>0||(o&128)>0||(a&128)>0||(l&128)>0){Z-=8;return}if(i<10){if(i===8)return Ir(e,t,r,n,s,o,a,l);{let c=Pe[Z++];if((c&128)>0){Z-=9;return}return Ir(e,t,r,n,s,o,a,l,c)}}else if(i<12){let c=Pe[Z++],u=Pe[Z++];if((c&128)>0||(u&128)>0){Z-=10;return}if(i<11)return Ir(e,t,r,n,s,o,a,l,c,u);let d=Pe[Z++];if((d&128)>0){Z-=11;return}return Ir(e,t,r,n,s,o,a,l,c,u,d)}else{let c=Pe[Z++],u=Pe[Z++],d=Pe[Z++],h=Pe[Z++];if((c&128)>0||(u&128)>0||(d&128)>0||(h&128)>0){Z-=12;return}if(i<14){if(i===12)return Ir(e,t,r,n,s,o,a,l,c,u,d,h);{let p=Pe[Z++];if((p&128)>0){Z-=13;return}return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p)}}else{let p=Pe[Z++],f=Pe[Z++];if((p&128)>0||(f&128)>0){Z-=14;return}if(i<15)return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p,f);let g=Pe[Z++];if((g&128)>0){Z-=15;return}return Ir(e,t,r,n,s,o,a,l,c,u,d,h,p,f,g)}}}}}function Lg(i){return An.copyBuffers?Uint8Array.prototype.slice.call(Pe,Z,Z+=i):Pe.subarray(Z,Z+=i)}function Xo(i){let e=Pe[Z++];if(fn[e])return fn[e](Pe.subarray(Z,Z+=i));throw new Error("Unknown extension type "+e)}var fM=new Array(4096);function pM(){let i=Pe[Z++];if(i>=160&&i<192){if(i=i-160,Vi>=Z)return lo.slice(Z-Yn,(Z+=i)-Yn);if(!(Vi==0&&ao<180))return Eg(i)}else return Z--,hr();let e=(i<<5^(i>1?Et.getUint16(Z):i>0?Pe[Z]:0))&4095,t=fM[e],r=Z,n=Z+i-3,s,o=0;if(t&&t.bytes==i){for(;r<n;){if(s=Et.getUint32(r),s!=t[o++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=Pe[r++],s!=t[o++]){r=1879048192;break}if(r===n)return Z=r,t.string;n-=3,r=Z}for(t=[],fM[e]=t,t.bytes=i;r<n;)s=Et.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=Pe[r++],t.push(s);let a=i<16?Cg(i):dM(i);return a!=null?t.string=a:t.string=Eg(i)}var mM=(i,e)=>{var t=hr();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=bt[i];return n&&n.isShared&&((bt.restoreStructures||(bt.restoreStructures=[]))[i]=n),bt[i]=t,t.read=_g(t,r),t.read()},gM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=hr();return(gM[i[0]]||Error)(i[1])};fn[105]=i=>{let e=Et.getUint32(Z-4);xs||(xs=new Map);let t=Pe[Z],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};xs.set(e,n);let s=hr();return n.used?Object.assign(r,s):(n.target=s,s)};fn[112]=i=>{let e=Et.getUint32(Z-4),t=xs.get(e);return t.used=!0,t.target};fn[115]=()=>new Set(hr());var Ng=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");fn[116]=i=>{let e=i[0],t=Ng[e];if(!t)throw new Error("Could not find typed array for code "+e);return new gM[t](Uint8Array.prototype.slice.call(i,1).buffer)};fn[120]=()=>{let i=hr();return new RegExp(i[0],i[1])};fn[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=Z;Z+=e-4,Gn=[hr(),hr()],Gn.position0=0,Gn.position1=0;let r=Z;Z=t;try{return hr()}finally{Z=r}};fn[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 yM(i){let e=ao,t=Z,r=Ag,n=Yn,s=Vi,o=lo,a=Mg,l=xs,c=Gn,u=new Uint8Array(Pe.slice(0,ao)),d=bt,h=bt.slice(0,bt.length),p=An,f=Nl,g=i();return ao=e,Z=t,Ag=r,Yn=n,Vi=s,lo=o,Mg=a,xs=l,Gn=c,Pe=u,Nl=f,bt=d,bt.splice(0,bt.length,...h),An=p,Et=new DataView(Pe.buffer,Pe.byteOffset,Pe.byteLength),g}function Yd(){Pe=null,xs=null,bt=null}function vM(i){i.unpack?fn[i.type]=i.unpack:fn[i.type]=i}var Qd=new Array(147);for(let i=0;i<256;i++)Qd[i]=+("1e"+Math.floor(45.15-i*.30103));var Kd=new bs({useRecords:!1}),V3=Kd.unpack,H3=Kd.unpackMultiple,j3=Kd.unpack;var W3=new Float32Array(1),E6=new Uint8Array(W3.buffer,0,4);"use strict";var Zd;try{Zd=new TextEncoder}catch(i){}var $d,Pg,ef=typeof Buffer!="undefined",Ig=ef?Buffer.allocUnsafeSlow:Uint8Array,bM=ef?Buffer:Uint8Array,wM=ef?4294967296:2144337920,de,gr,ae=0,Hi,ji=null,J3=/[\u0080-\uFFFF]/,tu=Symbol("record-id"),Pl=class extends bs{constructor(e){super(e);this.offset=0;let t,r,n,s,o,a,l=0,c=bM.prototype.utf8Write?function(M,E,C){return de.utf8Write(M,E,C)}:Zd&&Zd.encodeInto?function(M,E){return Zd.encodeInto(M,de.subarray(E)).written}:!1,u=this;e||(e={});let d=e&&e.sequential,h=e.structures||e.saveStructures,p=e.maxSharedStructures;if(p==null&&(p=h?32:0),p>8160)throw new Error("Maximum maxSharedStructure is 8160");let f=e.maxOwnStructures;f==null&&(f=h?32:64),d&&!e.saveStructures&&(this.structures=[]);let g=p>32||f+p>64,v=p+64,y=p+f+64;if(y>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let m=[],x=0,b=0;this.pack=this.encode=function(M,E){if(de||(de=new Ig(8192),gr=new DataView(de.buffer,0,8192),ae=0),Hi=de.length-10,Hi-ae<2048?(de=new Ig(de.length),gr=new DataView(de.buffer,0,de.length),Hi=de.length-10,ae=0):ae=ae+7&2147483640,r=ae,a=u.structuredClone?new Map:null,u.bundleStrings?(ji=["",""],de[ae++]=214,de[ae++]=98,ji.position=ae-r,ae+=4):ji=null,n=u.structures,n){n.uninitialized&&(n=u._mergeStructures(u.getStructures()));let C=n.sharedLength||0;if(C>p)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 _=0;_<C;_++){let O=n[_];if(!O)continue;let P,D=n.transitions;for(let G=0,R=O.length;G<R;G++){let U=O[G];P=D[U],P||(P=D[U]=Object.create(null)),D=P}D[tu]=_+64}l=C}d||(n.nextId=C+64)}s&&(s=!1),o=n||[];try{if(w(M),ji){gr.setUint32(ji.position+r,ae-ji.position-r);let C=ji;ji=null,w(C[0]),w(C[1])}if(u.offset=ae,a&&a.idsToInsert){ae+=a.idsToInsert.length*6,ae>Hi&&S(ae),u.offset=ae;let C=X3(de.subarray(r,ae),a.idsToInsert);return a=null,C}return E&TM?(de.start=r,de.end=ae,de):de.subarray(r,ae)}finally{if(n){if(b<10&&b++,x>1e4)n.transitions=null,b=0,x=0,m.length>0&&(m=[]);else if(m.length>0&&!d){for(let C=0,_=m.length;C<_;C++)m[C][tu]=0;m=[]}if(s&&u.saveStructures){let C=n.sharedLength||p;n.length>C&&(n=n.slice(0,C));let _=de.subarray(r,ae);return u.saveStructures(n,l)===!1?(u._mergeStructures(u.getStructures()),u.pack(M)):(l=C,_)}}E&K3&&(ae=r)}};let w=M=>{ae>Hi&&(de=S(ae));var E=typeof M,C;if(E==="string"){let _=M.length;if(ji&&_>=8&&_<4096){let D=J3.test(M);ji[D?0:1]+=M,de[ae++]=193,w(D?-_:_);return}let O;_<32?O=1:_<256?O=2:_<65536?O=3:O=5;let P=_*3;if(ae+P>Hi&&(de=S(ae+P)),_<64||!c){let D,G,R,U=ae+O;for(D=0;D<_;D++)G=M.charCodeAt(D),G<128?de[U++]=G:G<2048?(de[U++]=G>>6|192,de[U++]=G&63|128):(G&64512)==55296&&((R=M.charCodeAt(D+1))&64512)==56320?(G=65536+((G&1023)<<10)+(R&1023),D++,de[U++]=G>>18|240,de[U++]=G>>12&63|128,de[U++]=G>>6&63|128,de[U++]=G&63|128):(de[U++]=G>>12|224,de[U++]=G>>6&63|128,de[U++]=G&63|128);C=U-ae-O}else C=c(M,ae+O,P);C<32?de[ae++]=160|C:C<256?(O<2&&de.copyWithin(ae+2,ae+1,ae+1+C),de[ae++]=217,de[ae++]=C):C<65536?(O<3&&de.copyWithin(ae+3,ae+2,ae+2+C),de[ae++]=218,de[ae++]=C>>8,de[ae++]=C&255):(O<5&&de.copyWithin(ae+5,ae+3,ae+3+C),de[ae++]=219,gr.setUint32(ae,C),ae+=4),ae+=C}else if(E==="number")if(M>>>0===M)M<64?de[ae++]=M:M<256?(de[ae++]=204,de[ae++]=M):M<65536?(de[ae++]=205,de[ae++]=M>>8,de[ae++]=M&255):(de[ae++]=206,gr.setUint32(ae,M),ae+=4);else if(M>>0===M)M>=-32?de[ae++]=256+M:M>=-128?(de[ae++]=208,de[ae++]=M+256):M>=-32768?(de[ae++]=209,gr.setInt16(ae,M),ae+=2):(de[ae++]=210,gr.setInt32(ae,M),ae+=4);else{let _;if((_=this.useFloat32)>0&&M<4294967296&&M>=-2147483648){de[ae++]=202,gr.setFloat32(ae,M);let O;if(_<4||(O=M*Qd[(de[ae]&127)<<1|de[ae+1]>>7])>>0===O){ae+=4;return}else ae--}de[ae++]=203,gr.setFloat64(ae,M),ae+=8}else if(E==="object")if(!M)de[ae++]=192;else{if(a){let O=a.get(M);if(O){if(!O.id){let P=a.idsToInsert||(a.idsToInsert=[]);O.id=P.push(O)}de[ae++]=214,de[ae++]=112,gr.setUint32(ae,O.id),ae+=4;return}else a.set(M,{offset:ae-r})}let _=M.constructor;if(_===Object)T(M,!0);else if(_===Array){C=M.length,C<16?de[ae++]=144|C:C<65536?(de[ae++]=220,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=221,gr.setUint32(ae,C),ae+=4);for(let O=0;O<C;O++)w(M[O])}else if(_===Map){C=M.size,C<16?de[ae++]=128|C:C<65536?(de[ae++]=222,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=223,gr.setUint32(ae,C),ae+=4);for(let[O,P]of M)w(O),w(P)}else{for(let O=0,P=$d.length;O<P;O++){let D=Pg[O];if(M instanceof D){let G=$d[O];if(G.write){G.type&&(de[ae++]=212,de[ae++]=G.type,de[ae++]=0),w(G.write.call(this,M));return}let R=de,U=gr,te=ae;de=null;let he;try{he=G.pack.call(this,M,H=>(de=R,R=null,ae+=H,ae>Hi&&S(ae),{target:de,targetView:gr,position:ae-H}),w)}finally{R&&(de=R,gr=U,ae=te,Hi=de.length-10)}he&&(he.length+ae>Hi&&S(he.length+ae),ae=q3(he,de,ae,G.type));return}}T(M,!M.hasOwnProperty)}}else if(E==="boolean")de[ae++]=M?195:194;else if(E==="bigint"){if(M<BigInt(1)<<BigInt(63)&&M>=-(BigInt(1)<<BigInt(63)))de[ae++]=211,gr.setBigInt64(ae,M);else if(M<BigInt(1)<<BigInt(64)&&M>0)de[ae++]=207,gr.setBigUint64(ae,M);else if(this.largeBigIntToFloat)de[ae++]=203,gr.setFloat64(ae,Number(M));else throw new RangeError(M+" 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")w(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+E)},T=this.useRecords===!1?this.variableMapSize?M=>{let E=Object.keys(M),C=E.length;C<16?de[ae++]=128|C:C<65536?(de[ae++]=222,de[ae++]=C>>8,de[ae++]=C&255):(de[ae++]=223,gr.setUint32(ae,C),ae+=4);let _;for(let O=0;O<C;O++)w(_=E[O]),w(M[_])}:(M,E)=>{de[ae++]=222;let C=ae-r;ae+=2;let _=0;for(let O in M)(E||M.hasOwnProperty(O))&&(w(O),w(M[O]),_++);de[C+++r]=_>>8,de[C+r]=_&255}:M=>{let E=Object.keys(M),C,_=o.transitions||(o.transitions=Object.create(null)),O=0;for(let D=0,G=E.length;D<G;D++){let R=E[D];C=_[R],C||(C=_[R]=Object.create(null),O++),_=C}let P=_[tu];if(P)P>=96&&g?(de[ae++]=((P-=96)&31)+96,de[ae++]=P>>5):de[ae++]=P;else{P=o.nextId,P||(P=64),P<v&&this.shouldShareStructure&&!this.shouldShareStructure(E)?(P=o.nextOwnId,P<y||(P=v),o.nextOwnId=P+1):(P>=y&&(P=v),o.nextId=P+1);let D=E.highByte=P>=96&&g?P-96>>5:-1;_[tu]=P,o[P-64]=E,P<v?(E.isShared=!0,o.sharedLength=P-63,s=!0,D>=0?(de[ae++]=(P&31)+96,de[ae++]=D):de[ae++]=P):(D>=0?(de[ae++]=213,de[ae++]=114,de[ae++]=(P&31)+96,de[ae++]=D):(de[ae++]=212,de[ae++]=114,de[ae++]=P),O&&(x+=b*O),m.length>=f&&(m.shift()[tu]=0),m.push(_),w(E))}for(let D=0,G=E.length;D<G;D++)w(M[E[D]])},S=M=>{let E;if(M>16777216){if(M-r>wM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(wM,Math.round(Math.max((M-r)*(M>67108864?1.25:2),4194304)/4096)*4096)}else E=(Math.max(M-r<<2,de.length-1)>>12)+1<<12;let C=new Ig(E);return gr=new DataView(C.buffer,0,E),de.copy?de.copy(C,0,r,M):C.set(de.slice(r,M)),ae-=r,r=0,Hi=C.length-10,de=C}}useBuffer(e){de=e,gr=new DataView(de.buffer,de.byteOffset,de.byteLength),ae=0}};Pg=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Jd];$d=[{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?SM(i,16,e):MM(ef?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==bM&&this.structuredClone?SM(i,Ng.indexOf(t.name),e):MM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function SM(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 MM(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 q3(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 X3(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 Yo(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)");Pg.unshift(i.Class),$d.unshift(i)}vM(i)}var AM=new Pl({useRecords:!1}),Y3=AM.pack,Q3=AM.pack;var TM=512,K3=1024;var _M=new Pl({structuredClone:!0});Yo({Class:gi.prototype.constructor,type:1,write(i){return re({},i)},read(i){return Object.setPrototypeOf(i,gi.prototype),i}});Yo({Class:ur.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,ur.prototype),i}});Yo({Class:yi.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,yi.prototype),i}});Yo({Class:jd.prototype.constructor,type:4,write(i){return i.id},read(i){return new jd(i)}});Yo({Class:Wd.prototype.constructor,type:5,write(i){return i.data},read(i){return new Wd(i)}});function Z3(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 tf;(function(r){function i(n){return _M.pack(n)}r.serialize=i;function e(n){return _M.unpack(n)}r.deserialize=e;function t(n){return Z3(i(n)).toString()}r.checksum=t})(tf||(tf={}));var Il;(function(t){t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(Il||(Il={}));var rf;(function(t){function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Ui.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Ui.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:Ui.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(rf||(rf={}));var Dl;(function(r){r[r.Front=0]="Front",r[r.Back=1]="Back",r[r.Double=2]="Double"})(Dl||(Dl={}));var Dg;(function(t){t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Dg||(Dg={}));var Rg;(function(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})(Rg||(Rg={}));var nf;(function(e){e.defaultData=xe(re(re({},Rg.defaultData),Dg.defaultData),{cloner:null})})(nf||(nf={}));var pn;(function(n){n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify"})(pn||(pn={}));var ws;(function(r){r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom"})(ws||(ws={}));var co;(function(r){r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower"})(co||(co={}));var sf;(function(e){e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Ui.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"}})(sf||(sf={}));var Ar;(function(n){n[n.Normal=0]="Normal",n[n.Multiply=1]="Multiply",n[n.Screen=2]="Screen",n[n.Overlay=3]="Overlay"})(Ar||(Ar={}));var of;(function(r){r[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar"})(of||(of={}));var af;(function(r){r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping"})(af||(af={}));var Og;(function(n){n[n.UV=0]="UV",n[n.Planar=1]="Planar",n[n.Spherical=2]="Spherical",n[n.Cylindrical=3]="Cylindrical"})(Og||(Og={}));var lf;(function(s){s[s.Simplex=0]="Simplex",s[s.SimplexFractal=1]="SimplexFractal",s[s.Ashima=2]="Ashima",s[s.Fbm=3]="Fbm",s[s.Perlin=4]="Perlin"})(lf||(lf={}));var Rl;(function(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:.2,g:.2,b:.2,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:[1,1],mode:0,axis:Cl.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:Ur.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:xe(re({},Ur.fromHex(6710886)),{a:1}),colorB:xe(re({},Ur.fromHex(6710886)),{a:1}),colorC:xe(re({},Ur.fromHex(16777215)),{a:1}),colorD:xe(re({},Ur.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:Ui.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}}}})(Rl||(Rl={}));var cf;(function(n){function i(){return{layers:new ur}}n.defaultEmptyData=i;function e(s="layer1",o="layer2"){return t("phong",s,o)}n.defaultData=e;function t(s,o="layer1",a="layer2"){let l=new ur;return l.push({fi:0,data:Rl.defaultData("light",s),id:o}),l.push({fi:1,data:Rl.defaultData("color"),id:a}),{layers:l}}n.defaultTwoLayerData=t;function r(s,o="basic",a="layer1",l="layer2"){let c=Rl.defaultData("texture");Object.assign(c.texture,{image:s});let u=new ur;return u.push({fi:0,data:c,id:a}),u.push({fi:1,data:Rl.defaultData("light",o),id:l}),{layers:u}}n.defaultTwoLayerTextureData=r})(cf||(cf={}));var uf;(function(r){function i(){return{points:new ur,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})(uf||(uf={}));var hf;(function(e){function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(hf||(hf={}));var df;(function(e){function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:uf.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(df||(df={}));var ru;(function(n){n.identity=xe(re({},Gd.identity),{hiddenMatrix:oo.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:Ll.isEqual(s.position,o.position)?null:o.position,rotation:Ll.isEqual(s.rotation,o.rotation)?null:o.rotation,scale:Ll.isEqual(s.scale,o.scale)?null:o.scale,hiddenMatrix:oo.isEqual(s.hiddenMatrix,o.hiddenMatrix)?null:o.hiddenMatrix}}n.diff=r})(ru||(ru={}));var uo;(function(e){e.defaultData=re({states:new ur,events:new ur,visible:!0,raycastLock:!1},ru.identity)})(uo||(uo={}));var EM;(function(e){e.defaultData=re({type:"Empty"},uo.defaultData)})(EM||(EM={}));var Bg;(function(e){e.defaultData=re(re({type:"Mesh"},uo.defaultData),nf.defaultData)})(Bg||(Bg={}));var CM;(function(e){e.defaultData=re(re({type:"TextFrame"},uo.defaultData),sf.defaultData)})(CM||(CM={}));var ff;(function(e){e.defaultData=re(re(re({},uo.defaultData),ru.identity),qo.defaultData)})(ff||(ff={}));var LM;(function(e){function i(t){return re(re({},uo.defaultData),rf.defaultData(t))}e.defaultData=i})(LM||(LM={}));var NM;(function(t){t.defaultCamera=re({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:oo.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new ur,events:new ur},qo.defaultData),t.defaultMeshObject=xe(re(re({name:"Rectangle"},uo.defaultData),Bg.defaultData),{geometry:df.defaultData("RectangleGeometry"),material:cf.defaultTwoLayerData("basic","layer1","layer2")})})(NM||(NM={}));var nu;(function(t){function i(r,n){if(n===void 0)return r;let s=re({},r);return"material"in s&&"material"in n&&n.material&&(s.material=bg(s.material,o=>{if(typeof o!="string")for(let[a,l]of Object.entries(n.material.layers)){let c=o.layers.data(a);c&&Jo(c,l)}}).data),s.materials&&n.materials&&(s.materials=bg(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[d,h]of Object.entries(u.layers)){let p=(l=(a=o[c])==null?void 0:a.layers)==null?void 0:l.data(d);p&&Jo(p,h)}}}).data),s}t.patchMaterialState=i;function e(r,n){var o,a;if(n===void 0)return r;let s=re({},r);if(Object.assign(s,ru.merge(s,n)),so.is(r.type)){s.orthographic=re({},s.orthographic),s.perspective=re({},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=re({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(Il.is(r.type)){let l=n;s.intensity!==void 0&&(s.intensity=l.intensity),l.color!==void 0&&(s.color=Ur.clone(l.color))}return s}t.patch=e})(nu||(nu={}));var kr;(function(n){n[n.DEFAULT=0]="DEFAULT",n[n.VERTICAL=1]="VERTICAL",n[n.HORIZONTAL=2]="HORIZONTAL",n[n.BOTH=3]="BOTH"})(kr||(kr={}));var Wi;(function(r){r[r.OFF=0]="OFF",r[r.ROTATE=1]="ROTATE",r[r.PAN=2]="PAN"})(Wi||(Wi={}));var zn;(function(r){r[r.NONE=0]="NONE",r[r.EASE=1]="EASE",r[r.BOUNCE=2]="BOUNCE"})(zn||(zn={}));var PM;(function(e){e.defaultData={enablePan:!0,enableZoom:!0,enableRotate:!0,enableDamping:!0,rotationLimitsMode:0,rotationVerticalOffset:{min:Math.PI/4,max:Math.PI/4},rotationHorizontalOffset:{min:Math.PI/4,max:Math.PI/4},rotationSoftLimit:2,panLimitsMode:0,panVerticalOffset:{min:250,max:250},panHorizontalOffset:{min:250,max:250},panSoftLimit:2,zoomLimitsEnabled:!1,zoomLimits:{min:.1,max:2},autoRotate:!1,autoRotateSpeed:2,autoRotateClockwise:!0,hoverRotatePanMode:0,hoverRotatePanStrength:20,preventScroll:!1,isTouchZoom:!0,orbitTouches:2,panTouches:3}})(PM||(PM={}));var Fg=class{static computeTangents(e){e.computeTangents(),console.warn("THREE.BufferGeometryUtils: .computeTangents() has been removed. Use BufferGeometry.computeTangents() instead.")}static mergeBufferGeometries(e,t=!1){let r=e[0].index!==null,n=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),o={},a={},l=e[0].morphTargetsRelative,c=new _e,u=0;for(let d=0;d<e.length;++d){let h=e[d],p=0;if(r!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let f in h.attributes){if(!n.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+f+'" attribute exists among all geometries, or in none of them.'),null;o[f]===void 0&&(o[f]=[]),o[f].push(h.attributes[f]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(l!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let f in h.morphAttributes){if(!s.has(f))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;a[f]===void 0&&(a[f]=[]),a[f].push(h.morphAttributes[f])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(h.userData),t){let f;if(r)f=h.index.count;else if(h.attributes.position!==void 0)f=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;c.addGroup(u,f,d),u+=f}}if(r){let d=0,h=[];for(let p=0;p<e.length;++p){let f=e[p].index;for(let g=0;g<f.count;++g)h.push(f.getX(g)+d);d+=e[p].attributes.position.count}c.setIndex(h)}for(let d in o){let h=this.mergeBufferAttributes(o[d]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+d+" attribute."),null;c.setAttribute(d,h)}for(let d in a){let h=a[d][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[d]=[];for(let p=0;p<h;++p){let f=[];for(let v=0;v<a[d].length;++v)f.push(a[d][v][p]);let g=this.mergeBufferAttributes(f);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed while trying to merge the "+d+" morphAttribute."),null;c.morphAttributes[d].push(g)}}return c}static mergeBufferAttributes(e){let t,r,n,s=0;for(let l=0;l<e.length;++l){let c=e[l];if(c.isInterleavedBufferAttribute)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported."),null;if(t===void 0&&(t=c.array.constructor),t!==c.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(r===void 0&&(r=c.itemSize),r!==c.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=c.normalized),n!==c.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;s+=c.array.length}let o=new t(s),a=0;for(let l=0;l<e.length;++l)o.set(e[l].array,a),a+=e[l].array.length;return new Fe(o,r,n)}static interleaveAttributes(e){let t,r=0,n=0;for(let u=0,d=e.length;u<d;++u){let h=e[u];if(t===void 0&&(t=h.array.constructor),t!==h.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;r+=h.array.length,n+=h.itemSize}let s=new ds(new t(r),n),o=0,a=[],l=["getX","getY","getZ","getW"],c=["setX","setY","setZ","setW"];for(let u=0,d=e.length;u<d;u++){let h=e[u],p=h.itemSize,f=h.count,g=new Bi(s,p,o,h.normalized);a.push(g),o+=p;for(let v=0;v<f;v++)for(let y=0;y<p;y++)g[c[y]](v,h[l[y]](v))}return a}static estimateBytesUsed(e){let t=0;for(let n in e.attributes){let s=e.getAttribute(n);t+=s.count*s.itemSize*s.array.BYTES_PER_ELEMENT}let r=e.getIndex();return t+=r?r.count*r.itemSize*r.array.BYTES_PER_ELEMENT:0,t}static mergeVertices(e,t=1e-4){t=Math.max(t,Number.EPSILON);let r={},n=e.getIndex(),s=e.getAttribute("position"),o=n?n.count:s.count,a=0,l=Object.keys(e.attributes),c={},u={},d=[],h=["getX","getY","getZ","getW"];for(let v=0,y=l.length;v<y;v++){let m=l[v];c[m]=[];let x=e.morphAttributes[m];x&&(u[m]=new Array(x.length).fill().map(()=>[]))}let p=Math.log10(1/t),f=Math.pow(10,p);for(let v=0;v<o;v++){let y=n?n.getX(v):v,m="";for(let x=0,b=l.length;x<b;x++){let w=l[x],T=e.getAttribute(w),S=T.itemSize;for(let M=0;M<S;M++)m+=`${~~(T[h[M]](y)*f)},`}if(m in r)d.push(r[m]);else{for(let x=0,b=l.length;x<b;x++){let w=l[x],T=e.getAttribute(w),S=e.morphAttributes[w],M=T.itemSize,E=c[w],C=u[w];for(let _=0;_<M;_++){let O=h[_];if(E.push(T[O](y)),S)for(let P=0,D=S.length;P<D;P++)C[P].push(S[P][O](y))}}r[m]=a,d.push(a),a++}}let g=e.clone();for(let v=0,y=l.length;v<y;v++){let m=l[v],x=e.getAttribute(m),b=new x.array.constructor(c[m]),w=new Fe(b,x.itemSize,x.normalized);if(g.setAttribute(m,w),m in u)for(let T=0;T<u[m].length;T++){let S=e.morphAttributes[m][T],M=new S.array.constructor(u[m][T]),E=new Fe(M,S.itemSize,S.normalized);g.morphAttributes[m][T]=E}}return g.setIndex(d),g}static toTrianglesDrawMode(e,t){if(t===Fp)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===Gp||t===fx){let r=e.getIndex();if(r===null){let a=[],l=e.getAttribute("position");if(l!==void 0){for(let c=0;c<l.count;c++)a.push(c);e.setIndex(a),r=e.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e}let n=r.count-2,s=[];if(t===Gp)for(let a=1;a<=n;a++)s.push(r.getX(0)),s.push(r.getX(a)),s.push(r.getX(a+1));else for(let a=0;a<n;a++)a%2==0?(s.push(r.getX(a)),s.push(r.getX(a+1)),s.push(r.getX(a+2))):(s.push(r.getX(a+2)),s.push(r.getX(a+1)),s.push(r.getX(a)));s.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let o=e.clone();return o.setIndex(s),o.clearGroups(),o}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}static computeMorphedAttributes(e){if(e.geometry.isBufferGeometry!==!0)return console.error("THREE.BufferGeometryUtils: Geometry is not of type BufferGeometry."),null;let t=new A,r=new A,n=new A,s=new A,o=new A,a=new A,l=new A,c=new A,u=new A;function d(z,B,Y,q,ee,k,pe,ce,ne){t.fromBufferAttribute(Y,k),r.fromBufferAttribute(Y,pe),n.fromBufferAttribute(Y,ce);let X=z.morphTargetInfluences;if(B.morphTargets&&q&&X){l.set(0,0,0),c.set(0,0,0),u.set(0,0,0);for(let le=0,$=q.length;le<$;le++){let V=X[le],K=q[le];V!==0&&(s.fromBufferAttribute(K,k),o.fromBufferAttribute(K,pe),a.fromBufferAttribute(K,ce),ee?(l.addScaledVector(s,V),c.addScaledVector(o,V),u.addScaledVector(a,V)):(l.addScaledVector(s.sub(t),V),c.addScaledVector(o.sub(r),V),u.addScaledVector(a.sub(n),V)))}t.add(l),r.add(c),n.add(u)}z.isSkinnedMesh&&(z.boneTransform(k,t),z.boneTransform(pe,r),z.boneTransform(ce,n)),ne[k*3+0]=t.x,ne[k*3+1]=t.y,ne[k*3+2]=t.z,ne[pe*3+0]=r.x,ne[pe*3+1]=r.y,ne[pe*3+2]=r.z,ne[ce*3+0]=n.x,ne[ce*3+1]=n.y,ne[ce*3+2]=n.z}let h=e.geometry,p=e.material,f,g,v,y=h.index,m=h.attributes.position,x=h.morphAttributes.position,b=h.morphTargetsRelative,w=h.attributes.normal,T=h.morphAttributes.position,S=h.groups,M=h.drawRange,E,C,_,O,P,D,G,R,U=new Float32Array(m.count*m.itemSize),te=new Float32Array(w.count*w.itemSize);if(y!==null)if(Array.isArray(p))for(E=0,_=S.length;E<_;E++)for(P=S[E],D=p[P.materialIndex],G=Math.max(P.start,M.start),R=Math.min(P.start+P.count,M.start+M.count),C=G,O=R;C<O;C+=3)f=y.getX(C),g=y.getX(C+1),v=y.getX(C+2),d(e,D,m,x,b,f,g,v,U),d(e,D,w,T,b,f,g,v,te);else for(G=Math.max(0,M.start),R=Math.min(y.count,M.start+M.count),E=G,_=R;E<_;E+=3)f=y.getX(E),g=y.getX(E+1),v=y.getX(E+2),d(e,p,m,x,b,f,g,v,U),d(e,p,w,T,b,f,g,v,te);else if(m!==void 0)if(Array.isArray(p))for(E=0,_=S.length;E<_;E++)for(P=S[E],D=p[P.materialIndex],G=Math.max(P.start,M.start),R=Math.min(P.start+P.count,M.start+M.count),C=G,O=R;C<O;C+=3)f=C,g=C+1,v=C+2,d(e,D,m,x,b,f,g,v,U),d(e,D,w,T,b,f,g,v,te);else for(G=Math.max(0,M.start),R=Math.min(m.count,M.start+M.count),E=G,_=R;E<_;E+=3)f=E,g=E+1,v=E+2,d(e,p,m,x,b,f,g,v,U),d(e,p,w,T,b,f,g,v,te);let he=new Ae(U,3),H=new Ae(te,3);return{positionAttribute:m,normalAttribute:w,morphedPositionAttribute:he,morphedNormalAttribute:H}}};var Gg={type:"change"},IM={type:"changeZoom"},$3={type:"changePan"},Ol={type:"start"},iu={type:"end"},DM=/iPad|iPhone|iPod/.test(navigator.userAgent)||Vc&&"ontouchend"in document,su=new A,RM=new A,eF=new F,OM=new A,BM=new Ft,zg=new Ft,Dr=new F,br=new F,Vr=new F,$r=new nd,vi=new nd,Qn=new A,Ug=new A,kg=new A,FM=new A,Qo=new F,Ko=new F,Bl=new F,Zo=new F,$o=new F,Hr=new F,Fl=new F,Gl=new F,ou=new F,GM=new F,zM=new F,tF=2*Math.PI,rF=1e-8,nF=.01,UM=2,Vg=.125,kM=2,Hg=1,jg=1,Wg=.1,xi;(function(o){o[o.LEFT=0]="LEFT",o[o.MIDDLE=1]="MIDDLE",o[o.RIGHT=2]="RIGHT",o[o.ROTATE=3]="ROTATE",o[o.DOLLY=4]="DOLLY",o[o.PAN=5]="PAN"})(xi||(xi={}));var ft;(function(l){l[l.NONE=-1]="NONE",l[l.ROTATE=0]="ROTATE",l[l.DOLLY=1]="DOLLY",l[l.PAN=2]="PAN",l[l.TOUCH_ROTATE=3]="TOUCH_ROTATE",l[l.TOUCH_PAN=4]="TOUCH_PAN",l[l.TOUCH_DOLLY_PAN=5]="TOUCH_DOLLY_PAN",l[l.TOUCH_DOLLY_ROTATE=6]="TOUCH_DOLLY_ROTATE"})(ft||(ft={}));var Ot=-1,pf=!1,ho=!1,mf=!0,VM=!1,Jg=0,gf=1,qg,yf=!1,HM=-1,jM=-1,Xg,Yg=0,WM=1/0,Qg=0,Kg=1/0,JM=0,qM=Math.PI,Zg=-1/0,$g=1/0,ey=0,ty=Math.PI,ry=-1/0,ny=1/0,XM=zn.BOUNCE,YM=zn.BOUNCE,QM=!0,iy=class extends xr{constructor(e,t){super();this.object=e;this.domElement=t;this.enabled=!0;this.useKeyEvents=!0;this.enableDamping=!1;this.enableZoom=!0;this.enableRotate=!0;this.enablePan=!0;this.autoRotate=!1;this.rotationLimitsMode=kr.DEFAULT;this.panLimitsMode=kr.DEFAULT;this.hoverRotatePanMode=Wi.OFF;this.zoomLimitsEnabled=!1;this.preventScroll=!0;this.mouseButtons=[0,5];this.mouseButtonsPlay=[3,4,5];this.touches=[null,Ln.DOLLY_ROTATE,Ln.PAN];this.update=()=>{let e=this.object.position;su.copy(e).sub(this.target),$r.setFromVector3(su),this.object.isUpVectorFlipped&&($r.phi*=-1,$r.theta-=Math.PI),this.autoRotate&&Ot===-1&&this.rotateLeft((QM===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==kr.DEFAULT&&this.applyLimits(vi,this.rotationLimitsMode,XM,$g,Zg,qM,JM,GM),this.rotationLimitsMode!==kr.HORIZONTAL&&($r.phi+=vi.phi),(this.rotationLimitsMode!==kr.VERTICAL||this.autoRotate===!0)&&($r.theta+=vi.theta),$r.radius*=gf,this.zoomLimitsEnabled&&($r.radius=Math.max(Yg,Math.min(WM,$r.radius))),this.panLimitsMode!==kr.DEFAULT&&(this.target.applyQuaternion(zg.copy(this.object.quaternion).invert()),Qn.applyQuaternion(zg),this.applyLimits(Qn,this.panLimitsMode,YM,ty,ey,ny,ry,zM),this.target.applyQuaternion(this.object.quaternion),Qn.applyQuaternion(this.object.quaternion)),this.panLimitsMode===kr.HORIZONTAL&&(Qn.y=0),this.panLimitsMode===kr.VERTICAL&&(Qn.x=0),Ot===-1&&!yf?(Qn.multiplyScalar(1-Vg),this.target.add(Qn)):(this.target.add(Qn),Qn.set(0,0,0)),su.setFromSpherical($r),e.copy(this.target).add(su);let t=$r.phi%tF;return RM.copy(su).normalize(),this.object.up.copy(Ze.DefaultUp).applyAxisAngle(RM,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),Ot===-1||this.enableDamping===!0?(vi.theta*=1-Vg,vi.phi*=1-Vg):vi.set(0,0,0),gf=1,pf||Vr.x>.05||Vr.y>.05||OM.distanceToSquared(this.object.position)>nF||8*(1-BM.dot(this.object.quaternion))>rF?(this.dispatchEvent(Gg),OM.copy(this.object.position),BM.copy(this.object.quaternion),pf=!1,!0):(vi.set(0,0,0),Qn.set(0,0,0),!1)};this.onPointerDown=e=>{this.enabled!==!1&&(ho=!0,yt.length===0&&(this.domElement.ownerDocument.addEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.addEventListener("pointerup",this.onPointerUp)),sF(e),e.pointerType==="touch"?this.onPointerDownTouch(e):this.onPointerDownMouse(e))};this.onPointerMove=e=>{this.enabled!==!1&&(e.pointerType==="touch"?this.onPointerMoveTouch(e):this.onPointerMoveMouse(e))};this.onPointerUp=e=>{ZM(e),ho=!1,yt.length===0&&(this.domElement.ownerDocument.removeEventListener("pointermove",this.onPointerMove),this.domElement.ownerDocument.removeEventListener("pointerup",this.onPointerUp)),this.dispatchEvent(iu),Ot=-1};this.onPointerCancel=e=>{ZM(e)};this.onPointerDownMouse=e=>{let t;switch(this.useKeyEvents?t=this.mouseButtons[e.button]:t=this.mouseButtonsPlay[e.button],t){case 0:if(e.altKey===!0&&!e.shiftKey&&!Hc(e)){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}else if(qg===" "){if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}break;case 4:if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2;break;case 3:if(Hc(e)||e.shiftKey){if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}else{if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}break;case 5:if(Hc(e)||e.shiftKey){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),Ot=0}else{if(this.enablePan===!1)return;this.handleMouseDownPan(e),Ot=2}break;default:Ot=-1}Ot!==-1&&this.dispatchEvent(Ol)};this.onPointerMoveMouse=e=>{switch(Ot){case 0:if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e);break;case 1:if(this.enableZoom===!1)return;this.handleMouseMoveDolly(e);break;case 2:if(this.enablePan===!1)return;this.handleMouseMovePan(e);break}};this.onPointerDownTouch=e=>{switch($M(e),this.touches[yt.length-1]){case Ln.ROTATE:if(this.enableRotate===!1){Ot=-1;return}this.handleTouchStartRotate(),Ot=3;break;case Ln.PAN:if(this.enablePan===!1){Ot=-1;return}this.handleTouchStartPan(),Ot=4;break;case Ln.DOLLY_PAN:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchStartDollyPan(),Ot=5;break;case Ln.DOLLY_ROTATE:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchStartDollyRotate(),Ot=6;break;default:Ot=-1}Ot!==-1&&this.dispatchEvent(Ol)};this.onPointerMoveTouch=e=>{switch($M(e),Ot){case 3:if(this.enableRotate===!1)return;this.handleTouchMoveRotate(e),this.update();break;case 4:if(this.enablePan===!1)return;this.handleTouchMovePan(e),this.update();break;case 5:if(this.enableZoom===!1&&this.enablePan===!1)return;this.handleTouchMoveDollyPan(e),this.update();break;case 6:if(this.enableZoom===!1&&this.enableRotate===!1)return;this.handleTouchMoveDollyRotate(e),this.update();break;default:Ot=-1}};this.dispatchEndDebounced=qc(()=>this.dispatchEvent(iu),33);this.onMouseWheel=e=>{this.enabled===!1||this.enableZoom===!1&&this.enablePan===!1||((this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth||this.preventScroll)&&e.preventDefault(),this.dispatchEvent(Ol),this.handleMouseWheel(e),this.dispatchEndDebounced())};this.onGesture=e=>{if(this.enabled!==!1)if(e.preventDefault(),e.type==="gesturechange"){if(this.enableZoom===!1)return;this.dispatchEvent(Ol),e.scale>Jg?this.dollyIn(this.getZoomScale()):e.scale<Jg&&this.dollyOut(this.getZoomScale()),Jg=e.scale,this.update()}else this.dispatchEvent(iu)};this.onContextMenu=e=>{this.enabled!==!1&&e.preventDefault()};this.onTouchMove=e=>{(e.touches.length>1||this.preventScroll)&&e.preventDefault()};this.onTouchEnd=e=>{e.preventDefault()};this.onKeyDown=e=>{this.enabled!==!1&&(qg=e.key)};this.onKeyUp=()=>{this.enabled!==!1&&(qg=void 0,Ot!==-1&&this.onPointerUp(yt[0]))};this.onPointerHover=e=>{if(!(this.enabled===!1||Ot!==-1)){if(window.clearTimeout(jM),ho=!0,mf){let t={clientX:window.innerWidth/2,clientY:window.innerHeight/2};this.hoverRotatePanMode===Wi.PAN?this.handleMouseDownPan(t):this.hoverRotatePanMode===Wi.ROTATE&&this.handleMouseDownRotate(t),mf=!1}this.hoverRotatePanMode===Wi.PAN?this.handleMouseMovePan(e,Wg):this.hoverRotatePanMode===Wi.ROTATE&&this.handleMouseMoveRotate(e,Wg),jM=window.setTimeout(()=>{ho=!1},30),this.update()}};this.object=e,this.domElement=t,this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.isPerspectiveCamera?this.object.zoom:1,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(Gg),mf=!0,this.update(),Ot=-1}resetTo(e,t,r){this.target.copy(e),this.object.position.copy(t),this.object.zoom=r,this.object.updateProjectionMatrix(),this.dispatchEvent(Gg),this.update(),Ot=-1}fromJSON(e){this.setEnableDampingSpeed(e.enableDamping),this.enablePan=e.enablePan,this.enableZoom=e.enableZoom,this.enableRotate=e.enableRotate,this.rotationLimitsMode=e.rotationLimitsMode,this.panLimitsMode=e.panLimitsMode,YM=e.panSoftLimit,XM=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,mf=!0,this.hoverRotatePanMode!==Wi.OFF&&this.domElement.addEventListener("pointermove",this.onPointerHover),Wg=(e.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,Qg=e.zoomLimits.min,Kg=Math.max(e.zoomLimits.min,e.zoomLimits.max),Yg=1e3/e.zoomLimits.max,WM=Math.max(Yg,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,UM=e.autoRotateSpeed,QM=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(zg.copy(this.object.quaternion).invert());ry=-e.panVerticalOffset.min+r.y,ny=e.panVerticalOffset.max+r.y,ey=-e.panHorizontalOffset.min+r.x,ty=e.panHorizontalOffset.max+r.x,zM.set(ty-ey,ny-ry).divideScalar(2),GM.setScalar(Math.PI).divideScalar(4),JM=fo($r.phi-e.rotationVerticalOffset.min),qM=fo($r.phi+e.rotationVerticalOffset.max),Zg=fo($r.theta-e.rotationHorizontalOffset.min),$g=fo($r.theta+e.rotationHorizontalOffset.max),VM=Zg>$g,this.preventScroll=e.preventScroll,e.orbitTouches===1&&(this.touches[0]=Ln.ROTATE),e.panTouches===1&&(this.touches[0]=Ln.PAN),e.orbitTouches===2&&(this.touches[1]=Ln.DOLLY_ROTATE),e.panTouches===2&&(this.touches[1]=Ln.DOLLY_PAN),e.orbitTouches===3&&(this.touches[2]=Ln.ROTATE),e.panTouches===3&&(this.touches[2]=Ln.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),DM||(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),DM||(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(e,t,r,n,s,o,a,l){br.set(0,0);let c,u,d;e instanceof A?(c=e.x,u=e.y,Dr.set(this.target.x,this.target.y),d=!0):(c=e.theta,u=e.phi,Dr.set(fo($r.theta),fo($r.phi)),d=!1),r===zn.NONE&&(Dr.x+=c,Dr.y+=u),(t===kr.BOTH||t===kr.HORIZONTAL)&&(!d&&VM?Dr.x>n&&Dr.x<0?br.x=n-Dr.x:Dr.x<s&&Dr.x>0&&(br.x=s-Dr.x):Dr.x>n?br.x=n-Dr.x:Dr.x<s&&(br.x=s-Dr.x),n===s&&(c=0)),(t===kr.BOTH||t===kr.VERTICAL)&&(Dr.y>o?br.y=o-Dr.y:Dr.y<a&&(br.y=a-Dr.y),o===a&&(u=0)),d||(br.x=fo(br.x),br.y=fo(br.y)),r!==zn.NONE?(Vr.copy(br).divide(l),r===zn.BOUNCE?(Vr.x=Math.min(Math.abs(Vr.x),1),Vr.y=Math.min(Math.abs(Vr.y),1)):r===zn.EASE&&(Vr.x=Math.min(KM(Math.abs(Vr.x)),1),Vr.y=Math.min(KM(Math.abs(Vr.y)),1)),ho?r===zn.BOUNCE&&(Vr.x>.9||Vr.y>.9)?ho=!1:(c*br.x<0&&(c*=1-Vr.x),u*br.y<0&&(u*=1-Vr.y)):r===zn.BOUNCE&&(!d&&(Vr.x>.002||Vr.y>.002)||d&&(Math.abs(br.x)>2||Math.abs(br.y)>2))&&(c=br.x*.05,u=br.y*.05)):(c+=br.x,u+=br.y),e instanceof A?(e.x=c,e.y=u):(e.theta=c,e.phi=u)}setEnableDampingSpeed(e){this.enableDamping=e,Hg=e===!0?.2:1}stopDamping(){vi.theta=0,vi.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*UM}getZoomScale(){return Math.pow(.95,kM)}rotateLeft(e){vi.theta-=e}rotateUp(e){vi.phi-=e}panLeft(e,t){Ug.setFromMatrixColumn(t,0),Ug.multiplyScalar(-e),Qn.add(Ug)}panUp(e,t){kg.setFromMatrixColumn(t,1),kg.multiplyScalar(e),Qn.add(kg)}pan(e,t){let r=this.domElement;if(r&&this.object.isPerspectiveCamera){let n=this.object.position;FM.copy(n).sub(this.target);let s=FM.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*e*s/r.clientHeight,this.object.matrix),this.panUp(2*t*s/r.clientHeight,this.object.matrix)}else r&&this.object.isOrthographicCamera&&(this.panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this.panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix));this.dispatchEvent($3)}dollyOut(e){this.object.isPerspectiveCamera?gf/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Qg,Math.min(Kg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(IM)}dollyIn(e){this.object.isPerspectiveCamera?gf*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Qg,Math.min(Kg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(IM)}zoomOut(e=this.getZoomScale()){this.dispatchEvent(Ol),this.dollyOut(e),this.dispatchEvent(iu)}zoomIn(e=this.getZoomScale()){this.dispatchEvent(Ol),this.dollyIn(e),this.dispatchEvent(iu)}handleMouseDownRotate(e){Qo.set(e.clientX,e.clientY)}handleMouseDownDolly(e){Fl.set(e.clientX,e.clientY)}handleMouseDownPan(e){Zo.set(e.clientX,e.clientY)}handleMouseMoveRotate(e,t=1){Ko.set(e.clientX,e.clientY),Bl.subVectors(Ko,Qo).multiplyScalar(Hg*t).rotateAround(eF,-this.object.angleOffsetFromUp);let r=this.domElement;this.rotateLeft(2*Math.PI*Bl.x/r.clientHeight),this.rotateUp(2*Math.PI*Bl.y/r.clientHeight),Qo.copy(Ko),this.update()}handleMouseMoveDolly(e){Gl.set(e.clientX,e.clientY),ou.subVectors(Gl,Fl),ou.y>0?this.dollyOut(this.getZoomScale()):ou.y<0&&this.dollyIn(this.getZoomScale()),Fl.copy(Gl),this.update()}handleMouseMovePan(e,t=1){$o.set(e.clientX,e.clientY),Hr.subVectors($o,Zo).multiplyScalar(jg*t),this.pan(Hr.x,Hr.y),Zo.copy($o),this.update()}handleMouseWheel(e){if(!yf)yf=!0,Xg=iF(e),ho=!0;else{if(Xg===!1||Hc(e)){if(this.enableZoom===!1)return;e.deltaY===0?e.deltaX<0?this.dollyIn(this.getZoomScale()):e.deltaX>0&&this.dollyOut(this.getZoomScale()):e.deltaY<0?this.dollyIn(this.getZoomScale()):e.deltaY>0&&this.dollyOut(this.getZoomScale())}else{if(this.enablePan===!1)return;Hr.set(-e.deltaX,-e.deltaY).multiplyScalar(jg),Hr.x=Math.min(Math.abs(Hr.x),100)*(Hr.x<0?-1:1),Hr.y=Math.min(Math.abs(Hr.y),100)*(Hr.y<0?-1:1),e.altKey?this.pan(0,Hr.y):e.shiftKey?this.pan(Hr.x,0):this.pan(Hr.x,Hr.y)}this.update()}window.clearTimeout(HM),HM=window.setTimeout(()=>{ho=!1,yf=!1,Xg=!1},30)}handleTouchStartRotate(){if(yt.length===2){let e=.5*(yt[0].pageX+yt[1].pageX),t=.5*(yt[0].pageY+yt[1].pageY);Qo.set(e,t)}else Qo.set(yt[0].pageX,yt[0].pageY)}handleTouchStartPan(){if(yt.length===2){let e=.5*(yt[0].pageX+yt[1].pageX),t=.5*(yt[0].pageY+yt[1].pageY);Zo.set(e,t)}else Zo.set(yt[0].pageX,yt[0].pageY)}handleTouchStartDolly(){let e=yt[0].pageX-yt[1].pageX,t=yt[0].pageY-yt[1].pageY,r=Math.sqrt(e*e+t*t);Fl.set(0,r)}handleTouchStartDollyPan(){this.enableZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(e){if(yt.length===2){let r=sy(e),n=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);Ko.set(n,s)}else{if(e.pointerId!==yt[0].pointerId)return;Ko.set(e.pageX,e.pageY)}Bl.subVectors(Ko,Qo).multiplyScalar(Hg);let t=this.domElement;t&&(this.rotateLeft(2*Math.PI*Bl.x/t.clientHeight),this.rotateUp(2*Math.PI*Bl.y/t.clientHeight)),Qo.copy(Ko)}handleTouchMovePan(e){if(yt.length===2){let t=sy(e),r=.5*(e.pageX+t.x),n=.5*(e.pageY+t.y);$o.set(r,n)}else{if(e.pointerId!==yt[0].pointerId)return;$o.set(e.pageX,e.pageY)}Hr.subVectors($o,Zo).multiplyScalar(jg),this.pan(Hr.x,Hr.y),Zo.copy($o)}handleTouchMoveDolly(e){let t=sy(e),r=e.pageX-t.x,n=e.pageY-t.y,s=Math.sqrt(r*r+n*n);Gl.set(0,s),ou.set(0,Math.pow(Gl.y/Fl.y,kM)),this.dollyOut(ou.y),Fl.copy(Gl)}handleTouchMoveDollyPan(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enablePan&&this.handleTouchMovePan(e)}handleTouchMoveDollyRotate(e){this.enableZoom&&this.handleTouchMoveDolly(e),this.enableRotate&&this.handleTouchMoveRotate(e)}};function fo(i){let e=Math.PI*2;for(;i<=-Math.PI;)i+=e;for(;i>Math.PI;)i-=e;return i}function KM(i){return 1-Math.pow(1-i,4)}function iF(i){return i.wheelDeltaY===0||i.deltaY===0?Vc&&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 yt=[],vf={};function sF(i){yt.push(i)}function ZM(i){delete vf[i.pointerId];for(let e=0;e<yt.length;e++)if(yt[e].pointerId===i.pointerId){yt.splice(e,1);return}}function $M(i){let e=vf[i.pointerId];e===void 0&&(e=new F,vf[i.pointerId]=e),e.set(i.pageX,i.pageY)}function sy(i){let e=i.pointerId===yt[0].pointerId?yt[1]:yt[0];return vf[e.pointerId]}var e1=3,Tr=5855577;var t1=2857471;var oy=15711266;var ay=class extends ng{constructor(){super();this.layers.enable(e1)}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 un({color:65280,linewidth:10}),t=new A(this.ray.origin.x,this.ray.origin.y,this.ray.origin.z),r=new A(this.ray.direction.x,this.ray.direction.y,this.ray.direction.z),n=this.camera.far-this.camera.near,s=new A().addVectors(t,r.multiplyScalar(n)),o=new _e;return o.setFromPoints([t,s]),new Ys(o,e)}};var yr=class extends Wt{constructor({char:e,originalChar:t,fontFamily:r,letterSpacing:n,fontSize:s,LOD:o=16},a=new Pi({color:0,opacity:1,visible:!0,transparent:!0,side:Yt})){let l=yr.loadChar(e,r,o);super(l.geometry,a);this.char=e,this.originalChar=t!=null?t:e,this.fontFamily=r,this.letterSpacing=n,this.fontSize=s,this.LOD=o,this.resolution=l.resolution,this.glyphsHa=l.glyphsHa,this.localPosition=new F,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return yr._fontPath}static set FONTS_PATH(e){yr._fontPath=e}updatePosition(e,t){this.localPosition.copy(e);let r=new A(this.localPosition.x,-this.localPosition.y,0);this.position.copy(r).add(t)}updateFontSize(e){let t=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*t*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let t=yr.loadChar(this.char,e,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let t=yr.loadChar(e,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let t=yr.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new yr(e).copy(this)}static loadFont(e){return new Promise(function(t,r){yr.fontCache[e]?t(yr.fontCache[e]):new $m().load(yr.FONTS_PATH+e+".json",s=>{yr.fontCache[e]=s,t(s)},void 0,r)})}static loadChar(e,t,r){if(yr.charCache[e]){if(yr.charCache[e][r]&&yr.charCache[e][r].fontFamily===t)return yr.charCache[e][r]}else yr.charCache[e]={};let n=yr.fontCache[t],s=n.generateShapes(e,1);return yr.charCache[e][r]={geometry:new rl(s,r),fontFamily:t,resolution:n.data.resolution,glyphsHa:n.data.glyphs[e].ha},yr.charCache[e][r]}},en=yr;en.charCache={},en.fontCache={},en._fontPath="/_assets/_fonts/";var r1=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:d,cornerSegments:h,hollow:p}=i.parameters,f;return d||p?f=new xf(c,u,r,n,s,o,a,l*Math.PI/180,d,d,h,p):f=new $a(c,u,r,n,s,o,a,l*Math.PI/180),f.scale(1,1,t/e),Object.assign(f,{userData:xe(re({},i),{type:"CylinderGeometry"})})}};function po(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function n1(i){return new F(i.y,-i.x)}var xf=class extends _e{constructor(e,t,r,n,s,o,a,l,c,u,d,h,p=!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 f=[],g=[],v=[],y=[],m=0,x=r/2,b=new A,w=new A;p&&e==0&&(e=c),p&&t==0&&(t=u);let T=new F(e,x),S=new F(t,-x),M=null,E=null,C=null,_=null,O=T.clone().sub(S),P=0,D=0,G=0;h>0&&(P=Math.min(e,t)*(1-h),D=e-P,G=t-P);let R=T.clone();R.x-=P;let U=Math.PI-O.angle(),te=O.angle(),he=Math.tan(te/2),H=Math.tan(U/2),z=he+H,B=h?z:H,Y=h?z:he;if(c=Math.min(c,(e-D)/B,O.length()/z),u=Math.min(u,(t-G)/Y,O.length()/z),c>0){let ne=c/he;M=T.clone().sub(new F(ne,c)),h&&(C=M.clone(),C.x-=P-z*c),T.sub(O.clone().setLength(ne))}if(u>0){let ne=u/H;E=S.clone().sub(new F(ne,-u)),S.add(O.clone().setLength(ne)),h&&(_=E.clone(),_.x-=P-z*u,R.sub(O.clone().setLength(ne)))}O=T.clone().sub(S);let q=O.length()<.5,ee=[];for(let ne=0;ne<=n;ne++){let X=[],le=ne/n,$=le*l+a,V=new F(Math.sin($),Math.cos($));_&&E?(k(X,le,V,U,u,_,-1,!0),k(X,le,V,te,u,E,-1,!1)):E?(pe(X,V,E.x,0,-1),k(X,le,V,te,u,E,-1,!1)):o||pe(X,V,t,G,-1);let K=n1(O).normalize();if(po(K,V,b),!q)for(let ue=0;ue<=s;ue++){let ie=ue/s,N=O.clone().multiplyScalar(ie).add(S);po(N,V,w),g.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),y.push(le,.5+w.y/r),X.push(m++)}if(C&&M?(k(X,le,V,U,c,M,1,!1),k(X,le,V,te,c,C,1,!0)):M?(k(X,le,V,U,c,M,1,!1),pe(X,V,M.x,0,1)):o||pe(X,V,e,D,1),h&&!q){let ue=n1(O).multiplyScalar(-1).normalize();po(ue,V,b);for(let ie=0;ie<=s;ie++){let N=ie/s,L=O.clone().multiplyScalar(-N).add(R);po(L,V,w),g.push(w.x,w.y,w.z),v.push(b.x,b.y,b.z),y.push(le,.5+w.y/r),X.push(m++)}}h&&!o&&X.push(X[0]),ee.push(X)}for(let ne=0;ne<ee.length-1;ne++)for(let X=0;X<ee[0].length-1;X++){if(o&&h&&X==s)continue;let le=ee[ne][X],$=ee[ne+1][X],V=ee[ne+1][X+1],K=ee[ne][X+1],ue=g[V*3+0],ie=g[V*3+2];f.push(le,$,K),(ue!=0||ie!=0)&&f.push($,V,K)}l<Math.PI*2&&(ce(-1,ee[0],a),ce(1,ee[ee.length-1],a+l)),this.setIndex(f),this.setAttribute("position",new Ae(g,3)),this.setAttribute("normal",new Ae(v,3)),this.setAttribute("uv",new Ae(y,2));function k(ne,X,le,$,V,K,ue,ie){for(let N=0;N<d+1;N++){let L=N/d,J=ue<0?L:1-L;ie&&(J-=1),J*=$;let se=new F(Math.sin(J),Math.cos(J)*ue),ye=se.clone().multiplyScalar(V).add(K);po(ye,le,w),g.push(w.x,w.y,w.z),po(se,le,b),v.push(b.x,b.y,b.z),y.push(X,.5+w.y/r),ne.push(m++)}}function pe(ne,X,le,$,V){let K=new A,ue=new F,ie=[le,$];V<0&&ie.reverse();for(let N of ie)ue.set(N,x*V),po(ue,X,K),g.push(K.x,K.y,K.z),v.push(0,V,0),y.push(.5,.5),ne.push(m++)}function ce(ne,X,le){let $=new F(Math.sin(le),Math.cos(le)),V=new F(-Math.cos(le),Math.sin(le)),K=new A,ue=ne<0?(L,J,se)=>f.push(L,J,se):(L,J,se)=>f.push(L,se,J),ie=new F((e+t+D+G)/4,0);po(ie,$,K),g.push(K.x,K.y,K.z),v.push(V.x,0,V.y),y.push(.5,.5);let N=m++;for(let L of X){let J=g.slice(L*3,L*3+3);g.push(...J),v.push(V.x,0,V.y);let se=y.slice(L*2,L*2+2);y.push(...se),m++}for(let L=N+1;L<m-1;L++)ue(N,L,L+1);ue(N,m-1,N+1)}}};var i1=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:d}=i.parameters,h;return c>0||u>0||l<360?h=new xf(0,e/2,r,n,s,o,a,l*Math.PI/180,c,u,d,0,!0):h=new Ec(e/2,r,n,s,o),h.scale(1,1,t/e),Object.assign(h,{userData:xe(re({},i),{type:"ConeGeometry"})})}};var s1=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 In(e,t,r,n,s,o):c=new o1(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(re({},i),{type:"CubeGeometry"})})}},ly=Math.PI/2,o1=class extends _e{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=[],d=[],h=[],p=[],f=0,g=0;v("z","y","x",-1,-1,r,t,e,o,s,0),v("z","y","x",1,-1,r,t,-e,o,s,1),v("x","z","y",1,1,e,r,t,n,o,2),v("x","z","y",1,-1,e,r,-t,n,o,3),v("x","y","z",1,-1,e,t,r,n,s,4),v("x","y","z",-1,-1,e,t,-r,n,s,5),a>0&&(y("z","y","x",-1,-1,1,r,t,e,o,0),y("z","y","x",1,-1,-1,r,t,e,o,1),y("z","y","x",-1,1,-1,r,t,e,o,1),y("z","y","x",1,1,1,r,t,e,o,0),y("x","y","z",-1,-1,-1,e,t,r,n,0),y("x","y","z",1,-1,1,e,t,r,n,1),y("x","y","z",-1,1,1,e,t,r,n,0),y("x","y","z",1,1,-1,e,t,r,n,1),y("y","x","z",-1,-1,1,t,e,r,s,0),y("y","x","z",1,-1,-1,t,e,r,s,1),y("y","x","z",1,1,1,t,e,r,s,1),y("y","x","z",-1,1,-1,t,e,r,s,0),m(1,1,1),m(-1,1,1),m(1,-1,1),m(-1,-1,1),m(1,1,-1),m(-1,1,-1),m(1,-1,-1),m(-1,-1,-1)),this.setIndex(u),this.setAttribute("position",new Ae(d,3)),this.setAttribute("normal",new Ae(h,3)),this.setAttribute("uv",new Ae(p,2));function v(x,b,w,T,S,M,E,C,_,O,P){let D=(M-2*a)/_,G=(E-2*a)/O,R=M/2-a,U=E/2-a,te=C/2,he=_+1,H=O+1,z=0,B=0,Y=new A;for(let q=0;q<H;q++){let ee=q*G-U;for(let k=0;k<he;k++){let pe=k*D-R;Y[x]=pe*T,Y[b]=ee*S,Y[w]=te,d.push(Y.x,Y.y,Y.z),Y[x]=0,Y[b]=0,Y[w]=C>0?1:-1,h.push(Y.x,Y.y,Y.z),p.push(k/_),p.push(1-q/O),z+=1}}for(let q=0;q<O;q++)for(let ee=0;ee<_;ee++){let k=f+ee+he*q,pe=f+ee+he*(q+1),ce=f+(ee+1)+he*(q+1),ne=f+(ee+1)+he*q;u.push(k,pe,ne),u.push(pe,ce,ne),B+=6}c.addGroup(g,B,P),g+=B,f+=z}function y(x,b,w,T,S,M,E,C,_,O,P){let D=(E-2*a)/O,G=E/2-a,R=C/2-a,U=_/2,te=O+1,he=0,H=0,z=new A,B=new A;for(let Y=0;Y<l+1;Y++){let q=Y/l*ly,ee=Math.sin(q)*a,k=(1-Math.cos(q))*a,pe=Math.sin(q),ce=Math.cos(q);z[b]=(R+ee)*S,z[w]=(U-k)*M,B[x]=0,B[b]=pe*Math.sign(z[b]),B[w]=ce*Math.sign(z[w]);for(let ne=0;ne<te;ne++){let X=ne*D-G;z[x]=X*T,d.push(z.x,z.y,z.z),h.push(B.x,B.y,B.z),p.push(ne/O),p.push(0),he+=1}}for(let Y=0;Y<l;Y++)for(let q=0;q<O;q++){let ee=f+q+te*Y,k=f+q+te*(Y+1),pe=f+(q+1)+te*(Y+1),ce=f+(q+1)+te*Y;u.push(ee,k,ce),u.push(k,pe,ce),H+=6}c.addGroup(g,H,P),g+=H,f+=he}function m(x,b,w){let T=new A,S=new A(e/2,t/2,r/2);S.subScalar(a);let M=[],E=x*b*w>0?(_,O,P)=>u.push(_,O,P):(_,O,P)=>u.push(_,P,O);for(let _=0;_<=l;_++){let O=[],P=ly*(1-_/l),D=Math.cos(P),G=Math.sin(P),R=0;for(let U=0;U<=_;U++){let te=Math.cos(R),he=Math.sin(R);T.x=D*te,T.y=G,T.z=D*he;let H=S.clone().addScaledVector(T,a);d.push(x*H.x,b*H.y,w*H.z),h.push(x*T.x,b*T.y,w*T.z),p.push(0,0),O.push(f++),R+=ly/_}M.push(O)}let C=M.length-1;for(let _=0;_<C;_++){let O=M[_],P=M[_+1],D=O.length-1;E(O[0],P[1],P[0]);for(let G=1;G<=D;G++)E(O[G-1],O[G],P[G]),E(O[G],P[G+1],P[G])}}}};var ea=class extends _e{constructor(e,t,r,n=1,s=.2,o=4){super();this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];u(),d(),this.setAttribute("position",new Ae(a,3)),this.setAttribute("normal",new Ae(c,3)),this.setAttribute("uv",new Ae(l,2));return;function u(){var he;s=Math.min(1-1e-5,s),s==0&&(o=0);let p={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],f=new A,g=f.clone(),v=new nr,y=s*n,m=n-y,x=o+1,b=new A,w=(H,z)=>b.subVectors(H,z).normalize(),T=(H,z)=>Array(H).fill(void 0).map(z),S=T(e.length/3,(H,z)=>new A().fromArray(e,z*3).setLength(n)),M=[],E=1e6;for(let H=0;H<S.length;H++){let z=S[H],B=[],Y,q,ee,k=1e10,pe=-1;for(;(pe=t.indexOf(H,pe+1))!=-1;){let le=pe-pe%3;Y=t[le+(pe+1)%3],q=t[le+(pe+2)%3],ee=z.distanceToSquared(S[Y]),k=Math.min(k,ee),B.push([Y,q,ee])}k+=1e-6;let ce=[],ne=0,X=B.length;for(let le=0;le<X;le++){[Y,q,ee]=B[ne];let $=((he=M[Y])==null?void 0:he.includes(H))==!0;ee<=k&&ce.push(Y+ +$*E),ne=B.findIndex(V=>V[0]==q)}M.push(ce)}let C=[];{let H=0,z=0,B,Y,q=p==3;for(let ee=0;ee<=o;ee++){B=ee*(ee+1)/2,Y=(ee+1)*(ee+2)/2;for(let k=0;k<o-ee;k++)[H,z]=[B+k+ee+2,Y+k+ee+3],C.push(B,Y,...q?[z,B]:[H,Y],z,H),[B,Y]=[H,z];C.push(B,Y,B+o+2)}}let _=f.clone(),O=f.clone(),P=f.clone(),D=f.clone(),G=f.clone(),R=[],U=T(S.length,()=>T(p,()=>f.clone()));for(let H=0;H<S.length;H++){f.copy(S[H]).normalize(),_.copy(f).multiplyScalar(m);let z=M[H];for(let ce=0;ce<z.length;ce++){let ne=z[ce],X=z[(ce+1)%p];v.setFromPointsAndIndices(S,H,ne%E,X%E),v.b.sub(v.a).setLength(1e10).add(v.a),v.c.sub(v.a).setLength(1e10).add(v.a),v.closestPointToPoint(_,U[H][ce])}let B=[],Y=[],q=[],ee=new A;o==0&&[...U[H]].reduce((ce,ne)=>ce.add(ne),ee).multiplyScalar(1/p);for(let ce=0;ce<p;ce++){let ne=[],X=(ce-1+p)%p,le=U[H][X],$=U[H][ce];f.copy(le).sub(_),g.copy($).sub(_);let V=_.angleTo(f),K=f.angleTo(g),ue=Math.cos(V)*y;o==0?O.copy(ee):O.copy(_).setLength(m+ue),Y.push(ue);let ie=[O,le,$];for(let N=0;N<2;N++){let L=ie[N],J=ie[N+1];D.subVectors(L,_),G.subVectors(J,_),P.crossVectors(D,G).normalize();for(let se=0;se<x;se++){let ye=[V,K][N]*se/x;f.copy(D).applyAxisAngle(P,ye).add(_),B.push(f.clone()),N&&(w(f,_),ne.push([se==0?L:f.clone(),b.clone()]))}N&&(w(J,_),ne.push([J,b.clone()]))}q.push(ne)}R.push(q);let k=2*x,pe=2;for(let ce=0;ce<p;ce++){let ne=k*ce,X=k*((ce+1)%p),le=[B[ne]];for(let V=1;V<x;V++){D=B[ne+V],G=B[X+V],le.push(D);for(let K=1,ue=V-pe+1;K<=ue;K++)f.lerpVectors(D,G,K/(ue+1)),f.sub(_).setLength(Y[ce]).add(_),le.push(f.clone());le.push(G)}for(let V=0;V<x;V++)le.push(B[V+x+ne]);le.push(B[X+x]);let $=C.map(V=>le[V]);a.push(...$.map(V=>[V.x,V.y,V.z]).flat()),c.push(...$.map(V=>(w(V,_),[b.x,b.y,b.z])).flat())}}let te=[];for(let H=0;H<M.length;H++)for(let z=0;z<p;z++){let B=M[H][z];if(B<E){let Y=M[B].findIndex(k=>k%E==H),q=R[H][z],ee=R[B][Y];for(let k=0;k<x;k++){let pe=q[k],ce=ee[x-k],ne=q[k+1],X=ee[x-(k+1)];[pe,ce,ne,ne,ce,X].forEach(le=>{a.push(le[0].x,le[0].y,le[0].z),c.push(le[1].x,le[1].y,le[1].z)})}te.push(q[0][0],ee[x][0],q[x][0],ee[0][0])}}for(;te.length;){let H,z,B,Y;[H,z]=te.splice(0,2);let q=[H];for(;H!=z;)q.push(z),B=te.indexOf(z),Y=B%2,z=te.splice(B-Y,2)[1-Y];b.subVectors(q[0],q[1]).cross(f.subVectors(q[0],q[2])).normalize();let ee=b.dot(q[0])<0;ee&&b.negate();for(let k=1;k<=q.length-2;k++)[q[k+ +ee],q[k+1-+ee],q[0]].forEach(pe=>{a.push(pe.x,pe.y,pe.z),c.push(b.x,b.y,b.z)})}}function d(){let h=new A;for(let S=0;S<a.length;S+=3){h.x=a[S+0],h.y=a[S+1],h.z=a[S+2];let M=w(h)/2/Math.PI+.5,E=T(h)/Math.PI+.5;l.push(M,1-E)}let p=new A,f=new A,g=new A,v=new A,y=new F,m=new F,x=new F,b=(S,M,E,C)=>{C<0&&S.x===1&&(l[M]=S.x-1),E.x===0&&E.z===0&&(l[M]=C/2/Math.PI+.5)};for(let S=0,M=0;S<a.length;S+=9,M+=6){p.set(a[S+0],a[S+1],a[S+2]),f.set(a[S+3],a[S+4],a[S+5]),g.set(a[S+6],a[S+7],a[S+8]),y.set(l[M+0],l[M+1]),m.set(l[M+2],l[M+3]),x.set(l[M+4],l[M+5]),v.copy(p).add(f).add(g).divideScalar(3);let E=w(v);b(y,M+0,p,E),b(m,M+2,f,E),b(x,M+4,g,E)}for(let S=0;S<l.length;S+=6){let M=l[S+0],E=l[S+2],C=l[S+4],_=Math.max(M,E,C),O=Math.min(M,E,C);_>.9&&O<.1&&(M<.2&&(l[S+0]+=1),E<.2&&(l[S+2]+=1),C<.2&&(l[S+4]+=1))}function w(S){return Math.atan2(S.z,-S.x)}function T(S){return Math.atan2(-S.y,Math.sqrt(S.x*S.x+S.z*S.z))}}}static fromJSON(e){return new ea(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};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,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 bf(e*.5,s,o):new Lc(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(re({},i),{type:"DodecahedronGeometry"})})}},bf=class extends ea{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 bf(e.radius,e.corner,e.cornerSides)}};var au=1e-12,lu=class{constructor(e){this.position=new F;this.startPosition=new F;this.uuid=rt.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 lu(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},cu=class extends lu{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new cu(this.parent).copy(this)}},Ji=class extends lu{constructor(e,t){super(t);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new cu(this),new cu(this))}static create(e,t){let r=new Ji(e,new F(...t.position));return r.controls[0].position.set(...t.controlPrevious.position),r.controls[1].position.set(...t.controlNext.position),r.roundness=t.roundness,r.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,r}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let r=0,n=this.controls.length;r<n;r++){let s=this.controls[r];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new Ji(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},cy=i=>i,uu=new F,uy=new F,oF=new F,aF=new F,lF=new F,cF=new F,l1=new A,c1=new A;function u1(i){let e=new F;e.addVectors(i.v0,uu.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new F;return t.addVectors(i.v2,uy.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new bn(i.v0,e,t,i.v2)}function hu(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function uF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function hF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function hy(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 h1(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 d1(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function f1(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)),d;return hy(e,i,t)>Math.PI&&(u*=-1),hu(c,a)?d=(a+c)*(r/u-.5)*8/3/(o-l):d=(o+l)*(r/u-.5)*8/3/(c-a),n.set(e.x-d*a,e.y+d*o),s.set(t.x+d*c,t.y-d*l),[n,s]}function dy(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function p1(i,e,t,r,n=.5){let s=uu.subVectors(e,i).multiplyScalar(n).add(i),o=uy.subVectors(t,e).multiplyScalar(n).add(e),a=oF.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=aF.subVectors(o,s).multiplyScalar(n).add(s),u=lF.subVectors(a,o).multiplyScalar(n).add(o),d=a,h=cF.subVectors(u,c).multiplyScalar(n).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,h.x,h.y,u.x,u.y,d.x,d.y,r.x,r.y]}function m1(i,e,t=12,r=!0){let n=c1.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=cy(e[l]),u=uu,d=mo(c,t);a.push(d);for(let h=0;h<=d;h++)if(c instanceof bn||c instanceof di||c instanceof wn){if(c.getPoint(h/d,u),n.set(u.x,u.y,0),s!==void 0&&hF(s,n))continue;s===void 0&&(s=l1),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 g1(i,e,t,r=12,n=!0){let s=c1.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=cy(e[l]),d=uu,h=mo(u,r);a.push(h);for(let p=0;p<=h;p++)if(u instanceof bn||u instanceof di||u instanceof wn){if(u.getPoint(p/h,d),s.set(d.x,d.y,0),c==null?void 0:c.equals(s))continue;c===void 0?c=l1:(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 fy(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=mo(o.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=l),a+=l}o.curveAfter!==void 0&&(a+=mo(o.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=mo(i[0].roundedCurveCorner,e)*.5),r}function mo(i,e=12){return i&&i instanceof Go?e*2:i&&(i instanceof wn||i instanceof Jh)?1:i&&i instanceof el?e*i.points.length:e}function y1(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=cy(e[o]),l=mo(a,t),c=uu;for(let u=0;u<=l;u++)if(a instanceof bn||a instanceof di||a instanceof wn){if(a.getPoint(u/l,c),n!==void 0&&uF(n,c,au))continue;n===void 0&&(n=uy),n.copy(c),i.push(c.x,c.y),s++}}return hu(i[0],i[i.length-2],au)&&hu(i[1],i[i.length-1],au)&&(i.pop(),i.pop()),r&&s>1&&!(hu(i[s-1],i[1],au)&&hu(i[s-2],i[0],au))&&(i.push(i[0],i[1]),s++),i}var py=new F,dF=new F,fF=new F,pF=new F,mF=new F,gF=new F,St=class extends Jn{constructor(e=100,t=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new xr;this.plane=new xn(new A(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=rt.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=t}static createFromState(e,t,r){let n=new St;return n.isClosed=e.isClosed,n.points=e.points.map(s=>Ji.create(s.id,s.data)),typeof e.roundness=="number"&&(n.roundness=e.roundness),n.shapeHoles=e.shapeHoles.map(s=>St.createFromState(s)),t!==void 0&&r!==void 0&&n.applySize(t,r),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,r=this.points.length;t<r;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){return this.points.findIndex(t=>t.uuid===e)}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0)for(let t=0,r=this.shapeHoles.length;t<r;t++){let n=this.shapeHoles[t],s=e-this.points.length;if(s<=n.points.length-1)return n.points[s]}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],o=s.points.indexOf(e);if(o>=0)return t+o;t+=s.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this.applyScale(e/this.width,t/this.height),this._width=e,this._height=t}applyScale(e,t){let r=py.set(e,t);for(let n=0,s=this.points.length;n<s;n++){let o=this.points[n];o.position.multiply(r),o.controls[0].position.multiply(r),o.controls[1].position.multiply(r)}for(let n=0,s=this.shapeHoles.length;n<s;n++)this.shapeHoles[n].applyScale(e,t);this._update(!1)}createPoint(e,t=0,r=rt.generateUUID()){let n;e instanceof F?n=e:n=new F(e,t);let s=new Ji(r,n);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];if(n.uuid===e)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(r=>r.uuid===e);t&&this.removePoint(t)}update(e=!0){for(let t=0,r=this.shapeHoles.length;t<r;t++)this.shapeHoles[t].update(!1);this._update(e)}extractShapePointsToBuffer(e,t=12,r=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let n=r?this.roundedCurveDivisions:this.curveDivisions;return m1(e,r?this.roundedCurves:this.curves,t,this.autoClose),n.reduce((s,o)=>s+o,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=fy(this.points,e,!1),this.roundedCurveDivisions=fy(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,r=12){return g1(e,this.curves,t,r,this.autoClose).reduce((s,o)=>s+o,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),y1(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&this.points[0].roundedCurveCorner!==void 0&&(s=mo(this.points[0].roundedCurveCorner,this.subdivision)*.5);let o=e-s;o<0&&(o+=n.reduce((a,l)=>a+l,0));for(let a=0,l=n.length;a<l;a++){let c=n[a];if(o<r+c)return[a,(o-r+1)/c];r+=c}return[0,1]}getCurveT(e,t,r){let n=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],o=this.curveDivisions,a=o[e];if(dy(n,s)){let u=n.position.distanceTo(s.position);return n.position.distanceTo(py.set(r.x,r.y))/u}let l=0;for(let u=0;u<e;u++)l+=o[u];return(t-l)/a}dispose(){this.eventDispatcher=null}_applyCurveForPoint(e,t){dy(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,t.curveAfter=r;let n=r.clone();e.roundedCurveBefore=n,t.roundedCurveAfter=n,e.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(e=!0){var r;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,s=this.points.length;n<s;n++){let o=this.points[n];if(n===0)this.moveTo(o.position.x,o.position.y);else{let a=this.points[n-1];this._applyCurveForPoint(o,a)}}let t=this.getLastPoint();if((t==null?void 0:t.curveAfter)&&(t.curveAfter=void 0),this.isClosed){let n=this.points[0],s=this.points[this.points.length-1];this._applyCurveForPoint(n,s)}if(this.points.length>2){let n=0;for(let s=0,o=this.points.length;s<o;s++){let a=this.points[s],l=a.roundness;if(!a.controlsMoved()&&l>0){let c=a.curveBefore,u=a.curveAfter;if(c===void 0||u===void 0)continue;let d=a.roundedCurveBefore,h=a.roundedCurveAfter,p=c.getLength(),f=u.getLength(),g=Math.min(l,p*.499),v=Math.min(l,f*.499),y=Math.min(g,v),m=1-y/p,x=y/f,b=c.getPointAt(m,py),w=u.getPointAt(x,dF);this._subSplitCurve(c,d,m,b,void 0),this._subSplitCurve(u,h,x,void 0,w);let T;if(this.useCubicForRoundedCorners){let S=hy(b,a.position,w)/2,M=Math.tan(S)*b.distanceTo(a.position),[E,C]=h1(b,w,M,fF,pF),_=d1(E,C,a.position),[O,P]=f1(_,b,w,M,mF,gF);T=new bn(b.clone(),O.clone(),P.clone(),w.clone())}else T=new di(b.clone(),a.position.clone(),w.clone());a.roundedCurveCorner=T,this.roundedCurves.splice(s+n,0,T),n++}}}e&&((r=this.eventDispatcher)==null||r.dispatchEvent({type:"update"}))}_subSplitCurve(e,t,r,n,s){if(e instanceof wn)n!==void 0&&t.v2.copy(n),s!==void 0&&t.v1.copy(s);else{let o=e,a=t,l=o.getUtoTmapping(r,0),c=p1(o.v0,o.v1,o.v2,o.v3,l);return n!==void 0&&(a.v0.set(c[0],c[1]),a.v1.set(c[2],c[3]),a.v2.set(c[4],c[5]),a.v3.set(c[6],c[7])),s!==void 0&&(a.v0.set(c[6],c[7]),a.v1.set(c[8],c[9]),a.v2.set(c[10],c[11]),a.v3.set(c[12],c[13])),a}return t}clone(){let e=new St(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var r;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let n=0;n<t;n++){let s=n*7,o=e.points[s+0],a=e.points[s+1],l=e.points[s+2],c=e.points[s+3],u=e.points[s+4],d=e.points[s+5],h=e.points[s+6],p=new Ji(rt.generateUUID(),new F(o,a));p.controls[0].position.set(l,c),p.controls[1].position.set(u,d),p.roundness=h,this.points.push(p)}return this.shapeHoles=((r=e.shapeHoles)==null?void 0:r.length)?e.shapeHoles.map(n=>{let s=new St;return s.fromJSON(n),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){let t=(n,s)=>{s instanceof bn&&s.v3.equals(n.position)&&n.controls[0].position.copy(s.v2)},r=n=>{let s=[],o,a;for(o=0,a=n.length;o<a;o++)n[o]instanceof di&&(n[o]=u1(n[o]));for(o=0,a=n.length;o<a;o++){let u=n[o],d=o>0?n[o-1]:null,h;u instanceof bn?(h=this.createPoint(u.v0),h.controls[1].position.copy(u.v1)):u instanceof wn&&(h=this.createPoint(u.v1)),h!==void 0&&(d!==null&&t(h,d),s.push(h))}let l=n[n.length-1],c=!1;return l instanceof bn?l.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(l.v2),c=!0):l instanceof wn&&l.v2.equals(s[0].position)&&(c=!0),this.isClosed=c,s};return this.points=r(e.curves),e instanceof Jn&&(this.shapeHoles=e.holes.map(n=>{let s=new St;return s.fromShape(n),s})),this.update(),this}};var my=Math.PI*2;function gy({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function yF(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:4/3*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 v1(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 vF(i,e,t,r,n,s,o,a,l,c){let u=Math.pow(n,2),d=Math.pow(s,2),h=Math.pow(o,2),p=Math.pow(a,2),f=u*d-u*p-d*h;f<0&&(f=0),f/=u*p+d*h,f=Math.sqrt(f)*(l===c?-1:1);let g=f*n/s*a,v=f*-s/n*o,y=g+(i+t)/2,m=v+(e+r)/2,x=(o-g)/n,b=(a-v)/s,w=(-o-g)/n,T=(-a-v)/s,S=v1(1,0,x,b),M=v1(x,b,w,T);return!c&&M>0&&(M-=my),c&&M<0&&(M+=my),{centerx:y,centery:m,ang1:S,ang2:M}}function x1({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 d=Math.pow(c,2)/Math.pow(n,2)+Math.pow(u,2)/Math.pow(s,2);d>1&&(n*=Math.sqrt(d),s*=Math.sqrt(d));let h=vF(i,e,t,r,n,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:g,centery:v}=h,y=Math.abs(f)/(my/4);Math.abs(1-y)<1e-7&&(y=1);let m=Math.max(Math.ceil(y),1);f/=m;for(let x=0;x<m;x++)l.push(yF(p,f)),p+=f;return l.map(x=>{let{x:b,y:w}=gy(x[0],n,s,g,v),{x:T,y:S}=gy(x[1],n,s,g,v),{x:M,y:E}=gy(x[2],n,s,g,v);return{x1:b,y1:w,x2:T,y2:S,x:M,y:E}})}var Zt;(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"})(Zt||(Zt={}));var _r;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(_r||(_r={}));function He(i,e){if(!i)throw e||"Assertion Failed!"}var Ge=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){He(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){He(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){He(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){He(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}(),du=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}(),wf=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}(),zl=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}(),b1=function(){function i(){var e=new zl,t=new du,r=new wf(0),n=new wf(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 wf(0),r=new wf(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;He(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;He(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 zl,t=new zl,r=new du,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 zl;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var o=new du;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 du;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 zl;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 du;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&&Ge.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&Ge.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){He(n.prev===s),l=n.anEdge;do He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l),He(l.Lface===n),l=l.Lnext;while(l!==n.anEdge)}for(He(n.prev===s&&n.anEdge===null),a=t,a=t;(o=a.next)!==t;a=o){He(o.prev===a),l=o.anEdge;do He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l),He(l.Org===o),l=l.Onext;while(l!==o.anEdge)}for(He(o.prev===a&&o.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)He(l.Sym.next===c.Sym),He(l.Sym!==l),He(l.Sym.Sym===l),He(l.Org!==null),He(l.Dst!==null),He(l.Lnext.Onext.Sym===l),He(l.Onext.Sym.Lnext===l);He(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}(),w1=function(){function i(){this.handle=null}return i}(),S1=function(){function i(){this.key=null,this.node=0}return i}(),xF=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 w1,this.handles[r]=new S1;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,He(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 w1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new S1}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;He(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}(),yy=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}(),M1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),bF=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new M1,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 M1;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}(),wF=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?Ge.vertLeq(s.Org,o.Org)?Ge.edgeSign(o.Dst,s.Org,o.Org)<=0:Ge.edgeSign(s.Dst,o.Org,s.Org)>=0:Ge.edgeSign(o.Dst,n,o.Org)<=0;if(o.Dst===n)return Ge.edgeSign(s.Dst,n,s.Org)>=0;var a=Ge.edgeEval(s.Dst,n,s.Org),l=Ge.edgeEval(o.Dst,n,o.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&He(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){He(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 yy;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 Zt.ODD:return(t&1)!=0;case Zt.NONZERO:return t!==0;case Zt.POSITIVE:return t>0;case Zt.NEGATIVE:return t<0;case Zt.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,d=!0;c=r;do He(Ge.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,!d&&i.checkForRightSplice(e,l)&&(i.addWinding(c,u),i.deleteRegion(e,l),e.mesh.delete(u)),d=!1,l=a,u=c;l.dirty=!0,He(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=Ge.vertL1dist(t,e),s=Ge.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(Ge.vertLeq(n.Org,s.Org)){if(Ge.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;Ge.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(Ge.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(He(!Ge.vertEq(n.Dst,s.Dst)),Ge.vertLeq(n.Dst,s.Dst)){if(Ge.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(Ge.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,d,h=new zl,p,f;if(He(!Ge.vertEq(c,l)),He(Ge.edgeSign(l,e.event,o)<=0),He(Ge.edgeSign(c,e.event,a)>=0),He(o!==e.event&&a!==e.event),He(!t.fixUpperEdge&&!r.fixUpperEdge),o===a||(u=Math.min(o.t,l.t),d=Math.max(a.t,c.t),u>d))return!1;if(Ge.vertLeq(o,a)){if(Ge.edgeSign(c,o,a)>0)return!1}else if(Ge.edgeSign(l,a,o)<0)return!1;return i.debugEvent(e),Ge.intersect(l,o,c,a,h),He(Math.min(o.t,l.t)<=h.t),He(h.t<=Math.max(a.t,c.t)),He(Math.min(c.s,l.s)<=h.s),He(h.s<=Math.max(a.s,o.s)),Ge.vertLeq(h,e.event)&&(h.s=e.event.s,h.t=e.event.t),p=Ge.vertLeq(o,a)?o:a,Ge.vertLeq(p,h)&&(h.s=p.s,h.t=p.t),Ge.vertEq(h,o)||Ge.vertEq(h,a)?(i.checkForRightSplice(e,t),!1):!Ge.vertEq(l,e.event)&&Ge.edgeSign(l,e.event,h)>=0||!Ge.vertEq(c,e.event)&&Ge.edgeSign(c,e.event,h)<=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),f=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,f,!0),!0):(Ge.edgeSign(l,e.event,h)>=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),Ge.edgeSign(c,e.event,h)<=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=h.s,n.Org.t=h.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),Ge.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),Ge.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}Ge.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,Ge.vertEq(n.Org,r)){He(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!Ge.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}He(!1),t=i.topRightRegion(t),l=i.regionBelow(t),o=l.eUp.Sym,s=a=o.Onext,l.fixUpperEdge&&(He(s!==o),i.deleteRegion(e,l),e.mesh.delete(o),o=s.Oprev),e.mesh.splice(r.anEdge,o),Ge.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 yy;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,n=i.regionBelow(r),!!n){if(o=r.eUp,a=n.eUp,Ge.edgeSign(o.Dst,t,o.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=Ge.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);He(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 yy,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 bF(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||(He(t.fixUpperEdge),He(++r==1)),He(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,Ge.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 xF(s,Ge.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,He(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||!Ge.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}(),SF=function(){function i(){this.mesh=new b1,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=Zt.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],d=[0,0,0],h=[0,0,0],p=[null,null,null],f=[null,null,null],g=this.mesh.vHead;t=g.next;for(var v=0;v<3;++v)s=t.coords[v],c[v]=s,f[v]=t,l[v]=s,p[v]=t;for(t=g.next;t!==g;t=t.next)for(var y=0;y<3;++y)s=t.coords[y],s<c[y]&&(c[y]=s,f[y]=t),s>l[y]&&(l[y]=s,p[y]=t);var m=0;if(l[1]-c[1]>l[0]-c[0]&&(m=1),l[2]-c[2]>l[m]-c[m]&&(m=2),c[m]>=l[m]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=f[m],n=p[m],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=g.next;t!==g;t=t.next)d[0]=t.coords[0]-n.coords[0],d[1]=t.coords[1]-n.coords[1],d[2]=t.coords[2]-n.coords[2],h[0]=u[1]*d[2]-u[2]*d[1],h[1]=u[2]*d[0]-u[0]*d[2],h[2]=u[0]*d[1]-u[1]*d[0],o=h[0]*h[0]+h[1]*h[1]+h[2]*h[2],o>a&&(a=o,e[0]=h[0],e[1]=h[1],e[2]=h[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(;Ge.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Ge.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(Ge.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(Ge.edgeGoesLeft(n.Lnext)||Ge.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&&(Ge.edgeGoesRight(r.Lprev)||Ge.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===_r.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 d=c.n*n;this.vertices[d+0]=c.coords[0],this.vertices[d+1]=c.coords[1],n>2&&(this.vertices[d+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var h=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[h++]=c.n,l++,s=s.Lnext}while(s!==u.anEdge);for(var p=l;p<r;++p)this.elements[h++]=-1;if(t===_r.CONNECTED_POLYGONS){s=u.anEdge;do this.elements[h++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==u.anEdge);for(var f=l;f<r;++f)this.elements[h++]=-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 b1),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=Zt.ODD),t===void 0&&(t=_r.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_(),wF.computeInterior(this,o);var a=this.mesh;return t===_r.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),o&&a.check(),t===_r.BOUNDARY_CONTOURS?this.outputContours_(a,n):this.outputPolymesh_(a,t,r,n),!0},i}();function ta(i){var e=i.windingRule,t=e===void 0?Zt.ODD:e,r=i.elementType,n=r===void 0?_r.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,d=i.contours,h=d===void 0?[]:d,p=i.strict,f=p===void 0?!0:p,g=i.debug,v=g===void 0?!1:g;if(!h&&f)throw new Error("Contours can't be empty");if(!!h){var y=new SF;i.edgeCreateCallback&&(y.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(y.vertexIdCallback=i.vertexIdCallback);for(var m=0;m<h.length;m++)y.addContour(l||2,h[m]);return y.tesselate(t,n,o,l,u,f),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:v?y.mesh:void 0}}}var E9=Zt.ODD,C9=Zt.NONZERO,L9=Zt.POSITIVE,N9=Zt.NEGATIVE,P9=Zt.ABS_GEQ_TWO,I9=_r.POLYGONS,D9=_r.CONNECTED_POLYGONS,R9=_r.BOUNDARY_CONTOURS;var fu=class extends _e{constructor(e,t=12,r=100,n={}){super();this.type="ShapeGeometry";this.windingRule=Zt.ODD;this.elementType=_r.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=e,this._curveSegments=t,this._maxCount=r,this._maxDrawCount=r*3,this._triangulationOptions=Object.assign({windingRule:Zt.ODD,elementType:_r.POLYGONS,polySize:3,vertexSize:2,strict:!0},n),this._positionAttribute=new Fe(new Float32Array(r*3),3),this._normalAttribute=new Fe(new Float32Array(r*3),3),this._uvAttribute=new Fe(new Float32Array(r*2),2),this._indexAttribute=new Fe(new Uint32Array(r*3),1),this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.updateFromShape()}copy(e){return this._drawCount=e.drawCount,this._maxDrawCount=e._maxDrawCount,this._maxCount=e.maxCount,super.copy(e)}get curveSegments(){return this._curveSegments}set curveSegments(e){this._curveSegments=e,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let e=this._shape.extractShapePointsToFlatArray([],this._curveSegments),t=this._shape.shapeHoles.map(l=>l.extractShapePointsToFlatArray([],this._curveSegments)),r,n=!0,s=!0,o,a;for(let l=0,c=e.length/2;l<c;l++){let u=l*2,d=e[u+0],h=e[u+1];if(o!==void 0&&d!==o&&(n=!1),a!==void 0&&h!==a&&(s=!1),o=d,a=h,!n&&!s)break}if(!n&&!s&&(r=ta({contours:[e,...t],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})),this._positionAttribute.array.fill(0),this._normalAttribute.array.fill(0),this._uvAttribute.array.fill(0),this._indexAttribute.array.fill(0),this._drawCount=0,r){let l=1/0,c=-1/0,u=1/0,d=-1/0;for(let f=0,g=r.vertexCount;f<g;f++){let v=f*2,y=r.vertices[v+0],m=r.vertices[v+1];y<l&&(l=y),y>c&&(c=y),m<u&&(u=m),m>d&&(d=m)}let h=c-l,p=d-u;for(let f=0,g=r.vertexCount;f<g;f++){let v=f*2,y=r.vertices[v+0],m=r.vertices[v+1],x=(y-l)/h,b=(m-u)/p;this._positionAttribute.setXYZ(f,y,m,0),this._normalAttribute.setXYZ(f,0,0,1),this._uvAttribute.setXY(f,x,b)}for(let f=0,g=r.elementCount;f<g;f++){let v=f*3,y=r.elements[v+0],m=r.elements[v+1],x=r.elements[v+2];this._indexAttribute.setX(v+0,y),this._indexAttribute.setX(v+1,m),this._indexAttribute.setX(v+2,x),this._drawCount+=3}}return this._positionAttribute.needsUpdate=!0,this._normalAttribute.needsUpdate=!0,this._uvAttribute.needsUpdate=!0,this._indexAttribute.needsUpdate=!0,this.setDrawRange(0,this._drawCount),this._drawCount>this._maxDrawCount}};var Mf=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*Mf.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*Mf.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)}},Sf=Mf;Sf.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var vy=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),xy=class extends _e{constructor(e,t,r=0,n=12,s=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=t,r<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(r,t/2-1e-12),this._bevelSegments=Math.floor(s));let o=this._shape.extractShapePointsToFlatArray([],n),a=this._shape.shapeHoles.map(T=>{let S=T.extractShapePointsToFlatArray([],n),M=[];for(let E=S.length-1;E>=1;E-=2){let C=S[E-1],_=S[E-0];M.push(C,_)}return M}),l=ta({windingRule:Zt.ODD,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[o]}),c=ta({windingRule:Zt.ODD,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]});if(!l)throw new Error("error generating geometry");let u=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let T=0;T<c.elements.length;T++){let S=c.elements[T],M=T%2==0?l.vertexCount:0;l.elements.push(S+M)}for(let T=0;T<c.vertexIndices.length;T++){let S=c.vertexIndices[T],M=l.vertexCount;l.vertexIndices.push(S+M)}for(let T=0;T<c.vertices.length;T++){let S=c.vertices[T];l.vertices.push(S)}}let d=1/0,h=-1/0,p=1/0,f=-1/0;for(let T=0,S=l.vertexCount;T<S;T++){let M=T*2,E=l.vertices[M+0],C=l.vertices[M+1];E<d&&(d=E),E>h&&(h=E),C<p&&(p=C),C>f&&(f=C)}this._minX=d,this._minY=p,this._width=h-d,this._height=f-p;let g=l.vertexCount*2*(2+this._bevelSegments);this._buffer=new Sf(g);let v=[],y=[];for(let T=l.elementCount-1,S=l.elementCount;T>=0;T--){let M=T>=u,E=T*2,C=l.elements[E+0],_=l.elements[E+1],O=C+_,P={start:C,count:_,normals:[],continuous:[],concave:[]},D=C,G=O-1,R=C+1,U=this._shape.roundedCurves.length;do{let z=D-C,B=l.vertices[G*2+0],Y=l.vertices[G*2+1],q=l.vertices[D*2+0],ee=l.vertices[D*2+1],k=l.vertices[R*2+0],pe=l.vertices[R*2+1],ce=q-B,ne=ee-Y,X=Math.sqrt(ce*ce+ne*ne);ce/=X,ne/=X;let le=q-k,$=ee-pe,V=Math.sqrt(le*le+$*$);le/=V,$/=V,P.normals[z*2+0]=-$,P.normals[z*2+1]=le,P.concave[z]=ce*$-ne*le>0;let K=l.vertexIndices[D];if(Array.isArray(K))P.continuous[z]=!1;else{let[ue,ie]=this._shape.getCurveIndexFromVertexId(K-1,!0);if(ie>0&&ie<1)P.continuous[z]=!0;else{let N=ie===1?ue+1:ue-1;N=(N+U)%U;let L=ie===1?0:1,J=this._shape.roundedCurves[ue].getTangent(ie),se=this._shape.roundedCurves[N].getTangent(L);P.continuous[z]=J.dot(se)>.95}}M&&(P.normals[z*2+0]*=-1,P.normals[z*2+1]*=-1),[G,D,R]=[D,R,R+1],R>=O&&(R-=_)}while(R!==C+1);let te=[];te.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(C*2,O*2),vertexCount:_,vertexIndices:new Array(_).fill(!0).map((z,B)=>[B,B]),elements:[0,_],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(C*2,O*2)});for(let z=1;z<=this._bevelSegments;z++){let B=z/this._bevelSegments*Math.PI/2,Y=(1-Math.cos(B))*this._bevelSize,q=[],ee=[],k=[],pe=[],ce=0;for(let X=0;X<_;X++){let le=X*2,$=(X-1+_)%_*2,V=l.vertices[P.start*2+le+0],K=l.vertices[P.start*2+le+1],ue=-P.normals[$+0]*Y,ie=-P.normals[$+1]*Y,N=-P.normals[le+0]*Y,L=-P.normals[le+1]*Y;if(P.concave[X]||!P.concave[X]&&M){let J=Math.atan2(ie,ue),se=Math.atan2(L,N);se>J&&(se-=Math.PI*2);let ye=se-J;if(P.continuous[X]||M){let me=J+ye/2,Ie=Math.cos(me)*Y,we=Math.sin(me)*Y;q[2*ce+0]=V+Ie*(M?-1:1),q[2*ce+1]=K+we*(M?-1:1),pe[ce]=X,ce++}else{let me=Math.max(1,Math.floor(n/4*Math.abs(ye)/Math.PI));for(let Ie=0;Ie<=me;Ie++){let we=J+ye*(Ie/me),Re=Math.cos(we)*Y,Ee=Math.sin(we)*Y;q[2*ce+0]=V+Re,q[2*ce+1]=K+Ee,pe[ce]=X,ce++}}}else q[2*ce+0]=V+ue,q[2*ce+1]=K+ie,pe[ce]=X,ee[X]=ce,ce++,q[2*ce+0]=V,q[2*ce+1]=K,pe[ce]=X,ce++,q[2*ce+0]=V+N,q[2*ce+1]=K+L,pe[ce]=X,k[X]=ce,ce++}let ne=ta({windingRule:Zt.POSITIVE,elementType:_r.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[q],edgeCreateCallback:X=>{let $=X.Org.idx,V=pe[$],K=pe[($+1)%pe.length];X.idx=[V,K],X.Sym.idx=[K,V]},vertexIdCallback:X=>{let le=X.Lprev.idx;return[le?le[1]:0,X.idx[0]]}});if(!ne)throw console.log("Error"),new Error(`error generating bevel geometry for ${z}'th loop`);if(!ne.vertexCount)break;for(let X=0;X<ne.vertexIndices.length;X++){let[le,$]=ne.vertexIndices[X];if(le===$)continue;let V=$;$<le&&(V+=_);for(let K=le;K<V;K++){let ue=K%_,ie=(K+1)%_;if(!P.continuous[ue]||!P.continuous[ie]){ne.vertexIndices[X]=[le,ue],ne.vertexIndices.splice(X+1,0,[ie,$]),ne.vertices.splice((X+1)*2,0,ne.vertices[X*2],ne.vertices[X*2+1]);break}}}te.push({bevelI:z,angle:B,size:Y,boundary:ne,reverseMap:pe,insetPoints:q})}let he=(z,B,Y)=>{let q=0,ee=z.boundary.vertexIndices.length;for(;q<ee&&Y(z.boundary.vertexIndices[B]);)B=(B+1)%ee,q++;return q},H=v.length;for(let z=1;z<te.length;z++){let B=te[z-1],Y=te[z],q=B.boundary.vertexIndices.length,ee=Y.boundary.vertexIndices.length;if(!q||!ee)break;let k=P.concave.length,pe=0,ce=vy(pe,_);for(;!B.boundary.vertexIndices.filter(ce).length||!Y.boundary.vertexIndices.filter(ce).length;)pe++,ce=vy(pe,_);let ne=B.boundary.vertexIndices.findIndex(ce),X=Y.boundary.vertexIndices.findIndex(ce);do ne=(ne+1)%q;while(ce(B.boundary.vertexIndices[ne]));do X=(X+1)%ee;while(ce(Y.boundary.vertexIndices[X]));pe=(pe+1)%_;let le=pe,$=this.buildBevelVert(P,B,(ne-1+q)%q),V=this.buildBevelVert(P,Y,(X-1+ee)%ee),K=$,ue=V,ie,N,L=!1;do{ce=vy(pe,_);let J=he(B,ne,ce),se=he(Y,X,ce),ye=L;if(L=!1,J&&!se){for(let me=0;me<J;me++)ie=this.buildBevelVert(P,B,(ne+me)%q,me/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie;L=!0}else if(!J&&se)for(let me=0;me<se;me++)N=this.buildBevelVert(P,Y,(X+me)%ee,me/(se-1)),v.push(ue.topN,K.topP,N.topP),v.push(K.bottomP,ue.bottomN,N.bottomP),ue=N;else if(J&&se)if(ie=this.buildBevelVert(P,B,ne,0),N=this.buildBevelVert(P,Y,X,0),ye?(v.push(K.topN,N.topP,ue.topN),v.push(K.topN,ie.topP,N.topP),v.push(N.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,K.bottomN,N.bottomP)):(v.push(K.topN,ie.topP,ue.topN),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,ue.bottomN,N.bottomP)),K=ie,ue=N,J===se)for(let me=1;me<J;me++)ie=this.buildBevelVert(P,B,(ne+me)%q,me/(J-1)),N=this.buildBevelVert(P,Y,(X+me)%ee,me/(se-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,K.bottomN,ue.bottomN),v.push(ie.bottomP,ue.bottomN,N.bottomP),K=ie,ue=N;else if(J>se){let me=J/se,Ie=0;for(let we=1;we<J;we++)ie=this.buildBevelVert(P,B,(ne+we)%q,we/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie,we>(Ie+1)*me&&(Ie++,N=this.buildBevelVert(P,Y,(X+Ie)%ee,Ie/(se-1)),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,ue.bottomN,N.bottomP),ue=N)}else{let me=se/J,Ie=0;for(let we=1;we<se;we++)N=this.buildBevelVert(P,Y,(X+we)%ee,we/(se-1)),v.push(ue.topN,ie.topP,N.topP),v.push(ie.bottomP,ue.bottomN,N.bottomP),ue=N,we>(Ie+1)*me&&(Ie++,ie=this.buildBevelVert(P,B,(ne+Ie)%q,Ie/(J-1)),v.push(K.topN,ie.topP,ue.topN),v.push(ie.bottomP,K.bottomN,ue.bottomN),K=ie)}ne=(ne+J)%q,X=(X+se)%ee,pe=(pe+1)%k}while(pe!==le)}{let z=te[0];for(let B=0,Y=z.boundary.vertexCount;B<Y;B++){let q=this.buildBevelVert(P,z,B),ee=this.buildBevelVert(P,z,(B+1)%Y);v.push(ee.topP,q.topN,q.bottomN),v.push(ee.topP,q.bottomN,ee.bottomP)}}if(M){let z=[];for(let B=v.length-1;B>=H+2;B-=3){let Y=v[B-2],q=v[B-1],ee=v[B-0];z.push(ee,q,Y)}v.splice(H,v.length-H,...z)}if(M){let z=[];for(let B=te[te.length-1].boundary.vertices.length-1;B>=1;B-=2){let Y=te[te.length-1].boundary.vertices[B-1],q=te[te.length-1].boundary.vertices[B-0];z.push(Y,q)}y.push(z)}if(!M){let z=te[te.length-1],B=ta({windingRule:te.length>1?Zt.POSITIVE:Zt.ODD,elementType:_r.POLYGONS,vertexSize:2,strict:!0,contours:[z.insetPoints,...y]});if(!B)throw new Error("Error generating geometry for surface");for(let Y=0;Y<B.elementCount*3;Y+=3){let q=this.buildSurfaceVert(B,B.elements[Y+0]),ee=this.buildSurfaceVert(B,B.elements[Y+1]),k=this.buildSurfaceVert(B,B.elements[Y+2]);v.push(q.top,ee.top,k.top),v.push(k.bottom,ee.bottom,q.bottom)}}this.vertexCache={}}this._buffer.shrink();let m=new Fe(Uint32Array.from(v),1),x=new Fe(this._buffer.positions,3),b=new Fe(this._buffer.normals,3),w=new Fe(this._buffer.uvs,2);x.needsUpdate=!0,b.needsUpdate=!0,w.needsUpdate=!0,m.needsUpdate=!0,this.setAttribute("position",x),this.setAttribute("normal",b),this.setAttribute("uv",w),this.setIndex(m)}buildSurfaceVert(e,t){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let n=e.vertices[t*2+0],s=e.vertices[t*2+1],o=(n-this._minX)/this._width,a=(s-this._minY)/this._height,l=this._buffer.get(2),c=l*3,u=l*2,d={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=n,this._buffer.positions[c+1]=s,this._buffer.positions[c+2]=this._depth,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[u+0]=o,this._buffer.uvs[u+1]=a,this._buffer.positions[c+3]=n,this._buffer.positions[c+4]=s,this._buffer.positions[c+5]=0,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[u+2]=o,this._buffer.uvs[u+3]=a,this.vertexCache[r]=d,d}buildBevelVert(e,t,r,n=1){let s=`${t.bevelI}:${r}`;if(s in this.vertexCache)return this.vertexCache[s];let[o,a]=t.boundary.vertexIndices[r],l,c,u,d;o!==a?(c=o,l=a,d=!1,u=e.continuous[c]&&e.continuous[l]):(l=o,c=(l-1+e.count)%e.count,d=e.concave[l]&&t.bevelI>0,u=e.continuous[l]||d);let h=Math.cos(t.angle),p=Math.sin(t.angle),f=r*2,g=l*2,v=c*2,y=t.boundary.vertices[f+0],m=t.boundary.vertices[f+1],x=(1-p)*this._bevelSize,b=(y-this._minX)/this._width,w=(m-this._minY)/this._height,T=e.normals[g+0],S=e.normals[g+1],M=e.normals[v+0],E=e.normals[v+1];if(d){let D=M-T,G=E-S;T=T+D*(1-n),S=S+G*(1-n);let R=Math.sqrt(T*T+S*S);T/=R,S/=R}let C=this._buffer.get(u?2:4),_=C*3,O=C*2,P={i:r,fi:l,topP:C+0,topN:C+0,bottomP:C+1,bottomN:C+1};return this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=m,this._buffer.positions[_+2]=this._depth-x,this._buffer.normals[_+0]=T*h,this._buffer.normals[_+1]=S*h,this._buffer.normals[_+2]=p,this._buffer.uvs[O+0]=b,this._buffer.uvs[O+1]=w,this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=m,this._buffer.positions[_+5]=x,this._buffer.normals[_+3]=T*h,this._buffer.normals[_+4]=S*h,this._buffer.normals[_+5]=-p,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=b,u||(C+=2,_+=6,O+=4,P.topP=C+0,P.bottomP=C+1,this._buffer.positions[_+0]=y,this._buffer.positions[_+1]=m,this._buffer.positions[_+2]=this._depth-x,this._buffer.normals[_+0]=M*h,this._buffer.normals[_+1]=E*h,this._buffer.normals[_+2]=p,this._buffer.uvs[O+0]=b,this._buffer.uvs[O+1]=w,this._buffer.positions[_+3]=y,this._buffer.positions[_+4]=m,this._buffer.positions[_+5]=x,this._buffer.normals[_+3]=M*h,this._buffer.normals[_+4]=E*h,this._buffer.normals[_+5]=-p,this._buffer.uvs[O+2]=w,this._buffer.uvs[O+3]=b),this.vertexCache[s]=P,P}};var jr=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,u,d,h,p,f,g;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((u=t.height)!=null?u:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(d=t.depth)!=null?d:0),o=(h=i.shape)!=null?h:e==null?void 0:e.shape,a=(p=o==null?void 0:o.roundness)!=null?p:t.roundness;o!==void 0&&(o instanceof St?(o.width!==r||o.height!==n)&&o.applySize(r,n):o=new St(r,n).fromJSON(o),((f=i.parameters)==null?void 0:f.roundness)!==void 0&&((g=i.parameters)==null?void 0:g.roundness)>0&&o.update(!1));let l=o!=null?o:new St(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s,surfaceMaxCount:o}=i.parameters;i.shape.roundness=s;let a;return e<=0?a=new fu(i.shape,n,o):a=new xy(i.shape,e,t,n,r),Object.assign(a,{userData:xe(re({},i),{type:"VectorGeometry"})})}};var A1=Math.PI*2,T1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(o=t.depth)!=null?o:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u=i.shape,d=e*.5,h=t*.5,p=MF(u,d,h,n*Math.PI/180,r,s);u.isClosed=!0,u.update();let f=jr.create({shape:u,parameters:{subdivisions:p,surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(f,{userData:xe(re({},i),{type:"EllipseGeometry"})})}};function MF(i,e,t,r,n,s){if(r>=A1)return n>30||n%4==0?(TF(i,e,t,s),Math.round(n/4)):_1(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=x1({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?AF(i,o.x,o.y,c,n,e,t,s):_1(i,r,n,e,t,s)}function AF(i,e,t,r,n,s,o,a){let l=Math.round(n/r.length);i.addPoint(Ul(e,t));for(let c=0,u=r.length;c<u;c++){let d=r[c],h=i.points[c],p=Ul(d.x,d.y);h.controls[1].position.set(d.x1,d.y1),p.controls[0].position.set(d.x2,d.y2),i.addPoint(p)}return a>0?E1(i,s,o,a):i.addPoint(Ul(0,0)),l}function _1(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(Ul(c,u))}return e<A1?s>0?E1(i,r,n,s):i.addPoint(Ul(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&C1(i,r,n,s)),1}function TF(i,e,t,r=0,n=0,s=0){let o=.5522847498,a=e*o,l=t*o;i.addPoint(Af(n-e,s,n-e,s-l,n-e,s+l)),i.addPoint(Af(n,s+t,n-a,s+t,n+a,s+t)),i.addPoint(Af(n+e,s,n+e,s+l,n+e,s-l)),i.addPoint(Af(n,s-t,n+a,s-t,n-a,s-t)),r>0&&C1(i,e,t,r)}function Ul(i,e){return new Ji(rt.generateUUID(),new F(i,e))}function Af(i,e,t,r,n,s){let o=Ul(i,e);return o.controls[0].position.set(t,r),o.controls[1].position.set(n,s),o}function E1(i,e,t,r){L1(i,e,t,r).forEach(s=>i.addPoint(s))}function C1(i,e,t,r){let n=L1(i,e,t,r),s=new St;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function L1(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),o=new F(n/e,s/t),a=i.points.map(l=>l.clone()).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 N1=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:d}=i.parameters,h=new Tf(!1,e,t,r,n,s,o,a,l,c,u,d);return Object.assign(h,{userData:xe(re({},i),{type:"HelixGeometry"})})}},Tf=class extends _e{constructor(e,t,r,n,s,o,a,l,c,u,d,h){super();let p=e&&o===1;p&&(h=0),d>100&&(d=100);let f=()=>new A,g=new A,v=f(),y=f(),m=f(),x,b,w,T,S,M,E,C,_=f(),O=f(),P=f(),D=f(),G=f(),R=f(),U=f(),te=f(),he=r-2*l+.001,H=he/o,z=Math.ceil(a*o),B=z+1,Y=he/z,q=-he/2,ee=u+1,k=2*Math.PI/u,pe=Math.PI/2/h,ce=.01,ne=Math.min((1-d/100)*l,l-ce),X=l-ne,le=0,$=2,V=h*$+$,K=ee*V/$,ue=K+ee*B,ie=ee*(B+V),[N,L,J]=[3,3,2].map(Be=>Array(ie*Be).fill(0)),se=[],ye=s-l;function me(Be,gt){let Mt=Math.PI/2;M=gt*Y,C=2*Math.PI*(M%H)/H+Mt,M+=q,E=Math.sin(C)*ye,S=Math.cos(C)*ye,e?Be.set(S,E,M):Be.set(S,M,E)}me(g,-1e-10),me(v,0),_.copy(g),me(g,1);let Ie=g.distanceTo(v),we=X+ne,Re=Ie*z+2*we,Ee=ne,j=Re-we;for(let Be=0;Be<=z;Be++){me(y,Be),te.subVectors(y,_).normalize(),_.copy(y),R.copy(y).setComponent(+e+1,0).normalize(),U.crossVectors(te,R).normalize();let gt=Be===0,Mt=Be===z,Cn=gt?3*Math.PI/2:pe,Gt=gt?Ee:j,yn=gt?ee:ue,vn=gt?0:ie-ee,Ps=te.clone().multiplyScalar(gt?-X:X).add(y),pa=te.clone().multiplyScalar(gt?-1:1).normalize();for(let an=0;an<ee;an++){let Is=an*k;if(O.addVectors(g.copy(R).multiplyScalar(l*Math.cos(Is)),v.copy(U).multiplyScalar(l*Math.sin(Is))),P.copy(O).normalize(),gt||Mt){p||(le=vn+an,[0,1,2].forEach(Ht=>{N[le*3+Ht]=Ps.getComponent(Ht),L[le*3+Ht]=pa.getComponent(Ht)}),J[le*2]=+Mt,J[le*2+1]=an/u),v.copy(P).multiplyScalar(ne),m.addVectors(y,v);for(let Ht=0;Ht<h;Ht++){let ss=Ht*pe+Cn;D.addVectors(g.copy(te).multiplyScalar(X*Math.sin(ss)),v.copy(P).multiplyScalar(X*Math.cos(ss))),G.copy(D).normalize(),v.addVectors(m,D),D.normalize(),le=yn+Ht*ee+an,[0,1,2].forEach(Ve=>{N[le*3+Ve]=v.getComponent(Ve),L[le*3+Ve]=G.getComponent(Ve)});let ma=+gt+Math.sin(ss);J[le*2]=(Gt+X*ma)/Re,J[le*2+1]=an/u}}v.addVectors(y,O),le=K+Be*ee+an,[0,1,2].forEach(Ht=>{N[le*3+Ht]=v.getComponent(Ht),L[le*3+Ht]=P.getComponent(Ht)}),J[le*2]=(we+Be*Ie)/Re,J[le*2+1]=an/u}}let Se=B+2*h+$,fe=1,[Ne,De]=p?[fe,fe+B-1]:[0,Se-1];for(let Be=Ne;Be<=De-1;Be++){let gt=p&&Be===De-1;for(let Mt=0;Mt<ee-1;Mt++)x=Be*ee+Mt,b=x+1,w=(gt?Mt:x)+ee,T=(gt?Mt+1:b)+ee,Be===0?se.push(b,T,w):Be===Se-2?se.push(x,b,w):se.push(x,b,w,b,T,w)}this.setIndex(se),this.setAttribute("position",new Ae(N,3)),this.setAttribute("normal",new Ae(L,3)),this.setAttribute("uv",new Ae(J,2))}};var P1=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 _f(e*.5,s,o):new Oc(e*.5,n);return a.scale(1,t/e,r/e),Object.assign(a,{userData:xe(re({},i),{type:"IcosahedronGeometry"})})}},_f=class extends ea{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 _f(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 Jn;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 Bc(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:xe(re({},i),{type:"LatheGeometry"})})}};var qi=new Me,by=new Ze,Ef=new A,ra=class extends xr{constructor(){super();this.uuid=rt.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 Dt().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 qi.makeRotationX(e),this.applyMatrix4(qi),this}rotateY(e){return qi.makeRotationY(e),this.applyMatrix4(qi),this}rotateZ(e){return qi.makeRotationZ(e),this.applyMatrix4(qi),this}translate(e,t,r){return qi.makeTranslation(e,t,r),this.applyMatrix4(qi),this}scale(e,t,r){return qi.makeScale(e,t,r),this.applyMatrix4(qi),this}lookAt(e){return by.lookAt(e),by.updateMatrix(),this.applyMatrix4(by.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 h=0;h<s.count;h++)t.vertices.push(new A().fromBufferAttribute(s,h)),a!==void 0&&t.colors.push(new ve().fromBufferAttribute(a,h));function u(h,p,f,g){let v=a===void 0?[]:[t.colors[h].clone(),t.colors[p].clone(),t.colors[f].clone()],y=o===void 0?[]:[new A().fromBufferAttribute(o,h),new A().fromBufferAttribute(o,p),new A().fromBufferAttribute(o,f)],m=new pu(h,p,f,y,v,g);t.faces.push(m),l!==void 0&&t.faceVertexUvs[0].push([new F().fromBufferAttribute(l,h),new F().fromBufferAttribute(l,p),new F().fromBufferAttribute(l,f)]),c!==void 0&&t.faceVertexUvs[1].push([new F().fromBufferAttribute(c,h),new F().fromBufferAttribute(c,p),new F().fromBufferAttribute(c,f)])}let d=e.groups;if(d.length>0)for(let h=0;h<d.length;h++){let p=d[h],f=p.start,g=p.count;for(let v=f,y=f+g;v<y;v+=3)r!==void 0?u(r.getX(v),r.getX(v+1),r.getX(v+2),p.materialIndex):u(v,v+1,v+2,p.materialIndex)}else if(r!==void 0)for(let h=0;h<r.count;h+=3)u(r.getX(h),r.getX(h+1),r.getX(h+2));else for(let h=0;h<s.count;h+=3)u(h,h+1,h+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(Ef).negate(),this.translate(Ef.x,Ef.y,Ef.z),this}normalize(){this.computeBoundingSphere();let e=this.boundingSphere.center,t=this.boundingSphere.radius,r=t===0?1:1/t,n=new Me;return n.set(r,0,0,-r*e.x,0,r,0,-r*e.y,0,0,r,-r*e.z,0,0,0,1),this.applyMatrix4(n),this}computeFaceNormals(){let e=new A,t=new A;for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=this.vertices[s.a],a=this.vertices[s.b],l=this.vertices[s.c];e.subVectors(l,a),t.subVectors(o,a),e.cross(t),e.normalize(),s.normal.copy(e)}}computeVertexNormals(e=!0){let t=new Array(this.vertices.length);for(let r=0,n=this.vertices.length;r<n;r++)t[r]=new A;if(e){let r=new A,n=new A;for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=this.vertices[a.a],c=this.vertices[a.b],u=this.vertices[a.c];r.subVectors(u,c),n.subVectors(l,c),r.cross(n),t[a.a].add(r),t[a.b].add(r),t[a.c].add(r)}}else{this.computeFaceNormals();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r];t[s.a].add(s.normal),t[s.b].add(s.normal),t[s.c].add(s.normal)}}for(let r=0,n=this.vertices.length;r<n;r++)t[r].normalize();for(let r=0,n=this.faces.length;r<n;r++){let s=this.faces[r],o=s.vertexNormals;o.length===3?(o[0].copy(t[s.a]),o[1].copy(t[s.b]),o[2].copy(t[s.c])):(o[0]=t[s.a].clone(),o[1]=t[s.b].clone(),o[2]=t[s.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeFlatVertexNormals(){this.computeFaceNormals();for(let e=0,t=this.faces.length;e<t;e++){let r=this.faces[e],n=r.vertexNormals;n.length===3?(n[0].copy(r.normal),n[1].copy(r.normal),n[2].copy(r.normal)):(n[0]=r.normal.clone(),n[1]=r.normal.clone(),n[2]=r.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)}computeMorphNormals(){for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.__originalFaceNormal?n.__originalFaceNormal.copy(n.normal):n.__originalFaceNormal=n.normal.clone(),n.__originalVertexNormals||(n.__originalVertexNormals=[]);for(let s=0,o=n.vertexNormals.length;s<o;s++)n.__originalVertexNormals[s]?n.__originalVertexNormals[s].copy(n.vertexNormals[s]):n.__originalVertexNormals[s]=n.vertexNormals[s].clone()}let e=new ra;e.faces=this.faces;for(let t=0,r=this.morphTargets.length;t<r;t++){if(!this.morphNormals[t]){this.morphNormals[t]={},this.morphNormals[t].faceNormals=[],this.morphNormals[t].vertexNormals=[];let s=this.morphNormals[t].faceNormals,o=this.morphNormals[t].vertexNormals;for(let a=0,l=this.faces.length;a<l;a++){let c=new A,u={a:new A,b:new A,c:new A};s.push(c),o.push(u)}}let n=this.morphNormals[t];e.vertices=this.morphTargets[t].vertices,e.computeFaceNormals(),e.computeVertexNormals();for(let s=0,o=this.faces.length;s<o;s++){let a=this.faces[s],l=n.faceNormals[s],c=n.vertexNormals[s];l.copy(a.normal),c.a.copy(a.vertexNormals[0]),c.b.copy(a.vertexNormals[1]),c.c.copy(a.vertexNormals[2])}}for(let t=0,r=this.faces.length;t<r;t++){let n=this.faces[t];n.normal=n.__originalFaceNormal,n.vertexNormals=n.__originalVertexNormals}}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr),this.boundingBox.setFromPoints(this.vertices)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ln),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,d=e.colors;t!==void 0&&(n=new Dt().getNormalMatrix(t));for(let h=0,p=a.length;h<p;h++){let g=a[h].clone();t!==void 0&&g.applyMatrix4(t),o.push(g)}for(let h=0,p=d.length;h<p;h++)u.push(d[h].clone());for(let h=0,p=c.length;h<p;h++){let f=c[h],g,v,y=f.vertexNormals,m=f.vertexColors,x=new pu(f.a+s,f.b+s,f.c+s);x.normal.copy(f.normal),n!==void 0&&x.normal.applyMatrix3(n).normalize();for(let b=0,w=y.length;b<w;b++)g=y[b].clone(),n!==void 0&&g.applyMatrix3(n).normalize(),x.vertexNormals.push(g);x.color.copy(f.color);for(let b=0,w=m.length;b<w;b++)v=m[b],x.vertexColors.push(v.clone());x.materialIndex=f.materialIndex+r,l.push(x)}for(let h=0,p=e.faceVertexUvs.length;h<p;h++){let f=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let g=0,v=f.length;g<v;g++){let y=f[g],m=[];for(let x=0,b=y.length;x<b;x++)m.push(y[x].clone());this.faceVertexUvs[h].push(m)}}}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],d=Math.round(u.x*s)+"_"+Math.round(u.y*s)+"_"+Math.round(u.z*s);t[d]===void 0?(t[d]=l,r.push(this.vertices[l]),n[l]=r.length-1):n[l]=n[t[d]]}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 d=[u.a,u.b,u.c];for(let h=0;h<3;h++)if(d[h]===d[(h+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,d=this.faceVertexUvs.length;u<d;u++)this.faceVertexUvs[u].splice(c,1)}let a=this.vertices.length-r.length;return this.vertices=r,a}setFromPoints(e){this.vertices=[];for(let t=0,r=e.length;t<r;t++){let n=e[t];this.vertices.push(new A(n.x,n.y,n.z||0))}return this}sortFacesByMaterialIndex(){let e=this.faces,t=e.length;for(let l=0;l<t;l++)e[l]._id=l;function r(l,c){return l.materialIndex-c.materialIndex}e.sort(r);let n=this.faceVertexUvs[0],s=this.faceVertexUvs[1],o,a;n&&n.length===t&&(o=[]),s&&s.length===t&&(a=[]);for(let l=0;l<t;l++){let c=e[l]._id;o&&o.push(n[c]),a&&a.push(s[c])}o&&(this.faceVertexUvs[0]=o),a&&(this.faceVertexUvs[1]=a)}toJSON(){let e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){let f=this.parameters;for(let g in f)f[g]!==void 0&&(e[g]=f[g]);return e}let t=[];for(let f=0;f<this.vertices.length;f++){let g=this.vertices[f];t.push(g.x,g.y,g.z)}let r=[],n=[],s={},o=[],a={},l=[],c={};for(let f=0;f<this.faces.length;f++){let g=this.faces[f],v=!0,y=!1,m=this.faceVertexUvs[0][f]!==void 0,x=g.normal.length()>0,b=g.vertexNormals.length>0,w=g.color.r!==1||g.color.g!==1||g.color.b!==1,T=g.vertexColors.length>0,S=0;if(S=u(S,0,0),S=u(S,1,v),S=u(S,2,y),S=u(S,3,m),S=u(S,4,x),S=u(S,5,b),S=u(S,6,w),S=u(S,7,T),r.push(S),r.push(g.a,g.b,g.c),r.push(g.materialIndex),m){let M=this.faceVertexUvs[0][f];r.push(p(M[0]),p(M[1]),p(M[2]))}if(x&&r.push(d(g.normal)),b){let M=g.vertexNormals;r.push(d(M[0]),d(M[1]),d(M[2]))}if(w&&r.push(h(g.color)),T){let M=g.vertexColors;r.push(h(M[0]),h(M[1]),h(M[2]))}}function u(f,g,v){return v?f|1<<g:f&~(1<<g)}function d(f){let g=f.x.toString()+f.y.toString()+f.z.toString();return s[g]!==void 0||(s[g]=n.length/3,n.push(f.x,f.y,f.z)),s[g]}function h(f){let g=f.r.toString()+f.g.toString()+f.b.toString();return a[g]!==void 0||(a[g]=o.length,o.push(f.getHex())),a[g]}function p(f){let g=f.x.toString()+f.y.toString();return c[g]!==void 0||(c[g]=l.length/2,l.push(f.x,f.y)),c[g]}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 ra().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 h=0,p=t.length;h<p;h++)this.vertices.push(t[h].clone());let r=e.colors;for(let h=0,p=r.length;h<p;h++)this.colors.push(r[h].clone());let n=e.faces;for(let h=0,p=n.length;h<p;h++)this.faces.push(n[h].clone());for(let h=0,p=e.faceVertexUvs.length;h<p;h++){let f=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(let g=0,v=f.length;g<v;g++){let y=f[g],m=[];for(let x=0,b=y.length;x<b;x++){let w=y[x];m.push(w.clone())}this.faceVertexUvs[h].push(m)}}let s=e.morphTargets;for(let h=0,p=s.length;h<p;h++){let f={};if(f.name=s[h].name,s[h].vertices!==void 0){f.vertices=[];for(let g=0,v=s[h].vertices.length;g<v;g++)f.vertices.push(s[h].vertices[g].clone())}if(s[h].normals!==void 0){f.normals=[];for(let g=0,v=s[h].normals.length;g<v;g++)f.normals.push(s[h].normals[g].clone())}this.morphTargets.push(f)}let o=e.morphNormals;for(let h=0,p=o.length;h<p;h++){let f={};if(o[h].vertexNormals!==void 0){f.vertexNormals=[];for(let g=0,v=o[h].vertexNormals.length;g<v;g++){let y=o[h].vertexNormals[g],m={};m.a=y.a.clone(),m.b=y.b.clone(),m.c=y.c.clone(),f.vertexNormals.push(m)}}if(o[h].faceNormals!==void 0){f.faceNormals=[];for(let g=0,v=o[h].faceNormals.length;g<v;g++)f.faceNormals.push(o[h].faceNormals[g].clone())}this.morphNormals.push(f)}let a=e.skinWeights;for(let h=0,p=a.length;h<p;h++)this.skinWeights.push(a[h].clone());let l=e.skinIndices;for(let h=0,p=l.length;h<p;h++)this.skinIndices.push(l[h].clone());let c=e.lineDistances;for(let h=0,p=c.length;h<p;h++)this.lineDistances.push(c[h]);let u=e.boundingBox;u!==null&&(this.boundingBox=u.clone());let d=e.boundingSphere;return d!==null&&(this.boundingSphere=d.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 D1().fromGeometry(this),t=new _e,r=new Float32Array(e.vertices.length*3);if(t.setAttribute("position",new Fe(r,3).copyVector3sArray(e.vertices)),e.normals.length>0){let n=new Float32Array(e.normals.length*3);t.setAttribute("normal",new Fe(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){let n=new Float32Array(e.colors.length*3);t.setAttribute("color",new Fe(n,3).copyColorsArray(e.colors))}if(e.uvs.length>0){let n=new Float32Array(e.uvs.length*2);t.setAttribute("uv",new Fe(n,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){let n=new Float32Array(e.uvs2.length*2);t.setAttribute("uv2",new Fe(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 Ae(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 Ae(e.skinIndices.length*4,4);t.setAttribute("skinIndex",n.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){let n=new Ae(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 _e,r=e.geometry;if(e.isPoints||e.isLine){let n=new Ae(r.vertices.length*3,3),s=new Ae(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 Ae(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}};ra.prototype.isGeometry=!0;var D1=class{constructor(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}computeGroups(e){let t=[],r,n,s,o=e.faces;for(n=0;n<o.length;n++){let a=o[n];a.materialIndex!==s&&(s=a.materialIndex,r!==void 0&&(r.count=n*3-r.start,t.push(r)),r={start:n*3,materialIndex:s})}r!==void 0&&(r.count=n*3-r.start,t.push(r)),this.groups=t}fromGeometry(e){let t=e.faces,r=e.vertices,n=e.faceVertexUvs,s=n[0]&&n[0].length>0,o=n[1]&&n[1].length>0,a=e.morphTargets,l=a.length,c;if(l>0){c=[];for(let y=0;y<l;y++)c[y]={name:a[y].name,data:[]};this.morphTargets.position=c}let u=e.morphNormals,d=u.length,h;if(d>0){h=[];for(let y=0;y<d;y++)h[y]={name:u[y].name,data:[]};this.morphTargets.normal=h}let p=e.skinIndices,f=e.skinWeights,g=p.length===r.length,v=f.length===r.length;r.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(let y=0;y<t.length;y++){let m=t[y];this.vertices.push(r[m.a],r[m.b],r[m.c]);let x=m.vertexNormals;if(x.length===3)this.normals.push(x[0],x[1],x[2]);else{let w=m.normal;this.normals.push(w,w,w)}let b=m.vertexColors;if(b.length===3)this.colors.push(b[0],b[1],b[2]);else{let w=m.color;this.colors.push(w,w,w)}if(s===!0){let w=n[0][y];w!==void 0?this.uvs.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",y),this.uvs.push(new F,new F,new F))}if(o===!0){let w=n[1][y];w!==void 0?this.uvs2.push(w[0],w[1],w[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",y),this.uvs2.push(new F,new F,new F))}for(let w=0;w<l;w++){let T=a[w].vertices;c[w].data.push(T[m.a],T[m.b],T[m.c])}for(let w=0;w<d;w++){let T=u[w].vertexNormals[y];h[w].data.push(T.a,T.b,T.c)}g&&this.skinIndices.push(p[m.a],p[m.b],p[m.c]),v&&this.skinWeights.push(f[m.a],f[m.b],f[m.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}},pu=class{constructor(e,t,r,n,s,o=0){this.a=e,this.b=t,this.c=r,this.normal=n&&n.isVector3?n:new A,this.vertexNormals=Array.isArray(n)?n:[],this.color=s&&s.isColor?s:new ve,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 _F=["a","b","c"];function EF(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function wy(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function Sy(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],d=t[a];c={a:u,b:d,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(n),s[i].edges.push(c),s[e].edges.push(c)}function CF(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],Sy(o.a,o.b,i,r,o,t),Sy(o.b,o.c,i,r,o,t),Sy(o.c,o.a,i,r,o,t)}function Cf(i,e,t,r,n){i.push(new pu(e,t,r,void 0,void 0,n))}function kl(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function Lf(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var My=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof _e?e=new ra().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new A,r,n,s,o,a,l=e.vertices,c=e.faces,u=e.faceVertexUvs[0],d=u!==void 0&&u.length>0,h=[],p=new Map;CF(l,c,h,p);let f=[],g,v,y,m,x,b,w;for(let ce of Array.from(p.keys())){for(v=p.get(ce),y=new A,x=3/8,b=1/8,w=v.faces.length,w!=2&&(x=.5,b=0,w!=1),y.addVectors(v.a,v.b).multiplyScalar(x),t.set(0,0,0),o=0;o<w;o++){for(m=v.faces[o],a=0;a<3&&(g=l[EF(m,_F[a])],!(g!==v.a&&g!==v.b));a++);g&&t.add(g)}t.multiplyScalar(b),y.add(t),v.newEdge=f.length,f.push(y)}let T,S,M,E,C,_,O,P=[];for(n=0,s=l.length;n<s;n++){for(_=l[n],C=h[n].edges,r=C.length,r==3?T=3/16:r>3&&(T=3/(8*r)),S=1-r*Number(T),M=T,r<=2&&(r==2?(S=3/4,M=1/8):r==1||r==0),O=_.clone().multiplyScalar(S),t.set(0,0,0),o=0;o<r;o++)E=C[o],g=E.a!==_?E.a:E.b,t.add(g);t.multiplyScalar(Number(M)),O.add(t),P.push(O)}let D=P.concat(f),G=P.length,R,U,te,he=[],H=[],z,B,Y,q,ee=new F,k=new F,pe=new F;for(n=0,s=c.length;n<s;n++)m=c[n],R=Number(wy(m.a,m.b,p).newEdge)+G,U=Number(wy(m.b,m.c,p).newEdge)+G,te=Number(wy(m.c,m.a,p).newEdge)+G,Cf(he,R,U,te,m.materialIndex),Cf(he,m.a,R,te,m.materialIndex),Cf(he,m.b,U,R,m.materialIndex),Cf(he,m.c,te,U,m.materialIndex),d&&(z=u[n],B=z[0],Y=z[1],q=z[2],ee.set(kl(B.x,Y.x),kl(B.y,Y.y)),k.set(kl(Y.x,q.x),kl(Y.y,q.y)),pe.set(kl(B.x,q.x),kl(B.y,q.y)),Lf(H,ee,k,pe),Lf(H,B,ee,pe),Lf(H,Y,k,ee),Lf(H,q,pe,k));e.vertices=D,e.faces=he,d&&(e.faceVertexUvs[0]=H)}};var Er=new A,Nf=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 _e().copy(new In(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(Er),r={width:Er.x,height:Er.y,depth:Er.z,subdivisions:0}):r=e.parameters;let n=re(re({},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 _e().copy(new In(100,100,100)),o=s.userData.parameters;o===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(Er)):Er.set(o.width,o.height,o.depth),(e!==Er.x||t!==Er.y||r!==Er.z)&&s.scale(Er.x===0?1:e/Er.x,Er.y===0?1:t/Er.y,Er.z===0?1:r/Er.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 My(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:xe(re({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Ho(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(Er);let o=100/Er.x;Object.assign(s.parameters,{width:100,height:Er.y*o,depth:Er.z*o}),e(this.build(s))})}};var R1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,d=t*.5,h=0,p=0,f=2*Math.PI/r;for(let v=0;v<r;v++){let y=f*v,m=h+Math.sin(y)*u,x=p+Math.cos(y)*d;c.addPoint(c.createPoint(m,x))}c.isClosed=!0;for(let v=0,y=c.points.length;v<y;v++)c.points[v].roundness=n;c.roundness=n,c.update();let g=jr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:n,depth:s,extrudeBevelSize:o,extrudeBevelSegments:a}});return Object.assign(g,{userData:xe(re({},i),{type:"PolygonGeometry"})})}};var O1=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 B1(e*.5,t,n,s,o,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:xe(re({},i),{type:"PyramidGeometry"})})}};function mu(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function Ay(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 LF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var B1=class extends _e{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=[],d=[],h=0,p=t/2,f=Math.PI/r,g=e*Math.cos(Math.PI/r),v=2*Math.PI/r,y=(r-2)*Math.PI/r,m=Math.PI-y,x=new A(0,-p,0),b=new A(0,p,0),w=new F(e,-p),T=new F(g,-p),S=new F(0,b.y).sub(T),M=new F(0,b.y).sub(w),E=new F(S.y,-S.x).normalize(),C=new F(M.y,-M.x).normalize(),O=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-S.angle())/2)-1e-8;o=Math.min(o,O);let P;{let H=new A(E.x,E.y,0),z=new A(Math.cos(v)*H.x,H.y,Math.sin(v)*H.x);P=H.angleTo(z)}let D=o/Math.tan((Math.PI-S.angle())/2),G=o/Math.tan((Math.PI-P)/2),R=new A;if(!s){c.push(x.x,x.y,x.z),u.push(0,-1,0),d.push(0,0);let H=h++,z=[],B=w.clone(),Y=D/Math.cos(Math.PI/r);B.x-=Y;for(let q=0;q<r;q++){let ee=q/r*Math.PI*2+f,k=new F(Math.sin(ee),Math.cos(ee));mu(B,k,R),c.push(R.x,R.y,R.z),u.push(0,-1,0),d.push(0,0),z.push(h++)}for(let q=0;q<z.length;q++)l.push(z[q],H,z[(q+1)%z.length])}let U=[];{let H=new A,z=new A,B=new A,Y=new A,q=new A,ee=new A;for(let k=0;k<r;k++){let pe=k/r*Math.PI*2+f,ce=(k+.5)/r*Math.PI*2+f,ne=(k+1)/r*Math.PI*2+f,X=new F(Math.sin(pe),Math.cos(pe)),le=new F(Math.sin(ce),Math.cos(ce)),$=new F(Math.sin(ne),Math.cos(ne));mu(w,X,z),mu(w,$,B),mu(E,le,H),Ay(b,z,B,G,G,Y),c.push(Y.x,Y.y,Y.z),Ay(z,b,B,G,D,q),c.push(q.x,q.y,q.z),Ay(B,z,b,D,G,ee),c.push(ee.x,ee.y,ee.z),u.push(H.x,H.y,H.z),u.push(H.x,H.y,H.z),u.push(H.x,H.y,H.z),d.push(0,0),d.push(0,0),d.push(0,0);let V=h++,K=h++,ue=h++;if(l.push(V,K,ue),o>0){{let L=z.clone().add(B).multiplyScalar(.5),J=b.clone().sub(L).normalize(),ye=x.clone().sub(L).normalize().add(J).normalize().multiplyScalar(-1),me=ee.clone().sub(q);te(L,me,ye,S.angle())}let ie,N;{let L=new A;mu(C,$,L);let J=ee.clone().add(Y).multiplyScalar(.5);J=LF(J,B,b);let se=ee.clone().sub(Y);[ie,N]=te(J,se,L,P,Y.y)}{let L=ie,J=L.clone().setY(0).normalize(),se=new A(0,-1,0),ye=J.clone().cross(se);he(L,J,se,ye)}U.concat(N);{let L=S.angle(),J=Math.PI-L,se=b.clone();se.y-=o/Math.sin(L-Math.PI/2);let ye=new A,me=[];for(let we=0;we<a;we++){let Re=[],Ee=Math.PI/2-J*we/a,j=Math.cos(Ee),Se=Math.sin(Ee),fe=ce;for(let Ne=0;Ne<=we;Ne++){let De=Math.cos(fe),Be=Math.sin(fe);H.x=j*Be,H.y=Se,H.z=j*De,ye.copy(se).addScaledVector(H,o),c.push(ye.x,ye.y,ye.z),u.push(H.x,H.y,H.z),d.push(0,0),Re.push(h++),fe+=Math.PI*2/we/r}me.push(Re)}N.reverse(),me.push(N);let Ie=me.length-1;for(let we=0;we<Ie;we++){let Re=me[we],Ee=me[we+1],j=Re.length-1;l.push(Ee[1],Re[0],Ee[0]);for(let Se=1;Se<=j;Se++)l.push(Re[Se],Re[Se-1],Ee[Se]),l.push(Ee[Se+1],Re[Se],Ee[Se])}}}}}this.setIndex(l),this.setAttribute("position",new Ae(c,3)),this.setAttribute("normal",new Ae(u,3)),this.setAttribute("uv",new Ae(d,2));function te(H,z,B,Y,q){let ee=-Y/2,k=(Math.PI-Y)/2,pe=z.clone().normalize().cross(B);H.addScaledVector(B,-o/Math.sin(k));let ce=new A,ne=new A,X=1,le=h,$=[];for(let V=0;V<=a;V++){let K=ee+V/a*Y;ne.set(0,0,0),ne.addScaledVector(pe,Math.sin(K)),ne.addScaledVector(B,Math.cos(K));for(let ue=0;ue<=X;ue++){let ie=ue/X-.5;if(ce.copy(H),ce.addScaledVector(z,ie),ce.addScaledVector(ne,o),q!=null){let N=Math.max(0,ce.y-q);ce.addScaledVector(z,-N/z.y)}c.push(ce.x,ce.y,ce.z),u.push(ne.x,ne.y,ne.z),d.push(0,0),ue===0&&$.push(h),h++}}for(let V=0;V<a;V++)for(let K=0;K<X;K++){let ue=le+K+(X+1)*V,ie=ue+(X+1),N=ie+1,L=ue+1;l.push(ue,ie,L),l.push(ie,N,L)}return[H.clone().addScaledVector(z,.5),$]}function he(H,z,B,Y){let q=Math.PI/2,ee=M.angle()-q,k=[],pe=new A,ce=new A;for(let X=0;X<=a;X++){let le=[],$=X/a;for(let V=0;V<=X;V++){let ue=((X?V/X:0)-.5)*m,ie=Math.cos(ue),N=Math.sin(ue),L=Math.atan(Math.tan(ee)*ie),J=(q+L)*$,se=Math.cos(J),ye=Math.sin(J);pe.set(0,0,0),pe.addScaledVector(z,ye*ie),pe.addScaledVector(B,se),pe.addScaledVector(Y,ye*N),ce.copy(H).addScaledVector(pe,o),c.push(ce.x,ce.y,ce.z),u.push(pe.x,pe.y,pe.z),d.push(0,0),le.push(h++)}k.push(le)}let ne=k.length-1;for(let X=0;X<ne;X++){let le=k[X],$=k[X+1],V=le.length-1;l.push(le[0],$[1],$[0]);for(let K=1;K<=V;K++)l.push(le[K-1],le[K],$[K]),l.push(le[K],$[K+1],$[K])}}}};var Pf=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,a,l,c,u;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},i.ui),n=t.cornerRadius.reduce((d,h)=>d+h,0);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:n>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(u=t.depth)!=null?u:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,u={x:t*.5,y:r*.5},d={x:-u.x,y:-u.y},h={x:u.x,y:u.y};function p(w,T,S){return T>t&&S>r?Math.min(w*t/T,w*r/S):T>t?w*t/T:S>r?w*r/S:w}let f=[];f[0]=n[0]===0?0:p(n[0],n[0]+n[3],n[0]+n[1]),f[1]=n[1]===0?0:p(n[1],n[1]+n[2],n[1]+n[0]),f[2]=n[2]===0?0:p(n[2],n[2]+n[1],n[2]+n[3]),f[3]=n[3]===0?0:p(n[3],n[3]+n[0],n[3]+n[2]);let g=d.x,v=h.x,y=h.y,m=d.y;e.addPoint(e.createPoint(g,y)),e.addPoint(e.createPoint(v,y)),e.addPoint(e.createPoint(v,m)),e.addPoint(e.createPoint(g,m)),e.isClosed=!0;let x=!0;for(let w=0,T=e.points.length;w<T;w++)e.points[w].roundness=f[w],w>0&&f[w]!==f[w-1]&&(x=!1);x&&(e.roundness=f[0]),e.useCubicForRoundedCorners=s!==1,e.update();let b=jr.create({shape:e,parameters:{surfaceMaxCount:c,depth:o,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(b,{userData:xe(re({},i),{type:"RectangleGeometry"})})}};var F1=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 nl(.5*e,n,s,o,a,l,c);return u.scale(1,t/e,r/e),Object.assign(u,{userData:xe(re({},i),{type:"SphereGeometry"})})}};var G1=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 Js(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:xe(re({},i),{type:"PlaneGeometry"})})}};var z1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:o,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:u}=i.parameters,d=i.shape,h=e*.5,p=t*.5,f=0,g=0,v=o*Math.PI/360/n,y=Math.PI/2*3*-1,m=h*r/100,x=p*r/100;if(n==3&&r==50){v=2*Math.PI/n;for(let w=0;w<n;w++){let T=v*w,S=f+Math.sin(T)*h,M=g+Math.cos(T)*p;d.addPoint(d.createPoint(S,M))}}else for(let w=0;w<n;w++){let T=f+Math.cos(y)*h,S=g+Math.sin(y)*p;d.addPoint(d.createPoint(T,S)),y+=v,T=f+Math.cos(y)*m,S=g+Math.sin(y)*x,w<=n,d.addPoint(d.createPoint(T,S)),y+=v}d.isClosed=!0;for(let w=0,T=d.points.length;w<T;w++)d.points[w].roundness=s;d.roundness=s,d.update();let b=jr.create({shape:d,parameters:{surfaceMaxCount:u,roundness:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(b,{userData:xe(re({},i),{type:"StarGeometry"})})}};var If=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 Js(e,t);return Object.assign(r,{userData:xe(re({},i),{type:"TextFrameGeometry"})})}};var U1=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=NF(e,t,r,e*.5,o,s,0,0,n,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:xe(re({},i),{type:"TorusGeometry"})})}};function NF(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 Tf(!0,i,e,t,r,n,s,o,a,l,c,u)}var k1=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 Fc(a,t,r,n,s,o);return Object.assign(l,{userData:xe(re({},i),{type:"TorusKnotGeometry"})})}};var V1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,o,a;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof St?i.shape:new St,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o,isRect:a,surfaceMaxCount:l}=i.parameters,c=i.shape,u=e*.5,d=t*.5;a?(c.addPoint(c.createPoint(-u,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))):(c.addPoint(c.createPoint(0,d)),c.addPoint(c.createPoint(u,-d)),c.addPoint(c.createPoint(-u,-d))),c.isClosed=!0;for(let p=0,f=c.points.length;p<f;p++)c.points[p].roundness=r;c.roundness=r,c.update();let h=jr.create({shape:c,parameters:{surfaceMaxCount:l,roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:o}});return Object.assign(h,{userData:xe(re({},i),{type:"TriangleGeometry"})})}};var gu={};qT(gu,{addBarycentricAttribute:()=>DF,fixUvs:()=>OF,loadFromUrl:()=>RF,resizeGeometry:()=>IF,roundShapePolygon:()=>PF});var H1=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}},PF=(i,e,t)=>{let r,n,s,o,a,l,c,u,d,h,p,f,g,v,y=e.length;for(o=e[y-2],i.curves=[],r=1;r<y-1;r++){a=e[r%y],l=e[(r+1)%y];let m=H1(a,o),x=H1(a,l);c=m.nx*x.ny-m.ny*x.nx,u=m.nx*x.nx-m.ny*-x.ny,p=Math.asin(c),d=1,h=!1,u<0?p<0?p=Math.PI+p:(p=Math.PI-p,d=-1,h=!0):p>0&&(d=-1,h=!0),f=p/2,v=Math.abs(Math.cos(f)*t/Math.sin(f)),v>Math.min(m.len/2,x.len/2)?(v=Math.min(m.len/2,x.len/2),g=Math.abs(v*Math.sin(f)/Math.cos(f))):g=t,n=a.x+x.nx*v,s=a.y+x.ny*v,n+=-x.ny*g*d,s+=x.nx*g*d,i.absarc(n,s,g,m.ang+Math.PI/2*d,x.ang-Math.PI/2*d,h),o=a,a=l}i.closePath()},IF=(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},DF=(i,e)=>{let t=[new A(1,0,0),new A(0,1,0),new A(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,o=r.count;s<o;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new Ae(n,3))},RF=i=>new Promise(e=>{new Ho().load(i,r=>e(r))}),OF=(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 BF,Df=new Promise(i=>{BF=i});var je;Df.then(i=>{je=i});var Kn=class{static build(i,e,t,r,n){let s,o,a;return i===void 0?(s=Kn.allocate(n,t),je.set_destination_refinement_level(s,0),o=Kn.buildLevel(s,!0,r)):i.positionWASM!==void 0?(e&&e!==0&&(je.free_bvh(e),je.free_subdivision_surface(e)),s=Kn.allocate(n,void 0,i),je.set_destination_refinement_level(s,0),o=Kn.buildLevel(s,!0,r)):s=e,i!==void 0&&i.subdivisions!==void 0&&(je.set_destination_refinement_level(s,i.subdivisions),i.subdivisions>0?a=Kn.buildLevel(s,!1,r):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static allocate(i,e,t){var w;let r,n,s,o=[],a=[];if(t)r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM;else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let T=Fg.mergeVertices(e);r=T.attributes.position.array;let S=T.getIndex().array,M=S.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(M/3*2),s=new Uint8Array(M/6).fill(4);for(let G=0,R=0;G<M;G+=6)n[R++]=S[G],n[R++]=S[G+1],n[R++]=S[G+4],n[R++]=S[G+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let E,C,_;if(e.userData.type==="SphereGeometry")C=e.parameters.heightSegments,E=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(_=!0);else if(e.userData.type==="CylinderGeometry")C=e.parameters.heightSegments+2,E=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")C=e.parameters.heightSegments+1,E=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let G=e.userData.parameters;C=Math.ceil(G.tubularSegments*G.arc/(2*Math.PI))+2,E=G.radialSegments}else{let{pathSegments:G,segments:R,revolutions:U}=e.userData.parameters;C=Math.ceil(R*U)+2,E=G}_?(n=new Uint32Array(1*E*3+(C-1)*E*4),s=new Uint8Array(1*E+(C-1)*E)):(n=new Uint32Array(2*E*3+(C-2)*E*4),s=new Uint8Array(2*E+(C-2)*E));let O=0,P=0,D=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;P<3*E;)n[P++]=S[O++],n[P++]=S[O++],n[P++]=S[O++],s[D++]=3;let G=_?n.length:3*E+4*(C-2)*E;for(;P<G;O+=6)n[P++]=S[O],n[P++]=S[O+1],n[P++]=S[O+4],n[P++]=S[O+5],s[D++]=4}else for(;P<4*(C-2)*E;O+=6)n[P++]=S[O],n[P++]=S[O+1],n[P++]=S[O+4],n[P++]=S[O+5],s[D++]=4;for(;P<n.length;)n[P++]=S[O++],n[P++]=S[O++],n[P++]=S[O++],s[D++]=3;break;default:n=S,s=new Uint8Array(M/3).fill(3);break}}let l=r.length,c=n.length,u=s.length,d=r.length+o.length+a.length,h=n.length+s.length,p=d*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=d*Float32Array.BYTES_PER_ELEMENT,g=h*Uint32Array.BYTES_PER_ELEMENT,v=je._malloc(p),y=new Float32Array(je.HEAPF32.buffer,v,d),m=new Uint32Array(je.HEAPU32.buffer,v+f,h);y.set(r,0),y.set(o,r.length),y.set(a,r.length+o.length),m.set(n,0),m.set(s,n.length);let x;((w=t==null?void 0:t.scaleBaked)==null?void 0:w.some(T=>T!==1))&&(x=new Me().makeScale(...t.scaleBaked)),i&&(x?x.premultiply(i):x=i);let b=x?je.alloc_subdivision_surface2(v,l,v+f,c,v+f+n.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):je.alloc_subdivision_surface(v,l,v+f,c,v+f+n.length*Uint32Array.BYTES_PER_ELEMENT,u);return je._free(v),b}static buildLevel(i,e,t,r,n){let s=n?je.get_mesh_data2(i,e?je.Level.CONTROL:je.Level.REFINED,t!=null?t:!e,n.elements):je.get_mesh_data(i,e?je.Level.CONTROL:je.Level.REFINED,t!=null?t:!e),o=8,a=je.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,u=je.HEAPU32[a[c]>>2],d=je.HEAPF32.subarray(u>>2,(u>>2)+l[c]);c++;let h=je.HEAPU32[a[c]>>2],p=je.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=je.HEAPU32[a[c]>>2],g=je.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let v=je.HEAPU32[a[c]>>2],y=je.HEAPU32.subarray(v>>2,(v>>2)+l[c]);if(c++,r===void 0){let m=new _e;if(m.setIndex(new Ro(y,1)),m.setAttribute("position",new Ae(d,3)),m.setAttribute("normal",new Ae(p,3)),e){m.setAttribute("faceMap",new Ro(g,1));let x=new Float32Array(p.length/3*4).fill(0);m.setAttribute("color",new Fe(x,4))}return je.free_mesh_data(s),m.userData.type="SubdivGeometry",m}r.getAttribute("position").copyArray(d),r.getAttribute("normal").copyArray(p),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,je.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=je.get_wireframe_data_for_base_level(i),n=4,s=je.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(2,2+2),a=0,l=je.HEAPU32[s[a]>>2],c=je.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let u=je.HEAPU32[s[a]>>2],d=je.HEAPU32.subarray(u>>2,(u>>2)+o[a]);if(e===void 0){let h=new _e;h.setAttribute("position",new Ae(c,3));let p=new Float32Array(c.length);for(let f=0,g=c.length;f<g;)p[f++]=t.r,p[f++]=t.g,p[f++]=t.b;return h.setAttribute("color",new Fe(p,3)),h.setIndex(new Ro(d,1)),je.free_wireframe_data_for_base_level(r),h}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,je.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||je.set_destination_refinement_level(i,1);let r=t?je.get_topological_data2(i,e?je.Level.CONTROL:je.Level.REFINED,t.elements):je.get_topological_data(i,e?je.Level.CONTROL:je.Level.REFINED),n=6,s=je.HEAPU32.subarray(r>>2,(r>>2)+n),o=s.subarray(3,3+3),a=0,l=je.HEAPU32[s[a]>>2],c=new Float32Array(je.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let u=je.HEAPU32[s[a]>>2],d=new Uint32Array(je.HEAPU32.subarray(u>>2,(u>>2)+o[a]));a++;let h=je.HEAPU32[s[a]>>2],p=new Uint8Array(je.HEAPU32.subarray(h>>2,(h>>2)+o[a]));return je.free_topological_data(r),{positions:c,indices:d,verticesPerFace:p}}};var Ty={ConeGeometry:i1,CubeGeometry:s1,CylinderGeometry:r1,DodecahedronGeometry:a1,EllipseGeometry:T1,HelixGeometry:N1,IcosahedronGeometry:P1,LatheGeometry:I1,NonParametricGeometry:Nf,PolygonGeometry:R1,PyramidGeometry:O1,RectangleGeometry:Pf,SphereGeometry:F1,PlaneGeometry:G1,StarGeometry:z1,TextFrameGeometry:If,TorusGeometry:U1,TorusKnotGeometry:k1,TriangleGeometry:V1,VectorGeometry:jr},Rf=i=>Ty[i.type].create(i);var tn=class extends ve{constructor(e,t,r,n){super(e,t,r);this.a=n}setRGBA(e,t,r,n){super.setRGB(e,t,r),this.a=n}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};function sr(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 tn(0,0,0,0))}else return"a"in i?new tn(i.r,i.g,i.b,i.a):new tn(i.r,i.g,i.b,1);return t}var Of=i=>"isEntity"in i,Bf=i=>"isAbstractMesh"in i;var Ss=i=>"objectHelper"in i;function _y(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:oo.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&i.updateUp()}function FF(i,e){_y(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 j1(i,e,t){FF(i,e),e.color!==void 0&&(i.color=sr(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof Vo)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof Vo)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&Ss(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 Vl=new rr,Wr=new A,ze=new A,wr=new Me;function GF(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 d=e.getX(u),h=e.getY(u),p=e.getZ(u);d<n&&(n=d),h<s&&(s=h),p<o&&(o=p),d>a&&(a=d),h>l&&(l=h),p>c&&(c=p)}return i.min.set(n,s,o),i.max.set(a,l,c),i}var J1=(i,e,t,r)=>{var n;if(Bf(i)){let s=i.geometry.userData.parameters,o=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?Wr.copy(i.originalGeometry.boundingSphere.center):(GF(Vl,o,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:o.count),Vl.getCenter(Wr)),i.forceComputeSize?Vl.getSize(ze).multiplyScalar(.5):ze.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(Ss(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");Vl.setFromArray(s.array),Vl.getCenter(Wr),Vl.getSize(ze).multiplyScalar(.5)}else Wr.setScalar(0),ze.setScalar(0);wr.copy(e).multiply(i.matrixWorld),ze.x===0&&ze.y===0&&ze.z===0?t.push(new A(Wr.x,Wr.y,Wr.z).applyMatrix4(wr)):t.push(new A(-ze.x,ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,-ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,-ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,ze.y,ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(-ze.x,-ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,-ze.y,-ze.z).add(Wr).applyMatrix4(wr),new A(ze.x,ze.y,-ze.z).add(Wr).applyMatrix4(wr))},Ff=class extends rr{constructor(){super(...arguments);this.matrix=new Me;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new Me().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,t)}expandByObjectSize(e,t,r=!1){let n=[];return r===!0?e.traverseEntity(s=>J1(s,t,n,e.enableHelper===!0)):J1(e,t,n,e.enableHelper===!0),this.setFromPoints(n)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(wr.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(ze).multiplyScalar(.5),this.getCenter(Wr),wr.copy(this.matrix).setPosition(Wr),this.vertices=[new A(-ze.x,ze.y,ze.z).applyMatrix4(wr),new A(-ze.x,-ze.y,ze.z).applyMatrix4(wr),new A(ze.x,-ze.y,ze.z).applyMatrix4(wr),new A(ze.x,ze.y,ze.z).applyMatrix4(wr),new A(-ze.x,ze.y,-ze.z).applyMatrix4(wr),new A(-ze.x,-ze.y,-ze.z).applyMatrix4(wr),new A(ze.x,-ze.y,-ze.z).applyMatrix4(wr),new A(ze.x,ze.y,-ze.z).applyMatrix4(wr)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new hn(this.vertices[0],this.vertices[3]),new hn(this.vertices[1],this.vertices[2]),new hn(this.vertices[5],this.vertices[6]),new hn(this.vertices[4],this.vertices[7]),new hn(this.vertices[0],this.vertices[1]),new hn(this.vertices[3],this.vertices[2]),new hn(this.vertices[7],this.vertices[6]),new hn(this.vertices[4],this.vertices[5]),new hn(this.vertices[0],this.vertices[4]),new hn(this.vertices[1],this.vertices[5]),new hn(this.vertices[2],this.vertices[6]),new hn(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new A().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new A().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new A().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new A().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new A().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new A().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};function q1(i,e,t,r){if(r===0)return t.copy(i);if(r===1)return t.copy(e);let n=i.w*e.w+i.x*e.x+i.y*e.y+i.z*e.z;if(n>=1)return t.copy(i);let s=1-n*n;if(s<=Number.EPSILON){let u=1-r;return t.w=u*i.w+r*e.w,t.x=u*i.x+r*e.x,t.y=u*i.y+r*e.y,t.z=u*i.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,n),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=i.w*l+e.w*c,t.x=i.x*l+e.x*c,t.y=i.y*l+e.y*c,t.z=i.z*l+e.z*c,t}var Gf=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 We=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=rt.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 We&&(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 X1=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}},Cr=new X1;var Xe=class extends We{constructor(e,t){super(e);this.scope="";t=t!=null?t:{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,r,n){if(t=t!=null?t:this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&this.uuid===void 0&&(this.uuid=rt.generateUUID()),r=e.getUUID(r!=null?r:this.getUUID(),!s);let o=e.getNodeData(r),a=o.output||this.getType(e);if(e.analyzing)return(o.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,o,t),this.generate(e,t,r)):super.build(e,t,r);if(s)return o.name=o.name||super.build(e,t,r),o.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||o.deps===1))return super.build(e,t,r);r=this.getUUID(!1);let l=this.getTemp(e,r);if(l)return e.format(l,a,t);{l=super.generate(e,t,r,o.output,n);let c=this.generate(e,a,r);return e.addNodeCode(l+" = "+c+";"),e.format(l,a,t)}}return super.build(e,t,r)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let r=e.getVars()[t];return r?r.name:void 0}generate(e,t,r,n,s){return this.getShared(e,t)||console.error("TempNode is not shared"),r=r!=null?r:this.uuid,e.getTempVar(r,n!=null?n:this.getType(e),s,this.getLabel()).name}};var qt=class extends Xe{constructor(e,t){t=t!=null?t:{},t.shared=t.shared!==void 0?t.shared:!1;super(e,t);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){let t=super.createJSONNode(e);return this.readonly===!0&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),e.readonly!==void 0&&this.setReadonly(e.readonly),this}generate(e,t,r,n,s,o){r=e.getUUID(r!=null?r:this.getUUID()),n=n!=null?n:this.getType(e);let a=e.getNodeData(r);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,r,n,s,o):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(n,this,s,o,this.getLabel())),e.format(a.vertex.name,n,t)):(a.fragment||(a.fragment=e.createFragmentUniform(n,this,s,o,this.getLabel())),e.format(a.fragment.name,n,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}};var Jr=class extends qt{constructor(e=0,t){super("v2");this.nodeType="Vector2";this.value=e instanceof F?e:new F(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,r,n,s,o){return e.format("vec2("+this.value.x+", "+this.value.y+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),this}};var qr=class extends qt{constructor(e=0,t,r){super("v3");this.nodeType="Vector3";this.value=e instanceof A?e:new A(e,t,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,r,n,s,o){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.x=this.value.x,t.y=this.value.y,t.z=this.value.z,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.x&&(this.value.x=e.x),e.y&&(this.value.y=e.y),e.z&&(this.value.z=e.z),this}};var Xi=class extends qt{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof tn?e:new tn(e.r,e.g,e.b,e.a)}generateReadonly(e,t,r,n,s,o){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var zF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Y1=/[a-z_0-9]+/gi,Ce=class extends Xe{constructor(e,t,r,n,s){super(s);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=s===void 0,this.isInterface=!1,this.parse(e,t,r,n)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,r,n,s){let o,a=0,l=this.src;if(this.includes)for(let u=0;u<this.includes.length;u++)e.include(this.includes[u],this);for(let u in this.extensions)e.extensions[u]=!0;let c=[];for(;o=Y1.exec(this.src);)c.push(o);for(let u=0;u<c.length;u++){let d=c[u],h=d[0],p=this.isMethod?!this.getInputByName(h):!0,f=h;if(this.keywords[h]||this.useKeywords&&p&&Cr.containsKeyword(h)){let g=this.keywords[h];if(!g){let v=Cr.getKeywordData(h);v.cache&&(g=e.keywords[h]),g=g||Cr.getKeyword(h,e),v.cache&&(e.keywords[h]=g)}f=g.build(e)}h!==f&&(l=l.substring(0,d.index+a)+f+l.substring(d.index+h.length+a),a+=f.length-h.length),this.getIncludeByName(f)===void 0&&Cr.contains(f)&&e.include(Cr.get(f))}return t==="source"?l:this.isMethod?(this.isInterface||e.include(this,void 0,l),this.name):e.format("( "+l+" )",this.getType(e),t)}parse(e,t,r,n){if(this.src=e||"",this.includes=t!=null?t:[],this.extensions=r!=null?r:{},this.keywords=n!=null?n:{},this.isMethod){let s=zF.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let o=s[3].match(Y1);if(o){let a=0;for(;a<o.length;){let l=o[a++],c;l==="in"||l==="out"||l==="inout"?c=o[a++]:(c=l,l="");let u=o[a++];this.inputs.push({name:u,type:c,qualifier:l})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(e){return super.copy(e),this.isMethod=e.isMethod,this.useKeywords=e.useKeywords,e.type!==void 0&&(this.type=e.type),this.parse(e.src,e.includes,e.extensions,e.keywords),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){t=this.createJSONNode(e),t.src=this.src,t.isMethod=this.isMethod,t.useKeywords=this.useKeywords,this.isMethod||(t.type=this.type),t.extensions=JSON.parse(JSON.stringify(this.extensions));let n={};for(let s in this.keywords)n[s]=this.keywords[s].toJSON(e).uuid;if(t.keywords=n,(r=this.includes)==null?void 0:r.length){let s=[];for(let o=0;o<this.includes.length;o++)s.push(this.includes[o].toJSON(e).uuid);t.includes=s}t.isMethod=this.isMethod,t.inputs=this.inputs}return t.nodeType=this.nodeType,t}fromJSON(e,t){if(super.fromJSON(e,t),e.inputs!==void 0&&(this.inputs=e.inputs),e.isMethod!==void 0&&(this.isMethod=e.isMethod),e.src&&(this.src=e.src),e.isMethod&&(this.isMethod=e.isMethod),e.useKeywords&&(this.useKeywords=e.useKeywords),e.type&&(this.type=e.type),e.extensions&&(this.extensions=e.extensions),e.keywords&&t){this.keywords={};for(let r in e.keywords)this.keywords[r]=t.getNode(e.keywords[r])}return e.includes&&t&&(this.includes=e.includes.map(r=>t.getNode(r))),this}};var UF=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,Ey=class extends Xe{constructor(e="",t){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Ey.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,r,n,s){this.src=e||"";let o,a,l="",c=UF.exec(e);this.useDefine=s!=null?s:this.src.charAt(0)==="#",c&&c.length>1?(a=c[1],o=c[2],l=c[3]):(o=this.src,a="f"),this.name=o,this.type=a,this.value=l}build(e,t){if(t==="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 e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,r,n,s){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src,t.useDefine=this.useDefine,t.value=this.value,t.name=this.name),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src),e.value&&(this.value=e.value),e.name&&(this.name=e.name),e.useDefine!==void 0&&(this.useDefine=e.useDefine),this}},ct=Ey;ct.PI="PI",ct.PI2="PI2",ct.RECIPROCAL_PI="RECIPROCAL_PI",ct.RECIPROCAL_PI2="RECIPROCAL_PI2",ct.LOG2="LOG2",ct.EPSILON="EPSILON";var kF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
3192
3192
|
)*?)}`,"gim"),VF=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),yu=class extends Xe{constructor(e=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,r,n,s){return t==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=kF.exec(e);if(t){let r=t[2],n;for(;n=VF.exec(r);)this.inputs.push({type:n[1],name:n[2]});this.name=t[1]}else this.name="";this.type=this.name}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.src=this.src),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.src&&(this.src=e.src,this.parse(this.src)),this}};var vu=class extends Xe{constructor(e){super("v2",{shared:!1});this.nodeType="UV";this.index=e!=null?e:0}generate(e,t){e.requires.uv[this.index]=!0;let r=this.index>0?this.index+1:"",n=e.isShader("vertex")?"uv"+r:"vUv"+r;return e.format(n,this.getType(e),t)}copy(e){return super.copy(e),this.index=e.index,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.index=this.index),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.index&&(this.index=e.index),this}};Cr.addKeyword("uv",function(){return new vu});Cr.addKeyword("uv2",function(){return new vu(1)});var Le=class extends qt{constructor(e){super("f");this.nodeType="Float";this.value=e!=null?e:0}generateReadonly(e,t,r,n,s,o){return e.format(this.value+(this.value%1?"":".0"),n,t)}copy(e){return super.copy(e),this.value=e.value,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.value=this.value,this.getReadonly()===!0&&(t.readonly=!0)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.value&&(this.value=e.value),this}};var It=class extends Ce{constructor(e="",t,r,n,s){super(e,s,n,r,t);this.nodeType="Expression"}};var na=class extends Xe{constructor(e=new We,t){super("v4");this.nodeType="ColorSpace";this.factor=new We;this.input=e,this.method=t!=null?t:na.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case vr:return["Linear"];case Lo:return["sRGB"];case uc:return["RGBE"];case lh:return["RGBM",new Le(7).setReadonly(!0)];case ch:return["RGBM",new Le(16).setReadonly(!0)];case uh:return["RGBD",new Le(256).setReadonly(!0)];case No:return["Gamma",new It("float( GAMMA_FACTOR )","f")];default:return[]}}generate(e,t){let r=this.input.build(e,"v4"),n=this.getType(e),s=na.Nodes[this.method],o=e.include(s);if(o===na.LINEAR_TO_LINEAR)return e.format(r,n,t);if(s.inputs.length===2){let a=this.factor.build(e,"f");return e.format(o+"( "+r+", "+a+" )",n,t)}else return e.format(o+"( "+r+" )",n,t)}fromEncoding(e){let t=na.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=na.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}copy(e){return super.copy(e),this.input.copy(e.input),this.method=e.method,this.factor.copy(e.factor),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.input=this.input.toJSON(e).uuid,t.factor=this.factor.toJSON(e).uuid,t.method=this.method),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.input&&(this.input=t.getNode(e.input)),e.factor&&(this.factor=t.getNode(e.factor)),e.method&&(this.method=e.method),this}},$t=na;$t.Nodes={LinearToLinear:new Ce(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
3193
3193
|
`)),GammaToLinear:new Ce(["vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {"," return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );","}"].join(`
|
|
3194
3194
|
`)),LinearToGamma:new Ce(["vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {"," return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );","}"].join(`
|