@splinetool/runtime 0.9.2 → 0.9.3
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 +3 -3
- package/package.json +1 -1
- package/runtime.d.ts +2 -1
package/build/runtime.js
CHANGED
|
@@ -3188,7 +3188,7 @@ void main() {
|
|
|
3188
3188
|
}`,$2=`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:yE}),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:$2,fragmentShader:Z2}),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 eP(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 l_:i.depthFunc(512);break;case c_:i.depthFunc(519);break;case u_:i.depthFunc(513);break;case Np:i.depthFunc(515);break;case h_:i.depthFunc(514);break;case d_:i.depthFunc(518);break;case f_:i.depthFunc(516);break;case p_: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,[KT]:32778,[ZT]: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={[$T]:0,[e_]:1,[t_]:768,[$v]:770,[a_]:776,[s_]:774,[n_]:772,[r_]:769,[ex]:771,[o_]:775,[i_]: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!==QT){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!==XT?(q(2884),j!==M&&(j===Wv?i.cullFace(1029):j===YT?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 tP(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 rP(i,e,t){let r=t.isWebGL2;function n(s){let o;if(s===Nt)return 5121;if(s===T_)return 32819;if(s===__)return 32820;if(s===E_)return 33635;if(s===S_)return 5120;if(s===M_)return 5122;if(s===oh)return 5123;if(s===A_)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===C_)return 6406;if(s===jt)return 6407;if(s===Qt)return 6408;if(s===Rp)return 6409;if(s===L_)return 6410;if(s===Sa)return 6402;if(s===Co)return 34041;if(s===P_)return 6403;if(s===I_)return 36244;if(s===D_)return 33319;if(s===R_)return 33320;if(s===O_)return 36248;if(s===B_)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===F_)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===G_||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===$_||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)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?s:null;if(s===Z_)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 nP={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(nP))),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 iP(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 sP(){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:sP(),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 LN(k),ne=new wN(k,ce,i),ce.init(ne),fe=new rP(k,ce,ne),X=new eP(k,ce,ne),U[0]=1029,le=new IN(k),$=new H2,V=new tP(k,ce,X,$,ne,fe,le),K=new MN(g),ue=new CN(g),ie=new QE(k,ne),Ne=new xN(k,ce,ie,ne),N=new NN(k,ie,le,Ne),L=new BN(k,N,ie,le),Ee=new ON(k),Ie=new SN($),J=new V2(g,K,ue,ce,ne,Ne,Ie),se=new iP($),ye=new W2($),me=new K2(ce,ne),Re=new vN(g,K,X,L,a),we=new u0(g,L,ne),j=new bN(k,ce,le,ne),Se=new PN(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,oP=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(oP.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)}},wU=new A,SU=new A,MU=new A,AU=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 aP(i,e){let t=1-i;return t*t*e}function lP(i,e){return 2*(1-i)*i*e}function cP(i,e){return i*i*e}function Nc(i,e,t,r){return aP(i,e)+lP(i,t)+cP(i,r)}function uP(i,e){let t=1-i;return t*t*t*e}function hP(i,e){let t=1-i;return 3*t*t*i*e}function dP(i,e){return 3*(1-i)*i*i*e}function fP(i,e){return i*i*i*e}function Pc(i,e,t,r,n){return uP(i,e)+hP(i,t)+dP(i,r)+fP(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}),pP={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=xP(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===NP(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&&AP(i,r,n,s);let a=i,l,c;for(;i.prev!==i.next;){if(l=i.prev,c=i.next,s?gP(i,r,n,s):mP(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=yP(Qs(i),e,t),Ic(i,e,t,r,n,s,2)):o===2&&vP(i,e,t,r,n,s):Ic(Qs(i),e,t,r,n,s,1);break}}}function mP(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 gP(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 yP(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 vP(i,e,t,r,n,s){let o=i;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&EP(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 xP(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(_P(c));for(n.sort(bP),s=0;s<n.length;s++)wP(n[s],t),t=Qs(t,t.next);return t}function bP(i,e){return i.x-e.x}function wP(i,e){if(e=SP(i,e),e){let t=U0(e,i);Qs(e,e.next),Qs(t,t.next)}}function SP(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&&MP(o,t)))&&(o=t,u=d)),t=t.next;while(t!==a);return o}function MP(i,e){return ir(i.prev,i,e.prev)<0&&ir(e.next,i,i.next)<0}function AP(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,TP(n)}function TP(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 _P(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 EP(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!CP(i,e)&&(Dc(i,e)&&Dc(e,i)&&LP(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 CP(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 LP(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 NP(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=pP.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:PP;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 IP(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)}},PP={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 IP(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 DP(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 DP(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(OP(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 RP(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 OP(i){if(i.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");let e=RP(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}}},BP=new al,Rn=class{constructor(e){this.manager=e!==void 0?e:BP,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=FP(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 FP(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=GP(u,n,a,l,t);a+=d.offsetX,o.push(d.path)}}return o}function GP(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,zP={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);zP.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="\\[\\]\\.:\\/",UP=new RegExp("["+tg+"]","g"),rg="[^"+tg+"]",kP="[^"+tg.replace("\\.","")+"]",VP=/((?:WC+[\/:])*)/.source.replace("WC",rg),HP=/(WCOD+)?/.source.replace("WCOD",kP),jP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rg),WP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rg),JP=new RegExp("^"+VP+HP+jP+WP+"$"),qP=["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(UP,"")}static parseTrackName(e){let t=JP.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);qP.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=pE,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===mE;if(e===0)return s===-1?n:o&&(s&1)==1?t-n:n;if(r===fE){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()}},XP=new Float32Array(1),TU=new Int32Array(XP.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 YP=()=>typeof window=="undefined"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),QP=()=>typeof window=="undefined"?!1:window.navigator.platform.toUpperCase().includes("MAC"),EU=YP(),Vc=QP();function Bb(i){return Array.isArray(i)?i:[i]}function Hc(i){return Vc?i.metaKey:i.ctrlKey}var KP=typeof global=="object"&&global&&global.Object===Object&&global,ld=KP;var ZP=typeof self=="object"&&self&&self.Object===Object&&self,$P=ld||ZP||Function("return this")(),cr=$P;var eI=cr.Symbol,dn=eI;var Fb=Object.prototype,tI=Fb.hasOwnProperty,rI=Fb.toString,jc=dn?dn.toStringTag:void 0;function nI(i){var e=tI.call(i,jc),t=i[jc];try{i[jc]=void 0;var r=!0}catch(s){}var n=rI.call(i);return r&&(e?i[jc]=t:delete i[jc]),n}var Gb=nI;var iI=Object.prototype,sI=iI.toString;function oI(i){return sI.call(i)}var zb=oI;var aI="[object Null]",lI="[object Undefined]",Ub=dn?dn.toStringTag:void 0;function cI(i){return i==null?i===void 0?lI:aI:Ub&&Ub in Object(i)?Gb(i):zb(i)}var Bn=cI;function uI(i){return i!=null&&typeof i=="object"}var Zr=uI;var hI="[object Symbol]";function dI(i){return typeof i=="symbol"||Zr(i)&&Bn(i)==hI}var Zs=dI;function fI(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=fI;var pI=Array.isArray,zr=pI;var mI=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==-mI?"-0":e}var jb=Hb;var gI=/\s/;function yI(i){for(var e=i.length;e--&&gI.test(i.charAt(e)););return e}var Wb=yI;var vI=/^\s+/;function xI(i){return i&&i.slice(0,Wb(i)+1).replace(vI,"")}var Jb=xI;function bI(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var mr=bI;var qb=0/0,wI=/^[-+]0x[0-9a-f]+$/i,SI=/^0b[01]+$/i,MI=/^0o[0-7]+$/i,AI=parseInt;function TI(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=SI.test(i);return t||MI.test(i)?AI(i.slice(2),t?2:8):wI.test(i)?qb:+i}var ug=TI;function _I(i){return i}var ud=_I;var EI="[object AsyncFunction]",CI="[object Function]",LI="[object GeneratorFunction]",NI="[object Proxy]";function PI(i){if(!mr(i))return!1;var e=Bn(i);return e==CI||e==LI||e==EI||e==NI}var ul=PI;var II=cr["__core-js_shared__"],hd=II;var Xb=function(){var i=/[^.]+$/.exec(hd&&hd.keys&&hd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function DI(i){return!!Xb&&Xb in i}var Yb=DI;var RI=Function.prototype,OI=RI.toString;function BI(i){if(i!=null){try{return OI.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var ms=BI;var FI=/[\\^$.*+?()[\]{}|]/g,GI=/^\[object .+?Constructor\]$/,zI=Function.prototype,UI=Object.prototype,kI=zI.toString,VI=UI.hasOwnProperty,HI=RegExp("^"+kI.call(VI).replace(FI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jI(i){if(!mr(i)||Yb(i))return!1;var e=ul(i)?HI:GI;return e.test(ms(i))}var Qb=jI;function WI(i,e){return i==null?void 0:i[e]}var Kb=WI;function JI(i,e){var t=Kb(i,e);return Qb(t)?t:void 0}var Sn=JI;var qI=Sn(cr,"WeakMap"),dd=qI;var Zb=Object.create,XI=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=XI;function YI(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=YI;function QI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var fd=QI;var KI=800,ZI=16,$I=Date.now;function eD(i){var e=0,t=0;return function(){var r=$I(),n=ZI-(r-t);if(t=r,n>0){if(++e>=KI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var tw=eD;function tD(i){return function(){return i}}var rw=tD;var rD=function(){try{var i=Sn(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),hl=rD;var nD=hl?function(i,e){return hl(i,"toString",{configurable:!0,enumerable:!1,value:rw(e),writable:!0})}:ud,nw=nD;var iD=tw(nw),pd=iD;function sD(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var iw=sD;var oD=9007199254740991,aD=/^(?:0|[1-9]\d*)$/;function lD(i,e){var t=typeof i;return e=e==null?oD:e,!!e&&(t=="number"||t!="symbol"&&aD.test(i))&&i>-1&&i%1==0&&i<e}var md=lD;function cD(i,e,t){e=="__proto__"&&hl?hl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var dl=cD;function uD(i,e){return i===e||i!==i&&e!==e}var $s=uD;var hD=Object.prototype,dD=hD.hasOwnProperty;function fD(i,e,t){var r=i[e];(!(dD.call(i,e)&&$s(r,t))||t===void 0&&!(e in i))&&dl(i,e,t)}var gd=fD;function pD(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=pD;var sw=Math.max;function mD(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=mD;function gD(i,e){return pd(yd(i,e,ud),i+"")}var ow=gD;var yD=9007199254740991;function vD(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=yD}var vd=vD;function xD(i){return i!=null&&vd(i.length)&&!ul(i)}var eo=xD;function bD(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=bD;function wD(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=wD;var SD=Object.prototype;function MD(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||SD;return i===t}var fl=MD;function AD(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var cw=AD;var TD="[object Arguments]";function _D(i){return Zr(i)&&Bn(i)==TD}var hg=_D;var uw=Object.prototype,ED=uw.hasOwnProperty,CD=uw.propertyIsEnumerable,LD=hg(function(){return arguments}())?hg:function(i){return Zr(i)&&ED.call(i,"callee")&&!CD.call(i,"callee")},jo=LD;function ND(){return!1}var hw=ND;var dw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fw=dw&&typeof module=="object"&&module&&!module.nodeType&&module,PD=fw&&fw.exports===dw,pw=PD?cr.Buffer:void 0,ID=pw?pw.isBuffer:void 0,DD=ID||hw,pl=DD;var RD="[object Arguments]",OD="[object Array]",BD="[object Boolean]",FD="[object Date]",GD="[object Error]",zD="[object Function]",UD="[object Map]",kD="[object Number]",VD="[object Object]",HD="[object RegExp]",jD="[object Set]",WD="[object String]",JD="[object WeakMap]",qD="[object ArrayBuffer]",XD="[object DataView]",YD="[object Float32Array]",QD="[object Float64Array]",KD="[object Int8Array]",ZD="[object Int16Array]",$D="[object Int32Array]",eR="[object Uint8Array]",tR="[object Uint8ClampedArray]",rR="[object Uint16Array]",nR="[object Uint32Array]",Jt={};Jt[YD]=Jt[QD]=Jt[KD]=Jt[ZD]=Jt[$D]=Jt[eR]=Jt[tR]=Jt[rR]=Jt[nR]=!0;Jt[RD]=Jt[OD]=Jt[qD]=Jt[BD]=Jt[XD]=Jt[FD]=Jt[GD]=Jt[zD]=Jt[UD]=Jt[kD]=Jt[VD]=Jt[HD]=Jt[jD]=Jt[WD]=Jt[JD]=!1;function iR(i){return Zr(i)&&vd(i.length)&&!!Jt[Bn(i)]}var mw=iR;function sR(i){return function(e){return i(e)}}var ml=sR;var gw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wc=gw&&typeof module=="object"&&module&&!module.nodeType&&module,oR=Wc&&Wc.exports===gw,dg=oR&&ld.process,aR=function(){try{var i=Wc&&Wc.require&&Wc.require("util").types;return i||dg&&dg.binding&&dg.binding("util")}catch(e){}}(),gs=aR;var yw=gs&&gs.isTypedArray,lR=yw?ml(yw):mw,xd=lR;var cR=Object.prototype,uR=cR.hasOwnProperty;function hR(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||uR.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=hR;function dR(i,e){return function(t){return i(e(t))}}var wd=dR;var fR=wd(Object.keys,Object),vw=fR;var pR=Object.prototype,mR=pR.hasOwnProperty;function gR(i){if(!fl(i))return vw(i);var e=[];for(var t in Object(i))mR.call(i,t)&&t!="constructor"&&e.push(t);return e}var xw=gR;function yR(i){return eo(i)?bd(i):xw(i)}var gl=yR;function vR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var bw=vR;var xR=Object.prototype,bR=xR.hasOwnProperty;function wR(i){if(!mr(i))return bw(i);var e=fl(i),t=[];for(var r in i)r=="constructor"&&(e||!bR.call(i,r))||t.push(r);return t}var ww=wR;function SR(i){return eo(i)?bd(i,!0):ww(i)}var zi=SR;var MR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,AR=/^\w*$/;function TR(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Zs(i)?!0:AR.test(i)||!MR.test(i)||e!=null&&i in Object(e)}var Sw=TR;var _R=Sn(Object,"create"),ys=_R;function ER(){this.__data__=ys?ys(null):{},this.size=0}var Mw=ER;function CR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Aw=CR;var LR="__lodash_hash_undefined__",NR=Object.prototype,PR=NR.hasOwnProperty;function IR(i){var e=this.__data__;if(ys){var t=e[i];return t===LR?void 0:t}return PR.call(e,i)?e[i]:void 0}var Tw=IR;var DR=Object.prototype,RR=DR.hasOwnProperty;function OR(i){var e=this.__data__;return ys?e[i]!==void 0:RR.call(e,i)}var _w=OR;var BR="__lodash_hash_undefined__";function FR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=ys&&e===void 0?BR:e,this}var Ew=FR;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 GR(){this.__data__=[],this.size=0}var Cw=GR;function zR(i,e){for(var t=i.length;t--;)if($s(i[t][0],e))return t;return-1}var to=zR;var UR=Array.prototype,kR=UR.splice;function VR(i){var e=this.__data__,t=to(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():kR.call(e,t,1),--this.size,!0}var Lw=VR;function HR(i){var e=this.__data__,t=to(e,i);return t<0?void 0:e[t][1]}var Nw=HR;function jR(i){return to(this.__data__,i)>-1}var Pw=jR;function WR(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=WR;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 JR=Sn(cr,"Map"),no=JR;function qR(){this.size=0,this.__data__={hash:new fg,map:new(no||ro),string:new fg}}var Dw=qR;function XR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Rw=XR;function YR(i,e){var t=i.__data__;return Rw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var io=YR;function QR(i){var e=io(this,i).delete(i);return this.size-=e?1:0,e}var Ow=QR;function KR(i){return io(this,i).get(i)}var Bw=KR;function ZR(i){return io(this,i).has(i)}var Fw=ZR;function $R(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=$R;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 eO="Expected a function";function pg(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(eO);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 tO=500;function rO(i){var e=zw(i,function(r){return t.size===tO&&t.clear(),r}),t=e.cache;return e}var Uw=rO;var nO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iO=/\\(\\)?/g,sO=Uw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(nO,function(t,r,n,s){e.push(n?s.replace(iO,"$1"):r||t)}),e}),kw=sO;function oO(i){return i==null?"":jb(i)}var Vw=oO;function aO(i,e){return zr(i)?i:Sw(i,e)?[i]:kw(Vw(i))}var bl=aO;var lO=1/0;function cO(i){if(typeof i=="string"||Zs(i))return i;var e=i+"";return e=="0"&&1/i==-lO?"-0":e}var Sd=cO;function uO(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=uO;function hO(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var wl=hO;var jw=dn?dn.isConcatSpreadable:void 0;function dO(i){return zr(i)||jo(i)||!!(jw&&i&&i[jw])}var Ww=dO;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 fO(i){var e=i==null?0:i.length;return e?qw(i,1):[]}var Xw=fO;function pO(i){return pd(yd(i,void 0,Xw),i+"")}var Yw=pO;var mO=wd(Object.getPrototypeOf,Object),Sl=mO;var gO="[object Object]",yO=Function.prototype,vO=Object.prototype,Qw=yO.toString,xO=vO.hasOwnProperty,bO=Qw.call(Object);function wO(i){if(!Zr(i)||Bn(i)!=gO)return!1;var e=Sl(i);if(e===null)return!0;var t=xO.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Qw.call(t)==bO}var Md=wO;function SO(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=SO;function MO(){this.__data__=new ro,this.size=0}var Zw=MO;function AO(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var $w=AO;function TO(i){return this.__data__.get(i)}var eS=TO;function _O(i){return this.__data__.has(i)}var tS=_O;var EO=200;function CO(i,e){var t=this.__data__;if(t instanceof ro){var r=t.__data__;if(!no||r.length<EO-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=CO;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 LO(i,e){return i&&qn(e,gl(e),i)}var nS=LO;function NO(i,e){return i&&qn(e,zi(e),i)}var iS=NO;var sS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oS=sS&&typeof module=="object"&&module&&!module.nodeType&&module,PO=oS&&oS.exports===sS,aS=PO?cr.Buffer:void 0,lS=aS?aS.allocUnsafe:void 0;function IO(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=IO;function DO(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=DO;function RO(){return[]}var _d=RO;var OO=Object.prototype,BO=OO.propertyIsEnumerable,uS=Object.getOwnPropertySymbols,FO=uS?function(i){return i==null?[]:(i=Object(i),cS(uS(i),function(e){return BO.call(i,e)}))}:_d,Al=FO;function GO(i,e){return qn(i,Al(i),e)}var hS=GO;var zO=Object.getOwnPropertySymbols,UO=zO?function(i){for(var e=[];i;)wl(e,Al(i)),i=Sl(i);return e}:_d,Ed=UO;function kO(i,e){return qn(i,Ed(i),e)}var dS=kO;function VO(i,e,t){var r=e(i);return zr(i)?r:wl(r,t(i))}var Cd=VO;function HO(i){return Cd(i,gl,Al)}var fS=HO;function jO(i){return Cd(i,zi,Ed)}var Ld=jO;var WO=Sn(cr,"DataView"),Nd=WO;var JO=Sn(cr,"Promise"),Pd=JO;var qO=Sn(cr,"Set"),Id=qO;var pS="[object Map]",XO="[object Object]",mS="[object Promise]",gS="[object Set]",yS="[object WeakMap]",vS="[object DataView]",YO=ms(Nd),QO=ms(no),KO=ms(Pd),ZO=ms(Id),$O=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==XO?i.constructor:void 0,r=t?ms(t):"";if(r)switch(r){case YO:return vS;case QO:return pS;case KO:return mS;case ZO:return gS;case $O:return yS}return e});var Tl=Wo;var eB=Object.prototype,tB=eB.hasOwnProperty;function rB(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&tB.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var xS=rB;var nB=cr.Uint8Array,mg=nB;function iB(i){var e=new i.constructor(i.byteLength);return new mg(e).set(new mg(i)),e}var _l=iB;function sB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var bS=sB;var oB=/\w*$/;function aB(i){var e=new i.constructor(i.source,oB.exec(i));return e.lastIndex=i.lastIndex,e}var wS=aB;var SS=dn?dn.prototype:void 0,MS=SS?SS.valueOf:void 0;function lB(i){return MS?Object(MS.call(i)):{}}var AS=lB;function cB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=cB;var uB="[object Boolean]",hB="[object Date]",dB="[object Map]",fB="[object Number]",pB="[object RegExp]",mB="[object Set]",gB="[object String]",yB="[object Symbol]",vB="[object ArrayBuffer]",xB="[object DataView]",bB="[object Float32Array]",wB="[object Float64Array]",SB="[object Int8Array]",MB="[object Int16Array]",AB="[object Int32Array]",TB="[object Uint8Array]",_B="[object Uint8ClampedArray]",EB="[object Uint16Array]",CB="[object Uint32Array]";function LB(i,e,t){var r=i.constructor;switch(e){case vB:return _l(i);case uB:case hB:return new r(+i);case xB:return bS(i,t);case bB:case wB:case SB:case MB:case AB:case TB:case _B:case EB:case CB:return Dd(i,t);case dB:return new r;case fB:case gB:return new r(i);case pB:return wS(i);case mB:return new r;case yB:return AS(i)}}var TS=LB;function NB(i){return typeof i.constructor=="function"&&!fl(i)?$b(Sl(i)):{}}var Rd=NB;var PB="[object Map]";function IB(i){return Zr(i)&&Tl(i)==PB}var _S=IB;var ES=gs&&gs.isMap,DB=ES?ml(ES):_S,CS=DB;var RB="[object Set]";function OB(i){return Zr(i)&&Tl(i)==RB}var LS=OB;var NS=gs&&gs.isSet,BB=NS?ml(NS):LS,PS=BB;var FB=1,GB=2,zB=4,IS="[object Arguments]",UB="[object Array]",kB="[object Boolean]",VB="[object Date]",HB="[object Error]",DS="[object Function]",jB="[object GeneratorFunction]",WB="[object Map]",JB="[object Number]",RS="[object Object]",qB="[object RegExp]",XB="[object Set]",YB="[object String]",QB="[object Symbol]",KB="[object WeakMap]",ZB="[object ArrayBuffer]",$B="[object DataView]",e3="[object Float32Array]",t3="[object Float64Array]",r3="[object Int8Array]",n3="[object Int16Array]",i3="[object Int32Array]",s3="[object Uint8Array]",o3="[object Uint8ClampedArray]",a3="[object Uint16Array]",l3="[object Uint32Array]",Vt={};Vt[IS]=Vt[UB]=Vt[ZB]=Vt[$B]=Vt[kB]=Vt[VB]=Vt[e3]=Vt[t3]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[WB]=Vt[JB]=Vt[RS]=Vt[qB]=Vt[XB]=Vt[YB]=Vt[QB]=Vt[s3]=Vt[o3]=Vt[a3]=Vt[l3]=!0;Vt[HB]=Vt[DS]=Vt[KB]=!1;function Od(i,e,t,r,n,s){var o,a=e&FB,l=e&GB,c=e&zB;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==jB;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 c3=1,u3=4;function h3(i){return Bd(i,c3|u3)}var gg=h3;function d3(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=d3;var f3=OS(),BS=f3;var p3=function(){return cr.Date.now()},Fd=p3;var m3="Expected a function",g3=Math.max,y3=Math.min;function v3(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(m3);e=ug(e)||0,mr(t)&&(u=!!t.leading,d="maxWait"in t,s=d?g3(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?y3(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=v3;function x3(i,e,t){(t!==void 0&&!$s(i[e],t)||t===void 0&&!(e in i))&&dl(i,e,t)}var Xc=x3;function b3(i){return Zr(i)&&eo(i)}var FS=b3;function w3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Yc=w3;function S3(i){return qn(i,zi(i))}var GS=S3;function M3(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=M3;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 A3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var VS=A3;function T3(i,e){return e.length<2?i:Hw(i,Kw(e,0,-1))}var HS=T3;var _3=lw(function(i,e,t){kS(i,e,t)}),Jo=_3;function E3(i,e){return e=bl(e,i),i=HS(i,e),i==null||delete i[Sd(VS(e))]}var jS=E3;function C3(i){return Md(i)?void 0:i}var WS=C3;var L3=1,N3=2,P3=4,I3=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,L3|N3|P3,WS));for(var n=e.length;n--;)jS(t,e[n]);return t}),El=I3;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(i,e){for(let t of i)e(t.id,t.data),ZS(t.children,e)}function $S(i,e){e(i.id,i.data);for(let t of i.children)$S(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&&$S(r,t)}}traverse(e){ZS(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 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 eM=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]}}}},tM=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))}},rM=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))}},nM={get(i,e){if(e===kd)return()=>{i._parent=null};if(e===eM)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]}}},D3=xe(re({},nM),{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=B3(t))!=null?n:t}},i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){throw new Error("set to undefined is not supported!")}}),R3=xe(re({},nM),{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 rM(i,e,t),R3):t!==null&&typeof t=="object"?KS(t)?t:new Proxy(new tM(i,e,t),D3):t}function O3(i){let e=new xg(i);return[Vd(e,"",i),e]}function bg(i,e){let[t,r]=O3(i);return e(t),r.result()}function B3(i){return i instanceof $c||i instanceof eu?i._current:i!==null&&typeof i=="object"?i[eM]: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 iM=[],Mg=iM,Ag=0,An={},bt,lo,Yn=0,Vi=0,Gn,xs,fn=[],Et,sM={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 gM(()=>(Yd(),this?this.unpack(e,t):bs.prototype.unpack.call(sM,e,t)));ao=t>-1?t:e.length,Z=0,Ag=0,Vi=0,lo=null,Mg=iM,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=sM,(!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&&oM(),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&&oM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function oM(){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&&lM()[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[fM()]=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):hM(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 pM(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++,pM(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):G3(e);case 218:return e=Et.getUint16(Z),Z+=2,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):z3(e);case 219:return e=Et.getUint32(Z),Z+=4,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):U3(e);case 220:return e=Et.getUint16(Z),Z+=2,cM(e);case 221:return e=Et.getUint32(Z),Z+=4,cM(e);case 222:return e=Et.getUint16(Z),Z+=2,uM(e);case 223:return e=Et.getUint32(Z),Z+=4,uM(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 F3=/^[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=>F3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(hr);return i.highByte===0&&(i.read=aM(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?aM(e,t):t}var aM=(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]||lM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=_g(n,i)),n.read()};function lM(){let i=gM(()=>(Pe=null,An.getStructures()));return bt=An._mergeStructures(i,bt)}var Eg=Xd,G3=Xd,z3=Xd,U3=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 cM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}function uM(i){if(An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[fM()]=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 hM(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 dM=new Array(4096);function fM(){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=dM[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=[],dM[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):hM(i);return a!=null?t.string=a:t.string=Eg(i)}var pM=(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()},mM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=hr();return(mM[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 mM[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 gM(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 yM(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}),k3=Kd.unpack,V3=Kd.unpackMultiple,H3=Kd.unpack;var j3=new Float32Array(1),_6=new Uint8Array(j3.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,xM=ef?Buffer:Uint8Array,bM=ef?4294967296:2144337920,de,gr,ae=0,Hi,ji=null,W3=/[\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=xM.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=q3(de.subarray(r,ae),a.idsToInsert);return a=null,C}return E&AM?(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&Q3&&(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=W3.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=J3(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>bM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(bM,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?wM(i,16,e):SM(ef?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==xM&&this.structuredClone?wM(i,Ng.indexOf(t.name),e):SM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function wM(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 SM(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 J3(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 q3(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)}yM(i)}var MM=new Pl({useRecords:!1}),X3=MM.pack,Y3=MM.pack;var AM=512,Q3=1024;var TM=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 K3(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 TM.pack(n)}r.serialize=i;function e(n){return TM.unpack(n)}r.deserialize=e;function t(n){return K3(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 _M;(function(e){e.defaultData=re({type:"Empty"},uo.defaultData)})(_M||(_M={}));var Bg;(function(e){e.defaultData=re(re({type:"Mesh"},uo.defaultData),nf.defaultData)})(Bg||(Bg={}));var EM;(function(e){e.defaultData=re(re({type:"TextFrame"},uo.defaultData),sf.defaultData)})(EM||(EM={}));var ff;(function(e){e.defaultData=re(re(re({},uo.defaultData),ru.identity),qo.defaultData)})(ff||(ff={}));var CM;(function(e){function i(t){return re(re({},uo.defaultData),rf.defaultData(t))}e.defaultData=i})(CM||(CM={}));var LM;(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")})})(LM||(LM={}));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 NM;(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}})(NM||(NM={}));var Fg={type:"change"},PM={type:"changeZoom"},Z3={type:"changePan"},Ol={type:"start"},iu={type:"end"},IM=/iPad|iPhone|iPod/.test(navigator.userAgent)||Vc&&"ontouchend"in document,su=new A,DM=new A,$3=new F,RM=new A,OM=new Ft,Gg=new Ft,Dr=new F,br=new F,Vr=new F,$r=new nd,vi=new nd,Qn=new A,zg=new A,Ug=new A,BM=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,FM=new F,GM=new F,eF=2*Math.PI,tF=1e-8,rF=.01,zM=2,kg=.125,UM=2,Vg=1,Hg=1,jg=.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,kM=!1,Wg=0,gf=1,Jg,yf=!1,VM=-1,HM=-1,qg,Xg=0,jM=1/0,Yg=0,Qg=1/0,WM=0,JM=Math.PI,Kg=-1/0,Zg=1/0,$g=0,ey=Math.PI,ty=-1/0,ry=1/0,qM=zn.BOUNCE,XM=zn.BOUNCE,YM=!0,ny=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((YM===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==kr.DEFAULT&&this.applyLimits(vi,this.rotationLimitsMode,qM,Zg,Kg,JM,WM,FM),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(Xg,Math.min(jM,$r.radius))),this.panLimitsMode!==kr.DEFAULT&&(this.target.applyQuaternion(Gg.copy(this.object.quaternion).invert()),Qn.applyQuaternion(Gg),this.applyLimits(Qn,this.panLimitsMode,XM,ey,$g,ry,ty,GM),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-kg),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%eF;return DM.copy(su).normalize(),this.object.up.copy(Ze.DefaultUp).applyAxisAngle(DM,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-kg,vi.phi*=1-kg):vi.set(0,0,0),gf=1,pf||Vr.x>.05||Vr.y>.05||RM.distanceToSquared(this.object.position)>rF||8*(1-OM.dot(this.object.quaternion))>tF?(this.dispatchEvent(Fg),RM.copy(this.object.position),OM.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)),iF(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=>{KM(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=>{KM(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(Jg===" "){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(ZM(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(ZM(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>Wg?this.dollyIn(this.getZoomScale()):e.scale<Wg&&this.dollyOut(this.getZoomScale()),Wg=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&&(Jg=e.key)};this.onKeyUp=()=>{this.enabled!==!1&&(Jg=void 0,Ot!==-1&&this.onPointerUp(yt[0]))};this.onPointerHover=e=>{if(!(this.enabled===!1||Ot!==-1)){if(window.clearTimeout(HM),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,jg):this.hoverRotatePanMode===Wi.ROTATE&&this.handleMouseMoveRotate(e,jg),HM=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(Fg),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(Fg),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,XM=e.panSoftLimit,qM=e.rotationSoftLimit,this.hoverRotatePanMode=e.hoverRotatePanMode,mf=!0,this.hoverRotatePanMode!==Wi.OFF&&this.domElement.addEventListener("pointermove",this.onPointerHover),jg=(e.hoverRotatePanStrength/100)**2,this.zoomLimitsEnabled=e.zoomLimitsEnabled,Yg=e.zoomLimits.min,Qg=Math.max(e.zoomLimits.min,e.zoomLimits.max),Xg=1e3/e.zoomLimits.max,jM=Math.max(Xg,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,zM=e.autoRotateSpeed,YM=e.autoRotateClockwise;let r=this.object.getTarget().applyQuaternion(Gg.copy(this.object.quaternion).invert());ty=-e.panVerticalOffset.min+r.y,ry=e.panVerticalOffset.max+r.y,$g=-e.panHorizontalOffset.min+r.x,ey=e.panHorizontalOffset.max+r.x,GM.set(ey-$g,ry-ty).divideScalar(2),FM.setScalar(Math.PI).divideScalar(4),WM=fo($r.phi-e.rotationVerticalOffset.min),JM=fo($r.phi+e.rotationVerticalOffset.max),Kg=fo($r.theta-e.rotationHorizontalOffset.min),Zg=fo($r.theta+e.rotationHorizontalOffset.max),kM=Kg>Zg,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),IM||(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),IM||(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&&kM?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(QM(Math.abs(Vr.x)),1),Vr.y=Math.min(QM(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,Vg=e===!0?.2:1}stopDamping(){vi.theta=0,vi.phi=0}getAutoRotationAngle(){return 2*Math.PI/60/60*zM}getZoomScale(){return Math.pow(.95,UM)}rotateLeft(e){vi.theta-=e}rotateUp(e){vi.phi-=e}panLeft(e,t){zg.setFromMatrixColumn(t,0),zg.multiplyScalar(-e),Qn.add(zg)}panUp(e,t){Ug.setFromMatrixColumn(t,1),Ug.multiplyScalar(e),Qn.add(Ug)}pan(e,t){let r=this.domElement;if(r&&this.object.isPerspectiveCamera){let n=this.object.position;BM.copy(n).sub(this.target);let s=BM.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(Z3)}dollyOut(e){this.object.isPerspectiveCamera?gf/=e:this.object.isOrthographicCamera&&(this.object.zoom*=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Yg,Math.min(Qg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(PM)}dollyIn(e){this.object.isPerspectiveCamera?gf*=e:this.object.isOrthographicCamera&&(this.object.zoom/=e,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(Yg,Math.min(Qg,this.object.zoom))),this.object.updateProjectionMatrix(),pf=!0),this.dispatchEvent(PM)}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(Vg*t).rotateAround($3,-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(Hg*t),this.pan(Hr.x,Hr.y),Zo.copy($o),this.update()}handleMouseWheel(e){if(!yf)yf=!0,qg=nF(e),ho=!0;else{if(qg===!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(Hg),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(VM),VM=window.setTimeout(()=>{ho=!1,yf=!1,qg=!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=iy(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(Vg);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=iy(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(Hg),this.pan(Hr.x,Hr.y),Zo.copy($o)}handleTouchMoveDolly(e){let t=iy(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,UM)),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 QM(i){return 1-Math.pow(1-i,4)}function nF(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 iF(i){yt.push(i)}function KM(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 ZM(i){let e=vf[i.pointerId];e===void 0&&(e=new F,vf[i.pointerId]=e),e.set(i.pageX,i.pageY)}function iy(i){let e=i.pointerId===yt[0].pointerId?yt[1]:yt[0];return vf[e.pointerId]}var $M=3,Tr=5855577;var e1=2857471;var sy=15711266;var oy=class extends ng{constructor(){super();this.layers.enable($M)}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 t1=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 r1(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=r1(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=r1(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 n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,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 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,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 s1(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(re({},i),{type:"CubeGeometry"})})}},ay=Math.PI/2,s1=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*ay,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=ay*(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+=ay/_}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 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,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])}},ly=i=>i,uu=new F,cy=new F,sF=new F,oF=new F,aF=new F,lF=new F,a1=new A,l1=new A;function c1(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,cy.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 cF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function uF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function uy(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 u1(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 h1(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function d1(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 uy(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 hy(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function f1(i,e,t,r,n=.5){let s=uu.subVectors(e,i).multiplyScalar(n).add(i),o=cy.subVectors(t,e).multiplyScalar(n).add(e),a=sF.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=oF.subVectors(o,s).multiplyScalar(n).add(s),u=aF.subVectors(a,o).multiplyScalar(n).add(o),d=a,h=lF.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 p1(i,e,t=12,r=!0){let n=l1.set(0,0,0),s,o=0,a=[];for(let l=0;l<e.length;l++){let c=ly(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&&uF(s,n))continue;s===void 0&&(s=a1),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 m1(i,e,t,r=12,n=!0){let s=l1.set(0,0,0),o=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,u=ly(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=a1:(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 dy(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 g1(i,e,t=12,r=!0){let n,s=0;for(let o=0;o<e.length;o++){let a=ly(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&&cF(n,c,au))continue;n===void 0&&(n=cy),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 fy=new F,hF=new F,dF=new F,fF=new F,pF=new F,mF=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=fy.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 p1(e,r?this.roundedCurves:this.curves,t,this.autoClose),n.reduce((s,o)=>s+o,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=dy(this.points,e,!1),this.roundedCurveDivisions=dy(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,r=12){return m1(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),g1(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(hy(n,s)){let u=n.position.distanceTo(s.position);return n.position.distanceTo(fy.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){hy(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,fy),w=u.getPointAt(x,hF);this._subSplitCurve(c,d,m,b,void 0),this._subSplitCurve(u,h,x,void 0,w);let T;if(this.useCubicForRoundedCorners){let S=uy(b,a.position,w)/2,M=Math.tan(S)*b.distanceTo(a.position),[E,C]=u1(b,w,M,dF,fF),_=h1(E,C,a.position),[O,P]=d1(_,b,w,M,pF,mF);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=f1(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]=c1(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 py=Math.PI*2;function my({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function gF(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 y1(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 yF(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=y1(1,0,x,b),M=y1(x,b,w,T);return!c&&M>0&&(M-=py),c&&M<0&&(M+=py),{centerx:y,centery:m,ang1:S,ang2:M}}function v1({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=yF(i,e,t,r,n,s,c,u,o,a),{ang1:p,ang2:f}=h,{centerx:g,centery:v}=h,y=Math.abs(f)/(py/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(gF(p,f)),p+=f;return l.map(x=>{let{x:b,y:w}=my(x[0],n,s,g,v),{x:T,y:S}=my(x[1],n,s,g,v),{x:M,y:E}=my(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}(),x1=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}(),b1=function(){function i(){this.handle=null}return i}(),w1=function(){function i(){this.key=null,this.node=0}return i}(),vF=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 b1,this.handles[r]=new w1;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 b1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new w1}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}(),gy=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}(),S1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),xF=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new S1,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 S1;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}(),bF=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 gy;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 gy;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 gy,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 xF(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 vF(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}(),wF=function(){function i(){this.mesh=new x1,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 x1),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_(),bF.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 wF;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 A9=Zt.ODD,T9=Zt.NONZERO,_9=Zt.POSITIVE,E9=Zt.NEGATIVE,C9=Zt.ABS_GEQ_TWO,L9=_r.POLYGONS,N9=_r.CONNECTED_POLYGONS,P9=_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 yy=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),vy=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=yy(pe,_);for(;!B.boundary.vertexIndices.filter(ce).length||!Y.boundary.vertexIndices.filter(ce).length;)pe++,ce=yy(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=yy(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 vy(i.shape,e,t,n,r),Object.assign(a,{userData:xe(re({},i),{type:"VectorGeometry"})})}};var M1=Math.PI*2,A1=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=SF(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 SF(i,e,t,r,n,s){if(r>=M1)return n>30||n%4==0?(AF(i,e,t,s),Math.round(n/4)):T1(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=v1({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?MF(i,o.x,o.y,c,n,e,t,s):T1(i,r,n,e,t,s)}function MF(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?_1(i,s,o,a):i.addPoint(Ul(0,0)),l}function T1(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<M1?s>0?_1(i,r,n,s):i.addPoint(Ul(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&E1(i,r,n,s)),1}function AF(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&&E1(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 _1(i,e,t,r){C1(i,e,t,r).forEach(s=>i.addPoint(s))}function E1(i,e,t,r){let n=C1(i,e,t,r),s=new St;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function C1(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 L1=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 N1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new _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 P1=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,xy=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 xy.lookAt(e),xy.updateMatrix(),this.applyMatrix4(xy.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 I1().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 I1=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 TF=["a","b","c"];function _F(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function by(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function wy(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 EF(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],wy(o.a,o.b,i,r,o,t),wy(o.b,o.c,i,r,o,t),wy(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 Sy=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;EF(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[_F(m,TF[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(by(m.a,m.b,p).newEdge)+G,U=Number(by(m.b,m.c,p).newEdge)+G,te=Number(by(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 Sy(n).modify(a).toBufferGeometry()):(a!==void 0&&(s=a),a=void 0),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 D1=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 R1=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 O1(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 My(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 CF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var O1=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),My(b,z,B,G,G,Y),c.push(Y.x,Y.y,Y.z),My(z,b,B,G,D,q),c.push(q.x,q.y,q.z),My(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=CF(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 B1=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 F1=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 G1=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 z1=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=LF(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 LF(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 U1=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 k1=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={};JT(gu,{addBarycentricAttribute:()=>IF,fixUvs:()=>RF,loadFromUrl:()=>DF,resizeGeometry:()=>PF,roundShapePolygon:()=>NF});var V1=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}},NF=(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=V1(a,o),x=V1(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()},PF=(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},IF=(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))},DF=i=>new Promise(e=>{new Ho().load(i,r=>e(r))}),RF=(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 Ay=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 OF,Df=new Promise(i=>{OF=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=Ay.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:n1,CubeGeometry:i1,CylinderGeometry:t1,DodecahedronGeometry:o1,EllipseGeometry:A1,HelixGeometry:L1,IcosahedronGeometry:N1,LatheGeometry:P1,NonParametricGeometry:Nf,PolygonGeometry:D1,PyramidGeometry:R1,RectangleGeometry:Pf,SphereGeometry:B1,PlaneGeometry:F1,StarGeometry:G1,TextFrameGeometry:If,TorusGeometry:z1,TorusKnotGeometry:U1,TriangleGeometry:k1,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 BF(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 H1(i,e,t){BF(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 j1(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 FF(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 W1=(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):(FF(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=>W1(s,t,n,e.enableHelper===!0)):W1(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 J1(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 q1=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 q1;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 GF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,X1=/[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=X1.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=GF.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let o=s[3].match(X1);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 zF=/^([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=zF.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 UF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
3191
|
+
`)a=0,l-=s;else{let d=GP(u,n,a,l,t);a+=d.offsetX,o.push(d.path)}}return o}function GP(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,zP={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);zP.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="\\[\\]\\.:\\/",UP=new RegExp("["+tg+"]","g"),rg="[^"+tg+"]",kP="[^"+tg.replace("\\.","")+"]",VP=/((?:WC+[\/:])*)/.source.replace("WC",rg),HP=/(WCOD+)?/.source.replace("WCOD",kP),jP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",rg),WP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",rg),JP=new RegExp("^"+VP+HP+jP+WP+"$"),qP=["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(UP,"")}static parseTrackName(e){let t=JP.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);qP.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=pE,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===mE;if(e===0)return s===-1?n:o&&(s&1)==1?t-n:n;if(r===fE){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()}},XP=new Float32Array(1),TU=new Int32Array(XP.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 YP=()=>typeof window=="undefined"?!1:window.navigator.userAgent.toLowerCase().includes(" electron/"),QP=()=>typeof window=="undefined"?!1:window.navigator.platform.toUpperCase().includes("MAC"),EU=YP(),Vc=QP();function Bb(i){return Array.isArray(i)?i:[i]}function Hc(i){return Vc?i.metaKey:i.ctrlKey}var KP=typeof global=="object"&&global&&global.Object===Object&&global,ld=KP;var ZP=typeof self=="object"&&self&&self.Object===Object&&self,$P=ld||ZP||Function("return this")(),cr=$P;var eI=cr.Symbol,dn=eI;var Fb=Object.prototype,tI=Fb.hasOwnProperty,rI=Fb.toString,jc=dn?dn.toStringTag:void 0;function nI(i){var e=tI.call(i,jc),t=i[jc];try{i[jc]=void 0;var r=!0}catch(s){}var n=rI.call(i);return r&&(e?i[jc]=t:delete i[jc]),n}var Gb=nI;var iI=Object.prototype,sI=iI.toString;function oI(i){return sI.call(i)}var zb=oI;var aI="[object Null]",lI="[object Undefined]",Ub=dn?dn.toStringTag:void 0;function cI(i){return i==null?i===void 0?lI:aI:Ub&&Ub in Object(i)?Gb(i):zb(i)}var Bn=cI;function uI(i){return i!=null&&typeof i=="object"}var Zr=uI;var hI="[object Symbol]";function dI(i){return typeof i=="symbol"||Zr(i)&&Bn(i)==hI}var Zs=dI;function fI(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=fI;var pI=Array.isArray,zr=pI;var mI=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==-mI?"-0":e}var jb=Hb;var gI=/\s/;function yI(i){for(var e=i.length;e--&&gI.test(i.charAt(e)););return e}var Wb=yI;var vI=/^\s+/;function xI(i){return i&&i.slice(0,Wb(i)+1).replace(vI,"")}var Jb=xI;function bI(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var mr=bI;var qb=0/0,wI=/^[-+]0x[0-9a-f]+$/i,SI=/^0b[01]+$/i,MI=/^0o[0-7]+$/i,AI=parseInt;function TI(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=SI.test(i);return t||MI.test(i)?AI(i.slice(2),t?2:8):wI.test(i)?qb:+i}var ug=TI;function _I(i){return i}var ud=_I;var EI="[object AsyncFunction]",CI="[object Function]",LI="[object GeneratorFunction]",NI="[object Proxy]";function PI(i){if(!mr(i))return!1;var e=Bn(i);return e==CI||e==LI||e==EI||e==NI}var ul=PI;var II=cr["__core-js_shared__"],hd=II;var Xb=function(){var i=/[^.]+$/.exec(hd&&hd.keys&&hd.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function DI(i){return!!Xb&&Xb in i}var Yb=DI;var RI=Function.prototype,OI=RI.toString;function BI(i){if(i!=null){try{return OI.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var ms=BI;var FI=/[\\^$.*+?()[\]{}|]/g,GI=/^\[object .+?Constructor\]$/,zI=Function.prototype,UI=Object.prototype,kI=zI.toString,VI=UI.hasOwnProperty,HI=RegExp("^"+kI.call(VI).replace(FI,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function jI(i){if(!mr(i)||Yb(i))return!1;var e=ul(i)?HI:GI;return e.test(ms(i))}var Qb=jI;function WI(i,e){return i==null?void 0:i[e]}var Kb=WI;function JI(i,e){var t=Kb(i,e);return Qb(t)?t:void 0}var Sn=JI;var qI=Sn(cr,"WeakMap"),dd=qI;var Zb=Object.create,XI=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=XI;function YI(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=YI;function QI(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var fd=QI;var KI=800,ZI=16,$I=Date.now;function eD(i){var e=0,t=0;return function(){var r=$I(),n=ZI-(r-t);if(t=r,n>0){if(++e>=KI)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var tw=eD;function tD(i){return function(){return i}}var rw=tD;var rD=function(){try{var i=Sn(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),hl=rD;var nD=hl?function(i,e){return hl(i,"toString",{configurable:!0,enumerable:!1,value:rw(e),writable:!0})}:ud,nw=nD;var iD=tw(nw),pd=iD;function sD(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var iw=sD;var oD=9007199254740991,aD=/^(?:0|[1-9]\d*)$/;function lD(i,e){var t=typeof i;return e=e==null?oD:e,!!e&&(t=="number"||t!="symbol"&&aD.test(i))&&i>-1&&i%1==0&&i<e}var md=lD;function cD(i,e,t){e=="__proto__"&&hl?hl(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var dl=cD;function uD(i,e){return i===e||i!==i&&e!==e}var $s=uD;var hD=Object.prototype,dD=hD.hasOwnProperty;function fD(i,e,t){var r=i[e];(!(dD.call(i,e)&&$s(r,t))||t===void 0&&!(e in i))&&dl(i,e,t)}var gd=fD;function pD(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=pD;var sw=Math.max;function mD(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=mD;function gD(i,e){return pd(yd(i,e,ud),i+"")}var ow=gD;var yD=9007199254740991;function vD(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=yD}var vd=vD;function xD(i){return i!=null&&vd(i.length)&&!ul(i)}var eo=xD;function bD(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=bD;function wD(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=wD;var SD=Object.prototype;function MD(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||SD;return i===t}var fl=MD;function AD(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var cw=AD;var TD="[object Arguments]";function _D(i){return Zr(i)&&Bn(i)==TD}var hg=_D;var uw=Object.prototype,ED=uw.hasOwnProperty,CD=uw.propertyIsEnumerable,LD=hg(function(){return arguments}())?hg:function(i){return Zr(i)&&ED.call(i,"callee")&&!CD.call(i,"callee")},jo=LD;function ND(){return!1}var hw=ND;var dw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fw=dw&&typeof module=="object"&&module&&!module.nodeType&&module,PD=fw&&fw.exports===dw,pw=PD?cr.Buffer:void 0,ID=pw?pw.isBuffer:void 0,DD=ID||hw,pl=DD;var RD="[object Arguments]",OD="[object Array]",BD="[object Boolean]",FD="[object Date]",GD="[object Error]",zD="[object Function]",UD="[object Map]",kD="[object Number]",VD="[object Object]",HD="[object RegExp]",jD="[object Set]",WD="[object String]",JD="[object WeakMap]",qD="[object ArrayBuffer]",XD="[object DataView]",YD="[object Float32Array]",QD="[object Float64Array]",KD="[object Int8Array]",ZD="[object Int16Array]",$D="[object Int32Array]",eR="[object Uint8Array]",tR="[object Uint8ClampedArray]",rR="[object Uint16Array]",nR="[object Uint32Array]",Jt={};Jt[YD]=Jt[QD]=Jt[KD]=Jt[ZD]=Jt[$D]=Jt[eR]=Jt[tR]=Jt[rR]=Jt[nR]=!0;Jt[RD]=Jt[OD]=Jt[qD]=Jt[BD]=Jt[XD]=Jt[FD]=Jt[GD]=Jt[zD]=Jt[UD]=Jt[kD]=Jt[VD]=Jt[HD]=Jt[jD]=Jt[WD]=Jt[JD]=!1;function iR(i){return Zr(i)&&vd(i.length)&&!!Jt[Bn(i)]}var mw=iR;function sR(i){return function(e){return i(e)}}var ml=sR;var gw=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wc=gw&&typeof module=="object"&&module&&!module.nodeType&&module,oR=Wc&&Wc.exports===gw,dg=oR&&ld.process,aR=function(){try{var i=Wc&&Wc.require&&Wc.require("util").types;return i||dg&&dg.binding&&dg.binding("util")}catch(e){}}(),gs=aR;var yw=gs&&gs.isTypedArray,lR=yw?ml(yw):mw,xd=lR;var cR=Object.prototype,uR=cR.hasOwnProperty;function hR(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||uR.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=hR;function dR(i,e){return function(t){return i(e(t))}}var wd=dR;var fR=wd(Object.keys,Object),vw=fR;var pR=Object.prototype,mR=pR.hasOwnProperty;function gR(i){if(!fl(i))return vw(i);var e=[];for(var t in Object(i))mR.call(i,t)&&t!="constructor"&&e.push(t);return e}var xw=gR;function yR(i){return eo(i)?bd(i):xw(i)}var gl=yR;function vR(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var bw=vR;var xR=Object.prototype,bR=xR.hasOwnProperty;function wR(i){if(!mr(i))return bw(i);var e=fl(i),t=[];for(var r in i)r=="constructor"&&(e||!bR.call(i,r))||t.push(r);return t}var ww=wR;function SR(i){return eo(i)?bd(i,!0):ww(i)}var zi=SR;var MR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,AR=/^\w*$/;function TR(i,e){if(zr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Zs(i)?!0:AR.test(i)||!MR.test(i)||e!=null&&i in Object(e)}var Sw=TR;var _R=Sn(Object,"create"),ys=_R;function ER(){this.__data__=ys?ys(null):{},this.size=0}var Mw=ER;function CR(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var Aw=CR;var LR="__lodash_hash_undefined__",NR=Object.prototype,PR=NR.hasOwnProperty;function IR(i){var e=this.__data__;if(ys){var t=e[i];return t===LR?void 0:t}return PR.call(e,i)?e[i]:void 0}var Tw=IR;var DR=Object.prototype,RR=DR.hasOwnProperty;function OR(i){var e=this.__data__;return ys?e[i]!==void 0:RR.call(e,i)}var _w=OR;var BR="__lodash_hash_undefined__";function FR(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=ys&&e===void 0?BR:e,this}var Ew=FR;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 GR(){this.__data__=[],this.size=0}var Cw=GR;function zR(i,e){for(var t=i.length;t--;)if($s(i[t][0],e))return t;return-1}var to=zR;var UR=Array.prototype,kR=UR.splice;function VR(i){var e=this.__data__,t=to(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():kR.call(e,t,1),--this.size,!0}var Lw=VR;function HR(i){var e=this.__data__,t=to(e,i);return t<0?void 0:e[t][1]}var Nw=HR;function jR(i){return to(this.__data__,i)>-1}var Pw=jR;function WR(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=WR;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 JR=Sn(cr,"Map"),no=JR;function qR(){this.size=0,this.__data__={hash:new fg,map:new(no||ro),string:new fg}}var Dw=qR;function XR(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var Rw=XR;function YR(i,e){var t=i.__data__;return Rw(e)?t[typeof e=="string"?"string":"hash"]:t.map}var io=YR;function QR(i){var e=io(this,i).delete(i);return this.size-=e?1:0,e}var Ow=QR;function KR(i){return io(this,i).get(i)}var Bw=KR;function ZR(i){return io(this,i).has(i)}var Fw=ZR;function $R(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=$R;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 eO="Expected a function";function pg(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(eO);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 tO=500;function rO(i){var e=zw(i,function(r){return t.size===tO&&t.clear(),r}),t=e.cache;return e}var Uw=rO;var nO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,iO=/\\(\\)?/g,sO=Uw(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(nO,function(t,r,n,s){e.push(n?s.replace(iO,"$1"):r||t)}),e}),kw=sO;function oO(i){return i==null?"":jb(i)}var Vw=oO;function aO(i,e){return zr(i)?i:Sw(i,e)?[i]:kw(Vw(i))}var bl=aO;var lO=1/0;function cO(i){if(typeof i=="string"||Zs(i))return i;var e=i+"";return e=="0"&&1/i==-lO?"-0":e}var Sd=cO;function uO(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=uO;function hO(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var wl=hO;var jw=dn?dn.isConcatSpreadable:void 0;function dO(i){return zr(i)||jo(i)||!!(jw&&i&&i[jw])}var Ww=dO;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 fO(i){var e=i==null?0:i.length;return e?qw(i,1):[]}var Xw=fO;function pO(i){return pd(yd(i,void 0,Xw),i+"")}var Yw=pO;var mO=wd(Object.getPrototypeOf,Object),Sl=mO;var gO="[object Object]",yO=Function.prototype,vO=Object.prototype,Qw=yO.toString,xO=vO.hasOwnProperty,bO=Qw.call(Object);function wO(i){if(!Zr(i)||Bn(i)!=gO)return!1;var e=Sl(i);if(e===null)return!0;var t=xO.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Qw.call(t)==bO}var Md=wO;function SO(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=SO;function MO(){this.__data__=new ro,this.size=0}var Zw=MO;function AO(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var $w=AO;function TO(i){return this.__data__.get(i)}var eS=TO;function _O(i){return this.__data__.has(i)}var tS=_O;var EO=200;function CO(i,e){var t=this.__data__;if(t instanceof ro){var r=t.__data__;if(!no||r.length<EO-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=CO;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 LO(i,e){return i&&qn(e,gl(e),i)}var nS=LO;function NO(i,e){return i&&qn(e,zi(e),i)}var iS=NO;var sS=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oS=sS&&typeof module=="object"&&module&&!module.nodeType&&module,PO=oS&&oS.exports===sS,aS=PO?cr.Buffer:void 0,lS=aS?aS.allocUnsafe:void 0;function IO(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=IO;function DO(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=DO;function RO(){return[]}var _d=RO;var OO=Object.prototype,BO=OO.propertyIsEnumerable,uS=Object.getOwnPropertySymbols,FO=uS?function(i){return i==null?[]:(i=Object(i),cS(uS(i),function(e){return BO.call(i,e)}))}:_d,Al=FO;function GO(i,e){return qn(i,Al(i),e)}var hS=GO;var zO=Object.getOwnPropertySymbols,UO=zO?function(i){for(var e=[];i;)wl(e,Al(i)),i=Sl(i);return e}:_d,Ed=UO;function kO(i,e){return qn(i,Ed(i),e)}var dS=kO;function VO(i,e,t){var r=e(i);return zr(i)?r:wl(r,t(i))}var Cd=VO;function HO(i){return Cd(i,gl,Al)}var fS=HO;function jO(i){return Cd(i,zi,Ed)}var Ld=jO;var WO=Sn(cr,"DataView"),Nd=WO;var JO=Sn(cr,"Promise"),Pd=JO;var qO=Sn(cr,"Set"),Id=qO;var pS="[object Map]",XO="[object Object]",mS="[object Promise]",gS="[object Set]",yS="[object WeakMap]",vS="[object DataView]",YO=ms(Nd),QO=ms(no),KO=ms(Pd),ZO=ms(Id),$O=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==XO?i.constructor:void 0,r=t?ms(t):"";if(r)switch(r){case YO:return vS;case QO:return pS;case KO:return mS;case ZO:return gS;case $O:return yS}return e});var Tl=Wo;var eB=Object.prototype,tB=eB.hasOwnProperty;function rB(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&tB.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var xS=rB;var nB=cr.Uint8Array,mg=nB;function iB(i){var e=new i.constructor(i.byteLength);return new mg(e).set(new mg(i)),e}var _l=iB;function sB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var bS=sB;var oB=/\w*$/;function aB(i){var e=new i.constructor(i.source,oB.exec(i));return e.lastIndex=i.lastIndex,e}var wS=aB;var SS=dn?dn.prototype:void 0,MS=SS?SS.valueOf:void 0;function lB(i){return MS?Object(MS.call(i)):{}}var AS=lB;function cB(i,e){var t=e?_l(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Dd=cB;var uB="[object Boolean]",hB="[object Date]",dB="[object Map]",fB="[object Number]",pB="[object RegExp]",mB="[object Set]",gB="[object String]",yB="[object Symbol]",vB="[object ArrayBuffer]",xB="[object DataView]",bB="[object Float32Array]",wB="[object Float64Array]",SB="[object Int8Array]",MB="[object Int16Array]",AB="[object Int32Array]",TB="[object Uint8Array]",_B="[object Uint8ClampedArray]",EB="[object Uint16Array]",CB="[object Uint32Array]";function LB(i,e,t){var r=i.constructor;switch(e){case vB:return _l(i);case uB:case hB:return new r(+i);case xB:return bS(i,t);case bB:case wB:case SB:case MB:case AB:case TB:case _B:case EB:case CB:return Dd(i,t);case dB:return new r;case fB:case gB:return new r(i);case pB:return wS(i);case mB:return new r;case yB:return AS(i)}}var TS=LB;function NB(i){return typeof i.constructor=="function"&&!fl(i)?$b(Sl(i)):{}}var Rd=NB;var PB="[object Map]";function IB(i){return Zr(i)&&Tl(i)==PB}var _S=IB;var ES=gs&&gs.isMap,DB=ES?ml(ES):_S,CS=DB;var RB="[object Set]";function OB(i){return Zr(i)&&Tl(i)==RB}var LS=OB;var NS=gs&&gs.isSet,BB=NS?ml(NS):LS,PS=BB;var FB=1,GB=2,zB=4,IS="[object Arguments]",UB="[object Array]",kB="[object Boolean]",VB="[object Date]",HB="[object Error]",DS="[object Function]",jB="[object GeneratorFunction]",WB="[object Map]",JB="[object Number]",RS="[object Object]",qB="[object RegExp]",XB="[object Set]",YB="[object String]",QB="[object Symbol]",KB="[object WeakMap]",ZB="[object ArrayBuffer]",$B="[object DataView]",e3="[object Float32Array]",t3="[object Float64Array]",r3="[object Int8Array]",n3="[object Int16Array]",i3="[object Int32Array]",s3="[object Uint8Array]",o3="[object Uint8ClampedArray]",a3="[object Uint16Array]",l3="[object Uint32Array]",Vt={};Vt[IS]=Vt[UB]=Vt[ZB]=Vt[$B]=Vt[kB]=Vt[VB]=Vt[e3]=Vt[t3]=Vt[r3]=Vt[n3]=Vt[i3]=Vt[WB]=Vt[JB]=Vt[RS]=Vt[qB]=Vt[XB]=Vt[YB]=Vt[QB]=Vt[s3]=Vt[o3]=Vt[a3]=Vt[l3]=!0;Vt[HB]=Vt[DS]=Vt[KB]=!1;function Od(i,e,t,r,n,s){var o,a=e&FB,l=e&GB,c=e&zB;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==jB;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 c3=1,u3=4;function h3(i){return Bd(i,c3|u3)}var gg=h3;function d3(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=d3;var f3=OS(),BS=f3;var p3=function(){return cr.Date.now()},Fd=p3;var m3="Expected a function",g3=Math.max,y3=Math.min;function v3(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(m3);e=ug(e)||0,mr(t)&&(u=!!t.leading,d="maxWait"in t,s=d?g3(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?y3(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=v3;function x3(i,e,t){(t!==void 0&&!$s(i[e],t)||t===void 0&&!(e in i))&&dl(i,e,t)}var Xc=x3;function b3(i){return Zr(i)&&eo(i)}var FS=b3;function w3(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Yc=w3;function S3(i){return qn(i,zi(i))}var GS=S3;function M3(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=M3;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 A3(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var VS=A3;function T3(i,e){return e.length<2?i:Hw(i,Kw(e,0,-1))}var HS=T3;var _3=lw(function(i,e,t){kS(i,e,t)}),Jo=_3;function E3(i,e){return e=bl(e,i),i=HS(i,e),i==null||delete i[Sd(VS(e))]}var jS=E3;function C3(i){return Md(i)?void 0:i}var WS=C3;var L3=1,N3=2,P3=4,I3=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,L3|N3|P3,WS));for(var n=e.length;n--;)jS(t,e[n]);return t}),El=I3;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(i,e){for(let t of i)e(t.id,t.data),ZS(t.children,e)}function $S(i,e){e(i.id,i.data);for(let t of i.children)$S(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&&$S(r,t)}}traverse(e){ZS(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 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 eM=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]}}}},tM=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))}},rM=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))}},nM={get(i,e){if(e===kd)return()=>{i._parent=null};if(e===eM)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]}}},D3=xe(re({},nM),{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=B3(t))!=null?n:t}},i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){throw new Error("set to undefined is not supported!")}}),R3=xe(re({},nM),{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 rM(i,e,t),R3):t!==null&&typeof t=="object"?KS(t)?t:new Proxy(new tM(i,e,t),D3):t}function O3(i){let e=new xg(i);return[Vd(e,"",i),e]}function bg(i,e){let[t,r]=O3(i);return e(t),r.result()}function B3(i){return i instanceof $c||i instanceof eu?i._current:i!==null&&typeof i=="object"?i[eM]: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 iM=[],Mg=iM,Ag=0,An={},bt,lo,Yn=0,Vi=0,Gn,xs,fn=[],Et,sM={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 gM(()=>(Yd(),this?this.unpack(e,t):bs.prototype.unpack.call(sM,e,t)));ao=t>-1?t:e.length,Z=0,Ag=0,Vi=0,lo=null,Mg=iM,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=sM,(!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&&oM(),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&&oM(),Yd(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function oM(){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&&lM()[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[fM()]=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):hM(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 pM(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++,pM(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):G3(e);case 218:return e=Et.getUint16(Z),Z+=2,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):z3(e);case 219:return e=Et.getUint32(Z),Z+=4,Vi>=Z?lo.slice(Z-Yn,(Z+=e)-Yn):U3(e);case 220:return e=Et.getUint16(Z),Z+=2,cM(e);case 221:return e=Et.getUint32(Z),Z+=4,cM(e);case 222:return e=Et.getUint16(Z),Z+=2,uM(e);case 223:return e=Et.getUint32(Z),Z+=4,uM(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 F3=/^[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=>F3.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(hr);return i.highByte===0&&(i.read=aM(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?aM(e,t):t}var aM=(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]||lM()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=_g(n,i)),n.read()};function lM(){let i=gM(()=>(Pe=null,An.getStructures()));return bt=An._mergeStructures(i,bt)}var Eg=Xd,G3=Xd,z3=Xd,U3=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 cM(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=hr();return e}function uM(i){if(An.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[fM()]=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 hM(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 dM=new Array(4096);function fM(){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=dM[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=[],dM[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):hM(i);return a!=null?t.string=a:t.string=Eg(i)}var pM=(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()},mM=typeof self=="object"?self:global;fn[0]=()=>{};fn[0].noBuffer=!0;fn[101]=()=>{let i=hr();return(mM[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 mM[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 gM(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 yM(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}),k3=Kd.unpack,V3=Kd.unpackMultiple,H3=Kd.unpack;var j3=new Float32Array(1),_6=new Uint8Array(j3.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,xM=ef?Buffer:Uint8Array,bM=ef?4294967296:2144337920,de,gr,ae=0,Hi,ji=null,W3=/[\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=xM.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=q3(de.subarray(r,ae),a.idsToInsert);return a=null,C}return E&AM?(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&Q3&&(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=W3.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=J3(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>bM)throw new Error("Packed buffer would be larger than maximum buffer size");E=Math.min(bM,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?wM(i,16,e):SM(ef?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==xM&&this.structuredClone?wM(i,Ng.indexOf(t.name),e):SM(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function wM(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 SM(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 J3(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 q3(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)}yM(i)}var MM=new Pl({useRecords:!1}),X3=MM.pack,Y3=MM.pack;var AM=512,Q3=1024;var TM=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 K3(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 TM.pack(n)}r.serialize=i;function e(n){return TM.unpack(n)}r.deserialize=e;function t(n){return K3(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 _M;(function(e){e.defaultData=re({type:"Empty"},uo.defaultData)})(_M||(_M={}));var Bg;(function(e){e.defaultData=re(re({type:"Mesh"},uo.defaultData),nf.defaultData)})(Bg||(Bg={}));var EM;(function(e){e.defaultData=re(re({type:"TextFrame"},uo.defaultData),sf.defaultData)})(EM||(EM={}));var ff;(function(e){e.defaultData=re(re(re({},uo.defaultData),ru.identity),qo.defaultData)})(ff||(ff={}));var CM;(function(e){function i(t){return re(re({},uo.defaultData),rf.defaultData(t))}e.defaultData=i})(CM||(CM={}));var LM;(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")})})(LM||(LM={}));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 NM;(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}})(NM||(NM={}));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"},PM={type:"changeZoom"},Z3={type:"changePan"},Ol={type:"start"},iu={type:"end"},IM=/iPad|iPhone|iPod/.test(navigator.userAgent)||Vc&&"ontouchend"in document,su=new A,DM=new A,$3=new F,RM=new A,OM=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,BM=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,FM=new F,GM=new F,eF=2*Math.PI,tF=1e-8,rF=.01,zM=2,Vg=.125,UM=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,kM=!1,Jg=0,gf=1,qg,yf=!1,VM=-1,HM=-1,Xg,Yg=0,jM=1/0,Qg=0,Kg=1/0,WM=0,JM=Math.PI,Zg=-1/0,$g=1/0,ey=0,ty=Math.PI,ry=-1/0,ny=1/0,qM=zn.BOUNCE,XM=zn.BOUNCE,YM=!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((YM===!0?1:-1)*this.getAutoRotationAngle()),this.rotationLimitsMode!==kr.DEFAULT&&this.applyLimits(vi,this.rotationLimitsMode,qM,$g,Zg,JM,WM,FM),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(jM,$r.radius))),this.panLimitsMode!==kr.DEFAULT&&(this.target.applyQuaternion(zg.copy(this.object.quaternion).invert()),Qn.applyQuaternion(zg),this.applyLimits(Qn,this.panLimitsMode,XM,ty,ey,ny,ry,GM),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%eF;return DM.copy(su).normalize(),this.object.up.copy(Ze.DefaultUp).applyAxisAngle(DM,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||RM.distanceToSquared(this.object.position)>rF||8*(1-OM.dot(this.object.quaternion))>tF?(this.dispatchEvent(Gg),RM.copy(this.object.position),OM.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)),iF(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=>{KM(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=>{KM(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(ZM(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(ZM(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(HM),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),HM=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,XM=e.panSoftLimit,qM=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,jM=Math.max(Yg,1e3/e.zoomLimits.min),this.autoRotate=e.autoRotate,zM=e.autoRotateSpeed,YM=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,GM.set(ty-ey,ny-ry).divideScalar(2),FM.setScalar(Math.PI).divideScalar(4),WM=fo($r.phi-e.rotationVerticalOffset.min),JM=fo($r.phi+e.rotationVerticalOffset.max),Zg=fo($r.theta-e.rotationHorizontalOffset.min),$g=fo($r.theta+e.rotationHorizontalOffset.max),kM=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),IM||(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),IM||(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&&kM?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(QM(Math.abs(Vr.x)),1),Vr.y=Math.min(QM(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*zM}getZoomScale(){return Math.pow(.95,UM)}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;BM.copy(n).sub(this.target);let s=BM.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(Z3)}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(PM)}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(PM)}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($3,-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=nF(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(VM),VM=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,UM)),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 QM(i){return 1-Math.pow(1-i,4)}function nF(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 iF(i){yt.push(i)}function KM(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 ZM(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 $M=3,Tr=5855577;var e1=2857471;var oy=15711266;var ay=class extends ng{constructor(){super();this.layers.enable($M)}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 t1=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 r1(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=r1(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=r1(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 n1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,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 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,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 s1(e,t,r,n,s,o,a,l),Object.assign(c,{userData:xe(re({},i),{type:"CubeGeometry"})})}},ly=Math.PI/2,s1=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 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,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,sF=new F,oF=new F,aF=new F,lF=new F,a1=new A,l1=new A;function c1(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 cF(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function uF(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 u1(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 h1(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function d1(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 f1(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=sF.subVectors(r,t).multiplyScalar(n).add(t),l=s,c=oF.subVectors(o,s).multiplyScalar(n).add(s),u=aF.subVectors(a,o).multiplyScalar(n).add(o),d=a,h=lF.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 p1(i,e,t=12,r=!0){let n=l1.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&&uF(s,n))continue;s===void 0&&(s=a1),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 m1(i,e,t,r=12,n=!0){let s=l1.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=a1:(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 g1(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&&cF(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,hF=new F,dF=new F,fF=new F,pF=new F,mF=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 p1(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 m1(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),g1(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,hF);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]=u1(b,w,M,dF,fF),_=h1(E,C,a.position),[O,P]=d1(_,b,w,M,pF,mF);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=f1(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]=c1(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 gF(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 y1(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 yF(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=y1(1,0,x,b),M=y1(x,b,w,T);return!c&&M>0&&(M-=my),c&&M<0&&(M+=my),{centerx:y,centery:m,ang1:S,ang2:M}}function v1({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=yF(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(gF(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}(),x1=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}(),b1=function(){function i(){this.handle=null}return i}(),w1=function(){function i(){this.key=null,this.node=0}return i}(),vF=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 b1,this.handles[r]=new w1;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 b1;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new w1}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}(),S1=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),xF=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new S1,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 S1;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}(),bF=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 xF(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 vF(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}(),wF=function(){function i(){this.mesh=new x1,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 x1),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_(),bF.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 wF;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 _9=Zt.ODD,E9=Zt.NONZERO,C9=Zt.POSITIVE,L9=Zt.NEGATIVE,N9=Zt.ABS_GEQ_TWO,P9=_r.POLYGONS,I9=_r.CONNECTED_POLYGONS,D9=_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 M1=Math.PI*2,A1=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=SF(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 SF(i,e,t,r,n,s){if(r>=M1)return n>30||n%4==0?(AF(i,e,t,s),Math.round(n/4)):T1(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=v1({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?MF(i,o.x,o.y,c,n,e,t,s):T1(i,r,n,e,t,s)}function MF(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?_1(i,s,o,a):i.addPoint(Ul(0,0)),l}function T1(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<M1?s>0?_1(i,r,n,s):i.addPoint(Ul(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&E1(i,r,n,s)),1}function AF(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&&E1(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 _1(i,e,t,r){C1(i,e,t,r).forEach(s=>i.addPoint(s))}function E1(i,e,t,r){let n=C1(i,e,t,r),s=new St;n.forEach(o=>s.addPoint(o)),s.isClosed=!0,i.shapeHoles.push(s)}function C1(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 L1=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 N1=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:o}=i.parameters,a=n===0&&s!==0?new _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 P1=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 I1().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 I1=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 TF=["a","b","c"];function _F(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 EF(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;EF(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[_F(m,TF[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 D1=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 R1=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 O1(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 CF(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var O1=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=CF(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 B1=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 F1=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 G1=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 z1=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=LF(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 LF(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 U1=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 k1=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={};JT(gu,{addBarycentricAttribute:()=>IF,fixUvs:()=>RF,loadFromUrl:()=>DF,resizeGeometry:()=>PF,roundShapePolygon:()=>NF});var V1=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}},NF=(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=V1(a,o),x=V1(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()},PF=(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},IF=(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))},DF=i=>new Promise(e=>{new Ho().load(i,r=>e(r))}),RF=(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 OF,Df=new Promise(i=>{OF=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:n1,CubeGeometry:i1,CylinderGeometry:t1,DodecahedronGeometry:o1,EllipseGeometry:A1,HelixGeometry:L1,IcosahedronGeometry:N1,LatheGeometry:P1,NonParametricGeometry:Nf,PolygonGeometry:D1,PyramidGeometry:R1,RectangleGeometry:Pf,SphereGeometry:B1,PlaneGeometry:F1,StarGeometry:G1,TextFrameGeometry:If,TorusGeometry:z1,TorusKnotGeometry:U1,TriangleGeometry:k1,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 BF(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 H1(i,e,t){BF(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 j1(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 FF(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 W1=(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):(FF(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=>W1(s,t,n,e.enableHelper===!0)):W1(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 J1(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 q1=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 q1;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 GF=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,X1=/[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=X1.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=GF.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let o=s[3].match(X1);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 zF=/^([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=zF.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 UF=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
3192
3192
|
)*?)}`,"gim"),kF=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=UF.exec(e);if(t){let r=t[2],n;for(;n=kF.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(`
|
|
@@ -4139,7 +4139,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
4139
4139
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${a.result}, ${l.result} );
|
|
4140
4140
|
}
|
|
4141
4141
|
`),c&&h.push(c.code,`outgoingLight = spe_blend(outgoingLight, ${c.result}, 1.0, SPE_BLENDING_NORMAL);`),u?h.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${u.result} );`):h.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),h.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=h.join(`
|
|
4142
|
-
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.roughness=this.roughness.toJSON(e).uuid,t.metalness=this.metalness.toJSON(e).uuid,this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.reflectivity&&(t.reflectivity=this.reflectivity.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.metalness&&(this.metalness=t.getNode(e.metalness)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.reflectivity&&(this.reflectivity=t.getNode(e.reflectivity)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}};var Qy=class extends Zn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}constructor(e=new Yy,t){super(e,e,t);this.type="StandardNodeMaterial",this.fragment=e}};var Au=class extends Qy{constructor(e,t,r){super(t,e);this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof mn){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Au(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function $f(i,e){switch(i.data.type){case"light":return wi(i);case"fresnel":return qF(i,e);case"gradient":return XF(i);case"depth":return YF(i);case"normal":return QF(i);case"noise":return KF(i,e);case"texture":return ZF(i,e);case"rainbow":return $F(i);case"transmission":return eG(i,e);case"matcap":return tG(i,e);case"displace":return rG(i);case"color":default:return JF(i,e)}}function K1(i){return{type:i.data.type}}function wi(i){let{alpha:e,mode:t}=i.data;return xe(re({},K1(i)),{alpha:e,mode:t})}function JF(i,e){return xe(re({},wi(i)),{color:sr(i.data.color,e)})}function qF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return xe(re({},wi(i)),{color:sr(o,e),bias:t,scale:r,intensity:n,factor:s})}function XF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return xe(re({},wi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Qe(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new F(...o),morph:new F(...a),angle:s})}function YF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:u}=i.data;return xe(re({},wi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new A(...o),direction:a?new A(...a):new A(1,0,0),num:l.length,colors:l.map(d=>new Qe(d[0],d[1],d[2],d[3])),steps:c,smooth:u})}function QF(i){let{cnormal:e}=i.data;return xe(re({},wi(i)),{cnormal:new A(e[0],e[1],e[2])})}function KF(i,e){let{data:t}=i;return xe(re({},wi(i)),{scale:t.scale,move:t.move,fA:new F(...t.fA),fB:new F(...t.fB),distortion:new F(...t.distortion),colorA:sr(t.colorA,e),colorB:sr(t.colorB,e),colorC:sr(t.colorC,e),colorD:sr(t.colorD,e),noiseType:t.noiseType})}function ZF(i,e){let{projection:t,axis:r,crop:n,size:s}=i.data,{image:o,wrapping:a,repeat:l,offset:c}=i.data.texture,u=new Pt,d;if(typeof o=="string")d=e==null?void 0:e.getImage(o);else{let h=new Image;h.src=o.data,h.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(o.data))},d=h}return u.image=d,u.wrapS=u.wrapT=a,xe(re({},wi(i)),{texture:u,mat:new Dt().setUvTransform(c[0],c[1],l[0],l[1],0,0,0),crop:n,projection:t,axis:["x","y","z"].indexOf(r),size:s})}function $F(i){let{data:e}=i;return xe(re({},wi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new A(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new A(...e.offset)})}function eG(i,e){let{data:t}=i;return xe(re({},wi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function tG(i,e){let t=new Pt,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=r.data,o.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(r.data))},n=o}t.image=n;let s=16777215;return xe(re({},wi(i)),{color:s,texture:t})}function rG(i){let{data:e}=i,t=xe(re({},K1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return xe(re({},t),{offset:new A(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new Pt,n=new Dt().setUvTransform(0,0,1,1,0,0,0);return xe(re({},t),{texture:r,mat:n,crop:e.crop})}}function ep(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var Yl;(function(e){function i(t){return new ve(t.x,t.y,t.z).getHex()}e.getHex=i})(Yl||(Yl={}));var Z1;(function(e){function i(t){return new Qe(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(Z1||(Z1={}));var $1;(function(t){function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new ve(r.r,r.g,r.b).getHex()}t.getHex=e})($1||($1={}));function yo(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Ky(i,e)}function eA(i,e){return i.map(t=>yo(t,e))}function Ky(i,e){let t=nG(i),r;switch(t.category){case"basic":r=new sn;break;case"lambert":{r=new Su;break}case"toon":{r=new Mu;break}case"physical":r=new Au;break;case"phong":default:{r=new $n;break}}let n=r.userData.layers;iG(n);for(let s=i.layers.length-1;s>=0;s--)sG(n,i.layers[s],e);switch(t.category){case"basic":break;case"lambert":{let a=r,c=sr(t.emissive,e);c instanceof ve?a.emissive.value=c:a.emissive.value.setHex(Yl.getHex(c));break}case"toon":{let a=r,l=t;a.shininess.value=l.shininess;let c=sr(l.specular,e);c instanceof ve?a.specular.value=c:a.specular.value.setHex(Yl.getHex(c));break}case"physical":let s=r,o=t;s.metalness.value=o.metalness,s.roughness.value=o.roughness,s.reflectivity.value=o.reflectivity;break;case"phong":default:{let a=r,l=t;a.shininess.value=l.shininess;let c=sr(l.specular,e);c instanceof ve?a.specular.value=c:a.specular.value.setHex(Yl.getHex(c));break}}return n.blendColors(),n.blendAfterColors(),n.blendPositions(),r}function nG(i){for(let e of i.layers)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:Ar.Normal}}function iG(i){for(let e of i.getLayers())i.removeLayer(e.id)}function sG(i,e,t){let r=$f(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)ep(s,n,e.data)}var aa=new Set;var Si;(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"})(Si||(Si={}));var Ts=class{constructor(){this.easing=4;this.duration=1e3;this.delay=0;this.cubicControls=[.5,.05,.1,.3];this.springParameters={mass:1,stiffness:80,damping:10,velocity:0};this.repeat=!1;this.cycle=!1;this.rewind=!1}static create(e){let t=new Ts,r=e;return t.easing=e.easing,t.duration=e.duration,t.delay=e.delay,r.easing===Qc.CUBIC?t.cubicControls=[...r.control1,...r.control2]:r.easing===Qc.SPRING&&(t.springParameters={mass:r.mass,stiffness:r.stiffness,damping:r.damping,velocity:r.velocity}),t.repeat=e.repeat,t.cycle=e.cycle,t.rewind=e.rewind,t}get sp_mass(){return this.springParameters.mass}set sp_mass(e){this.springParameters.mass=e}get sp_stiffness(){return this.springParameters.stiffness}set sp_stiffness(e){this.springParameters.stiffness=e}get sp_damping(){return this.springParameters.damping}set sp_damping(e){this.springParameters.damping=e}get sp_velocity(){return this.springParameters.velocity}set sp_velocity(e){this.springParameters.velocity=e}copy(e){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters=re({},e.springParameters),this.repeat=e.repeat,this.cycle=e.cycle,this.rewind=e.rewind,this}clone(){return new Ts().copy(this)}toJSON(){let e={easing:this.easing,duration:this.duration,delay:this.delay,cubicControls:this.cubicControls,springParameters:re({},this.springParameters)};return this.repeat===!0&&(e.repeat=!0),this.cycle===!0&&(e.cycle=!0),this.rewind===!0&&(e.rewind=!0),this.object!==void 0&&(e.object=this.object.uuid),this.state!==void 0&&(e.state=this.state.uuid),e}fromJSON(e,t,r){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters.mass=e.springParameters.mass,this.springParameters.stiffness=e.springParameters.stiffness,this.springParameters.damping=e.springParameters.damping,this.springParameters.velocity=e.springParameters.velocity,e.repeat!==void 0&&(this.repeat=e.repeat),e.cycle!==void 0&&(this.cycle=e.cycle),e.rewind!==void 0&&(this.rewind=e.rewind),e.object!==void 0&&(this.object=t[e.object]),e.state!==void 0&&(this.state=r[e.state]),this}};function oG(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Je;(function(h){h[h.MOUSE_DOWN=0]="MOUSE_DOWN",h[h.MOUSE_UP=1]="MOUSE_UP",h[h.MOUSE_HOVER=2]="MOUSE_HOVER",h[h.MOUSE_ENTER=3]="MOUSE_ENTER",h[h.MOUSE_LEAVE=4]="MOUSE_LEAVE",h[h.KEY_DOWN=5]="KEY_DOWN",h[h.KEY_UP=6]="KEY_UP",h[h.START=7]="START",h[h.OPEN_LINK=8]="OPEN_LINK",h[h.LOOK_AT=9]="LOOK_AT",h[h.FOLLOW=10]="FOLLOW",h[h.SCROLL=11]="SCROLL"})(Je||(Je={}));var vo=class{constructor(e,t){this.targets=[];this._type=e,this.key=t}get type(){return this._type}set type(e){this._type=e,e===9?this.distance=1e3:this.distance=void 0,e!==5&&e!==6&&(this.key=void 0)}newTarget(e){let t=new Ts;if(t.object=e,e!==void 0){let r=e.interaction.states;r.length>0&&(t.state=r[r.length-1])}return this.targets.push(t),aa.add(t),t}addTarget(e,t=0){this.targets.splice(t,0,e),aa.add(e)}removeTarget(e){aa.delete(this.targets[e]),this.targets.splice(e,1)}dispatchReverse(){for(let e=0,t=this.targets.length;e<t;++e){let r=this.targets[e];r.state!==void 0&&r.object!==void 0&&r.object.interaction.reverse(r)}}dispatch(e){this.url!==void 0&&(this._type===8||this._type===0||this._type===1||this._type===5||this._type===6)&&(oG()?window.location.assign(this.url):window.open(this.url,"_blank"));for(let t=0,r=this.targets.length;t<r;++t){let n=this.targets[t];n.state!==void 0&&n.object!==void 0&&(this._type===11?n.object.interaction.seek(n,e,this.steps):n.object.interaction.play(n))}}copy(e){return this._type=e.type,this.key=e.key,this.url=e.url,this.distance=e.distance,this}clone(){return new vo().copy(this)}toJSON(){let e={type:this._type,key:this.key,ui:{isCollapsed:!1}};if(this.url!==void 0&&(e.url=this.url),this.distance!==void 0&&(e.distance=this.distance),this.targets.length>0){e.targets=[];for(let t=0,r=this.targets.length;t<r;++t)e.targets.push(this.targets[t].toJSON())}return e}fromJSON(e,t,r){if(this._type=e.type,this.key=e.key,this.targets=[],this.url=e.url,e.distance!==void 0&&(this.distance=e.distance),e.targets!==void 0)for(let n=0,s=e.targets.length;n<s;++n)this.addTarget(new Ts().fromJSON(e.targets[n],t,r),n);return this}};var Qi=class{constructor(){this.uuid=rt.generateUUID();this.name="";this.position=new A;this.rotation=new jn;this.scale=new A;this.hiddenMatrix=new Me}static create(e,t,r){let n=new Qi;if(n.uuid=e,n.position.fromArray(t.position),n.scale.fromArray(t.scale),n.rotation.fromArray(t.rotation),n.hiddenMatrix.fromArray(t.hiddenMatrix),"geometry"in t&&(n.geometry=t.geometry),"material"in t&&(n.material={layersList:yo(t.material,r).layersList.getLayers()}),"materials"in t&&(n.material=t.materials.map(s=>({layersList:yo(s,r).layersList.getLayers()}))),"perspective"in t&&(n.camera={zoomOrtho:t.orthographic.zoom,zoomPersp:t.perspective.zoom,targetOffset:t.targetOffset}),Il.is(t.type)){let s=t;n.light={intensity:s.intensity,color:sr(s.color,r)}}return n}update(e){this.updateMatrix(e),"geometry"in e&&this.updateGeometry(e),"material"in e&&this.updateMaterial(e),e.objectType==="CombinedCamera"?this.updateCamera(e):(e.objectType==="LightDirectional"||e.objectType==="LightPoint"||e.objectType==="LightSpot")&&this.updateLight(e)}updateCamera(e){this.camera={zoomPersp:e.perspCamera.zoom,zoomOrtho:e.orthoCamera.zoom,targetOffset:e.targetOffset}}updateLight(e){let t=e.color;this.light={intensity:e.intensity,color:{r:t.r,g:t.g,b:t.b}}}updateMatrix(e){this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),"hiddenMatrix"in e&&this.hiddenMatrix.copy(e.hiddenMatrix)}updateGeometry(e){if("geometry"in e){let{width:t,height:r,depth:n}=e.geometry.userData.parameters;this.geometry={width:t,height:r,depth:n}}}updateMaterial(e){if("material"in e)if(e.material instanceof Array){this.material=[];for(let t=0,r=e.material.length;t<r;++t){let n=e.material[t],s=[],o=n.layersList.head;for(;o;)s.push(o.clone()),o=o.next;this.material.push({layersList:s})}}else{let t=e.material,r=[],n=t.layersList.head;for(;n;)r.push(n.clone()),n=n.next;this.material={layersList:r}}}execute(e){if(e.position.copy(this.position),e.rotation.copy(this.rotation),e.scale.copy(this.scale),"hiddenMatrix"in e&&e.hiddenMatrix.copy(this.hiddenMatrix),"geometry"in e&&this.geometry!==void 0){let r=e.geometry.userData.parameters,n=this.geometry;(n.width!==r.width||n.height!==r.height||n.depth!==r.depth)&&e.updateGeometry({parameters:{width:n.width,height:n.height,depth:n.depth}})}if("material"in e){let t=e.material;if(t instanceof Array){let r=this.material;for(let n=0,s=r.length;n<s;++n){let o=t[n].layersList.head,a=r[n].layersList,l=0;for(;o;)o.copy(a[l++]),o=o.next;t[n].dispose()}}else{if(t.userData.isAsset)return;let r=0,n=t.layersList.head,o=this.material.layersList;for(;n;)n.copyUniforms(o[r++]),n=n.next;t.dispose()}}if(this.camera&&e.objectType==="CombinedCamera"&&(e=e,e.zoom=e.cameraType==="OrthographicCamera"?this.camera.zoomOrtho:this.camera.zoomPersp,e.targetOffset=this.camera.targetOffset,e.updateProjectionMatrix()),this.light&&(e.objectType==="LightDirectional"||e.objectType==="LightPoint"||e.objectType==="LightSpot")){e=e,e.intensity=this.light.intensity;let t=this.light.color;e.color.setRGB(t.r,t.g,t.b)}}copy(e){if(this.name=e.name,this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),this.hiddenMatrix.copy(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let t=0,r=e.material.length;t<r;++t)this.material.push({layersList:e.material[t].layersList.map(n=>n.clone())})}else this.material={layersList:e.material.layersList.map(t=>t.clone())};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:e.camera.targetOffset}),e.light!==void 0&&(this.light={intensity:e.light.intensity,color:Ur.clone(e.light.color)}),this}clone(){return new Qi().copy(this)}toJSON(e){let t={uuid:this.uuid,name:this.name,position:this.position.toArray(),rotation:this.rotation.toArray(),scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};if(this.geometry!==void 0&&(t.geometry={width:this.geometry.width,height:this.geometry.height,depth:this.geometry.depth}),this.material!==void 0)if(this.material instanceof Array){t.material=[];for(let r=0,n=this.material.length;r<n;++r)t.material.push({layersList:this.material[r].layersList.map(s=>s.toJSON(e))})}else t.material={layersList:this.material.layersList.map(r=>r.toJSON(e))};return this.camera!==void 0&&(t.camera={zoomPersp:this.camera.zoomPersp,zoomOrtho:this.camera.zoomOrtho,targetOffset:this.camera.targetOffset}),t}fromJSON(e,t){var r;if(this.uuid=e.uuid,this.name=e.name,this.position.fromArray(e.position),this.rotation.fromArray(e.rotation),this.scale.fromArray(e.scale),this.hiddenMatrix.fromArray(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let n=0,s=e.material.length;n<s;++n)this.material.push({layersList:e.material[n].layersList.map(o=>Iy(o,t))})}else this.material={layersList:e.material.layersList.map(n=>Iy(n,t))};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:(r=e.camera.targetOffset)!=null?r:-1}),this}};"use strict";var tA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Zy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},aG=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],tp={CSS:{},springs:{}};function Ki(i,e,t){return Math.min(Math.max(i,e),t)}function Tu(i,e){return i.indexOf(e)>-1}function $y(i,e){return i.apply(null,e)}var qe={arr:function(i){return Array.isArray(i)},obj:function(i){return Tu(Object.prototype.toString.call(i),"Object")},pth:function(i){return qe.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||qe.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i=="undefined"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return qe.hex(i)||qe.rgb(i)||qe.hsl(i)},key:function(i){return!tA.hasOwnProperty(i)&&!Zy.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function rA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function nA(i,e){var t=rA(i),r=Ki(qe.und(t[0])?1:t[0],.1,100),n=Ki(qe.und(t[1])?100:t[1],.1,100),s=Ki(qe.und(t[2])?10:t[2],.1,100),o=Ki(qe.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,d=l<1?(l*a+-o)/c:-o+a;function h(f){var g=e?e*f/1e3:f;return l<1?g=Math.exp(-g*l*a)*(u*Math.cos(c*g)+d*Math.sin(c*g)):g=(u+d*g)*Math.exp(-g*a),f===0||f===1?f:1-g}function p(){var f=tp.springs[i];if(f)return f;for(var g=1/6,v=0,y=0;;)if(v+=g,h(v)===1){if(y++,y>=16)break}else y=0;var m=v*g*1e3;return tp.springs[i]=m,m}return e?h:p}function lG(i){return i===void 0&&(i=10),function(e){return Math.ceil(Ki(e,1e-6,1)*i)*(1/i)}}var cG=function(){var i=11,e=1/(i-1);function t(u,d){return 1-3*d+3*u}function r(u,d){return 3*d-6*u}function n(u){return 3*u}function s(u,d,h){return((t(d,h)*u+r(d,h))*u+n(d))*u}function o(u,d,h){return 3*t(d,h)*u*u+2*r(d,h)*u+n(d)}function a(u,d,h,p,f){var g,v,y=0;do v=d+(h-d)/2,g=s(v,p,f)-u,g>0?h=v:d=v;while(Math.abs(g)>1e-7&&++y<10);return v}function l(u,d,h,p){for(var f=0;f<4;++f){var g=o(d,h,p);if(g===0)return d;var v=s(d,h,p)-u;d-=v/g}return d}function c(u,d,h,p){if(!(0<=u&&u<=1&&0<=h&&h<=1))return;var f=new Float32Array(i);if(u!==d||h!==p)for(var g=0;g<i;++g)f[g]=s(g*e,u,h);function v(y){for(var m=0,x=1,b=i-1;x!==b&&f[x]<=y;++x)m+=e;--x;var w=(y-f[x])/(f[x+1]-f[x]),T=m+w*e,S=o(T,u,h);return S>=.001?l(y,T,u,h):S===0?T:a(y,m,m+e,u,h)}return function(y){return u===d&&h===p||y===0||y===1?y:s(v(y),d,p)}}return c}(),iA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Ki(r,1,10),o=Ki(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function ev(i,e){if(qe.fnc(i))return i;var t=i.split("(")[0],r=iA[t],n=rA(i);switch(t){case"spring":return nA(i,e);case"cubicBezier":return $y(cG,n);case"steps":return $y(lG,n);default:return $y(r,n)}}function sA(i){try{var e=document.querySelectorAll(i);return e}catch(t){return}}function rp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function np(i){return i.reduce(function(e,t){return e.concat(qe.arr(t)?np(t):t)},[])}function oA(i){return qe.arr(i)?i:(qe.str(i)&&(i=sA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function tv(i,e){return i.some(function(t){return t===e})}function rv(i){var e={};for(var t in i)e[t]=i[t];return e}function nv(i,e){var t=rv(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function ip(i,e){var t=rv(i);for(var r in e)t[r]=qe.und(i[r])?e[r]:i[r];return t}function uG(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function hG(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function dG(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(h,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?h+(p-h)*6*f:f<1/2?p:f<2/3?h+(p-h)*(2/3-f)*6:h}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,d=2*n-u;a=o(d,u,t+1/3),l=o(d,u,t),c=o(d,u,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function fG(i){if(qe.rgb(i))return uG(i);if(qe.hex(i))return hG(i);if(qe.hsl(i))return dG(i)}function _s(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function pG(i){if(Tu(i,"translate")||i==="perspective")return"px";if(Tu(i,"rotate")||Tu(i,"skew"))return"deg"}function iv(i,e){return qe.fnc(i)?i(e.target,e.id,e.total):i}function Zi(i,e){return i.getAttribute(e)}function sv(i,e,t){var r=_s(e);if(tv([t,"deg","rad","turn"],r))return e;var n=tp.CSS[e+t];if(!qe.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return tp.CSS[e+t]=c,c}function aA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?sv(i,n,t):n}}function ov(i,e){if(qe.dom(i)&&!qe.inp(i)&&(Zi(i,e)||qe.svg(i)&&i[e]))return"attribute";if(qe.dom(i)&&tv(aG,e))return"transform";if(qe.dom(i)&&e!=="transform"&&aA(i,e))return"css";if(i[e]!=null)return"object"}function lA(i){if(!!qe.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function mG(i,e,t,r){var n=Tu(e,"scale")?1:0+pG(e),s=lA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?sv(i,s,r):s}function av(i,e,t,r){switch(ov(i,e)){case"transform":return mG(i,e,r,t);case"css":return aA(i,e,t);case"attribute":return Zi(i,e);default:return i[e]||0}}function lv(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=_s(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function cA(i,e){if(qe.col(i))return fG(i);if(/\s/g.test(i))return i;var t=_s(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function cv(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function gG(i){return Math.PI*2*Zi(i,"r")}function yG(i){return Zi(i,"width")*2+Zi(i,"height")*2}function vG(i){return cv({x:Zi(i,"x1"),y:Zi(i,"y1")},{x:Zi(i,"x2"),y:Zi(i,"y2")})}function uA(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=cv(r,s)),r=s}return t}function xG(i){var e=i.points;return uA(i)+cv(e.getItem(e.numberOfItems-1),e.getItem(0))}function hA(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return gG(i);case"rect":return yG(i);case"line":return vG(i);case"polyline":return uA(i);case"polygon":return xG(i)}}function bG(i){var e=hA(i);return i.setAttribute("stroke-dasharray",e),e}function wG(i){for(var e=i.parentNode;qe.svg(e)&&qe.svg(e.parentNode);)e=e.parentNode;return e}function dA(i,e){var t=e||{},r=t.el||wG(i),n=r.getBoundingClientRect(),s=Zi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function SG(i,e){var t=qe.str(i)?sA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:dA(t),totalLength:hA(t)*(r/100)}}}function MG(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=dA(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function fA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=cA(qe.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:qe.str(i)||e?r.split(t):[]}}function pA(i){var e=i?np(qe.arr(i)?i.map(oA):oA(i)):[];return rp(e,function(t,r,n){return n.indexOf(t)===r})}function mA(i){var e=pA(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:lA(t)}}})}function AG(i,e){var t=rv(e);if(/^spring/.test(t.easing)&&(t.duration=nA(t.easing)),qe.arr(i)){var r=i.length,n=r===2&&!qe.obj(i[0]);n?i={value:i}:qe.fnc(e.duration)||(t.duration=e.duration/r)}var s=qe.arr(i)?i:[i];return s.map(function(o,a){var l=qe.obj(o)&&!qe.pth(o)?o:{value:o};return qe.und(l.delay)&&(l.delay=a?0:e.delay),qe.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return ip(o,t)})}function TG(i){for(var e=rp(np(i.map(function(s){return Object.keys(s)})),function(s){return qe.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)qe.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function _G(i,e){var t=[],r=e.keyframes;r&&(e=ip(TG(r),e));for(var n in e)qe.key(n)&&t.push({name:n,tweens:AG(e[n],i)});return t}function EG(i,e){var t={};for(var r in i){var n=iv(i[r],e);qe.arr(n)&&(n=n.map(function(s){return iv(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function CG(i,e){var t;return i.tweens.map(function(r){var n=EG(r,e),s=n.value,o=qe.arr(s)?s[1]:s,a=_s(o),l=av(e.target,i.name,a,e),c=t?t.to.original:l,u=qe.arr(s)?s[0]:c,d=_s(u)||_s(l),h=a||d;return qe.und(o)&&(o=c),n.from=fA(u,h),n.to=fA(lv(o,u),h),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=ev(n.easing,n.duration),n.isPath=qe.pth(s),n.isColor=qe.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var gA={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function yA(i,e){var t=mA(i);t.forEach(function(r){for(var n in e){var s=iv(e[n],r),o=r.target,a=_s(s),l=av(o,n,a,r),c=a||_s(l),u=lv(cA(s,c),l),d=ov(o,n);gA[d](o,n,u,r.transforms,!0)}})}function LG(i,e){var t=ov(i.target,e.name);if(t){var r=CG(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function NG(i,e){return rp(np(i.map(function(t){return e.map(function(r){return LG(t,r)})})),function(t){return!qe.und(t)})}function vA(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var xA=0;function PG(i){var e=nv(tA,i),t=nv(Zy,i),r=_G(t,i),n=mA(i.targets),s=NG(n,r),o=vA(s,t),a=xA;return xA++,ip(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var _n=[],bA=[],sp,IG=function(){function i(){sp=requestAnimationFrame(e)}function e(t){var r=_n.length;if(r){for(var n=0;n<r;){var s=_n[n];if(!s.paused)s.tick(t);else{var o=_n.indexOf(s);o>-1&&(_n.splice(o,1),r=_n.length)}n++}i()}else sp=cancelAnimationFrame(sp)}return i}();function DG(){document.hidden?(_n.forEach(function(i){return i.pause()}),bA=_n.slice(0),Sr.running=_n=[]):bA.forEach(function(i){return i.play()})}typeof document!="undefined"&&document.addEventListener("visibilitychange",DG);function Sr(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(x){var b=window.Promise&&new Promise(function(w){return o=w});return x.finished=b,b}var l=PG(i),c=a(l);function u(){var x=l.direction;x!=="alternate"&&(l.direction=x!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(b){return b.reversed=l.reversed})}function d(x){return l.reversed?l.duration-x:x}function h(){e=0,t=d(l.currentTime)*(1/Sr.speed)}function p(x,b){b&&b.seek(x-b.timelineOffset)}function f(x){if(l.reversePlayback)for(var w=s;w--;)p(x,n[w]);else for(var b=0;b<s;b++)p(x,n[b])}function g(x){var b=0,w=l.animations,T=w.length;for(l.reversePlayback===!0&&l.rewind===!1&&(x=l.duration-x);b<T;){var S=w[b],M=S.animatable,E=S.tweens,C=E.length-1,_=E[C];C&&(_=rp(E,function(ce){return x<ce.end})[0]||_);for(var O=Ki(x-_.start-_.delay,0,_.duration)/_.duration,P=isNaN(O)?1:_.easing(O),D=_.to.strings,G=_.round,R=[],U=_.to.numbers.length,te=void 0,he=0;he<U;he++){var H=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var z=_.to.numbers[he],B=_.from.numbers[he]||0;else var B=_.to.numbers[he],z=_.from.numbers[he]||0;_.isPath?H=MG(_.value,P*B):H=z+P*(B-z),G&&(_.isColor&&he>2||(H=Math.round(H*G)/G)),R.push(H)}var Y=D.length;if(!Y)te=R[0];else{te=D[0];for(var q=0;q<Y;q++){var ee=D[q],k=D[q+1],pe=R[q];isNaN(pe)||(k?te+=pe+k:te+=pe+" ")}}gA[S.type](M.target,S.property,te,M.transforms),S.currentValue=te,b++}}function v(x){l[x]&&!l.passThrough&&l[x](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function m(x){var b=l.duration,w=l.delay,T=b-l.endDelay,S=d(x);l.progress=Ki(S/b*100,0,100),l.reversePlayback=S<l.currentTime,n&&f(S),!l.began&&l.currentTime>=0&&(l.began=!0,v("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,v("loopBegin")),S<=w&&l.currentTime!==0&&g(0),(S>=T&&l.currentTime!==b||!b)&&g(b),S>w&&S<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,v("changeBegin")),v("change"),g(S)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,v("changeComplete")),l.currentTime=Ki(S,0,b),l.began&&v("update"),x>=b&&(t=0,y(),l.remaining?(e=r,v("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,v("loopComplete"),v("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var x=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=x==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||x==="alternate"&&l.loop===1)&&l.remaining++,g(l.reversed?l.duration:0)},l.set=function(x,b){return yA(x,b),l},l.tick=function(x){r=x,e||(e=r),m((r+(t-e))*Sr.speed)},l.seek=function(x){m(d(x))},l.pause=function(){l.paused=!0,h()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,_n.push(l),h(),sp||IG())},l.reverse=function(){u(),l.completed=!l.reversed,h()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function wA(i,e){for(var t=e.length;t--;)tv(i,e[t].animatable.target)&&e.splice(t,1)}function RG(i){for(var e=pA(i),t=_n.length;t--;){var r=_n[t],n=r.animations,s=r.children;wA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;wA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function OG(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?ev(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=qe.arr(i),d=parseFloat(u?i[0]:i),h=u?parseFloat(i[1]):0,p=_s(u?i[1]:i)||0,f=e.start||0+(u?d:0),g=[],v=0;return function(y,m,x){if(a&&(o=0),l&&(o=(x-1)/2),c&&(o=x-1),!g.length){for(var b=0;b<x;b++){if(!n)g.push(Math.abs(o-b));else{var w=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),S=b%n[0],M=Math.floor(b/n[0]),E=w-S,C=T-M,_=Math.sqrt(E*E+C*C);s==="x"&&(_=-E),s==="y"&&(_=-C),g.push(_)}v=Math.max.apply(Math,g)}r&&(g=g.map(function(P){return r(P/v)*v})),t==="reverse"&&(g=g.map(function(P){return s?P<0?P*-1:-P:Math.abs(v-P)}))}var O=u?(h-d)/v:d;return f+O*(Math.round(g[m]*100)/100)+p}}function BG(i){i===void 0&&(i={});var e=Sr(i);return e.duration=0,e.add=function(t,r){var n=_n.indexOf(e),s=e.children;n>-1&&_n.splice(n,1);function o(h){h.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=ip(t,nv(Zy,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=qe.und(r)?c:lv(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=Sr(l);o(u),s.push(u);var d=vA(s,i);return e.delay=d.delay,e.endDelay=d.endDelay,e.duration=d.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Sr.version="3.2.0";Sr.speed=1;Sr.running=_n;Sr.remove=RG;Sr.get=av;Sr.set=yA;Sr.convertPx=sv;Sr.path=SG;Sr.setDashoffset=bG;Sr.stagger=OG;Sr.timeline=BG;Sr.easing=ev;Sr.penner=iA;Sr.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var _u=Sr;function SA(i){var o;let e=[],t=i.groups,r=i.getAttribute("position").array,n=i.getAttribute("normal").array,s=(o=i.getAttribute("uv"))==null?void 0:o.array;return t.forEach(a=>{let l=a.count,c=new _e,u=new Float32Array(l*3),d=new Float32Array(l*3),h=new Float32Array(l*2);for(let p=0;p<l;p++){let f=3*(a.start+p),g=3*p;if(u[g]=r[f],u[g+1]=r[f+1],u[g+2]=r[f+2],d[g]=n[f],d[g+1]=n[f+1],d[g+2]=n[f+2],s){let v=2*(a.start+p),y=2*p;h[y]=s[v],h[y+1]=s[v+1]}}c.setAttribute("position",new Ae(u,3)),c.setAttribute("normal",new Ae(d,3)),s&&c.setAttribute("uv",new Ae(h,2)),e.push(c)}),e}var Eu=class{constructor(){this.pluginCallbacks=[],this.register(function(e){return new LA(e)}),this.register(function(e){return new NA(e)}),this.register(function(e){return new PA(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new DA(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){let n=new CA,s=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)s.push(this.pluginCallbacks[o](n));n.setPlugins(s),n.write(e,t,r)}},Bt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},kn={};kn[tr]=Bt.NEAREST;kn[ih]=Bt.NEAREST_MIPMAP_NEAREST;kn[sh]=Bt.NEAREST_MIPMAP_LINEAR;kn[tt]=Bt.LINEAR;kn[Dp]=Bt.LINEAR_MIPMAP_NEAREST;kn[Li]=Bt.LINEAR_MIPMAP_LINEAR;kn[ar]=Bt.CLAMP_TO_EDGE;kn[Os]=Bt.REPEAT;kn[cc]=Bt.MIRRORED_REPEAT;var MA={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},AA=12,FG=1179937895,GG=2,TA=8,zG=1313821514,UG=5130562;function Cu(i,e){return i.length===e.length&&i.every(function(t,r){return t===e[r]})}function kG(i){if(window.TextEncoder!==void 0)return new TextEncoder().encode(i).buffer;let e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0,r=i.length;t<r;t++){let n=i.charCodeAt(t);e[t]=n>255?32:n}return e.buffer}function VG(i){return Cu(i.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function HG(i,e,t){let r={min:new Array(i.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(i.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=e;n<e+t;n++)for(let s=0;s<i.itemSize;s++){let o;i.itemSize>4?o=i.array[n*i.itemSize+s]:s===0?o=i.getX(n):s===1?o=i.getY(n):s===2?o=i.getZ(n):s===3&&(o=i.getW(n)),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function _A(i){return Math.ceil(i/4)*4}function uv(i,e=0){let t=_A(i.byteLength);if(t!==i.byteLength){let r=new Uint8Array(t);if(r.set(new Uint8Array(i)),e!==0)for(let n=i.byteLength;n<t;n++)r[n]=e;return r.buffer}return i}var EA=null,CA=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);let n=this;Promise.all(this.pending).then(function(){let s=n.buffers,o=n.json,a=n.options,l=n.extensionsUsed,c=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(l);if(u.length>0&&(o.extensionsUsed=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),a.binary===!0){let d=new window.FileReader;d.readAsArrayBuffer(c),d.onloadend=function(){let h=uv(d.result),p=new DataView(new ArrayBuffer(TA));p.setUint32(0,h.byteLength,!0),p.setUint32(4,UG,!0);let f=uv(kG(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(TA));g.setUint32(0,f.byteLength,!0),g.setUint32(4,zG,!0);let v=new ArrayBuffer(AA),y=new DataView(v);y.setUint32(0,FG,!0),y.setUint32(4,GG,!0);let m=AA+g.byteLength+f.byteLength+p.byteLength+h.byteLength;y.setUint32(8,m,!0);let x=new Blob([v,g,f,p,h],{type:"application/octet-stream"}),b=new window.FileReader;b.readAsArrayBuffer(x),b.onloadend=function(){t(b.result)}}}else if(o.buffers&&o.buffers.length>0){let d=new window.FileReader;d.readAsDataURL(c),d.onloadend=function(){let h=d.result;o.buffers[0].uri=h,t(o)}}else t(o)})}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;let r=this.options,n=this.extensionsUsed;try{let s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],n[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let r=new A;for(let n=0,s=e.count;n<s;n++)if(Math.abs(r.fromBufferAttribute(e,n).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let r=e.clone(),n=new A;for(let s=0,o=r.count;s<o;s++)n.fromBufferAttribute(r,s),n.x===0&&n.y===0&&n.z===0?n.setX(1):n.normalize(),r.setXYZ(s,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1,n={};(t.offset.x!==0||t.offset.y!==0)&&(n.offset=t.offset.toArray(),r=!0),t.rotation!==0&&(n.rotation=t.rotation,r=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){let t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,n,s){let o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===Bt.UNSIGNED_BYTE?a=1:t===Bt.UNSIGNED_SHORT?a=2:a=4;let l=_A(n*e.itemSize*a),c=new DataView(new ArrayBuffer(l)),u=0;for(let p=r;p<r+n;p++)for(let f=0;f<e.itemSize;f++){let g;e.itemSize>4?g=e.array[p*e.itemSize+f]:f===0?g=e.getX(p):f===1?g=e.getY(p):f===2?g=e.getZ(p):f===3&&(g=e.getW(p)),t===Bt.FLOAT?c.setFloat32(u,g,!0):t===Bt.UNSIGNED_INT?c.setUint32(u,g,!0):t===Bt.UNSIGNED_SHORT?c.setUint16(u,g,!0):t===Bt.UNSIGNED_BYTE&&c.setUint8(u,g),u+=a}let d={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(d.target=s),s===Bt.ARRAY_BUFFER&&(d.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(d),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(n){let s=new window.FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){let o=uv(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,n(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,n){let s=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"},l;if(e.array.constructor===Float32Array)l=Bt.FLOAT;else if(e.array.constructor===Uint32Array)l=Bt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)l=Bt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)l=Bt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),n===void 0&&(n=e.count),s.truncateDrawRange&&t!==void 0&&t.index===null){let p=r+n,f=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),n=Math.min(p,f)-r,n<0&&(n=0)}if(n===0)return null;let c=HG(e,r,n),u;t!==void 0&&(u=e===t.index?Bt.ELEMENT_ARRAY_BUFFER:Bt.ARRAY_BUFFER);let d=this.processBufferView(e,l,r,n,u),h={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:n,max:c.max,min:c.min,type:a[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(h)-1}processImage(e,t,r){let n=this,s=n.cache,o=n.json,a=n.options,l=n.pending;s.images.has(e)||s.images.set(e,{});let c=s.images.get(e),u=t===Qt?"image/png":"image/jpeg",d=u+":flipY/"+r.toString();if(c[d]!==void 0)return c[d];o.images||(o.images=[]);let h={mimeType:u};if(a.embedImages){let f=EA=EA||document.createElement("canvas");f.width=Math.min(e.width,a.maxTextureSize),f.height=Math.min(e.height,a.maxTextureSize);let g=f.getContext("2d");if(r===!0&&(g.translate(0,f.height),g.scale(1,-1)),typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)g.drawImage(e,0,0,f.width,f.height);else{t!==Qt&&t!==jt&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let v=new Uint8ClampedArray(e.height*e.width*4);if(t===Qt)for(let y=0;y<v.length;y+=4)v[y+0]=e.data[y+0],v[y+1]=e.data[y+1],v[y+2]=e.data[y+2],v[y+3]=e.data[y+3];else for(let y=0,m=0;y<v.length;y+=4,m+=3)v[y+0]=e.data[m+0],v[y+1]=e.data[m+1],v[y+2]=e.data[m+2],v[y+3]=255;g.putImageData(new ImageData(v,e.width,e.height),0,0)}a.binary===!0?l.push(new Promise(function(v){f.toBlob(function(y){n.processBufferViewImage(y).then(function(m){h.bufferView=m,v()})},u)})):h.uri=f.toDataURL(u)}else h.uri=e.src;let p=o.images.push(h)-1;return c[d]=p,p}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let r={magFilter:kn[e.magFilter],minFilter:kn[e.minFilter],wrapS:kn[e.wrapS],wrapT:kn[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){let t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(n.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,n)});let s=r.textures.push(n)-1;return t.textures.set(e,s),s}processMaterial(e){let t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let n={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let s=e.color.toArray().concat([e.opacity]);if(Cu(s,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){let a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),n.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){let a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){let a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(n.emissiveFactor=a.toArray()),e.emissiveMap){let c={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(c,e.emissiveMap),n.emissiveTexture=c}}if(e.normalMap){let a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),n.normalTexture=a}if(e.aoMap){let a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a}e.transparent?n.alphaMode="BLEND":e.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===Yt&&(n.doubleSided=!0),e.name!==""&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,n)});let o=r.materials.push(n)-1;return t.materials.set(e,o),o}processMesh(e){let t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(let x=0,b=e.material.length;x<b;x++)n.push(e.material[x].uuid);else n.push(e.material.uuid);let s=n.join(":");if(t.meshes.has(s))return t.meshes.get(s);let o=e.geometry,a;if(e.isLineSegments?a=Bt.LINES:e.isLineLoop?a=Bt.LINE_LOOP:e.isLine?a=Bt.LINE_STRIP:e.isPoints?a=Bt.POINTS:a=e.material.wireframe?Bt.LINES:Bt.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");let l={},c={},u=[],d=[],h={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=o.getAttribute("normal");p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let f=null;for(let x in o.attributes){if(x.substr(0,5)==="morph")continue;let b=o.attributes[x];if(x=h[x]||x.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(x)||(x="_"+x),t.attributes.has(this.getUID(b))){c[x]=t.attributes.get(this.getUID(b));continue}f=null;let T=b.array;x==="JOINTS_0"&&!(T instanceof Uint16Array)&&!(T instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new Fe(new Uint16Array(T),b.itemSize,b.normalized));let S=this.processAccessor(f||b,o);S!==null&&(c[x]=S,t.attributes.set(this.getUID(b),S))}if(p!==void 0&&o.setAttribute("normal",p),Object.keys(c).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){let x=[],b=[],w={};if(e.morphTargetDictionary!==void 0)for(let T in e.morphTargetDictionary)w[e.morphTargetDictionary[T]]=T;for(let T=0;T<e.morphTargetInfluences.length;++T){let S={},M=!1;for(let E in o.morphAttributes){if(E!=="position"&&E!=="normal"){M||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),M=!0);continue}let C=o.morphAttributes[E][T],_=E.toUpperCase(),O=o.attributes[E];if(t.attributes.has(this.getUID(C))){S[_]=t.attributes.get(this.getUID(C));continue}let P=C.clone();if(!o.morphTargetsRelative)for(let D=0,G=C.count;D<G;D++)P.setXYZ(D,C.getX(D)-O.getX(D),C.getY(D)-O.getY(D),C.getZ(D)-O.getZ(D));S[_]=this.processAccessor(P,o),t.attributes.set(this.getUID(O),S[_])}d.push(S),x.push(e.morphTargetInfluences[T]),e.morphTargetDictionary!==void 0&&b.push(w[T])}l.weights=x,b.length>0&&(l.extras={},l.extras.targetNames=b)}let g=Array.isArray(e.material);if(g&&o.groups.length===0)return null;let v=g?e.material:[e.material],y=g?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let x=0,b=y.length;x<b;x++){let w={mode:a,attributes:c};if(this.serializeUserData(o,w),d.length>0&&(w.targets=d),o.index!==null){let S=this.getUID(o.index);(y[x].start!==void 0||y[x].count!==void 0)&&(S+=":"+y[x].start+":"+y[x].count),t.attributes.has(S)?w.indices=t.attributes.get(S):(w.indices=this.processAccessor(o.index,o,y[x].start,y[x].count),t.attributes.set(S,w.indices)),w.indices===null&&delete w.indices}let T=this.processMaterial(v[y[x].materialIndex]);T!==null&&(w.material=T),u.push(w)}l.primitives=u,r.meshes||(r.meshes=[]),this._invokeAll(function(x){x.writeMesh&&x.writeMesh(e,l)});let m=r.meshes.push(l)-1;return t.meshes.set(s,m),m}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let r=e.isOrthographicCamera,n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:rt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){let r=this.json,n=this.nodeMap;r.animations||(r.animations=[]),e=Eu.Utils.mergeMorphTargetTracks(e.clone(),t);let s=e.tracks,o=[],a=[];for(let l=0;l<s.length;++l){let c=s[l],u=lt.parseTrackName(c.name),d=lt.findNode(t,u.nodeName),h=MA[u.propertyName];if(u.objectName==="bones"&&(d.isSkinnedMesh===!0?d=d.skeleton.getBoneByName(u.objectIndex):d=void 0),!d||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;let p=1,f=c.values.length/c.times.length;h===MA.morphTargetInfluences&&(f/=d.morphTargetInfluences.length);let g;c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",f/=3):c.getInterpolation()===Ma?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new Fe(c.times,p)),output:this.processAccessor(new Fe(c.values,f)),interpolation:g}),o.push({sampler:a.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:o}),r.animations.length-1}processSkin(e){let t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],s=e.skeleton;if(s===void 0)return null;let o=e.skeleton.bones[0];if(o===void 0)return null;let a=[],l=new Float32Array(s.bones.length*16),c=new Me;for(let d=0;d<s.bones.length;++d)a.push(r.get(s.bones[d])),c.copy(s.boneInverses[d]),c.multiply(e.bindMatrix).toArray(l,d*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Fe(l,16)),joints:a,skeleton:r.get(o)}),n.skin=t.skins.length-1}processNode(e){let t=this.json,r=this.options,n=this.nodeMap;t.nodes||(t.nodes=[]);let s={};if(r.trs){let a=e.quaternion.toArray(),l=e.position.toArray(),c=e.scale.toArray();Cu(a,[0,0,0,1])||(s.rotation=a),Cu(l,[0,0,0])||(s.translation=l),Cu(c,[1,1,1])||(s.scale=c)}else e.matrixAutoUpdate&&e.updateMatrix(),VG(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){let a=this.processMesh(e);a!==null&&(s.mesh=a)}else e.isCamera&&(s.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let a=[];for(let l=0,c=e.children.length;l<c;l++){let u=e.children[l];if(u.visible||r.onlyVisible===!1){let d=this.processNode(u);d!==null&&a.push(d)}}a.length>0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});let o=t.nodes.push(s)-1;return n.set(e,o),o}processScene(e){let t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);let n={};e.name!==""&&(n.name=e.name),t.scenes.push(n);let s=[];for(let o=0,a=e.children.length;o<a;o++){let l=e.children[o];if(l.visible||r.onlyVisible===!1){let c=this.processNode(l);c!==null&&s.push(c)}}s.length>0&&(n.nodes=s),this.serializeUserData(e,n)}processObjects(e){let t=new Gr;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){let t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(n){n.beforeParse&&n.beforeParse(e)});let r=[];for(let n=0;n<e.length;n++)e[n]instanceof Gr?this.processScene(e[n]):r.push(e[n]);r.length>0&&this.processObjects(r);for(let n=0;n<this.skins.length;++n)this.processSkin(this.skins[n]);for(let n=0;n<t.animations.length;++n)this.processAnimation(t.animations[n],e[0]);this._invokeAll(function(n){n.afterParse&&n.afterParse(e)})}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}},LA=class{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let r=this.writer,n=r.json,s=r.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},s[this.name]=!0);let a=n.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}},NA=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},PA=class{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;let r=this.writer,n=r.extensionsUsed,s={};t.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);let o=[1,1,1];if(e.specular.toArray(o,0),s.specularFactor=o,s.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){let a={index:r.processTexture(e.specularMap)};r.applyTextureTransform(a,e.specularMap),s.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}},IA=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,n=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){let o={index:r.processTexture(e.transmissionMap)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}},DA=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.thickness===0)return;let r=this.writer,n=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){let o={index:r.processTexture(e.thicknessMap)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationTint.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}};Eu.Utils={insertKeyframe:function(i,e){let t=.001,r=i.getValueSize(),n=new i.TimeBufferType(i.times.length+1),s=new i.ValueBufferType(i.values.length+r),o=i.createInterpolant(new i.ValueBufferType(r)),a;if(i.times.length===0){n[0]=e;for(let l=0;l<r;l++)s[l]=0;a=0}else if(e<i.times[0]){if(Math.abs(i.times[0]-e)<t)return 0;n[0]=e,n.set(i.times,1),s.set(o.evaluate(e),0),s.set(i.values,r),a=0}else if(e>i.times[i.times.length-1]){if(Math.abs(i.times[i.times.length-1]-e)<t)return i.times.length-1;n[n.length-1]=e,n.set(i.times,0),s.set(i.values,0),s.set(o.evaluate(e),i.values.length),a=n.length-1}else for(let l=0;l<i.times.length;l++){if(Math.abs(i.times[l]-e)<t)return l;if(i.times[l]<e&&i.times[l+1]>e){n.set(i.times.slice(0,l+1),0),n[l+1]=e,n.set(i.times.slice(l+1),l+2),s.set(i.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(i.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return i.times=n,i.values=s,a},mergeMorphTargetTracks:function(i,e){let t=[],r={},n=i.tracks;for(let s=0;s<n.length;++s){let o=n[s],a=lt.parseTrackName(o.name),l=lt.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(Aa)}let c=l.morphTargetInfluences.length,u=l.morphTargetDictionary[a.propertyIndex];if(u===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let d;if(r[l.uuid]===void 0){d=o.clone();let p=new d.ValueBufferType(c*d.times.length);for(let f=0;f<d.times.length;f++)p[f*c+u]=d.values[f];d.name=(a.nodeName||"")+".morphTargetInfluences",d.values=p,r[l.uuid]=d,t.push(d);continue}let h=o.createInterpolant(new o.ValueBufferType(1));d=r[l.uuid];for(let p=0;p<d.times.length;p++)d.values[p*c+u]=h.evaluate(d.times[p]);for(let p=0;p<o.times.length;p++){let f=this.insertKeyframe(d,o.times[p]);d.values[f*c+u]=o.values[p]}}return i.tracks=t,i}};var jG,RA=new Promise(i=>{jG=i});var GA=Hv(FA());var ap={isPublish:!1,gltfQueue:[]};function Lu(i,e,t){return i[e.uuid]===void 0&&(i[e.uuid]=e.toJSON(t)),e.uuid}var ZG=new Eu;function zA(i,e,t){if(i[e.uuid]===void 0)if(e.userData.type==="NonParametricGeometry"||e.userData.type==="SubdivGeometry"){if(e.userData.type==="SubdivGeometry")if(ap.isPublish)e=Nf.create({geometry:e.clone()}),e.userData.parameters.subdivisions===0&&(delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.positionWASM,delete e.attributes.indexWASM,delete e.attributes.verticesPerFaceWASM);else{let n=e.originalGeometry;if(n){let s=e.userData;e=n.clone(),e.userData=s}else e=e.clone();delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.position,delete e.attributes.normal,e.index=null}let r=e.originalGeometry;if(r!==void 0){let n=e.userData;e=r,e.userData=n}if(!ap.isPublish)i[e.uuid]=e.toJSON();else{let n={type:"NonParametricGeometry",uuid:e.uuid,userData:{}};e.name!==""&&(n.name=e.name),Object.keys(e.userData).length>0&&(n.userData=re({},e.userData));let s=e.index===null,o=new Oi;if(Array.isArray(t))SA(e).forEach((l,c)=>{let u=new Wt(l,new il);o.add(u),l.userData.groupIndex=c,l.userData.materialIndex=e.groups[c].materialIndex,l.index===null&&(s=!0)});else{let a=new Wt(e,new il);o.add(a)}ap.gltfQueue.push(new Promise(async a=>{await Promise.all(ap.gltfQueue),ZG.parse(o,async l=>{let{gltfTransform:c,DracoMeshCompressionExtension:u,addIndex:d}=await RA,h=c.readJSON({json:gg(l),resources:{}});h.createExtension(u).setRequired(!0).setEncoderOptions({quantizationVolume:"scene"}),s&&await h.transform(d);try{let{json:p,resources:f}=c.writeJSON(h),g=GA.default.fromByteArray(new Uint8Array(f[".bin"]));p.buffers[0].uri=`data:application/octet-stream;base64,${g}`,a()}catch(p){a()}},{})})),i[e.uuid]=n}}else{let r=e.userData;if(r.type==="VectorGeometry"){let n=e.userData.shape;r=Object.assign({},r,{shape:n.toJSON()})}i[e.uuid]={uuid:e.uuid,userData:r}}return e.uuid}function Ql(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function UA(i){let e=[];for(let t in i)e.push(i[t]);return e}var Es;(function(r){r[r.started=0]="started",r[r.ended=1]="ended",r[r.once=2]="once"})(Es||(Es={}));var Mi=class{constructor(e){this.object=e;this.uuid=rt.generateUUID();this.states=[];this.events=[];this._scrollCounter=null;this._interpolateMaterialBetweenValues=(e,t,r,n=t.getNames())=>{var s,o,a,l,c;for(let u=0,d=n.length;u<d;++u){let h=n[u],p=`f${t.id}_${h}`,f=`f${r.id}_${h}`,g=t.uniforms[p],v=r.uniforms[f];if(!(!g||g.value===void 0||v===void 0)){if(h==="mode"){g.value!==v.value&&(g.value=v.value);continue}if(typeof g.value=="boolean"){g.value!==v.value&&(g.value=v.value);continue}if(typeof g.value=="number"){g.value!==v.value&&((s=this._animation)==null||s.add({targets:g,value:Number(v.value)},0));continue}if("isVector2"in g.value){g.value.equals(v.value)===!1&&((o=this._animation)==null||o.add({targets:g,x:v.value.x,y:v.value.y},0));continue}if("isVector3"in g.value){g.value.equals(v.value)===!1&&((a=this._animation)==null||a.add({targets:g,x:v.value.x,y:v.value.y,z:v.value.z},0));continue}if("isColor"in g.value){g.value.equals(v.value)===!1&&((l=this._animation)==null||l.add({targets:g.value,r:v.value.r,g:v.value.g,b:v.value.b},0));continue}}}if(t.backLayer){let d=`f${t.backLayer.id}_alpha`,h=t.backLayer.uniforms[d];(c=this._animation)==null||c.add({targets:h,value:0},0)}};this._interpolateMaterialBetweenLayers=(e,t,r)=>{var c,u,d;let n=e.layersList;if(t.backLayer===void 0){let h=r.getValues();h.alpha=0,t.backLayer=n.addLayerBeforeAt(h,t),t.backLayer.isBack=!0,e.dispose()}let s=`f${t.id}_alpha`,o=`f${(c=t.backLayer)==null?void 0:c.id}_alpha`,a=t.uniforms[s],l=(u=t.backLayer)==null?void 0:u.uniforms[o];(d=this._animation)==null||d.add({targets:a,value:0},0).add({targets:l,value:r.uniforms[`f${r.id}_alpha`].value},0)};this._interpolateMaterialTexture=(e,t,r)=>{var h;let n=`f${t.id}_texture`,s=t.uniforms[n].value,o=r.uniforms[`f${r.id}_texture`].value,a=t.uniforms[`f${t.id}_crop`],l=r.uniforms[`f${r.id}_crop`];a&&l&&a.value!==l.value&&(a.value=Number(l.value)),(s.wrapS!==o.wrapS||s.wrapT!==o.wrapT)&&(s.wrapS=o.wrapS,s.wrapT=o.wrapT,s.needsUpdate=!0);let c=s.matrix,u=o.matrix;if(c.equals(u)===!1){let p={repeatX:s.repeat.x,repeatY:s.repeat.y,offsetX:s.offset.x,offsetY:s.offset.y};(h=this._animation)==null||h.add({targets:p,repeatX:o.repeat.x,repeatY:o.repeat.y,offsetX:o.offset.x,offsetY:o.offset.y,update:()=>{s.repeat.set(p.repeatX,p.repeatY),s.offset.set(p.offsetX,p.offsetY),s.updateMatrix(),s.needsUpdate=!0}},0)}let d=["alpha","mode"];t.type==="displace_map"&&d.push("intensity"),this._interpolateMaterialBetweenValues(e,t,r,d)};this._interpolateMaterialGradient=(e,t,r)=>{var p;let n=10,s=`f${t.id}_steps`,o=`f${r.id}_steps`,a=t.uniforms[s],l=r.uniforms[o],c=`f${t.id}_colors`,u=`f${r.id}_colors`,d=t.uniforms[c],h=r.uniforms[u];for(let f=0;f<n;++f){let g=d.value[f],v=h.value[f];if(a.value[f]!==l.value[f]||!g.equals(v)){let y={value:a.value[f]};(p=this._animation)==null||p.add({targets:[y,g],value:l.value[f],x:v.x,y:v.y,z:v.z,w:v.w,update:()=>{a.value[f]=y.value}},0)}}this._interpolateMaterialBetweenValues(e,t,r,["alpha","mode","gradientType","smooth","offset","morph","angle","origin","direction","near","far"])}}static get isAllAnimationsEnded(){let e;for(let t in Mi.isAnimating){if(Mi.isAnimating[t]===2)return Mi.isAnimating[t]=1,!1;if(Mi.isAnimating[t]===0)return!1;e=!0}return e}computeCache(){return this.cache={mouseDown:this.events.find(e=>e.type===Je.MOUSE_DOWN),mouseUp:this.events.find(e=>e.type===Je.MOUSE_UP),mouseHover:this.events.find(e=>e.type===Je.MOUSE_HOVER),start:this.events.find(e=>e.type===Je.START),lookAt:this.events.find(e=>e.type===Je.LOOK_AT),follow:this.events.find(e=>e.type===Je.FOLLOW),keyDown:this.events.filter(e=>e.type===Je.KEY_DOWN),keyUp:this.events.filter(e=>e.type===Je.KEY_UP),scroll:this.events.find(e=>e.type===Je.SCROLL)},this.cache}newState(e){let t=new Qi;return t.name=e,t.update(this.object),this.states.push(t),t}addState(e,t){this.states.splice(t,0,e)}removeState(e){this.states.splice(e,1)}selectState(e){e!==void 0&&this.states[e].execute(this.object)}hasEventType(e,t){return e===Je.KEY_DOWN||e===Je.KEY_UP?t===void 0?!1:this.events.some(r=>r.type===e&&r.key===t):this.events.some(r=>r.type===e)}newEvent(){let e=[Je.MOUSE_DOWN,Je.MOUSE_UP,Je.MOUSE_HOVER,Je.KEY_DOWN].find(r=>this.hasEventType(r)===!1),t=new vo(e);return this.events.push(t),t}addEvent(e,t){this.events.splice(t,0,e);let r=this.events[t].targets;for(let n=0,s=r.length;n<s;++n)r[n].object!==void 0&&aa.add(r[n])}removeEvent(e){let t=this.events[e].targets;for(let r=0,n=t.length;r<n;++r)t[r].object!==void 0&&aa.delete(t[r]);this.events.splice(e,1)}copy(e){for(let t=0,r=e.states.length;t<r;++t)this.addState(e.states[t].clone(),t);for(let t=0,r=e.events.length;t<r;++t){this.addEvent(e.events[t].clone(),t);let n=e.events[t].targets;for(let s=0,o=n.length;s<o;++s){let a=n[s].clone();n[s].object===e.object?(a.object=this.object,a.state=this.states[e.states.indexOf(n[s].state)]):(a.object=n[s].object,a.state=n[s].state),this.events[t].addTarget(a,s)}}return this}clone(e){return new Mi(e).copy(this)}toJSON(e){e===void 0&&(e={nodes:{},geometries:{},materials:{},textures:{},images:{},interactionStates:{}});let t={uuid:this.uuid};if(this.states.length>0){t.states=[];for(let r=0,n=this.states.length;r<n;++r)t.states.push(Lu(e.interactionStates,this.states[r],e))}if(this.events.length>0){t.events=[];for(let r=0,n=this.events.length;r<n;++r)t.events.push(this.events[r].toJSON())}return t}fromJSON(e,t,r){var n;if(this.uuid=e.uuid,this.states=[],this.events=[],e.states!==void 0)for(let s=0,o=e.states.length;s<o;++s){let a=r[e.states[s]];this.states.push(a),((n=a.camera)==null?void 0:n.targetOffset)===-1&&(a.camera.targetOffset=this.object.getDistanceToTarget())}if(e.events!==void 0)for(let s=0,o=e.events.length;s<o;++s)this.events.push(new vo().fromJSON(e.events[s],t,r));return this}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null,this._removeBackLayer()),this.states.length>1?(this.states[0].execute(this.object),this._currentState=this.states[0],this._prevState=void 0):this._state0!==void 0?this._state0.execute(this.object):this.events.some(e=>e.type===Je.LOOK_AT||e.type===Je.FOLLOW)&&(this._state0=new Qi,this._state0.update(this.object))}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._removeBackLayer()),this.states.length>1?this.states[0].execute(this.object):this._state0!==void 0&&(this._state0.execute(this.object),this._state0=void 0),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),this.object.updateMatrix(),(t=this._animation)==null||t.finished.then(()=>{this.lookAt(e),this.object.updateMatrix()})}follow(e){this.object.position.copy(e),this.object.parent!==null&&this.object.position.applyMatrix4(new Me().copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4(new Me().copy(this.object.hiddenMatrix).invert()),this.object.updateMatrix()}play(e){this.object.visible&&e.state!==void 0&&this.animate(e.state,e)}seek(e,t,r){var n;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),Mi.isAnimating[e.state.uuid]=2,(n=this._animation)==null||n.seek(this._scrollCounter/r*e.duration)}reverse(e){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e)}_removeBackLayer(){if("material"in this.object){let e=this.object.material;if(e instanceof Array)for(let t=0,r=e.length;t<r;++t){let n=e[t].layersList,s=n.head;for(;s;)if(s.backLayer){delete s.backLayer;let o=s.next;n.removeLayer(s.id),s=o}else s.isBack&&(s.isBack=!1),s=s.next}else{let t=e.layersList,r=t.head;for(;r;)for(;r;)if(r.backLayer){delete r.backLayer;let n=r.next;t.removeLayer(r.id),r=n}else r.isBack&&(r.isBack=!1),r=r.next}}}getTimingFunction(e,t,r){switch(e){case Si.LINEAR:return"cubicBezier( 0, 0, 1, 1 )";case Si.EASE:return"cubicBezier( .25, .1, .25, 1 )";case Si.EASE_IN:return"cubicBezier( .42, 0, 1, 1 )";case Si.EASE_OUT:return"cubicBezier( 0, 0, .58, 1 )";case Si.EASE_IN_OUT:return"cubicBezier( .42, 0, .58, 1 )";case Si.CUBIC:return`cubicBezier( ${t[0]}, ${t[1]}, ${t[2]}, ${t[3]} )`;case Si.SPRING:return`spring( ${r.mass}, ${r.stiffness}, ${r.damping}, ${r.velocity} )`}}animate(e,t,r=!1){var n,s,o,a,l,c;if(Mi.isAnimating[e.uuid]=0,this._currentState===e){if((n=this._animation)==null?void 0:n.reversed){let u=(o=(s=this._animation)==null?void 0:s.currentTime)!=null?o:0;(a=this._animation)==null||a.reset(),(l=this._animation)==null||l.seek(u),(c=this._animation)==null||c.play()}}else this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&(Mi.isAnimating[this._prevState.uuid]=1,this._animation.pause()),this._removeBackLayer(),t.cycle===!0&&t.repeat===!0?this._animation=_u.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!0&&t.repeat===!1?this._animation=_u.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!1&&t.repeat===!0?this._animation=_u.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):this._animation=_u.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}),this._animation.finished.then(()=>{r||(this._removeBackLayer(),this._animation=void 0,Mi.isAnimating[e.uuid]=1)}),this.animateMatrix(e),this.animateGeometry(e),this.animateMaterial(e),this.animateCamera(e),this.animateLight(e.light)}animateMatrix(e){var s,o,a,l;if(this.object.position.equals(e.position)===!1){let c=this.object.position.clone(),u={t:0};(s=this._animation)==null||s.add({targets:u,t:1,update:()=>{this.object.position.lerpVectors(c,e.position,u.t),this.object.updateMatrix()}},0)}if(this.object.scale.equals(e.scale)===!1){let c=this.object.scale.clone(),u={t:0};(o=this._animation)==null||o.add({targets:u,t:1,update:()=>{this.object.scale.lerpVectors(c,e.scale,u.t),this.object.updateMatrix()}},0)}if(this.object.rotation.equals(e.rotation)===!1){let c=this.object.quaternion.clone(),u={t:0},d={x:this.object.rotation.x,y:this.object.rotation.y,z:this.object.rotation.z},h={x:e.rotation.x-this.object.rotation.x,y:e.rotation.y-this.object.rotation.y,z:e.rotation.z-this.object.rotation.z},p=e.rotation.clone(),f=new Ft().setFromEuler(p);(a=this._animation)==null||a.add({targets:u,t:1,update:Object.values(h).every(g=>Math.abs(g)<2*Math.PI)?()=>{J1(c,f,this.object.quaternion,u.t),this.object.updateMatrix()}:()=>{this.object.rotation.x=d.x+h.x*u.t,this.object.rotation.y=d.y+h.y*u.t,this.object.rotation.z=d.z+h.z*u.t,this.object.updateMatrix()}},0)}let t=new A,r=new Ft,n=new A;if(e.hiddenMatrix.decompose(t,r,n),"hiddenMatrix"in this.object){let c=new A,u=new Ft,d=new A;if(this.object.hiddenMatrix.decompose(c,u,d),this.object.hiddenMatrix.equals(e.hiddenMatrix)===!1){let h=new A,p=new Ft,f=new A,g={t:0},v=this.object.hiddenMatrix;(l=this._animation)==null||l.add({targets:g,t:1,update:()=>{p.slerpQuaternions(u,r,g.t),h.lerpVectors(c,t,g.t),f.lerpVectors(d,n,g.t),v.compose(h,p,f)}},0)}}}animateGeometry(e){var t;if("geometry"in this.object&&e.geometry!==void 0){let n=this.object.geometry.userData.parameters,s=e.geometry;if(s.width!==n.width||s.height!==n.height||s.depth!==n.depth){let o=this.object;(t=this._animation)==null||t.add({targets:n,width:s.width,height:s.height,depth:s.depth,update:()=>{o.updateGeometry({parameters:{width:n.width,height:n.height,depth:n.depth}})}},0)}}}animateMaterial(e){if("material"in this.object)if(this.object.material instanceof Array)for(let t=0,r=this.object.material.length;t<r;++t)this._interpolateMaterial(this.object.material[t],e.material[t]);else{if(this.object.material.userData.isAsset)return;this._interpolateMaterial(this.object.material,e.material)}}animateCamera(e){var t,r;if(this.object.objectType==="CombinedCamera"&&e.camera!==void 0){let n=this.object,s=n.cameraType==="OrthographicCamera"?e.camera.zoomOrtho:e.camera.zoomPersp;n.zoom!==s&&((t=this._animation)==null||t.add({targets:n,zoom:s,update:()=>{n.updateProjectionMatrix()}},0)),n.targetOffset!==e.camera.targetOffset&&((r=this._animation)==null||r.add({targets:n,targetOffset:e.camera.targetOffset},0))}}animateLight(e){var t,r;if(e!==void 0&&(this.object.objectType==="LightDirectional"||this.object.objectType==="LightSpot"||this.object.objectType==="LightPoint")){let n=this.object;n.intensity!==e.intensity&&((t=this._animation)==null||t.add({targets:n,intensity:e.intensity},0)),Ur.equals(n.color,e.color)||(r=this._animation)==null||r.add({targets:n.color,r:e.color.r,g:e.color.g,b:e.color.b},0)}}_interpolateMaterial(e,t){let r=e.layersList.head,n=0;for(;r;){if(r.isBack===!0){r=r.next;continue}let s=t.layersList[n++];if(kf(r)){let o=r.uniforms[`f${r.id}_texture`].value,a=s.uniforms[`f${s.id}_texture`].value;o.image===a.image?this._interpolateMaterialTexture(e,r,s):this._interpolateMaterialBetweenLayers(e,r,s)}else r.type==="gradient"||r.type==="depth"?r.uniforms[`f${r.id}_gradientType`].value===s.uniforms[`f${s.id}_gradientType`].value?this._interpolateMaterialGradient(e,r,s):this._interpolateMaterialBetweenLayers(e,r,s):this._interpolateMaterialBetweenValues(e,r,s);r=r.next}}},xo=Mi;xo.isAnimating={};var lp=i=>class extends i{hasEntityChild(){return this.children.some(t=>Of(t))}isDescendantOf(t){t instanceof Ze&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Me().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),Of(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Of(o)||o instanceof On)&&s.children.push(o.toJSON(t).object)}if(r){let o=Ql(t.geometries),a=Ql(t.materials),l=Ql(t.textures),c=Ql(t.images),u=Ql(t.interactionStates),d=UA(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),d.length>0&&(n.nodes=d)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var En=i=>"isEntity"in i,kA=i=>"isAbstractMesh"in i,ti=i=>class extends lp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Me;this.interaction=new xo(this);this._singleBBox=new Ff;this._recursiveBBox=new Ff;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(t){this.visible=t;for(let r of this.children)En(r)&&r.traverseEntity(n=>{Ss(n)&&n.visible&&(n.objectHelper.visible=t)})}get visibility(){return this.visible}get interactionCache(){return this.interaction.cache===void 0&&this.interaction.computeCache(),this.interaction.cache}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(t=>{En(t)&&(t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0)})}traverseEntity(t){t(this);for(let r of this.children)En(r)&&r.traverseEntity(t)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);for(let r of this.children)r.updateMatrixWorld(t)}updateWorldMatrix(t,r){let n=this.parent;if(t&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),r)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(t){return new this.constructor().shallowCopy(this,t)}shallowCopy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),r===!0)for(let n of t.children)En(n)&&this.add(n.shallowClone());return this}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),r===!0)for(let n of t.children)En(n)&&this.add(n.clone());return this}keepChildrenMatrixWorld(){let t=new Me,r=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),t.copy(this.matrixWorld).invert(),t.multiply(r);for(let n of this.children)En(n)&&n.hiddenMatrix.premultiply(t)}toJSON(t){let r=super.toJSON(t),n=r.object;return this.raycastLock===!0&&(n.raycastLock=!0),this.scaleLock===!0&&(n.scaleLock=!0),n.hiddenMatrix=this.hiddenMatrix.toArray(),this.interaction!==void 0&&(n.interaction=this.interaction.toJSON(t)),r}fromJSON(t){return super.fromJSON(t),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.scaleLock!==void 0&&(this.scaleLock=t.scaleLock),this.hiddenMatrix.fromArray(t.hiddenMatrix),this}fromObject3D(t){let r=t.children;return t.children=[],Object.assign(t,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Me}),this.copy(t),t.children=r,this}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return El(r,t)}fromObjectTransformState(t){return t.position&&this.position.fromArray(t.position),t.rotation&&this.rotation.fromArray(t.rotation),t.scale&&this.scale.fromArray(t.scale),t.hiddenMatrix&&this.hiddenMatrix.fromArray(t.hiddenMatrix),this.updateMatrix(),this}toState(t=[]){let r=re({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(t));return El(r,t)}fromState(t,r){return t.name&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.type!=="OrthographicCamera"&&t.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),t.visible!==void 0&&(this.visibility=t.visible),this.fromObjectTransformState(t),this}};var cp=class extends Ze{constructor(e,t={}){super();this.object=e;let r=e.recursiveBBox.getSize(new A),n=.1;this.parameters=zd.defaultData(r.toArray(),n),Jo(this.parameters,t),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let t of this.object.material)t.visible=!0;if(e){let t=this.object.material.map(r=>r.clone());for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material}for(let t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let t=this.object.material.clone();for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let t=0,r=e-this.children.length;t<r;++t){let n=this.object.shallowClone(!1);n.visible=!0,this.add(n),this.parameters.hideBase&&this.setHideBase(!0)}else for(let t=0,r=this.children.length-e;t<r;++t)this.remove(this.children[0])}_updateRadial(e){let t=e.radial,r=t.start*rt.DEG2RAD,n=t.end*rt.DEG2RAD,s=r-n,o=new jn(t.rotation[0]*rt.DEG2RAD,t.rotation[1]*rt.DEG2RAD,t.rotation[2]*rt.DEG2RAD),a;switch(t.axis){case"z":a=new A(0,0,1);break;case"y":a=new A(0,1,0);break;default:case"x":a=new A(1,0,0);break}for(let[l,c]of this.children.entries()){c.hiddenMatrix.identity(),c.scale.x=t.scale[0]+1,c.scale.y=t.scale[1]+1,c.scale.z=t.scale[2]+1,c.position.setScalar(0);let u=s/e.count*l-r;switch(t.axis){case"x":c.rotation.set(0,u,0);break;case"y":c.rotation.set(0,0,u);break;case"z":c.rotation.set(u,0,0);break}c.translateOnAxis(a,t.radius),c.position.x+=t.position[0],c.position.y+=t.position[1],c.position.z+=t.position[2],t.alignment===!0?(c.rotation.x+=o.x,c.rotation.y+=o.y,c.rotation.z+=o.z):c.rotation.copy(o)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=e.linear,r=new jn(t.rotation[0]*rt.DEG2RAD,t.rotation[1]*rt.DEG2RAD,t.rotation[2]*rt.DEG2RAD);for(let[n,s]of this.children.entries())s.hiddenMatrix.identity(),s.scale.x=t.scale[0]*n+1,s.scale.y=t.scale[1]*n+1,s.scale.z=t.scale[2]*n+1,s.rotation.x=r.x*n,s.rotation.y=r.y*n,s.rotation.z=r.z*n,s.position.x=t.position[0]*n,s.position.y=t.position[1]*n,s.position.z=t.position[2]*n}_updateGrid(e){let t=0,r=e.grid;if(r.useCenter===!0){let n={x:r.count[0]%2==0?2:1,y:r.count[1]%2==0?2:1,z:r.count[2]%2==0?2:1},s=new A(r.size[0]*(r.count[0]-n.x)*.5,r.size[1]*(r.count[1]-n.y)*.5,r.size[2]*(r.count[2]-n.z)*.5);for(let o=0;o<r.count[0];o++)for(let a=0;a<r.count[1];a++)for(let l=0;l<r.count[2];l++){let c=this.children[t++];c.hiddenMatrix.identity(),c.scale.setScalar(1),c.rotation.set(0,0,0),c.position.x=r.size[0]*o-s.x,c.position.y=r.size[1]*a-s.y,c.position.z=r.size[2]*l-s.z}}else for(let n=0;n<r.count[0];n++)for(let s=0;s<r.count[1];s++)for(let o=0;o<r.count[2];o++){let a=this.children[t++];a.hiddenMatrix.identity(),a.scale.setScalar(1),a.rotation.set(0,0,0),a.position.x=r.size[0]*n,a.position.y=-r.size[1]*s,a.position.z=-r.size[2]*o}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),Jo(this.parameters,e),this.update(),this}};var Lr=class extends ti(Wt){constructor(e,t){super(e,t);this.isAbstractMesh=!0;Array.isArray(t)&&(this.selectedMaterial=0)}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,t){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),t=t!=null?t:this.selectedMaterial,this.material[t].dispose(),this.material[t]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let t=this.geometry,r=Ty[t.userData.type],n=this.objectType==="NonParametric"?Object.assign({},t.userData,{geometry:t}):t.userData,s=r.build(r.normalizeInputs(e,n)),o=t.uuid;if(this.geometry.dispose(),this.geometry=s,this.geometry.uuid=o,this.geometry.computeBoundingSphere(),this.cloner)for(let a of this.cloner.children)a.geometry=this.geometry}resizeGeometry(e,t,r){gu.resizeGeometry(this.geometry,{width:e,height:t,depth:r})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let t=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,r=Rf(t),n=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(r,n).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new cp(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){let t=super.toJSON(e),r=t.object;if(r.geometry=zA(e.geometries,this.geometry,this.material),Array.isArray(this.material)){let n=[];for(let s=0,o=this.material.length;s<o;s++)n.push(Lu(e.materials,this.material[s],e));r.material=n}else r.material=Lu(e.materials,this.material,e);return t}fromJSON(e){return super.fromJSON(e),e.selectedMaterial!==void 0&&(this.selectedMaterial=e.selectedMaterial),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new cp(this)),this.cloner.fromClonerState(e))}fromState(e,t){var r,n;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(r=e.castShadow)!=null?r:!0,this.receiveShadow=(n=e.receiveShadow)!=null?n:!0),this}};var up=new F,ca=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new F(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=pn.Left}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,n=this.message.length;r<n;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,n;for(n=e;n>=0;n-=1)if(this.message[n].char===" "){r=!1,t.length===0&&(n-=1,t.splice(0,0,this.message[n]));break}else t.splice(0,0,this.message[n]);return r?t=[]:this.message.splice(n+1,t.length),t}getWord(e=0,t=1){let r=[],n=e;for(n=e;;n+=t){if(!this.message[n]||this.message[n].char===" "){r.length===0&&this.message[n]&&(r.push(this.message[n]),this.message.splice(n,1));break}t>0?(r.push(this.message[n]),this.message.splice(n,1),n-=t):(r.splice(0,0,this.message[n]),this.message.splice(n,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,n=e;for(;n>=0&&n<this.message.length;){if(this.message[n].char===" "){r===0&&(r=this.message[n].charSize);break}r+=this.message[n].charSize,n+=t}return(n<0||n>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let n=t;n<=r;n+=1)this.message[n].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,n,s){switch(r){case pn.Left:this.leftAlign(e,s);break;case pn.Center:this.centerAlign(this.spaceLeft(t),e,s);break;case pn.Right:this.rightAlign(this.spaceLeft(t),e,s);break;case pn.Justify:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){up.set(t,r);let n=this.message.length;for(let s=0;s<n;s++)this.message[s].updatePosition(this.message[s].localPosition.add(up),e)}leftAlign(e,t){this.align=pn.Left,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=pn.Center,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=pn.Right,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=pn.Justify,this.endLine){this.offsetCharacters(t,0,r);return}let n=this.countSpaces();if(n===0){this.offsetCharacters(t,0,r);return}let s=e/n,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),up.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(up),t)}clone(){let e=new ca(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var $G=new A(0,0,1),VA=new A,HA=new A,jA=new Dt,ua=class extends Lr{constructor(e=jr.create({}),t=new sn({side:Yt})){super(e,t);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new xr;this._onShapeUpdate=()=>{if(this.geometry instanceof fu){if(this.geometry.updateFromShape()){let e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};var r;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="VectorObject",t}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let t=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:t})}}setShape(e){var t,r;this.shape&&((t=this.shape.eventDispatcher)==null||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),jA.getNormalMatrix(this.matrixWorld),VA.copy($G).applyMatrix3(jA).normalize(),HA.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(VA,HA)}clone(e){let t=this.shape.clone(),r=this.material.clone(),n=this.geometry.userData,s=jr.create(Object.assign({},n,{shape:t})),o=new ua(s,r).copy(this,e);return o.shape=t,t.update(),o}raycast(e,t){Lr.prototype.raycast.call(this,e,t)}};var es=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new In(30,30,30),e};var hp=new Ni,dv=new ln,WA=new Me,ts=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),dv.copy(s.boundingSphere),dv.applyMatrix4(o),t.ray.intersectsSphere(dv)===!1||(WA.copy(o).invert(),hp.copy(t.ray).applyMatrix4(WA),s.boundingBox!==null&&hp.intersectsBox(s.boundingBox)===!1))return;let a,l,c,u,d=s.index,h=s.attributes.position,p=s.drawRange,f,g;if(n===!1){let y=Math.max(0,p.start),m=Math.min(d.count,p.start+p.count);for(f=y,g=m;f<g;f+=3)if(l=d.getX(f),c=d.getX(f+1),u=d.getX(f+2),a=v(i,t,hp,h,l,c,u),a){a.faceIndex=Math.floor(f/3),r.push(a);return}}else{let m=s.attributes.position,x=new A,b=new A,w=new A,T=new A,S=2,E=1/((i.scale.x+i.scale.y+i.scale.z)/3),C=E*E,_=Math.max(0,p.start),O=Math.min(m.count,p.start+p.count);for(let P=_,D=O-1;P<D;P+=S){if(x.fromBufferAttribute(m,P),b.fromBufferAttribute(m,P+1),hp.distanceSqToSegment(x,b,T,w)>C)continue;T.applyMatrix4(i.matrixWorld);let R=t.ray.origin.distanceTo(T);R<t.near||R>t.far||r.push({distance:R,point:w.clone().applyMatrix4(i.matrixWorld),object:i})}}function v(y,m,x,b,w,T,S){let M=new A,E=new A,C=new A,_=new A,O=new A;if(M.fromBufferAttribute(b,w),E.fromBufferAttribute(b,T),C.fromBufferAttribute(b,S),x.intersectTriangle(M,E,C,!1,_)===null)return null;O.copy(_),O.applyMatrix4(y.matrixWorld);let D=m.ray.origin.distanceTo(O);return D<m.near||D>m.far?null:{faceIndex:1,distance:D,point:O.clone(),object:y}}};var dp=new A,ri=new hi,JA=class extends Fi{constructor(e){let t=new _e,r=new un({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new ve(sy),l=new ve(sy),c=new ve(e1);u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",l),u("p","n2",l),u("p","n3",l),u("p","n4",l),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c);function u(h,p,f){d(h,f),d(p,f)}function d(h,p){n.push(0,0,0),s.push(p.r,p.g,p.b),o[h]===void 0&&(o[h]=[]),o[h].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=!0;ri.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let n=1,s=1,o=r?.8:1e-4;Ai("n1",t,e,ri,-n,-s,o),Ai("n2",t,e,ri,n,-s,o),Ai("n3",t,e,ri,-n,s,o),Ai("n4",t,e,ri,n,s,o);let a=o;Ai("f1",t,e,ri,-n,-s,a),Ai("f2",t,e,ri,n,-s,a),Ai("f3",t,e,ri,-n,s,a),Ai("f4",t,e,ri,n,s,a);let l=a,c=.5;Ai("u1",t,e,ri,n*.7*c,s*1.1,l),Ai("u2",t,e,ri,-n*.7*c,s*1.1,l),Ai("u3",t,e,ri,0,s*(1.1+.9*c),l),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Ai(i,e,t,r,n,s,o){dp.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],dp.x,dp.y,dp.z)}}var fv=class extends es(JA){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){ts(this.object,this.geometry,e,t,!0)}};var Nu=class extends es(lg){constructor(e,t=15,r=10066329){super(e,t,r);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,Nu.geometryHelper,e,t)}};var Pu=class extends es(cg){constructor(e,t=15){super(t);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){ts(this.object,Pu.geometryHelper,e,t)}update(){}};var Iu=class extends es(ag){constructor(e,t=15,r=6710886){super(e,t,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,Iu.geometryHelper,e,t)}};var pp=class extends es(sg){constructor(e,t=6710886){super(e,t);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,pp.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=pp._vector,t=this.object.distance?this.object.distance:1e3,r=t*Math.tan(this.object.angle);this.cone.scale.set(r,r,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,o=this.cone.material.length;s<o;s++)this.cone.material[s].color.set(n);else this.cone.material.color.set(n)}}},fp=pp;fp._vector=new A;var rs=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(r){this.visible=r,this.setHelperVisibility(r),this.setHelperChildrenVisibility(r)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(r){this.objectHelper.visible=r}setHelperChildrenVisibility(r){for(let n of this.children)En(n)&&n.traverseEntity(s=>{Ss(s)&&s.visible&&(s.objectHelper.visible=r)})}raycast(r,n){this.objectHelper.raycast(r,n)}copy(r,n=!0){return super.copy(r,n),r.enableHelper!==void 0&&(this.enableHelper=r.enableHelper),r.objectHelper!==void 0&&(this.objectHelper.visible=r.objectHelper.visible),this}toJSON(r){let n=super.toJSON(r),s=n.object;return s.enableHelper=this.enableHelper,n}fromJSON(r){return super.fromJSON(r),r.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(r,n){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;r.color!==void 0&&(s.color=sr(r.color,n)),r.intensity!==void 0&&(s.intensity=r.intensity),r.depth!==void 0&&(s.shadow.camera.far=r.depth,s.shadow.needsUpdate=!0),r.shadows!==void 0&&(this.castShadow=r.shadows),r.helper!==void 0&&(this.enableHelper=r.helper,s.gizmos.shadowmap.visible=r.helper)}return this}};var Kl=new A,pv=new A,ni=class extends rs(ti(hi),fv){constructor(e=window.innerWidth,t=window.innerHeight,r=45,n,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=qo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=t,this.orthoCamera=new Va(e*-.5,e*.5,t*.5,t*-.5,n!=null?n:-5e4,s),this.perspCamera=new dr(r,e/t,n!=null?n:50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(e,t){let r=new ni().fromState(t);return r.enableHelper=!0,r.objectHelper.update(),r.uuid=e,r}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(Kl),this.targetOffset=Kl.distanceTo(e)}getTarget(e=new A){return this.getWorldDirection(pv),this.getWorldPosition(Kl),pv.multiplyScalar(this.targetOffset),e.copy(Kl).add(pv),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Kl),Kl.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new Ft),t=new A(0,0,1).applyQuaternion(e),r=new A().copy(Ze.DefaultUp).applyQuaternion(e),n=new A().copy(Ze.DefaultUp).projectOnPlane(t),s=new A().crossVectors(n,r).dot(t)>=0?1:-1;this.angleOffsetFromUp=n.angleTo(r)*s}getViewFrontToObject(e){let t=e.getWorldPosition(new A),n=e.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:t.clone().add(n),target:t}}getViewToObject(e){let t=e.getWorldPosition(new A),n=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:t.clone().sub(n),target:t}}setViewplaneSize(e,t){this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,n,s,o){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,r,n,s,o):this.orthoCamera.setViewOffset(e,t,r,n,s,o)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let t={near:this.orthoCamera.near,far:this.orthoCamera.far},r={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=r.near,this.perspCamera.far=r.far,this.updateProjectionMatrix(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="CombinedCamera",r.cameraType=this.cameraType,r.targetOffset=this.targetOffset,r.isUpVectorFlipped=this.isUpVectorFlipped,r.angleOffsetFromUp=this.angleOffsetFromUp,r.left=this.left,r.right=this.right,r.top=this.top,r.bottom=this.bottom,this.view!==null&&(r.view=Object.assign({},this.view)),r.zoomOrtho=this.orthoCamera.zoom,r.nearOrtho=this.orthoCamera.near,r.far=this.far,r.aspect=this.aspect,r.fov=this.fov,r.focus=this.focus,r.filmGauge=this.filmGauge,r.filmOffset=this.filmOffset,r.zoomPersp=this.perspCamera.zoom,r.nearPersp=this.perspCamera.near,t}fromJSON(e){var t;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new A),n=new A().fromArray(e.orbitControlsTarget);this.targetOffset=n.distanceTo(r)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(t=e.angleOffsetFromUp)!=null?t:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset};return El(t,e)}fromCameraState(e){let{orthographic:t,perspective:r}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),t!==void 0&&(t.near!==void 0&&(this.orthoCamera.near=t.near),t.zoom!==void 0&&(this.orthoCamera.zoom=t.zoom)),r!==void 0&&(r.near!==void 0&&(this.perspCamera.near=r.near),r.fov!==void 0&&(this.perspCamera.fov=r.fov),r.zoom!==void 0&&(this.perspCamera.zoom=r.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),this.updateProjectionMatrix(),this}toState(e){return xe(re(re({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};var ii=class extends rs(ti(Oi),Pu){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,t){let r=new ii().fromState(t);return r.uuid=e,r.enableHelper=!0,r.objectHelper.update(),r}toJSON(e){let t=super.toJSON(e);return t.object.objectType="EmptyObject",t}};var Du=class extends rs(ti(ed),Nu){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=1,r.far=2500;let n=new mi(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new Du().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightDirectional",r.color=this.color.getHex(),r.intensity=this.intensity,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.left=r.left,t.right=r.right,t.top=r.top,t.bottom=r.bottom,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromDirectionalLightState(e,t){let r=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,t),e.size!==void 0&&j1(this,e.size),r&&this.update(),this}fromState(e,t){return super.fromState(e),this.fromDirectionalLightState(e,t),this}};var Ru=class extends rs(ti($h),Iu){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let n=new A(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new A(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),o=new rr(n,s),a=new cl(o,new ve(16755200));a.visible=!1,this._gizmos.shadowmap=a,this.update()}static createFromState(e,t,r){let n=new Ru().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof cl&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof cl&&(t.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let t=this._gizmos[e];if(t instanceof cl){let r=this.shadow.camera,n=new A(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new A(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z);t.box.set(n,s),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightPoint",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.decay=this.decay,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromPointLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,t){return super.fromState(e),this.fromPointLightState(e,t),this}};var qA=new A,XA=new A,YA=new Ft,Ou=class extends rs(ti(Zh),fp){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=rt.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new mi(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new Ou().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),XA.setFromMatrixPosition(this.matrixWorld),YA.setFromRotationMatrix(this.matrixWorld),qA.copy(this.up).applyQuaternion(YA).negate().multiplyScalar(this.distance),this.target.position.copy(XA).add(qA),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,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}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightSpot",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.angle=this.angle,r.decay=this.decay,r.penumbra=this.penumbra,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromSpotLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,t){return super.fromState(e),this.fromSpotLightState(e,t),this}};var QA=i=>i.tagName==="VIDEO",Zl=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;QA(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];kf(a)&&(Zl.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;QA(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Bu=class extends Lr{constructor(e,t=new sn){super(e,t);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&Zl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,t){super.resizeGeometry(e,t,0),this.material.userData.layers&&Zl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh2D",t}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let t,r;if(e instanceof jh){let o=e.image;t=o.videoWidth*.5,r=o.videoHeight*.5}else{let o=e.image;t=o.width*.5,r=o.height*.5}let n=Pf.create({parameters:{width:t,height:r}}),s=new sn;return s.layersList.changeLayer(0,{type:at.TEXTURE,texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new Bu(n,s)}};var Fu=class extends Lr{constructor(e,t=new $n){super(e,t);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh3D",t}};var Gu=class extends Fu{constructor(e,t=new $n){super(e,t);this.objectType="NonParametric"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="NonParametric",t}};var zu;(function(t){t[t.TO_RIGHT=1]="TO_RIGHT",t[t.TO_LEFT=-1]="TO_LEFT"})(zu||(zu={}));var mv=class extends Lr{constructor(e,t=new sn({transparent:!0,opacity:1,visible:!1,side:Yt})){super(e,t);this.objectType="TextFrame";this.charContainer=new Ze,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:co.None,horizontalAlignment:1,verticalAlignment:ws.Top,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new A(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,t,r){let n=If.create({parameters:{width:t.width,height:t.height}}),s=new mv(n).fromState(t,r);return s.uuid=e,s}async updateText(e){this.clearText();let t=this.userData.textFrame,r=t.fontFamily;await en.loadFont(r),t.text=e;let n=t.textOrigin,s=new Pi({visible:t.visible,transparent:!0,side:Yt}),o=e.split(`
|
|
4142
|
+
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),this.position&&(t.position=this.position.toJSON(e).uuid),this.color&&(t.color=this.color.toJSON(e).uuid),t.roughness=this.roughness.toJSON(e).uuid,t.metalness=this.metalness.toJSON(e).uuid,this.alpha&&(t.alpha=this.alpha.toJSON(e).uuid),this.reflectivity&&(t.reflectivity=this.reflectivity.toJSON(e).uuid),this.shadingAlpha&&(t.shadingAlpha=this.shadingAlpha.toJSON(e).uuid),this.shadingBlend&&(t.shadingBlend=this.shadingBlend.toJSON(e).uuid),this.afterColor&&(t.afterColor=this.afterColor.toJSON(e).uuid)),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.position&&(this.position=t.getNode(e.position)),e.color&&(this.color=t.getNode(e.color)),e.roughness&&(this.roughness=t.getNode(e.roughness)),e.metalness&&(this.metalness=t.getNode(e.metalness)),e.alpha&&(this.alpha=t.getNode(e.alpha)),e.reflectivity&&(this.reflectivity=t.getNode(e.reflectivity)),e.shadingAlpha&&(this.shadingAlpha=t.getNode(e.shadingAlpha)),e.shadingBlend&&(this.shadingBlend=t.getNode(e.shadingBlend)),e.afterColor&&(this.afterColor=t.getNode(e.afterColor)),this}};var Qy=class extends Zn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}constructor(e=new Yy,t){super(e,e,t);this.type="StandardNodeMaterial",this.fragment=e}};var Au=class extends Qy{constructor(e,t,r){super(t,e);this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof mn){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Au(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};function $f(i,e){switch(i.data.type){case"light":return wi(i);case"fresnel":return qF(i,e);case"gradient":return XF(i);case"depth":return YF(i);case"normal":return QF(i);case"noise":return KF(i,e);case"texture":return ZF(i,e);case"rainbow":return $F(i);case"transmission":return eG(i,e);case"matcap":return tG(i,e);case"displace":return rG(i);case"color":default:return JF(i,e)}}function K1(i){return{type:i.data.type}}function wi(i){let{alpha:e,mode:t}=i.data;return xe(re({},K1(i)),{alpha:e,mode:t})}function JF(i,e){return xe(re({},wi(i)),{color:sr(i.data.color,e)})}function qF(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:o}=i.data;return xe(re({},wi(i)),{color:sr(o,e),bias:t,scale:r,intensity:n,factor:s})}function XF(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:o,morph:a}=i.data;return xe(re({},wi(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Qe(l[0],l[1],l[2],l[3])),num:r.length,steps:n,offset:new F(...o),morph:new F(...a),angle:s})}function YF(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:o,direction:a,colors:l,steps:c,smooth:u}=i.data;return xe(re({},wi(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new A(...o),direction:a?new A(...a):new A(1,0,0),num:l.length,colors:l.map(d=>new Qe(d[0],d[1],d[2],d[3])),steps:c,smooth:u})}function QF(i){let{cnormal:e}=i.data;return xe(re({},wi(i)),{cnormal:new A(e[0],e[1],e[2])})}function KF(i,e){let{data:t}=i;return xe(re({},wi(i)),{scale:t.scale,move:t.move,fA:new F(...t.fA),fB:new F(...t.fB),distortion:new F(...t.distortion),colorA:sr(t.colorA,e),colorB:sr(t.colorB,e),colorC:sr(t.colorC,e),colorD:sr(t.colorD,e),noiseType:t.noiseType})}function ZF(i,e){let{projection:t,axis:r,crop:n,size:s}=i.data,{image:o,wrapping:a,repeat:l,offset:c}=i.data.texture,u=new Pt,d;if(typeof o=="string")d=e==null?void 0:e.getImage(o);else{let h=new Image;h.src=o.data,h.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(o.data))},d=h}return u.image=d,u.wrapS=u.wrapT=a,xe(re({},wi(i)),{texture:u,mat:new Dt().setUvTransform(c[0],c[1],l[0],l[1],0,0,0),crop:n,projection:t,axis:["x","y","z"].indexOf(r),size:s})}function $F(i){let{data:e}=i;return xe(re({},wi(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new A(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new A(...e.offset)})}function eG(i,e){let{data:t}=i;return xe(re({},wi(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function tG(i,e){let t=new Pt,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let o=new Image;o.src=r.data,o.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(r.data))},n=o}t.image=n;let s=16777215;return xe(re({},wi(i)),{color:s,texture:t})}function rG(i){let{data:e}=i,t=xe(re({},K1(i)),{intensity:e.intensity});if(e.displacementType==="noise")return xe(re({},t),{offset:new A(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new Pt,n=new Dt().setUvTransform(0,0,1,1,0,0,0);return xe(re({},t),{texture:r,mat:n,crop:e.crop})}}function ep(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}var Yl;(function(e){function i(t){return new ve(t.x,t.y,t.z).getHex()}e.getHex=i})(Yl||(Yl={}));var Z1;(function(e){function i(t){return new Qe(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(Z1||(Z1={}));var $1;(function(t){function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new ve(r.r,r.g,r.b).getHex()}t.getHex=e})($1||($1={}));function yo(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Ky(i,e)}function eA(i,e){return i.map(t=>yo(t,e))}function Ky(i,e){let t=nG(i),r;switch(t.category){case"basic":r=new sn;break;case"lambert":{r=new Su;break}case"toon":{r=new Mu;break}case"physical":r=new Au;break;case"phong":default:{r=new $n;break}}let n=r.userData.layers;iG(n);for(let s=i.layers.length-1;s>=0;s--)sG(n,i.layers[s],e);switch(t.category){case"basic":break;case"lambert":{let a=r,c=sr(t.emissive,e);c instanceof ve?a.emissive.value=c:a.emissive.value.setHex(Yl.getHex(c));break}case"toon":{let a=r,l=t;a.shininess.value=l.shininess;let c=sr(l.specular,e);c instanceof ve?a.specular.value=c:a.specular.value.setHex(Yl.getHex(c));break}case"physical":let s=r,o=t;s.metalness.value=o.metalness,s.roughness.value=o.roughness,s.reflectivity.value=o.reflectivity;break;case"phong":default:{let a=r,l=t;a.shininess.value=l.shininess;let c=sr(l.specular,e);c instanceof ve?a.specular.value=c:a.specular.value.setHex(Yl.getHex(c));break}}return n.blendColors(),n.blendAfterColors(),n.blendPositions(),r}function nG(i){for(let e of i.layers)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:Ar.Normal}}function iG(i){for(let e of i.getLayers())i.removeLayer(e.id)}function sG(i,e,t){let r=$f(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)ep(s,n,e.data)}var aa=new Set;var Si;(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"})(Si||(Si={}));var Ts=class{constructor(){this.easing=4;this.duration=1e3;this.delay=0;this.cubicControls=[.5,.05,.1,.3];this.springParameters={mass:1,stiffness:80,damping:10,velocity:0};this.repeat=!1;this.cycle=!1;this.rewind=!1}static create(e){let t=new Ts,r=e;return t.easing=e.easing,t.duration=e.duration,t.delay=e.delay,r.easing===Qc.CUBIC?t.cubicControls=[...r.control1,...r.control2]:r.easing===Qc.SPRING&&(t.springParameters={mass:r.mass,stiffness:r.stiffness,damping:r.damping,velocity:r.velocity}),t.repeat=e.repeat,t.cycle=e.cycle,t.rewind=e.rewind,t}get sp_mass(){return this.springParameters.mass}set sp_mass(e){this.springParameters.mass=e}get sp_stiffness(){return this.springParameters.stiffness}set sp_stiffness(e){this.springParameters.stiffness=e}get sp_damping(){return this.springParameters.damping}set sp_damping(e){this.springParameters.damping=e}get sp_velocity(){return this.springParameters.velocity}set sp_velocity(e){this.springParameters.velocity=e}copy(e){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters=re({},e.springParameters),this.repeat=e.repeat,this.cycle=e.cycle,this.rewind=e.rewind,this}clone(){return new Ts().copy(this)}toJSON(){let e={easing:this.easing,duration:this.duration,delay:this.delay,cubicControls:this.cubicControls,springParameters:re({},this.springParameters)};return this.repeat===!0&&(e.repeat=!0),this.cycle===!0&&(e.cycle=!0),this.rewind===!0&&(e.rewind=!0),this.object!==void 0&&(e.object=this.object.uuid),this.state!==void 0&&(e.state=this.state.uuid),e}fromJSON(e,t,r){return this.easing=e.easing,this.duration=e.duration,this.delay=e.delay,this.cubicControls=[...e.cubicControls],this.springParameters.mass=e.springParameters.mass,this.springParameters.stiffness=e.springParameters.stiffness,this.springParameters.damping=e.springParameters.damping,this.springParameters.velocity=e.springParameters.velocity,e.repeat!==void 0&&(this.repeat=e.repeat),e.cycle!==void 0&&(this.cycle=e.cycle),e.rewind!==void 0&&(this.rewind=e.rewind),e.object!==void 0&&(this.object=t[e.object]),e.state!==void 0&&(this.state=r[e.state]),this}};function oG(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Je;(function(h){h[h.MOUSE_DOWN=0]="MOUSE_DOWN",h[h.MOUSE_UP=1]="MOUSE_UP",h[h.MOUSE_HOVER=2]="MOUSE_HOVER",h[h.MOUSE_ENTER=3]="MOUSE_ENTER",h[h.MOUSE_LEAVE=4]="MOUSE_LEAVE",h[h.KEY_DOWN=5]="KEY_DOWN",h[h.KEY_UP=6]="KEY_UP",h[h.START=7]="START",h[h.OPEN_LINK=8]="OPEN_LINK",h[h.LOOK_AT=9]="LOOK_AT",h[h.FOLLOW=10]="FOLLOW",h[h.SCROLL=11]="SCROLL"})(Je||(Je={}));var vo=class{constructor(e,t){this.targets=[];this._type=e,this.key=t}get type(){return this._type}set type(e){this._type=e,e===9?this.distance=1e3:this.distance=void 0,e!==5&&e!==6&&(this.key=void 0)}newTarget(e){let t=new Ts;if(t.object=e,e!==void 0){let r=e.interaction.states;r.length>0&&(t.state=r[r.length-1])}return this.targets.push(t),aa.add(t),t}addTarget(e,t=0){this.targets.splice(t,0,e),aa.add(e)}removeTarget(e){aa.delete(this.targets[e]),this.targets.splice(e,1)}dispatchReverse(){for(let e=0,t=this.targets.length;e<t;++e){let r=this.targets[e];r.state!==void 0&&r.object!==void 0&&r.object.interaction.reverse(r)}}dispatch(e){this.url!==void 0&&(this._type===8||this._type===0||this._type===1||this._type===5||this._type===6)&&(oG()?window.location.assign(this.url):window.open(this.url,"_blank"));for(let t=0,r=this.targets.length;t<r;++t){let n=this.targets[t];n.state!==void 0&&n.object!==void 0&&(this._type===11?n.object.interaction.seek(n,e,this.steps):n.object.interaction.play(n))}}copy(e){return this._type=e.type,this.key=e.key,this.url=e.url,this.distance=e.distance,this}clone(){return new vo().copy(this)}toJSON(){let e={type:this._type,key:this.key,ui:{isCollapsed:!1}};if(this.url!==void 0&&(e.url=this.url),this.distance!==void 0&&(e.distance=this.distance),this.targets.length>0){e.targets=[];for(let t=0,r=this.targets.length;t<r;++t)e.targets.push(this.targets[t].toJSON())}return e}fromJSON(e,t,r){if(this._type=e.type,this.key=e.key,this.targets=[],this.url=e.url,e.distance!==void 0&&(this.distance=e.distance),e.targets!==void 0)for(let n=0,s=e.targets.length;n<s;++n)this.addTarget(new Ts().fromJSON(e.targets[n],t,r),n);return this}};var Qi=class{constructor(){this.uuid=rt.generateUUID();this.name="";this.position=new A;this.rotation=new jn;this.scale=new A;this.hiddenMatrix=new Me}static create(e,t,r){let n=new Qi;if(n.uuid=e,n.position.fromArray(t.position),n.scale.fromArray(t.scale),n.rotation.fromArray(t.rotation),n.hiddenMatrix.fromArray(t.hiddenMatrix),"geometry"in t&&(n.geometry=t.geometry),"material"in t&&(n.material={layersList:yo(t.material,r).layersList.getLayers()}),"materials"in t&&(n.material=t.materials.map(s=>({layersList:yo(s,r).layersList.getLayers()}))),"perspective"in t&&(n.camera={zoomOrtho:t.orthographic.zoom,zoomPersp:t.perspective.zoom,targetOffset:t.targetOffset}),Il.is(t.type)){let s=t;n.light={intensity:s.intensity,color:sr(s.color,r)}}return n}update(e){this.updateMatrix(e),"geometry"in e&&this.updateGeometry(e),"material"in e&&this.updateMaterial(e),e.objectType==="CombinedCamera"?this.updateCamera(e):(e.objectType==="LightDirectional"||e.objectType==="LightPoint"||e.objectType==="LightSpot")&&this.updateLight(e)}updateCamera(e){this.camera={zoomPersp:e.perspCamera.zoom,zoomOrtho:e.orthoCamera.zoom,targetOffset:e.targetOffset}}updateLight(e){let t=e.color;this.light={intensity:e.intensity,color:{r:t.r,g:t.g,b:t.b}}}updateMatrix(e){this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),"hiddenMatrix"in e&&this.hiddenMatrix.copy(e.hiddenMatrix)}updateGeometry(e){if("geometry"in e){let{width:t,height:r,depth:n}=e.geometry.userData.parameters;this.geometry={width:t,height:r,depth:n}}}updateMaterial(e){if("material"in e)if(e.material instanceof Array){this.material=[];for(let t=0,r=e.material.length;t<r;++t){let n=e.material[t],s=[],o=n.layersList.head;for(;o;)s.push(o.clone()),o=o.next;this.material.push({layersList:s})}}else{let t=e.material,r=[],n=t.layersList.head;for(;n;)r.push(n.clone()),n=n.next;this.material={layersList:r}}}execute(e){if(e.position.copy(this.position),e.rotation.copy(this.rotation),e.scale.copy(this.scale),"hiddenMatrix"in e&&e.hiddenMatrix.copy(this.hiddenMatrix),"geometry"in e&&this.geometry!==void 0){let r=e.geometry.userData.parameters,n=this.geometry;(n.width!==r.width||n.height!==r.height||n.depth!==r.depth)&&e.updateGeometry({parameters:{width:n.width,height:n.height,depth:n.depth}})}if("material"in e){let t=e.material;if(t instanceof Array){let r=this.material;for(let n=0,s=r.length;n<s;++n){let o=t[n].layersList.head,a=r[n].layersList,l=0;for(;o;)o.copy(a[l++]),o=o.next;t[n].dispose()}}else{if(t.userData.isAsset)return;let r=0,n=t.layersList.head,o=this.material.layersList;for(;n;)n.copyUniforms(o[r++]),n=n.next;t.dispose()}}if(this.camera&&e.objectType==="CombinedCamera"&&(e=e,e.zoom=e.cameraType==="OrthographicCamera"?this.camera.zoomOrtho:this.camera.zoomPersp,e.targetOffset=this.camera.targetOffset,e.updateProjectionMatrix()),this.light&&(e.objectType==="LightDirectional"||e.objectType==="LightPoint"||e.objectType==="LightSpot")){e=e,e.intensity=this.light.intensity;let t=this.light.color;e.color.setRGB(t.r,t.g,t.b)}}copy(e){if(this.name=e.name,this.position.copy(e.position),this.rotation.copy(e.rotation),this.scale.copy(e.scale),this.hiddenMatrix.copy(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let t=0,r=e.material.length;t<r;++t)this.material.push({layersList:e.material[t].layersList.map(n=>n.clone())})}else this.material={layersList:e.material.layersList.map(t=>t.clone())};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:e.camera.targetOffset}),e.light!==void 0&&(this.light={intensity:e.light.intensity,color:Ur.clone(e.light.color)}),this}clone(){return new Qi().copy(this)}toJSON(e){let t={uuid:this.uuid,name:this.name,position:this.position.toArray(),rotation:this.rotation.toArray(),scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};if(this.geometry!==void 0&&(t.geometry={width:this.geometry.width,height:this.geometry.height,depth:this.geometry.depth}),this.material!==void 0)if(this.material instanceof Array){t.material=[];for(let r=0,n=this.material.length;r<n;++r)t.material.push({layersList:this.material[r].layersList.map(s=>s.toJSON(e))})}else t.material={layersList:this.material.layersList.map(r=>r.toJSON(e))};return this.camera!==void 0&&(t.camera={zoomPersp:this.camera.zoomPersp,zoomOrtho:this.camera.zoomOrtho,targetOffset:this.camera.targetOffset}),t}fromJSON(e,t){var r;if(this.uuid=e.uuid,this.name=e.name,this.position.fromArray(e.position),this.rotation.fromArray(e.rotation),this.scale.fromArray(e.scale),this.hiddenMatrix.fromArray(e.hiddenMatrix),e.geometry!==void 0&&(this.geometry={width:e.geometry.width,height:e.geometry.height,depth:e.geometry.depth}),e.material!==void 0)if(e.material instanceof Array){this.material=[];for(let n=0,s=e.material.length;n<s;++n)this.material.push({layersList:e.material[n].layersList.map(o=>Iy(o,t))})}else this.material={layersList:e.material.layersList.map(n=>Iy(n,t))};return e.camera!==void 0&&(this.camera={zoomPersp:e.camera.zoomPersp,zoomOrtho:e.camera.zoomOrtho,targetOffset:(r=e.camera.targetOffset)!=null?r:-1}),this}};"use strict";var tA={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Zy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},aG=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],tp={CSS:{},springs:{}};function Ki(i,e,t){return Math.min(Math.max(i,e),t)}function Tu(i,e){return i.indexOf(e)>-1}function $y(i,e){return i.apply(null,e)}var qe={arr:function(i){return Array.isArray(i)},obj:function(i){return Tu(Object.prototype.toString.call(i),"Object")},pth:function(i){return qe.obj(i)&&i.hasOwnProperty("totalLength")},svg:function(i){return i instanceof SVGElement},inp:function(i){return i instanceof HTMLInputElement},dom:function(i){return!("isNode"in i)&&(i.nodeType||qe.svg(i))},str:function(i){return typeof i=="string"},fnc:function(i){return typeof i=="function"},und:function(i){return typeof i=="undefined"},hex:function(i){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(i)},rgb:function(i){return/^rgb/.test(i)},hsl:function(i){return/^hsl/.test(i)},col:function(i){return qe.hex(i)||qe.rgb(i)||qe.hsl(i)},key:function(i){return!tA.hasOwnProperty(i)&&!Zy.hasOwnProperty(i)&&i!=="targets"&&i!=="keyframes"}};function rA(i){var e=/\(([^)]+)\)/.exec(i);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function nA(i,e){var t=rA(i),r=Ki(qe.und(t[0])?1:t[0],.1,100),n=Ki(qe.und(t[1])?100:t[1],.1,100),s=Ki(qe.und(t[2])?10:t[2],.1,100),o=Ki(qe.und(t[3])?0:t[3],.1,100),a=Math.sqrt(n/r),l=s/(2*Math.sqrt(n*r)),c=l<1?a*Math.sqrt(1-l*l):0,u=1,d=l<1?(l*a+-o)/c:-o+a;function h(f){var g=e?e*f/1e3:f;return l<1?g=Math.exp(-g*l*a)*(u*Math.cos(c*g)+d*Math.sin(c*g)):g=(u+d*g)*Math.exp(-g*a),f===0||f===1?f:1-g}function p(){var f=tp.springs[i];if(f)return f;for(var g=1/6,v=0,y=0;;)if(v+=g,h(v)===1){if(y++,y>=16)break}else y=0;var m=v*g*1e3;return tp.springs[i]=m,m}return e?h:p}function lG(i){return i===void 0&&(i=10),function(e){return Math.ceil(Ki(e,1e-6,1)*i)*(1/i)}}var cG=function(){var i=11,e=1/(i-1);function t(u,d){return 1-3*d+3*u}function r(u,d){return 3*d-6*u}function n(u){return 3*u}function s(u,d,h){return((t(d,h)*u+r(d,h))*u+n(d))*u}function o(u,d,h){return 3*t(d,h)*u*u+2*r(d,h)*u+n(d)}function a(u,d,h,p,f){var g,v,y=0;do v=d+(h-d)/2,g=s(v,p,f)-u,g>0?h=v:d=v;while(Math.abs(g)>1e-7&&++y<10);return v}function l(u,d,h,p){for(var f=0;f<4;++f){var g=o(d,h,p);if(g===0)return d;var v=s(d,h,p)-u;d-=v/g}return d}function c(u,d,h,p){if(!(0<=u&&u<=1&&0<=h&&h<=1))return;var f=new Float32Array(i);if(u!==d||h!==p)for(var g=0;g<i;++g)f[g]=s(g*e,u,h);function v(y){for(var m=0,x=1,b=i-1;x!==b&&f[x]<=y;++x)m+=e;--x;var w=(y-f[x])/(f[x+1]-f[x]),T=m+w*e,S=o(T,u,h);return S>=.001?l(y,T,u,h):S===0?T:a(y,m,m+e,u,h)}return function(y){return u===d&&h===p||y===0||y===1?y:s(v(y),d,p)}}return c}(),iA=function(){var i={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var n,s=4;r<((n=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((n*3-2)/22-r,2)}},Elastic:function(r,n){r===void 0&&(r=1),n===void 0&&(n=.5);var s=Ki(r,1,10),o=Ki(n,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,n){e[r]=function(){return function(s){return Math.pow(s,n+2)}}}),Object.keys(e).forEach(function(r){var n=e[r];i["easeIn"+r]=n,i["easeOut"+r]=function(s,o){return function(a){return 1-n(s,o)(1-a)}},i["easeInOut"+r]=function(s,o){return function(a){return a<.5?n(s,o)(a*2)/2:1-n(s,o)(a*-2+2)/2}}}),i}();function ev(i,e){if(qe.fnc(i))return i;var t=i.split("(")[0],r=iA[t],n=rA(i);switch(t){case"spring":return nA(i,e);case"cubicBezier":return $y(cG,n);case"steps":return $y(lG,n);default:return $y(r,n)}}function sA(i){try{var e=document.querySelectorAll(i);return e}catch(t){return}}function rp(i,e){for(var t=i.length,r=arguments.length>=2?arguments[1]:void 0,n=[],s=0;s<t;s++)if(s in i){var o=i[s];e.call(r,o,s,i)&&n.push(o)}return n}function np(i){return i.reduce(function(e,t){return e.concat(qe.arr(t)?np(t):t)},[])}function oA(i){return qe.arr(i)?i:(qe.str(i)&&(i=sA(i)||i),i instanceof NodeList||i instanceof HTMLCollection?[].slice.call(i):[i])}function tv(i,e){return i.some(function(t){return t===e})}function rv(i){var e={};for(var t in i)e[t]=i[t];return e}function nv(i,e){var t=rv(i);for(var r in i)t[r]=e.hasOwnProperty(r)?e[r]:i[r];return t}function ip(i,e){var t=rv(i);for(var r in e)t[r]=qe.und(i[r])?e[r]:i[r];return t}function uG(i){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(i);return e?"rgba("+e[1]+",1)":i}function hG(i){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=i.replace(e,function(a,l,c,u){return l+l+c+c+u+u}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),n=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+n+","+s+","+o+",1)"}function dG(i){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(i)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(i),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,n=parseInt(e[3],10)/100,s=e[4]||1;function o(h,p,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?h+(p-h)*6*f:f<1/2?p:f<2/3?h+(p-h)*(2/3-f)*6:h}var a,l,c;if(r==0)a=l=c=n;else{var u=n<.5?n*(1+r):n+r-n*r,d=2*n-u;a=o(d,u,t+1/3),l=o(d,u,t),c=o(d,u,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function fG(i){if(qe.rgb(i))return uG(i);if(qe.hex(i))return hG(i);if(qe.hsl(i))return dG(i)}function _s(i){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(i);if(e)return e[1]}function pG(i){if(Tu(i,"translate")||i==="perspective")return"px";if(Tu(i,"rotate")||Tu(i,"skew"))return"deg"}function iv(i,e){return qe.fnc(i)?i(e.target,e.id,e.total):i}function Zi(i,e){return i.getAttribute(e)}function sv(i,e,t){var r=_s(e);if(tv([t,"deg","rad","turn"],r))return e;var n=tp.CSS[e+t];if(!qe.und(n))return n;var s=100,o=document.createElement(i.tagName),a=i.parentNode&&i.parentNode!==document?i.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return tp.CSS[e+t]=c,c}function aA(i,e,t){if(e in i.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),n=i.style[e]||getComputedStyle(i).getPropertyValue(r)||"0";return t?sv(i,n,t):n}}function ov(i,e){if(qe.dom(i)&&!qe.inp(i)&&(Zi(i,e)||qe.svg(i)&&i[e]))return"attribute";if(qe.dom(i)&&tv(aG,e))return"transform";if(qe.dom(i)&&e!=="transform"&&aA(i,e))return"css";if(i[e]!=null)return"object"}function lA(i){if(!!qe.dom(i)){for(var e=i.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,n;n=t.exec(e);)r.set(n[1],n[2]);return r}}function mG(i,e,t,r){var n=Tu(e,"scale")?1:0+pG(e),s=lA(i).get(e)||n;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?sv(i,s,r):s}function av(i,e,t,r){switch(ov(i,e)){case"transform":return mG(i,e,r,t);case"css":return aA(i,e,t);case"attribute":return Zi(i,e);default:return i[e]||0}}function lv(i,e){var t=/^(\*=|\+=|-=)/.exec(i);if(!t)return i;var r=_s(i)||0,n=parseFloat(e),s=parseFloat(i.replace(t[0],""));switch(t[0][0]){case"+":return n+s+r;case"-":return n-s+r;case"*":return n*s+r}}function cA(i,e){if(qe.col(i))return fG(i);if(/\s/g.test(i))return i;var t=_s(i),r=t?i.substr(0,i.length-t.length):i;return e?r+e:r}function cv(i,e){return Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2))}function gG(i){return Math.PI*2*Zi(i,"r")}function yG(i){return Zi(i,"width")*2+Zi(i,"height")*2}function vG(i){return cv({x:Zi(i,"x1"),y:Zi(i,"y1")},{x:Zi(i,"x2"),y:Zi(i,"y2")})}function uA(i){for(var e=i.points,t=0,r,n=0;n<e.numberOfItems;n++){var s=e.getItem(n);n>0&&(t+=cv(r,s)),r=s}return t}function xG(i){var e=i.points;return uA(i)+cv(e.getItem(e.numberOfItems-1),e.getItem(0))}function hA(i){if(i.getTotalLength)return i.getTotalLength();switch(i.tagName.toLowerCase()){case"circle":return gG(i);case"rect":return yG(i);case"line":return vG(i);case"polyline":return uA(i);case"polygon":return xG(i)}}function bG(i){var e=hA(i);return i.setAttribute("stroke-dasharray",e),e}function wG(i){for(var e=i.parentNode;qe.svg(e)&&qe.svg(e.parentNode);)e=e.parentNode;return e}function dA(i,e){var t=e||{},r=t.el||wG(i),n=r.getBoundingClientRect(),s=Zi(r,"viewBox"),o=n.width,a=n.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function SG(i,e){var t=qe.str(i)?sA(i)[0]:i,r=e||100;return function(n){return{property:n,el:t,svg:dA(t),totalLength:hA(t)*(r/100)}}}function MG(i,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return i.el.getPointAtLength(l)}var r=dA(i.el,i.svg),n=t(),s=t(-1),o=t(1);switch(i.property){case"x":return(n.x-r.x)*r.w;case"y":return(n.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function fA(i,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=cA(qe.pth(i)?i.totalLength:i,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:qe.str(i)||e?r.split(t):[]}}function pA(i){var e=i?np(qe.arr(i)?i.map(oA):oA(i)):[];return rp(e,function(t,r,n){return n.indexOf(t)===r})}function mA(i){var e=pA(i);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:lA(t)}}})}function AG(i,e){var t=rv(e);if(/^spring/.test(t.easing)&&(t.duration=nA(t.easing)),qe.arr(i)){var r=i.length,n=r===2&&!qe.obj(i[0]);n?i={value:i}:qe.fnc(e.duration)||(t.duration=e.duration/r)}var s=qe.arr(i)?i:[i];return s.map(function(o,a){var l=qe.obj(o)&&!qe.pth(o)?o:{value:o};return qe.und(l.delay)&&(l.delay=a?0:e.delay),qe.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return ip(o,t)})}function TG(i){for(var e=rp(np(i.map(function(s){return Object.keys(s)})),function(s){return qe.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=i.map(function(a){var l={};for(var c in a)qe.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},n=0;n<e.length;n++)r(n);return t}function _G(i,e){var t=[],r=e.keyframes;r&&(e=ip(TG(r),e));for(var n in e)qe.key(n)&&t.push({name:n,tweens:AG(e[n],i)});return t}function EG(i,e){var t={};for(var r in i){var n=iv(i[r],e);qe.arr(n)&&(n=n.map(function(s){return iv(s,e)}),n.length===1&&(n=n[0])),t[r]=n}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function CG(i,e){var t;return i.tweens.map(function(r){var n=EG(r,e),s=n.value,o=qe.arr(s)?s[1]:s,a=_s(o),l=av(e.target,i.name,a,e),c=t?t.to.original:l,u=qe.arr(s)?s[0]:c,d=_s(u)||_s(l),h=a||d;return qe.und(o)&&(o=c),n.from=fA(u,h),n.to=fA(lv(o,u),h),n.start=t?t.end:0,n.end=n.start+n.delay+n.duration+n.endDelay,n.easing=ev(n.easing,n.duration),n.isPath=qe.pth(s),n.isColor=qe.col(n.from.original),n.isColor&&(n.round=1),t=n,n})}var gA={css:function(i,e,t){return i.style[e]=t},attribute:function(i,e,t){return i.setAttribute(e,t)},object:function(i,e,t){return i[e]=t},transform:function(i,e,t,r,n){if(r.list.set(e,t),e===r.last||n){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),i.style.transform=s}}};function yA(i,e){var t=mA(i);t.forEach(function(r){for(var n in e){var s=iv(e[n],r),o=r.target,a=_s(s),l=av(o,n,a,r),c=a||_s(l),u=lv(cA(s,c),l),d=ov(o,n);gA[d](o,n,u,r.transforms,!0)}})}function LG(i,e){var t=ov(i.target,e.name);if(t){var r=CG(e,i),n=r[r.length-1];return{type:t,property:e.name,animatable:i,tweens:r,duration:n.end,delay:r[0].delay,endDelay:n.endDelay}}}function NG(i,e){return rp(np(i.map(function(t){return e.map(function(r){return LG(t,r)})})),function(t){return!qe.und(t)})}function vA(i,e){var t=i.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},n={};return n.duration=t?Math.max.apply(Math,i.map(function(s){return r(s)+s.duration})):e.duration,n.delay=t?Math.min.apply(Math,i.map(function(s){return r(s)+s.delay})):e.delay,n.endDelay=t?n.duration-Math.max.apply(Math,i.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,n}var xA=0;function PG(i){var e=nv(tA,i),t=nv(Zy,i),r=_G(t,i),n=mA(i.targets),s=NG(n,r),o=vA(s,t),a=xA;return xA++,ip(e,{id:a,children:[],animatables:n,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var _n=[],bA=[],sp,IG=function(){function i(){sp=requestAnimationFrame(e)}function e(t){var r=_n.length;if(r){for(var n=0;n<r;){var s=_n[n];if(!s.paused)s.tick(t);else{var o=_n.indexOf(s);o>-1&&(_n.splice(o,1),r=_n.length)}n++}i()}else sp=cancelAnimationFrame(sp)}return i}();function DG(){document.hidden?(_n.forEach(function(i){return i.pause()}),bA=_n.slice(0),Sr.running=_n=[]):bA.forEach(function(i){return i.play()})}typeof document!="undefined"&&document.addEventListener("visibilitychange",DG);function Sr(i){i===void 0&&(i={});var e=0,t=0,r=0,n,s=0,o=null;function a(x){var b=window.Promise&&new Promise(function(w){return o=w});return x.finished=b,b}var l=PG(i),c=a(l);function u(){var x=l.direction;x!=="alternate"&&(l.direction=x!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,n.forEach(function(b){return b.reversed=l.reversed})}function d(x){return l.reversed?l.duration-x:x}function h(){e=0,t=d(l.currentTime)*(1/Sr.speed)}function p(x,b){b&&b.seek(x-b.timelineOffset)}function f(x){if(l.reversePlayback)for(var w=s;w--;)p(x,n[w]);else for(var b=0;b<s;b++)p(x,n[b])}function g(x){var b=0,w=l.animations,T=w.length;for(l.reversePlayback===!0&&l.rewind===!1&&(x=l.duration-x);b<T;){var S=w[b],M=S.animatable,E=S.tweens,C=E.length-1,_=E[C];C&&(_=rp(E,function(ce){return x<ce.end})[0]||_);for(var O=Ki(x-_.start-_.delay,0,_.duration)/_.duration,P=isNaN(O)?1:_.easing(O),D=_.to.strings,G=_.round,R=[],U=_.to.numbers.length,te=void 0,he=0;he<U;he++){var H=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var z=_.to.numbers[he],B=_.from.numbers[he]||0;else var B=_.to.numbers[he],z=_.from.numbers[he]||0;_.isPath?H=MG(_.value,P*B):H=z+P*(B-z),G&&(_.isColor&&he>2||(H=Math.round(H*G)/G)),R.push(H)}var Y=D.length;if(!Y)te=R[0];else{te=D[0];for(var q=0;q<Y;q++){var ee=D[q],k=D[q+1],pe=R[q];isNaN(pe)||(k?te+=pe+k:te+=pe+" ")}}gA[S.type](M.target,S.property,te,M.transforms),S.currentValue=te,b++}}function v(x){l[x]&&!l.passThrough&&l[x](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function m(x){var b=l.duration,w=l.delay,T=b-l.endDelay,S=d(x);l.progress=Ki(S/b*100,0,100),l.reversePlayback=S<l.currentTime,n&&f(S),!l.began&&l.currentTime>=0&&(l.began=!0,v("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,v("loopBegin")),S<=w&&l.currentTime!==0&&g(0),(S>=T&&l.currentTime!==b||!b)&&g(b),S>w&&S<T?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,v("changeBegin")),v("change"),g(S)):l.changeBegan&&(l.changeCompleted=!0,l.changeBegan=!1,v("changeComplete")),l.currentTime=Ki(S,0,b),l.began&&v("update"),x>=b&&(t=0,y(),l.remaining?(e=r,v("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&u()):(l.paused=!0,l.completed||(l.completed=!0,v("loopComplete"),v("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var x=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=x==="reverse",l.remaining=l.loop,n=l.children,s=n.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||x==="alternate"&&l.loop===1)&&l.remaining++,g(l.reversed?l.duration:0)},l.set=function(x,b){return yA(x,b),l},l.tick=function(x){r=x,e||(e=r),m((r+(t-e))*Sr.speed)},l.seek=function(x){m(d(x))},l.pause=function(){l.paused=!0,h()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,_n.push(l),h(),sp||IG())},l.reverse=function(){u(),l.completed=!l.reversed,h()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function wA(i,e){for(var t=e.length;t--;)tv(i,e[t].animatable.target)&&e.splice(t,1)}function RG(i){for(var e=pA(i),t=_n.length;t--;){var r=_n[t],n=r.animations,s=r.children;wA(e,n);for(var o=s.length;o--;){var a=s[o],l=a.animations;wA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!n.length&&!s.length&&r.pause()}}function OG(i,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?ev(e.easing):null,n=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",u=qe.arr(i),d=parseFloat(u?i[0]:i),h=u?parseFloat(i[1]):0,p=_s(u?i[1]:i)||0,f=e.start||0+(u?d:0),g=[],v=0;return function(y,m,x){if(a&&(o=0),l&&(o=(x-1)/2),c&&(o=x-1),!g.length){for(var b=0;b<x;b++){if(!n)g.push(Math.abs(o-b));else{var w=l?(n[0]-1)/2:o%n[0],T=l?(n[1]-1)/2:Math.floor(o/n[0]),S=b%n[0],M=Math.floor(b/n[0]),E=w-S,C=T-M,_=Math.sqrt(E*E+C*C);s==="x"&&(_=-E),s==="y"&&(_=-C),g.push(_)}v=Math.max.apply(Math,g)}r&&(g=g.map(function(P){return r(P/v)*v})),t==="reverse"&&(g=g.map(function(P){return s?P<0?P*-1:-P:Math.abs(v-P)}))}var O=u?(h-d)/v:d;return f+O*(Math.round(g[m]*100)/100)+p}}function BG(i){i===void 0&&(i={});var e=Sr(i);return e.duration=0,e.add=function(t,r){var n=_n.indexOf(e),s=e.children;n>-1&&_n.splice(n,1);function o(h){h.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=ip(t,nv(Zy,i));l.targets=l.targets||i.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=qe.und(r)?c:lv(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var u=Sr(l);o(u),s.push(u);var d=vA(s,i);return e.delay=d.delay,e.endDelay=d.endDelay,e.duration=d.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}Sr.version="3.2.0";Sr.speed=1;Sr.running=_n;Sr.remove=RG;Sr.get=av;Sr.set=yA;Sr.convertPx=sv;Sr.path=SG;Sr.setDashoffset=bG;Sr.stagger=OG;Sr.timeline=BG;Sr.easing=ev;Sr.penner=iA;Sr.random=function(i,e){return Math.floor(Math.random()*(e-i+1))+i};var _u=Sr;function SA(i){var o;let e=[],t=i.groups,r=i.getAttribute("position").array,n=i.getAttribute("normal").array,s=(o=i.getAttribute("uv"))==null?void 0:o.array;return t.forEach(a=>{let l=a.count,c=new _e,u=new Float32Array(l*3),d=new Float32Array(l*3),h=new Float32Array(l*2);for(let p=0;p<l;p++){let f=3*(a.start+p),g=3*p;if(u[g]=r[f],u[g+1]=r[f+1],u[g+2]=r[f+2],d[g]=n[f],d[g+1]=n[f+1],d[g+2]=n[f+2],s){let v=2*(a.start+p),y=2*p;h[y]=s[v],h[y+1]=s[v+1]}}c.setAttribute("position",new Ae(u,3)),c.setAttribute("normal",new Ae(d,3)),s&&c.setAttribute("uv",new Ae(h,2)),e.push(c)}),e}var Eu=class{constructor(){this.pluginCallbacks=[],this.register(function(e){return new LA(e)}),this.register(function(e){return new NA(e)}),this.register(function(e){return new PA(e)}),this.register(function(e){return new IA(e)}),this.register(function(e){return new DA(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r){let n=new CA,s=[];for(let o=0,a=this.pluginCallbacks.length;o<a;o++)s.push(this.pluginCallbacks[o](n));n.setPlugins(s),n.write(e,t,r)}},Bt={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123,FLOAT:5126,UNSIGNED_INT:5125,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},kn={};kn[tr]=Bt.NEAREST;kn[ih]=Bt.NEAREST_MIPMAP_NEAREST;kn[sh]=Bt.NEAREST_MIPMAP_LINEAR;kn[tt]=Bt.LINEAR;kn[Dp]=Bt.LINEAR_MIPMAP_NEAREST;kn[Li]=Bt.LINEAR_MIPMAP_LINEAR;kn[ar]=Bt.CLAMP_TO_EDGE;kn[Os]=Bt.REPEAT;kn[cc]=Bt.MIRRORED_REPEAT;var MA={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},AA=12,FG=1179937895,GG=2,TA=8,zG=1313821514,UG=5130562;function Cu(i,e){return i.length===e.length&&i.every(function(t,r){return t===e[r]})}function kG(i){if(window.TextEncoder!==void 0)return new TextEncoder().encode(i).buffer;let e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0,r=i.length;t<r;t++){let n=i.charCodeAt(t);e[t]=n>255?32:n}return e.buffer}function VG(i){return Cu(i.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function HG(i,e,t){let r={min:new Array(i.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(i.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let n=e;n<e+t;n++)for(let s=0;s<i.itemSize;s++){let o;i.itemSize>4?o=i.array[n*i.itemSize+s]:s===0?o=i.getX(n):s===1?o=i.getY(n):s===2?o=i.getZ(n):s===3&&(o=i.getW(n)),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function _A(i){return Math.ceil(i/4)*4}function uv(i,e=0){let t=_A(i.byteLength);if(t!==i.byteLength){let r=new Uint8Array(t);if(r.set(new Uint8Array(i)),e!==0)for(let n=i.byteLength;n<t;n++)r[n]=e;return r.buffer}return i}var EA=null,CA=class{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}write(e,t,r){this.options=Object.assign({},{binary:!1,trs:!1,onlyVisible:!0,truncateDrawRange:!0,embedImages:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e);let n=this;Promise.all(this.pending).then(function(){let s=n.buffers,o=n.json,a=n.options,l=n.extensionsUsed,c=new Blob(s,{type:"application/octet-stream"}),u=Object.keys(l);if(u.length>0&&(o.extensionsUsed=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),a.binary===!0){let d=new window.FileReader;d.readAsArrayBuffer(c),d.onloadend=function(){let h=uv(d.result),p=new DataView(new ArrayBuffer(TA));p.setUint32(0,h.byteLength,!0),p.setUint32(4,UG,!0);let f=uv(kG(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(TA));g.setUint32(0,f.byteLength,!0),g.setUint32(4,zG,!0);let v=new ArrayBuffer(AA),y=new DataView(v);y.setUint32(0,FG,!0),y.setUint32(4,GG,!0);let m=AA+g.byteLength+f.byteLength+p.byteLength+h.byteLength;y.setUint32(8,m,!0);let x=new Blob([v,g,f,p,h],{type:"application/octet-stream"}),b=new window.FileReader;b.readAsArrayBuffer(x),b.onloadend=function(){t(b.result)}}}else if(o.buffers&&o.buffers.length>0){let d=new window.FileReader;d.readAsDataURL(c),d.onloadend=function(){let h=d.result;o.buffers[0].uri=h,t(o)}}else t(o)})}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;let r=this.options,n=this.extensionsUsed;try{let s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(let o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],n[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e){return this.uids.has(e)||this.uids.set(e,this.uid++),this.uids.get(e)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let r=new A;for(let n=0,s=e.count;n<s;n++)if(Math.abs(r.fromBufferAttribute(e,n).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let r=e.clone(),n=new A;for(let s=0,o=r.count;s<o;s++)n.fromBufferAttribute(r,s),n.x===0&&n.y===0&&n.z===0?n.setX(1):n.normalize(),r.setXYZ(s,n.x,n.y,n.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1,n={};(t.offset.x!==0||t.offset.y!==0)&&(n.offset=t.offset.toArray(),r=!0),t.rotation!==0&&(n.rotation=t.rotation,r=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(n.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}processBuffer(e){let t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,n,s){let o=this.json;o.bufferViews||(o.bufferViews=[]);let a;t===Bt.UNSIGNED_BYTE?a=1:t===Bt.UNSIGNED_SHORT?a=2:a=4;let l=_A(n*e.itemSize*a),c=new DataView(new ArrayBuffer(l)),u=0;for(let p=r;p<r+n;p++)for(let f=0;f<e.itemSize;f++){let g;e.itemSize>4?g=e.array[p*e.itemSize+f]:f===0?g=e.getX(p):f===1?g=e.getY(p):f===2?g=e.getZ(p):f===3&&(g=e.getW(p)),t===Bt.FLOAT?c.setFloat32(u,g,!0):t===Bt.UNSIGNED_INT?c.setUint32(u,g,!0):t===Bt.UNSIGNED_SHORT?c.setUint16(u,g,!0):t===Bt.UNSIGNED_BYTE&&c.setUint8(u,g),u+=a}let d={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(d.target=s),s===Bt.ARRAY_BUFFER&&(d.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(d),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(n){let s=new window.FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){let o=uv(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,n(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,n){let s=this.options,o=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",16:"MAT4"},l;if(e.array.constructor===Float32Array)l=Bt.FLOAT;else if(e.array.constructor===Uint32Array)l=Bt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)l=Bt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)l=Bt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),n===void 0&&(n=e.count),s.truncateDrawRange&&t!==void 0&&t.index===null){let p=r+n,f=t.drawRange.count===1/0?e.count:t.drawRange.start+t.drawRange.count;r=Math.max(r,t.drawRange.start),n=Math.min(p,f)-r,n<0&&(n=0)}if(n===0)return null;let c=HG(e,r,n),u;t!==void 0&&(u=e===t.index?Bt.ELEMENT_ARRAY_BUFFER:Bt.ARRAY_BUFFER);let d=this.processBufferView(e,l,r,n,u),h={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:n,max:c.max,min:c.min,type:a[e.itemSize]};return e.normalized===!0&&(h.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(h)-1}processImage(e,t,r){let n=this,s=n.cache,o=n.json,a=n.options,l=n.pending;s.images.has(e)||s.images.set(e,{});let c=s.images.get(e),u=t===Qt?"image/png":"image/jpeg",d=u+":flipY/"+r.toString();if(c[d]!==void 0)return c[d];o.images||(o.images=[]);let h={mimeType:u};if(a.embedImages){let f=EA=EA||document.createElement("canvas");f.width=Math.min(e.width,a.maxTextureSize),f.height=Math.min(e.height,a.maxTextureSize);let g=f.getContext("2d");if(r===!0&&(g.translate(0,f.height),g.scale(1,-1)),typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas!="undefined"&&e instanceof OffscreenCanvas||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap)g.drawImage(e,0,0,f.width,f.height);else{t!==Qt&&t!==jt&&console.error("GLTFExporter: Only RGB and RGBA formats are supported."),(e.width>a.maxTextureSize||e.height>a.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let v=new Uint8ClampedArray(e.height*e.width*4);if(t===Qt)for(let y=0;y<v.length;y+=4)v[y+0]=e.data[y+0],v[y+1]=e.data[y+1],v[y+2]=e.data[y+2],v[y+3]=e.data[y+3];else for(let y=0,m=0;y<v.length;y+=4,m+=3)v[y+0]=e.data[m+0],v[y+1]=e.data[m+1],v[y+2]=e.data[m+2],v[y+3]=255;g.putImageData(new ImageData(v,e.width,e.height),0,0)}a.binary===!0?l.push(new Promise(function(v){f.toBlob(function(y){n.processBufferViewImage(y).then(function(m){h.bufferView=m,v()})},u)})):h.uri=f.toDataURL(u)}else h.uri=e.src;let p=o.images.push(h)-1;return c[d]=p,p}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let r={magFilter:kn[e.magFilter],minFilter:kn[e.minFilter],wrapS:kn[e.wrapS],wrapT:kn[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){let t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY)};e.name&&(n.name=e.name),this._invokeAll(function(o){o.writeTexture&&o.writeTexture(e,n)});let s=r.textures.push(n)-1;return t.textures.set(e,s),s}processMaterial(e){let t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);let n={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let s=e.color.toArray().concat([e.opacity]);if(Cu(s,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap)if(e.metalnessMap===e.roughnessMap){let a={index:this.processTexture(e.metalnessMap)};this.applyTextureTransform(a,e.metalnessMap),n.pbrMetallicRoughness.metallicRoughnessTexture=a}else console.warn("THREE.GLTFExporter: Ignoring metalnessMap and roughnessMap because they are not the same Texture.");if(e.map){let a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),n.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){let a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(n.emissiveFactor=a.toArray()),e.emissiveMap){let c={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(c,e.emissiveMap),n.emissiveTexture=c}}if(e.normalMap){let a={index:this.processTexture(e.normalMap)};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),n.normalTexture=a}if(e.aoMap){let a={index:this.processTexture(e.aoMap),texCoord:1};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),n.occlusionTexture=a}e.transparent?n.alphaMode="BLEND":e.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),e.side===Yt&&(n.doubleSided=!0),e.name!==""&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,n)});let o=r.materials.push(n)-1;return t.materials.set(e,o),o}processMesh(e){let t=this.cache,r=this.json,n=[e.geometry.uuid];if(Array.isArray(e.material))for(let x=0,b=e.material.length;x<b;x++)n.push(e.material[x].uuid);else n.push(e.material.uuid);let s=n.join(":");if(t.meshes.has(s))return t.meshes.get(s);let o=e.geometry,a;if(e.isLineSegments?a=Bt.LINES:e.isLineLoop?a=Bt.LINE_LOOP:e.isLine?a=Bt.LINE_STRIP:e.isPoints?a=Bt.POINTS:a=e.material.wireframe?Bt.LINES:Bt.TRIANGLES,o.isBufferGeometry!==!0)throw new Error("THREE.GLTFExporter: Geometry is not of type THREE.BufferGeometry.");let l={},c={},u=[],d=[],h={uv:"TEXCOORD_0",uv2:"TEXCOORD_1",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},p=o.getAttribute("normal");p!==void 0&&!this.isNormalizedNormalAttribute(p)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),o.setAttribute("normal",this.createNormalizedNormalAttribute(p)));let f=null;for(let x in o.attributes){if(x.substr(0,5)==="morph")continue;let b=o.attributes[x];if(x=h[x]||x.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(x)||(x="_"+x),t.attributes.has(this.getUID(b))){c[x]=t.attributes.get(this.getUID(b));continue}f=null;let T=b.array;x==="JOINTS_0"&&!(T instanceof Uint16Array)&&!(T instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),f=new Fe(new Uint16Array(T),b.itemSize,b.normalized));let S=this.processAccessor(f||b,o);S!==null&&(c[x]=S,t.attributes.set(this.getUID(b),S))}if(p!==void 0&&o.setAttribute("normal",p),Object.keys(c).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){let x=[],b=[],w={};if(e.morphTargetDictionary!==void 0)for(let T in e.morphTargetDictionary)w[e.morphTargetDictionary[T]]=T;for(let T=0;T<e.morphTargetInfluences.length;++T){let S={},M=!1;for(let E in o.morphAttributes){if(E!=="position"&&E!=="normal"){M||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),M=!0);continue}let C=o.morphAttributes[E][T],_=E.toUpperCase(),O=o.attributes[E];if(t.attributes.has(this.getUID(C))){S[_]=t.attributes.get(this.getUID(C));continue}let P=C.clone();if(!o.morphTargetsRelative)for(let D=0,G=C.count;D<G;D++)P.setXYZ(D,C.getX(D)-O.getX(D),C.getY(D)-O.getY(D),C.getZ(D)-O.getZ(D));S[_]=this.processAccessor(P,o),t.attributes.set(this.getUID(O),S[_])}d.push(S),x.push(e.morphTargetInfluences[T]),e.morphTargetDictionary!==void 0&&b.push(w[T])}l.weights=x,b.length>0&&(l.extras={},l.extras.targetNames=b)}let g=Array.isArray(e.material);if(g&&o.groups.length===0)return null;let v=g?e.material:[e.material],y=g?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let x=0,b=y.length;x<b;x++){let w={mode:a,attributes:c};if(this.serializeUserData(o,w),d.length>0&&(w.targets=d),o.index!==null){let S=this.getUID(o.index);(y[x].start!==void 0||y[x].count!==void 0)&&(S+=":"+y[x].start+":"+y[x].count),t.attributes.has(S)?w.indices=t.attributes.get(S):(w.indices=this.processAccessor(o.index,o,y[x].start,y[x].count),t.attributes.set(S,w.indices)),w.indices===null&&delete w.indices}let T=this.processMaterial(v[y[x].materialIndex]);T!==null&&(w.material=T),u.push(w)}l.primitives=u,r.meshes||(r.meshes=[]),this._invokeAll(function(x){x.writeMesh&&x.writeMesh(e,l)});let m=r.meshes.push(l)-1;return t.meshes.set(s,m),m}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let r=e.isOrthographicCamera,n={type:r?"orthographic":"perspective"};return r?n.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:rt.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){let r=this.json,n=this.nodeMap;r.animations||(r.animations=[]),e=Eu.Utils.mergeMorphTargetTracks(e.clone(),t);let s=e.tracks,o=[],a=[];for(let l=0;l<s.length;++l){let c=s[l],u=lt.parseTrackName(c.name),d=lt.findNode(t,u.nodeName),h=MA[u.propertyName];if(u.objectName==="bones"&&(d.isSkinnedMesh===!0?d=d.skeleton.getBoneByName(u.objectIndex):d=void 0),!d||!h)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',c.name),null;let p=1,f=c.values.length/c.times.length;h===MA.morphTargetInfluences&&(f/=d.morphTargetInfluences.length);let g;c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(g="CUBICSPLINE",f/=3):c.getInterpolation()===Ma?g="STEP":g="LINEAR",a.push({input:this.processAccessor(new Fe(c.times,p)),output:this.processAccessor(new Fe(c.values,f)),interpolation:g}),o.push({sampler:a.length-1,target:{node:n.get(d),path:h}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:a,channels:o}),r.animations.length-1}processSkin(e){let t=this.json,r=this.nodeMap,n=t.nodes[r.get(e)],s=e.skeleton;if(s===void 0)return null;let o=e.skeleton.bones[0];if(o===void 0)return null;let a=[],l=new Float32Array(s.bones.length*16),c=new Me;for(let d=0;d<s.bones.length;++d)a.push(r.get(s.bones[d])),c.copy(s.boneInverses[d]),c.multiply(e.bindMatrix).toArray(l,d*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Fe(l,16)),joints:a,skeleton:r.get(o)}),n.skin=t.skins.length-1}processNode(e){let t=this.json,r=this.options,n=this.nodeMap;t.nodes||(t.nodes=[]);let s={};if(r.trs){let a=e.quaternion.toArray(),l=e.position.toArray(),c=e.scale.toArray();Cu(a,[0,0,0,1])||(s.rotation=a),Cu(l,[0,0,0])||(s.translation=l),Cu(c,[1,1,1])||(s.scale=c)}else e.matrixAutoUpdate&&e.updateMatrix(),VG(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){let a=this.processMesh(e);a!==null&&(s.mesh=a)}else e.isCamera&&(s.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let a=[];for(let l=0,c=e.children.length;l<c;l++){let u=e.children[l];if(u.visible||r.onlyVisible===!1){let d=this.processNode(u);d!==null&&a.push(d)}}a.length>0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});let o=t.nodes.push(s)-1;return n.set(e,o),o}processScene(e){let t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);let n={};e.name!==""&&(n.name=e.name),t.scenes.push(n);let s=[];for(let o=0,a=e.children.length;o<a;o++){let l=e.children[o];if(l.visible||r.onlyVisible===!1){let c=this.processNode(l);c!==null&&s.push(c)}}s.length>0&&(n.nodes=s),this.serializeUserData(e,n)}processObjects(e){let t=new Gr;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);this.processScene(t)}processInput(e){let t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(n){n.beforeParse&&n.beforeParse(e)});let r=[];for(let n=0;n<e.length;n++)e[n]instanceof Gr?this.processScene(e[n]):r.push(e[n]);r.length>0&&this.processObjects(r);for(let n=0;n<this.skins.length;++n)this.processSkin(this.skins[n]);for(let n=0;n<t.animations.length;++n)this.processAnimation(t.animations[n],e[0]);this._invokeAll(function(n){n.afterParse&&n.afterParse(e)})}_invokeAll(e){for(let t=0,r=this.plugins.length;t<r;t++)e(this.plugins[t])}},LA=class{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}let r=this.writer,n=r.json,s=r.extensionsUsed,o={};e.name&&(o.name=e.name),o.color=e.color.toArray(),o.intensity=e.intensity,e.isDirectionalLight?o.type="directional":e.isPointLight?(o.type="point",e.distance>0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,o.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},s[this.name]=!0);let a=n.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}},NA=class{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let n=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},n[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}},PA=class{constructor(e){this.writer=e,this.name="KHR_materials_pbrSpecularGlossiness"}writeMaterial(e,t){if(!e.isGLTFSpecularGlossinessMaterial)return;let r=this.writer,n=r.extensionsUsed,s={};t.pbrMetallicRoughness.baseColorFactor&&(s.diffuseFactor=t.pbrMetallicRoughness.baseColorFactor);let o=[1,1,1];if(e.specular.toArray(o,0),s.specularFactor=o,s.glossinessFactor=e.glossiness,t.pbrMetallicRoughness.baseColorTexture&&(s.diffuseTexture=t.pbrMetallicRoughness.baseColorTexture),e.specularMap){let a={index:r.processTexture(e.specularMap)};r.applyTextureTransform(a,e.specularMap),s.specularGlossinessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}},IA=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;let r=this.writer,n=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){let o={index:r.processTexture(e.transmissionMap)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}},DA=class{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.thickness===0)return;let r=this.writer,n=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){let o={index:r.processTexture(e.thicknessMap)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationTint.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,n[this.name]=!0}};Eu.Utils={insertKeyframe:function(i,e){let t=.001,r=i.getValueSize(),n=new i.TimeBufferType(i.times.length+1),s=new i.ValueBufferType(i.values.length+r),o=i.createInterpolant(new i.ValueBufferType(r)),a;if(i.times.length===0){n[0]=e;for(let l=0;l<r;l++)s[l]=0;a=0}else if(e<i.times[0]){if(Math.abs(i.times[0]-e)<t)return 0;n[0]=e,n.set(i.times,1),s.set(o.evaluate(e),0),s.set(i.values,r),a=0}else if(e>i.times[i.times.length-1]){if(Math.abs(i.times[i.times.length-1]-e)<t)return i.times.length-1;n[n.length-1]=e,n.set(i.times,0),s.set(i.values,0),s.set(o.evaluate(e),i.values.length),a=n.length-1}else for(let l=0;l<i.times.length;l++){if(Math.abs(i.times[l]-e)<t)return l;if(i.times[l]<e&&i.times[l+1]>e){n.set(i.times.slice(0,l+1),0),n[l+1]=e,n.set(i.times.slice(l+1),l+2),s.set(i.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(i.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return i.times=n,i.values=s,a},mergeMorphTargetTracks:function(i,e){let t=[],r={},n=i.tracks;for(let s=0;s<n.length;++s){let o=n[s],a=lt.parseTrackName(o.name),l=lt.findNode(e,a.nodeName);if(a.propertyName!=="morphTargetInfluences"||a.propertyIndex===void 0){t.push(o);continue}if(o.createInterpolant!==o.InterpolantFactoryMethodDiscrete&&o.createInterpolant!==o.InterpolantFactoryMethodLinear){if(o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),o=o.clone(),o.setInterpolation(Aa)}let c=l.morphTargetInfluences.length,u=l.morphTargetDictionary[a.propertyIndex];if(u===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let d;if(r[l.uuid]===void 0){d=o.clone();let p=new d.ValueBufferType(c*d.times.length);for(let f=0;f<d.times.length;f++)p[f*c+u]=d.values[f];d.name=(a.nodeName||"")+".morphTargetInfluences",d.values=p,r[l.uuid]=d,t.push(d);continue}let h=o.createInterpolant(new o.ValueBufferType(1));d=r[l.uuid];for(let p=0;p<d.times.length;p++)d.values[p*c+u]=h.evaluate(d.times[p]);for(let p=0;p<o.times.length;p++){let f=this.insertKeyframe(d,o.times[p]);d.values[f*c+u]=o.values[p]}}return i.tracks=t,i}};var jG,RA=new Promise(i=>{jG=i});var GA=Hv(FA());var ap={isPublish:!1,gltfQueue:[]};function Lu(i,e,t){return i[e.uuid]===void 0&&(i[e.uuid]=e.toJSON(t)),e.uuid}var ZG=new Eu;function zA(i,e,t){if(i[e.uuid]===void 0)if(e.userData.type==="NonParametricGeometry"||e.userData.type==="SubdivGeometry"){if(e.userData.type==="SubdivGeometry")if(ap.isPublish)e=Nf.create({geometry:e.clone()}),e.userData.parameters.subdivisions===0&&(delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.positionWASM,delete e.attributes.indexWASM,delete e.attributes.verticesPerFaceWASM);else{let n=e.originalGeometry;if(n){let s=e.userData;e=n.clone(),e.userData=s}else e=e.clone();delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.position,delete e.attributes.normal,e.index=null}let r=e.originalGeometry;if(r!==void 0){let n=e.userData;e=r,e.userData=n}if(!ap.isPublish)i[e.uuid]=e.toJSON();else{let n={type:"NonParametricGeometry",uuid:e.uuid,userData:{}};e.name!==""&&(n.name=e.name),Object.keys(e.userData).length>0&&(n.userData=re({},e.userData));let s=e.index===null,o=new Oi;if(Array.isArray(t))SA(e).forEach((l,c)=>{let u=new Wt(l,new il);o.add(u),l.userData.groupIndex=c,l.userData.materialIndex=e.groups[c].materialIndex,l.index===null&&(s=!0)});else{let a=new Wt(e,new il);o.add(a)}ap.gltfQueue.push(new Promise(async a=>{await Promise.all(ap.gltfQueue),ZG.parse(o,async l=>{let{gltfTransform:c,DracoMeshCompressionExtension:u,addIndex:d}=await RA,h=c.readJSON({json:gg(l),resources:{}});h.createExtension(u).setRequired(!0).setEncoderOptions({quantizationVolume:"scene"}),s&&await h.transform(d);try{let{json:p,resources:f}=c.writeJSON(h),g=GA.default.fromByteArray(new Uint8Array(f[".bin"]));p.buffers[0].uri=`data:application/octet-stream;base64,${g}`,a()}catch(p){a()}},{})})),i[e.uuid]=n}}else{let r=e.userData;if(r.type==="VectorGeometry"){let n=e.userData.shape;r=Object.assign({},r,{shape:n.toJSON()})}i[e.uuid]={uuid:e.uuid,userData:r}}return e.uuid}function Ql(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function UA(i){let e=[];for(let t in i)e.push(i[t]);return e}var Es;(function(r){r[r.started=0]="started",r[r.ended=1]="ended",r[r.once=2]="once"})(Es||(Es={}));var Mi=class{constructor(e){this.object=e;this.uuid=rt.generateUUID();this.states=[];this.events=[];this._scrollCounter=null;this._interpolateMaterialBetweenValues=(e,t,r,n=t.getNames())=>{var s,o,a,l,c;for(let u=0,d=n.length;u<d;++u){let h=n[u],p=`f${t.id}_${h}`,f=`f${r.id}_${h}`,g=t.uniforms[p],v=r.uniforms[f];if(!(!g||g.value===void 0||v===void 0)){if(h==="mode"){g.value!==v.value&&(g.value=v.value);continue}if(typeof g.value=="boolean"){g.value!==v.value&&(g.value=v.value);continue}if(typeof g.value=="number"){g.value!==v.value&&((s=this._animation)==null||s.add({targets:g,value:Number(v.value)},0));continue}if("isVector2"in g.value){g.value.equals(v.value)===!1&&((o=this._animation)==null||o.add({targets:g,x:v.value.x,y:v.value.y},0));continue}if("isVector3"in g.value){g.value.equals(v.value)===!1&&((a=this._animation)==null||a.add({targets:g,x:v.value.x,y:v.value.y,z:v.value.z},0));continue}if("isColor"in g.value){g.value.equals(v.value)===!1&&((l=this._animation)==null||l.add({targets:g.value,r:v.value.r,g:v.value.g,b:v.value.b},0));continue}}}if(t.backLayer){let d=`f${t.backLayer.id}_alpha`,h=t.backLayer.uniforms[d];(c=this._animation)==null||c.add({targets:h,value:0},0)}};this._interpolateMaterialBetweenLayers=(e,t,r)=>{var c,u,d;let n=e.layersList;if(t.backLayer===void 0){let h=r.getValues();h.alpha=0,t.backLayer=n.addLayerBeforeAt(h,t),t.backLayer.isBack=!0,e.dispose()}let s=`f${t.id}_alpha`,o=`f${(c=t.backLayer)==null?void 0:c.id}_alpha`,a=t.uniforms[s],l=(u=t.backLayer)==null?void 0:u.uniforms[o];(d=this._animation)==null||d.add({targets:a,value:0},0).add({targets:l,value:r.uniforms[`f${r.id}_alpha`].value},0)};this._interpolateMaterialTexture=(e,t,r)=>{var h;let n=`f${t.id}_texture`,s=t.uniforms[n].value,o=r.uniforms[`f${r.id}_texture`].value,a=t.uniforms[`f${t.id}_crop`],l=r.uniforms[`f${r.id}_crop`];a&&l&&a.value!==l.value&&(a.value=Number(l.value)),(s.wrapS!==o.wrapS||s.wrapT!==o.wrapT)&&(s.wrapS=o.wrapS,s.wrapT=o.wrapT,s.needsUpdate=!0);let c=s.matrix,u=o.matrix;if(c.equals(u)===!1){let p={repeatX:s.repeat.x,repeatY:s.repeat.y,offsetX:s.offset.x,offsetY:s.offset.y};(h=this._animation)==null||h.add({targets:p,repeatX:o.repeat.x,repeatY:o.repeat.y,offsetX:o.offset.x,offsetY:o.offset.y,update:()=>{s.repeat.set(p.repeatX,p.repeatY),s.offset.set(p.offsetX,p.offsetY),s.updateMatrix(),s.needsUpdate=!0}},0)}let d=["alpha","mode"];t.type==="displace_map"&&d.push("intensity"),this._interpolateMaterialBetweenValues(e,t,r,d)};this._interpolateMaterialGradient=(e,t,r)=>{var p;let n=10,s=`f${t.id}_steps`,o=`f${r.id}_steps`,a=t.uniforms[s],l=r.uniforms[o],c=`f${t.id}_colors`,u=`f${r.id}_colors`,d=t.uniforms[c],h=r.uniforms[u];for(let f=0;f<n;++f){let g=d.value[f],v=h.value[f];if(a.value[f]!==l.value[f]||!g.equals(v)){let y={value:a.value[f]};(p=this._animation)==null||p.add({targets:[y,g],value:l.value[f],x:v.x,y:v.y,z:v.z,w:v.w,update:()=>{a.value[f]=y.value}},0)}}this._interpolateMaterialBetweenValues(e,t,r,["alpha","mode","gradientType","smooth","offset","morph","angle","origin","direction","near","far"])}}static get isAllAnimationsEnded(){let e;for(let t in Mi.isAnimating){if(Mi.isAnimating[t]===2)return Mi.isAnimating[t]=1,!1;if(Mi.isAnimating[t]===0)return!1;e=!0}return e}computeCache(){return this.cache={mouseDown:this.events.find(e=>e.type===Je.MOUSE_DOWN),mouseUp:this.events.find(e=>e.type===Je.MOUSE_UP),mouseHover:this.events.find(e=>e.type===Je.MOUSE_HOVER),start:this.events.find(e=>e.type===Je.START),lookAt:this.events.find(e=>e.type===Je.LOOK_AT),follow:this.events.find(e=>e.type===Je.FOLLOW),keyDown:this.events.filter(e=>e.type===Je.KEY_DOWN),keyUp:this.events.filter(e=>e.type===Je.KEY_UP),scroll:this.events.find(e=>e.type===Je.SCROLL)},this.cache}newState(e){let t=new Qi;return t.name=e,t.update(this.object),this.states.push(t),t}addState(e,t){this.states.splice(t,0,e)}removeState(e){this.states.splice(e,1)}selectState(e){e!==void 0&&this.states[e].execute(this.object)}hasEventType(e,t){return e===Je.KEY_DOWN||e===Je.KEY_UP?t===void 0?!1:this.events.some(r=>r.type===e&&r.key===t):this.events.some(r=>r.type===e)}newEvent(){let e=[Je.MOUSE_DOWN,Je.MOUSE_UP,Je.MOUSE_HOVER,Je.KEY_DOWN].find(r=>this.hasEventType(r)===!1),t=new vo(e);return this.events.push(t),t}addEvent(e,t){this.events.splice(t,0,e);let r=this.events[t].targets;for(let n=0,s=r.length;n<s;++n)r[n].object!==void 0&&aa.add(r[n])}removeEvent(e){let t=this.events[e].targets;for(let r=0,n=t.length;r<n;++r)t[r].object!==void 0&&aa.delete(t[r]);this.events.splice(e,1)}copy(e){for(let t=0,r=e.states.length;t<r;++t)this.addState(e.states[t].clone(),t);for(let t=0,r=e.events.length;t<r;++t){this.addEvent(e.events[t].clone(),t);let n=e.events[t].targets;for(let s=0,o=n.length;s<o;++s){let a=n[s].clone();n[s].object===e.object?(a.object=this.object,a.state=this.states[e.states.indexOf(n[s].state)]):(a.object=n[s].object,a.state=n[s].state),this.events[t].addTarget(a,s)}}return this}clone(e){return new Mi(e).copy(this)}toJSON(e){e===void 0&&(e={nodes:{},geometries:{},materials:{},textures:{},images:{},interactionStates:{}});let t={uuid:this.uuid};if(this.states.length>0){t.states=[];for(let r=0,n=this.states.length;r<n;++r)t.states.push(Lu(e.interactionStates,this.states[r],e))}if(this.events.length>0){t.events=[];for(let r=0,n=this.events.length;r<n;++r)t.events.push(this.events[r].toJSON())}return t}fromJSON(e,t,r){var n;if(this.uuid=e.uuid,this.states=[],this.events=[],e.states!==void 0)for(let s=0,o=e.states.length;s<o;++s){let a=r[e.states[s]];this.states.push(a),((n=a.camera)==null?void 0:n.targetOffset)===-1&&(a.camera.targetOffset=this.object.getDistanceToTarget())}if(e.events!==void 0)for(let s=0,o=e.events.length;s<o;++s)this.events.push(new vo().fromJSON(e.events[s],t,r));return this}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null,this._removeBackLayer()),this.states.length>1?(this.states[0].execute(this.object),this._currentState=this.states[0],this._prevState=void 0):this._state0!==void 0?this._state0.execute(this.object):this.events.some(e=>e.type===Je.LOOK_AT||e.type===Je.FOLLOW)&&(this._state0=new Qi,this._state0.update(this.object))}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._removeBackLayer()),this.states.length>1?this.states[0].execute(this.object):this._state0!==void 0&&(this._state0.execute(this.object),this._state0=void 0),this._currentState=void 0,this._prevState=void 0}lookAt(e){var t;this.object.lookAt(e),this.object.updateMatrix(),(t=this._animation)==null||t.finished.then(()=>{this.lookAt(e),this.object.updateMatrix()})}follow(e){this.object.position.copy(e),this.object.parent!==null&&this.object.position.applyMatrix4(new Me().copy(this.object.parent.matrixWorld).invert()),this.object.position.applyMatrix4(new Me().copy(this.object.hiddenMatrix).invert()),this.object.updateMatrix()}play(e){this.object.visible&&e.state!==void 0&&this.animate(e.state,e)}seek(e,t,r){var n;this._scrollCounter===null&&(this.object.visible&&e.state!==void 0&&this.animate(e.state,e,!0),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),Mi.isAnimating[e.state.uuid]=2,(n=this._animation)==null||n.seek(this._scrollCounter/r*e.duration)}reverse(e){this.object.visible&&this._prevState!==void 0&&this.animate(this._prevState,e)}_removeBackLayer(){if("material"in this.object){let e=this.object.material;if(e instanceof Array)for(let t=0,r=e.length;t<r;++t){let n=e[t].layersList,s=n.head;for(;s;)if(s.backLayer){delete s.backLayer;let o=s.next;n.removeLayer(s.id),s=o}else s.isBack&&(s.isBack=!1),s=s.next}else{let t=e.layersList,r=t.head;for(;r;)for(;r;)if(r.backLayer){delete r.backLayer;let n=r.next;t.removeLayer(r.id),r=n}else r.isBack&&(r.isBack=!1),r=r.next}}}getTimingFunction(e,t,r){switch(e){case Si.LINEAR:return"cubicBezier( 0, 0, 1, 1 )";case Si.EASE:return"cubicBezier( .25, .1, .25, 1 )";case Si.EASE_IN:return"cubicBezier( .42, 0, 1, 1 )";case Si.EASE_OUT:return"cubicBezier( 0, 0, .58, 1 )";case Si.EASE_IN_OUT:return"cubicBezier( .42, 0, .58, 1 )";case Si.CUBIC:return`cubicBezier( ${t[0]}, ${t[1]}, ${t[2]}, ${t[3]} )`;case Si.SPRING:return`spring( ${r.mass}, ${r.stiffness}, ${r.damping}, ${r.velocity} )`}}animate(e,t,r=!1){var n,s,o,a,l,c;if(Mi.isAnimating[e.uuid]=0,this._currentState===e){if((n=this._animation)==null?void 0:n.reversed){let u=(o=(s=this._animation)==null?void 0:s.currentTime)!=null?o:0;(a=this._animation)==null||a.reset(),(l=this._animation)==null||l.seek(u),(c=this._animation)==null||c.play()}}else this._prevState=this._currentState,this._currentState=e,this._animation!==void 0&&(Mi.isAnimating[this._prevState.uuid]=1,this._animation.pause()),this._removeBackLayer(),t.cycle===!0&&t.repeat===!0?this._animation=_u.timeline({duration:t.duration,delay:t.delay/2,endDelay:t.delay/2,direction:"alternate",loop:!0,rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!0&&t.repeat===!1?this._animation=_u.timeline({duration:t.duration,delay:t.delay,endDelay:t.delay/2,direction:"alternate",rewind:t.rewind,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):t.cycle===!1&&t.repeat===!0?this._animation=_u.timeline({duration:t.duration,delay:t.delay,direction:"normal",loop:!0,easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}):this._animation=_u.timeline({duration:t.duration,delay:t.delay,direction:"normal",easing:this.getTimingFunction(t.easing,t.cubicControls,t.springParameters),autoplay:!r}),this._animation.finished.then(()=>{r||(this._removeBackLayer(),this._animation=void 0,Mi.isAnimating[e.uuid]=1)}),this.animateMatrix(e),this.animateGeometry(e),this.animateMaterial(e),this.animateCamera(e),this.animateLight(e.light)}animateMatrix(e){var s,o,a,l;if(this.object.position.equals(e.position)===!1){let c=this.object.position.clone(),u={t:0};(s=this._animation)==null||s.add({targets:u,t:1,update:()=>{this.object.position.lerpVectors(c,e.position,u.t),this.object.updateMatrix()}},0)}if(this.object.scale.equals(e.scale)===!1){let c=this.object.scale.clone(),u={t:0};(o=this._animation)==null||o.add({targets:u,t:1,update:()=>{this.object.scale.lerpVectors(c,e.scale,u.t),this.object.updateMatrix()}},0)}if(this.object.rotation.equals(e.rotation)===!1){let c=this.object.quaternion.clone(),u={t:0},d={x:this.object.rotation.x,y:this.object.rotation.y,z:this.object.rotation.z},h={x:e.rotation.x-this.object.rotation.x,y:e.rotation.y-this.object.rotation.y,z:e.rotation.z-this.object.rotation.z},p=e.rotation.clone(),f=new Ft().setFromEuler(p);(a=this._animation)==null||a.add({targets:u,t:1,update:Object.values(h).every(g=>Math.abs(g)<2*Math.PI)?()=>{J1(c,f,this.object.quaternion,u.t),this.object.updateMatrix()}:()=>{this.object.rotation.x=d.x+h.x*u.t,this.object.rotation.y=d.y+h.y*u.t,this.object.rotation.z=d.z+h.z*u.t,this.object.updateMatrix()}},0)}let t=new A,r=new Ft,n=new A;if(e.hiddenMatrix.decompose(t,r,n),"hiddenMatrix"in this.object){let c=new A,u=new Ft,d=new A;if(this.object.hiddenMatrix.decompose(c,u,d),this.object.hiddenMatrix.equals(e.hiddenMatrix)===!1){let h=new A,p=new Ft,f=new A,g={t:0},v=this.object.hiddenMatrix;(l=this._animation)==null||l.add({targets:g,t:1,update:()=>{p.slerpQuaternions(u,r,g.t),h.lerpVectors(c,t,g.t),f.lerpVectors(d,n,g.t),v.compose(h,p,f)}},0)}}}animateGeometry(e){var t;if("geometry"in this.object&&e.geometry!==void 0){let n=this.object.geometry.userData.parameters,s=e.geometry;if(s.width!==n.width||s.height!==n.height||s.depth!==n.depth){let o=this.object;(t=this._animation)==null||t.add({targets:n,width:s.width,height:s.height,depth:s.depth,update:()=>{o.updateGeometry({parameters:{width:n.width,height:n.height,depth:n.depth}})}},0)}}}animateMaterial(e){if("material"in this.object)if(this.object.material instanceof Array)for(let t=0,r=this.object.material.length;t<r;++t)this._interpolateMaterial(this.object.material[t],e.material[t]);else{if(this.object.material.userData.isAsset)return;this._interpolateMaterial(this.object.material,e.material)}}animateCamera(e){var t,r;if(this.object.objectType==="CombinedCamera"&&e.camera!==void 0){let n=this.object,s=n.cameraType==="OrthographicCamera"?e.camera.zoomOrtho:e.camera.zoomPersp;n.zoom!==s&&((t=this._animation)==null||t.add({targets:n,zoom:s,update:()=>{n.updateProjectionMatrix()}},0)),n.targetOffset!==e.camera.targetOffset&&((r=this._animation)==null||r.add({targets:n,targetOffset:e.camera.targetOffset},0))}}animateLight(e){var t,r;if(e!==void 0&&(this.object.objectType==="LightDirectional"||this.object.objectType==="LightSpot"||this.object.objectType==="LightPoint")){let n=this.object;n.intensity!==e.intensity&&((t=this._animation)==null||t.add({targets:n,intensity:e.intensity},0)),Ur.equals(n.color,e.color)||(r=this._animation)==null||r.add({targets:n.color,r:e.color.r,g:e.color.g,b:e.color.b},0)}}_interpolateMaterial(e,t){let r=e.layersList.head,n=0;for(;r;){if(r.isBack===!0){r=r.next;continue}let s=t.layersList[n++];if(kf(r)){let o=r.uniforms[`f${r.id}_texture`].value,a=s.uniforms[`f${s.id}_texture`].value;o.image===a.image?this._interpolateMaterialTexture(e,r,s):this._interpolateMaterialBetweenLayers(e,r,s)}else r.type==="gradient"||r.type==="depth"?r.uniforms[`f${r.id}_gradientType`].value===s.uniforms[`f${s.id}_gradientType`].value?this._interpolateMaterialGradient(e,r,s):this._interpolateMaterialBetweenLayers(e,r,s):this._interpolateMaterialBetweenValues(e,r,s);r=r.next}}},xo=Mi;xo.isAnimating={};var lp=i=>class extends i{hasEntityChild(){return this.children.some(t=>Of(t))}isDescendantOf(t){t instanceof Ze&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new Me().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),Of(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Of(o)||o instanceof On)&&s.children.push(o.toJSON(t).object)}if(r){let o=Ql(t.geometries),a=Ql(t.materials),l=Ql(t.textures),c=Ql(t.images),u=Ql(t.interactionStates),d=UA(t.nodes);o.length>0&&(n.geometries=o),a.length>0&&(n.materials=a),l.length>0&&(n.textures=l),c.length>0&&(n.images=c),u.length>0&&(n.interactionStates=u),d.length>0&&(n.nodes=d)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var En=i=>"isEntity"in i,kA=i=>"isAbstractMesh"in i,ti=i=>class extends lp(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Me;this.interaction=new xo(this);this._singleBBox=new Ff;this._recursiveBBox=new Ff;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(t){this.visible=t;for(let r of this.children)En(r)&&r.traverseEntity(n=>{Ss(n)&&n.visible&&(n.objectHelper.visible=t)})}get visibility(){return this.visible}get interactionCache(){return this.interaction.cache===void 0&&this.interaction.computeCache(),this.interaction.cache}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(t=>{En(t)&&(t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0)})}traverseEntity(t){t(this);for(let r of this.children)En(r)&&r.traverseEntity(t)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);for(let r of this.children)r.updateMatrixWorld(t)}updateWorldMatrix(t,r){let n=this.parent;if(t&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),r)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(t){return new this.constructor().shallowCopy(this,t)}shallowCopy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),r===!0)for(let n of t.children)En(n)&&this.add(n.shallowClone());return this}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),t.interaction!==void 0&&this.interaction.copy(t.interaction),r===!0)for(let n of t.children)En(n)&&this.add(n.clone());return this}keepChildrenMatrixWorld(){let t=new Me,r=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),t.copy(this.matrixWorld).invert(),t.multiply(r);for(let n of this.children)En(n)&&n.hiddenMatrix.premultiply(t)}toJSON(t){let r=super.toJSON(t),n=r.object;return this.raycastLock===!0&&(n.raycastLock=!0),this.scaleLock===!0&&(n.scaleLock=!0),n.hiddenMatrix=this.hiddenMatrix.toArray(),this.interaction!==void 0&&(n.interaction=this.interaction.toJSON(t)),r}fromJSON(t){return super.fromJSON(t),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.scaleLock!==void 0&&(this.scaleLock=t.scaleLock),this.hiddenMatrix.fromArray(t.hiddenMatrix),this}fromObject3D(t){let r=t.children;return t.children=[],Object.assign(t,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Me}),this.copy(t),t.children=r,this}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return El(r,t)}fromObjectTransformState(t){return t.position&&this.position.fromArray(t.position),t.rotation&&this.rotation.fromArray(t.rotation),t.scale&&this.scale.fromArray(t.scale),t.hiddenMatrix&&this.hiddenMatrix.fromArray(t.hiddenMatrix),this.updateMatrix(),this}toState(t=[]){let r=re({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(t));return El(r,t)}fromState(t,r){return t.name&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.type!=="OrthographicCamera"&&t.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),t.visible!==void 0&&(this.visibility=t.visible),this.fromObjectTransformState(t),this}};var cp=class extends Ze{constructor(e,t={}){super();this.object=e;let r=e.recursiveBBox.getSize(new A),n=.1;this.parameters=zd.defaultData(r.toArray(),n),Jo(this.parameters,t),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let t of this.object.material)t.visible=!0;if(e){let t=this.object.material.map(r=>r.clone());for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material}for(let t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let t=this.object.material.clone();for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let t=0,r=e-this.children.length;t<r;++t){let n=this.object.shallowClone(!1);n.visible=!0,this.add(n),this.parameters.hideBase&&this.setHideBase(!0)}else for(let t=0,r=this.children.length-e;t<r;++t)this.remove(this.children[0])}_updateRadial(e){let t=e.radial,r=t.start*rt.DEG2RAD,n=t.end*rt.DEG2RAD,s=r-n,o=new jn(t.rotation[0]*rt.DEG2RAD,t.rotation[1]*rt.DEG2RAD,t.rotation[2]*rt.DEG2RAD),a;switch(t.axis){case"z":a=new A(0,0,1);break;case"y":a=new A(0,1,0);break;default:case"x":a=new A(1,0,0);break}for(let[l,c]of this.children.entries()){c.hiddenMatrix.identity(),c.scale.x=t.scale[0]+1,c.scale.y=t.scale[1]+1,c.scale.z=t.scale[2]+1,c.position.setScalar(0);let u=s/e.count*l-r;switch(t.axis){case"x":c.rotation.set(0,u,0);break;case"y":c.rotation.set(0,0,u);break;case"z":c.rotation.set(u,0,0);break}c.translateOnAxis(a,t.radius),c.position.x+=t.position[0],c.position.y+=t.position[1],c.position.z+=t.position[2],t.alignment===!0?(c.rotation.x+=o.x,c.rotation.y+=o.y,c.rotation.z+=o.z):c.rotation.copy(o)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=e.linear,r=new jn(t.rotation[0]*rt.DEG2RAD,t.rotation[1]*rt.DEG2RAD,t.rotation[2]*rt.DEG2RAD);for(let[n,s]of this.children.entries())s.hiddenMatrix.identity(),s.scale.x=t.scale[0]*n+1,s.scale.y=t.scale[1]*n+1,s.scale.z=t.scale[2]*n+1,s.rotation.x=r.x*n,s.rotation.y=r.y*n,s.rotation.z=r.z*n,s.position.x=t.position[0]*n,s.position.y=t.position[1]*n,s.position.z=t.position[2]*n}_updateGrid(e){let t=0,r=e.grid;if(r.useCenter===!0){let n={x:r.count[0]%2==0?2:1,y:r.count[1]%2==0?2:1,z:r.count[2]%2==0?2:1},s=new A(r.size[0]*(r.count[0]-n.x)*.5,r.size[1]*(r.count[1]-n.y)*.5,r.size[2]*(r.count[2]-n.z)*.5);for(let o=0;o<r.count[0];o++)for(let a=0;a<r.count[1];a++)for(let l=0;l<r.count[2];l++){let c=this.children[t++];c.hiddenMatrix.identity(),c.scale.setScalar(1),c.rotation.set(0,0,0),c.position.x=r.size[0]*o-s.x,c.position.y=r.size[1]*a-s.y,c.position.z=r.size[2]*l-s.z}}else for(let n=0;n<r.count[0];n++)for(let s=0;s<r.count[1];s++)for(let o=0;o<r.count[2];o++){let a=this.children[t++];a.hiddenMatrix.identity(),a.scale.setScalar(1),a.rotation.set(0,0,0),a.position.x=r.size[0]*n,a.position.y=-r.size[1]*s,a.position.z=-r.size[2]*o}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),Jo(this.parameters,e),this.update(),this}};var Lr=class extends ti(Wt){constructor(e,t){super(e,t);this.isAbstractMesh=!0;Array.isArray(t)&&(this.selectedMaterial=0)}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,t){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),t=t!=null?t:this.selectedMaterial,this.material[t].dispose(),this.material[t]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let t=this.geometry,r=Ty[t.userData.type],n=this.objectType==="NonParametric"?Object.assign({},t.userData,{geometry:t}):t.userData,s=r.build(r.normalizeInputs(e,n)),o=t.uuid;if(this.geometry.dispose(),this.geometry=s,this.geometry.uuid=o,this.geometry.computeBoundingSphere(),this.cloner)for(let a of this.cloner.children)a.geometry=this.geometry}resizeGeometry(e,t,r){gu.resizeGeometry(this.geometry,{width:e,height:t,depth:r})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let t=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,r=Rf(t),n=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(r,n).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new cp(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){let t=super.toJSON(e),r=t.object;if(r.geometry=zA(e.geometries,this.geometry,this.material),Array.isArray(this.material)){let n=[];for(let s=0,o=this.material.length;s<o;s++)n.push(Lu(e.materials,this.material[s],e));r.material=n}else r.material=Lu(e.materials,this.material,e);return t}fromJSON(e){return super.fromJSON(e),e.selectedMaterial!==void 0&&(this.selectedMaterial=e.selectedMaterial),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new cp(this)),this.cloner.fromClonerState(e))}fromState(e,t){var r,n;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(r=e.castShadow)!=null?r:!0,this.receiveShadow=(n=e.receiveShadow)!=null?n:!0),this}};var up=new F,ca=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new F(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=pn.Left}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,n=this.message.length;r<n;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,n;for(n=e;n>=0;n-=1)if(this.message[n].char===" "){r=!1,t.length===0&&(n-=1,t.splice(0,0,this.message[n]));break}else t.splice(0,0,this.message[n]);return r?t=[]:this.message.splice(n+1,t.length),t}getWord(e=0,t=1){let r=[],n=e;for(n=e;;n+=t){if(!this.message[n]||this.message[n].char===" "){r.length===0&&this.message[n]&&(r.push(this.message[n]),this.message.splice(n,1));break}t>0?(r.push(this.message[n]),this.message.splice(n,1),n-=t):(r.splice(0,0,this.message[n]),this.message.splice(n,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,n=e;for(;n>=0&&n<this.message.length;){if(this.message[n].char===" "){r===0&&(r=this.message[n].charSize);break}r+=this.message[n].charSize,n+=t}return(n<0||n>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let n=t;n<=r;n+=1)this.message[n].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,n,s){switch(r){case pn.Left:this.leftAlign(e,s);break;case pn.Center:this.centerAlign(this.spaceLeft(t),e,s);break;case pn.Right:this.rightAlign(this.spaceLeft(t),e,s);break;case pn.Justify:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){up.set(t,r);let n=this.message.length;for(let s=0;s<n;s++)this.message[s].updatePosition(this.message[s].localPosition.add(up),e)}leftAlign(e,t){this.align=pn.Left,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=pn.Center,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=pn.Right,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=pn.Justify,this.endLine){this.offsetCharacters(t,0,r);return}let n=this.countSpaces();if(n===0){this.offsetCharacters(t,0,r);return}let s=e/n,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),up.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(up),t)}clone(){let e=new ca(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var $G=new A(0,0,1),VA=new A,HA=new A,jA=new Dt,ua=class extends Lr{constructor(e=jr.create({}),t=new sn({side:Yt})){super(e,t);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new xr;this._onShapeUpdate=()=>{if(this.geometry instanceof fu){if(this.geometry.updateFromShape()){let e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};var r;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="VectorObject",t}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let t=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:t})}}setShape(e){var t,r;this.shape&&((t=this.shape.eventDispatcher)==null||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),jA.getNormalMatrix(this.matrixWorld),VA.copy($G).applyMatrix3(jA).normalize(),HA.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(VA,HA)}clone(e){let t=this.shape.clone(),r=this.material.clone(),n=this.geometry.userData,s=jr.create(Object.assign({},n,{shape:t})),o=new ua(s,r).copy(this,e);return o.shape=t,t.update(),o}raycast(e,t){Lr.prototype.raycast.call(this,e,t)}};var es=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new In(30,30,30),e};var hp=new Ni,dv=new ln,WA=new Me,ts=(i,e,t,r,n=!1)=>{let s=e,o=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),dv.copy(s.boundingSphere),dv.applyMatrix4(o),t.ray.intersectsSphere(dv)===!1||(WA.copy(o).invert(),hp.copy(t.ray).applyMatrix4(WA),s.boundingBox!==null&&hp.intersectsBox(s.boundingBox)===!1))return;let a,l,c,u,d=s.index,h=s.attributes.position,p=s.drawRange,f,g;if(n===!1){let y=Math.max(0,p.start),m=Math.min(d.count,p.start+p.count);for(f=y,g=m;f<g;f+=3)if(l=d.getX(f),c=d.getX(f+1),u=d.getX(f+2),a=v(i,t,hp,h,l,c,u),a){a.faceIndex=Math.floor(f/3),r.push(a);return}}else{let m=s.attributes.position,x=new A,b=new A,w=new A,T=new A,S=2,E=1/((i.scale.x+i.scale.y+i.scale.z)/3),C=E*E,_=Math.max(0,p.start),O=Math.min(m.count,p.start+p.count);for(let P=_,D=O-1;P<D;P+=S){if(x.fromBufferAttribute(m,P),b.fromBufferAttribute(m,P+1),hp.distanceSqToSegment(x,b,T,w)>C)continue;T.applyMatrix4(i.matrixWorld);let R=t.ray.origin.distanceTo(T);R<t.near||R>t.far||r.push({distance:R,point:w.clone().applyMatrix4(i.matrixWorld),object:i})}}function v(y,m,x,b,w,T,S){let M=new A,E=new A,C=new A,_=new A,O=new A;if(M.fromBufferAttribute(b,w),E.fromBufferAttribute(b,T),C.fromBufferAttribute(b,S),x.intersectTriangle(M,E,C,!1,_)===null)return null;O.copy(_),O.applyMatrix4(y.matrixWorld);let D=m.ray.origin.distanceTo(O);return D<m.near||D>m.far?null:{faceIndex:1,distance:D,point:O.clone(),object:y}}};var dp=new A,ri=new hi,JA=class extends Fi{constructor(e){let t=new _e,r=new un({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],o={},a=new ve(oy),l=new ve(oy),c=new ve(e1);u("n1","n2",a),u("n2","n4",a),u("n4","n3",a),u("n3","n1",a),u("f1","f2",a),u("f2","f4",a),u("f4","f3",a),u("f3","f1",a),u("n1","f1",a),u("n2","f2",a),u("n3","f3",a),u("n4","f4",a),u("p","n1",l),u("p","n2",l),u("p","n3",l),u("p","n4",l),u("u1","u2",c),u("u2","u3",c),u("u3","u1",c);function u(h,p,f){d(h,f),d(p,f)}function d(h,p){n.push(0,0,0),s.push(p.r,p.g,p.b),o[h]===void 0&&(o[h]=[]),o[h].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=!0;ri.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let n=1,s=1,o=r?.8:1e-4;Ai("n1",t,e,ri,-n,-s,o),Ai("n2",t,e,ri,n,-s,o),Ai("n3",t,e,ri,-n,s,o),Ai("n4",t,e,ri,n,s,o);let a=o;Ai("f1",t,e,ri,-n,-s,a),Ai("f2",t,e,ri,n,-s,a),Ai("f3",t,e,ri,-n,s,a),Ai("f4",t,e,ri,n,s,a);let l=a,c=.5;Ai("u1",t,e,ri,n*.7*c,s*1.1,l),Ai("u2",t,e,ri,-n*.7*c,s*1.1,l),Ai("u3",t,e,ri,0,s*(1.1+.9*c),l),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Ai(i,e,t,r,n,s,o){dp.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],dp.x,dp.y,dp.z)}}var fv=class extends es(JA){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){ts(this.object,this.geometry,e,t,!0)}};var Nu=class extends es(lg){constructor(e,t=15,r=10066329){super(e,t,r);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,Nu.geometryHelper,e,t)}};var Pu=class extends es(cg){constructor(e,t=15){super(t);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){ts(this.object,Pu.geometryHelper,e,t)}update(){}};var Iu=class extends es(ag){constructor(e,t=15,r=6710886){super(e,t,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,Iu.geometryHelper,e,t)}};var pp=class extends es(sg){constructor(e,t=6710886){super(e,t);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){ts(this.object,pp.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=pp._vector,t=this.object.distance?this.object.distance:1e3,r=t*Math.tan(this.object.angle);this.cone.scale.set(r,r,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,o=this.cone.material.length;s<o;s++)this.cone.material[s].color.set(n);else this.cone.material.color.set(n)}}},fp=pp;fp._vector=new A;var rs=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(r){this.visible=r,this.setHelperVisibility(r),this.setHelperChildrenVisibility(r)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(r){this.objectHelper.visible=r}setHelperChildrenVisibility(r){for(let n of this.children)En(n)&&n.traverseEntity(s=>{Ss(s)&&s.visible&&(s.objectHelper.visible=r)})}raycast(r,n){this.objectHelper.raycast(r,n)}copy(r,n=!0){return super.copy(r,n),r.enableHelper!==void 0&&(this.enableHelper=r.enableHelper),r.objectHelper!==void 0&&(this.objectHelper.visible=r.objectHelper.visible),this}toJSON(r){let n=super.toJSON(r),s=n.object;return s.enableHelper=this.enableHelper,n}fromJSON(r){return super.fromJSON(r),r.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(r,n){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;r.color!==void 0&&(s.color=sr(r.color,n)),r.intensity!==void 0&&(s.intensity=r.intensity),r.depth!==void 0&&(s.shadow.camera.far=r.depth,s.shadow.needsUpdate=!0),r.shadows!==void 0&&(this.castShadow=r.shadows),r.helper!==void 0&&(this.enableHelper=r.helper,s.gizmos.shadowmap.visible=r.helper)}return this}};var Kl=new A,pv=new A,ni=class extends rs(ti(hi),fv){constructor(e=window.innerWidth,t=window.innerHeight,r=45,n,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=qo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=t,this.orthoCamera=new Va(e*-.5,e*.5,t*.5,t*-.5,n!=null?n:-5e4,s),this.perspCamera=new dr(r,e/t,n!=null?n:50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(e,t){let r=new ni().fromState(t);return r.enableHelper=!0,r.objectHelper.update(),r.uuid=e,r}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(Kl),this.targetOffset=Kl.distanceTo(e)}getTarget(e=new A){return this.getWorldDirection(pv),this.getWorldPosition(Kl),pv.multiplyScalar(this.targetOffset),e.copy(Kl).add(pv),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Kl),Kl.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new Ft),t=new A(0,0,1).applyQuaternion(e),r=new A().copy(Ze.DefaultUp).applyQuaternion(e),n=new A().copy(Ze.DefaultUp).projectOnPlane(t),s=new A().crossVectors(n,r).dot(t)>=0?1:-1;this.angleOffsetFromUp=n.angleTo(r)*s}getViewFrontToObject(e){let t=e.getWorldPosition(new A),n=e.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:t.clone().add(n),target:t}}getViewToObject(e){let t=e.getWorldPosition(new A),n=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:t.clone().sub(n),target:t}}setViewplaneSize(e,t){this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,n,s,o){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,r,n,s,o):this.orthoCamera.setViewOffset(e,t,r,n,s,o)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let t={near:this.orthoCamera.near,far:this.orthoCamera.far},r={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=r.near,this.perspCamera.far=r.far,this.updateProjectionMatrix(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="CombinedCamera",r.cameraType=this.cameraType,r.targetOffset=this.targetOffset,r.isUpVectorFlipped=this.isUpVectorFlipped,r.angleOffsetFromUp=this.angleOffsetFromUp,r.left=this.left,r.right=this.right,r.top=this.top,r.bottom=this.bottom,this.view!==null&&(r.view=Object.assign({},this.view)),r.zoomOrtho=this.orthoCamera.zoom,r.nearOrtho=this.orthoCamera.near,r.far=this.far,r.aspect=this.aspect,r.fov=this.fov,r.focus=this.focus,r.filmGauge=this.filmGauge,r.filmOffset=this.filmOffset,r.zoomPersp=this.perspCamera.zoom,r.nearPersp=this.perspCamera.near,t}fromJSON(e){var t;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new A),n=new A().fromArray(e.orbitControlsTarget);this.targetOffset=n.distanceTo(r)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(t=e.angleOffsetFromUp)!=null?t:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset};return El(t,e)}fromCameraState(e){let{orthographic:t,perspective:r}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),t!==void 0&&(t.near!==void 0&&(this.orthoCamera.near=t.near),t.zoom!==void 0&&(this.orthoCamera.zoom=t.zoom)),r!==void 0&&(r.near!==void 0&&(this.perspCamera.near=r.near),r.fov!==void 0&&(this.perspCamera.fov=r.fov),r.zoom!==void 0&&(this.perspCamera.zoom=r.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),this.updateProjectionMatrix(),this}toState(e){return xe(re(re({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};var ii=class extends rs(ti(Oi),Pu){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,t){let r=new ii().fromState(t);return r.uuid=e,r.enableHelper=!0,r.objectHelper.update(),r}toJSON(e){let t=super.toJSON(e);return t.object.objectType="EmptyObject",t}};var Du=class extends rs(ti(ed),Nu){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=1,r.far=2500;let n=new mi(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new Du().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightDirectional",r.color=this.color.getHex(),r.intensity=this.intensity,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.left=r.left,t.right=r.right,t.top=r.top,t.bottom=r.bottom,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromDirectionalLightState(e,t){let r=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,t),e.size!==void 0&&j1(this,e.size),r&&this.update(),this}fromState(e,t){return super.fromState(e),this.fromDirectionalLightState(e,t),this}};var Ru=class extends rs(ti($h),Iu){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let n=new A(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new A(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),o=new rr(n,s),a=new cl(o,new ve(16755200));a.visible=!1,this._gizmos.shadowmap=a,this.update()}static createFromState(e,t,r){let n=new Ru().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof cl&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof cl&&(t.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let t=this._gizmos[e];if(t instanceof cl){let r=this.shadow.camera,n=new A(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new A(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z);t.box.set(n,s),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightPoint",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.decay=this.decay,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromPointLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,t){return super.fromState(e),this.fromPointLightState(e,t),this}};var qA=new A,XA=new A,YA=new Ft,Ou=class extends rs(ti(Zh),fp){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=rt.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new mi(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new Ou().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof mi&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),XA.setFromMatrixPosition(this.matrixWorld),YA.setFromRotationMatrix(this.matrixWorld),qA.copy(this.up).applyQuaternion(YA).negate().multiplyScalar(this.distance),this.target.position.copy(XA).add(qA),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,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}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightSpot",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.angle=this.angle,r.decay=this.decay,r.penumbra=this.penumbra,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromSpotLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,t){return super.fromState(e),this.fromSpotLightState(e,t),this}};var QA=i=>i.tagName==="VIDEO",Zl=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let o=r.image;QA(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;n>s?o={x:1,y:s/n}:n<s?o={x:n/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let o=0;o<s.length;o++){let a=s[o];kf(a)&&(Zl.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,o,a=r.image;QA(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,n.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Bu=class extends Lr{constructor(e,t=new sn){super(e,t);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&Zl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,t){super.resizeGeometry(e,t,0),this.material.userData.layers&&Zl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh2D",t}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let t,r;if(e instanceof jh){let o=e.image;t=o.videoWidth*.5,r=o.videoHeight*.5}else{let o=e.image;t=o.width*.5,r=o.height*.5}let n=Pf.create({parameters:{width:t,height:r}}),s=new sn;return s.layersList.changeLayer(0,{type:at.TEXTURE,texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new Bu(n,s)}};var Fu=class extends Lr{constructor(e,t=new $n){super(e,t);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh3D",t}};var Gu=class extends Fu{constructor(e,t=new $n){super(e,t);this.objectType="NonParametric"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="NonParametric",t}};var zu;(function(t){t[t.TO_RIGHT=1]="TO_RIGHT",t[t.TO_LEFT=-1]="TO_LEFT"})(zu||(zu={}));var mv=class extends Lr{constructor(e,t=new sn({transparent:!0,opacity:1,visible:!1,side:Yt})){super(e,t);this.objectType="TextFrame";this.charContainer=new Ze,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:co.None,horizontalAlignment:1,verticalAlignment:ws.Top,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new A(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,t,r){let n=If.create({parameters:{width:t.width,height:t.height}}),s=new mv(n).fromState(t,r);return s.uuid=e,s}async updateText(e){this.clearText();let t=this.userData.textFrame,r=t.fontFamily;await en.loadFont(r),t.text=e;let n=t.textOrigin,s=new Pi({visible:t.visible,transparent:!0,side:Yt}),o=e.split(`
|
|
4143
4143
|
`),a=0;this.userData.textFrame.textLines=o.map((l,c)=>{let u=new ca(a,t.lineHeight,t.fontSize);return u.message=l.split("").map(d=>{let h={char:d,fontFamily:r,letterSpacing:t.letterSpacing,fontSize:t.fontSize,LOD:16},p=s.clone();p.color=t.hexColor,p.opacity=t.opacity;let f=new en(h,p);return u.addChar3D(f,n),this.charContainer.add(f),f}),a+=u.maxCharSize*u.lineHeight,u}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let t=this.charContainer.children[0];this.charContainer.remove(t)}for(;e.length;)e.pop()}raycast(e,t){let r=[];if(super.raycast(e,r),r.length>0){t.push(r[0]);return}let n=[];for(let s=0,o=this.charContainer.children.length;s<o;++s)if(this.charContainer.children[s]instanceof en&&(e.intersectObject(this.charContainer.children[s],!1,n),n.length>0)){n[0].object=this,t.push(n[0]);return}}updateGeometry(e){var c,u,d,h;let t=this.userData,r=this.geometry.userData,n=r.parameters.width,s=r.parameters.height,o=(u=(c=e.parameters)==null?void 0:c.width)!=null?u:n,a=(h=(d=e.parameters)==null?void 0:d.height)!=null?h:s,l=t.textFrame;super.updateGeometry(e),l.maxLineSize=o,l.textOrigin.set(-.5*o,.5*a,0),a!==s?(this.checkOverFlow(),this.checkCapacity()):o!==n&&(n<o?this.checkCapacity():n>o&&this.checkOverFlow())}checkOverFlow(e=0){let t=this.userData,r=t.textFrame.textOrigin,n=t.textFrame.textLines;for(let s=e;s<n.length;s++){n[s].updateYLinePos(this.getNewLinePosition(s)),n[s].fullUpdate(r);let o=[];for(;n[s].checkOverFlow(t.textFrame.maxLineSize);)n[s].containSpaceOverFlow()?o.unshift(n[s].getWord(n[s].message.length-1,-1)):o.unshift(n[s].popChar());if(o.length>0){n[s+1]===void 0?(n[s].isEndLine(!1),this.createTextLine()):n[s].endLine&&(this.createTextLine(s+1),n[s].isEndLine(!1),n[s+1].isEndLine(!0));let a=0;for(let l=0;l<o.length;l+=1)for(let c=0;c<o[l].length;c+=1)n[s+1].addChar3D(o[l][c],r,a),a+=1;n[s+1].fullUpdate(r)}n[s].fullUpdate(r)}this.textFullUpdate(e)}checkCapacity(e=0){let t=this.userData,r=t.textFrame.textOrigin,n=t.textFrame.maxLineSize,s=t.textFrame.textLines;for(let o=e;o<s.length;o+=1)if(s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(r),!!s[o-1])for(;!s[o-1].endLine;){let a,l=s[o-1].spaceLeft(n);if(s[o].wordSize(0,1)<=l){s[o].containSpace()?a=s[o].getWord(0,1):a=s[o].popChar(0);for(let c=0;c<a.length;c+=1)a[c]&&s[o-1].addChar3D(a[c],r)}else{s[o].isEmpty()?(s[o].endLine&&s[o-1].isEndLine(!0),s.splice(o,1),o-=1):(s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(r));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let r=this.userData.textFrame;r.textLines.splice(e,0,new ca(this.getNewLinePosition(e),r.lineHeight,r.fontSize))}textFullUpdate(e=0){let r=this.userData.textFrame,n=r.textLines,s=this.getVerticalAlignmentOffSet();for(let o=e;o<n.length;o++)n[o].updateYLinePos(this.getNewLinePosition(o)),n[o].fullUpdate(r.textOrigin),n[o].alignText(r.textOrigin,r.maxLineSize,r.horizontalAlignment,r.verticalAlignment,s)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case ws.Top:return 0;case ws.Center:return this.getRemainingVerticalSpace()/2;case ws.Bottom:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let t=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(t.length)}getNewLinePosition(e){let r=this.userData.textFrame.textLines,n=0;for(let s=0;s<e;s+=1)n+=r[s].maxCharSize*r[s].lineHeight;return n}updateColor(e){var n;let t=this.userData;t.textFrame.hexColor=e;let r=t.textFrame.textLines;for(let s=0;s<r.length;s++){let o=r[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;((n=l.color)==null?void 0:n.isColor)&&(l.color=e)}}}updateOpacity(e){let t=this.userData;t.textFrame.opacity=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++){let s=r[n].message;for(let o=0;o<s.length;o++){let a=s[o].material;a.opacity=e}}}updateVisible(e){let t=this.userData;t.textFrame.visible=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++){let s=r[n].message;for(let o=0;o<s.length;o++){let a=s[o].material;a.visible=e}}}async updateFontFamily(e){await en.loadFont(e);let r=this.userData.textFrame,n=r.textLines;r.fontFamily=e;for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)o[a].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let r=this.userData.textFrame,n=r.textLines,s=r.fontSize;r.fontSize=e;for(let o=0;o<n.length;o++)n[o].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let r=this.userData.textFrame;await en.loadFont(r.fontFamily);let n=r.textLines;switch(r.textTransform=e,e){case co.Upper:for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)n[s].message[a].updateChar(o[a].char.toUpperCase())}break;case co.Lower:for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)n[s].message[a].updateChar(o[a].char.toLowerCase())}break;default:for(let s=0;s<n.length;s++){let o=n[s].message;for(let a=0;a<o.length;a++)n[s].message[a].updateChar(o[a].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.letterSpacing=e;for(let n=0;n<r.length;n++){let s=r[n].message;for(let o=0;o<s.length;o++)s[o].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let t=this.userData;t.textFrame.LOD=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.lineHeight=e;for(let n=0;n<r.length;n++)r[n].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let t=this.userData;t.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let t=this.userData;t.textFrame.horizontalAlignment=e,this.textFullUpdate()}toJSON(e){let t=super.toJSON(e),r=t.object;r.objectType="TextFrame";let s=this.userData.textFrame.textLines.map(o=>{let a=o.message.map(l=>({char:l.char,originalChar:l.originalChar,fontFamily:l.fontFamily,letterSpacing:l.letterSpacing,fontSize:l.fontSize,LOD:l.LOD}));return{align:o.align,endLine:o.endLine,lineHeight:o.lineHeight,maxCharSize:o.maxCharSize,yLinePos:o.yLinePos,message:a}});return r.userData.textFrame.textLinesData=s,t}async fromJSONasync(e){if(super.fromJSON(e),e.userData!==void 0){let t=e.userData.textFrame;await en.loadFont(t.fontFamily),t.textOrigin=new A(t.textOrigin.x,t.textOrigin.y,t.textOrigin.z);let r=new Pi({color:t.hexColor,opacity:t.opacity,visible:t.visible,transparent:!0,side:Yt});t.textLinesData&&(t.textLines=t.textLinesData.map((n,s)=>{let o=new ca(Number(n.yLinePos),Number(n.lineHeight),Number(n.maxCharSize)),a=n.message.map((l,c)=>{if(l.char===void 0){let h=t.textLines[s].message[c];if("geometries"in h){let p=h.geometries[0].userData.parameters;Object.assign(l,{LOD:p.lod,char:p.char,fontFamily:p.fontFamily,fontSize:p.fontSize,letterSpacing:p.letterSpacing,originalChar:p.char})}}let u={char:l.char,fontFamily:l.fontFamily,letterSpacing:Number(l.letterSpacing),fontSize:Number(l.fontSize),LOD:l.LOD},d=new en(u,r.clone());return o.addChar3D(d,t.textOrigin),this.charContainer.add(d),d});return o.message=a,o}),this.userData.textFrame=t),this.textFullUpdate()}return this}fromTextFrameData(e,t){if(e.color!==void 0){let r=sr(e.color,t);this.updateColor(r),this.updateOpacity(r.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,t){return super.fromState(e),this.fromTextFrameData(e,t),this}convertToVector(){let{fontFamily:e,hexColor:t}=this.userData.textFrame,r=new ii;r.name="Text Shape";let n=en.fontCache[e];for(let s of this.charContainer.children)s instanceof en&&n.generateShapes(s.char,1).forEach(o=>{let a=new St().fromShape(o);a.applyScale(s.scale.x,s.scale.y);let l=jr.create({shape:a}),c=new sn({side:Yt});c.color=t;let u=new ua(l,c);u.name=s.char,u.position.copy(s.position),u.rotation.copy(s.rotation),r.attach(u)});return r}},$l=mv;$l.VerticalAlign=ws,$l.HorizontalAlign=pn,$l.TextTransform=co;var KA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var Uu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var ez=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4144
4144
|
uniform mediump sampler2D inputBuffer;
|
|
4145
4145
|
#else
|
|
@@ -4414,4 +4414,4 @@ vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord
|
|
|
4414
4414
|
#else
|
|
4415
4415
|
float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset));
|
|
4416
4416
|
#endif
|
|
4417
|
-
outputColor=vec4(color,inputColor.a);}`,vT=class extends ns{constructor(i={}){let e=Object.assign({blendFunction:pt.NORMAL,eskil:!1,offset:.5,darkness:.5},i);super("VignetteEffect",nU,{blendFunction:e.blendFunction,uniforms:new Map([["offset",new Te(e.offset)],["darkness",new Te(e.darkness)]])});this.eskil=e.eskil}get eskil(){return this.defines.has("ESKIL")}set eskil(i){this.eskil!==i&&(i?this.defines.set("ESKIL","1"):this.defines.delete("ESKIL"),this.setChanged())}},mse=[new Float32Array(3),new Float32Array(3)],gse=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],yse=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var vse=[new Float32Array(2),new Float32Array(2)];var xse=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),bse=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],wse=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Sse=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var Mse=new Map([[on(0,0,0,0),new Float32Array([0,0,0,0])],[on(0,0,0,1),new Float32Array([0,0,0,1])],[on(0,0,1,0),new Float32Array([0,0,1,0])],[on(0,0,1,1),new Float32Array([0,0,1,1])],[on(0,1,0,0),new Float32Array([0,1,0,0])],[on(0,1,0,1),new Float32Array([0,1,0,1])],[on(0,1,1,0),new Float32Array([0,1,1,0])],[on(0,1,1,1),new Float32Array([0,1,1,1])],[on(1,0,0,0),new Float32Array([1,0,0,0])],[on(1,0,0,1),new Float32Array([1,0,0,1])],[on(1,0,1,0),new Float32Array([1,0,1,0])],[on(1,0,1,1),new Float32Array([1,0,1,1])],[on(1,1,0,0),new Float32Array([1,1,0,0])],[on(1,1,0,1),new Float32Array([1,1,0,1])],[on(1,1,1,0),new Float32Array([1,1,1,0])],[on(1,1,1,1),new Float32Array([1,1,1,1])]]);function wv(i,e,t){return i+(e-i)*t}function on(i,e,t,r){let n=wv(i,e,1-.25),s=wv(t,r,1-.25);return wv(n,s,1-.125)}var xT=class extends Rn{load(i=()=>{},e=null){arguments.length===4?(i=arguments[1],e=arguments[3]):(arguments.length===3||typeof arguments[0]!="function")&&(i=arguments[1],e=null);let t=this.manager,r=new al;return new Promise((n,s)=>{let o=new Image,a=new Image;r.onError=l=>{t.itemError(l),e!==null?(e(`Failed to load ${l}`),n()):s(`Failed to load ${l}`)},r.onLoad=()=>{let l=[o,a];i(l),n(l)},o.addEventListener("error",l=>{r.itemError("smaa-search")}),a.addEventListener("error",l=>{r.itemError("smaa-area")}),o.addEventListener("load",()=>{t.itemEnd("smaa-search"),r.itemEnd("smaa-search")}),a.addEventListener("load",()=>{t.itemEnd("smaa-area"),r.itemEnd("smaa-area")}),t.itemStart("smaa-search"),t.itemStart("smaa-area"),r.itemStart("smaa-search"),r.itemStart("smaa-area"),o.src=mT,a.src=gT})}};var Mr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=pt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=re({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var ku=class extends Mr{constructor(){super(aT);this.blendFunction=pt.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var Vu=class extends Mr{constructor(){super(lT)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var Hu=class extends Mr{constructor(){super(uT);this.effect.offset=new F(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var ju=class extends Mr{constructor(){super(cT)}};var Wu=class extends Mr{constructor(){super(dT);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var Ju=class extends Mr{constructor(){super(fT);this.blendFunction=pt.OVERLAY}};var qu=class extends Mr{constructor(){super(vT)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var Xu=class extends Mr{constructor(e){super(hT,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var Yu=class extends Mr{constructor(){super(pT)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function bT(i,e){return e&&e.enabled&&i.push(e.effect),i}var xp=class{constructor(){this._scene=new Gr;this._camera=new ni;this.effects=new Map;this.loadingManager=new al;this.smaaImageLoader=new xT(this.loadingManager);this.renderPass=new xv;this._renderToScreen=!0;this._hasSmaa=!1;this.search=null;this.area=null;this.clock=new eg,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new ku),this.effects.set("chromaticAberration",new Hu),this.effects.set("vignette",new qu),this.effects.set("noise",new Ju),this.effects.set("colorAverage",new ju),this.effects.set("hueSaturation",new Wu),this.effects.set("brightnessContrast",new Vu),this.effects.set("depthOfField",new Xu),this.effects.set("pixelation",new Yu),this.smaaPromise=this.loadSmaaImages()}get scene(){return this._scene}set scene(e){this._scene=e}get camera(){return this._camera}set camera(e){this._camera=e}loadSmaaImages(){return new Promise(e=>{this.smaaImageLoader.load(([t,r])=>{this.search=t,this.area=r,e()})})}async _initSmaa(){if(!this.effectComposer)return;let e=this.effectComposer.passes.length;(!this.area||!this.search)&&await this.smaaPromise;let t=new yT(this.search,this.area,ha.ULTRA,yp.COLOR);t.edgeDetectionMaterial.setPredicationMode(eT.DEPTH),t.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),t.edgeDetectionMaterial.setPredicationThreshold(.002),t.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new vp(this.camera,t),e),this._hasSmaa=!0}async _initPasses(){if(!(!this.effectComposer||!this.renderer))if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new xv(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),await this._initSmaa();let e=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(bT,[]),t=[this.effects.get("pixelation")].reduce(bT,[]);t.length>0&&this.effectComposer.addPass(new vp(this.camera,...t)),this.effectComposer.addPass(new vp(this.camera,...e))}else this.effectComposer.addPass(this.renderPass)}async reinit(){!this.renderer||(this.effectComposer=new oT(this.renderer),await this._initPasses())}async init({renderer:e,camera:t,scene:r}){this.renderer=e,this.scene=r,this.camera=t,this._initSavePass(),await this.reinit()}_initSavePass(){if(this._savePass)return;let e=new F;this.renderer.getDrawingBufferSize(e);let t=this.renderer.capabilities.isWebGL2?Gs:xt;this._rt=new t(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Os,wrapT:Os}),this._savePass=new rT(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){var r,n;let t=this.effectComposer;!t||(e===!0?(((r=this.renderer)==null?void 0:r.capabilities.isWebGL2)&&(t.multisampling=0),t.removePass(this._savePass),t.passes[t.passes.length-1].renderToScreen=!0,t.autoRenderToScreen=!0):(((n=this.renderer)==null?void 0:n.capabilities.isWebGL2)&&!this._hasSmaa&&(t.multisampling=4),t.autoRenderToScreen=!1,t.passes[t.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,t.addPass(this._savePass)),this._renderToScreen=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(e){e&&(Object.keys(e).forEach(t=>{let r=e[t],n=this.effects.get(t);Object.keys(r).forEach(s=>{n[s]=r[s]})}),this.enabled=e.enabled)}toJSON(){let e={};return this.effects.forEach((t,r)=>{e[r]=t.toJSON()},e),re({enabled:this.enabled},e)}render(){var e;(e=this.effectComposer)==null||e.render(this.clock.getDelta())}setScissor(e,t,r,n){if(!this.effectComposer||!this.renderer)return;e instanceof Qe?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,r,n),this.effectComposer.outputBuffer.scissor.set(e,t,r,n));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,r,n)}setScissorTest(e){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e))}setViewport(e,t,r,n){!this.effectComposer||(e instanceof Qe?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,r,n),this.effectComposer.outputBuffer.viewport.set(e,t,r,n)))}resize(e,t){var r,n;if((r=this.effectComposer)==null||r.setSize(e,t),this._rt){let s=((n=this.renderer)==null?void 0:n.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(e*s,t*s)}}dispose(){var e;(e=this.effectComposer)==null||e.dispose()}};function wT(i,e){return iU(i)}function iU(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let t=St.createFromState(i.shape,i.width,i.height);e.shape=t}else i.type==="NonParametricGeometry"&&(e.geometry=new Ho().parse(i));return Rf(e)}var AT=Hv(MT());var Sv;Df.then(i=>{Sv=i});var TT=new Me,sU=new Me,oU=new Me,Ei=new rr,wo=new A,aU=new Me,lU=new Me,da=class extends Lr{constructor(e,t,r,n=new $n){super(r!=null?r:t,n);this.subdivPointer=e;this.originalGeometry=t;this.subdividedGeometry=r;this.objectType="SubdivObject";this.hiddenMatrixOld=new Me;this.smoothShading=!0;this.matrixWorldRigid=new Me;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,t,r){let{subdivPointer:n,originalGeometry:s,subdividedGeometry:o}=Kn.build(t.geometry,void 0,void 0,!t.flatShading),a=yo(t.material,r),l=new da(n,s,o||void 0,a);return l.calcBoundingBox(),l.freeSubdivPointer(),l.uuid=e,l.fromState(t),l}shallowClone(e){return new Gu(this.geometry,this.material).shallowCopy(this,e)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="SubdivObject",t}buildFromStore(e){var s,o,a;let{originalGeometry:t,subdividedGeometry:r,subdivPointer:n}=Kn.build(e,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=n,t!==void 0&&((s=this.originalGeometry)==null||s.dispose(),this.originalGeometry=t),r!==void 0&&((o=this.subdividedGeometry)==null||o.dispose(),this.subdividedGeometry=r!=null?r:void 0),this.geometry=(a=this.subdividedGeometry)!=null?a:this.originalGeometry,this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry;e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Kn.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Kn.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){var e;this.originalGeometry.dispose(),this.originalGeometry=Kn.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Kn.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(e=this.subdividedGeometry)!=null?e:this.originalGeometry}raycast(e,t){var r;this.geometry=this.originalGeometry,Lr.prototype.raycast.call(this,e,t),this.geometry=(r=this.subdividedGeometry)!=null?r:this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:r,v:n,q:s}=(0,AT.SVD)(t),o=TT.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),a=sU.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),l=oU.copy(a).transpose();this.shearScale=aU.makeScale(s[0],s[1],s[2]).multiply(l).premultiply(a),this.shearScaleInv=lU.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(o,l),s.every(c=>Math.abs(s[0]-c)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new ln);let t=e.attributes.position,r=e.boundingSphere.center;Ei.setFromBufferAttribute(t),Ei.getCenter(r),e.boundingSphere.radius=r.distanceTo(Ei.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ei.getSize(wo);let n={width:wo.x,height:wo.y,depth:wo.z};return this.geometry.userData.parameters=n,n}updateBoundingBox(e){let t=this.originalGeometry;Ei.min.set(e[0],e[2],e[4]),Ei.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(Ei.min.applyMatrix4(this.shearScaleInv),Ei.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new ln);let r=t.boundingSphere.center;Ei.getCenter(r),t.boundingSphere.radius=r.distanceTo(Ei.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ei.getSize(wo);let n={width:wo.x,height:wo.y,depth:wo.z};return this.geometry.userData.parameters=n,n}freeSubdivPointer(){this.subdivPointer&&(Sv.free_bvh(this.subdivPointer),Sv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,_T(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(_T(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=re({},e.parameters)}};function _T(i,e,t,r){let n=i.position.array,s=i.normal.array,o=TT.makeScale(e,t,r).invert().elements,a,l,c;for(var u=0,d=n.length;u<d;u+=3)n[u]*=e,n[u+1]*=t,n[u+2]*=r,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c}function ET(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===Dl.Front?i.side=oi:e.side===Dl.Back?i.side=zt:i.side=Yt)}function cU(i,e){if(Array.isArray(i.material))for(let t of i.material)ET(t,e);else{let t=i.material;ET(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function CT(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=da.createFromState(i,e,t);else{let n=wT(e.geometry,t),s="materials"in e?eA(e.materials,t):yo(e.material,t);hf.is2DParametricMesh(n.userData.type)?r=new Bu(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new ua(n,s):e.geometry.type==="NonParametricGeometry"?r=new Gu(n,Array.isArray(s)?s.length>1?s:s[0]:s):r=new Fu(n,s),r.uuid=i,r.fromState(e)}return cU(r,e),r}function LT(i,e,t){return e.type==="Mesh"?CT(i,e,t):e.type==="TextFrame"?$l.createFromState(i,e,t):e.type==="Empty"?ii.createFromState(i,e):e.type==="PointLight"?Ru.createFromState(i,e,t):e.type==="SpotLight"?Ou.createFromState(i,e,t):e.type==="DirectionalLight"?Du.createFromState(i,e,t):so.is(e.type)?ni.createFromState(i,e):(console.error(e),new ii)}function uU(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function NT(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType(at.TRANSMISSION);return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>uU(i,s))):e.layers.set(0),r}function PT(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof Lr)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)NT(i,r,r.material[n])&&(t=!0);else NT(i,r,r.material)&&(t=!0)}),t}function IT(i,e){"material"in i&&hU(i.material,e),"geometry"in i&&i.geometry.dispose()}function hU(i,e){Bb(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var DT=new A,Mv=class extends lp(Gr){constructor(e,t){super();this.objectType="Scene";this.alpha=1;this.backupFog=new Xa(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new ve(1,0,0);this.bgColor=new ve(1,1,1);this.entityByUuid={};this.postprocessing=new xp,this.ambientLight=new Vo(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.init(e,t)}needsTransmission(e){return this.needsTransmissionDirty&&(this._needsTransmission=PT(e,this),e!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(e){if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,t){if(this.initPostprocessing(e.postprocessing),this.createChildrenObjects(e.objects,this,t),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(sr(e.backgroundColor,t)),this.updateFog(e.fog,t),this.updateAmbientLight(e.environment.ambientLight,t),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let r=this.find(e.publish.playCamera);r instanceof ni&&this.switchActiveCamera(r)}}initPostprocessing(e){let n=e,{enabled:t}=n,r=kv(n,["enabled"]);for(let s of Object.entries(r)){let o=s[1],a=this.postprocessing.effects.get(s[0]);if(a){a.enabled=o.enabled;for(let[l,c]of Object.entries(o))a[l]=c}}this.postprocessing.enabled=t,this.postprocessing.reinit()}clearScene(e){this.traverseEntity(t=>{IT(t,e)});for(let t of this.children)En(t)&&t.removeFromParent()}resetAfterClear(e,t){this.init(e,t)}createPersonalCamera(){let e=ni.createFromState(Mv.PERSONAL_CAMERA_ID,xe(re({},ff.defaultData),{name:"personal"}));return e.enableHelper=!1,e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let t=[],r=n=>{for(let s of n.children)En(s)&&!s.raycastLock&&s.visible&&((Bf(s)||Ss(s)&&s.enableHelper&&s.objectHelper.parent)&&e.intersectObject(s,!1,t),r(s))};return r(this),t}traverseEntity(e){for(let t of this.children)En(t)&&t.traverseEntity(e)}updateFog(e,t){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=sr(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){return{}}fromJSON(e){return this}dispose(){this.traverseEntity(e=>{"geometry"in e&&e.geometry.dispose(),"material"in e&&(e.material instanceof Array?e.material.forEach(t=>t.dispose()):e.material.dispose())}),this.postprocessing.dispose()}updateAmbientLight(e,t){H1(this.ambientLight,e,t),e.groundColor!==void 0&&(this.ambientLight.groundColor=sr(e.groundColor,t)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=e,this.postprocessing.camera=e,e.enableHelper=!1}setBackgroundColor(e){this.bgColor=e,this.alpha=e.a}createChildrenObjects(e,t,r){for(let n of e)this.createChildObject(n.id,n.data,n.children,t,r)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createChildObject(e,t,r,n,s){let o=LT(e,t,s);return o&&(this.entityByUuid[e]=o,n.add(o),this.createChildrenObjects(r,o,s)),o}getCenter(e){let t=[];for(let n=0,s=e.length;n<s;++n){let{id:o,recursive:a}=e[n],l=this.find(o),c=a?l.recursiveBBox:l.singleBBox;t.push(...c.vertices)}let r=new rr;return r.setFromPoints(t),r.getCenter(DT),DT}copyMatrixWorld(e,t){if(e===null){t.identity();return}let r=this.find(e);r?t.copy(r.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){var n;if(e===null){t.identity();return}let r=(n=this.find(e))==null?void 0:n.parent;r?t.copy(r.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof Lr)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)e(t.material[r]);else e(t.material)})}updateCanvasSize(e,t){this.activeCamera.setViewplaneSize(e,t);let r,n;e>=t?(r=t/e,n=1):(r=1,n=e/t),this.traverseMaterial(s=>{s.layersList.getLayersOfType(at.TRANSMISSION).forEach(a=>{a.uniforms[`f${a.id}_aspectRatio`].value.x=r,a.uniforms[`f${a.id}_aspectRatio`].value.y=n})})}},wp=Mv;wp.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var Av=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._enableEvent={};this._map={};this._prevAncestors=[];this._raycaster=new oy;this._intersection=new A;this._plane=new xn;this._normal=new A;this._position=new A;this._onMouseDown=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()};this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()};this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()};this._onWheel=e=>{this._handleWheelEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)};this._onTouchMove=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)};this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)};this._domElement=e,this._scene=t,this._camera=r,this._app=n}activate(){this.isEnable=!0,this._scene.traverseEntity(e=>{if(e.interaction!==void 0){e.interaction.start();for(let t of e.interaction.events){let r=t.type;this._addCustomEvent(r,e),this._enableEvent[r]=!0,(r===Je.KEY_DOWN||r===Je.KEY_UP||r===Je.START||r===Je.LOOK_AT||r===Je.FOLLOW||r===Je.SCROLL)&&(this._map[r]===void 0&&(this._map[r]=[]),this._map[r].push(e))}}}),this._enableEvent[Je.START]!==void 0&&this._handleStartEvent(),this._enableEvent[Je.MOUSE_DOWN]!==void 0&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),this._enableEvent[Je.MOUSE_UP]!==void 0&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),(this._enableEvent[Je.MOUSE_HOVER]!==void 0||this._enableEvent[Je.LOOK_AT]!==void 0||this._enableEvent[Je.FOLLOW]!==void 0)&&(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),this._enableEvent[Je.KEY_DOWN]!==void 0&&document.addEventListener("keydown",this._onKeyDown,!1),this._enableEvent[Je.KEY_UP]!==void 0&&document.addEventListener("keyup",this._onKeyUp,!1),this._enableEvent[Je.SCROLL]!==void 0&&this._domElement.addEventListener("wheel",this._onWheel,!1)}deactivate(){this._scene.traverseEntity(e=>{e.interaction!==void 0&&e.interaction.end(),e.interaction.cache=void 0}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{e.interaction.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect();return{x:(e-r.left)/r.width*2-1,y:-((t-r.top)/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map[Je.START])==null||e.forEach(t=>{var r;(r=t.interactionCache.start)==null||r.dispatch()})}_handleWheelEvent(e){var t;(t=this._map[Je.SCROLL])==null||t.forEach(r=>{var n;(n=r.interactionCache.scroll)==null||n.dispatch(e.deltaY>0?1:-1)})}_handleMouseDownEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseDown",s.uuid),(t=s.interactionCache.mouseDown)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseDown",o.uuid),(a=o.interactionCache.mouseDown)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseUpEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseUp",s.uuid),(t=s.interactionCache.mouseUp)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseUp",o.uuid),(a=o.interactionCache.mouseUp)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,r;if(this._enableEvent[Je.MOUSE_HOVER]!==void 0){let n;if(!e){let o=this._raycastMesh(this._raycaster).find(a=>!a.object.interactionCache.follow);n=o?o.object:void 0}if(this._prevObject!==n){this._prevObject!==void 0&&((t=this._prevObject.interactionCache.mouseHover)==null||t.dispatchReverse()),n!==void 0&&(this._dispatchDOMCustomEvent("mouseHover",n.uuid),(r=n.interactionCache.mouseHover)==null||r.dispatch());let s=[];n==null||n.traverseAncestors(l=>{l instanceof ii&&l.interactionCache.mouseHover&&s.push(l)}),this._prevAncestors.filter(l=>{var c;return s.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatchReverse(),!0)});let o=s.filter(l=>{var c;return this._prevAncestors.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatch(),!0)}),a=this._prevAncestors.filter(l=>s.includes(l));this._prevAncestors=[...a,...o]}this._prevObject=n}}_handleLookAtEvent(){var e;(e=this._map[Je.LOOK_AT])==null||e.forEach(t=>{var n;let r=(n=t.interactionCache.lookAt)==null?void 0:n.distance;this._dispatchDOMCustomEvent("lookAt",t.uuid),r!==void 0&&(this._plane.set(this._normal,-r),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.lookAt(this._intersection))}),this._app.requestRender()}_handleFollowEvent(){var e;(e=this._map[Je.FOLLOW])==null||e.forEach(t=>{this._dispatchDOMCustomEvent("follow",t.uuid),this._plane.setFromNormalAndCoplanarPoint(this._normal,t.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.follow(this._intersection)}),this._app.requestRender()}_handleKeyDownEvent(e){var t;(t=this._map[Je.KEY_DOWN])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyDown)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyDown",r.uuid),n==null||n.dispatch()})}_handleKeyUpEvent(e){var t;(t=this._map[Je.KEY_UP])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyUp)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyUp",r.uuid),n==null||n.dispatch()})}_raycastMesh(e){let t=[],r=n=>{for(let s of n.children)En(s)&&!s.raycastLock&&s.visible&&(kA(s)&&e.intersectObject(s,!1,t),r(s))};return r(this._scene),t}_addCustomEvent(e,t){let r=(()=>{switch(e){case 0:return"mouseDown";case 1:return"mouseUp";case 2:return"mouseHover";case 5:return"keyDown";case 6:return"keyUp";case 7:return"start";case 9:return"lookAt";case 10:return"follow"}})();if(r){let n=new CustomEvent(r,{bubbles:!0});Object.defineProperty(n,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[r]?this.splineEvents[r][t.uuid]=n:this.splineEvents[r]={[t.uuid]:n}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var Tv=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new F().copy(r),this._editorSize=new F().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=dU(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function dU(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var RT=new sn,ec=class extends tn{},Qu=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new xt(2048,2048,{generateMipmaps:!0,minFilter:Li,magFilter:tt,wrapS:ar,wrapT:ar}),this.transmissionRenderTarget.depthTexture=new fs(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ky(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===RT}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:RT}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new ec(t.r,t.g,t.b,t.a):this.colors[e]=new ec(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function fU(i,e){switch(i.type){case at.NOISE:return e==="noiseType";case at.TEXTURE:return e==="projection"||e==="axis";case at.DISPLACE:return e==="noiseType";default:return!1}}function _v(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||ep(a,t,n))continue;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Lt:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof ec?c.value=new tn(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case Xi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof ec?c.value=new tn(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Jr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case qr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case rn:{let u=l;"image"in u&&(c.value.image=e.getImage(u.image)),"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&(c.value.repeat=u.repeat),"offset"in u&&(c.value.offset=u.offset),c.value.needsUpdate=!0;break}case go:{l.forEach((u,d)=>{c.value[d].setX(u[0]),c.value[d].setY(u[1]),c.value[d].setZ(u[2]),c.value[d].setW(u[3])});break}default:{s=s||fU(t,a),c.value=l;break}}}if(s&&n){let a=$f({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,re({},a)),r.dispose(),r.needsUpdate=!0}}function OT(i,e,t){var n;let r=[];i.objects.traverse((s,o)=>{var c;if(o.states===void 0)return;let a=e.find(s),l=a.interaction=new xo(a);pU(a,o,null,t),l.states.push(Qi.create(s,o,t));for(let u of o.states){let d=nu.patch(o,u.data);l.states.push(Qi.create(u.id,d,t))}if(o.events)for(let u of o.events){let d=u.data,h=new vo(d.type);if("key"in d&&(h.key=d.key),"url"in d&&(h.url=(c=d.url)!=null?c:void 0),"distance"in d&&(h.distance=d.distance),"steps"in d&&(h.steps=d.steps),"targets"in d)for(let{data:p}of d.targets){let f=Ts.create(p);p.object?(f.object=e.find(p.object),r.push([f,p.object,p.state])):f.object=void 0,h.addTarget(f)}l.events.push(h)}});for(let[s,o,a]of r){let l=e.find(o);l&&(a?s.state=(n=l.interaction.states.find(c=>c.uuid===a))!=null?n:l.interaction.states[0]:s.state=l.interaction.states[0])}}function pU(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:nu.patch(e,e.states.data(t));if(_y(i,s),i instanceof ni&&so.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}else if(i instanceof Lr&&s.type==="Mesh"){if(i instanceof da?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);_v(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);_v(c.data,r,u,i.material[o],c.data)}}o++}}}else s.type==="DirectionalLight"?i.fromDirectionalLightState(s,r):s.type==="PointLight"?i.fromPointLightState(s,r):s.type==="SpotLight"&&i.fromSpotLightState(s,r)}var Ev=class{constructor(e){this.sharedAssets=new Qu(e.shared),this.scene=new wp(e.scene,this.sharedAssets)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.clearScene(this.sharedAssets),this.sharedAssets.dispose()}};var tc=".",Ku=Symbol("target"),Cv=Symbol("unsubscribe");function Zu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function BT(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var Vn=Array.isArray;function fa(i){return typeof i=="symbol"}var mU={after:(i,e)=>Vn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>Vn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=tc),fa(e)?i+e.toString():i+e):i,initial:i=>{if(Vn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(tc);return e===-1?"":i.slice(0,e)},last:i=>{if(Vn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(tc);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(Vn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(tc);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(tc,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},gn=mU;function Lv(i){return typeof i=="object"&&typeof i.next=="function"}function Nv(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[Ku].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function Sp(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&fa(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var Mp=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,gn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function rc(i){return toString.call(i)==="[object Object]"}function nc(){return!0}function So(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var Ap=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var gU=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),Pv={push:nc,pop:nc,shift:nc,unshift:nc,copyWithin:So,reverse:So,sort:So,splice:So,flat:So,fill:So},FT=new Set([...Ap,...gU,...Object.keys(Pv)]);function ic(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var Iv=["keys","values","entries"],Dv=new Set(["has","toString"]),Rv={add:ic,clear:ic,delete:ic,forEach:ic},GT=new Set([...Dv,...Object.keys(Rv),...Iv]);function sc(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var yU=new Set([...Dv,"get"]),Ov={set:sc,clear:sc,delete:sc,forEach:sc},zT=new Set([...yU,...Object.keys(Ov),...Iv]);var Yr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return Ap.has(e)}_shallowClone(e){let t=e;if(rc(e))t=re({},e);else if(Vn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(Vn(n)?this._onIsChanged=Pv[t]:n instanceof Set?this._onIsChanged=Rv[t]:n instanceof Map&&(this._onIsChanged=Ov[t]),n):r}update(e,t,r){let n=gn.after(e,this._path);if(t!=="length"){let s=this.clone;gn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],gn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var $u=class extends Yr{static isHandledMethod(e){return FT.has(e)}};var Tp=class extends Yr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var eh=class extends Yr{static isHandledMethod(e){return GT.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var th=class extends Yr{static isHandledMethod(e){return zT.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var _p=class extends Yr{constructor(e,t,r,n){super(void 0,t,r,n);this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var Ep=class extends Yr{constructor(e,t,r,n){super(void 0,t,r,n);this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var is=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return rc(e)||Vn(e)||Zu(e)}static isHandledMethod(e,t){return rc(e)?Yr.isHandledMethod(t):Vn(e)?$u.isHandledMethod(t):e instanceof Set?eh.isHandledMethod(t):e instanceof Map?th.isHandledMethod(t):Zu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Yr;Vn(e)?n=$u:e instanceof Date?n=Tp:e instanceof Set?n=eh:e instanceof Map?n=th:e instanceof WeakSet?n=_p:e instanceof WeakMap&&(n=Ep),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=is.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var vU={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Bv=(i,e,t={})=>{t=re(re({},vU),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new Mp(n),c=typeof t.onValidate=="function",u=new is(c),d=(m,x,b,w,T)=>!c||u.isCloning||t.onValidate(gn.concat(l.getPath(m),x),b,w,T)===!0,h=(m,x,b,w)=>{!Sp(l,t,x)&&!(o&&l.isDetached(m,i))&&p(l.getPath(m),x,b,w)},p=(m,x,b,w,T)=>{u.isCloning?u.update(m,x,w):e(gn.concat(m,x),b,w,T)},f=m=>m&&(m[r]||m),g=(m,x,b,w)=>BT(m)||b==="constructor"||s&&!is.isHandledMethod(x,b)||Sp(l,t,b)||l.isGetInvariant(x,b)||o&&l.isDetached(x,i)?m:(w===void 0&&(w=l.getPath(x)),l.getProxy(m,gn.concat(w,b),v,r)),v={get(m,x,b){if(fa(x)){if(x===r||x===Ku)return m;if(x===Cv&&!l.isUnsubscribed&&l.getPath(m).length===0)return l.unsubscribe(),m}let w=Zu(m)?Reflect.get(m,x):Reflect.get(m,x,b);return g(w,m,x)},set(m,x,b,w){b=f(b);let T=m[r]||m,S=T[x];if(n(S,b)&&x in m)return!0;let M=d(m,x,b,S);return M&&l.setProperty(T,x,b,w,S)?(h(m,x,m[x],S),!0):!M},defineProperty(m,x,b){if(!l.isSameDescriptor(b,m,x)){let w=m[x];d(m,x,b.value,w)&&l.defineProperty(m,x,b,w)&&h(m,x,b.value,w)}return!0},deleteProperty(m,x){if(!Reflect.has(m,x))return!0;let b=Reflect.get(m,x),w=d(m,x,void 0,b);return w&&l.deleteProperty(m,x,b)?(h(m,x,void 0,b),!0):!w},apply(m,x,b){let w=x[r]||x;if(l.isUnsubscribed)return Reflect.apply(m,w,b);if((a===!1||a!==!0&&!a.includes(m.name))&&is.isHandledType(w)){let T=gn.initial(l.getPath(m)),S=is.isHandledMethod(w,m.name);u.start(w,T,b);let M=Reflect.apply(m,u.preferredThisArg(m,x,w),S?b.map(_=>f(_)):b),E=u.isChanged(w,n),C=u.stop();if(is.isHandledType(M)&&S&&(x instanceof Map&&m.name==="get"&&(T=gn.concat(T,b[0])),M=l.getProxy(M,T,v)),E){let _={name:m.name,args:b,result:M},O=u.isCloning?gn.initial(T):T,P=u.isCloning?gn.last(T):"";d(gn.get(i,O),P,w,C,_)?p(O,P,w,C,_):u.undo(w)}return(x instanceof Map||x instanceof Set)&&Lv(M)?Nv(M,m,x,T,g):M}return Reflect.apply(m,x,b)}},y=l.getProxy(i,t.pathAsArray?[]:"",v);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};Bv.target=i=>i&&i[Ku]||i;Bv.unsubscribe=i=>i[Cv]||i;var Fv=Bv;var Mo;(function(t){t[t.FULLSCREEN=1]="FULLSCREEN",t[t.CUSTOM=2]="CUSTOM"})(Mo||(Mo={}));var xU=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var t;if(!this._renderer)return;this._rafId=requestAnimationFrame(this.render);let e=xo.isAllAnimationsEnded;!this.autoRender&&this._skipRender&&(e===void 0||e)||(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),((t=this._scene.postprocessing)==null?void 0:t.enabled)?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))))};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new F(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),((t=this._scene)==null?void 0:t.postprocessing)&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",qc(this.resize,200))}async load(e){let r=await(await fetch(e,{credentials:"include",mode:"no-cors"})).arrayBuffer();this.start(r)}start(e){var a;let t=tf.deserialize(new Uint8Array(e));this._publishData=t.scene.publish;let n=new Ev(t).scene;this._scene=n,this._sharedAssetsManager=new Qu(t.shared),this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},OT(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let s=Object.values(t.frames)[0];s&&(s.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=s.size[0],this._viewportHeight=s.size[1])),((a=this._scene.postprocessing)==null?void 0:a.enabled)?(this._renderer=new _t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}).then(this.requestRender)):this._renderer=new _t({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new xt(2048,2048,{generateMipmaps:!0,minFilter:Li,magFilter:tt,wrapS:ar,wrapT:ar}),this._transmissionRenderTarget.depthTexture=new fs(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Lp,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new Tv(this._renderer,this._camera,new F(this._viewportWidth,this._viewportHeight),new F(window.innerWidth,window.innerHeight)),!0&&(this._controls=new ny(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new Av(this._renderer.domElement,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}dispose(){var e,t,r,n,s,o,a;(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{Fv.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatch()}):s==null||s.dispatch()},emitEventReverse(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatchReverse()}):s==null||s.dispatchReverse()}},r=Fv(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender()});return this._proxyObjectCache.set(e.uuid,r),r}};en.FONTS_PATH="_assets/_fonts/";export{xU as Application};
|
|
4417
|
+
outputColor=vec4(color,inputColor.a);}`,vT=class extends ns{constructor(i={}){let e=Object.assign({blendFunction:pt.NORMAL,eskil:!1,offset:.5,darkness:.5},i);super("VignetteEffect",nU,{blendFunction:e.blendFunction,uniforms:new Map([["offset",new Te(e.offset)],["darkness",new Te(e.darkness)]])});this.eskil=e.eskil}get eskil(){return this.defines.has("ESKIL")}set eskil(i){this.eskil!==i&&(i?this.defines.set("ESKIL","1"):this.defines.delete("ESKIL"),this.setChanged())}},mse=[new Float32Array(3),new Float32Array(3)],gse=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],yse=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var vse=[new Float32Array(2),new Float32Array(2)];var xse=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),bse=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],wse=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Sse=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var Mse=new Map([[on(0,0,0,0),new Float32Array([0,0,0,0])],[on(0,0,0,1),new Float32Array([0,0,0,1])],[on(0,0,1,0),new Float32Array([0,0,1,0])],[on(0,0,1,1),new Float32Array([0,0,1,1])],[on(0,1,0,0),new Float32Array([0,1,0,0])],[on(0,1,0,1),new Float32Array([0,1,0,1])],[on(0,1,1,0),new Float32Array([0,1,1,0])],[on(0,1,1,1),new Float32Array([0,1,1,1])],[on(1,0,0,0),new Float32Array([1,0,0,0])],[on(1,0,0,1),new Float32Array([1,0,0,1])],[on(1,0,1,0),new Float32Array([1,0,1,0])],[on(1,0,1,1),new Float32Array([1,0,1,1])],[on(1,1,0,0),new Float32Array([1,1,0,0])],[on(1,1,0,1),new Float32Array([1,1,0,1])],[on(1,1,1,0),new Float32Array([1,1,1,0])],[on(1,1,1,1),new Float32Array([1,1,1,1])]]);function wv(i,e,t){return i+(e-i)*t}function on(i,e,t,r){let n=wv(i,e,1-.25),s=wv(t,r,1-.25);return wv(n,s,1-.125)}var xT=class extends Rn{load(i=()=>{},e=null){arguments.length===4?(i=arguments[1],e=arguments[3]):(arguments.length===3||typeof arguments[0]!="function")&&(i=arguments[1],e=null);let t=this.manager,r=new al;return new Promise((n,s)=>{let o=new Image,a=new Image;r.onError=l=>{t.itemError(l),e!==null?(e(`Failed to load ${l}`),n()):s(`Failed to load ${l}`)},r.onLoad=()=>{let l=[o,a];i(l),n(l)},o.addEventListener("error",l=>{r.itemError("smaa-search")}),a.addEventListener("error",l=>{r.itemError("smaa-area")}),o.addEventListener("load",()=>{t.itemEnd("smaa-search"),r.itemEnd("smaa-search")}),a.addEventListener("load",()=>{t.itemEnd("smaa-area"),r.itemEnd("smaa-area")}),t.itemStart("smaa-search"),t.itemStart("smaa-area"),r.itemStart("smaa-search"),r.itemStart("smaa-area"),o.src=mT,a.src=gT})}};var Mr=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=pt.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t=re({},this),r=Object.getPrototypeOf(this),n=Object.getOwnPropertyNames(r);for(let s of n){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var ku=class extends Mr{constructor(){super(aT);this.blendFunction=pt.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var Vu=class extends Mr{constructor(){super(lT)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var Hu=class extends Mr{constructor(){super(uT);this.effect.offset=new F(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var ju=class extends Mr{constructor(){super(cT)}};var Wu=class extends Mr{constructor(){super(dT);this._hue=0}set hue(e){this._hue=e,this.effect.setHue(e)}get hue(){return this._hue}set saturation(e){this.effect.uniforms.get("saturation").value=e}get saturation(){return this.effect.uniforms.get("saturation").value}};var Ju=class extends Mr{constructor(){super(fT);this.blendFunction=pt.OVERLAY}};var qu=class extends Mr{constructor(){super(vT)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var Xu=class extends Mr{constructor(e){super(hT,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var Yu=class extends Mr{constructor(){super(pT)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function bT(i,e){return e&&e.enabled&&i.push(e.effect),i}var xp=class{constructor(){this._scene=new Gr;this._camera=new ni;this.effects=new Map;this.loadingManager=new al;this.smaaImageLoader=new xT(this.loadingManager);this.renderPass=new xv;this._renderToScreen=!0;this._hasSmaa=!1;this.search=null;this.area=null;this.clock=new eg,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new ku),this.effects.set("chromaticAberration",new Hu),this.effects.set("vignette",new qu),this.effects.set("noise",new Ju),this.effects.set("colorAverage",new ju),this.effects.set("hueSaturation",new Wu),this.effects.set("brightnessContrast",new Vu),this.effects.set("depthOfField",new Xu),this.effects.set("pixelation",new Yu),this.smaaPromise=this.loadSmaaImages()}get scene(){return this._scene}set scene(e){this._scene=e}get camera(){return this._camera}set camera(e){this._camera=e}loadSmaaImages(){return new Promise(e=>{this.smaaImageLoader.load(([t,r])=>{this.search=t,this.area=r,e()})})}async _initSmaa(){if(!this.effectComposer)return;let e=this.effectComposer.passes.length;(!this.area||!this.search)&&await this.smaaPromise;let t=new yT(this.search,this.area,ha.ULTRA,yp.COLOR);t.edgeDetectionMaterial.setPredicationMode(eT.DEPTH),t.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),t.edgeDetectionMaterial.setPredicationThreshold(.002),t.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new vp(this.camera,t),e),this._hasSmaa=!0}async _initPasses(){if(!(!this.effectComposer||!this.renderer))if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new xv(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),await this._initSmaa();let e=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(bT,[]),t=[this.effects.get("pixelation")].reduce(bT,[]);t.length>0&&this.effectComposer.addPass(new vp(this.camera,...t)),this.effectComposer.addPass(new vp(this.camera,...e))}else this.effectComposer.addPass(this.renderPass)}async reinit(){!this.renderer||(this.effectComposer=new oT(this.renderer),await this._initPasses())}async init({renderer:e,camera:t,scene:r}){this.renderer=e,this.scene=r,this.camera=t,this._initSavePass(),await this.reinit()}_initSavePass(){if(this._savePass)return;let e=new F;this.renderer.getDrawingBufferSize(e);let t=this.renderer.capabilities.isWebGL2?Gs:xt;this._rt=new t(e.x,e.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:Os,wrapT:Os}),this._savePass=new rT(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(e){var r,n;let t=this.effectComposer;!t||(e===!0?(((r=this.renderer)==null?void 0:r.capabilities.isWebGL2)&&(t.multisampling=0),t.removePass(this._savePass),t.passes[t.passes.length-1].renderToScreen=!0,t.autoRenderToScreen=!0):(((n=this.renderer)==null?void 0:n.capabilities.isWebGL2)&&!this._hasSmaa&&(t.multisampling=4),t.autoRenderToScreen=!1,t.passes[t.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,t.addPass(this._savePass)),this._renderToScreen=e)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(e){e&&(Object.keys(e).forEach(t=>{let r=e[t],n=this.effects.get(t);Object.keys(r).forEach(s=>{n[s]=r[s]})}),this.enabled=e.enabled)}toJSON(){let e={};return this.effects.forEach((t,r)=>{e[r]=t.toJSON()},e),re({enabled:this.enabled},e)}render(){var e;(e=this.effectComposer)==null||e.render(this.clock.getDelta())}setScissor(e,t,r,n){if(!this.effectComposer||!this.renderer)return;e instanceof Qe?(this.effectComposer.inputBuffer.scissor.set(e.x,e.y,e.z,e.w),this.effectComposer.outputBuffer.scissor.set(e.x,e.y,e.z,e.w)):(this.effectComposer.inputBuffer.scissor.set(e,t,r,n),this.effectComposer.outputBuffer.scissor.set(e,t,r,n));let s=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(s),this.effectComposer.outputBuffer.scissor.multiplyScalar(s),this.renderer.setScissor(e,t,r,n)}setScissorTest(e){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=e,this.effectComposer.outputBuffer.scissorTest=e,this.renderer.setScissorTest(e))}setViewport(e,t,r,n){!this.effectComposer||(e instanceof Qe?(this.effectComposer.inputBuffer.viewport.copy(e),this.effectComposer.outputBuffer.viewport.copy(e)):(this.effectComposer.inputBuffer.viewport.set(e,t,r,n),this.effectComposer.outputBuffer.viewport.set(e,t,r,n)))}resize(e,t){var r,n;if((r=this.effectComposer)==null||r.setSize(e,t),this._rt){let s=((n=this.renderer)==null?void 0:n.getPixelRatio())||window.devicePixelRatio;this._rt.setSize(e*s,t*s)}}dispose(){var e;(e=this.effectComposer)==null||e.dispose()}};function wT(i,e){return iU(i)}function iU(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let t=St.createFromState(i.shape,i.width,i.height);e.shape=t}else i.type==="NonParametricGeometry"&&(e.geometry=new Ho().parse(i));return Rf(e)}var AT=Hv(MT());var Sv;Df.then(i=>{Sv=i});var TT=new Me,sU=new Me,oU=new Me,Ei=new rr,wo=new A,aU=new Me,lU=new Me,da=class extends Lr{constructor(e,t,r,n=new $n){super(r!=null?r:t,n);this.subdivPointer=e;this.originalGeometry=t;this.subdividedGeometry=r;this.objectType="SubdivObject";this.hiddenMatrixOld=new Me;this.smoothShading=!0;this.matrixWorldRigid=new Me;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,t,r){let{subdivPointer:n,originalGeometry:s,subdividedGeometry:o}=Kn.build(t.geometry,void 0,void 0,!t.flatShading),a=yo(t.material,r),l=new da(n,s,o||void 0,a);return l.calcBoundingBox(),l.freeSubdivPointer(),l.uuid=e,l.fromState(t),l}shallowClone(e){return new Gu(this.geometry,this.material).shallowCopy(this,e)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="SubdivObject",t}buildFromStore(e){var s,o,a;let{originalGeometry:t,subdividedGeometry:r,subdivPointer:n}=Kn.build(e,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=n,t!==void 0&&((s=this.originalGeometry)==null||s.dispose(),this.originalGeometry=t),r!==void 0&&((o=this.subdividedGeometry)==null||o.dispose(),this.subdividedGeometry=r!=null?r:void 0),this.geometry=(a=this.subdividedGeometry)!=null?a:this.originalGeometry,this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry;e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){Kn.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&Kn.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){var e;this.originalGeometry.dispose(),this.originalGeometry=Kn.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Kn.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(e=this.subdividedGeometry)!=null?e:this.originalGeometry}raycast(e,t){var r;this.geometry=this.originalGeometry,Lr.prototype.raycast.call(this,e,t),this.geometry=(r=this.subdividedGeometry)!=null?r:this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:r,v:n,q:s}=(0,AT.SVD)(t),o=TT.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),a=sU.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),l=oU.copy(a).transpose();this.shearScale=aU.makeScale(s[0],s[1],s[2]).multiply(l).premultiply(a),this.shearScaleInv=lU.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(o,l),s.every(c=>Math.abs(s[0]-c)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new ln);let t=e.attributes.position,r=e.boundingSphere.center;Ei.setFromBufferAttribute(t),Ei.getCenter(r),e.boundingSphere.radius=r.distanceTo(Ei.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ei.getSize(wo);let n={width:wo.x,height:wo.y,depth:wo.z};return this.geometry.userData.parameters=n,n}updateBoundingBox(e){let t=this.originalGeometry;Ei.min.set(e[0],e[2],e[4]),Ei.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(Ei.min.applyMatrix4(this.shearScaleInv),Ei.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new ln);let r=t.boundingSphere.center;Ei.getCenter(r),t.boundingSphere.radius=r.distanceTo(Ei.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Ei.getSize(wo);let n={width:wo.x,height:wo.y,depth:wo.z};return this.geometry.userData.parameters=n,n}freeSubdivPointer(){this.subdivPointer&&(Sv.free_bvh(this.subdivPointer),Sv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,_T(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(_T(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=re({},e.parameters)}};function _T(i,e,t,r){let n=i.position.array,s=i.normal.array,o=TT.makeScale(e,t,r).invert().elements,a,l,c;for(var u=0,d=n.length;u<d;u+=3)n[u]*=e,n[u+1]*=t,n[u+2]*=r,a=s[u],l=s[u+1],c=s[u+2],s[u]=o[0]*a+o[4]*l+o[8]*c,s[u+1]=o[1]*a+o[5]*l+o[9]*c,s[u+2]=o[2]*a+o[6]*l+o[10]*c}function ET(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===Dl.Front?i.side=oi:e.side===Dl.Back?i.side=zt:i.side=Yt)}function cU(i,e){if(Array.isArray(i.material))for(let t of i.material)ET(t,e);else{let t=i.material;ET(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function CT(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=da.createFromState(i,e,t);else{let n=wT(e.geometry,t),s="materials"in e?eA(e.materials,t):yo(e.material,t);hf.is2DParametricMesh(n.userData.type)?r=new Bu(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new ua(n,s):e.geometry.type==="NonParametricGeometry"?r=new Gu(n,Array.isArray(s)?s.length>1?s:s[0]:s):r=new Fu(n,s),r.uuid=i,r.fromState(e)}return cU(r,e),r}function LT(i,e,t){return e.type==="Mesh"?CT(i,e,t):e.type==="TextFrame"?$l.createFromState(i,e,t):e.type==="Empty"?ii.createFromState(i,e):e.type==="PointLight"?Ru.createFromState(i,e,t):e.type==="SpotLight"?Ou.createFromState(i,e,t):e.type==="DirectionalLight"?Du.createFromState(i,e,t):so.is(e.type)?ni.createFromState(i,e):(console.error(e),new ii)}function uU(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function NT(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType(at.TRANSMISSION);return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>uU(i,s))):e.layers.set(0),r}function PT(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof Lr)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)NT(i,r,r.material[n])&&(t=!0);else NT(i,r,r.material)&&(t=!0)}),t}function IT(i,e){"material"in i&&hU(i.material,e),"geometry"in i&&i.geometry.dispose()}function hU(i,e){Bb(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var DT=new A,Mv=class extends lp(Gr){constructor(e,t){super();this.objectType="Scene";this.alpha=1;this.backupFog=new Xa(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new ve(1,0,0);this.bgColor=new ve(1,1,1);this.entityByUuid={};this.postprocessing=new xp,this.ambientLight=new Vo(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.init(e,t)}needsTransmission(e){return this.needsTransmissionDirty&&(this._needsTransmission=PT(e,this),e!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(e){if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,t){if(this.initPostprocessing(e.postprocessing),this.createChildrenObjects(e.objects,this,t),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(sr(e.backgroundColor,t)),this.updateFog(e.fog,t),this.updateAmbientLight(e.environment.ambientLight,t),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let r=this.find(e.publish.playCamera);r instanceof ni&&this.switchActiveCamera(r)}}initPostprocessing(e){let n=e,{enabled:t}=n,r=kv(n,["enabled"]);for(let s of Object.entries(r)){let o=s[1],a=this.postprocessing.effects.get(s[0]);if(a){a.enabled=o.enabled;for(let[l,c]of Object.entries(o))a[l]=c}}this.postprocessing.enabled=t,this.postprocessing.reinit()}clearScene(e){this.traverseEntity(t=>{IT(t,e)});for(let t of this.children)En(t)&&t.removeFromParent()}resetAfterClear(e,t){this.init(e,t)}createPersonalCamera(){let e=ni.createFromState(Mv.PERSONAL_CAMERA_ID,xe(re({},ff.defaultData),{name:"personal"}));return e.enableHelper=!1,e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let t=[],r=n=>{for(let s of n.children)En(s)&&!s.raycastLock&&s.visible&&((Bf(s)||Ss(s)&&s.enableHelper&&s.objectHelper.parent)&&e.intersectObject(s,!1,t),r(s))};return r(this),t}traverseEntity(e){for(let t of this.children)En(t)&&t.traverseEntity(e)}updateFog(e,t){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=sr(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){return{}}fromJSON(e){return this}dispose(){this.traverseEntity(e=>{"geometry"in e&&e.geometry.dispose(),"material"in e&&(e.material instanceof Array?e.material.forEach(t=>t.dispose()):e.material.dispose())}),this.postprocessing.dispose()}updateAmbientLight(e,t){H1(this.ambientLight,e,t),e.groundColor!==void 0&&(this.ambientLight.groundColor=sr(e.groundColor,t)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=e,this.postprocessing.camera=e,e.enableHelper=!1}setBackgroundColor(e){this.bgColor=e,this.alpha=e.a}createChildrenObjects(e,t,r){for(let n of e)this.createChildObject(n.id,n.data,n.children,t,r)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createChildObject(e,t,r,n,s){let o=LT(e,t,s);return o&&(this.entityByUuid[e]=o,n.add(o),this.createChildrenObjects(r,o,s)),o}getCenter(e){let t=[];for(let n=0,s=e.length;n<s;++n){let{id:o,recursive:a}=e[n],l=this.find(o),c=a?l.recursiveBBox:l.singleBBox;t.push(...c.vertices)}let r=new rr;return r.setFromPoints(t),r.getCenter(DT),DT}copyMatrixWorld(e,t){if(e===null){t.identity();return}let r=this.find(e);r?t.copy(r.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){var n;if(e===null){t.identity();return}let r=(n=this.find(e))==null?void 0:n.parent;r?t.copy(r.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof Lr)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)e(t.material[r]);else e(t.material)})}updateCanvasSize(e,t){this.activeCamera.setViewplaneSize(e,t);let r,n;e>=t?(r=t/e,n=1):(r=1,n=e/t),this.traverseMaterial(s=>{s.layersList.getLayersOfType(at.TRANSMISSION).forEach(a=>{a.uniforms[`f${a.id}_aspectRatio`].value.x=r,a.uniforms[`f${a.id}_aspectRatio`].value.y=n})})}},wp=Mv;wp.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var Av=class{constructor(e,t,r,n){this.isEnable=!1;this.splineEvents={};this._enableEvent={};this._map={};this._prevAncestors=[];this._raycaster=new ay;this._intersection=new A;this._plane=new xn;this._normal=new A;this._position=new A;this._onMouseDown=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseDownEvent()};this._onMouseUp=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._handleMouseUpEvent()};this._onMouseMove=e=>{this._raycaster.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent()};this._onWheel=e=>{this._handleWheelEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseDownEvent(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onTouchEnd=()=>{this._handleMouseUpEvent(),this._handleMouseHoverEvent(!0)};this._onTouchMove=e=>{e.touches.length===1&&(this._raycaster.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(this._normal),this._normal.negate(),this._handleMouseHoverEvent(),this._handleLookAtEvent(),this._handleFollowEvent())};this._onKeyDown=e=>{this._handleKeyDownEvent(e.key)};this._onKeyUp=e=>{this._handleKeyUpEvent(e.key)};this._domElement=e,this._scene=t,this._camera=r,this._app=n}activate(){this.isEnable=!0,this._scene.traverseEntity(e=>{if(e.interaction!==void 0){e.interaction.start();for(let t of e.interaction.events){let r=t.type;this._addCustomEvent(r,e),this._enableEvent[r]=!0,(r===Je.KEY_DOWN||r===Je.KEY_UP||r===Je.START||r===Je.LOOK_AT||r===Je.FOLLOW||r===Je.SCROLL)&&(this._map[r]===void 0&&(this._map[r]=[]),this._map[r].push(e))}}}),this._enableEvent[Je.START]!==void 0&&this._handleStartEvent(),this._enableEvent[Je.MOUSE_DOWN]!==void 0&&(this._domElement.addEventListener("pointerdown",this._onMouseDown,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1)),this._enableEvent[Je.MOUSE_UP]!==void 0&&(this._domElement.addEventListener("pointerup",this._onMouseUp,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1)),(this._enableEvent[Je.MOUSE_HOVER]!==void 0||this._enableEvent[Je.LOOK_AT]!==void 0||this._enableEvent[Je.FOLLOW]!==void 0)&&(this._domElement.addEventListener("pointermove",this._onMouseMove,!1),this._domElement.addEventListener("touchstart",this._onTouchStart,!1),this._domElement.addEventListener("touchend",this._onTouchEnd,!1),this._domElement.addEventListener("touchmove",this._onTouchMove,!1)),this._enableEvent[Je.KEY_DOWN]!==void 0&&document.addEventListener("keydown",this._onKeyDown,!1),this._enableEvent[Je.KEY_UP]!==void 0&&document.addEventListener("keyup",this._onKeyUp,!1),this._enableEvent[Je.SCROLL]!==void 0&&this._domElement.addEventListener("wheel",this._onWheel,!1)}deactivate(){this._scene.traverseEntity(e=>{e.interaction!==void 0&&e.interaction.end(),e.interaction.cache=void 0}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._enableEvent={},this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{e.interaction.start()}),this._handleStartEvent()}_getPointer(e,t){let r=this._domElement.getBoundingClientRect();return{x:(e-r.left)/r.width*2-1,y:-((t-r.top)/r.height)*2+1}}_handleStartEvent(){var e;(e=this._map[Je.START])==null||e.forEach(t=>{var r;(r=t.interactionCache.start)==null||r.dispatch()})}_handleWheelEvent(e){var t;(t=this._map[Je.SCROLL])==null||t.forEach(r=>{var n;this._dispatchDOMCustomEvent("scroll",r.uuid),(n=r.interactionCache.scroll)==null||n.dispatch(e.deltaY>0?1:-1)})}_handleMouseDownEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseDown",s.uuid),(t=s.interactionCache.mouseDown)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseDown",o.uuid),(a=o.interactionCache.mouseDown)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseUpEvent(){var t;let e=this._raycastMesh(this._raycaster);for(let r=0,n=e.length;r<n;++r){let s=e[r].object;if(this._dispatchDOMCustomEvent("mouseUp",s.uuid),(t=s.interactionCache.mouseUp)==null||t.dispatch(),s.traverseAncestors(o=>{var a;o instanceof ii&&(this._dispatchDOMCustomEvent("mouseUp",o.uuid),(a=o.interactionCache.mouseUp)==null||a.dispatch())}),!s.interactionCache.follow)break}}_handleMouseHoverEvent(e=!1){var t,r;if(this._enableEvent[Je.MOUSE_HOVER]!==void 0){let n;if(!e){let o=this._raycastMesh(this._raycaster).find(a=>!a.object.interactionCache.follow);n=o?o.object:void 0}if(this._prevObject!==n){this._prevObject!==void 0&&((t=this._prevObject.interactionCache.mouseHover)==null||t.dispatchReverse()),n!==void 0&&(this._dispatchDOMCustomEvent("mouseHover",n.uuid),(r=n.interactionCache.mouseHover)==null||r.dispatch());let s=[];n==null||n.traverseAncestors(l=>{l instanceof ii&&l.interactionCache.mouseHover&&s.push(l)}),this._prevAncestors.filter(l=>{var c;return s.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatchReverse(),!0)});let o=s.filter(l=>{var c;return this._prevAncestors.includes(l)?!1:((c=l.interactionCache.mouseHover)==null||c.dispatch(),!0)}),a=this._prevAncestors.filter(l=>s.includes(l));this._prevAncestors=[...a,...o]}this._prevObject=n}}_handleLookAtEvent(){var e;(e=this._map[Je.LOOK_AT])==null||e.forEach(t=>{var n;let r=(n=t.interactionCache.lookAt)==null?void 0:n.distance;this._dispatchDOMCustomEvent("lookAt",t.uuid),r!==void 0&&(this._plane.set(this._normal,-r),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.lookAt(this._intersection))}),this._app.requestRender()}_handleFollowEvent(){var e;(e=this._map[Je.FOLLOW])==null||e.forEach(t=>{this._dispatchDOMCustomEvent("follow",t.uuid),this._plane.setFromNormalAndCoplanarPoint(this._normal,t.getWorldPosition(this._position)),this._raycaster.ray.intersectPlane(this._plane,this._intersection),t.interaction.follow(this._intersection)}),this._app.requestRender()}_handleKeyDownEvent(e){var t;(t=this._map[Je.KEY_DOWN])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyDown)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyDown",r.uuid),n==null||n.dispatch()})}_handleKeyUpEvent(e){var t;(t=this._map[Je.KEY_UP])==null||t.forEach(r=>{var s;let n=(s=r.interactionCache.keyUp)==null?void 0:s.find(o=>o.key===e);this._dispatchDOMCustomEvent("keyUp",r.uuid),n==null||n.dispatch()})}_raycastMesh(e){let t=[],r=n=>{for(let s of n.children)En(s)&&!s.raycastLock&&s.visible&&(kA(s)&&e.intersectObject(s,!1,t),r(s))};return r(this._scene),t}_addCustomEvent(e,t){let r=(()=>{switch(e){case 0:return"mouseDown";case 1:return"mouseUp";case 2:return"mouseHover";case 5:return"keyDown";case 6:return"keyUp";case 7:return"start";case 9:return"lookAt";case 10:return"follow";case 11:return"scroll"}})();if(r){let n=new CustomEvent(r,{bubbles:!0});Object.defineProperty(n,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[r]?this.splineEvents[r][t.uuid]=n:this.splineEvents[r]={[t.uuid]:n}}}_dispatchDOMCustomEvent(e,t){var n;let r=(n=this.splineEvents[e])==null?void 0:n[t];r&&this._domElement.dispatchEvent(r)}};var Tv=class{constructor(e,t,r,n,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new F().copy(r),this._editorSize=new F().copy(n),this._aspect=t.aspect,this._fov=s!=null?s:t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,n=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<n&&(o=(n-t)*.5,o=-o,l=n),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let n=dU(e,1080,2160,1,15)/100;r*=e/t,r*=1-n}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function dU(i,e,t,r,n){return(i-e)/(t-e)*(n-r)+r}var RT=new sn,ec=class extends tn{},Qu=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new xt(2048,2048,{generateMipmaps:!0,minFilter:Li,magFilter:tt,wrapS:ar,wrapT:ar}),this.transmissionRenderTarget.depthTexture=new fs(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Ky(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===RT}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:RT}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new ec(t.r,t.g,t.b,t.a):this.colors[e]=new ec(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,o;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(n=t.g)!=null?n:a.g,this.colors[e].b=(s=t.b)!=null?s:a.b,this.colors[e].a=(o=t.a)!=null?o:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function fU(i,e){switch(i.type){case at.NOISE:return e==="noiseType";case at.TEXTURE:return e==="projection"||e==="axis";case at.DISPLACE:return e==="noiseType";default:return!1}}function _v(i,e,t,r,n){var o;let s=!1;for(let[a,l]of Object.entries(i)){if(!a||l===void 0||ep(a,t,n))continue;let c=t.uniforms[`f${t.id}_${a}`];if(!!c)switch(c.constructor){case Lt:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof ec?c.value=new tn(u.r,u.g,u.b,u.a):c.setRGBA(u);break}case Xi:if(typeof l=="string"){let u=e.getColor(l);u&&(c.value=u);break}else{let u=l;c.value instanceof ec?c.value=new tn(u.r,u.g,u.b,u.a):c.value.setRGBA(u.r,u.g,u.b,u.a);break}case Jr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]);break}case qr:{let u=l;c.value.setX(u[0]),c.value.setY(u[1]),c.value.setZ(u[2]);break}case rn:{let u=l;"image"in u&&(c.value.image=e.getImage(u.image)),"wrapping"in u&&(c.value.wrapS=c.value.wrapT=u.wrapping),"repeat"in u&&(c.value.repeat=u.repeat),"offset"in u&&(c.value.offset=u.offset),c.value.needsUpdate=!0;break}case go:{l.forEach((u,d)=>{c.value[d].setX(u[0]),c.value[d].setY(u[1]),c.value[d].setZ(u[2]),c.value[d].setW(u[3])});break}default:{s=s||fU(t,a),c.value=l;break}}}if(s&&n){let a=$f({id:"0",fi:0,data:n},e);(o=r.userData.layers)==null||o.changeLayer(t.id,re({},a)),r.dispose(),r.needsUpdate=!0}}function OT(i,e,t){var n;let r=[];i.objects.traverse((s,o)=>{var c;if(o.states===void 0)return;let a=e.find(s),l=a.interaction=new xo(a);pU(a,o,null,t),l.states.push(Qi.create(s,o,t));for(let u of o.states){let d=nu.patch(o,u.data);l.states.push(Qi.create(u.id,d,t))}if(o.events)for(let u of o.events){let d=u.data,h=new vo(d.type);if("key"in d&&(h.key=d.key),"url"in d&&(h.url=(c=d.url)!=null?c:void 0),"distance"in d&&(h.distance=d.distance),"steps"in d&&(h.steps=d.steps),"targets"in d)for(let{data:p}of d.targets){let f=Ts.create(p);p.object?(f.object=e.find(p.object),r.push([f,p.object,p.state])):f.object=void 0,h.addTarget(f)}l.events.push(h)}});for(let[s,o,a]of r){let l=e.find(o);l&&(a?s.state=(n=l.interaction.states.find(c=>c.uuid===a))!=null?n:l.interaction.states[0]:s.state=l.interaction.states[0])}}function pU(i,e,t,r,n=!1){if(!n&&e.states.length===0)return;let s=t===null?e:nu.patch(e,e.states.data(t));if(_y(i,s),i instanceof ni&&so.is(s.type)){let a=s;i.setZoom("PerspectiveCamera",a.perspective.zoom),i.setZoom("OrthographicCamera",a.orthographic.zoom)}else if(i instanceof Lr&&s.type==="Mesh"){if(i instanceof da?i.buildFromStore(s.geometry):i.updateGeometry({parameters:s.geometry}),"material"in s){if(i.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=i.material.userData.layers.getLayerByUuid(l.id);_v(l.data,r,c,i.material,l.data)}}}else if("materials"in s){if(!(i.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let u=i.material[o].userData.layers.getLayerByUuid(c.id);_v(c.data,r,u,i.material[o],c.data)}}o++}}}else s.type==="DirectionalLight"?i.fromDirectionalLightState(s,r):s.type==="PointLight"?i.fromPointLightState(s,r):s.type==="SpotLight"&&i.fromSpotLightState(s,r)}var Ev=class{constructor(e){this.sharedAssets=new Qu(e.shared),this.scene=new wp(e.scene,this.sharedAssets)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.clearScene(this.sharedAssets),this.sharedAssets.dispose()}};var tc=".",Ku=Symbol("target"),Cv=Symbol("unsubscribe");function Zu(i){return i instanceof Date||i instanceof Set||i instanceof Map||i instanceof WeakSet||i instanceof WeakMap||ArrayBuffer.isView(i)}function BT(i){return(typeof i=="object"?i===null:typeof i!="function")||i instanceof RegExp}var Vn=Array.isArray;function fa(i){return typeof i=="symbol"}var mU={after:(i,e)=>Vn(i)?i.slice(e.length):e===""?i:i.slice(e.length+1),concat:(i,e)=>Vn(i)?(i=[...i],e&&i.push(e),i):e&&e.toString!==void 0?(i!==""&&(i+=tc),fa(e)?i+e.toString():i+e):i,initial:i=>{if(Vn(i))return i.slice(0,-1);if(i==="")return i;let e=i.lastIndexOf(tc);return e===-1?"":i.slice(0,e)},last:i=>{if(Vn(i))return i[i.length-1]||"";if(i==="")return i;let e=i.lastIndexOf(tc);return e===-1?i:i.slice(e+1)},walk:(i,e)=>{if(Vn(i))for(let t of i)e(t);else if(i!==""){let t=0,r=i.indexOf(tc);if(r===-1)e(i);else for(;t<i.length;)r===-1&&(r=i.length),e(i.slice(t,r)),t=r+1,r=i.indexOf(tc,t)}},get(i,e){return this.walk(e,t=>{i&&(i=i[t])}),i}},gn=mU;function Lv(i){return typeof i=="object"&&typeof i.next=="function"}function Nv(i,e,t,r,n){let s=i.next;if(e.name==="entries")i.next=function(){let o=s.call(this);return o.done===!1&&(o.value[0]=n(o.value[0],e,o.value[0],r),o.value[1]=n(o.value[1],e,o.value[0],r)),o};else if(e.name==="values"){let o=t[Ku].keys();i.next=function(){let a=s.call(this);return a.done===!1&&(a.value=n(a.value,e,o.next().value,r)),a}}else i.next=function(){let o=s.call(this);return o.done===!1&&(o.value=n(o.value,e,o.value,r)),o};return i}function Sp(i,e,t){return i.isUnsubscribed||e.ignoreSymbols&&fa(t)||e.ignoreUnderscores&&t.charAt(0)==="_"||"ignoreKeys"in e&&e.ignoreKeys.includes(t)}var Mp=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return this._descriptorCache===void 0&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),r=t.get(e);return r===void 0&&(r={},t.set(e,r)),r}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let r=this._getProperties(e),n=r[t];return n===void 0&&(n=Reflect.getOwnPropertyDescriptor(e,t),r[t]=n),n}getProxy(e,t,r,n){if(this.isUnsubscribed)return e;let s=e[n],o=s||e;this._pathCache.set(o,t);let a=this._proxyCache.get(o);return a===void 0&&(a=s===void 0?new Proxy(e,r):e,this._proxyCache.set(o,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,gn.get(t,this.getPath(e)))}defineProperty(e,t,r){return Reflect.defineProperty(e,t,r)?(this.isUnsubscribed||(this._getProperties(e)[t]=r),!0):!1}setProperty(e,t,r,n,s){if(!this._equals(s,r)||!(t in e)){let o=this._getOwnPropertyDescriptor(e,t);return o!==void 0&&"set"in o?Reflect.set(e,t,r,n):Reflect.set(e,t,r)}return!0}deleteProperty(e,t,r){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let n=this._getDescriptorCache().get(e);n&&(delete n[t],this._pathCache.delete(r))}return!0}return!1}isSameDescriptor(e,t,r){let n=this._getOwnPropertyDescriptor(t,r);return e!==void 0&&n!==void 0&&Object.is(e.value,n.value)&&(e.writable||!1)===(n.writable||!1)&&(e.enumerable||!1)===(n.enumerable||!1)&&(e.configurable||!1)===(n.configurable||!1)&&e.get===n.get&&e.set===n.set}isGetInvariant(e,t){let r=this._getOwnPropertyDescriptor(e,t);return r!==void 0&&r.configurable!==!0&&r.writable!==!0}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function rc(i){return toString.call(i)==="[object Object]"}function nc(){return!0}function So(i,e){return i.length!==e.length||i.some((t,r)=>e[r]!==t)}var Ap=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]);var gU=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),Pv={push:nc,pop:nc,shift:nc,unshift:nc,copyWithin:So,reverse:So,sort:So,splice:So,flat:So,fill:So},FT=new Set([...Ap,...gU,...Object.keys(Pv)]);function ic(i,e){if(i.size!==e.size)return!0;for(let t of i)if(!e.has(t))return!0;return!1}var Iv=["keys","values","entries"],Dv=new Set(["has","toString"]),Rv={add:ic,clear:ic,delete:ic,forEach:ic},GT=new Set([...Dv,...Object.keys(Rv),...Iv]);function sc(i,e){if(i.size!==e.size)return!0;let t;for(let[r,n]of i)if(t=e.get(r),t!==n||t===void 0&&!e.has(r))return!0;return!1}var yU=new Set([...Dv,"get"]),Ov={set:sc,clear:sc,delete:sc,forEach:sc},zT=new Set([...yU,...Object.keys(Ov),...Iv]);var Yr=class{constructor(e,t,r,n){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=n,this._changes=n?[]:null,this.clone=t===void 0?e:this._shallowClone(e)}static isHandledMethod(e){return Ap.has(e)}_shallowClone(e){let t=e;if(rc(e))t=re({},e);else if(Vn(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(r=>this._shallowClone(r)));else if(e instanceof Map){t=new Map;for(let[r,n]of e.entries())t.set(r,this._shallowClone(n))}return this._clonedCache.add(t),t}preferredThisArg(e,t,r,n){return e?(Vn(n)?this._onIsChanged=Pv[t]:n instanceof Set?this._onIsChanged=Rv[t]:n instanceof Map&&(this._onIsChanged=Ov[t]),n):r}update(e,t,r){let n=gn.after(e,this._path);if(t!=="length"){let s=this.clone;gn.walk(n,o=>{s&&s[o]&&(this._clonedCache.has(s[o])||(s[o]=this._shallowClone(s[o])),s=s[o])}),this._hasOnValidate&&this._changes.push({path:n,property:t,previous:r}),s&&s[t]&&(s[t]=r)}this._isChanged=!0}undo(e){let t;for(let r=this._changes.length-1;r!==-1;r--)t=this._changes[r],gn.get(e,t.path)[t.property]=t.previous}isChanged(e){return this._onIsChanged===void 0?this._isChanged:this._onIsChanged(this.clone,e)}};var $u=class extends Yr{static isHandledMethod(e){return FT.has(e)}};var Tp=class extends Yr{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}};var eh=class extends Yr{static isHandledMethod(e){return GT.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}};var th=class extends Yr{static isHandledMethod(e){return zT.has(e)}undo(e){for(let[t,r]of this.clone.entries())e.set(t,r);for(let t of e.keys())this.clone.has(t)||e.delete(t)}};var _p=class extends Yr{constructor(e,t,r,n){super(void 0,t,r,n);this._arg1=r[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}};var Ep=class extends Yr{constructor(e,t,r,n){super(void 0,t,r,n);this._weakKey=r[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}};var is=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return rc(e)||Vn(e)||Zu(e)}static isHandledMethod(e,t){return rc(e)?Yr.isHandledMethod(t):Vn(e)?$u.isHandledMethod(t):e instanceof Set?eh.isHandledMethod(t):e instanceof Map?th.isHandledMethod(t):Zu(e)}get isCloning(){return this._stack.length>0}start(e,t,r){let n=Yr;Vn(e)?n=$u:e instanceof Date?n=Tp:e instanceof Set?n=eh:e instanceof Map?n=th:e instanceof WeakSet?n=_p:e instanceof WeakMap&&(n=Ep),this._stack.push(new n(e,t,r,this._hasOnValidate))}update(e,t,r){this._stack[this._stack.length-1].update(e,t,r)}preferredThisArg(e,t,r){let{name:n}=e,s=is.isHandledMethod(r,n);return this._stack[this._stack.length-1].preferredThisArg(s,n,t,r)}isChanged(e,t,r){return this._stack[this._stack.length-1].isChanged(e,t,r)}undo(e){this._previousClone!==void 0&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}};var vU={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Bv=(i,e,t={})=>{t=re(re({},vU),t);let r=Symbol("ProxyTarget"),{equals:n,isShallow:s,ignoreDetached:o,details:a}=t,l=new Mp(n),c=typeof t.onValidate=="function",u=new is(c),d=(m,x,b,w,T)=>!c||u.isCloning||t.onValidate(gn.concat(l.getPath(m),x),b,w,T)===!0,h=(m,x,b,w)=>{!Sp(l,t,x)&&!(o&&l.isDetached(m,i))&&p(l.getPath(m),x,b,w)},p=(m,x,b,w,T)=>{u.isCloning?u.update(m,x,w):e(gn.concat(m,x),b,w,T)},f=m=>m&&(m[r]||m),g=(m,x,b,w)=>BT(m)||b==="constructor"||s&&!is.isHandledMethod(x,b)||Sp(l,t,b)||l.isGetInvariant(x,b)||o&&l.isDetached(x,i)?m:(w===void 0&&(w=l.getPath(x)),l.getProxy(m,gn.concat(w,b),v,r)),v={get(m,x,b){if(fa(x)){if(x===r||x===Ku)return m;if(x===Cv&&!l.isUnsubscribed&&l.getPath(m).length===0)return l.unsubscribe(),m}let w=Zu(m)?Reflect.get(m,x):Reflect.get(m,x,b);return g(w,m,x)},set(m,x,b,w){b=f(b);let T=m[r]||m,S=T[x];if(n(S,b)&&x in m)return!0;let M=d(m,x,b,S);return M&&l.setProperty(T,x,b,w,S)?(h(m,x,m[x],S),!0):!M},defineProperty(m,x,b){if(!l.isSameDescriptor(b,m,x)){let w=m[x];d(m,x,b.value,w)&&l.defineProperty(m,x,b,w)&&h(m,x,b.value,w)}return!0},deleteProperty(m,x){if(!Reflect.has(m,x))return!0;let b=Reflect.get(m,x),w=d(m,x,void 0,b);return w&&l.deleteProperty(m,x,b)?(h(m,x,void 0,b),!0):!w},apply(m,x,b){let w=x[r]||x;if(l.isUnsubscribed)return Reflect.apply(m,w,b);if((a===!1||a!==!0&&!a.includes(m.name))&&is.isHandledType(w)){let T=gn.initial(l.getPath(m)),S=is.isHandledMethod(w,m.name);u.start(w,T,b);let M=Reflect.apply(m,u.preferredThisArg(m,x,w),S?b.map(_=>f(_)):b),E=u.isChanged(w,n),C=u.stop();if(is.isHandledType(M)&&S&&(x instanceof Map&&m.name==="get"&&(T=gn.concat(T,b[0])),M=l.getProxy(M,T,v)),E){let _={name:m.name,args:b,result:M},O=u.isCloning?gn.initial(T):T,P=u.isCloning?gn.last(T):"";d(gn.get(i,O),P,w,C,_)?p(O,P,w,C,_):u.undo(w)}return(x instanceof Map||x instanceof Set)&&Lv(M)?Nv(M,m,x,T,g):M}return Reflect.apply(m,x,b)}},y=l.getProxy(i,t.pathAsArray?[]:"",v);return e=e.bind(y),c&&(t.onValidate=t.onValidate.bind(y)),y};Bv.target=i=>i&&i[Ku]||i;Bv.unsubscribe=i=>i[Cv]||i;var Fv=Bv;var Mo;(function(t){t[t.FULLSCREEN=1]="FULLSCREEN",t[t.CUSTOM=2]="CUSTOM"})(Mo||(Mo={}));var xU=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{var t;if(!this._renderer)return;this._rafId=requestAnimationFrame(this.render);let e=xo.isAllAnimationsEnded;!this.autoRender&&this._skipRender&&(e===void 0||e)||(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),((t=this._scene.postprocessing)==null?void 0:t.enabled)?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))))};this.resize=()=>{var e,t,r,n;!this._renderer||(this._viewportMode===1&&(this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._frameView&&(this._frameView.frameSize=new F(this._viewportWidth,this._viewportHeight))),(e=this._frameView)==null||e.updateRenderer(),((t=this._scene)==null?void 0:t.postprocessing)&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._viewportMode!==1&&((r=this._frameView)==null||r.updateViewport()),this._camera&&((n=this._frameView)==null||n.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this.requestRender())};this.canvas=e,this.autoRender=t,window.addEventListener("resize",qc(this.resize,200))}async load(e){let r=await(await fetch(e,{credentials:"include",mode:"no-cors"})).arrayBuffer();this.start(r)}start(e){var a;let t=tf.deserialize(new Uint8Array(e));this._publishData=t.scene.publish;let n=new Ev(t).scene;this._scene=n,this._sharedAssetsManager=new Qu(t.shared),this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},OT(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let s=Object.values(t.frames)[0];s&&(s.preset==="fullscreen"?(this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight):(this._viewportMode=2,this._viewportWidth=s.size[0],this._viewportHeight=s.size[1])),((a=this._scene.postprocessing)==null?void 0:a.enabled)?(this._renderer=new _t({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}).then(this.requestRender)):this._renderer=new _t({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new xt(2048,2048,{generateMipmaps:!0,minFilter:Li,magFilter:tt,wrapS:ar,wrapT:ar}),this._transmissionRenderTarget.depthTexture=new fs(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=Lp,this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new Tv(this._renderer,this._camera,new F(this._viewportWidth,this._viewportHeight),new F(window.innerWidth,window.innerHeight)),!0&&(this._controls=new iy(this._camera,this._renderer.domElement),this._publishData&&(this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1),this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new Av(this._renderer.domElement,this._scene,this._camera,this),this.resize(),this.render()}findObjectById(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){var r;let t=(r=this._scene)==null?void 0:r.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){var e;return(e=this._playmode)==null?void 0:e.splineEvents}emitEvent(e,t){let r=this.findObjectById(t);r==null||r.emitEvent(e)}emitEventReverse(e,t){let r=this.findObjectById(t);r==null||r.emitEventReverse(e)}addEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.addEventListener(e,t)}removeEventListener(e,t){var r;(r=this._renderer)==null||r.domElement.removeEventListener(e,t)}dispose(){var e,t,r,n,s,o,a;(e=this._playmode)==null||e.deactivate(),(t=this._scene)==null||t.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(l=>{Fv.unsubscribe(l)}),(r=this._renderer)==null||r.dispose(),(n=this._transmissionRenderTarget)==null||n.dispose(),(o=(s=this._transmissionRenderTarget)==null?void 0:s.depthTexture)==null||o.dispose(),(a=this._sharedAssetsManager)==null||a.dispose()}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatch()}):s==null||s.dispatch()},emitEventReverse(n){var o;let s=(o=e.interactionCache)==null?void 0:o[n];Array.isArray(s)?s.forEach(a=>{a==null||a.dispatchReverse()}):s==null||s.dispatchReverse()}},r=Fv(t,(n,s)=>{var a;typeof e[n]!="object"&&((a=Object.getOwnPropertyDescriptor(e,n))==null?void 0:a.writable)&&(e[n]=s),this.requestRender()});return this._proxyObjectCache.set(e.uuid,r),r}};en.FONTS_PATH="_assets/_fonts/";export{xU as Application};
|