@needle-tools/engine 4.7.4 → 4.8.0-next.71dbdab
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/dist/gltf-progressive--2HtE1d8.umd.cjs +8 -0
- package/dist/gltf-progressive-CeuEsYpY.min.js +8 -0
- package/dist/gltf-progressive-DY5t1MFv.js +1370 -0
- package/dist/loader.worker-8olmVOL4.js +1 -0
- package/dist/needle-engine.bundle-B39uCVgy.js +42600 -0
- package/dist/needle-engine.bundle-CvGXlxjL.umd.cjs +1607 -0
- package/dist/needle-engine.bundle-D598TFE7.min.js +1607 -0
- package/dist/needle-engine.d.ts +15 -15
- package/dist/needle-engine.js +591 -592
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/{postprocessing-BzY0H7ry.min.js → postprocessing-ChsrvDkI.min.js} +54 -54
- package/dist/{postprocessing-vKBVFpSz.js → postprocessing-DElbMQgB.js} +479 -483
- package/dist/{postprocessing-Dw2OCMp4.umd.cjs → postprocessing-DtxaELce.umd.cjs} +66 -66
- package/dist/{three-examples-DUcCNw9s.umd.cjs → three-examples-BhQvv1B9.umd.cjs} +11 -11
- package/dist/{three-examples-tvuhV8Ne.js → three-examples-CM6Iip03.js} +23 -27
- package/dist/{three-examples-BMOhDaYR.min.js → three-examples-D2zemuAM.min.js} +12 -12
- package/dist/{three-mesh-ui-CxuWt7m-.js → three-mesh-ui-D6Mz5Yl7.js} +799 -810
- package/dist/three-mesh-ui-DWcMuyQ_.min.js +406 -0
- package/dist/three-mesh-ui-tt0buEDC.umd.cjs +406 -0
- package/dist/{vendor-BmYIgaS1.js → vendor-ClB-U1Hn.js} +10 -10
- package/dist/{vendor-Cavtu3CP.umd.cjs → vendor-bOWOWClg.umd.cjs} +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/Behaviour.d.ts +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +8 -0
- package/lib/engine-components/postprocessing/PostProcessingHandler.js.map +1 -1
- package/package.json +5 -5
- package/plugins/vite/dependencies.js +28 -19
- package/plugins/vite/dependency-watcher.js +6 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +14 -0
- package/dist/gltf-progressive-Bgh1c4Fd.js +0 -1224
- package/dist/gltf-progressive-D6f5talj.min.js +0 -8
- package/dist/gltf-progressive-otA_hxSA.umd.cjs +0 -8
- package/dist/needle-engine.bundle-Bb6xVcZE.min.js +0 -1607
- package/dist/needle-engine.bundle-BldBPoPh.js +0 -43846
- package/dist/needle-engine.bundle-ByrSH-zp.umd.cjs +0 -1607
- package/dist/three-mesh-ui-B3p3gyUz.min.js +0 -406
- package/dist/three-mesh-ui-CQiIQIlA.umd.cjs +0 -406
|
@@ -11533,19 +11533,19 @@ class ka {
|
|
|
11533
11533
|
constructor(t, e, i) {
|
|
11534
11534
|
var r, s, a, o, c, l, h, u, f, d, y, _, p, m, g;
|
|
11535
11535
|
this._closedByUser = !1, this.handleOpenEvent = (v) => this.handleEvent(j.open, v), this.handleErrorEvent = (v) => this.handleEvent(j.error, v), this.handleCloseEvent = (v) => this.handleEvent(j.close, v), this.handleMessageEvent = (v) => this.handleEvent(j.message, v), this._url = t, this._protocols = e, this._options = {
|
|
11536
|
-
buffer: i
|
|
11536
|
+
buffer: i?.buffer,
|
|
11537
11537
|
retry: {
|
|
11538
|
-
maxRetries: (r = i
|
|
11539
|
-
instantReconnect: (s = i
|
|
11540
|
-
backoff: (a = i
|
|
11538
|
+
maxRetries: (r = i?.retry) === null || r === void 0 ? void 0 : r.maxRetries,
|
|
11539
|
+
instantReconnect: (s = i?.retry) === null || s === void 0 ? void 0 : s.instantReconnect,
|
|
11540
|
+
backoff: (a = i?.retry) === null || a === void 0 ? void 0 : a.backoff
|
|
11541
11541
|
},
|
|
11542
11542
|
listeners: {
|
|
11543
|
-
open: [...(c = (o = i
|
|
11544
|
-
close: [...(h = (l = i
|
|
11545
|
-
error: [...(f = (u = i
|
|
11546
|
-
message: [...(y = (d = i
|
|
11547
|
-
retry: [...(p = (_ = i
|
|
11548
|
-
reconnect: [...(g = (m = i
|
|
11543
|
+
open: [...(c = (o = i?.listeners) === null || o === void 0 ? void 0 : o.open) !== null && c !== void 0 ? c : []],
|
|
11544
|
+
close: [...(h = (l = i?.listeners) === null || l === void 0 ? void 0 : l.close) !== null && h !== void 0 ? h : []],
|
|
11545
|
+
error: [...(f = (u = i?.listeners) === null || u === void 0 ? void 0 : u.error) !== null && f !== void 0 ? f : []],
|
|
11546
|
+
message: [...(y = (d = i?.listeners) === null || d === void 0 ? void 0 : d.message) !== null && y !== void 0 ? y : []],
|
|
11547
|
+
retry: [...(p = (_ = i?.listeners) === null || _ === void 0 ? void 0 : _.retry) !== null && p !== void 0 ? p : []],
|
|
11548
|
+
reconnect: [...(g = (m = i?.listeners) === null || m === void 0 ? void 0 : m.reconnect) !== null && g !== void 0 ? g : []]
|
|
11549
11549
|
}
|
|
11550
11550
|
}, this._underlyingWebsocket = this.tryConnect();
|
|
11551
11551
|
}
|
|
@@ -1118,4 +1118,4 @@ void main() {
|
|
|
1118
1118
|
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
1119
1119
|
|
|
1120
1120
|
#include <fog_vertex>
|
|
1121
|
-
}`;class Cl extends oa{constructor(t){super(t),this.vector_=new O,this.vector2_=new O,this.vector3_=new O,this.quaternion_=new J,this.maxParticles=1e4,this.setupBuffers(),this.rebuildMaterial()}setupBuffers(){this.geometry&&this.geometry.dispose(),this.geometry=new M.BufferGeometry,this.indexBuffer=new M.BufferAttribute(new Uint32Array(this.maxParticles*6),1),this.indexBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setIndex(this.indexBuffer),this.positionBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.positionBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("position",this.positionBuffer),this.previousBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.previousBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("previous",this.previousBuffer),this.nextBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.nextBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("next",this.nextBuffer),this.widthBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*2),1),this.widthBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("width",this.widthBuffer),this.sideBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*2),1),this.sideBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("side",this.sideBuffer),this.uvBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*4),2),this.uvBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("uv",this.uvBuffer),this.colorBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*8),4),this.colorBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("color",this.colorBuffer)}expandBuffers(t){for(;t>=this.maxParticles;)this.maxParticles*=2;this.setupBuffers()}rebuildMaterial(){this.layers.mask=this.settings.layers.mask;const t={lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},resolution:{value:new Je(1,1)},sizeAttenuation:{value:1},visibility:{value:1},alphaTest:{value:0}},e={};if(e.USE_UV="",e.USE_COLOR_ALPHA="",this.settings.material.map&&(e.USE_MAP="",e.MAP_UV=Nn(this.settings.material.map.channel),t.map=new M.Uniform$1(this.settings.material.map),t.mapTransform=new M.Uniform$1(new Xt().copy(this.settings.material.map.matrix))),this.settings.material.defines&&this.settings.material.defines.USE_COLOR_AS_ALPHA!==void 0&&(e.USE_COLOR_AS_ALPHA=""),this.settings.renderMode===exports.RenderMode.Trail)this.material=new M.ShaderMaterial({uniforms:t,defines:e,vertexShader:Ml,fragmentShader:Tl,transparent:this.settings.material.transparent,depthWrite:!this.settings.material.transparent,side:this.settings.material.side,blending:this.settings.material.blending||M.AdditiveBlending,blendDst:this.settings.material.blendDst,blendSrc:this.settings.material.blendSrc,blendEquation:this.settings.material.blendEquation,premultipliedAlpha:this.settings.material.premultipliedAlpha});else throw new Error("render mode unavailable")}update(){let t=0,e=0,i=0;this.systems.forEach(r=>{for(let s=0;s<r.particleNum;s++)i+=r.particles[s].previous.length*2}),i>this.maxParticles&&this.expandBuffers(i),this.systems.forEach(r=>{r.emitter.updateMatrixWorld&&(r.emitter.updateWorldMatrix(!0,!1),r.emitter.updateMatrixWorld(!0));const s=this.quaternion_,a=this.vector2_,o=this.vector3_;r.emitter.matrixWorld.decompose(a,s,o);const c=r.particles,l=r.particleNum,u=this.settings.uTileCount,h=this.settings.vTileCount,f=1/u,d=1/h;for(let y=0;y<l;y++){const _=c[y],p=_.uvTile%h,m=Math.floor(_.uvTile/h+.001),g=_.previous.values();let v=g.next(),S=v.value,x=S;v.done||(v=g.next());let b;v.value!==void 0?b=v.value:b=x;for(let T=0;T<_.previous.length;T++,t+=2){if(this.positionBuffer.setXYZ(t,x.position.x,x.position.y,x.position.z),this.positionBuffer.setXYZ(t+1,x.position.x,x.position.y,x.position.z),r.worldSpace?(this.positionBuffer.setXYZ(t,x.position.x,x.position.y,x.position.z),this.positionBuffer.setXYZ(t+1,x.position.x,x.position.y,x.position.z)):(_.parentMatrix?this.vector_.copy(x.position).applyMatrix4(_.parentMatrix):this.vector_.copy(x.position).applyMatrix4(r.emitter.matrixWorld),this.positionBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.positionBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.previousBuffer.setXYZ(t,S.position.x,S.position.y,S.position.z),this.previousBuffer.setXYZ(t+1,S.position.x,S.position.y,S.position.z)):(_.parentMatrix?this.vector_.copy(S.position).applyMatrix4(_.parentMatrix):this.vector_.copy(S.position).applyMatrix4(r.emitter.matrixWorld),this.previousBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.previousBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.nextBuffer.setXYZ(t,b.position.x,b.position.y,b.position.z),this.nextBuffer.setXYZ(t+1,b.position.x,b.position.y,b.position.z)):(_.parentMatrix?this.vector_.copy(b.position).applyMatrix4(_.parentMatrix):this.vector_.copy(b.position).applyMatrix4(r.emitter.matrixWorld),this.nextBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.nextBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),this.sideBuffer.setX(t,-1),this.sideBuffer.setX(t+1,1),r.worldSpace)this.widthBuffer.setX(t,x.size),this.widthBuffer.setX(t+1,x.size);else if(_.parentMatrix)this.widthBuffer.setX(t,x.size),this.widthBuffer.setX(t+1,x.size);else{const w=(Math.abs(o.x)+Math.abs(o.y)+Math.abs(o.z))/3;this.widthBuffer.setX(t,x.size*w),this.widthBuffer.setX(t+1,x.size*w)}this.uvBuffer.setXY(t,(T/_.previous.length+p)*f,(h-m-1)*d),this.uvBuffer.setXY(t+1,(T/_.previous.length+p)*f,(h-m)*d),this.colorBuffer.setXYZW(t,x.color.x,x.color.y,x.color.z,x.color.w),this.colorBuffer.setXYZW(t+1,x.color.x,x.color.y,x.color.z,x.color.w),T+1<_.previous.length&&(this.indexBuffer.setX(e*3,t),this.indexBuffer.setX(e*3+1,t+1),this.indexBuffer.setX(e*3+2,t+2),e++,this.indexBuffer.setX(e*3,t+2),this.indexBuffer.setX(e*3+1,t+1),this.indexBuffer.setX(e*3+2,t+3),e++),S=x,x=b,v.done||(v=g.next(),v.value!==void 0&&(b=v.value))}}}),this.positionBuffer.clearUpdateRanges(),this.positionBuffer.addUpdateRange(0,t*3),this.positionBuffer.needsUpdate=!0,this.previousBuffer.clearUpdateRanges(),this.previousBuffer.addUpdateRange(0,t*3),this.previousBuffer.needsUpdate=!0,this.nextBuffer.clearUpdateRanges(),this.nextBuffer.addUpdateRange(0,t*3),this.nextBuffer.needsUpdate=!0,this.sideBuffer.clearUpdateRanges(),this.sideBuffer.addUpdateRange(0,t),this.sideBuffer.needsUpdate=!0,this.widthBuffer.clearUpdateRanges(),this.widthBuffer.addUpdateRange(0,t),this.widthBuffer.needsUpdate=!0,this.uvBuffer.clearUpdateRanges(),this.uvBuffer.addUpdateRange(0,t*2),this.uvBuffer.needsUpdate=!0,this.colorBuffer.clearUpdateRanges(),this.colorBuffer.addUpdateRange(0,t*4),this.colorBuffer.needsUpdate=!0,this.indexBuffer.clearUpdateRanges(),this.indexBuffer.addUpdateRange(0,e*3),this.indexBuffer.needsUpdate=!0,this.geometry.setDrawRange(0,e*3)}dispose(){this.geometry.dispose()}}class Yi{get geometry(){return this._geometry}set geometry(t){if(this._geometry=t,t===void 0||typeof t=="string")return;const e=new M.Triangle;this._triangleIndexToArea.length=0;let i=0;if(!t.getIndex())return;const r=t.getIndex().array,s=r.length/3;this._triangleIndexToArea.push(0);for(let a=0;a<s;a++)e.setFromAttributeAndIndices(t.getAttribute("position"),r[a*3],r[a*3+1],r[a*3+2]),i+=e.getArea(),this._triangleIndexToArea.push(i);t.userData.triangleIndexToArea=this._triangleIndexToArea}constructor(t){this.type="mesh_surface",this._triangleIndexToArea=[],this._tempA=new M.Vector3,this._tempB=new M.Vector3,this._tempC=new M.Vector3,t&&(this.geometry=t)}initialize(t){const e=this._geometry;if(!e||e.getIndex()===null){t.position.set(0,0,0),t.velocity.set(0,0,1).multiplyScalar(t.startSpeed);return}const i=this._triangleIndexToArea.length-1;let r=0,s=i;const a=Math.random()*this._triangleIndexToArea[i];for(;r+1<s;){const d=Math.floor((r+s)/2);a<this._triangleIndexToArea[d]?s=d:r=d}let o=Math.random(),c=Math.random();o+c>1&&(o=1-o,c=1-c);const l=e.getIndex().array[r*3],u=e.getIndex().array[r*3+1],h=e.getIndex().array[r*3+2],f=e.getAttribute("position");this._tempA.fromBufferAttribute(f,l),this._tempB.fromBufferAttribute(f,u),this._tempC.fromBufferAttribute(f,h),this._tempB.sub(this._tempA),this._tempC.sub(this._tempA),this._tempA.addScaledVector(this._tempB,o).addScaledVector(this._tempC,c),t.position.copy(this._tempA),this._tempA.copy(this._tempB).cross(this._tempC).normalize(),t.velocity.copy(this._tempA).normalize().multiplyScalar(t.startSpeed)}toJSON(){return{type:"mesh_surface",mesh:this._geometry?this._geometry.uuid:""}}static fromJSON(t,e){return new Yi(e.geometries[t.geometry])}clone(){return new Yi(this._geometry)}update(t,e){}}il({id:"three.quarks",emitterShapes:[{type:"mesh_surface",params:[["geometry",["geometry"]]],constructor:Yi,loadJSON:Yi.fromJSON}],behaviors:[]});class is extends M.Object3D{constructor(){super(),this.batches=[],this.systemToBatchIndex=new Map,this.type="BatchedRenderer",this.depthTexture=null}static equals(t,e){return t.material.side===e.material.side&&t.material.blending===e.material.blending&&t.material.blendSrc===e.material.blendSrc&&t.material.blendDst===e.material.blendDst&&t.material.blendEquation===e.material.blendEquation&&t.material.premultipliedAlpha===e.material.premultipliedAlpha&&t.material.transparent===e.material.transparent&&t.material.depthTest===e.material.depthTest&&t.material.type===e.material.type&&t.material.alphaTest===e.material.alphaTest&&t.material.map===e.material.map&&t.renderMode===e.renderMode&&t.blendTiles===e.blendTiles&&t.softParticles===e.softParticles&&t.softFarFade===e.softFarFade&&t.softNearFade===e.softNearFade&&t.uTileCount===e.uTileCount&&t.vTileCount===e.vTileCount&&t.instancingGeometry===e.instancingGeometry&&t.renderOrder===e.renderOrder&&t.layers.mask===e.layers.mask}addSystem(t){t._renderer=this;const e=t.getRendererSettings();for(let r=0;r<this.batches.length;r++)if(is.equals(this.batches[r].settings,e)){this.batches[r].addSystem(t),this.systemToBatchIndex.set(t,r);return}let i;switch(e.renderMode){case exports.RenderMode.Trail:i=new Cl(e);break;case exports.RenderMode.Mesh:case exports.RenderMode.BillBoard:case exports.RenderMode.VerticalBillBoard:case exports.RenderMode.HorizontalBillBoard:case exports.RenderMode.StretchedBillBoard:i=new bl(e);break}this.depthTexture&&i.applyDepthTexture(this.depthTexture),i.addSystem(t),this.batches.push(i),this.systemToBatchIndex.set(t,this.batches.length-1),this.add(i)}deleteSystem(t){const e=this.systemToBatchIndex.get(t);e!=null&&(this.batches[e].removeSystem(t),this.systemToBatchIndex.delete(t))}setDepthTexture(t){this.depthTexture=t;for(const e of this.batches)e.applyDepthTexture(t)}updateSystem(t){this.deleteSystem(t),this.addSystem(t)}update(t){this.systemToBatchIndex.forEach((e,i)=>{i.update(t)});for(let e=0;e<this.batches.length;e++)this.batches[e].update()}}const Pl=is;hl();console.log("%c Particle system powered by three.quarks. https://quarks.art/","font-size: 14px; font-weight: bold;");const aa=Math.sqrt(5),wl=(aa-1)/4,at=(5-aa)/20,ar=n=>Math.floor(n)|0,cr=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function El(n=Math.random){const t=Rl(n),e=new Float64Array(t).map(a=>cr[a%32*4]),i=new Float64Array(t).map(a=>cr[a%32*4+1]),r=new Float64Array(t).map(a=>cr[a%32*4+2]),s=new Float64Array(t).map(a=>cr[a%32*4+3]);return function(o,c,l,u){let h,f,d,y,_;const p=(o+c+l+u)*wl,m=ar(o+p),g=ar(c+p),v=ar(l+p),S=ar(u+p),x=(m+g+v+S)*at,b=m-x,T=g-x,w=v-x,C=S-x,P=o-b,R=c-T,E=l-w,A=u-C;let k=0,z=0,U=0,L=0;P>R?k++:z++,P>E?k++:U++,P>A?k++:L++,R>E?z++:U++,R>A?z++:L++,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;i<512/2;i++)e[i]=i;for(let i=0;i<512/2-1;i++){const r=i+~~(n()*(256-i)),s=e[i];e[i]=e[r],e[r]=s}for(let i=256;i<512;i++)e[i]=e[i-256];return e}class Al{constructor(t,e){if(this._retries=0,!Number.isInteger(t)||t<0)throw new Error("Base must be a positive integer or zero");if(e!==void 0&&(!Number.isInteger(e)||e<0))throw new Error("ExpMax must be a undefined, a positive integer or zero");this.base=t,this.expMax=e,this.i=0}get retries(){return this._retries}get current(){return this.base*Math.pow(2,this.i)}next(){return this._retries++,this.i=this.expMax===void 0?this.i+1:Math.min(this.i+1,this.expMax),this.current}reset(){this._retries=0,this.i=0}}var G;(function(n){n.open="open",n.close="close",n.error="error",n.message="message",n.retry="retry",n.reconnect="reconnect"})(G||(G={}));class ca{constructor(t,e,i){var r,s,a,o,c,l,u,h,f,d,y,_,p,m,g;this._closedByUser=!1,this.handleOpenEvent=v=>this.handleEvent(G.open,v),this.handleErrorEvent=v=>this.handleEvent(G.error,v),this.handleCloseEvent=v=>this.handleEvent(G.close,v),this.handleMessageEvent=v=>this.handleEvent(G.message,v),this._url=t,this._protocols=e,this._options={buffer:i==null?void 0:i.buffer,retry:{maxRetries:(r=i==null?void 0:i.retry)===null||r===void 0?void 0:r.maxRetries,instantReconnect:(s=i==null?void 0:i.retry)===null||s===void 0?void 0:s.instantReconnect,backoff:(a=i==null?void 0:i.retry)===null||a===void 0?void 0:a.backoff},listeners:{open:[...(c=(o=i==null?void 0:i.listeners)===null||o===void 0?void 0:o.open)!==null&&c!==void 0?c:[]],close:[...(u=(l=i==null?void 0:i.listeners)===null||l===void 0?void 0:l.close)!==null&&u!==void 0?u:[]],error:[...(f=(h=i==null?void 0:i.listeners)===null||h===void 0?void 0:h.error)!==null&&f!==void 0?f:[]],message:[...(y=(d=i==null?void 0:i.listeners)===null||d===void 0?void 0:d.message)!==null&&y!==void 0?y:[]],retry:[...(p=(_=i==null?void 0:i.listeners)===null||_===void 0?void 0:_.retry)!==null&&p!==void 0?p:[]],reconnect:[...(g=(m=i==null?void 0:i.listeners)===null||m===void 0?void 0:m.reconnect)!==null&&g!==void 0?g:[]]}},this._underlyingWebsocket=this.tryConnect()}get url(){return this._url}get protocols(){return this._protocols}get buffer(){return this._options.buffer}get maxRetries(){return this._options.retry.maxRetries}get instantReconnect(){return this._options.retry.instantReconnect}get backoff(){return this._options.retry.backoff}get closedByUser(){return this._closedByUser}get lastConnection(){return this._lastConnection}get underlyingWebsocket(){return this._underlyingWebsocket}get readyState(){return this._underlyingWebsocket.readyState}get bufferedAmount(){return this._underlyingWebsocket.bufferedAmount}get extensions(){return this._underlyingWebsocket.extensions}get binaryType(){return this._underlyingWebsocket.binaryType}set binaryType(t){this._underlyingWebsocket.binaryType=t}send(t){this.closedByUser||(this._underlyingWebsocket.readyState===this._underlyingWebsocket.OPEN?this._underlyingWebsocket.send(t):this.buffer!==void 0&&this.buffer.add(t))}close(t,e){this.cancelScheduledConnectionRetry(),this._closedByUser=!0,this._underlyingWebsocket.close(t,e)}addEventListener(t,e,i){this._options.listeners[t].push({listener:e,options:i})}removeEventListener(t,e,i){const r=s=>s.listener!==e||s.options!==i;this._options.listeners[t]=this._options.listeners[t].filter(r)}tryConnect(){return this._underlyingWebsocket=new WebSocket(this.url,this.protocols),this._underlyingWebsocket.addEventListener(G.open,this.handleOpenEvent),this._underlyingWebsocket.addEventListener(G.close,this.handleCloseEvent),this._underlyingWebsocket.addEventListener(G.error,this.handleErrorEvent),this._underlyingWebsocket.addEventListener(G.message,this.handleMessageEvent),this._underlyingWebsocket}clearWebsocket(){this._underlyingWebsocket.removeEventListener(G.open,this.handleOpenEvent),this._underlyingWebsocket.removeEventListener(G.close,this.handleCloseEvent),this._underlyingWebsocket.removeEventListener(G.error,this.handleErrorEvent),this._underlyingWebsocket.removeEventListener(G.message,this.handleMessageEvent),this._underlyingWebsocket.close()}dispatchEvent(t,e){const i=this._options.listeners[t],r=[];i.forEach(({listener:s,options:a})=>{s(this,e),(a===void 0||a.once===void 0||!a.once)&&r.push({listener:s,options:a})}),this._options.listeners[t]=r}handleEvent(t,e){switch(t){case G.close:this.dispatchEvent(t,e),this.scheduleConnectionRetryIfNeeded();break;case G.open:if(this.backoff!==void 0&&this._lastConnection!==void 0){const i={retries:this.backoff.retries,lastConnection:new Date(this._lastConnection)},r=new CustomEvent(G.reconnect,{detail:i});this.dispatchEvent(G.reconnect,r),this.backoff.reset()}this._lastConnection=new Date,this.dispatchEvent(t,e),this.sendBufferedData();break;case G.retry:this.dispatchEvent(t,e),this.clearWebsocket(),this.tryConnect();break;default:this.dispatchEvent(t,e);break}}sendBufferedData(){if(this.buffer!==void 0)for(let t=this.buffer.read();t!==void 0;t=this.buffer.read())this.send(t)}scheduleConnectionRetryIfNeeded(){if(this.closedByUser||this.backoff===void 0)return;const t=i=>{const r=new CustomEvent(G.retry,{detail:i});this.handleEvent(G.retry,r)},e={backoff:this._options.retry.instantReconnect===!0?0:this.backoff.next(),retries:this._options.retry.instantReconnect===!0?0:this.backoff.retries,lastConnection:this._lastConnection};(this._options.retry.maxRetries===void 0||e.retries<=this._options.retry.maxRetries)&&(this.retryTimeout=globalThis.setTimeout(()=>t(e),e.backoff))}cancelScheduledConnectionRetry(){globalThis.clearTimeout(this.retryTimeout)}}class kl{constructor(t){this._url=t}get url(){return this._url}withProtocols(t){return this._protocols=t,this}get protocols(){return this._protocols}withMaxRetries(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{maxRetries:t})}),this}get maxRetries(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.maxRetries}withInstantReconnect(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{instantReconnect:t})}),this}get instantReconnect(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.instantReconnect}withBackoff(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{backoff:t})}),this}get backoff(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.backoff}withBuffer(t){return this._options=Object.assign(Object.assign({},this._options),{buffer:t}),this}get buffer(){var t;return(t=this._options)===null||t===void 0?void 0:t.buffer}onOpen(t,e){return this.addListener(G.open,t,e),this}onClose(t,e){return this.addListener(G.close,t,e),this}onError(t,e){return this.addListener(G.error,t,e),this}onMessage(t,e){return this.addListener(G.message,t,e),this}onRetry(t,e){return this.addListener(G.retry,t,e),this}onReconnect(t,e){return this.addListener(G.reconnect,t,e),this}build(){return new ca(this._url,this._protocols,this._options)}addListener(t,e,i){var r,s,a,o,c,l,u,h,f,d,y,_,p,m,g,v,S,x,b,T,w;return this._options=Object.assign(Object.assign({},this._options),{listeners:{open:(a=(s=(r=this._options)===null||r===void 0?void 0:r.listeners)===null||s===void 0?void 0:s.open)!==null&&a!==void 0?a:[],close:(l=(c=(o=this._options)===null||o===void 0?void 0:o.listeners)===null||c===void 0?void 0:c.close)!==null&&l!==void 0?l:[],error:(f=(h=(u=this._options)===null||u===void 0?void 0:u.listeners)===null||h===void 0?void 0:h.error)!==null&&f!==void 0?f:[],message:(_=(y=(d=this._options)===null||d===void 0?void 0:d.listeners)===null||y===void 0?void 0:y.message)!==null&&_!==void 0?_:[],retry:(g=(m=(p=this._options)===null||p===void 0?void 0:p.listeners)===null||m===void 0?void 0:m.retry)!==null&&g!==void 0?g:[],reconnect:(x=(S=(v=this._options)===null||v===void 0?void 0:v.listeners)===null||S===void 0?void 0:S.reconnect)!==null&&x!==void 0?x:[],[t]:[...(w=(T=(b=this._options)===null||b===void 0?void 0:b.listeners)===null||T===void 0?void 0:T[t])!==null&&w!==void 0?w:[],{listener:e,options:i}]}}),this}}const zl=Object.freeze(Object.defineProperty({__proto__:null,ExponentialBackoff:Al,Websocket:ca,WebsocketBuilder:kl,get WebsocketEvent(){return G}},Symbol.toStringTag,{value:"Module"})),rs=0,la=1,ua=2,Fn=2,dn=1.25,$s=1,mi=32,$r=65535,Bl=Math.pow(2,-24),pn=Symbol("SKIP_GENERATION");function Ol(n){return n.index?n.index.count:n.attributes.position.count}function Xe(n){return Ol(n)/3}function Il(n,t=ArrayBuffer){return n>65535?new Uint32Array(new t(4*n)):new Uint16Array(new t(2*n))}function Ul(n,t){if(!n.index){const e=n.attributes.position.count,i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,r=Il(e,i);n.setIndex(new M.BufferAttribute(r,1));for(let s=0;s<e;s++)r[s]=s}}function ha(n,t){const e=Xe(n),i=t||n.drawRange,r=i.start/3,s=(i.start+i.count)/3,a=Math.max(0,r),o=Math.min(e,s)-a;return[{offset:Math.floor(a),count:Math.floor(o)}]}function fa(n,t){if(!n.groups||!n.groups.length)return ha(n,t);const e=[],i=new Set,r=t||n.drawRange,s=r.start/3,a=(r.start+r.count)/3;for(const c of n.groups){const l=c.start/3,u=(c.start+c.count)/3;i.add(Math.max(s,l)),i.add(Math.min(a,u))}const o=Array.from(i.values()).sort((c,l)=>c-l);for(let c=0;c<o.length-1;c++){const l=o[c],u=o[c+1];e.push({offset:Math.floor(l),count:Math.floor(u-l)})}return e}function Nl(n,t){const e=Xe(n),i=fa(n,t).sort((a,o)=>a.offset-o.offset),r=i[i.length-1];r.count=Math.min(e-r.offset,r.count);let s=0;return i.forEach(({count:a})=>s+=a),e!==s}function mn(n,t,e,i,r){let s=1/0,a=1/0,o=1/0,c=-1/0,l=-1/0,u=-1/0,h=1/0,f=1/0,d=1/0,y=-1/0,_=-1/0,p=-1/0;for(let m=t*6,g=(t+e)*6;m<g;m+=6){const v=n[m+0],S=n[m+1],x=v-S,b=v+S;x<s&&(s=x),b>c&&(c=b),v<h&&(h=v),v>y&&(y=v);const T=n[m+2],w=n[m+3],C=T-w,P=T+w;C<a&&(a=C),P>l&&(l=P),T<f&&(f=T),T>_&&(_=T);const R=n[m+4],E=n[m+5],A=R-E,k=R+E;A<o&&(o=A),k>u&&(u=k),R<d&&(d=R),R>p&&(p=R)}i[0]=s,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,r[0]=h,r[1]=f,r[2]=d,r[3]=y,r[4]=_,r[5]=p}function Fl(n,t=null,e=null,i=null){const r=n.attributes.position,s=n.index?n.index.array:null,a=Xe(n),o=r.normalized;let c;t===null?(c=new Float32Array(a*6),e=0,i=a):(c=t,e=e||0,i=i||a);const l=r.array,u=r.offset||0;let h=3;r.isInterleavedBufferAttribute&&(h=r.data.stride);const f=["getX","getY","getZ"];for(let d=e;d<e+i;d++){const y=d*3,_=d*6;let p=y+0,m=y+1,g=y+2;s&&(p=s[p],m=s[m],g=s[g]),o||(p=p*h+u,m=m*h+u,g=g*h+u);for(let v=0;v<3;v++){let S,x,b;o?(S=r[f[v]](p),x=r[f[v]](m),b=r[f[v]](g)):(S=l[p+v],x=l[m+v],b=l[g+v]);let T=S;x<T&&(T=x),b<T&&(T=b);let w=S;x>w&&(w=x),b>w&&(w=b);const C=(w-T)/2,P=v*2;c[_+P+0]=T+C,c[_+P+1]=C+(Math.abs(T)+C)*Bl}}return c}function Y(n,t,e){return e.min.x=t[n],e.min.y=t[n+1],e.min.z=t[n+2],e.max.x=t[n+3],e.max.y=t[n+4],e.max.z=t[n+5],e}function qs(n){let t=-1,e=-1/0;for(let i=0;i<3;i++){const r=n[i+3]-n[i];r>e&&(e=r,t=i)}return t}function Xs(n,t){t.set(n)}function Ws(n,t,e){let i,r;for(let s=0;s<3;s++){const a=s+3;i=n[s],r=t[s],e[s]=i<r?i:r,i=n[a],r=t[a],e[a]=i>r?i:r}}function lr(n,t,e){for(let i=0;i<3;i++){const r=t[n+2*i],s=t[n+2*i+1],a=r-s,o=r+s;a<e[i]&&(e[i]=a),o>e[i+3]&&(e[i+3]=o)}}function ei(n){const t=n[3]-n[0],e=n[4]-n[1],i=n[5]-n[2];return 2*(t*e+e*i+i*t)}const ne=32,Dl=(n,t)=>n.candidate-t.candidate,fe=new Array(ne).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),ur=new Float32Array(6);function Ll(n,t,e,i,r,s){let a=-1,o=0;if(s===rs)a=qs(t),a!==-1&&(o=(t[a]+t[a+3])/2);else if(s===la)a=qs(n),a!==-1&&(o=Vl(e,i,r,a));else if(s===ua){const c=ei(n);let l=dn*r;const u=i*6,h=(i+r)*6;for(let f=0;f<3;f++){const d=t[f],p=(t[f+3]-d)/ne;if(r<ne/4){const m=[...fe];m.length=r;let g=0;for(let S=u;S<h;S+=6,g++){const x=m[g];x.candidate=e[S+2*f],x.count=0;const{bounds:b,leftCacheBounds:T,rightCacheBounds:w}=x;for(let C=0;C<3;C++)w[C]=1/0,w[C+3]=-1/0,T[C]=1/0,T[C+3]=-1/0,b[C]=1/0,b[C+3]=-1/0;lr(S,e,b)}m.sort(Dl);let v=r;for(let S=0;S<v;S++){const x=m[S];for(;S+1<v&&m[S+1].candidate===x.candidate;)m.splice(S+1,1),v--}for(let S=u;S<h;S+=6){const x=e[S+2*f];for(let b=0;b<v;b++){const T=m[b];x>=T.candidate?lr(S,e,T.rightCacheBounds):(lr(S,e,T.leftCacheBounds),T.count++)}}for(let S=0;S<v;S++){const x=m[S],b=x.count,T=r-x.count,w=x.leftCacheBounds,C=x.rightCacheBounds;let P=0;b!==0&&(P=ei(w)/c);let R=0;T!==0&&(R=ei(C)/c);const E=$s+dn*(P*b+R*T);E<l&&(a=f,l=E,o=x.candidate)}}else{for(let v=0;v<ne;v++){const S=fe[v];S.count=0,S.candidate=d+p+v*p;const x=S.bounds;for(let b=0;b<3;b++)x[b]=1/0,x[b+3]=-1/0}for(let v=u;v<h;v+=6){let b=~~((e[v+2*f]-d)/p);b>=ne&&(b=ne-1);const T=fe[b];T.count++,lr(v,e,T.bounds)}const m=fe[ne-1];Xs(m.bounds,m.rightCacheBounds);for(let v=ne-2;v>=0;v--){const S=fe[v],x=fe[v+1];Ws(S.bounds,x.rightCacheBounds,S.rightCacheBounds)}let g=0;for(let v=0;v<ne-1;v++){const S=fe[v],x=S.count,b=S.bounds,w=fe[v+1].rightCacheBounds;x!==0&&(g===0?Xs(b,ur):Ws(b,ur,ur)),g+=x;let C=0,P=0;g!==0&&(C=ei(ur)/c);const R=r-g;R!==0&&(P=ei(w)/c);const E=$s+dn*(C*g+P*R);E<l&&(a=f,l=E,o=S.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${s} used.`);return{axis:a,pos:o}}function Vl(n,t,e,i){let r=0;for(let s=t,a=t+e;s<a;s++)r+=n[s*6+i*2];return r/e}class yn{constructor(){this.boundingData=new Float32Array(6)}}function Jl(n,t,e,i,r,s){let a=i,o=i+r-1;const c=s.pos,l=s.axis*2;for(;;){for(;a<=o&&e[a*6+l]<c;)a++;for(;a<=o&&e[o*6+l]>=c;)o--;if(a<o){for(let u=0;u<3;u++){let h=t[a*3+u];t[a*3+u]=t[o*3+u],t[o*3+u]=h}for(let u=0;u<6;u++){let h=e[a*6+u];e[a*6+u]=e[o*6+u],e[o*6+u]=h}a++,o--}else return a}}function Gl(n,t,e,i,r,s){let a=i,o=i+r-1;const c=s.pos,l=s.axis*2;for(;;){for(;a<=o&&e[a*6+l]<c;)a++;for(;a<=o&&e[o*6+l]>=c;)o--;if(a<o){let u=n[a];n[a]=n[o],n[o]=u;for(let h=0;h<6;h++){let f=e[a*6+h];e[a*6+h]=e[o*6+h],e[o*6+h]=f}a++,o--}else return a}}function St(n,t){return t[n+15]===65535}function Mt(n,t){return t[n+6]}function Ct(n,t){return t[n+14]}function Pt(n){return n+8}function wt(n,t){return t[n+6]}function da(n,t){return t[n+7]}let pa,fi,Ar,ma;const jl=Math.pow(2,32);function Dn(n){return"count"in n?1:1+Dn(n.left)+Dn(n.right)}function $l(n,t,e){return pa=new Float32Array(e),fi=new Uint32Array(e),Ar=new Uint16Array(e),ma=new Uint8Array(e),Ln(n,t)}function Ln(n,t){const e=n/4,i=n/2,r="count"in t,s=t.boundingData;for(let a=0;a<6;a++)pa[e+a]=s[a];if(r)if(t.buffer){const a=t.buffer;ma.set(new Uint8Array(a),n);for(let o=n,c=n+a.byteLength;o<c;o+=mi){const l=o/2;St(l,Ar)||(fi[o/4+6]+=e)}return n+a.byteLength}else{const a=t.offset,o=t.count;return fi[e+6]=a,Ar[i+14]=o,Ar[i+15]=$r,n+mi}else{const a=t.left,o=t.right,c=t.splitAxis;let l;if(l=Ln(n+mi,a),l/4>jl)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return fi[e+6]=l/4,l=Ln(l,o),fi[e+7]=c,l}}function ql(n,t){const e=(n.index?n.index.count:n.attributes.position.count)/3,i=e>2**16,r=i?4:2,s=t?new SharedArrayBuffer(e*r):new ArrayBuffer(e*r),a=i?new Uint32Array(s):new Uint16Array(s);for(let o=0,c=a.length;o<c;o++)a[o]=o;return a}function Xl(n,t,e,i,r){const{maxDepth:s,verbose:a,maxLeafTris:o,strategy:c,onProgress:l,indirect:u}=r,h=n._indirectBuffer,f=n.geometry,d=f.index?f.index.array:null,y=u?Gl:Jl,_=Xe(f),p=new Float32Array(6);let m=!1;const g=new yn;return mn(t,e,i,g.boundingData,p),S(g,e,i,p),g;function v(x){l&&l(x/_)}function S(x,b,T,w=null,C=0){if(!m&&C>=s&&(m=!0,a&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),T<=o||C>=s)return v(b+T),x.offset=b,x.count=T,x;const P=Ll(x.boundingData,w,t,b,T,c);if(P.axis===-1)return v(b+T),x.offset=b,x.count=T,x;const R=y(h,d,t,b,T,P);if(R===b||R===b+T)v(b+T),x.offset=b,x.count=T;else{x.splitAxis=P.axis;const E=new yn,A=b,k=R-b;x.left=E,mn(t,A,k,E.boundingData,p),S(E,A,k,p,C+1);const z=new yn,U=R,L=T-k;x.right=z,mn(t,U,L,z.boundingData,p),S(z,U,L,p,C+1)}return x}}function Wl(n,t){const e=n.geometry;t.indirect&&(n._indirectBuffer=ql(e,t.useSharedArrayBuffer),Nl(e,t.range)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Ul(e,t);const i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,r=Fl(e),s=t.indirect?ha(e,t.range):fa(e,t.range);n._roots=s.map(a=>{const o=Xl(n,r,a.offset,a.count,t),c=Dn(o),l=new i(mi*c);return $l(0,o,l),l})}class le{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let i=1/0,r=-1/0;for(let s=0,a=t.length;s<a;s++){const c=t[s][e];i=c<i?c:i,r=c>r?c:r}this.min=i,this.max=r}setFromPoints(t,e){let i=1/0,r=-1/0;for(let s=0,a=e.length;s<a;s++){const o=e[s],c=t.dot(o);i=c<i?c:i,r=c>r?c:r}this.min=i,this.max=r}isSeparated(t){return this.min>t.max||t.min>this.max}}le.prototype.setFromBox=function(){const n=new M.Vector3;return function(e,i){const r=i.min,s=i.max;let a=1/0,o=-1/0;for(let c=0;c<=1;c++)for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){n.x=r.x*c+s.x*(1-c),n.y=r.y*l+s.y*(1-l),n.z=r.z*u+s.z*(1-u);const h=e.dot(n);a=Math.min(h,a),o=Math.max(h,o)}this.min=a,this.max=o}}();const Hl=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Vector3;return function(r,s,a){const o=r.start,c=n,l=s.start,u=t;e.subVectors(o,l),n.subVectors(r.end,r.start),t.subVectors(s.end,s.start);const h=e.dot(u),f=u.dot(c),d=u.dot(u),y=e.dot(c),p=c.dot(c)*d-f*f;let m,g;p!==0?m=(h*f-y*d)/p:m=0,g=(h+m*f)/d,a.x=m,a.y=g}}(),ns=function(){const n=new M.Vector2,t=new M.Vector3,e=new M.Vector3;return function(r,s,a,o){Hl(r,s,n);let c=n.x,l=n.y;if(c>=0&&c<=1&&l>=0&&l<=1){r.at(c,a),s.at(l,o);return}else if(c>=0&&c<=1){l<0?s.at(0,o):s.at(1,o),r.closestPointToPoint(o,!0,a);return}else if(l>=0&&l<=1){c<0?r.at(0,a):r.at(1,a),s.closestPointToPoint(a,!0,o);return}else{let u;c<0?u=r.start:u=r.end;let h;l<0?h=s.start:h=s.end;const f=t,d=e;if(r.closestPointToPoint(h,!0,t),s.closestPointToPoint(u,!0,e),f.distanceToSquared(h)<=d.distanceToSquared(u)){a.copy(f),o.copy(h);return}else{a.copy(u),o.copy(d);return}}}}(),Yl=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Plane,i=new M.Line3;return function(s,a){const{radius:o,center:c}=s,{a:l,b:u,c:h}=a;if(i.start=l,i.end=u,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o||(i.start=l,i.end=h,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o)||(i.start=u,i.end=h,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o))return!0;const _=a.getPlane(e);if(Math.abs(_.distanceToPoint(c))<=o){const m=_.projectPoint(c,t);if(a.containsPoint(m))return!0}return!1}}(),Zl=1e-15;function gn(n){return Math.abs(n)<Zl}class Rt extends M.Triangle{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M.Vector3),this.satBounds=new Array(4).fill().map(()=>new le),this.points=[this.a,this.b,this.c],this.sphere=new M.Sphere,this.plane=new M.Plane,this.needsUpdate=!0}intersectsSphere(t){return Yl(t,this)}update(){const t=this.a,e=this.b,i=this.c,r=this.points,s=this.satAxes,a=this.satBounds,o=s[0],c=a[0];this.getNormal(o),c.setFromPoints(o,r);const l=s[1],u=a[1];l.subVectors(t,e),u.setFromPoints(l,r);const h=s[2],f=a[2];h.subVectors(e,i),f.setFromPoints(h,r);const d=s[3],y=a[3];d.subVectors(i,t),y.setFromPoints(d,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,t),this.needsUpdate=!1}}Rt.prototype.closestPointToSegment=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Line3;return function(r,s=null,a=null){const{start:o,end:c}=r,l=this.points;let u,h=1/0;for(let f=0;f<3;f++){const d=(f+1)%3;e.start.copy(l[f]),e.end.copy(l[d]),ns(e,r,n,t),u=n.distanceToSquared(t),u<h&&(h=u,s&&s.copy(n),a&&a.copy(t))}return this.closestPointToPoint(o,n),u=o.distanceToSquared(n),u<h&&(h=u,s&&s.copy(n),a&&a.copy(o)),this.closestPointToPoint(c,n),u=c.distanceToSquared(n),u<h&&(h=u,s&&s.copy(n),a&&a.copy(c)),Math.sqrt(h)}}();Rt.prototype.intersectsTriangle=function(){const n=new Rt,t=new Array(3),e=new Array(3),i=new le,r=new le,s=new M.Vector3,a=new M.Vector3,o=new M.Vector3,c=new M.Vector3,l=new M.Vector3,u=new M.Line3,h=new M.Line3,f=new M.Line3,d=new M.Vector3;function y(_,p,m){const g=_.points;let v=0,S=-1;for(let x=0;x<3;x++){const{start:b,end:T}=u;b.copy(g[x]),T.copy(g[(x+1)%3]),u.delta(a);const w=gn(p.distanceToPoint(b));if(gn(p.normal.dot(a))&&w){m.copy(u),v=2;break}const C=p.intersectLine(u,d);if(!C&&w&&d.copy(b),(C||w)&&!gn(d.distanceTo(T))){if(v<=1)(v===1?m.start:m.end).copy(d),w&&(S=v);else if(v>=2){(S===1?m.start:m.end).copy(d),v=2;break}if(v++,v===2&&S===-1)break}}return v}return function(p,m=null,g=!1){this.needsUpdate&&this.update(),p.isExtendedTriangle?p.needsUpdate&&p.update():(n.copy(p),n.update(),p=n);const v=this.plane,S=p.plane;if(Math.abs(v.normal.dot(S.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;e[0]=p.a,e[1]=p.b,e[2]=p.c;for(let C=0;C<4;C++){const P=x[C],R=b[C];if(i.setFromPoints(R,e),P.isSeparated(i))return!1}const T=p.satBounds,w=p.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let C=0;C<4;C++){const P=T[C],R=w[C];if(i.setFromPoints(R,t),P.isSeparated(i))return!1}for(let C=0;C<4;C++){const P=b[C];for(let R=0;R<4;R++){const E=w[R];if(s.crossVectors(P,E),i.setFromPoints(s,t),r.setFromPoints(s,e),i.isSeparated(r))return!1}}return m&&(g||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const x=y(this,S,h);if(x===1&&p.containsPoint(h.end))return m&&(m.start.copy(h.end),m.end.copy(h.end)),!0;if(x!==2)return!1;const b=y(p,v,f);if(b===1&&this.containsPoint(f.end))return m&&(m.start.copy(f.end),m.end.copy(f.end)),!0;if(b!==2)return!1;if(h.delta(o),f.delta(c),o.dot(c)<0){let A=f.start;f.start=f.end,f.end=A}const T=h.start.dot(o),w=h.end.dot(o),C=f.start.dot(o),P=f.end.dot(o),R=w<C,E=T<P;return T!==P&&C!==w&&R===E?!1:(m&&(l.subVectors(h.start,f.start),l.dot(o)>0?m.start.copy(h.start):m.start.copy(f.start),l.subVectors(h.end,f.end),l.dot(o)<0?m.end.copy(h.end):m.end.copy(f.end)),!0)}}}();Rt.prototype.distanceToPoint=function(){const n=new M.Vector3;return function(e){return this.closestPointToPoint(e,n),e.distanceTo(n)}}();Rt.prototype.distanceToTriangle=function(){const n=new M.Vector3,t=new M.Vector3,e=["a","b","c"],i=new M.Line3,r=new M.Line3;return function(a,o=null,c=null){const l=o||c?i:null;if(this.intersectsTriangle(a,l))return(o||c)&&(o&&l.getCenter(o),c&&l.getCenter(c)),0;let u=1/0;for(let h=0;h<3;h++){let f;const d=e[h],y=a[d];this.closestPointToPoint(y,n),f=y.distanceToSquared(n),f<u&&(u=f,o&&o.copy(n),c&&c.copy(y));const _=this[d];a.closestPointToPoint(_,n),f=_.distanceToSquared(n),f<u&&(u=f,o&&o.copy(_),c&&c.copy(n))}for(let h=0;h<3;h++){const f=e[h],d=e[(h+1)%3];i.set(this[f],this[d]);for(let y=0;y<3;y++){const _=e[y],p=e[(y+1)%3];r.set(a[_],a[p]),ns(i,r,n,t);const m=n.distanceToSquared(t);m<u&&(u=m,o&&o.copy(n),c&&c.copy(t))}}return Math.sqrt(u)}}();class dt{constructor(t,e,i){this.isOrientedBox=!0,this.min=new M.Vector3,this.max=new M.Vector3,this.matrix=new M.Matrix4,this.invMatrix=new M.Matrix4,this.points=new Array(8).fill().map(()=>new M.Vector3),this.satAxes=new Array(3).fill().map(()=>new M.Vector3),this.satBounds=new Array(3).fill().map(()=>new le),this.alignedSatBounds=new Array(3).fill().map(()=>new le),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),i&&this.matrix.copy(i)}set(t,e,i){this.min.copy(t),this.max.copy(e),this.matrix.copy(i),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}}dt.prototype.update=function(){return function(){const t=this.matrix,e=this.min,i=this.max,r=this.points;for(let l=0;l<=1;l++)for(let u=0;u<=1;u++)for(let h=0;h<=1;h++){const f=1*l|2*u|4*h,d=r[f];d.x=l?i.x:e.x,d.y=u?i.y:e.y,d.z=h?i.z:e.z,d.applyMatrix4(t)}const s=this.satBounds,a=this.satAxes,o=r[0];for(let l=0;l<3;l++){const u=a[l],h=s[l],f=1<<l,d=r[f];u.subVectors(o,d),h.setFromPoints(u,r)}const c=this.alignedSatBounds;c[0].setFromPointsField(r,"x"),c[1].setFromPointsField(r,"y"),c[2].setFromPointsField(r,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();dt.prototype.intersectsBox=function(){const n=new le;return function(e){this.needsUpdate&&this.update();const i=e.min,r=e.max,s=this.satBounds,a=this.satAxes,o=this.alignedSatBounds;if(n.min=i.x,n.max=r.x,o[0].isSeparated(n)||(n.min=i.y,n.max=r.y,o[1].isSeparated(n))||(n.min=i.z,n.max=r.z,o[2].isSeparated(n)))return!1;for(let c=0;c<3;c++){const l=a[c],u=s[c];if(n.setFromBox(l,e),u.isSeparated(n))return!1}return!0}}();dt.prototype.intersectsTriangle=function(){const n=new Rt,t=new Array(3),e=new le,i=new le,r=new M.Vector3;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(n.copy(a),n.update(),a=n);const o=this.satBounds,c=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let f=0;f<3;f++){const d=o[f],y=c[f];if(e.setFromPoints(y,t),d.isSeparated(e))return!1}const l=a.satBounds,u=a.satAxes,h=this.points;for(let f=0;f<3;f++){const d=l[f],y=u[f];if(e.setFromPoints(y,h),d.isSeparated(e))return!1}for(let f=0;f<3;f++){const d=c[f];for(let y=0;y<4;y++){const _=u[y];if(r.crossVectors(d,_),e.setFromPoints(r,t),i.setFromPoints(r,h),e.isSeparated(i))return!1}}return!0}}();dt.prototype.closestPointToPoint=function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e}}();dt.prototype.distanceToPoint=function(){const n=new M.Vector3;return function(e){return this.closestPointToPoint(e,n),e.distanceTo(n)}}();dt.prototype.distanceToBox=function(){const n=["x","y","z"],t=new Array(12).fill().map(()=>new M.Line3),e=new Array(12).fill().map(()=>new M.Line3),i=new M.Vector3,r=new M.Vector3;return function(a,o=0,c=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(c||l)&&(a.getCenter(r),this.closestPointToPoint(r,i),a.closestPointToPoint(i,r),c&&c.copy(i),l&&l.copy(r)),0;const u=o*o,h=a.min,f=a.max,d=this.points;let y=1/0;for(let p=0;p<8;p++){const m=d[p];r.copy(m).clamp(h,f);const g=m.distanceToSquared(r);if(g<y&&(y=g,c&&c.copy(m),l&&l.copy(r),g<u))return Math.sqrt(g)}let _=0;for(let p=0;p<3;p++)for(let m=0;m<=1;m++)for(let g=0;g<=1;g++){const v=(p+1)%3,S=(p+2)%3,x=m<<v|g<<S,b=1<<p|m<<v|g<<S,T=d[x],w=d[b];t[_].set(T,w);const P=n[p],R=n[v],E=n[S],A=e[_],k=A.start,z=A.end;k[P]=h[P],k[R]=m?h[R]:f[R],k[E]=g?h[E]:f[R],z[P]=f[P],z[R]=m?h[R]:f[R],z[E]=g?h[E]:f[R],_++}for(let p=0;p<=1;p++)for(let m=0;m<=1;m++)for(let g=0;g<=1;g++){r.x=p?f.x:h.x,r.y=m?f.y:h.y,r.z=g?f.z:h.z,this.closestPointToPoint(r,i);const v=r.distanceToSquared(i);if(v<y&&(y=v,c&&c.copy(i),l&&l.copy(r),v<u))return Math.sqrt(v)}for(let p=0;p<12;p++){const m=t[p];for(let g=0;g<12;g++){const v=e[g];ns(m,v,i,r);const S=i.distanceToSquared(r);if(S<y&&(y=S,c&&c.copy(i),l&&l.copy(r),S<u))return Math.sqrt(S)}}return Math.sqrt(y)}}();class ss{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){const t=this._primitives;return t.length===0?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}}class Ql extends ss{constructor(){super(()=>new Rt)}}const Et=new Ql;class Kl{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const t=[];let e=null;this.setBuffer=i=>{e&&t.push(e),e=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{e=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,t.length!==0&&this.setBuffer(t.pop())}}}const $=new Kl;let ye,Ve;const Be=[],hr=new ss(()=>new M.Box3);function tu(n,t,e,i,r,s){ye=hr.getPrimitive(),Ve=hr.getPrimitive(),Be.push(ye,Ve),$.setBuffer(n._roots[t]);const a=Vn(0,n.geometry,e,i,r,s);$.clearBuffer(),hr.releasePrimitive(ye),hr.releasePrimitive(Ve),Be.pop(),Be.pop();const o=Be.length;return o>0&&(Ve=Be[o-1],ye=Be[o-2]),a}function Vn(n,t,e,i,r=null,s=0,a=0){const{float32Array:o,uint16Array:c,uint32Array:l}=$;let u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);return Y(n,o,ye),i(f,d,!1,a,s+n,ye)}else{let P=function(E){const{uint16Array:A,uint32Array:k}=$;let z=E*2;for(;!St(z,A);)E=Pt(E),z=E*2;return Mt(E,k)},R=function(E){const{uint16Array:A,uint32Array:k}=$;let z=E*2;for(;!St(z,A);)E=wt(E,k),z=E*2;return Mt(E,k)+Ct(z,A)};const f=Pt(n),d=wt(n,l);let y=f,_=d,p,m,g,v;if(r&&(g=ye,v=Ve,Y(y,o,g),Y(_,o,v),p=r(g),m=r(v),m<p)){y=d,_=f;const E=p;p=m,m=E,g=v}g||(g=ye,Y(y,o,g));const S=St(y*2,c),x=e(g,S,p,a+1,s+y);let b;if(x===Fn){const E=P(y),k=R(y)-E;b=i(E,k,!0,a+1,s+y,g)}else b=x&&Vn(y,t,e,i,r,s,a+1);if(b)return!0;v=Ve,Y(_,o,v);const T=St(_*2,c),w=e(v,T,m,a+1,s+_);let C;if(w===Fn){const E=P(_),k=R(_)-E;C=i(E,k,!0,a+1,s+_,v)}else C=w&&Vn(_,t,e,i,r,s,a+1);return!!C}}const ii=new M.Vector3,vn=new M.Vector3;function eu(n,t,e={},i=0,r=1/0){const s=i*i,a=r*r;let o=1/0,c=null;if(n.shapecast({boundsTraverseOrder:u=>(ii.copy(t).clamp(u.min,u.max),ii.distanceToSquared(t)),intersectsBounds:(u,h,f)=>f<o&&f<a,intersectsTriangle:(u,h)=>{u.closestPointToPoint(t,ii);const f=t.distanceToSquared(ii);return f<o&&(vn.copy(ii),o=f,c=h),f<s}}),o===1/0)return null;const l=Math.sqrt(o);return e.point?e.point.copy(vn):e.point=vn.clone(),e.distance=l,e.faceIndex=c,e}const iu=parseInt(M.REVISION)>=169,Se=new M.Vector3,be=new M.Vector3,Te=new M.Vector3,fr=new M.Vector2,dr=new M.Vector2,pr=new M.Vector2,Hs=new M.Vector3,Ys=new M.Vector3,Zs=new M.Vector3,ri=new M.Vector3;function ru(n,t,e,i,r,s,a,o){let c;if(s===M.BackSide?c=n.intersectTriangle(i,e,t,!0,r):c=n.intersectTriangle(t,e,i,s!==M.DoubleSide,r),c===null)return null;const l=n.origin.distanceTo(r);return l<a||l>o?null:{distance:l,point:r.clone()}}function nu(n,t,e,i,r,s,a,o,c,l,u){Se.fromBufferAttribute(t,s),be.fromBufferAttribute(t,a),Te.fromBufferAttribute(t,o);const h=ru(n,Se,be,Te,ri,c,l,u);if(h){const f=new M.Vector3;M.Triangle.getBarycoord(ri,Se,be,Te,f),i&&(fr.fromBufferAttribute(i,s),dr.fromBufferAttribute(i,a),pr.fromBufferAttribute(i,o),h.uv=M.Triangle.getInterpolation(ri,Se,be,Te,fr,dr,pr,new M.Vector2)),r&&(fr.fromBufferAttribute(r,s),dr.fromBufferAttribute(r,a),pr.fromBufferAttribute(r,o),h.uv1=M.Triangle.getInterpolation(ri,Se,be,Te,fr,dr,pr,new M.Vector2)),e&&(Hs.fromBufferAttribute(e,s),Ys.fromBufferAttribute(e,a),Zs.fromBufferAttribute(e,o),h.normal=M.Triangle.getInterpolation(ri,Se,be,Te,Hs,Ys,Zs,new M.Vector3),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:s,b:a,c:o,normal:new M.Vector3,materialIndex:0};M.Triangle.getNormal(Se,be,Te,d.normal),h.face=d,h.faceIndex=s,iu&&(h.barycoord=f)}return h}function qr(n,t,e,i,r,s,a){const o=i*3;let c=o+0,l=o+1,u=o+2;const h=n.index;n.index&&(c=h.getX(c),l=h.getX(l),u=h.getX(u));const{position:f,normal:d,uv:y,uv1:_}=n.attributes,p=nu(e,f,d,y,_,c,l,u,t,s,a);return p?(p.faceIndex=i,r&&r.push(p),p):null}function et(n,t,e,i){const r=n.a,s=n.b,a=n.c;let o=t,c=t+1,l=t+2;e&&(o=e.getX(o),c=e.getX(c),l=e.getX(l)),r.x=i.getX(o),r.y=i.getY(o),r.z=i.getZ(o),s.x=i.getX(c),s.y=i.getY(c),s.z=i.getZ(c),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l)}function su(n,t,e,i,r,s,a,o){const{geometry:c,_indirectBuffer:l}=n;for(let u=i,h=i+r;u<h;u++)qr(c,t,e,u,s,a,o)}function ou(n,t,e,i,r,s,a){const{geometry:o,_indirectBuffer:c}=n;let l=1/0,u=null;for(let h=i,f=i+r;h<f;h++){let d;d=qr(o,t,e,h,null,s,a),d&&d.distance<l&&(u=d,l=d.distance)}return u}function au(n,t,e,i,r,s,a){const{geometry:o}=e,{index:c}=o,l=o.attributes.position;for(let u=n,h=t+n;u<h;u++){let f;if(f=u,et(a,f*3,c,l),a.needsUpdate=!0,i(a,f,r,s))return!0}return!1}function cu(n,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=n.geometry,i=e.index?e.index.array:null,r=e.attributes.position;let s,a,o,c,l=0;const u=n._roots;for(let f=0,d=u.length;f<d;f++)s=u[f],a=new Uint32Array(s),o=new Uint16Array(s),c=new Float32Array(s),h(0,l),l+=s.byteLength;function h(f,d,y=!1){const _=f*2;if(o[_+15]===$r){const m=a[f+6],g=o[_+14];let v=1/0,S=1/0,x=1/0,b=-1/0,T=-1/0,w=-1/0;for(let C=3*m,P=3*(m+g);C<P;C++){let R=i[C];const E=r.getX(R),A=r.getY(R),k=r.getZ(R);E<v&&(v=E),E>b&&(b=E),A<S&&(S=A),A>T&&(T=A),k<x&&(x=k),k>w&&(w=k)}return c[f+0]!==v||c[f+1]!==S||c[f+2]!==x||c[f+3]!==b||c[f+4]!==T||c[f+5]!==w?(c[f+0]=v,c[f+1]=S,c[f+2]=x,c[f+3]=b,c[f+4]=T,c[f+5]=w,!0):!1}else{const m=f+8,g=a[f+6],v=m+d,S=g+d;let x=y,b=!1,T=!1;t?x||(b=t.has(v),T=t.has(S),x=!b&&!T):(b=!0,T=!0);const w=x||b,C=x||T;let P=!1;w&&(P=h(m,d,x));let R=!1;C&&(R=h(g,d,x));const E=P||R;if(E)for(let A=0;A<3;A++){const k=m+A,z=g+A,U=c[k],L=c[k+3],I=c[z],X=c[z+3];c[f+A]=U<I?U:I,c[f+A+3]=L>X?L:X}return E}}}function ge(n,t,e,i,r){let s,a,o,c,l,u;const h=1/e.direction.x,f=1/e.direction.y,d=1/e.direction.z,y=e.origin.x,_=e.origin.y,p=e.origin.z;let m=t[n],g=t[n+3],v=t[n+1],S=t[n+3+1],x=t[n+2],b=t[n+3+2];return h>=0?(s=(m-y)*h,a=(g-y)*h):(s=(g-y)*h,a=(m-y)*h),f>=0?(o=(v-_)*f,c=(S-_)*f):(o=(S-_)*f,c=(v-_)*f),s>c||o>a||((o>s||isNaN(s))&&(s=o),(c<a||isNaN(a))&&(a=c),d>=0?(l=(x-p)*d,u=(b-p)*d):(l=(b-p)*d,u=(x-p)*d),s>u||l>a)?!1:((l>s||s!==s)&&(s=l),(u<a||a!==a)&&(a=u),s<=r&&a>=i)}function lu(n,t,e,i,r,s,a,o){const{geometry:c,_indirectBuffer:l}=n;for(let u=i,h=i+r;u<h;u++){let f=l?l[u]:u;qr(c,t,e,f,s,a,o)}}function uu(n,t,e,i,r,s,a){const{geometry:o,_indirectBuffer:c}=n;let l=1/0,u=null;for(let h=i,f=i+r;h<f;h++){let d;d=qr(o,t,e,c?c[h]:h,null,s,a),d&&d.distance<l&&(u=d,l=d.distance)}return u}function hu(n,t,e,i,r,s,a){const{geometry:o}=e,{index:c}=o,l=o.attributes.position;for(let u=n,h=t+n;u<h;u++){let f;if(f=e.resolveTriangleIndex(u),et(a,f*3,c,l),a.needsUpdate=!0,i(a,f,r,s))return!0}return!1}function fu(n,t,e,i,r,s,a){$.setBuffer(n._roots[t]),Jn(0,n,e,i,r,s,a),$.clearBuffer()}function Jn(n,t,e,i,r,s,a){const{float32Array:o,uint16Array:c,uint32Array:l}=$,u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);su(t,e,i,f,d,r,s,a)}else{const f=Pt(n);ge(f,o,i,s,a)&&Jn(f,t,e,i,r,s,a);const d=wt(n,l);ge(d,o,i,s,a)&&Jn(d,t,e,i,r,s,a)}}const du=["x","y","z"];function pu(n,t,e,i,r,s){$.setBuffer(n._roots[t]);const a=Gn(0,n,e,i,r,s);return $.clearBuffer(),a}function Gn(n,t,e,i,r,s){const{float32Array:a,uint16Array:o,uint32Array:c}=$;let l=n*2;if(St(l,o)){const h=Mt(n,c),f=Ct(l,o);return ou(t,e,i,h,f,r,s)}else{const h=da(n,c),f=du[h],y=i.direction[f]>=0;let _,p;y?(_=Pt(n),p=wt(n,c)):(_=wt(n,c),p=Pt(n));const g=ge(_,a,i,r,s)?Gn(_,t,e,i,r,s):null;if(g){const x=g.point[f];if(y?x<=a[p+h]:x>=a[p+h+3])return g}const S=ge(p,a,i,r,s)?Gn(p,t,e,i,r,s):null;return g&&S?g.distance<=S.distance?g:S:g||S||null}}const mr=new M.Box3,Oe=new Rt,Ie=new Rt,ni=new M.Matrix4,Qs=new dt,yr=new dt;function mu(n,t,e,i){$.setBuffer(n._roots[t]);const r=jn(0,n,e,i);return $.clearBuffer(),r}function jn(n,t,e,i,r=null){const{float32Array:s,uint16Array:a,uint32Array:o}=$;let c=n*2;if(r===null&&(e.boundingBox||e.computeBoundingBox(),Qs.set(e.boundingBox.min,e.boundingBox.max,i),r=Qs),St(c,a)){const u=t.geometry,h=u.index,f=u.attributes.position,d=e.index,y=e.attributes.position,_=Mt(n,o),p=Ct(c,a);if(ni.copy(i).invert(),e.boundsTree)return Y(n,s,yr),yr.matrix.copy(ni),yr.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:g=>yr.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(i),g.b.applyMatrix4(i),g.c.applyMatrix4(i),g.needsUpdate=!0;for(let v=_*3,S=(p+_)*3;v<S;v+=3)if(et(Ie,v,h,f),Ie.needsUpdate=!0,g.intersectsTriangle(Ie))return!0;return!1}});for(let m=_*3,g=(p+_)*3;m<g;m+=3){et(Oe,m,h,f),Oe.a.applyMatrix4(ni),Oe.b.applyMatrix4(ni),Oe.c.applyMatrix4(ni),Oe.needsUpdate=!0;for(let v=0,S=d.count;v<S;v+=3)if(et(Ie,v,d,y),Ie.needsUpdate=!0,Oe.intersectsTriangle(Ie))return!0}}else{const u=n+8,h=o[n+6];return Y(u,s,mr),!!(r.intersectsBox(mr)&&jn(u,t,e,i,r)||(Y(h,s,mr),r.intersectsBox(mr)&&jn(h,t,e,i,r)))}}const gr=new M.Matrix4,_n=new dt,si=new dt,yu=new M.Vector3,gu=new M.Vector3,vu=new M.Vector3,_u=new M.Vector3;function xu(n,t,e,i={},r={},s=0,a=1/0){t.boundingBox||t.computeBoundingBox(),_n.set(t.boundingBox.min,t.boundingBox.max,e),_n.needsUpdate=!0;const o=n.geometry,c=o.attributes.position,l=o.index,u=t.attributes.position,h=t.index,f=Et.getPrimitive(),d=Et.getPrimitive();let y=yu,_=gu,p=null,m=null;r&&(p=vu,m=_u);let g=1/0,v=null,S=null;return gr.copy(e).invert(),si.matrix.copy(gr),n.shapecast({boundsTraverseOrder:x=>_n.distanceToBox(x),intersectsBounds:(x,b,T)=>T<g&&T<a?(b&&(si.min.copy(x.min),si.max.copy(x.max),si.needsUpdate=!0),!0):!1,intersectsRange:(x,b)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:w=>si.distanceToBox(w),intersectsBounds:(w,C,P)=>P<g&&P<a,intersectsRange:(w,C)=>{for(let P=w,R=w+C;P<R;P++){et(d,3*P,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let E=x,A=x+b;E<A;E++){et(f,3*E,l,c),f.needsUpdate=!0;const k=f.distanceToTriangle(d,y,p);if(k<g&&(_.copy(y),m&&m.copy(p),g=k,v=E,S=P),k<s)return!0}}}});{const T=Xe(t);for(let w=0,C=T;w<C;w++){et(d,3*w,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=x,R=x+b;P<R;P++){et(f,3*P,l,c),f.needsUpdate=!0;const E=f.distanceToTriangle(d,y,p);if(E<g&&(_.copy(y),m&&m.copy(p),g=E,v=P,S=w),E<s)return!0}}}}}),Et.releasePrimitive(f),Et.releasePrimitive(d),g===1/0?null:(i.point?i.point.copy(_):i.point=_.clone(),i.distance=g,i.faceIndex=v,r&&(r.point?r.point.copy(m):r.point=m.clone(),r.point.applyMatrix4(gr),_.applyMatrix4(gr),r.distance=_.sub(r.point).length(),r.faceIndex=S),i)}function Su(n,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=n.geometry,i=e.index?e.index.array:null,r=e.attributes.position;let s,a,o,c,l=0;const u=n._roots;for(let f=0,d=u.length;f<d;f++)s=u[f],a=new Uint32Array(s),o=new Uint16Array(s),c=new Float32Array(s),h(0,l),l+=s.byteLength;function h(f,d,y=!1){const _=f*2;if(o[_+15]===$r){const m=a[f+6],g=o[_+14];let v=1/0,S=1/0,x=1/0,b=-1/0,T=-1/0,w=-1/0;for(let C=m,P=m+g;C<P;C++){const R=3*n.resolveTriangleIndex(C);for(let E=0;E<3;E++){let A=R+E;A=i?i[A]:A;const k=r.getX(A),z=r.getY(A),U=r.getZ(A);k<v&&(v=k),k>b&&(b=k),z<S&&(S=z),z>T&&(T=z),U<x&&(x=U),U>w&&(w=U)}}return c[f+0]!==v||c[f+1]!==S||c[f+2]!==x||c[f+3]!==b||c[f+4]!==T||c[f+5]!==w?(c[f+0]=v,c[f+1]=S,c[f+2]=x,c[f+3]=b,c[f+4]=T,c[f+5]=w,!0):!1}else{const m=f+8,g=a[f+6],v=m+d,S=g+d;let x=y,b=!1,T=!1;t?x||(b=t.has(v),T=t.has(S),x=!b&&!T):(b=!0,T=!0);const w=x||b,C=x||T;let P=!1;w&&(P=h(m,d,x));let R=!1;C&&(R=h(g,d,x));const E=P||R;if(E)for(let A=0;A<3;A++){const k=m+A,z=g+A,U=c[k],L=c[k+3],I=c[z],X=c[z+3];c[f+A]=U<I?U:I,c[f+A+3]=L>X?L:X}return E}}}function bu(n,t,e,i,r,s,a){$.setBuffer(n._roots[t]),$n(0,n,e,i,r,s,a),$.clearBuffer()}function $n(n,t,e,i,r,s,a){const{float32Array:o,uint16Array:c,uint32Array:l}=$,u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);lu(t,e,i,f,d,r,s,a)}else{const f=Pt(n);ge(f,o,i,s,a)&&$n(f,t,e,i,r,s,a);const d=wt(n,l);ge(d,o,i,s,a)&&$n(d,t,e,i,r,s,a)}}const Tu=["x","y","z"];function Mu(n,t,e,i,r,s){$.setBuffer(n._roots[t]);const a=qn(0,n,e,i,r,s);return $.clearBuffer(),a}function qn(n,t,e,i,r,s){const{float32Array:a,uint16Array:o,uint32Array:c}=$;let l=n*2;if(St(l,o)){const h=Mt(n,c),f=Ct(l,o);return uu(t,e,i,h,f,r,s)}else{const h=da(n,c),f=Tu[h],y=i.direction[f]>=0;let _,p;y?(_=Pt(n),p=wt(n,c)):(_=wt(n,c),p=Pt(n));const g=ge(_,a,i,r,s)?qn(_,t,e,i,r,s):null;if(g){const x=g.point[f];if(y?x<=a[p+h]:x>=a[p+h+3])return g}const S=ge(p,a,i,r,s)?qn(p,t,e,i,r,s):null;return g&&S?g.distance<=S.distance?g:S:g||S||null}}const vr=new M.Box3,Ue=new Rt,Ne=new Rt,oi=new M.Matrix4,Ks=new dt,_r=new dt;function Cu(n,t,e,i){$.setBuffer(n._roots[t]);const r=Xn(0,n,e,i);return $.clearBuffer(),r}function Xn(n,t,e,i,r=null){const{float32Array:s,uint16Array:a,uint32Array:o}=$;let c=n*2;if(r===null&&(e.boundingBox||e.computeBoundingBox(),Ks.set(e.boundingBox.min,e.boundingBox.max,i),r=Ks),St(c,a)){const u=t.geometry,h=u.index,f=u.attributes.position,d=e.index,y=e.attributes.position,_=Mt(n,o),p=Ct(c,a);if(oi.copy(i).invert(),e.boundsTree)return Y(n,s,_r),_r.matrix.copy(oi),_r.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:g=>_r.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(i),g.b.applyMatrix4(i),g.c.applyMatrix4(i),g.needsUpdate=!0;for(let v=_,S=p+_;v<S;v++)if(et(Ne,3*t.resolveTriangleIndex(v),h,f),Ne.needsUpdate=!0,g.intersectsTriangle(Ne))return!0;return!1}});for(let m=_,g=p+_;m<g;m++){const v=t.resolveTriangleIndex(m);et(Ue,3*v,h,f),Ue.a.applyMatrix4(oi),Ue.b.applyMatrix4(oi),Ue.c.applyMatrix4(oi),Ue.needsUpdate=!0;for(let S=0,x=d.count;S<x;S+=3)if(et(Ne,S,d,y),Ne.needsUpdate=!0,Ue.intersectsTriangle(Ne))return!0}}else{const u=n+8,h=o[n+6];return Y(u,s,vr),!!(r.intersectsBox(vr)&&Xn(u,t,e,i,r)||(Y(h,s,vr),r.intersectsBox(vr)&&Xn(h,t,e,i,r)))}}const xr=new M.Matrix4,xn=new dt,ai=new dt,Pu=new M.Vector3,wu=new M.Vector3,Eu=new M.Vector3,Ru=new M.Vector3;function Au(n,t,e,i={},r={},s=0,a=1/0){t.boundingBox||t.computeBoundingBox(),xn.set(t.boundingBox.min,t.boundingBox.max,e),xn.needsUpdate=!0;const o=n.geometry,c=o.attributes.position,l=o.index,u=t.attributes.position,h=t.index,f=Et.getPrimitive(),d=Et.getPrimitive();let y=Pu,_=wu,p=null,m=null;r&&(p=Eu,m=Ru);let g=1/0,v=null,S=null;return xr.copy(e).invert(),ai.matrix.copy(xr),n.shapecast({boundsTraverseOrder:x=>xn.distanceToBox(x),intersectsBounds:(x,b,T)=>T<g&&T<a?(b&&(ai.min.copy(x.min),ai.max.copy(x.max),ai.needsUpdate=!0),!0):!1,intersectsRange:(x,b)=>{if(t.boundsTree){const T=t.boundsTree;return T.shapecast({boundsTraverseOrder:w=>ai.distanceToBox(w),intersectsBounds:(w,C,P)=>P<g&&P<a,intersectsRange:(w,C)=>{for(let P=w,R=w+C;P<R;P++){const E=T.resolveTriangleIndex(P);et(d,3*E,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let A=x,k=x+b;A<k;A++){const z=n.resolveTriangleIndex(A);et(f,3*z,l,c),f.needsUpdate=!0;const U=f.distanceToTriangle(d,y,p);if(U<g&&(_.copy(y),m&&m.copy(p),g=U,v=A,S=P),U<s)return!0}}}})}else{const T=Xe(t);for(let w=0,C=T;w<C;w++){et(d,3*w,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=x,R=x+b;P<R;P++){const E=n.resolveTriangleIndex(P);et(f,3*E,l,c),f.needsUpdate=!0;const A=f.distanceToTriangle(d,y,p);if(A<g&&(_.copy(y),m&&m.copy(p),g=A,v=P,S=w),A<s)return!0}}}}}),Et.releasePrimitive(f),Et.releasePrimitive(d),g===1/0?null:(i.point?i.point.copy(_):i.point=_.clone(),i.distance=g,i.faceIndex=v,r&&(r.point?r.point.copy(m):r.point=m.clone(),r.point.applyMatrix4(xr),_.applyMatrix4(xr),r.distance=_.sub(r.point).length(),r.faceIndex=S),i)}function ku(){return typeof SharedArrayBuffer<"u"}const yi=new $.constructor,Lr=new $.constructor,pe=new ss(()=>new M.Box3),Fe=new M.Box3,De=new M.Box3,Sn=new M.Box3,bn=new M.Box3;let Tn=!1;function zu(n,t,e,i){if(Tn)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Tn=!0;const r=n._roots,s=t._roots;let a,o=0,c=0;const l=new M.Matrix4().copy(e).invert();for(let u=0,h=r.length;u<h;u++){yi.setBuffer(r[u]),c=0;const f=pe.getPrimitive();Y(0,yi.float32Array,f),f.applyMatrix4(l);for(let d=0,y=s.length;d<y&&(Lr.setBuffer(s[d]),a=Ut(0,0,e,l,i,o,c,0,0,f),Lr.clearBuffer(),c+=s[d].length,!a);d++);if(pe.releasePrimitive(f),yi.clearBuffer(),o+=r[u].length,a)break}return Tn=!1,a}function Ut(n,t,e,i,r,s=0,a=0,o=0,c=0,l=null,u=!1){let h,f;u?(h=Lr,f=yi):(h=yi,f=Lr);const d=h.float32Array,y=h.uint32Array,_=h.uint16Array,p=f.float32Array,m=f.uint32Array,g=f.uint16Array,v=n*2,S=t*2,x=St(v,_),b=St(S,g);let T=!1;if(b&&x)u?T=r(Mt(t,m),Ct(t*2,g),Mt(n,y),Ct(n*2,_),c,a+t,o,s+n):T=r(Mt(n,y),Ct(n*2,_),Mt(t,m),Ct(t*2,g),o,s+n,c,a+t);else if(b){const w=pe.getPrimitive();Y(t,p,w),w.applyMatrix4(e);const C=Pt(n),P=wt(n,y);Y(C,d,Fe),Y(P,d,De);const R=w.intersectsBox(Fe),E=w.intersectsBox(De);T=R&&Ut(t,C,i,e,r,a,s,c,o+1,w,!u)||E&&Ut(t,P,i,e,r,a,s,c,o+1,w,!u),pe.releasePrimitive(w)}else{const w=Pt(t),C=wt(t,m);Y(w,p,Sn),Y(C,p,bn);const P=l.intersectsBox(Sn),R=l.intersectsBox(bn);if(P&&R)T=Ut(n,w,e,i,r,s,a,o,c+1,l,u)||Ut(n,C,e,i,r,s,a,o,c+1,l,u);else if(P)if(x)T=Ut(n,w,e,i,r,s,a,o,c+1,l,u);else{const E=pe.getPrimitive();E.copy(Sn).applyMatrix4(e);const A=Pt(n),k=wt(n,y);Y(A,d,Fe),Y(k,d,De);const z=E.intersectsBox(Fe),U=E.intersectsBox(De);T=z&&Ut(w,A,i,e,r,a,s,c,o+1,E,!u)||U&&Ut(w,k,i,e,r,a,s,c,o+1,E,!u),pe.releasePrimitive(E)}else if(R)if(x)T=Ut(n,C,e,i,r,s,a,o,c+1,l,u);else{const E=pe.getPrimitive();E.copy(bn).applyMatrix4(e);const A=Pt(n),k=wt(n,y);Y(A,d,Fe),Y(k,d,De);const z=E.intersectsBox(Fe),U=E.intersectsBox(De);T=z&&Ut(C,A,i,e,r,a,s,c,o+1,E,!u)||U&&Ut(C,k,i,e,r,a,s,c,o+1,E,!u),pe.releasePrimitive(E)}}return T}const Sr=new dt,to=new M.Box3,Bu={strategy:rs,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null};class Ki{static serialize(t,e={}){e={cloneBuffers:!0,...e};const i=t.geometry,r=t._roots,s=t._indirectBuffer,a=i.getIndex();let o;return e.cloneBuffers?o={roots:r.map(c=>c.slice()),index:a?a.array.slice():null,indirectBuffer:s?s.slice():null}:o={roots:r,index:a?a.array:null,indirectBuffer:s},o}static deserialize(t,e,i={}){i={setIndex:!0,indirect:!!t.indirectBuffer,...i};const{index:r,roots:s,indirectBuffer:a}=t,o=new Ki(e,{...i,[pn]:!0});if(o._roots=s,o._indirectBuffer=a||null,i.setIndex){const c=e.getIndex();if(c===null){const l=new M.BufferAttribute(t.index,1,!1);e.setIndex(l)}else c.array!==r&&(c.array.set(r),c.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(t,e={}){if(t.isBufferGeometry){if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e=Object.assign({...Bu,[pn]:!1},e),e.useSharedArrayBuffer&&!ku())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=t,this._roots=null,this._indirectBuffer=null,e[pn]||(Wl(this,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new M.Box3))),this.resolveTriangleIndex=e.indirect?i=>this._indirectBuffer[i]:i=>i}refit(t=null){return(this.indirect?Su:cu)(this,t)}traverse(t,e=0){const i=this._roots[e],r=new Uint32Array(i),s=new Uint16Array(i);a(0);function a(o,c=0){const l=o*2,u=s[l+15]===$r;if(u){const h=r[o+6],f=s[l+14];t(c,u,new Float32Array(i,o*4,6),h,f)}else{const h=o+mi/4,f=r[o+6],d=r[o+7];t(c,u,new Float32Array(i,o*4,6),d)||(a(h,c+1),a(f,c+1))}}}raycast(t,e=M.FrontSide,i=0,r=1/0){const s=this._roots,a=this.geometry,o=[],c=e.isMaterial,l=Array.isArray(e),u=a.groups,h=c?e.side:e,f=this.indirect?bu:fu;for(let d=0,y=s.length;d<y;d++){const _=l?e[u[d].materialIndex].side:h,p=o.length;if(f(this,d,_,t,o,i,r),l){const m=u[d].materialIndex;for(let g=p,v=o.length;g<v;g++)o[g].face.materialIndex=m}}return o}raycastFirst(t,e=M.FrontSide,i=0,r=1/0){const s=this._roots,a=this.geometry,o=e.isMaterial,c=Array.isArray(e);let l=null;const u=a.groups,h=o?e.side:e,f=this.indirect?Mu:pu;for(let d=0,y=s.length;d<y;d++){const _=c?e[u[d].materialIndex].side:h,p=f(this,d,_,t,i,r);p!=null&&(l==null||p.distance<l.distance)&&(l=p,c&&(p.face.materialIndex=u[d].materialIndex))}return l}intersectsGeometry(t,e){let i=!1;const r=this._roots,s=this.indirect?Cu:mu;for(let a=0,o=r.length;a<o&&(i=s(this,a,t,e),!i);a++);return i}shapecast(t){const e=Et.getPrimitive(),i=this.indirect?hu:au;let{boundsTraverseOrder:r,intersectsBounds:s,intersectsRange:a,intersectsTriangle:o}=t;if(a&&o){const h=a;a=(f,d,y,_,p)=>h(f,d,y,_,p)?!0:i(f,d,this,o,y,_,e)}else a||(o?a=(h,f,d,y)=>i(h,f,this,o,d,y,e):a=(h,f,d)=>d);let c=!1,l=0;const u=this._roots;for(let h=0,f=u.length;h<f;h++){const d=u[h];if(c=tu(this,h,s,a,r,l),c)break;l+=d.byteLength}return Et.releasePrimitive(e),c}bvhcast(t,e,i){let{intersectsRanges:r,intersectsTriangles:s}=i;const a=Et.getPrimitive(),o=this.geometry.index,c=this.geometry.attributes.position,l=this.indirect?y=>{const _=this.resolveTriangleIndex(y);et(a,_*3,o,c)}:y=>{et(a,y*3,o,c)},u=Et.getPrimitive(),h=t.geometry.index,f=t.geometry.attributes.position,d=t.indirect?y=>{const _=t.resolveTriangleIndex(y);et(u,_*3,h,f)}:y=>{et(u,y*3,h,f)};if(s){const y=(_,p,m,g,v,S,x,b)=>{for(let T=m,w=m+g;T<w;T++){d(T),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let C=_,P=_+p;C<P;C++)if(l(C),a.needsUpdate=!0,s(a,u,C,T,v,S,x,b))return!0}return!1};if(r){const _=r;r=function(p,m,g,v,S,x,b,T){return _(p,m,g,v,S,x,b,T)?!0:y(p,m,g,v,S,x,b,T)}}else r=y}return zu(this,t,e,r)}intersectsBox(t,e){return Sr.set(t.min,t.max,e),Sr.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Sr.intersectsBox(i),intersectsTriangle:i=>Sr.intersectsTriangle(i)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,i={},r={},s=0,a=1/0){return(this.indirect?Au:xu)(this,t,e,i,r,s,a)}closestPointToPoint(t,e={},i=0,r=1/0){return eu(this,t,e,i,r)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(i=>{Y(0,new Float32Array(i),to),t.union(to)}),t}}function eo(n,t,e){return n===null?null:(n.point.applyMatrix4(t.matrixWorld),n.distance=n.point.distanceTo(e.ray.origin),n.object=t,n)}const br=new M.Ray,io=new M.Vector3,ro=new M.Matrix4,Ou=M.Mesh.prototype.raycast,Iu=M.BatchedMesh.prototype.raycast,no=new M.Vector3,ct=new M.Mesh,Tr=[];function Uu(n,t){this.isBatchedMesh?Nu.call(this,n,t):Fu.call(this,n,t)}function Nu(n,t){if(this.boundsTrees){const e=this.boundsTrees,i=this._drawInfo||this._instanceInfo,r=this._drawRanges||this._geometryInfo,s=this.matrixWorld;ct.material=this.material,ct.geometry=this.geometry;const a=ct.geometry.boundsTree,o=ct.geometry.drawRange;ct.geometry.boundingSphere===null&&(ct.geometry.boundingSphere=new M.Sphere);for(let c=0,l=i.length;c<l;c++){if(!this.getVisibleAt(c))continue;const u=i[c].geometryIndex;if(ct.geometry.boundsTree=e[u],this.getMatrixAt(c,ct.matrixWorld).premultiply(s),!ct.geometry.boundsTree){this.getBoundingBoxAt(u,ct.geometry.boundingBox),this.getBoundingSphereAt(u,ct.geometry.boundingSphere);const h=r[u];ct.geometry.setDrawRange(h.start,h.count)}ct.raycast(n,Tr);for(let h=0,f=Tr.length;h<f;h++){const d=Tr[h];d.object=this,d.batchId=c,t.push(d)}Tr.length=0}ct.geometry.boundsTree=a,ct.geometry.drawRange=o,ct.material=null,ct.geometry=null}else Iu.call(this,n,t)}function Fu(n,t){if(this.geometry.boundsTree){if(this.material===void 0)return;ro.copy(this.matrixWorld).invert(),br.copy(n.ray).applyMatrix4(ro),no.setFromMatrixScale(this.matrixWorld),io.copy(br.direction).multiply(no);const e=io.length(),i=n.near/e,r=n.far/e,s=this.geometry.boundsTree;if(n.firstHitOnly===!0){const a=eo(s.raycastFirst(br,this.material,i,r),this,n);a&&t.push(a)}else{const a=s.raycast(br,this.material,i,r);for(let o=0,c=a.length;o<c;o++){const l=eo(a[o],this,n);l&&t.push(l)}}}else Ou.call(this,n,t)}function Du(n={}){return this.boundsTree=new Ki(this,n),this.boundsTree}const Me=new M.Vector3,Ce=new M.Vector3,Pe=new M.Vector3,so=new M.Vector4,Mr=new M.Vector3,Mn=new M.Vector3,oo=new M.Vector4,ao=new M.Vector4,Cr=new M.Matrix4,co=new M.Matrix4;function ci(n,t){if(!n&&!t)return;const e=n.count===t.count,i=n.normalized===t.normalized,r=n.array.constructor===t.array.constructor,s=n.itemSize===t.itemSize;if(!e||!i||!r||!s)throw new Error}function di(n,t=null){const e=n.array.constructor,i=n.normalized,r=n.itemSize,s=t===null?n.count:t;return new M.BufferAttribute(new e(r*s),r,i)}function ya(n,t,e=0){if(n.isInterleavedBufferAttribute){const i=n.itemSize;for(let r=0,s=n.count;r<s;r++){const a=r+e;t.setX(a,n.getX(r)),i>=2&&t.setY(a,n.getY(r)),i>=3&&t.setZ(a,n.getZ(r)),i>=4&&t.setW(a,n.getW(r))}}else{const i=t.array,r=i.constructor,s=i.BYTES_PER_ELEMENT*n.itemSize*e;new r(i.buffer,s,n.array.length).set(n.array)}}function Lu(n,t,e){const i=n.elements,r=t.elements;for(let s=0,a=r.length;s<a;s++)i[s]+=r[s]*e}function lo(n,t,e){const i=n.skeleton,r=n.geometry,s=i.bones,a=i.boneInverses;oo.fromBufferAttribute(r.attributes.skinIndex,t),ao.fromBufferAttribute(r.attributes.skinWeight,t),Cr.elements.fill(0);for(let o=0;o<4;o++){const c=ao.getComponent(o);if(c!==0){const l=oo.getComponent(o);co.multiplyMatrices(s[l].matrixWorld,a[l]),Lu(Cr,co,c)}}return Cr.multiply(n.bindMatrix).premultiply(n.bindMatrixInverse),e.transformDirection(Cr),e}function Cn(n,t,e,i,r){Mr.set(0,0,0);for(let s=0,a=n.length;s<a;s++){const o=t[s],c=n[s];o!==0&&(Mn.fromBufferAttribute(c,i),e?Mr.addScaledVector(Mn,o):Mr.addScaledVector(Mn.sub(r),o))}r.add(Mr)}function Vu(n,t={useGroups:!1,updateIndex:!1,skipAttributes:[]},e=new M.BufferGeometry){const i=n[0].index!==null,{useGroups:r=!1,updateIndex:s=!1,skipAttributes:a=[]}=t,o=new Set(Object.keys(n[0].attributes)),c={};let l=0;e.clearGroups();for(let u=0;u<n.length;++u){const h=n[u];let f=0;if(i!==(h.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(const d in h.attributes){if(!o.has(d))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.');c[d]===void 0&&(c[d]=[]),c[d].push(h.attributes[d]),f++}if(f!==o.size)throw new Error("StaticGeometryGenerator: Make sure all geometries have the same number of attributes.");if(r){let d;if(i)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else throw new Error("StaticGeometryGenerator: The geometry must have either an index or a position attribute");e.addGroup(l,d,u),l+=d}}if(i){let u=!1;if(!e.index){let h=0;for(let f=0;f<n.length;++f)h+=n[f].index.count;e.setIndex(new M.BufferAttribute(new Uint32Array(h),1,!1)),u=!0}if(s||u){const h=e.index;let f=0,d=0;for(let y=0;y<n.length;++y){const _=n[y],p=_.index;if(a[y]!==!0)for(let m=0;m<p.count;++m)h.setX(f,p.getX(m)+d),f++;d+=_.attributes.position.count}}}for(const u in c){const h=c[u];if(!(u in e.attributes)){let y=0;for(const _ in h)y+=h[_].count;e.setAttribute(u,di(c[u][0],y))}const f=e.attributes[u];let d=0;for(let y=0,_=h.length;y<_;y++){const p=h[y];a[y]!==!0&&ya(p,f,d),d+=p.count}}return e}function Ju(n,t){if(n===null||t===null)return n===t;if(n.length!==t.length)return!1;for(let e=0,i=n.length;e<i;e++)if(n[e]!==t[e])return!1;return!0}function Gu(n){const{index:t,attributes:e}=n;if(t)for(let i=0,r=t.count;i<r;i+=3){const s=t.getX(i),a=t.getX(i+2);t.setX(i,a),t.setX(i+2,s)}else for(const i in e){const r=e[i],s=r.itemSize;for(let a=0,o=r.count;a<o;a+=3)for(let c=0;c<s;c++){const l=r.getComponent(a,c),u=r.getComponent(a+2,c);r.setComponent(a,c,u),r.setComponent(a+2,c,l)}}return n}class ju{constructor(t){this.matrixWorld=new M.Matrix4,this.geometryHash=null,this.boneMatrices=null,this.primitiveCount=-1,this.mesh=t,this.update()}update(){const t=this.mesh,e=t.geometry,i=t.skeleton,r=(e.index?e.index.count:e.attributes.position.count)/3;if(this.matrixWorld.copy(t.matrixWorld),this.geometryHash=e.attributes.position.version,this.primitiveCount=r,i){i.boneTexture||i.computeBoneTexture(),i.update();const s=i.boneMatrices;!this.boneMatrices||this.boneMatrices.length!==s.length?this.boneMatrices=s.slice():this.boneMatrices.set(s)}else this.boneMatrices=null}didChange(){const t=this.mesh,e=t.geometry,i=(e.index?e.index.count:e.attributes.position.count)/3;return!(this.matrixWorld.equals(t.matrixWorld)&&this.geometryHash===e.attributes.position.version&&Ju(t.skeleton&&t.skeleton.boneMatrices||null,this.boneMatrices)&&this.primitiveCount===i)}}class $u{constructor(t){Array.isArray(t)||(t=[t]);const e=[];t.forEach(i=>{i.traverseVisible(r=>{r.isMesh&&e.push(r)})}),this.meshes=e,this.useGroups=!0,this.applyWorldTransforms=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Array(e.length).fill().map(()=>new M.BufferGeometry),this._diffMap=new WeakMap}getMaterials(){const t=[];return this.meshes.forEach(e=>{Array.isArray(e.material)?t.push(...e.material):t.push(e.material)}),t}generate(t=new M.BufferGeometry){let e=[];const{meshes:i,useGroups:r,_intermediateGeometry:s,_diffMap:a}=this;for(let o=0,c=i.length;o<c;o++){const l=i[o],u=s[o],h=a.get(l);!h||h.didChange(l)?(this._convertToStaticGeometry(l,u),e.push(!1),h?h.update():a.set(l,new ju(l))):e.push(!0)}if(s.length===0){t.setIndex(null);const o=t.attributes;for(const c in o)t.deleteAttribute(c);for(const c in this.attributes)t.setAttribute(this.attributes[c],new M.BufferAttribute(new Float32Array(0),4,!1))}else Vu(s,{useGroups:r,skipAttributes:e},t);for(const o in t.attributes)t.attributes[o].needsUpdate=!0;return t}_convertToStaticGeometry(t,e=new M.BufferGeometry){const i=t.geometry,r=this.applyWorldTransforms,s=this.attributes.includes("normal"),a=this.attributes.includes("tangent"),o=i.attributes,c=e.attributes;!e.index&&i.index&&(e.index=i.index.clone()),c.position||e.setAttribute("position",di(o.position)),s&&!c.normal&&o.normal&&e.setAttribute("normal",di(o.normal)),a&&!c.tangent&&o.tangent&&e.setAttribute("tangent",di(o.tangent)),ci(i.index,e.index),ci(o.position,c.position),s&&ci(o.normal,c.normal),a&&ci(o.tangent,c.tangent);const l=o.position,u=s?o.normal:null,h=a?o.tangent:null,f=i.morphAttributes.position,d=i.morphAttributes.normal,y=i.morphAttributes.tangent,_=i.morphTargetsRelative,p=t.morphTargetInfluences,m=new M.Matrix3;m.getNormalMatrix(t.matrixWorld),i.index&&e.index.array.set(i.index.array);for(let g=0,v=o.position.count;g<v;g++)Me.fromBufferAttribute(l,g),u&&Ce.fromBufferAttribute(u,g),h&&(so.fromBufferAttribute(h,g),Pe.fromBufferAttribute(h,g)),p&&(f&&Cn(f,p,_,g,Me),d&&Cn(d,p,_,g,Ce),y&&Cn(y,p,_,g,Pe)),t.isSkinnedMesh&&(t.applyBoneTransform(g,Me),u&&lo(t,g,Ce),h&&lo(t,g,Pe)),r&&Me.applyMatrix4(t.matrixWorld),c.position.setXYZ(g,Me.x,Me.y,Me.z),u&&(r&&Ce.applyNormalMatrix(m),c.normal.setXYZ(g,Ce.x,Ce.y,Ce.z)),h&&(r&&Pe.transformDirection(t.matrixWorld),c.tangent.setXYZW(g,Pe.x,Pe.y,Pe.z,so.w));for(const g in this.attributes){const v=this.attributes[g];v==="position"||v==="tangent"||v==="normal"||!(v in o)||(c[v]||e.setAttribute(v,di(o[v])),ci(o[v],c[v]),ya(o[v],c[v]))}return t.matrixWorld.determinant()<0&&Gu(e),e}}const qu=Object.freeze(Object.defineProperty({__proto__:null,AVERAGE:la,CENTER:rs,CONTAINED:Fn,ExtendedTriangle:Rt,MeshBVH:Ki,OrientedBox:dt,SAH:ua,StaticGeometryGenerator:$u,acceleratedRaycast:Uu,computeBoundsTree:Du},Symbol.toStringTag,{value:"Module"}));class Xu{constructor(t){this.name="WorkerBase",this.running=!1,this.worker=t,this.worker.onerror=e=>{throw e.message?new Error(`${this.name}: Could not create Web Worker with error "${e.message}"`):new Error(`${this.name}: Could not create Web Worker.`)}}runTask(){}generate(...t){if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");if(this.worker===null)throw new Error("GenerateMeshBVHWorker: Worker has been disposed.");this.running=!0;const e=this.runTask(this.worker,...t);return e.finally(()=>{this.running=!1}),e}dispose(){this.worker.terminate(),this.worker=null}}exports.$70d766613f57b014$export$2e2bcd8739ae039=Ko;exports.BatchedParticleRenderer=Pl;exports.Builder=Wn;exports.ByteBuffer=gi;exports.ConstantColor=Re;exports.ConstantValue=F;exports.Matrix4=Ft;exports.MeshBVH=Ki;exports.MotionController=Ta;exports.ParticleSystem=Dr;exports.SIZE_PREFIX_LENGTH=ho;exports.TrailParticle=Nr;exports.Vector4=bt;exports.WorkerBase=Xu;exports.bundler=ec;exports.createNoise4D=El;exports.fetchProfile=va;exports.index=zl;exports.index$1=qu;exports.md5=gc;exports.v5=fc;
|
|
1121
|
+
}`;class Cl extends oa{constructor(t){super(t),this.vector_=new O,this.vector2_=new O,this.vector3_=new O,this.quaternion_=new J,this.maxParticles=1e4,this.setupBuffers(),this.rebuildMaterial()}setupBuffers(){this.geometry&&this.geometry.dispose(),this.geometry=new M.BufferGeometry,this.indexBuffer=new M.BufferAttribute(new Uint32Array(this.maxParticles*6),1),this.indexBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setIndex(this.indexBuffer),this.positionBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.positionBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("position",this.positionBuffer),this.previousBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.previousBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("previous",this.previousBuffer),this.nextBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*6),3),this.nextBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("next",this.nextBuffer),this.widthBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*2),1),this.widthBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("width",this.widthBuffer),this.sideBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*2),1),this.sideBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("side",this.sideBuffer),this.uvBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*4),2),this.uvBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("uv",this.uvBuffer),this.colorBuffer=new M.BufferAttribute(new Float32Array(this.maxParticles*8),4),this.colorBuffer.setUsage(M.DynamicDrawUsage),this.geometry.setAttribute("color",this.colorBuffer)}expandBuffers(t){for(;t>=this.maxParticles;)this.maxParticles*=2;this.setupBuffers()}rebuildMaterial(){this.layers.mask=this.settings.layers.mask;const t={lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},resolution:{value:new Je(1,1)},sizeAttenuation:{value:1},visibility:{value:1},alphaTest:{value:0}},e={};if(e.USE_UV="",e.USE_COLOR_ALPHA="",this.settings.material.map&&(e.USE_MAP="",e.MAP_UV=Nn(this.settings.material.map.channel),t.map=new M.Uniform$1(this.settings.material.map),t.mapTransform=new M.Uniform$1(new Xt().copy(this.settings.material.map.matrix))),this.settings.material.defines&&this.settings.material.defines.USE_COLOR_AS_ALPHA!==void 0&&(e.USE_COLOR_AS_ALPHA=""),this.settings.renderMode===exports.RenderMode.Trail)this.material=new M.ShaderMaterial({uniforms:t,defines:e,vertexShader:Ml,fragmentShader:Tl,transparent:this.settings.material.transparent,depthWrite:!this.settings.material.transparent,side:this.settings.material.side,blending:this.settings.material.blending||M.AdditiveBlending,blendDst:this.settings.material.blendDst,blendSrc:this.settings.material.blendSrc,blendEquation:this.settings.material.blendEquation,premultipliedAlpha:this.settings.material.premultipliedAlpha});else throw new Error("render mode unavailable")}update(){let t=0,e=0,i=0;this.systems.forEach(r=>{for(let s=0;s<r.particleNum;s++)i+=r.particles[s].previous.length*2}),i>this.maxParticles&&this.expandBuffers(i),this.systems.forEach(r=>{r.emitter.updateMatrixWorld&&(r.emitter.updateWorldMatrix(!0,!1),r.emitter.updateMatrixWorld(!0));const s=this.quaternion_,a=this.vector2_,o=this.vector3_;r.emitter.matrixWorld.decompose(a,s,o);const c=r.particles,l=r.particleNum,u=this.settings.uTileCount,h=this.settings.vTileCount,f=1/u,d=1/h;for(let y=0;y<l;y++){const _=c[y],p=_.uvTile%h,m=Math.floor(_.uvTile/h+.001),g=_.previous.values();let v=g.next(),S=v.value,x=S;v.done||(v=g.next());let b;v.value!==void 0?b=v.value:b=x;for(let T=0;T<_.previous.length;T++,t+=2){if(this.positionBuffer.setXYZ(t,x.position.x,x.position.y,x.position.z),this.positionBuffer.setXYZ(t+1,x.position.x,x.position.y,x.position.z),r.worldSpace?(this.positionBuffer.setXYZ(t,x.position.x,x.position.y,x.position.z),this.positionBuffer.setXYZ(t+1,x.position.x,x.position.y,x.position.z)):(_.parentMatrix?this.vector_.copy(x.position).applyMatrix4(_.parentMatrix):this.vector_.copy(x.position).applyMatrix4(r.emitter.matrixWorld),this.positionBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.positionBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.previousBuffer.setXYZ(t,S.position.x,S.position.y,S.position.z),this.previousBuffer.setXYZ(t+1,S.position.x,S.position.y,S.position.z)):(_.parentMatrix?this.vector_.copy(S.position).applyMatrix4(_.parentMatrix):this.vector_.copy(S.position).applyMatrix4(r.emitter.matrixWorld),this.previousBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.previousBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.nextBuffer.setXYZ(t,b.position.x,b.position.y,b.position.z),this.nextBuffer.setXYZ(t+1,b.position.x,b.position.y,b.position.z)):(_.parentMatrix?this.vector_.copy(b.position).applyMatrix4(_.parentMatrix):this.vector_.copy(b.position).applyMatrix4(r.emitter.matrixWorld),this.nextBuffer.setXYZ(t,this.vector_.x,this.vector_.y,this.vector_.z),this.nextBuffer.setXYZ(t+1,this.vector_.x,this.vector_.y,this.vector_.z)),this.sideBuffer.setX(t,-1),this.sideBuffer.setX(t+1,1),r.worldSpace)this.widthBuffer.setX(t,x.size),this.widthBuffer.setX(t+1,x.size);else if(_.parentMatrix)this.widthBuffer.setX(t,x.size),this.widthBuffer.setX(t+1,x.size);else{const w=(Math.abs(o.x)+Math.abs(o.y)+Math.abs(o.z))/3;this.widthBuffer.setX(t,x.size*w),this.widthBuffer.setX(t+1,x.size*w)}this.uvBuffer.setXY(t,(T/_.previous.length+p)*f,(h-m-1)*d),this.uvBuffer.setXY(t+1,(T/_.previous.length+p)*f,(h-m)*d),this.colorBuffer.setXYZW(t,x.color.x,x.color.y,x.color.z,x.color.w),this.colorBuffer.setXYZW(t+1,x.color.x,x.color.y,x.color.z,x.color.w),T+1<_.previous.length&&(this.indexBuffer.setX(e*3,t),this.indexBuffer.setX(e*3+1,t+1),this.indexBuffer.setX(e*3+2,t+2),e++,this.indexBuffer.setX(e*3,t+2),this.indexBuffer.setX(e*3+1,t+1),this.indexBuffer.setX(e*3+2,t+3),e++),S=x,x=b,v.done||(v=g.next(),v.value!==void 0&&(b=v.value))}}}),this.positionBuffer.clearUpdateRanges(),this.positionBuffer.addUpdateRange(0,t*3),this.positionBuffer.needsUpdate=!0,this.previousBuffer.clearUpdateRanges(),this.previousBuffer.addUpdateRange(0,t*3),this.previousBuffer.needsUpdate=!0,this.nextBuffer.clearUpdateRanges(),this.nextBuffer.addUpdateRange(0,t*3),this.nextBuffer.needsUpdate=!0,this.sideBuffer.clearUpdateRanges(),this.sideBuffer.addUpdateRange(0,t),this.sideBuffer.needsUpdate=!0,this.widthBuffer.clearUpdateRanges(),this.widthBuffer.addUpdateRange(0,t),this.widthBuffer.needsUpdate=!0,this.uvBuffer.clearUpdateRanges(),this.uvBuffer.addUpdateRange(0,t*2),this.uvBuffer.needsUpdate=!0,this.colorBuffer.clearUpdateRanges(),this.colorBuffer.addUpdateRange(0,t*4),this.colorBuffer.needsUpdate=!0,this.indexBuffer.clearUpdateRanges(),this.indexBuffer.addUpdateRange(0,e*3),this.indexBuffer.needsUpdate=!0,this.geometry.setDrawRange(0,e*3)}dispose(){this.geometry.dispose()}}class Yi{get geometry(){return this._geometry}set geometry(t){if(this._geometry=t,t===void 0||typeof t=="string")return;const e=new M.Triangle;this._triangleIndexToArea.length=0;let i=0;if(!t.getIndex())return;const r=t.getIndex().array,s=r.length/3;this._triangleIndexToArea.push(0);for(let a=0;a<s;a++)e.setFromAttributeAndIndices(t.getAttribute("position"),r[a*3],r[a*3+1],r[a*3+2]),i+=e.getArea(),this._triangleIndexToArea.push(i);t.userData.triangleIndexToArea=this._triangleIndexToArea}constructor(t){this.type="mesh_surface",this._triangleIndexToArea=[],this._tempA=new M.Vector3,this._tempB=new M.Vector3,this._tempC=new M.Vector3,t&&(this.geometry=t)}initialize(t){const e=this._geometry;if(!e||e.getIndex()===null){t.position.set(0,0,0),t.velocity.set(0,0,1).multiplyScalar(t.startSpeed);return}const i=this._triangleIndexToArea.length-1;let r=0,s=i;const a=Math.random()*this._triangleIndexToArea[i];for(;r+1<s;){const d=Math.floor((r+s)/2);a<this._triangleIndexToArea[d]?s=d:r=d}let o=Math.random(),c=Math.random();o+c>1&&(o=1-o,c=1-c);const l=e.getIndex().array[r*3],u=e.getIndex().array[r*3+1],h=e.getIndex().array[r*3+2],f=e.getAttribute("position");this._tempA.fromBufferAttribute(f,l),this._tempB.fromBufferAttribute(f,u),this._tempC.fromBufferAttribute(f,h),this._tempB.sub(this._tempA),this._tempC.sub(this._tempA),this._tempA.addScaledVector(this._tempB,o).addScaledVector(this._tempC,c),t.position.copy(this._tempA),this._tempA.copy(this._tempB).cross(this._tempC).normalize(),t.velocity.copy(this._tempA).normalize().multiplyScalar(t.startSpeed)}toJSON(){return{type:"mesh_surface",mesh:this._geometry?this._geometry.uuid:""}}static fromJSON(t,e){return new Yi(e.geometries[t.geometry])}clone(){return new Yi(this._geometry)}update(t,e){}}il({id:"three.quarks",emitterShapes:[{type:"mesh_surface",params:[["geometry",["geometry"]]],constructor:Yi,loadJSON:Yi.fromJSON}],behaviors:[]});class is extends M.Object3D{constructor(){super(),this.batches=[],this.systemToBatchIndex=new Map,this.type="BatchedRenderer",this.depthTexture=null}static equals(t,e){return t.material.side===e.material.side&&t.material.blending===e.material.blending&&t.material.blendSrc===e.material.blendSrc&&t.material.blendDst===e.material.blendDst&&t.material.blendEquation===e.material.blendEquation&&t.material.premultipliedAlpha===e.material.premultipliedAlpha&&t.material.transparent===e.material.transparent&&t.material.depthTest===e.material.depthTest&&t.material.type===e.material.type&&t.material.alphaTest===e.material.alphaTest&&t.material.map===e.material.map&&t.renderMode===e.renderMode&&t.blendTiles===e.blendTiles&&t.softParticles===e.softParticles&&t.softFarFade===e.softFarFade&&t.softNearFade===e.softNearFade&&t.uTileCount===e.uTileCount&&t.vTileCount===e.vTileCount&&t.instancingGeometry===e.instancingGeometry&&t.renderOrder===e.renderOrder&&t.layers.mask===e.layers.mask}addSystem(t){t._renderer=this;const e=t.getRendererSettings();for(let r=0;r<this.batches.length;r++)if(is.equals(this.batches[r].settings,e)){this.batches[r].addSystem(t),this.systemToBatchIndex.set(t,r);return}let i;switch(e.renderMode){case exports.RenderMode.Trail:i=new Cl(e);break;case exports.RenderMode.Mesh:case exports.RenderMode.BillBoard:case exports.RenderMode.VerticalBillBoard:case exports.RenderMode.HorizontalBillBoard:case exports.RenderMode.StretchedBillBoard:i=new bl(e);break}this.depthTexture&&i.applyDepthTexture(this.depthTexture),i.addSystem(t),this.batches.push(i),this.systemToBatchIndex.set(t,this.batches.length-1),this.add(i)}deleteSystem(t){const e=this.systemToBatchIndex.get(t);e!=null&&(this.batches[e].removeSystem(t),this.systemToBatchIndex.delete(t))}setDepthTexture(t){this.depthTexture=t;for(const e of this.batches)e.applyDepthTexture(t)}updateSystem(t){this.deleteSystem(t),this.addSystem(t)}update(t){this.systemToBatchIndex.forEach((e,i)=>{i.update(t)});for(let e=0;e<this.batches.length;e++)this.batches[e].update()}}const Pl=is;hl();console.log("%c Particle system powered by three.quarks. https://quarks.art/","font-size: 14px; font-weight: bold;");const aa=Math.sqrt(5),wl=(aa-1)/4,at=(5-aa)/20,ar=n=>Math.floor(n)|0,cr=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function El(n=Math.random){const t=Rl(n),e=new Float64Array(t).map(a=>cr[a%32*4]),i=new Float64Array(t).map(a=>cr[a%32*4+1]),r=new Float64Array(t).map(a=>cr[a%32*4+2]),s=new Float64Array(t).map(a=>cr[a%32*4+3]);return function(o,c,l,u){let h,f,d,y,_;const p=(o+c+l+u)*wl,m=ar(o+p),g=ar(c+p),v=ar(l+p),S=ar(u+p),x=(m+g+v+S)*at,b=m-x,T=g-x,w=v-x,C=S-x,P=o-b,R=c-T,E=l-w,A=u-C;let k=0,z=0,U=0,L=0;P>R?k++:z++,P>E?k++:U++,P>A?k++:L++,R>E?z++:U++,R>A?z++:L++,E>A?U++:L++;const I=k>=3?1:0,X=z>=3?1:0,Z=U>=3?1:0,it=L>=3?1:0,K=k>=2?1:0,pt=z>=2?1:0,mt=U>=2?1:0,rt=L>=2?1:0,W=k>=1?1:0,j=z>=1?1:0,Ht=U>=1?1:0,Dt=L>=1?1:0,Lt=P-I+at,Vt=R-X+at,vt=E-Z+at,At=A-it+at,_t=P-K+2*at,Yt=R-pt+2*at,Zt=E-mt+2*at,H=A-rt+2*at,Jt=P-W+3*at,Qt=R-j+3*at,ve=E-Ht+3*at,Kt=A-Dt+3*at,te=P-1+4*at,ee=R-1+4*at,ie=E-1+4*at,re=A-1+4*at,kt=m&255,zt=g&255,Bt=v&255,Ot=S&255;let V=.6-P*P-R*R-E*E-A*A;if(V<0)h=0;else{const q=kt+t[zt+t[Bt+t[Ot]]];V*=V,h=V*V*(e[q]*P+i[q]*R+r[q]*E+s[q]*A)}let We=.6-Lt*Lt-Vt*Vt-vt*vt-At*At;if(We<0)f=0;else{const q=kt+I+t[zt+X+t[Bt+Z+t[Ot+it]]];We*=We,f=We*We*(e[q]*Lt+i[q]*Vt+r[q]*vt+s[q]*At)}let He=.6-_t*_t-Yt*Yt-Zt*Zt-H*H;if(He<0)d=0;else{const q=kt+K+t[zt+pt+t[Bt+mt+t[Ot+rt]]];He*=He,d=He*He*(e[q]*_t+i[q]*Yt+r[q]*Zt+s[q]*H)}let Ye=.6-Jt*Jt-Qt*Qt-ve*ve-Kt*Kt;if(Ye<0)y=0;else{const q=kt+W+t[zt+j+t[Bt+Ht+t[Ot+Dt]]];Ye*=Ye,y=Ye*Ye*(e[q]*Jt+i[q]*Qt+r[q]*ve+s[q]*Kt)}let Ze=.6-te*te-ee*ee-ie*ie-re*re;if(Ze<0)_=0;else{const q=kt+1+t[zt+1+t[Bt+1+t[Ot+1]]];Ze*=Ze,_=Ze*Ze*(e[q]*te+i[q]*ee+r[q]*ie+s[q]*re)}return 27*(h+f+d+y+_)}}function Rl(n){const e=new Uint8Array(512);for(let i=0;i<512/2;i++)e[i]=i;for(let i=0;i<512/2-1;i++){const r=i+~~(n()*(256-i)),s=e[i];e[i]=e[r],e[r]=s}for(let i=256;i<512;i++)e[i]=e[i-256];return e}class Al{constructor(t,e){if(this._retries=0,!Number.isInteger(t)||t<0)throw new Error("Base must be a positive integer or zero");if(e!==void 0&&(!Number.isInteger(e)||e<0))throw new Error("ExpMax must be a undefined, a positive integer or zero");this.base=t,this.expMax=e,this.i=0}get retries(){return this._retries}get current(){return this.base*Math.pow(2,this.i)}next(){return this._retries++,this.i=this.expMax===void 0?this.i+1:Math.min(this.i+1,this.expMax),this.current}reset(){this._retries=0,this.i=0}}var G;(function(n){n.open="open",n.close="close",n.error="error",n.message="message",n.retry="retry",n.reconnect="reconnect"})(G||(G={}));class ca{constructor(t,e,i){var r,s,a,o,c,l,u,h,f,d,y,_,p,m,g;this._closedByUser=!1,this.handleOpenEvent=v=>this.handleEvent(G.open,v),this.handleErrorEvent=v=>this.handleEvent(G.error,v),this.handleCloseEvent=v=>this.handleEvent(G.close,v),this.handleMessageEvent=v=>this.handleEvent(G.message,v),this._url=t,this._protocols=e,this._options={buffer:i?.buffer,retry:{maxRetries:(r=i?.retry)===null||r===void 0?void 0:r.maxRetries,instantReconnect:(s=i?.retry)===null||s===void 0?void 0:s.instantReconnect,backoff:(a=i?.retry)===null||a===void 0?void 0:a.backoff},listeners:{open:[...(c=(o=i?.listeners)===null||o===void 0?void 0:o.open)!==null&&c!==void 0?c:[]],close:[...(u=(l=i?.listeners)===null||l===void 0?void 0:l.close)!==null&&u!==void 0?u:[]],error:[...(f=(h=i?.listeners)===null||h===void 0?void 0:h.error)!==null&&f!==void 0?f:[]],message:[...(y=(d=i?.listeners)===null||d===void 0?void 0:d.message)!==null&&y!==void 0?y:[]],retry:[...(p=(_=i?.listeners)===null||_===void 0?void 0:_.retry)!==null&&p!==void 0?p:[]],reconnect:[...(g=(m=i?.listeners)===null||m===void 0?void 0:m.reconnect)!==null&&g!==void 0?g:[]]}},this._underlyingWebsocket=this.tryConnect()}get url(){return this._url}get protocols(){return this._protocols}get buffer(){return this._options.buffer}get maxRetries(){return this._options.retry.maxRetries}get instantReconnect(){return this._options.retry.instantReconnect}get backoff(){return this._options.retry.backoff}get closedByUser(){return this._closedByUser}get lastConnection(){return this._lastConnection}get underlyingWebsocket(){return this._underlyingWebsocket}get readyState(){return this._underlyingWebsocket.readyState}get bufferedAmount(){return this._underlyingWebsocket.bufferedAmount}get extensions(){return this._underlyingWebsocket.extensions}get binaryType(){return this._underlyingWebsocket.binaryType}set binaryType(t){this._underlyingWebsocket.binaryType=t}send(t){this.closedByUser||(this._underlyingWebsocket.readyState===this._underlyingWebsocket.OPEN?this._underlyingWebsocket.send(t):this.buffer!==void 0&&this.buffer.add(t))}close(t,e){this.cancelScheduledConnectionRetry(),this._closedByUser=!0,this._underlyingWebsocket.close(t,e)}addEventListener(t,e,i){this._options.listeners[t].push({listener:e,options:i})}removeEventListener(t,e,i){const r=s=>s.listener!==e||s.options!==i;this._options.listeners[t]=this._options.listeners[t].filter(r)}tryConnect(){return this._underlyingWebsocket=new WebSocket(this.url,this.protocols),this._underlyingWebsocket.addEventListener(G.open,this.handleOpenEvent),this._underlyingWebsocket.addEventListener(G.close,this.handleCloseEvent),this._underlyingWebsocket.addEventListener(G.error,this.handleErrorEvent),this._underlyingWebsocket.addEventListener(G.message,this.handleMessageEvent),this._underlyingWebsocket}clearWebsocket(){this._underlyingWebsocket.removeEventListener(G.open,this.handleOpenEvent),this._underlyingWebsocket.removeEventListener(G.close,this.handleCloseEvent),this._underlyingWebsocket.removeEventListener(G.error,this.handleErrorEvent),this._underlyingWebsocket.removeEventListener(G.message,this.handleMessageEvent),this._underlyingWebsocket.close()}dispatchEvent(t,e){const i=this._options.listeners[t],r=[];i.forEach(({listener:s,options:a})=>{s(this,e),(a===void 0||a.once===void 0||!a.once)&&r.push({listener:s,options:a})}),this._options.listeners[t]=r}handleEvent(t,e){switch(t){case G.close:this.dispatchEvent(t,e),this.scheduleConnectionRetryIfNeeded();break;case G.open:if(this.backoff!==void 0&&this._lastConnection!==void 0){const i={retries:this.backoff.retries,lastConnection:new Date(this._lastConnection)},r=new CustomEvent(G.reconnect,{detail:i});this.dispatchEvent(G.reconnect,r),this.backoff.reset()}this._lastConnection=new Date,this.dispatchEvent(t,e),this.sendBufferedData();break;case G.retry:this.dispatchEvent(t,e),this.clearWebsocket(),this.tryConnect();break;default:this.dispatchEvent(t,e);break}}sendBufferedData(){if(this.buffer!==void 0)for(let t=this.buffer.read();t!==void 0;t=this.buffer.read())this.send(t)}scheduleConnectionRetryIfNeeded(){if(this.closedByUser||this.backoff===void 0)return;const t=i=>{const r=new CustomEvent(G.retry,{detail:i});this.handleEvent(G.retry,r)},e={backoff:this._options.retry.instantReconnect===!0?0:this.backoff.next(),retries:this._options.retry.instantReconnect===!0?0:this.backoff.retries,lastConnection:this._lastConnection};(this._options.retry.maxRetries===void 0||e.retries<=this._options.retry.maxRetries)&&(this.retryTimeout=globalThis.setTimeout(()=>t(e),e.backoff))}cancelScheduledConnectionRetry(){globalThis.clearTimeout(this.retryTimeout)}}class kl{constructor(t){this._url=t}get url(){return this._url}withProtocols(t){return this._protocols=t,this}get protocols(){return this._protocols}withMaxRetries(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{maxRetries:t})}),this}get maxRetries(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.maxRetries}withInstantReconnect(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{instantReconnect:t})}),this}get instantReconnect(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.instantReconnect}withBackoff(t){var e;return this._options=Object.assign(Object.assign({},this._options),{retry:Object.assign(Object.assign({},(e=this._options)===null||e===void 0?void 0:e.retry),{backoff:t})}),this}get backoff(){var t,e;return(e=(t=this._options)===null||t===void 0?void 0:t.retry)===null||e===void 0?void 0:e.backoff}withBuffer(t){return this._options=Object.assign(Object.assign({},this._options),{buffer:t}),this}get buffer(){var t;return(t=this._options)===null||t===void 0?void 0:t.buffer}onOpen(t,e){return this.addListener(G.open,t,e),this}onClose(t,e){return this.addListener(G.close,t,e),this}onError(t,e){return this.addListener(G.error,t,e),this}onMessage(t,e){return this.addListener(G.message,t,e),this}onRetry(t,e){return this.addListener(G.retry,t,e),this}onReconnect(t,e){return this.addListener(G.reconnect,t,e),this}build(){return new ca(this._url,this._protocols,this._options)}addListener(t,e,i){var r,s,a,o,c,l,u,h,f,d,y,_,p,m,g,v,S,x,b,T,w;return this._options=Object.assign(Object.assign({},this._options),{listeners:{open:(a=(s=(r=this._options)===null||r===void 0?void 0:r.listeners)===null||s===void 0?void 0:s.open)!==null&&a!==void 0?a:[],close:(l=(c=(o=this._options)===null||o===void 0?void 0:o.listeners)===null||c===void 0?void 0:c.close)!==null&&l!==void 0?l:[],error:(f=(h=(u=this._options)===null||u===void 0?void 0:u.listeners)===null||h===void 0?void 0:h.error)!==null&&f!==void 0?f:[],message:(_=(y=(d=this._options)===null||d===void 0?void 0:d.listeners)===null||y===void 0?void 0:y.message)!==null&&_!==void 0?_:[],retry:(g=(m=(p=this._options)===null||p===void 0?void 0:p.listeners)===null||m===void 0?void 0:m.retry)!==null&&g!==void 0?g:[],reconnect:(x=(S=(v=this._options)===null||v===void 0?void 0:v.listeners)===null||S===void 0?void 0:S.reconnect)!==null&&x!==void 0?x:[],[t]:[...(w=(T=(b=this._options)===null||b===void 0?void 0:b.listeners)===null||T===void 0?void 0:T[t])!==null&&w!==void 0?w:[],{listener:e,options:i}]}}),this}}const zl=Object.freeze(Object.defineProperty({__proto__:null,ExponentialBackoff:Al,Websocket:ca,WebsocketBuilder:kl,get WebsocketEvent(){return G}},Symbol.toStringTag,{value:"Module"})),rs=0,la=1,ua=2,Fn=2,dn=1.25,$s=1,mi=32,$r=65535,Bl=Math.pow(2,-24),pn=Symbol("SKIP_GENERATION");function Ol(n){return n.index?n.index.count:n.attributes.position.count}function Xe(n){return Ol(n)/3}function Il(n,t=ArrayBuffer){return n>65535?new Uint32Array(new t(4*n)):new Uint16Array(new t(2*n))}function Ul(n,t){if(!n.index){const e=n.attributes.position.count,i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,r=Il(e,i);n.setIndex(new M.BufferAttribute(r,1));for(let s=0;s<e;s++)r[s]=s}}function ha(n,t){const e=Xe(n),i=t||n.drawRange,r=i.start/3,s=(i.start+i.count)/3,a=Math.max(0,r),o=Math.min(e,s)-a;return[{offset:Math.floor(a),count:Math.floor(o)}]}function fa(n,t){if(!n.groups||!n.groups.length)return ha(n,t);const e=[],i=new Set,r=t||n.drawRange,s=r.start/3,a=(r.start+r.count)/3;for(const c of n.groups){const l=c.start/3,u=(c.start+c.count)/3;i.add(Math.max(s,l)),i.add(Math.min(a,u))}const o=Array.from(i.values()).sort((c,l)=>c-l);for(let c=0;c<o.length-1;c++){const l=o[c],u=o[c+1];e.push({offset:Math.floor(l),count:Math.floor(u-l)})}return e}function Nl(n,t){const e=Xe(n),i=fa(n,t).sort((a,o)=>a.offset-o.offset),r=i[i.length-1];r.count=Math.min(e-r.offset,r.count);let s=0;return i.forEach(({count:a})=>s+=a),e!==s}function mn(n,t,e,i,r){let s=1/0,a=1/0,o=1/0,c=-1/0,l=-1/0,u=-1/0,h=1/0,f=1/0,d=1/0,y=-1/0,_=-1/0,p=-1/0;for(let m=t*6,g=(t+e)*6;m<g;m+=6){const v=n[m+0],S=n[m+1],x=v-S,b=v+S;x<s&&(s=x),b>c&&(c=b),v<h&&(h=v),v>y&&(y=v);const T=n[m+2],w=n[m+3],C=T-w,P=T+w;C<a&&(a=C),P>l&&(l=P),T<f&&(f=T),T>_&&(_=T);const R=n[m+4],E=n[m+5],A=R-E,k=R+E;A<o&&(o=A),k>u&&(u=k),R<d&&(d=R),R>p&&(p=R)}i[0]=s,i[1]=a,i[2]=o,i[3]=c,i[4]=l,i[5]=u,r[0]=h,r[1]=f,r[2]=d,r[3]=y,r[4]=_,r[5]=p}function Fl(n,t=null,e=null,i=null){const r=n.attributes.position,s=n.index?n.index.array:null,a=Xe(n),o=r.normalized;let c;t===null?(c=new Float32Array(a*6),e=0,i=a):(c=t,e=e||0,i=i||a);const l=r.array,u=r.offset||0;let h=3;r.isInterleavedBufferAttribute&&(h=r.data.stride);const f=["getX","getY","getZ"];for(let d=e;d<e+i;d++){const y=d*3,_=d*6;let p=y+0,m=y+1,g=y+2;s&&(p=s[p],m=s[m],g=s[g]),o||(p=p*h+u,m=m*h+u,g=g*h+u);for(let v=0;v<3;v++){let S,x,b;o?(S=r[f[v]](p),x=r[f[v]](m),b=r[f[v]](g)):(S=l[p+v],x=l[m+v],b=l[g+v]);let T=S;x<T&&(T=x),b<T&&(T=b);let w=S;x>w&&(w=x),b>w&&(w=b);const C=(w-T)/2,P=v*2;c[_+P+0]=T+C,c[_+P+1]=C+(Math.abs(T)+C)*Bl}}return c}function Y(n,t,e){return e.min.x=t[n],e.min.y=t[n+1],e.min.z=t[n+2],e.max.x=t[n+3],e.max.y=t[n+4],e.max.z=t[n+5],e}function qs(n){let t=-1,e=-1/0;for(let i=0;i<3;i++){const r=n[i+3]-n[i];r>e&&(e=r,t=i)}return t}function Xs(n,t){t.set(n)}function Ws(n,t,e){let i,r;for(let s=0;s<3;s++){const a=s+3;i=n[s],r=t[s],e[s]=i<r?i:r,i=n[a],r=t[a],e[a]=i>r?i:r}}function lr(n,t,e){for(let i=0;i<3;i++){const r=t[n+2*i],s=t[n+2*i+1],a=r-s,o=r+s;a<e[i]&&(e[i]=a),o>e[i+3]&&(e[i+3]=o)}}function ei(n){const t=n[3]-n[0],e=n[4]-n[1],i=n[5]-n[2];return 2*(t*e+e*i+i*t)}const ne=32,Dl=(n,t)=>n.candidate-t.candidate,fe=new Array(ne).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),ur=new Float32Array(6);function Ll(n,t,e,i,r,s){let a=-1,o=0;if(s===rs)a=qs(t),a!==-1&&(o=(t[a]+t[a+3])/2);else if(s===la)a=qs(n),a!==-1&&(o=Vl(e,i,r,a));else if(s===ua){const c=ei(n);let l=dn*r;const u=i*6,h=(i+r)*6;for(let f=0;f<3;f++){const d=t[f],p=(t[f+3]-d)/ne;if(r<ne/4){const m=[...fe];m.length=r;let g=0;for(let S=u;S<h;S+=6,g++){const x=m[g];x.candidate=e[S+2*f],x.count=0;const{bounds:b,leftCacheBounds:T,rightCacheBounds:w}=x;for(let C=0;C<3;C++)w[C]=1/0,w[C+3]=-1/0,T[C]=1/0,T[C+3]=-1/0,b[C]=1/0,b[C+3]=-1/0;lr(S,e,b)}m.sort(Dl);let v=r;for(let S=0;S<v;S++){const x=m[S];for(;S+1<v&&m[S+1].candidate===x.candidate;)m.splice(S+1,1),v--}for(let S=u;S<h;S+=6){const x=e[S+2*f];for(let b=0;b<v;b++){const T=m[b];x>=T.candidate?lr(S,e,T.rightCacheBounds):(lr(S,e,T.leftCacheBounds),T.count++)}}for(let S=0;S<v;S++){const x=m[S],b=x.count,T=r-x.count,w=x.leftCacheBounds,C=x.rightCacheBounds;let P=0;b!==0&&(P=ei(w)/c);let R=0;T!==0&&(R=ei(C)/c);const E=$s+dn*(P*b+R*T);E<l&&(a=f,l=E,o=x.candidate)}}else{for(let v=0;v<ne;v++){const S=fe[v];S.count=0,S.candidate=d+p+v*p;const x=S.bounds;for(let b=0;b<3;b++)x[b]=1/0,x[b+3]=-1/0}for(let v=u;v<h;v+=6){let b=~~((e[v+2*f]-d)/p);b>=ne&&(b=ne-1);const T=fe[b];T.count++,lr(v,e,T.bounds)}const m=fe[ne-1];Xs(m.bounds,m.rightCacheBounds);for(let v=ne-2;v>=0;v--){const S=fe[v],x=fe[v+1];Ws(S.bounds,x.rightCacheBounds,S.rightCacheBounds)}let g=0;for(let v=0;v<ne-1;v++){const S=fe[v],x=S.count,b=S.bounds,w=fe[v+1].rightCacheBounds;x!==0&&(g===0?Xs(b,ur):Ws(b,ur,ur)),g+=x;let C=0,P=0;g!==0&&(C=ei(ur)/c);const R=r-g;R!==0&&(P=ei(w)/c);const E=$s+dn*(C*g+P*R);E<l&&(a=f,l=E,o=S.candidate)}}}}else console.warn(`MeshBVH: Invalid build strategy value ${s} used.`);return{axis:a,pos:o}}function Vl(n,t,e,i){let r=0;for(let s=t,a=t+e;s<a;s++)r+=n[s*6+i*2];return r/e}class yn{constructor(){this.boundingData=new Float32Array(6)}}function Jl(n,t,e,i,r,s){let a=i,o=i+r-1;const c=s.pos,l=s.axis*2;for(;;){for(;a<=o&&e[a*6+l]<c;)a++;for(;a<=o&&e[o*6+l]>=c;)o--;if(a<o){for(let u=0;u<3;u++){let h=t[a*3+u];t[a*3+u]=t[o*3+u],t[o*3+u]=h}for(let u=0;u<6;u++){let h=e[a*6+u];e[a*6+u]=e[o*6+u],e[o*6+u]=h}a++,o--}else return a}}function Gl(n,t,e,i,r,s){let a=i,o=i+r-1;const c=s.pos,l=s.axis*2;for(;;){for(;a<=o&&e[a*6+l]<c;)a++;for(;a<=o&&e[o*6+l]>=c;)o--;if(a<o){let u=n[a];n[a]=n[o],n[o]=u;for(let h=0;h<6;h++){let f=e[a*6+h];e[a*6+h]=e[o*6+h],e[o*6+h]=f}a++,o--}else return a}}function St(n,t){return t[n+15]===65535}function Mt(n,t){return t[n+6]}function Ct(n,t){return t[n+14]}function Pt(n){return n+8}function wt(n,t){return t[n+6]}function da(n,t){return t[n+7]}let pa,fi,Ar,ma;const jl=Math.pow(2,32);function Dn(n){return"count"in n?1:1+Dn(n.left)+Dn(n.right)}function $l(n,t,e){return pa=new Float32Array(e),fi=new Uint32Array(e),Ar=new Uint16Array(e),ma=new Uint8Array(e),Ln(n,t)}function Ln(n,t){const e=n/4,i=n/2,r="count"in t,s=t.boundingData;for(let a=0;a<6;a++)pa[e+a]=s[a];if(r)if(t.buffer){const a=t.buffer;ma.set(new Uint8Array(a),n);for(let o=n,c=n+a.byteLength;o<c;o+=mi){const l=o/2;St(l,Ar)||(fi[o/4+6]+=e)}return n+a.byteLength}else{const a=t.offset,o=t.count;return fi[e+6]=a,Ar[i+14]=o,Ar[i+15]=$r,n+mi}else{const a=t.left,o=t.right,c=t.splitAxis;let l;if(l=Ln(n+mi,a),l/4>jl)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return fi[e+6]=l/4,l=Ln(l,o),fi[e+7]=c,l}}function ql(n,t){const e=(n.index?n.index.count:n.attributes.position.count)/3,i=e>2**16,r=i?4:2,s=t?new SharedArrayBuffer(e*r):new ArrayBuffer(e*r),a=i?new Uint32Array(s):new Uint16Array(s);for(let o=0,c=a.length;o<c;o++)a[o]=o;return a}function Xl(n,t,e,i,r){const{maxDepth:s,verbose:a,maxLeafTris:o,strategy:c,onProgress:l,indirect:u}=r,h=n._indirectBuffer,f=n.geometry,d=f.index?f.index.array:null,y=u?Gl:Jl,_=Xe(f),p=new Float32Array(6);let m=!1;const g=new yn;return mn(t,e,i,g.boundingData,p),S(g,e,i,p),g;function v(x){l&&l(x/_)}function S(x,b,T,w=null,C=0){if(!m&&C>=s&&(m=!0,a&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),T<=o||C>=s)return v(b+T),x.offset=b,x.count=T,x;const P=Ll(x.boundingData,w,t,b,T,c);if(P.axis===-1)return v(b+T),x.offset=b,x.count=T,x;const R=y(h,d,t,b,T,P);if(R===b||R===b+T)v(b+T),x.offset=b,x.count=T;else{x.splitAxis=P.axis;const E=new yn,A=b,k=R-b;x.left=E,mn(t,A,k,E.boundingData,p),S(E,A,k,p,C+1);const z=new yn,U=R,L=T-k;x.right=z,mn(t,U,L,z.boundingData,p),S(z,U,L,p,C+1)}return x}}function Wl(n,t){const e=n.geometry;t.indirect&&(n._indirectBuffer=ql(e,t.useSharedArrayBuffer),Nl(e,t.range)&&!t.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Ul(e,t);const i=t.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,r=Fl(e),s=t.indirect?ha(e,t.range):fa(e,t.range);n._roots=s.map(a=>{const o=Xl(n,r,a.offset,a.count,t),c=Dn(o),l=new i(mi*c);return $l(0,o,l),l})}class le{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(t,e){let i=1/0,r=-1/0;for(let s=0,a=t.length;s<a;s++){const c=t[s][e];i=c<i?c:i,r=c>r?c:r}this.min=i,this.max=r}setFromPoints(t,e){let i=1/0,r=-1/0;for(let s=0,a=e.length;s<a;s++){const o=e[s],c=t.dot(o);i=c<i?c:i,r=c>r?c:r}this.min=i,this.max=r}isSeparated(t){return this.min>t.max||t.min>this.max}}le.prototype.setFromBox=function(){const n=new M.Vector3;return function(e,i){const r=i.min,s=i.max;let a=1/0,o=-1/0;for(let c=0;c<=1;c++)for(let l=0;l<=1;l++)for(let u=0;u<=1;u++){n.x=r.x*c+s.x*(1-c),n.y=r.y*l+s.y*(1-l),n.z=r.z*u+s.z*(1-u);const h=e.dot(n);a=Math.min(h,a),o=Math.max(h,o)}this.min=a,this.max=o}}();const Hl=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Vector3;return function(r,s,a){const o=r.start,c=n,l=s.start,u=t;e.subVectors(o,l),n.subVectors(r.end,r.start),t.subVectors(s.end,s.start);const h=e.dot(u),f=u.dot(c),d=u.dot(u),y=e.dot(c),p=c.dot(c)*d-f*f;let m,g;p!==0?m=(h*f-y*d)/p:m=0,g=(h+m*f)/d,a.x=m,a.y=g}}(),ns=function(){const n=new M.Vector2,t=new M.Vector3,e=new M.Vector3;return function(r,s,a,o){Hl(r,s,n);let c=n.x,l=n.y;if(c>=0&&c<=1&&l>=0&&l<=1){r.at(c,a),s.at(l,o);return}else if(c>=0&&c<=1){l<0?s.at(0,o):s.at(1,o),r.closestPointToPoint(o,!0,a);return}else if(l>=0&&l<=1){c<0?r.at(0,a):r.at(1,a),s.closestPointToPoint(a,!0,o);return}else{let u;c<0?u=r.start:u=r.end;let h;l<0?h=s.start:h=s.end;const f=t,d=e;if(r.closestPointToPoint(h,!0,t),s.closestPointToPoint(u,!0,e),f.distanceToSquared(h)<=d.distanceToSquared(u)){a.copy(f),o.copy(h);return}else{a.copy(u),o.copy(d);return}}}}(),Yl=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Plane,i=new M.Line3;return function(s,a){const{radius:o,center:c}=s,{a:l,b:u,c:h}=a;if(i.start=l,i.end=u,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o||(i.start=l,i.end=h,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o)||(i.start=u,i.end=h,i.closestPointToPoint(c,!0,n).distanceTo(c)<=o))return!0;const _=a.getPlane(e);if(Math.abs(_.distanceToPoint(c))<=o){const m=_.projectPoint(c,t);if(a.containsPoint(m))return!0}return!1}}(),Zl=1e-15;function gn(n){return Math.abs(n)<Zl}class Rt extends M.Triangle{constructor(...t){super(...t),this.isExtendedTriangle=!0,this.satAxes=new Array(4).fill().map(()=>new M.Vector3),this.satBounds=new Array(4).fill().map(()=>new le),this.points=[this.a,this.b,this.c],this.sphere=new M.Sphere,this.plane=new M.Plane,this.needsUpdate=!0}intersectsSphere(t){return Yl(t,this)}update(){const t=this.a,e=this.b,i=this.c,r=this.points,s=this.satAxes,a=this.satBounds,o=s[0],c=a[0];this.getNormal(o),c.setFromPoints(o,r);const l=s[1],u=a[1];l.subVectors(t,e),u.setFromPoints(l,r);const h=s[2],f=a[2];h.subVectors(e,i),f.setFromPoints(h,r);const d=s[3],y=a[3];d.subVectors(i,t),y.setFromPoints(d,r),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(o,t),this.needsUpdate=!1}}Rt.prototype.closestPointToSegment=function(){const n=new M.Vector3,t=new M.Vector3,e=new M.Line3;return function(r,s=null,a=null){const{start:o,end:c}=r,l=this.points;let u,h=1/0;for(let f=0;f<3;f++){const d=(f+1)%3;e.start.copy(l[f]),e.end.copy(l[d]),ns(e,r,n,t),u=n.distanceToSquared(t),u<h&&(h=u,s&&s.copy(n),a&&a.copy(t))}return this.closestPointToPoint(o,n),u=o.distanceToSquared(n),u<h&&(h=u,s&&s.copy(n),a&&a.copy(o)),this.closestPointToPoint(c,n),u=c.distanceToSquared(n),u<h&&(h=u,s&&s.copy(n),a&&a.copy(c)),Math.sqrt(h)}}();Rt.prototype.intersectsTriangle=function(){const n=new Rt,t=new Array(3),e=new Array(3),i=new le,r=new le,s=new M.Vector3,a=new M.Vector3,o=new M.Vector3,c=new M.Vector3,l=new M.Vector3,u=new M.Line3,h=new M.Line3,f=new M.Line3,d=new M.Vector3;function y(_,p,m){const g=_.points;let v=0,S=-1;for(let x=0;x<3;x++){const{start:b,end:T}=u;b.copy(g[x]),T.copy(g[(x+1)%3]),u.delta(a);const w=gn(p.distanceToPoint(b));if(gn(p.normal.dot(a))&&w){m.copy(u),v=2;break}const C=p.intersectLine(u,d);if(!C&&w&&d.copy(b),(C||w)&&!gn(d.distanceTo(T))){if(v<=1)(v===1?m.start:m.end).copy(d),w&&(S=v);else if(v>=2){(S===1?m.start:m.end).copy(d),v=2;break}if(v++,v===2&&S===-1)break}}return v}return function(p,m=null,g=!1){this.needsUpdate&&this.update(),p.isExtendedTriangle?p.needsUpdate&&p.update():(n.copy(p),n.update(),p=n);const v=this.plane,S=p.plane;if(Math.abs(v.normal.dot(S.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;e[0]=p.a,e[1]=p.b,e[2]=p.c;for(let C=0;C<4;C++){const P=x[C],R=b[C];if(i.setFromPoints(R,e),P.isSeparated(i))return!1}const T=p.satBounds,w=p.satAxes;t[0]=this.a,t[1]=this.b,t[2]=this.c;for(let C=0;C<4;C++){const P=T[C],R=w[C];if(i.setFromPoints(R,t),P.isSeparated(i))return!1}for(let C=0;C<4;C++){const P=b[C];for(let R=0;R<4;R++){const E=w[R];if(s.crossVectors(P,E),i.setFromPoints(s,t),r.setFromPoints(s,e),i.isSeparated(r))return!1}}return m&&(g||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),m.start.set(0,0,0),m.end.set(0,0,0)),!0}else{const x=y(this,S,h);if(x===1&&p.containsPoint(h.end))return m&&(m.start.copy(h.end),m.end.copy(h.end)),!0;if(x!==2)return!1;const b=y(p,v,f);if(b===1&&this.containsPoint(f.end))return m&&(m.start.copy(f.end),m.end.copy(f.end)),!0;if(b!==2)return!1;if(h.delta(o),f.delta(c),o.dot(c)<0){let A=f.start;f.start=f.end,f.end=A}const T=h.start.dot(o),w=h.end.dot(o),C=f.start.dot(o),P=f.end.dot(o),R=w<C,E=T<P;return T!==P&&C!==w&&R===E?!1:(m&&(l.subVectors(h.start,f.start),l.dot(o)>0?m.start.copy(h.start):m.start.copy(f.start),l.subVectors(h.end,f.end),l.dot(o)<0?m.end.copy(h.end):m.end.copy(f.end)),!0)}}}();Rt.prototype.distanceToPoint=function(){const n=new M.Vector3;return function(e){return this.closestPointToPoint(e,n),e.distanceTo(n)}}();Rt.prototype.distanceToTriangle=function(){const n=new M.Vector3,t=new M.Vector3,e=["a","b","c"],i=new M.Line3,r=new M.Line3;return function(a,o=null,c=null){const l=o||c?i:null;if(this.intersectsTriangle(a,l))return(o||c)&&(o&&l.getCenter(o),c&&l.getCenter(c)),0;let u=1/0;for(let h=0;h<3;h++){let f;const d=e[h],y=a[d];this.closestPointToPoint(y,n),f=y.distanceToSquared(n),f<u&&(u=f,o&&o.copy(n),c&&c.copy(y));const _=this[d];a.closestPointToPoint(_,n),f=_.distanceToSquared(n),f<u&&(u=f,o&&o.copy(_),c&&c.copy(n))}for(let h=0;h<3;h++){const f=e[h],d=e[(h+1)%3];i.set(this[f],this[d]);for(let y=0;y<3;y++){const _=e[y],p=e[(y+1)%3];r.set(a[_],a[p]),ns(i,r,n,t);const m=n.distanceToSquared(t);m<u&&(u=m,o&&o.copy(n),c&&c.copy(t))}}return Math.sqrt(u)}}();class dt{constructor(t,e,i){this.isOrientedBox=!0,this.min=new M.Vector3,this.max=new M.Vector3,this.matrix=new M.Matrix4,this.invMatrix=new M.Matrix4,this.points=new Array(8).fill().map(()=>new M.Vector3),this.satAxes=new Array(3).fill().map(()=>new M.Vector3),this.satBounds=new Array(3).fill().map(()=>new le),this.alignedSatBounds=new Array(3).fill().map(()=>new le),this.needsUpdate=!1,t&&this.min.copy(t),e&&this.max.copy(e),i&&this.matrix.copy(i)}set(t,e,i){this.min.copy(t),this.max.copy(e),this.matrix.copy(i),this.needsUpdate=!0}copy(t){this.min.copy(t.min),this.max.copy(t.max),this.matrix.copy(t.matrix),this.needsUpdate=!0}}dt.prototype.update=function(){return function(){const t=this.matrix,e=this.min,i=this.max,r=this.points;for(let l=0;l<=1;l++)for(let u=0;u<=1;u++)for(let h=0;h<=1;h++){const f=1*l|2*u|4*h,d=r[f];d.x=l?i.x:e.x,d.y=u?i.y:e.y,d.z=h?i.z:e.z,d.applyMatrix4(t)}const s=this.satBounds,a=this.satAxes,o=r[0];for(let l=0;l<3;l++){const u=a[l],h=s[l],f=1<<l,d=r[f];u.subVectors(o,d),h.setFromPoints(u,r)}const c=this.alignedSatBounds;c[0].setFromPointsField(r,"x"),c[1].setFromPointsField(r,"y"),c[2].setFromPointsField(r,"z"),this.invMatrix.copy(this.matrix).invert(),this.needsUpdate=!1}}();dt.prototype.intersectsBox=function(){const n=new le;return function(e){this.needsUpdate&&this.update();const i=e.min,r=e.max,s=this.satBounds,a=this.satAxes,o=this.alignedSatBounds;if(n.min=i.x,n.max=r.x,o[0].isSeparated(n)||(n.min=i.y,n.max=r.y,o[1].isSeparated(n))||(n.min=i.z,n.max=r.z,o[2].isSeparated(n)))return!1;for(let c=0;c<3;c++){const l=a[c],u=s[c];if(n.setFromBox(l,e),u.isSeparated(n))return!1}return!0}}();dt.prototype.intersectsTriangle=function(){const n=new Rt,t=new Array(3),e=new le,i=new le,r=new M.Vector3;return function(a){this.needsUpdate&&this.update(),a.isExtendedTriangle?a.needsUpdate&&a.update():(n.copy(a),n.update(),a=n);const o=this.satBounds,c=this.satAxes;t[0]=a.a,t[1]=a.b,t[2]=a.c;for(let f=0;f<3;f++){const d=o[f],y=c[f];if(e.setFromPoints(y,t),d.isSeparated(e))return!1}const l=a.satBounds,u=a.satAxes,h=this.points;for(let f=0;f<3;f++){const d=l[f],y=u[f];if(e.setFromPoints(y,h),d.isSeparated(e))return!1}for(let f=0;f<3;f++){const d=c[f];for(let y=0;y<4;y++){const _=u[y];if(r.crossVectors(d,_),e.setFromPoints(r,t),i.setFromPoints(r,h),e.isSeparated(i))return!1}}return!0}}();dt.prototype.closestPointToPoint=function(){return function(t,e){return this.needsUpdate&&this.update(),e.copy(t).applyMatrix4(this.invMatrix).clamp(this.min,this.max).applyMatrix4(this.matrix),e}}();dt.prototype.distanceToPoint=function(){const n=new M.Vector3;return function(e){return this.closestPointToPoint(e,n),e.distanceTo(n)}}();dt.prototype.distanceToBox=function(){const n=["x","y","z"],t=new Array(12).fill().map(()=>new M.Line3),e=new Array(12).fill().map(()=>new M.Line3),i=new M.Vector3,r=new M.Vector3;return function(a,o=0,c=null,l=null){if(this.needsUpdate&&this.update(),this.intersectsBox(a))return(c||l)&&(a.getCenter(r),this.closestPointToPoint(r,i),a.closestPointToPoint(i,r),c&&c.copy(i),l&&l.copy(r)),0;const u=o*o,h=a.min,f=a.max,d=this.points;let y=1/0;for(let p=0;p<8;p++){const m=d[p];r.copy(m).clamp(h,f);const g=m.distanceToSquared(r);if(g<y&&(y=g,c&&c.copy(m),l&&l.copy(r),g<u))return Math.sqrt(g)}let _=0;for(let p=0;p<3;p++)for(let m=0;m<=1;m++)for(let g=0;g<=1;g++){const v=(p+1)%3,S=(p+2)%3,x=m<<v|g<<S,b=1<<p|m<<v|g<<S,T=d[x],w=d[b];t[_].set(T,w);const P=n[p],R=n[v],E=n[S],A=e[_],k=A.start,z=A.end;k[P]=h[P],k[R]=m?h[R]:f[R],k[E]=g?h[E]:f[R],z[P]=f[P],z[R]=m?h[R]:f[R],z[E]=g?h[E]:f[R],_++}for(let p=0;p<=1;p++)for(let m=0;m<=1;m++)for(let g=0;g<=1;g++){r.x=p?f.x:h.x,r.y=m?f.y:h.y,r.z=g?f.z:h.z,this.closestPointToPoint(r,i);const v=r.distanceToSquared(i);if(v<y&&(y=v,c&&c.copy(i),l&&l.copy(r),v<u))return Math.sqrt(v)}for(let p=0;p<12;p++){const m=t[p];for(let g=0;g<12;g++){const v=e[g];ns(m,v,i,r);const S=i.distanceToSquared(r);if(S<y&&(y=S,c&&c.copy(i),l&&l.copy(r),S<u))return Math.sqrt(S)}}return Math.sqrt(y)}}();class ss{constructor(t){this._getNewPrimitive=t,this._primitives=[]}getPrimitive(){const t=this._primitives;return t.length===0?this._getNewPrimitive():t.pop()}releasePrimitive(t){this._primitives.push(t)}}class Ql extends ss{constructor(){super(()=>new Rt)}}const Et=new Ql;class Kl{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const t=[];let e=null;this.setBuffer=i=>{e&&t.push(e),e=i,this.float32Array=new Float32Array(i),this.uint16Array=new Uint16Array(i),this.uint32Array=new Uint32Array(i)},this.clearBuffer=()=>{e=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,t.length!==0&&this.setBuffer(t.pop())}}}const $=new Kl;let ye,Ve;const Be=[],hr=new ss(()=>new M.Box3);function tu(n,t,e,i,r,s){ye=hr.getPrimitive(),Ve=hr.getPrimitive(),Be.push(ye,Ve),$.setBuffer(n._roots[t]);const a=Vn(0,n.geometry,e,i,r,s);$.clearBuffer(),hr.releasePrimitive(ye),hr.releasePrimitive(Ve),Be.pop(),Be.pop();const o=Be.length;return o>0&&(Ve=Be[o-1],ye=Be[o-2]),a}function Vn(n,t,e,i,r=null,s=0,a=0){const{float32Array:o,uint16Array:c,uint32Array:l}=$;let u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);return Y(n,o,ye),i(f,d,!1,a,s+n,ye)}else{let P=function(E){const{uint16Array:A,uint32Array:k}=$;let z=E*2;for(;!St(z,A);)E=Pt(E),z=E*2;return Mt(E,k)},R=function(E){const{uint16Array:A,uint32Array:k}=$;let z=E*2;for(;!St(z,A);)E=wt(E,k),z=E*2;return Mt(E,k)+Ct(z,A)};const f=Pt(n),d=wt(n,l);let y=f,_=d,p,m,g,v;if(r&&(g=ye,v=Ve,Y(y,o,g),Y(_,o,v),p=r(g),m=r(v),m<p)){y=d,_=f;const E=p;p=m,m=E,g=v}g||(g=ye,Y(y,o,g));const S=St(y*2,c),x=e(g,S,p,a+1,s+y);let b;if(x===Fn){const E=P(y),k=R(y)-E;b=i(E,k,!0,a+1,s+y,g)}else b=x&&Vn(y,t,e,i,r,s,a+1);if(b)return!0;v=Ve,Y(_,o,v);const T=St(_*2,c),w=e(v,T,m,a+1,s+_);let C;if(w===Fn){const E=P(_),k=R(_)-E;C=i(E,k,!0,a+1,s+_,v)}else C=w&&Vn(_,t,e,i,r,s,a+1);return!!C}}const ii=new M.Vector3,vn=new M.Vector3;function eu(n,t,e={},i=0,r=1/0){const s=i*i,a=r*r;let o=1/0,c=null;if(n.shapecast({boundsTraverseOrder:u=>(ii.copy(t).clamp(u.min,u.max),ii.distanceToSquared(t)),intersectsBounds:(u,h,f)=>f<o&&f<a,intersectsTriangle:(u,h)=>{u.closestPointToPoint(t,ii);const f=t.distanceToSquared(ii);return f<o&&(vn.copy(ii),o=f,c=h),f<s}}),o===1/0)return null;const l=Math.sqrt(o);return e.point?e.point.copy(vn):e.point=vn.clone(),e.distance=l,e.faceIndex=c,e}const iu=parseInt(M.REVISION)>=169,Se=new M.Vector3,be=new M.Vector3,Te=new M.Vector3,fr=new M.Vector2,dr=new M.Vector2,pr=new M.Vector2,Hs=new M.Vector3,Ys=new M.Vector3,Zs=new M.Vector3,ri=new M.Vector3;function ru(n,t,e,i,r,s,a,o){let c;if(s===M.BackSide?c=n.intersectTriangle(i,e,t,!0,r):c=n.intersectTriangle(t,e,i,s!==M.DoubleSide,r),c===null)return null;const l=n.origin.distanceTo(r);return l<a||l>o?null:{distance:l,point:r.clone()}}function nu(n,t,e,i,r,s,a,o,c,l,u){Se.fromBufferAttribute(t,s),be.fromBufferAttribute(t,a),Te.fromBufferAttribute(t,o);const h=ru(n,Se,be,Te,ri,c,l,u);if(h){const f=new M.Vector3;M.Triangle.getBarycoord(ri,Se,be,Te,f),i&&(fr.fromBufferAttribute(i,s),dr.fromBufferAttribute(i,a),pr.fromBufferAttribute(i,o),h.uv=M.Triangle.getInterpolation(ri,Se,be,Te,fr,dr,pr,new M.Vector2)),r&&(fr.fromBufferAttribute(r,s),dr.fromBufferAttribute(r,a),pr.fromBufferAttribute(r,o),h.uv1=M.Triangle.getInterpolation(ri,Se,be,Te,fr,dr,pr,new M.Vector2)),e&&(Hs.fromBufferAttribute(e,s),Ys.fromBufferAttribute(e,a),Zs.fromBufferAttribute(e,o),h.normal=M.Triangle.getInterpolation(ri,Se,be,Te,Hs,Ys,Zs,new M.Vector3),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:s,b:a,c:o,normal:new M.Vector3,materialIndex:0};M.Triangle.getNormal(Se,be,Te,d.normal),h.face=d,h.faceIndex=s,iu&&(h.barycoord=f)}return h}function qr(n,t,e,i,r,s,a){const o=i*3;let c=o+0,l=o+1,u=o+2;const h=n.index;n.index&&(c=h.getX(c),l=h.getX(l),u=h.getX(u));const{position:f,normal:d,uv:y,uv1:_}=n.attributes,p=nu(e,f,d,y,_,c,l,u,t,s,a);return p?(p.faceIndex=i,r&&r.push(p),p):null}function et(n,t,e,i){const r=n.a,s=n.b,a=n.c;let o=t,c=t+1,l=t+2;e&&(o=e.getX(o),c=e.getX(c),l=e.getX(l)),r.x=i.getX(o),r.y=i.getY(o),r.z=i.getZ(o),s.x=i.getX(c),s.y=i.getY(c),s.z=i.getZ(c),a.x=i.getX(l),a.y=i.getY(l),a.z=i.getZ(l)}function su(n,t,e,i,r,s,a,o){const{geometry:c,_indirectBuffer:l}=n;for(let u=i,h=i+r;u<h;u++)qr(c,t,e,u,s,a,o)}function ou(n,t,e,i,r,s,a){const{geometry:o,_indirectBuffer:c}=n;let l=1/0,u=null;for(let h=i,f=i+r;h<f;h++){let d;d=qr(o,t,e,h,null,s,a),d&&d.distance<l&&(u=d,l=d.distance)}return u}function au(n,t,e,i,r,s,a){const{geometry:o}=e,{index:c}=o,l=o.attributes.position;for(let u=n,h=t+n;u<h;u++){let f;if(f=u,et(a,f*3,c,l),a.needsUpdate=!0,i(a,f,r,s))return!0}return!1}function cu(n,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=n.geometry,i=e.index?e.index.array:null,r=e.attributes.position;let s,a,o,c,l=0;const u=n._roots;for(let f=0,d=u.length;f<d;f++)s=u[f],a=new Uint32Array(s),o=new Uint16Array(s),c=new Float32Array(s),h(0,l),l+=s.byteLength;function h(f,d,y=!1){const _=f*2;if(o[_+15]===$r){const m=a[f+6],g=o[_+14];let v=1/0,S=1/0,x=1/0,b=-1/0,T=-1/0,w=-1/0;for(let C=3*m,P=3*(m+g);C<P;C++){let R=i[C];const E=r.getX(R),A=r.getY(R),k=r.getZ(R);E<v&&(v=E),E>b&&(b=E),A<S&&(S=A),A>T&&(T=A),k<x&&(x=k),k>w&&(w=k)}return c[f+0]!==v||c[f+1]!==S||c[f+2]!==x||c[f+3]!==b||c[f+4]!==T||c[f+5]!==w?(c[f+0]=v,c[f+1]=S,c[f+2]=x,c[f+3]=b,c[f+4]=T,c[f+5]=w,!0):!1}else{const m=f+8,g=a[f+6],v=m+d,S=g+d;let x=y,b=!1,T=!1;t?x||(b=t.has(v),T=t.has(S),x=!b&&!T):(b=!0,T=!0);const w=x||b,C=x||T;let P=!1;w&&(P=h(m,d,x));let R=!1;C&&(R=h(g,d,x));const E=P||R;if(E)for(let A=0;A<3;A++){const k=m+A,z=g+A,U=c[k],L=c[k+3],I=c[z],X=c[z+3];c[f+A]=U<I?U:I,c[f+A+3]=L>X?L:X}return E}}}function ge(n,t,e,i,r){let s,a,o,c,l,u;const h=1/e.direction.x,f=1/e.direction.y,d=1/e.direction.z,y=e.origin.x,_=e.origin.y,p=e.origin.z;let m=t[n],g=t[n+3],v=t[n+1],S=t[n+3+1],x=t[n+2],b=t[n+3+2];return h>=0?(s=(m-y)*h,a=(g-y)*h):(s=(g-y)*h,a=(m-y)*h),f>=0?(o=(v-_)*f,c=(S-_)*f):(o=(S-_)*f,c=(v-_)*f),s>c||o>a||((o>s||isNaN(s))&&(s=o),(c<a||isNaN(a))&&(a=c),d>=0?(l=(x-p)*d,u=(b-p)*d):(l=(b-p)*d,u=(x-p)*d),s>u||l>a)?!1:((l>s||s!==s)&&(s=l),(u<a||a!==a)&&(a=u),s<=r&&a>=i)}function lu(n,t,e,i,r,s,a,o){const{geometry:c,_indirectBuffer:l}=n;for(let u=i,h=i+r;u<h;u++){let f=l?l[u]:u;qr(c,t,e,f,s,a,o)}}function uu(n,t,e,i,r,s,a){const{geometry:o,_indirectBuffer:c}=n;let l=1/0,u=null;for(let h=i,f=i+r;h<f;h++){let d;d=qr(o,t,e,c?c[h]:h,null,s,a),d&&d.distance<l&&(u=d,l=d.distance)}return u}function hu(n,t,e,i,r,s,a){const{geometry:o}=e,{index:c}=o,l=o.attributes.position;for(let u=n,h=t+n;u<h;u++){let f;if(f=e.resolveTriangleIndex(u),et(a,f*3,c,l),a.needsUpdate=!0,i(a,f,r,s))return!0}return!1}function fu(n,t,e,i,r,s,a){$.setBuffer(n._roots[t]),Jn(0,n,e,i,r,s,a),$.clearBuffer()}function Jn(n,t,e,i,r,s,a){const{float32Array:o,uint16Array:c,uint32Array:l}=$,u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);su(t,e,i,f,d,r,s,a)}else{const f=Pt(n);ge(f,o,i,s,a)&&Jn(f,t,e,i,r,s,a);const d=wt(n,l);ge(d,o,i,s,a)&&Jn(d,t,e,i,r,s,a)}}const du=["x","y","z"];function pu(n,t,e,i,r,s){$.setBuffer(n._roots[t]);const a=Gn(0,n,e,i,r,s);return $.clearBuffer(),a}function Gn(n,t,e,i,r,s){const{float32Array:a,uint16Array:o,uint32Array:c}=$;let l=n*2;if(St(l,o)){const h=Mt(n,c),f=Ct(l,o);return ou(t,e,i,h,f,r,s)}else{const h=da(n,c),f=du[h],y=i.direction[f]>=0;let _,p;y?(_=Pt(n),p=wt(n,c)):(_=wt(n,c),p=Pt(n));const g=ge(_,a,i,r,s)?Gn(_,t,e,i,r,s):null;if(g){const x=g.point[f];if(y?x<=a[p+h]:x>=a[p+h+3])return g}const S=ge(p,a,i,r,s)?Gn(p,t,e,i,r,s):null;return g&&S?g.distance<=S.distance?g:S:g||S||null}}const mr=new M.Box3,Oe=new Rt,Ie=new Rt,ni=new M.Matrix4,Qs=new dt,yr=new dt;function mu(n,t,e,i){$.setBuffer(n._roots[t]);const r=jn(0,n,e,i);return $.clearBuffer(),r}function jn(n,t,e,i,r=null){const{float32Array:s,uint16Array:a,uint32Array:o}=$;let c=n*2;if(r===null&&(e.boundingBox||e.computeBoundingBox(),Qs.set(e.boundingBox.min,e.boundingBox.max,i),r=Qs),St(c,a)){const u=t.geometry,h=u.index,f=u.attributes.position,d=e.index,y=e.attributes.position,_=Mt(n,o),p=Ct(c,a);if(ni.copy(i).invert(),e.boundsTree)return Y(n,s,yr),yr.matrix.copy(ni),yr.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:g=>yr.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(i),g.b.applyMatrix4(i),g.c.applyMatrix4(i),g.needsUpdate=!0;for(let v=_*3,S=(p+_)*3;v<S;v+=3)if(et(Ie,v,h,f),Ie.needsUpdate=!0,g.intersectsTriangle(Ie))return!0;return!1}});for(let m=_*3,g=(p+_)*3;m<g;m+=3){et(Oe,m,h,f),Oe.a.applyMatrix4(ni),Oe.b.applyMatrix4(ni),Oe.c.applyMatrix4(ni),Oe.needsUpdate=!0;for(let v=0,S=d.count;v<S;v+=3)if(et(Ie,v,d,y),Ie.needsUpdate=!0,Oe.intersectsTriangle(Ie))return!0}}else{const u=n+8,h=o[n+6];return Y(u,s,mr),!!(r.intersectsBox(mr)&&jn(u,t,e,i,r)||(Y(h,s,mr),r.intersectsBox(mr)&&jn(h,t,e,i,r)))}}const gr=new M.Matrix4,_n=new dt,si=new dt,yu=new M.Vector3,gu=new M.Vector3,vu=new M.Vector3,_u=new M.Vector3;function xu(n,t,e,i={},r={},s=0,a=1/0){t.boundingBox||t.computeBoundingBox(),_n.set(t.boundingBox.min,t.boundingBox.max,e),_n.needsUpdate=!0;const o=n.geometry,c=o.attributes.position,l=o.index,u=t.attributes.position,h=t.index,f=Et.getPrimitive(),d=Et.getPrimitive();let y=yu,_=gu,p=null,m=null;r&&(p=vu,m=_u);let g=1/0,v=null,S=null;return gr.copy(e).invert(),si.matrix.copy(gr),n.shapecast({boundsTraverseOrder:x=>_n.distanceToBox(x),intersectsBounds:(x,b,T)=>T<g&&T<a?(b&&(si.min.copy(x.min),si.max.copy(x.max),si.needsUpdate=!0),!0):!1,intersectsRange:(x,b)=>{if(t.boundsTree)return t.boundsTree.shapecast({boundsTraverseOrder:w=>si.distanceToBox(w),intersectsBounds:(w,C,P)=>P<g&&P<a,intersectsRange:(w,C)=>{for(let P=w,R=w+C;P<R;P++){et(d,3*P,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let E=x,A=x+b;E<A;E++){et(f,3*E,l,c),f.needsUpdate=!0;const k=f.distanceToTriangle(d,y,p);if(k<g&&(_.copy(y),m&&m.copy(p),g=k,v=E,S=P),k<s)return!0}}}});{const T=Xe(t);for(let w=0,C=T;w<C;w++){et(d,3*w,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=x,R=x+b;P<R;P++){et(f,3*P,l,c),f.needsUpdate=!0;const E=f.distanceToTriangle(d,y,p);if(E<g&&(_.copy(y),m&&m.copy(p),g=E,v=P,S=w),E<s)return!0}}}}}),Et.releasePrimitive(f),Et.releasePrimitive(d),g===1/0?null:(i.point?i.point.copy(_):i.point=_.clone(),i.distance=g,i.faceIndex=v,r&&(r.point?r.point.copy(m):r.point=m.clone(),r.point.applyMatrix4(gr),_.applyMatrix4(gr),r.distance=_.sub(r.point).length(),r.faceIndex=S),i)}function Su(n,t=null){t&&Array.isArray(t)&&(t=new Set(t));const e=n.geometry,i=e.index?e.index.array:null,r=e.attributes.position;let s,a,o,c,l=0;const u=n._roots;for(let f=0,d=u.length;f<d;f++)s=u[f],a=new Uint32Array(s),o=new Uint16Array(s),c=new Float32Array(s),h(0,l),l+=s.byteLength;function h(f,d,y=!1){const _=f*2;if(o[_+15]===$r){const m=a[f+6],g=o[_+14];let v=1/0,S=1/0,x=1/0,b=-1/0,T=-1/0,w=-1/0;for(let C=m,P=m+g;C<P;C++){const R=3*n.resolveTriangleIndex(C);for(let E=0;E<3;E++){let A=R+E;A=i?i[A]:A;const k=r.getX(A),z=r.getY(A),U=r.getZ(A);k<v&&(v=k),k>b&&(b=k),z<S&&(S=z),z>T&&(T=z),U<x&&(x=U),U>w&&(w=U)}}return c[f+0]!==v||c[f+1]!==S||c[f+2]!==x||c[f+3]!==b||c[f+4]!==T||c[f+5]!==w?(c[f+0]=v,c[f+1]=S,c[f+2]=x,c[f+3]=b,c[f+4]=T,c[f+5]=w,!0):!1}else{const m=f+8,g=a[f+6],v=m+d,S=g+d;let x=y,b=!1,T=!1;t?x||(b=t.has(v),T=t.has(S),x=!b&&!T):(b=!0,T=!0);const w=x||b,C=x||T;let P=!1;w&&(P=h(m,d,x));let R=!1;C&&(R=h(g,d,x));const E=P||R;if(E)for(let A=0;A<3;A++){const k=m+A,z=g+A,U=c[k],L=c[k+3],I=c[z],X=c[z+3];c[f+A]=U<I?U:I,c[f+A+3]=L>X?L:X}return E}}}function bu(n,t,e,i,r,s,a){$.setBuffer(n._roots[t]),$n(0,n,e,i,r,s,a),$.clearBuffer()}function $n(n,t,e,i,r,s,a){const{float32Array:o,uint16Array:c,uint32Array:l}=$,u=n*2;if(St(u,c)){const f=Mt(n,l),d=Ct(u,c);lu(t,e,i,f,d,r,s,a)}else{const f=Pt(n);ge(f,o,i,s,a)&&$n(f,t,e,i,r,s,a);const d=wt(n,l);ge(d,o,i,s,a)&&$n(d,t,e,i,r,s,a)}}const Tu=["x","y","z"];function Mu(n,t,e,i,r,s){$.setBuffer(n._roots[t]);const a=qn(0,n,e,i,r,s);return $.clearBuffer(),a}function qn(n,t,e,i,r,s){const{float32Array:a,uint16Array:o,uint32Array:c}=$;let l=n*2;if(St(l,o)){const h=Mt(n,c),f=Ct(l,o);return uu(t,e,i,h,f,r,s)}else{const h=da(n,c),f=Tu[h],y=i.direction[f]>=0;let _,p;y?(_=Pt(n),p=wt(n,c)):(_=wt(n,c),p=Pt(n));const g=ge(_,a,i,r,s)?qn(_,t,e,i,r,s):null;if(g){const x=g.point[f];if(y?x<=a[p+h]:x>=a[p+h+3])return g}const S=ge(p,a,i,r,s)?qn(p,t,e,i,r,s):null;return g&&S?g.distance<=S.distance?g:S:g||S||null}}const vr=new M.Box3,Ue=new Rt,Ne=new Rt,oi=new M.Matrix4,Ks=new dt,_r=new dt;function Cu(n,t,e,i){$.setBuffer(n._roots[t]);const r=Xn(0,n,e,i);return $.clearBuffer(),r}function Xn(n,t,e,i,r=null){const{float32Array:s,uint16Array:a,uint32Array:o}=$;let c=n*2;if(r===null&&(e.boundingBox||e.computeBoundingBox(),Ks.set(e.boundingBox.min,e.boundingBox.max,i),r=Ks),St(c,a)){const u=t.geometry,h=u.index,f=u.attributes.position,d=e.index,y=e.attributes.position,_=Mt(n,o),p=Ct(c,a);if(oi.copy(i).invert(),e.boundsTree)return Y(n,s,_r),_r.matrix.copy(oi),_r.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:g=>_r.intersectsBox(g),intersectsTriangle:g=>{g.a.applyMatrix4(i),g.b.applyMatrix4(i),g.c.applyMatrix4(i),g.needsUpdate=!0;for(let v=_,S=p+_;v<S;v++)if(et(Ne,3*t.resolveTriangleIndex(v),h,f),Ne.needsUpdate=!0,g.intersectsTriangle(Ne))return!0;return!1}});for(let m=_,g=p+_;m<g;m++){const v=t.resolveTriangleIndex(m);et(Ue,3*v,h,f),Ue.a.applyMatrix4(oi),Ue.b.applyMatrix4(oi),Ue.c.applyMatrix4(oi),Ue.needsUpdate=!0;for(let S=0,x=d.count;S<x;S+=3)if(et(Ne,S,d,y),Ne.needsUpdate=!0,Ue.intersectsTriangle(Ne))return!0}}else{const u=n+8,h=o[n+6];return Y(u,s,vr),!!(r.intersectsBox(vr)&&Xn(u,t,e,i,r)||(Y(h,s,vr),r.intersectsBox(vr)&&Xn(h,t,e,i,r)))}}const xr=new M.Matrix4,xn=new dt,ai=new dt,Pu=new M.Vector3,wu=new M.Vector3,Eu=new M.Vector3,Ru=new M.Vector3;function Au(n,t,e,i={},r={},s=0,a=1/0){t.boundingBox||t.computeBoundingBox(),xn.set(t.boundingBox.min,t.boundingBox.max,e),xn.needsUpdate=!0;const o=n.geometry,c=o.attributes.position,l=o.index,u=t.attributes.position,h=t.index,f=Et.getPrimitive(),d=Et.getPrimitive();let y=Pu,_=wu,p=null,m=null;r&&(p=Eu,m=Ru);let g=1/0,v=null,S=null;return xr.copy(e).invert(),ai.matrix.copy(xr),n.shapecast({boundsTraverseOrder:x=>xn.distanceToBox(x),intersectsBounds:(x,b,T)=>T<g&&T<a?(b&&(ai.min.copy(x.min),ai.max.copy(x.max),ai.needsUpdate=!0),!0):!1,intersectsRange:(x,b)=>{if(t.boundsTree){const T=t.boundsTree;return T.shapecast({boundsTraverseOrder:w=>ai.distanceToBox(w),intersectsBounds:(w,C,P)=>P<g&&P<a,intersectsRange:(w,C)=>{for(let P=w,R=w+C;P<R;P++){const E=T.resolveTriangleIndex(P);et(d,3*E,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let A=x,k=x+b;A<k;A++){const z=n.resolveTriangleIndex(A);et(f,3*z,l,c),f.needsUpdate=!0;const U=f.distanceToTriangle(d,y,p);if(U<g&&(_.copy(y),m&&m.copy(p),g=U,v=A,S=P),U<s)return!0}}}})}else{const T=Xe(t);for(let w=0,C=T;w<C;w++){et(d,3*w,h,u),d.a.applyMatrix4(e),d.b.applyMatrix4(e),d.c.applyMatrix4(e),d.needsUpdate=!0;for(let P=x,R=x+b;P<R;P++){const E=n.resolveTriangleIndex(P);et(f,3*E,l,c),f.needsUpdate=!0;const A=f.distanceToTriangle(d,y,p);if(A<g&&(_.copy(y),m&&m.copy(p),g=A,v=P,S=w),A<s)return!0}}}}}),Et.releasePrimitive(f),Et.releasePrimitive(d),g===1/0?null:(i.point?i.point.copy(_):i.point=_.clone(),i.distance=g,i.faceIndex=v,r&&(r.point?r.point.copy(m):r.point=m.clone(),r.point.applyMatrix4(xr),_.applyMatrix4(xr),r.distance=_.sub(r.point).length(),r.faceIndex=S),i)}function ku(){return typeof SharedArrayBuffer<"u"}const yi=new $.constructor,Lr=new $.constructor,pe=new ss(()=>new M.Box3),Fe=new M.Box3,De=new M.Box3,Sn=new M.Box3,bn=new M.Box3;let Tn=!1;function zu(n,t,e,i){if(Tn)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");Tn=!0;const r=n._roots,s=t._roots;let a,o=0,c=0;const l=new M.Matrix4().copy(e).invert();for(let u=0,h=r.length;u<h;u++){yi.setBuffer(r[u]),c=0;const f=pe.getPrimitive();Y(0,yi.float32Array,f),f.applyMatrix4(l);for(let d=0,y=s.length;d<y&&(Lr.setBuffer(s[d]),a=Ut(0,0,e,l,i,o,c,0,0,f),Lr.clearBuffer(),c+=s[d].length,!a);d++);if(pe.releasePrimitive(f),yi.clearBuffer(),o+=r[u].length,a)break}return Tn=!1,a}function Ut(n,t,e,i,r,s=0,a=0,o=0,c=0,l=null,u=!1){let h,f;u?(h=Lr,f=yi):(h=yi,f=Lr);const d=h.float32Array,y=h.uint32Array,_=h.uint16Array,p=f.float32Array,m=f.uint32Array,g=f.uint16Array,v=n*2,S=t*2,x=St(v,_),b=St(S,g);let T=!1;if(b&&x)u?T=r(Mt(t,m),Ct(t*2,g),Mt(n,y),Ct(n*2,_),c,a+t,o,s+n):T=r(Mt(n,y),Ct(n*2,_),Mt(t,m),Ct(t*2,g),o,s+n,c,a+t);else if(b){const w=pe.getPrimitive();Y(t,p,w),w.applyMatrix4(e);const C=Pt(n),P=wt(n,y);Y(C,d,Fe),Y(P,d,De);const R=w.intersectsBox(Fe),E=w.intersectsBox(De);T=R&&Ut(t,C,i,e,r,a,s,c,o+1,w,!u)||E&&Ut(t,P,i,e,r,a,s,c,o+1,w,!u),pe.releasePrimitive(w)}else{const w=Pt(t),C=wt(t,m);Y(w,p,Sn),Y(C,p,bn);const P=l.intersectsBox(Sn),R=l.intersectsBox(bn);if(P&&R)T=Ut(n,w,e,i,r,s,a,o,c+1,l,u)||Ut(n,C,e,i,r,s,a,o,c+1,l,u);else if(P)if(x)T=Ut(n,w,e,i,r,s,a,o,c+1,l,u);else{const E=pe.getPrimitive();E.copy(Sn).applyMatrix4(e);const A=Pt(n),k=wt(n,y);Y(A,d,Fe),Y(k,d,De);const z=E.intersectsBox(Fe),U=E.intersectsBox(De);T=z&&Ut(w,A,i,e,r,a,s,c,o+1,E,!u)||U&&Ut(w,k,i,e,r,a,s,c,o+1,E,!u),pe.releasePrimitive(E)}else if(R)if(x)T=Ut(n,C,e,i,r,s,a,o,c+1,l,u);else{const E=pe.getPrimitive();E.copy(bn).applyMatrix4(e);const A=Pt(n),k=wt(n,y);Y(A,d,Fe),Y(k,d,De);const z=E.intersectsBox(Fe),U=E.intersectsBox(De);T=z&&Ut(C,A,i,e,r,a,s,c,o+1,E,!u)||U&&Ut(C,k,i,e,r,a,s,c,o+1,E,!u),pe.releasePrimitive(E)}}return T}const Sr=new dt,to=new M.Box3,Bu={strategy:rs,maxDepth:40,maxLeafTris:10,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,indirect:!1,verbose:!0,range:null};class Ki{static serialize(t,e={}){e={cloneBuffers:!0,...e};const i=t.geometry,r=t._roots,s=t._indirectBuffer,a=i.getIndex();let o;return e.cloneBuffers?o={roots:r.map(c=>c.slice()),index:a?a.array.slice():null,indirectBuffer:s?s.slice():null}:o={roots:r,index:a?a.array:null,indirectBuffer:s},o}static deserialize(t,e,i={}){i={setIndex:!0,indirect:!!t.indirectBuffer,...i};const{index:r,roots:s,indirectBuffer:a}=t,o=new Ki(e,{...i,[pn]:!0});if(o._roots=s,o._indirectBuffer=a||null,i.setIndex){const c=e.getIndex();if(c===null){const l=new M.BufferAttribute(t.index,1,!1);e.setIndex(l)}else c.array!==r&&(c.array.set(r),c.needsUpdate=!0)}return o}get indirect(){return!!this._indirectBuffer}constructor(t,e={}){if(t.isBufferGeometry){if(t.index&&t.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(e=Object.assign({...Bu,[pn]:!1},e),e.useSharedArrayBuffer&&!ku())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=t,this._roots=null,this._indirectBuffer=null,e[pn]||(Wl(this,e),!t.boundingBox&&e.setBoundingBox&&(t.boundingBox=this.getBoundingBox(new M.Box3))),this.resolveTriangleIndex=e.indirect?i=>this._indirectBuffer[i]:i=>i}refit(t=null){return(this.indirect?Su:cu)(this,t)}traverse(t,e=0){const i=this._roots[e],r=new Uint32Array(i),s=new Uint16Array(i);a(0);function a(o,c=0){const l=o*2,u=s[l+15]===$r;if(u){const h=r[o+6],f=s[l+14];t(c,u,new Float32Array(i,o*4,6),h,f)}else{const h=o+mi/4,f=r[o+6],d=r[o+7];t(c,u,new Float32Array(i,o*4,6),d)||(a(h,c+1),a(f,c+1))}}}raycast(t,e=M.FrontSide,i=0,r=1/0){const s=this._roots,a=this.geometry,o=[],c=e.isMaterial,l=Array.isArray(e),u=a.groups,h=c?e.side:e,f=this.indirect?bu:fu;for(let d=0,y=s.length;d<y;d++){const _=l?e[u[d].materialIndex].side:h,p=o.length;if(f(this,d,_,t,o,i,r),l){const m=u[d].materialIndex;for(let g=p,v=o.length;g<v;g++)o[g].face.materialIndex=m}}return o}raycastFirst(t,e=M.FrontSide,i=0,r=1/0){const s=this._roots,a=this.geometry,o=e.isMaterial,c=Array.isArray(e);let l=null;const u=a.groups,h=o?e.side:e,f=this.indirect?Mu:pu;for(let d=0,y=s.length;d<y;d++){const _=c?e[u[d].materialIndex].side:h,p=f(this,d,_,t,i,r);p!=null&&(l==null||p.distance<l.distance)&&(l=p,c&&(p.face.materialIndex=u[d].materialIndex))}return l}intersectsGeometry(t,e){let i=!1;const r=this._roots,s=this.indirect?Cu:mu;for(let a=0,o=r.length;a<o&&(i=s(this,a,t,e),!i);a++);return i}shapecast(t){const e=Et.getPrimitive(),i=this.indirect?hu:au;let{boundsTraverseOrder:r,intersectsBounds:s,intersectsRange:a,intersectsTriangle:o}=t;if(a&&o){const h=a;a=(f,d,y,_,p)=>h(f,d,y,_,p)?!0:i(f,d,this,o,y,_,e)}else a||(o?a=(h,f,d,y)=>i(h,f,this,o,d,y,e):a=(h,f,d)=>d);let c=!1,l=0;const u=this._roots;for(let h=0,f=u.length;h<f;h++){const d=u[h];if(c=tu(this,h,s,a,r,l),c)break;l+=d.byteLength}return Et.releasePrimitive(e),c}bvhcast(t,e,i){let{intersectsRanges:r,intersectsTriangles:s}=i;const a=Et.getPrimitive(),o=this.geometry.index,c=this.geometry.attributes.position,l=this.indirect?y=>{const _=this.resolveTriangleIndex(y);et(a,_*3,o,c)}:y=>{et(a,y*3,o,c)},u=Et.getPrimitive(),h=t.geometry.index,f=t.geometry.attributes.position,d=t.indirect?y=>{const _=t.resolveTriangleIndex(y);et(u,_*3,h,f)}:y=>{et(u,y*3,h,f)};if(s){const y=(_,p,m,g,v,S,x,b)=>{for(let T=m,w=m+g;T<w;T++){d(T),u.a.applyMatrix4(e),u.b.applyMatrix4(e),u.c.applyMatrix4(e),u.needsUpdate=!0;for(let C=_,P=_+p;C<P;C++)if(l(C),a.needsUpdate=!0,s(a,u,C,T,v,S,x,b))return!0}return!1};if(r){const _=r;r=function(p,m,g,v,S,x,b,T){return _(p,m,g,v,S,x,b,T)?!0:y(p,m,g,v,S,x,b,T)}}else r=y}return zu(this,t,e,r)}intersectsBox(t,e){return Sr.set(t.min,t.max,e),Sr.needsUpdate=!0,this.shapecast({intersectsBounds:i=>Sr.intersectsBox(i),intersectsTriangle:i=>Sr.intersectsTriangle(i)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,i={},r={},s=0,a=1/0){return(this.indirect?Au:xu)(this,t,e,i,r,s,a)}closestPointToPoint(t,e={},i=0,r=1/0){return eu(this,t,e,i,r)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(i=>{Y(0,new Float32Array(i),to),t.union(to)}),t}}function eo(n,t,e){return n===null?null:(n.point.applyMatrix4(t.matrixWorld),n.distance=n.point.distanceTo(e.ray.origin),n.object=t,n)}const br=new M.Ray,io=new M.Vector3,ro=new M.Matrix4,Ou=M.Mesh.prototype.raycast,Iu=M.BatchedMesh.prototype.raycast,no=new M.Vector3,ct=new M.Mesh,Tr=[];function Uu(n,t){this.isBatchedMesh?Nu.call(this,n,t):Fu.call(this,n,t)}function Nu(n,t){if(this.boundsTrees){const e=this.boundsTrees,i=this._drawInfo||this._instanceInfo,r=this._drawRanges||this._geometryInfo,s=this.matrixWorld;ct.material=this.material,ct.geometry=this.geometry;const a=ct.geometry.boundsTree,o=ct.geometry.drawRange;ct.geometry.boundingSphere===null&&(ct.geometry.boundingSphere=new M.Sphere);for(let c=0,l=i.length;c<l;c++){if(!this.getVisibleAt(c))continue;const u=i[c].geometryIndex;if(ct.geometry.boundsTree=e[u],this.getMatrixAt(c,ct.matrixWorld).premultiply(s),!ct.geometry.boundsTree){this.getBoundingBoxAt(u,ct.geometry.boundingBox),this.getBoundingSphereAt(u,ct.geometry.boundingSphere);const h=r[u];ct.geometry.setDrawRange(h.start,h.count)}ct.raycast(n,Tr);for(let h=0,f=Tr.length;h<f;h++){const d=Tr[h];d.object=this,d.batchId=c,t.push(d)}Tr.length=0}ct.geometry.boundsTree=a,ct.geometry.drawRange=o,ct.material=null,ct.geometry=null}else Iu.call(this,n,t)}function Fu(n,t){if(this.geometry.boundsTree){if(this.material===void 0)return;ro.copy(this.matrixWorld).invert(),br.copy(n.ray).applyMatrix4(ro),no.setFromMatrixScale(this.matrixWorld),io.copy(br.direction).multiply(no);const e=io.length(),i=n.near/e,r=n.far/e,s=this.geometry.boundsTree;if(n.firstHitOnly===!0){const a=eo(s.raycastFirst(br,this.material,i,r),this,n);a&&t.push(a)}else{const a=s.raycast(br,this.material,i,r);for(let o=0,c=a.length;o<c;o++){const l=eo(a[o],this,n);l&&t.push(l)}}}else Ou.call(this,n,t)}function Du(n={}){return this.boundsTree=new Ki(this,n),this.boundsTree}const Me=new M.Vector3,Ce=new M.Vector3,Pe=new M.Vector3,so=new M.Vector4,Mr=new M.Vector3,Mn=new M.Vector3,oo=new M.Vector4,ao=new M.Vector4,Cr=new M.Matrix4,co=new M.Matrix4;function ci(n,t){if(!n&&!t)return;const e=n.count===t.count,i=n.normalized===t.normalized,r=n.array.constructor===t.array.constructor,s=n.itemSize===t.itemSize;if(!e||!i||!r||!s)throw new Error}function di(n,t=null){const e=n.array.constructor,i=n.normalized,r=n.itemSize,s=t===null?n.count:t;return new M.BufferAttribute(new e(r*s),r,i)}function ya(n,t,e=0){if(n.isInterleavedBufferAttribute){const i=n.itemSize;for(let r=0,s=n.count;r<s;r++){const a=r+e;t.setX(a,n.getX(r)),i>=2&&t.setY(a,n.getY(r)),i>=3&&t.setZ(a,n.getZ(r)),i>=4&&t.setW(a,n.getW(r))}}else{const i=t.array,r=i.constructor,s=i.BYTES_PER_ELEMENT*n.itemSize*e;new r(i.buffer,s,n.array.length).set(n.array)}}function Lu(n,t,e){const i=n.elements,r=t.elements;for(let s=0,a=r.length;s<a;s++)i[s]+=r[s]*e}function lo(n,t,e){const i=n.skeleton,r=n.geometry,s=i.bones,a=i.boneInverses;oo.fromBufferAttribute(r.attributes.skinIndex,t),ao.fromBufferAttribute(r.attributes.skinWeight,t),Cr.elements.fill(0);for(let o=0;o<4;o++){const c=ao.getComponent(o);if(c!==0){const l=oo.getComponent(o);co.multiplyMatrices(s[l].matrixWorld,a[l]),Lu(Cr,co,c)}}return Cr.multiply(n.bindMatrix).premultiply(n.bindMatrixInverse),e.transformDirection(Cr),e}function Cn(n,t,e,i,r){Mr.set(0,0,0);for(let s=0,a=n.length;s<a;s++){const o=t[s],c=n[s];o!==0&&(Mn.fromBufferAttribute(c,i),e?Mr.addScaledVector(Mn,o):Mr.addScaledVector(Mn.sub(r),o))}r.add(Mr)}function Vu(n,t={useGroups:!1,updateIndex:!1,skipAttributes:[]},e=new M.BufferGeometry){const i=n[0].index!==null,{useGroups:r=!1,updateIndex:s=!1,skipAttributes:a=[]}=t,o=new Set(Object.keys(n[0].attributes)),c={};let l=0;e.clearGroups();for(let u=0;u<n.length;++u){const h=n[u];let f=0;if(i!==(h.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(const d in h.attributes){if(!o.has(d))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.');c[d]===void 0&&(c[d]=[]),c[d].push(h.attributes[d]),f++}if(f!==o.size)throw new Error("StaticGeometryGenerator: Make sure all geometries have the same number of attributes.");if(r){let d;if(i)d=h.index.count;else if(h.attributes.position!==void 0)d=h.attributes.position.count;else throw new Error("StaticGeometryGenerator: The geometry must have either an index or a position attribute");e.addGroup(l,d,u),l+=d}}if(i){let u=!1;if(!e.index){let h=0;for(let f=0;f<n.length;++f)h+=n[f].index.count;e.setIndex(new M.BufferAttribute(new Uint32Array(h),1,!1)),u=!0}if(s||u){const h=e.index;let f=0,d=0;for(let y=0;y<n.length;++y){const _=n[y],p=_.index;if(a[y]!==!0)for(let m=0;m<p.count;++m)h.setX(f,p.getX(m)+d),f++;d+=_.attributes.position.count}}}for(const u in c){const h=c[u];if(!(u in e.attributes)){let y=0;for(const _ in h)y+=h[_].count;e.setAttribute(u,di(c[u][0],y))}const f=e.attributes[u];let d=0;for(let y=0,_=h.length;y<_;y++){const p=h[y];a[y]!==!0&&ya(p,f,d),d+=p.count}}return e}function Ju(n,t){if(n===null||t===null)return n===t;if(n.length!==t.length)return!1;for(let e=0,i=n.length;e<i;e++)if(n[e]!==t[e])return!1;return!0}function Gu(n){const{index:t,attributes:e}=n;if(t)for(let i=0,r=t.count;i<r;i+=3){const s=t.getX(i),a=t.getX(i+2);t.setX(i,a),t.setX(i+2,s)}else for(const i in e){const r=e[i],s=r.itemSize;for(let a=0,o=r.count;a<o;a+=3)for(let c=0;c<s;c++){const l=r.getComponent(a,c),u=r.getComponent(a+2,c);r.setComponent(a,c,u),r.setComponent(a+2,c,l)}}return n}class ju{constructor(t){this.matrixWorld=new M.Matrix4,this.geometryHash=null,this.boneMatrices=null,this.primitiveCount=-1,this.mesh=t,this.update()}update(){const t=this.mesh,e=t.geometry,i=t.skeleton,r=(e.index?e.index.count:e.attributes.position.count)/3;if(this.matrixWorld.copy(t.matrixWorld),this.geometryHash=e.attributes.position.version,this.primitiveCount=r,i){i.boneTexture||i.computeBoneTexture(),i.update();const s=i.boneMatrices;!this.boneMatrices||this.boneMatrices.length!==s.length?this.boneMatrices=s.slice():this.boneMatrices.set(s)}else this.boneMatrices=null}didChange(){const t=this.mesh,e=t.geometry,i=(e.index?e.index.count:e.attributes.position.count)/3;return!(this.matrixWorld.equals(t.matrixWorld)&&this.geometryHash===e.attributes.position.version&&Ju(t.skeleton&&t.skeleton.boneMatrices||null,this.boneMatrices)&&this.primitiveCount===i)}}class $u{constructor(t){Array.isArray(t)||(t=[t]);const e=[];t.forEach(i=>{i.traverseVisible(r=>{r.isMesh&&e.push(r)})}),this.meshes=e,this.useGroups=!0,this.applyWorldTransforms=!0,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Array(e.length).fill().map(()=>new M.BufferGeometry),this._diffMap=new WeakMap}getMaterials(){const t=[];return this.meshes.forEach(e=>{Array.isArray(e.material)?t.push(...e.material):t.push(e.material)}),t}generate(t=new M.BufferGeometry){let e=[];const{meshes:i,useGroups:r,_intermediateGeometry:s,_diffMap:a}=this;for(let o=0,c=i.length;o<c;o++){const l=i[o],u=s[o],h=a.get(l);!h||h.didChange(l)?(this._convertToStaticGeometry(l,u),e.push(!1),h?h.update():a.set(l,new ju(l))):e.push(!0)}if(s.length===0){t.setIndex(null);const o=t.attributes;for(const c in o)t.deleteAttribute(c);for(const c in this.attributes)t.setAttribute(this.attributes[c],new M.BufferAttribute(new Float32Array(0),4,!1))}else Vu(s,{useGroups:r,skipAttributes:e},t);for(const o in t.attributes)t.attributes[o].needsUpdate=!0;return t}_convertToStaticGeometry(t,e=new M.BufferGeometry){const i=t.geometry,r=this.applyWorldTransforms,s=this.attributes.includes("normal"),a=this.attributes.includes("tangent"),o=i.attributes,c=e.attributes;!e.index&&i.index&&(e.index=i.index.clone()),c.position||e.setAttribute("position",di(o.position)),s&&!c.normal&&o.normal&&e.setAttribute("normal",di(o.normal)),a&&!c.tangent&&o.tangent&&e.setAttribute("tangent",di(o.tangent)),ci(i.index,e.index),ci(o.position,c.position),s&&ci(o.normal,c.normal),a&&ci(o.tangent,c.tangent);const l=o.position,u=s?o.normal:null,h=a?o.tangent:null,f=i.morphAttributes.position,d=i.morphAttributes.normal,y=i.morphAttributes.tangent,_=i.morphTargetsRelative,p=t.morphTargetInfluences,m=new M.Matrix3;m.getNormalMatrix(t.matrixWorld),i.index&&e.index.array.set(i.index.array);for(let g=0,v=o.position.count;g<v;g++)Me.fromBufferAttribute(l,g),u&&Ce.fromBufferAttribute(u,g),h&&(so.fromBufferAttribute(h,g),Pe.fromBufferAttribute(h,g)),p&&(f&&Cn(f,p,_,g,Me),d&&Cn(d,p,_,g,Ce),y&&Cn(y,p,_,g,Pe)),t.isSkinnedMesh&&(t.applyBoneTransform(g,Me),u&&lo(t,g,Ce),h&&lo(t,g,Pe)),r&&Me.applyMatrix4(t.matrixWorld),c.position.setXYZ(g,Me.x,Me.y,Me.z),u&&(r&&Ce.applyNormalMatrix(m),c.normal.setXYZ(g,Ce.x,Ce.y,Ce.z)),h&&(r&&Pe.transformDirection(t.matrixWorld),c.tangent.setXYZW(g,Pe.x,Pe.y,Pe.z,so.w));for(const g in this.attributes){const v=this.attributes[g];v==="position"||v==="tangent"||v==="normal"||!(v in o)||(c[v]||e.setAttribute(v,di(o[v])),ci(o[v],c[v]),ya(o[v],c[v]))}return t.matrixWorld.determinant()<0&&Gu(e),e}}const qu=Object.freeze(Object.defineProperty({__proto__:null,AVERAGE:la,CENTER:rs,CONTAINED:Fn,ExtendedTriangle:Rt,MeshBVH:Ki,OrientedBox:dt,SAH:ua,StaticGeometryGenerator:$u,acceleratedRaycast:Uu,computeBoundsTree:Du},Symbol.toStringTag,{value:"Module"}));class Xu{constructor(t){this.name="WorkerBase",this.running=!1,this.worker=t,this.worker.onerror=e=>{throw e.message?new Error(`${this.name}: Could not create Web Worker with error "${e.message}"`):new Error(`${this.name}: Could not create Web Worker.`)}}runTask(){}generate(...t){if(this.running)throw new Error("GenerateMeshBVHWorker: Already running job.");if(this.worker===null)throw new Error("GenerateMeshBVHWorker: Worker has been disposed.");this.running=!0;const e=this.runTask(this.worker,...t);return e.finally(()=>{this.running=!1}),e}dispose(){this.worker.terminate(),this.worker=null}}exports.$70d766613f57b014$export$2e2bcd8739ae039=Ko;exports.BatchedParticleRenderer=Pl;exports.Builder=Wn;exports.ByteBuffer=gi;exports.ConstantColor=Re;exports.ConstantValue=F;exports.Matrix4=Ft;exports.MeshBVH=Ki;exports.MotionController=Ta;exports.ParticleSystem=Dr;exports.SIZE_PREFIX_LENGTH=ho;exports.TrailParticle=Nr;exports.Vector4=bt;exports.WorkerBase=Xu;exports.bundler=ec;exports.createNoise4D=El;exports.fetchProfile=va;exports.index=zl;exports.index$1=qu;exports.md5=gc;exports.v5=fc;
|
|
@@ -20,7 +20,7 @@ export declare class BehaviorExtension implements IUSDExporterExtension {
|
|
|
20
20
|
private audioClipsCopy;
|
|
21
21
|
private targetUuids;
|
|
22
22
|
getAllTargetUuids(): Set<string>;
|
|
23
|
-
onBeforeBuildDocument(context: USDZExporterContext): Promise<
|
|
23
|
+
onBeforeBuildDocument(context: USDZExporterContext): Promise<any[]> | Promise<void>;
|
|
24
24
|
onExportObject(_object: any, model: USDObject, context: any): void;
|
|
25
25
|
onAfterBuildDocument(context: USDZExporterContext): void;
|
|
26
26
|
onAfterHierarchy(context: USDZExporterContext, writer: USDWriter): void;
|
|
@@ -36,6 +36,7 @@ export declare class PostProcessingHandler {
|
|
|
36
36
|
private applyEffects;
|
|
37
37
|
/** Should be called before `composer.addPass()` to create an effect pass with all previously collected effects that can be merged up to that point */
|
|
38
38
|
private createPassForMergeableEffects;
|
|
39
|
+
private handleDevicePixelRatio;
|
|
39
40
|
private _menuEntry;
|
|
40
41
|
private _passIndices;
|
|
41
42
|
private _onCreateEffectsDebug;
|
|
@@ -83,6 +83,7 @@ export class PostProcessingHandler {
|
|
|
83
83
|
if (context.composer === this._composer) {
|
|
84
84
|
context.composer = null;
|
|
85
85
|
}
|
|
86
|
+
this.handleDevicePixelRatio();
|
|
86
87
|
}
|
|
87
88
|
dispose() {
|
|
88
89
|
this.unapply(true);
|
|
@@ -409,6 +410,7 @@ export class PostProcessingHandler {
|
|
|
409
410
|
}
|
|
410
411
|
this._anyPassHasDepth ||= pass.needsDepthTexture;
|
|
411
412
|
}
|
|
413
|
+
this.handleDevicePixelRatio();
|
|
412
414
|
// DEBUG LAND BELOW
|
|
413
415
|
if (debug)
|
|
414
416
|
console.log("[PostProcessing] Passes →", [...composer.passes], "\n---------------------------------\n• " + composer.passes.map(i => i.name || (i.constructor.name + "*")).join("\n• ") + "\n");
|
|
@@ -427,6 +429,12 @@ export class PostProcessingHandler {
|
|
|
427
429
|
effects.length = 0; // Clear effects after adding them to the pass
|
|
428
430
|
}
|
|
429
431
|
}
|
|
432
|
+
handleDevicePixelRatio() {
|
|
433
|
+
// Keep user device pixel ratio (if any) https://linear.app/needle/issue/NE-6661
|
|
434
|
+
if (typeof this.context.devicePixelRatio === "number") {
|
|
435
|
+
this.context.requestSizeUpdate();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
430
438
|
_menuEntry = null;
|
|
431
439
|
_passIndices = null;
|
|
432
440
|
_onCreateEffectsDebug(composer, cam) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PostProcessingHandler.js","sourceRoot":"","sources":["../../../src/engine-components/postprocessing/PostProcessingHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAA+B,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEpJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,gFAAgF;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAA4B,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG/F,UAAU,CAAC,2BAA2B,CAAC,GAAG,UAAU,CAAC,2BAA2B,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAGjJ,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEpC,MAAM,SAAS,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAC1D,MAAM,gBAAgB,GAAG,MAAM,CAAC,iCAAiC,CAAC,CAAC;AACnE,MAAM,mBAAmB,GAAG,MAAM,CAAC,8BAA8B,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAEtB,SAAS,GAA0B,IAAI,CAAC;IACxC,qBAAqB,CAA0B;IACtC,QAAQ,GAAoC,EAAE,CAAC;IAEhE;;OAEG;IACH,iBAAiB,CAAC,MAAc;QAC5B,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAC1B,O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C,MAAM,CAAC,CAAC;gBACzB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;gBACzB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACnC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;oBACzF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;wBAC3C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;qBAC5B;yBACI;wBACD,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;qBAC/B;oBACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpC,CAAC,CAAC,CAAC;aACN;SACJ;IACL,CAAC;CAEJ"}
|
|
1
|
+
{"version":3,"file":"PostProcessingHandler.js","sourceRoot":"","sources":["../../../src/engine-components/postprocessing/PostProcessingHandler.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAA+B,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEpJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,gFAAgF;AAChF,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,YAAY,EAA4B,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAG/F,UAAU,CAAC,2BAA2B,CAAC,GAAG,UAAU,CAAC,2BAA2B,CAAC,KAAK,S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D,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;qBAC/B;oBACD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACpC,CAAC,CAAC,CAAC;aACN;SACJ;IACL,CAAC;CAEJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@needle-tools/engine",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0-next.71dbdab",
|
|
4
4
|
"description": "Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.",
|
|
5
5
|
"main": "dist/needle-engine.min.js",
|
|
6
6
|
"exports": {
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
],
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@dimforge/rapier3d-compat": "^0.14.0",
|
|
96
|
-
"@needle-tools/gltf-progressive": "3.1.1",
|
|
96
|
+
"@needle-tools/gltf-progressive": "3.1.1-next.fd37564",
|
|
97
97
|
"@webxr-input-profiles/motion-controllers": "^1.0.0",
|
|
98
98
|
"flatbuffers": "2.0.4",
|
|
99
99
|
"md5": "^2.3.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"simplex-noise": "^4.0.1",
|
|
104
104
|
"stats.js": "^0.17.0",
|
|
105
105
|
"three": "npm:@needle-tools/three@0.169.7",
|
|
106
|
-
"three-mesh-bvh": "
|
|
106
|
+
"three-mesh-bvh": "0.9.1",
|
|
107
107
|
"three-mesh-ui": "npm:@needle-tools/three-mesh-ui@^7.1.5-alpha.5",
|
|
108
108
|
"three.quarks": "0.15.6",
|
|
109
109
|
"uuid": "^9.0.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"madge": "^5.0.1",
|
|
139
139
|
"npm-watch": "^0.11.0",
|
|
140
140
|
"typescript": "^4.5.5",
|
|
141
|
-
"vite": "
|
|
141
|
+
"vite": "7",
|
|
142
142
|
"vite-plugin-dts": "^4.5.0"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
@@ -167,4 +167,4 @@
|
|
|
167
167
|
"module": "lib/needle-engine.js",
|
|
168
168
|
"typings": "lib/needle-engine.d.ts",
|
|
169
169
|
"types": "lib/needle-engine.d.ts"
|
|
170
|
-
}
|
|
170
|
+
}
|