517 lines
56 KiB
JavaScript
517 lines
56 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1517,e=>{"use strict";let t,r;var i=e.i(43476),n=e.i(71645),s=e.i(75056),a=e.i(25234),o=e.i(28600),l=e.i(31067),c=e.i(90072),d=e.i(68911);let u=n.forwardRef(function({args:[e=1,t=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:c=.4,children:d,...u},m){return n.createElement("mesh",(0,l.default)({ref:m},u),n.createElement(f,{args:[e,t,r],radius:i,steps:s,smoothness:a,bevelSegments:o,creaseAngle:c}),d)}),f=n.forwardRef(function({args:[e=1,t=1,r=1]=[],radius:i=.05,steps:s=1,smoothness:a=4,bevelSegments:o=4,creaseAngle:u=.4,...f},m){let p=n.useMemo(()=>{let r,n;return r=new c.Shape,n=i-1e-5,r.absarc(1e-5,1e-5,1e-5,-Math.PI/2,-Math.PI,!0),r.absarc(1e-5,t-2*n,1e-5,Math.PI,Math.PI/2,!0),r.absarc(e-2*n,t-2*n,1e-5,Math.PI/2,0,!0),r.absarc(e-2*n,1e-5,1e-5,0,-Math.PI/2,!0),r},[e,t,i]),h=n.useMemo(()=>({depth:r-2*i,bevelEnabled:!0,bevelSegments:2*o,steps:s,bevelSize:i-1e-5,bevelThickness:i,curveSegments:a}),[r,i,a,o,s]),v=n.useRef(null);return n.useLayoutEffect(()=>{v.current&&(v.current.center(),(0,d.toCreasedNormals)(v.current,u))},[p,h,u]),n.useImperativeHandle(m,()=>v.current),n.createElement("extrudeGeometry",(0,l.default)({ref:v,args:[p,h]},f))});var m=c,p=c;let h=new p.Box3,v=new p.Vector3;class x extends p.InstancedBufferGeometry{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry",this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new p.Float32BufferAttribute([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new p.Float32BufferAttribute([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(e){let t=this.attributes.instanceStart,r=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),r.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));let r=new p.InstancedInterleavedBuffer(t,6,1);return this.setAttribute("instanceStart",new p.InterleavedBufferAttribute(r,3,0)),this.setAttribute("instanceEnd",new p.InterleavedBufferAttribute(r,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e,t=3){let r;e instanceof Float32Array?r=e:Array.isArray(e)&&(r=new Float32Array(e));let i=new p.InstancedInterleavedBuffer(r,2*t,1);return this.setAttribute("instanceColorStart",new p.InterleavedBufferAttribute(i,t,0)),this.setAttribute("instanceColorEnd",new p.InterleavedBufferAttribute(i,t,t)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new p.WireframeGeometry(e.geometry)),this}fromLineSegments(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new p.Box3);let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),h.setFromBufferAttribute(t),this.boundingBox.union(h))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new p.Sphere),null===this.boundingBox&&this.computeBoundingBox();let e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){let r=this.boundingSphere.center;this.boundingBox.getCenter(r);let i=0;for(let n=0,s=e.count;n<s;n++)v.fromBufferAttribute(e,n),i=Math.max(i,r.distanceToSquared(v)),v.fromBufferAttribute(t,n),i=Math.max(i,r.distanceToSquared(v));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(e){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(e)}}var g=c,y=e.i(8560),j=e.i(31497);class b extends g.ShaderMaterial{constructor(e){super({type:"LineMaterial",uniforms:g.UniformsUtils.clone(g.UniformsUtils.merge([y.UniformsLib.common,y.UniformsLib.fog,{worldUnits:{value:1},linewidth:{value:1},resolution:{value:new g.Vector2(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}}])),vertexShader:`
|
||
#include <common>
|
||
#include <fog_pars_vertex>
|
||
#include <logdepthbuf_pars_vertex>
|
||
#include <clipping_planes_pars_vertex>
|
||
|
||
uniform float linewidth;
|
||
uniform vec2 resolution;
|
||
|
||
attribute vec3 instanceStart;
|
||
attribute vec3 instanceEnd;
|
||
|
||
#ifdef USE_COLOR
|
||
#ifdef USE_LINE_COLOR_ALPHA
|
||
varying vec4 vLineColor;
|
||
attribute vec4 instanceColorStart;
|
||
attribute vec4 instanceColorEnd;
|
||
#else
|
||
varying vec3 vLineColor;
|
||
attribute vec3 instanceColorStart;
|
||
attribute vec3 instanceColorEnd;
|
||
#endif
|
||
#endif
|
||
|
||
#ifdef WORLD_UNITS
|
||
|
||
varying vec4 worldPos;
|
||
varying vec3 worldStart;
|
||
varying vec3 worldEnd;
|
||
|
||
#ifdef USE_DASH
|
||
|
||
varying vec2 vUv;
|
||
|
||
#endif
|
||
|
||
#else
|
||
|
||
varying vec2 vUv;
|
||
|
||
#endif
|
||
|
||
#ifdef USE_DASH
|
||
|
||
uniform float dashScale;
|
||
attribute float instanceDistanceStart;
|
||
attribute float instanceDistanceEnd;
|
||
varying float vLineDistance;
|
||
|
||
#endif
|
||
|
||
void trimSegment( const in vec4 start, inout vec4 end ) {
|
||
|
||
// trim end segment so it terminates between the camera plane and the near plane
|
||
|
||
// conservative estimate of the near plane
|
||
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
||
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
||
float nearEstimate = - 0.5 * b / a;
|
||
|
||
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
||
|
||
end.xyz = mix( start.xyz, end.xyz, alpha );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
#ifdef USE_COLOR
|
||
|
||
vLineColor = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
||
|
||
#endif
|
||
|
||
#ifdef USE_DASH
|
||
|
||
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
||
vUv = uv;
|
||
|
||
#endif
|
||
|
||
float aspect = resolution.x / resolution.y;
|
||
|
||
// camera space
|
||
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
||
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
||
|
||
#ifdef WORLD_UNITS
|
||
|
||
worldStart = start.xyz;
|
||
worldEnd = end.xyz;
|
||
|
||
#else
|
||
|
||
vUv = uv;
|
||
|
||
#endif
|
||
|
||
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
||
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
||
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
||
// perhaps there is a more elegant solution -- WestLangley
|
||
|
||
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
||
|
||
if ( perspective ) {
|
||
|
||
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
||
|
||
trimSegment( start, end );
|
||
|
||
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
||
|
||
trimSegment( end, start );
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// clip space
|
||
vec4 clipStart = projectionMatrix * start;
|
||
vec4 clipEnd = projectionMatrix * end;
|
||
|
||
// ndc space
|
||
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
||
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
||
|
||
// direction
|
||
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
||
|
||
// account for clip-space aspect ratio
|
||
dir.x *= aspect;
|
||
dir = normalize( dir );
|
||
|
||
#ifdef WORLD_UNITS
|
||
|
||
// get the offset direction as perpendicular to the view vector
|
||
vec3 worldDir = normalize( end.xyz - start.xyz );
|
||
vec3 offset;
|
||
if ( position.y < 0.5 ) {
|
||
|
||
offset = normalize( cross( start.xyz, worldDir ) );
|
||
|
||
} else {
|
||
|
||
offset = normalize( cross( end.xyz, worldDir ) );
|
||
|
||
}
|
||
|
||
// sign flip
|
||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||
|
||
float forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );
|
||
|
||
// don't extend the line if we're rendering dashes because we
|
||
// won't be rendering the endcaps
|
||
#ifndef USE_DASH
|
||
|
||
// extend the line bounds to encompass endcaps
|
||
start.xyz += - worldDir * linewidth * 0.5;
|
||
end.xyz += worldDir * linewidth * 0.5;
|
||
|
||
// shift the position of the quad so it hugs the forward edge of the line
|
||
offset.xy -= dir * forwardOffset;
|
||
offset.z += 0.5;
|
||
|
||
#endif
|
||
|
||
// endcaps
|
||
if ( position.y > 1.0 || position.y < 0.0 ) {
|
||
|
||
offset.xy += dir * 2.0 * forwardOffset;
|
||
|
||
}
|
||
|
||
// adjust for linewidth
|
||
offset *= linewidth * 0.5;
|
||
|
||
// set the world position
|
||
worldPos = ( position.y < 0.5 ) ? start : end;
|
||
worldPos.xyz += offset;
|
||
|
||
// project the worldpos
|
||
vec4 clip = projectionMatrix * worldPos;
|
||
|
||
// shift the depth of the projected points so the line
|
||
// segments overlap neatly
|
||
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
||
clip.z = clipPose.z * clip.w;
|
||
|
||
#else
|
||
|
||
vec2 offset = vec2( dir.y, - dir.x );
|
||
// undo aspect ratio adjustment
|
||
dir.x /= aspect;
|
||
offset.x /= aspect;
|
||
|
||
// sign flip
|
||
if ( position.x < 0.0 ) offset *= - 1.0;
|
||
|
||
// endcaps
|
||
if ( position.y < 0.0 ) {
|
||
|
||
offset += - dir;
|
||
|
||
} else if ( position.y > 1.0 ) {
|
||
|
||
offset += dir;
|
||
|
||
}
|
||
|
||
// adjust for linewidth
|
||
offset *= linewidth;
|
||
|
||
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
||
offset /= resolution.y;
|
||
|
||
// select end
|
||
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
||
|
||
// back to clip space
|
||
offset *= clip.w;
|
||
|
||
clip.xy += offset;
|
||
|
||
#endif
|
||
|
||
gl_Position = clip;
|
||
|
||
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
||
|
||
#include <logdepthbuf_vertex>
|
||
#include <clipping_planes_vertex>
|
||
#include <fog_vertex>
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
uniform vec3 diffuse;
|
||
uniform float opacity;
|
||
uniform float linewidth;
|
||
|
||
#ifdef USE_DASH
|
||
|
||
uniform float dashOffset;
|
||
uniform float dashSize;
|
||
uniform float gapSize;
|
||
|
||
#endif
|
||
|
||
varying float vLineDistance;
|
||
|
||
#ifdef WORLD_UNITS
|
||
|
||
varying vec4 worldPos;
|
||
varying vec3 worldStart;
|
||
varying vec3 worldEnd;
|
||
|
||
#ifdef USE_DASH
|
||
|
||
varying vec2 vUv;
|
||
|
||
#endif
|
||
|
||
#else
|
||
|
||
varying vec2 vUv;
|
||
|
||
#endif
|
||
|
||
#include <common>
|
||
#include <fog_pars_fragment>
|
||
#include <logdepthbuf_pars_fragment>
|
||
#include <clipping_planes_pars_fragment>
|
||
|
||
#ifdef USE_COLOR
|
||
#ifdef USE_LINE_COLOR_ALPHA
|
||
varying vec4 vLineColor;
|
||
#else
|
||
varying vec3 vLineColor;
|
||
#endif
|
||
#endif
|
||
|
||
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
||
|
||
float mua;
|
||
float mub;
|
||
|
||
vec3 p13 = p1 - p3;
|
||
vec3 p43 = p4 - p3;
|
||
|
||
vec3 p21 = p2 - p1;
|
||
|
||
float d1343 = dot( p13, p43 );
|
||
float d4321 = dot( p43, p21 );
|
||
float d1321 = dot( p13, p21 );
|
||
float d4343 = dot( p43, p43 );
|
||
float d2121 = dot( p21, p21 );
|
||
|
||
float denom = d2121 * d4343 - d4321 * d4321;
|
||
|
||
float numer = d1343 * d4321 - d1321 * d4343;
|
||
|
||
mua = numer / denom;
|
||
mua = clamp( mua, 0.0, 1.0 );
|
||
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
||
mub = clamp( mub, 0.0, 1.0 );
|
||
|
||
return vec2( mua, mub );
|
||
|
||
}
|
||
|
||
void main() {
|
||
|
||
#include <clipping_planes_fragment>
|
||
|
||
#ifdef USE_DASH
|
||
|
||
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
||
|
||
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
||
|
||
#endif
|
||
|
||
float alpha = opacity;
|
||
|
||
#ifdef WORLD_UNITS
|
||
|
||
// Find the closest points on the view ray and the line segment
|
||
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
||
vec3 lineDir = worldEnd - worldStart;
|
||
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
||
|
||
vec3 p1 = worldStart + lineDir * params.x;
|
||
vec3 p2 = rayEnd * params.y;
|
||
vec3 delta = p1 - p2;
|
||
float len = length( delta );
|
||
float norm = len / linewidth;
|
||
|
||
#ifndef USE_DASH
|
||
|
||
#ifdef USE_ALPHA_TO_COVERAGE
|
||
|
||
float dnorm = fwidth( norm );
|
||
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
||
|
||
#else
|
||
|
||
if ( norm > 0.5 ) {
|
||
|
||
discard;
|
||
|
||
}
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
#else
|
||
|
||
#ifdef USE_ALPHA_TO_COVERAGE
|
||
|
||
// artifacts appear on some hardware if a derivative is taken within a conditional
|
||
float a = vUv.x;
|
||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||
float len2 = a * a + b * b;
|
||
float dlen = fwidth( len2 );
|
||
|
||
if ( abs( vUv.y ) > 1.0 ) {
|
||
|
||
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
||
|
||
}
|
||
|
||
#else
|
||
|
||
if ( abs( vUv.y ) > 1.0 ) {
|
||
|
||
float a = vUv.x;
|
||
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
||
float len2 = a * a + b * b;
|
||
|
||
if ( len2 > 1.0 ) discard;
|
||
|
||
}
|
||
|
||
#endif
|
||
|
||
#endif
|
||
|
||
vec4 diffuseColor = vec4( diffuse, alpha );
|
||
#ifdef USE_COLOR
|
||
#ifdef USE_LINE_COLOR_ALPHA
|
||
diffuseColor *= vLineColor;
|
||
#else
|
||
diffuseColor.rgb *= vLineColor;
|
||
#endif
|
||
#endif
|
||
|
||
#include <logdepthbuf_fragment>
|
||
|
||
gl_FragColor = diffuseColor;
|
||
|
||
#include <tonemapping_fragment>
|
||
#include <${j.version>=154?"colorspace_fragment":"encodings_fragment"}>
|
||
#include <fog_fragment>
|
||
#include <premultiplied_alpha_fragment>
|
||
|
||
}
|
||
`,clipping:!0}),this.isLineMaterial=!0,this.onBeforeCompile=function(){this.transparent?this.defines.USE_LINE_COLOR_ALPHA="1":delete this.defines.USE_LINE_COLOR_ALPHA},Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(e){this.uniforms.linewidth.value=e}},dashed:{enumerable:!0,get:function(){return"USE_DASH"in this.defines},set(e){!!e!="USE_DASH"in this.defines&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return"USE_ALPHA_TO_COVERAGE"in this.defines},set:function(e){!!e!="USE_ALPHA_TO_COVERAGE"in this.defines&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(e)}}let S=j.version>=125?"uv1":"uv2",M=new m.Vector4,w=new m.Vector3,E=new m.Vector3,A=new m.Vector4,U=new m.Vector4,_=new m.Vector4,z=new m.Vector3,P=new m.Matrix4,D=new m.Line3,I=new m.Vector3,R=new m.Box3,L=new m.Sphere,C=new m.Vector4;function B(e,t,i){return C.set(0,0,-t,1).applyMatrix4(e.projectionMatrix),C.multiplyScalar(1/C.w),C.x=r/i.width,C.y=r/i.height,C.applyMatrix4(e.projectionMatrixInverse),C.multiplyScalar(1/C.w),Math.abs(Math.max(C.x,C.y))}class F extends m.Mesh{constructor(e=new x,t=new b({color:0xffffff*Math.random()})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){let e=this.geometry,t=e.attributes.instanceStart,r=e.attributes.instanceEnd,i=new Float32Array(2*t.count);for(let e=0,n=0,s=t.count;e<s;e++,n+=2)w.fromBufferAttribute(t,e),E.fromBufferAttribute(r,e),i[n]=0===n?0:i[n-1],i[n+1]=i[n]+w.distanceTo(E);let n=new m.InstancedInterleavedBuffer(i,2,1);return e.setAttribute("instanceDistanceStart",new m.InterleavedBufferAttribute(n,1,0)),e.setAttribute("instanceDistanceEnd",new m.InterleavedBufferAttribute(n,1,1)),this}raycast(e,i){let n,s,a=this.material.worldUnits,o=e.camera;null!==o||a||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');let l=void 0!==e.params.Line2&&e.params.Line2.threshold||0;t=e.ray;let c=this.matrixWorld,d=this.geometry,u=this.material;if(r=u.linewidth+l,null===d.boundingSphere&&d.computeBoundingSphere(),L.copy(d.boundingSphere).applyMatrix4(c),a)n=.5*r;else{let e=Math.max(o.near,L.distanceToPoint(t.origin));n=B(o,e,u.resolution)}if(L.radius+=n,!1!==t.intersectsSphere(L)){if(null===d.boundingBox&&d.computeBoundingBox(),R.copy(d.boundingBox).applyMatrix4(c),a)s=.5*r;else{let e=Math.max(o.near,R.distanceToPoint(t.origin));s=B(o,e,u.resolution)}R.expandByScalar(s),!1!==t.intersectsBox(R)&&(a?function(e,i){let n=e.matrixWorld,s=e.geometry,a=s.attributes.instanceStart,o=s.attributes.instanceEnd,l=Math.min(s.instanceCount,a.count);for(let s=0;s<l;s++){D.start.fromBufferAttribute(a,s),D.end.fromBufferAttribute(o,s),D.applyMatrix4(n);let l=new m.Vector3,c=new m.Vector3;t.distanceSqToSegment(D.start,D.end,c,l),c.distanceTo(l)<.5*r&&i.push({point:c,pointOnLine:l,distance:t.origin.distanceTo(c),object:e,face:null,faceIndex:s,uv:null,[S]:null})}}(this,i):function(e,i,n){let s=i.projectionMatrix,a=e.material.resolution,o=e.matrixWorld,l=e.geometry,c=l.attributes.instanceStart,d=l.attributes.instanceEnd,u=Math.min(l.instanceCount,c.count),f=-i.near;t.at(1,_),_.w=1,_.applyMatrix4(i.matrixWorldInverse),_.applyMatrix4(s),_.multiplyScalar(1/_.w),_.x*=a.x/2,_.y*=a.y/2,_.z=0,z.copy(_),P.multiplyMatrices(i.matrixWorldInverse,o);for(let i=0;i<u;i++){if(A.fromBufferAttribute(c,i),U.fromBufferAttribute(d,i),A.w=1,U.w=1,A.applyMatrix4(P),U.applyMatrix4(P),A.z>f&&U.z>f)continue;if(A.z>f){let e=A.z-U.z,t=(A.z-f)/e;A.lerp(U,t)}else if(U.z>f){let e=U.z-A.z,t=(U.z-f)/e;U.lerp(A,t)}A.applyMatrix4(s),U.applyMatrix4(s),A.multiplyScalar(1/A.w),U.multiplyScalar(1/U.w),A.x*=a.x/2,A.y*=a.y/2,U.x*=a.x/2,U.y*=a.y/2,D.start.copy(A),D.start.z=0,D.end.copy(U),D.end.z=0;let l=D.closestPointToPointParameter(z,!0);D.at(l,I);let u=m.MathUtils.lerp(A.z,U.z,l),p=u>=-1&&u<=1,h=z.distanceTo(I)<.5*r;if(p&&h){D.start.fromBufferAttribute(c,i),D.end.fromBufferAttribute(d,i),D.start.applyMatrix4(o),D.end.applyMatrix4(o);let r=new m.Vector3,s=new m.Vector3;t.distanceSqToSegment(D.start,D.end,s,r),n.push({point:s,pointOnLine:r,distance:t.origin.distanceTo(s),object:e,face:null,faceIndex:i,uv:null,[S]:null})}}}(this,o,i))}}onBeforeRender(e){let t=this.material.uniforms;t&&t.resolution&&(e.getViewport(M),this.material.uniforms.resolution.value.set(M.z,M.w))}}class T extends x{constructor(){super(),this.isLineGeometry=!0,this.type="LineGeometry"}setPositions(e){let t=e.length-3,r=new Float32Array(2*t);for(let i=0;i<t;i+=3)r[2*i]=e[i],r[2*i+1]=e[i+1],r[2*i+2]=e[i+2],r[2*i+3]=e[i+3],r[2*i+4]=e[i+4],r[2*i+5]=e[i+5];return super.setPositions(r),this}setColors(e,t=3){let r=e.length-t,i=new Float32Array(2*r);if(3===t)for(let n=0;n<r;n+=t)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5];else for(let n=0;n<r;n+=t)i[2*n]=e[n],i[2*n+1]=e[n+1],i[2*n+2]=e[n+2],i[2*n+3]=e[n+3],i[2*n+4]=e[n+4],i[2*n+5]=e[n+5],i[2*n+6]=e[n+6],i[2*n+7]=e[n+7];return super.setColors(i,t),this}fromLine(e){let t=e.geometry;return this.setPositions(t.attributes.position.array),this}}class k extends F{constructor(e=new T,t=new b({color:0xffffff*Math.random()})){super(e,t),this.isLine2=!0,this.type="Line2"}}let G=n.forwardRef(function({points:e,color:t=0xffffff,vertexColors:r,linewidth:i,lineWidth:s,segments:a,dashed:d,...u},f){var m,p;let h=(0,o.useThree)(e=>e.size),v=n.useMemo(()=>a?new F:new k,[a]),[g]=n.useState(()=>new b),y=(null==r||null==(m=r[0])?void 0:m.length)===4?4:3,j=n.useMemo(()=>{let i=a?new x:new T,n=e.map(e=>{let t=Array.isArray(e);return e instanceof c.Vector3||e instanceof c.Vector4?[e.x,e.y,e.z]:e instanceof c.Vector2?[e.x,e.y,0]:t&&3===e.length?[e[0],e[1],e[2]]:t&&2===e.length?[e[0],e[1],0]:e});if(i.setPositions(n.flat()),r){t=0xffffff;let e=r.map(e=>e instanceof c.Color?e.toArray():e);i.setColors(e.flat(),y)}return i},[e,a,r,y]);return n.useLayoutEffect(()=>{v.computeLineDistances()},[e,v]),n.useLayoutEffect(()=>{d?g.defines.USE_DASH="":delete g.defines.USE_DASH,g.needsUpdate=!0},[d,g]),n.useEffect(()=>()=>{j.dispose(),g.dispose()},[j]),n.createElement("primitive",(0,l.default)({object:v,ref:f},u),n.createElement("primitive",{object:j,attach:"geometry"}),n.createElement("primitive",(0,l.default)({object:g,attach:"material",color:t,vertexColors:!!r,resolution:[h.width,h.height],linewidth:null!=(p=null!=i?i:s)?p:1,dashed:d,transparent:4===y},u)))});var O=c,N=e.i(67335);let V=parseInt(c.REVISION.replace(/\D+/g,""));class H extends O.ShaderMaterial{constructor(){super({uniforms:{time:{value:0},pixelRatio:{value:1}},vertexShader:`
|
||
uniform float pixelRatio;
|
||
uniform float time;
|
||
attribute float size;
|
||
attribute float speed;
|
||
attribute float opacity;
|
||
attribute vec3 noise;
|
||
attribute vec3 color;
|
||
varying vec3 vColor;
|
||
varying float vOpacity;
|
||
|
||
void main() {
|
||
vec4 modelPosition = modelMatrix * vec4(position, 1.0);
|
||
modelPosition.y += sin(time * speed + modelPosition.x * noise.x * 100.0) * 0.2;
|
||
modelPosition.z += cos(time * speed + modelPosition.x * noise.y * 100.0) * 0.2;
|
||
modelPosition.x += cos(time * speed + modelPosition.x * noise.z * 100.0) * 0.2;
|
||
vec4 viewPosition = viewMatrix * modelPosition;
|
||
vec4 projectionPostion = projectionMatrix * viewPosition;
|
||
gl_Position = projectionPostion;
|
||
gl_PointSize = size * 25. * pixelRatio;
|
||
gl_PointSize *= (1.0 / - viewPosition.z);
|
||
vColor = color;
|
||
vOpacity = opacity;
|
||
}
|
||
`,fragmentShader:`
|
||
varying vec3 vColor;
|
||
varying float vOpacity;
|
||
void main() {
|
||
float distanceToCenter = distance(gl_PointCoord, vec2(0.5));
|
||
float strength = 0.05 / distanceToCenter - 0.1;
|
||
gl_FragColor = vec4(vColor, strength * vOpacity);
|
||
#include <tonemapping_fragment>
|
||
#include <${V>=154?"colorspace_fragment":"encodings_fragment"}>
|
||
}
|
||
`})}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}get pixelRatio(){return this.uniforms.pixelRatio.value}set pixelRatio(e){this.uniforms.pixelRatio.value=e}}let W=e=>e&&e.constructor===Float32Array,$=e=>e instanceof O.Vector2||e instanceof O.Vector3||e instanceof O.Vector4,q=e=>Array.isArray(e)?e:$(e)?e.toArray():[e,e,e];function Y(e,t,r){return n.useMemo(()=>{if(void 0!==t)if(W(t))return t;else{if(t instanceof O.Color){let r=Array.from({length:3*e},()=>[t.r,t.g,t.b]).flat();return Float32Array.from(r)}if($(t)||Array.isArray(t)){let r=Array.from({length:3*e},()=>q(t)).flat();return Float32Array.from(r)}return Float32Array.from({length:e},()=>t)}return Float32Array.from({length:e},r)},[t])}let K=n.forwardRef(({noise:e=1,count:t=100,speed:r=1,opacity:i=1,scale:s=1,size:c,color:d,children:u,...f},m)=>{n.useMemo(()=>(0,N.extend)({SparklesImplMaterial:H}),[]);let p=n.useRef(null),h=(0,o.useThree)(e=>e.viewport.dpr),v=q(s),x=n.useMemo(()=>Float32Array.from(Array.from({length:t},()=>v.map(O.MathUtils.randFloatSpread)).flat()),[t,...v]),g=Y(t,c,Math.random),y=Y(t,i),j=Y(t,r),b=Y(3*t,e),S=Y(void 0===d?3*t:t,W(d)?d:new O.Color(d),()=>1);return(0,a.useFrame)(e=>{p.current&&p.current.material&&(p.current.material.time=e.clock.elapsedTime)}),n.useImperativeHandle(m,()=>p.current,[]),n.createElement("points",(0,l.default)({key:`particle-${t}-${JSON.stringify(s)}`},f,{ref:p}),n.createElement("bufferGeometry",null,n.createElement("bufferAttribute",{attach:"attributes-position",args:[x,3]}),n.createElement("bufferAttribute",{attach:"attributes-size",args:[g,1]}),n.createElement("bufferAttribute",{attach:"attributes-opacity",args:[y,1]}),n.createElement("bufferAttribute",{attach:"attributes-speed",args:[j,1]}),n.createElement("bufferAttribute",{attach:"attributes-color",args:[S,3]}),n.createElement("bufferAttribute",{attach:"attributes-noise",args:[b,3]})),u||n.createElement("sparklesImplMaterial",{transparent:!0,pixelRatio:h,depthWrite:!1}))});var Z=e.i(60099),J=e.i(78140);let X={uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
uniform sampler2D tDiffuse;
|
||
uniform float h;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vec4 sum = vec4( 0.0 );
|
||
|
||
sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
|
||
|
||
gl_FragColor = sum;
|
||
|
||
}
|
||
`},Q={uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vUv = uv;
|
||
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
||
|
||
}
|
||
`,fragmentShader:`
|
||
|
||
uniform sampler2D tDiffuse;
|
||
uniform float v;
|
||
|
||
varying vec2 vUv;
|
||
|
||
void main() {
|
||
|
||
vec4 sum = vec4( 0.0 );
|
||
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
|
||
sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
|
||
|
||
gl_FragColor = sum;
|
||
|
||
}
|
||
`},ee=n.forwardRef(({scale:e=10,frames:t=1/0,opacity:r=1,width:i=1,height:s=1,blur:d=1,near:u=0,far:f=10,resolution:m=512,smooth:p=!0,color:h="#000000",depthWrite:v=!1,renderOrder:x,...g},y)=>{let j,b,S=n.useRef(null),M=(0,o.useThree)(e=>e.scene),w=(0,o.useThree)(e=>e.gl),E=n.useRef(null);i*=Array.isArray(e)?e[0]:e||1,s*=Array.isArray(e)?e[1]:e||1;let[A,U,_,z,P,D,I]=n.useMemo(()=>{let e=new c.WebGLRenderTarget(m,m),t=new c.WebGLRenderTarget(m,m);t.texture.generateMipmaps=e.texture.generateMipmaps=!1;let r=new c.PlaneGeometry(i,s).rotateX(Math.PI/2),n=new c.Mesh(r),a=new c.MeshDepthMaterial;a.depthTest=a.depthWrite=!1,a.onBeforeCompile=e=>{e.uniforms={...e.uniforms,ucolor:{value:new c.Color(h)}},e.fragmentShader=e.fragmentShader.replace("void main() {",`uniform vec3 ucolor;
|
||
void main() {
|
||
`),e.fragmentShader=e.fragmentShader.replace("vec4( vec3( 1.0 - fragCoordZ ), opacity );","vec4( ucolor * fragCoordZ * 2.0, ( 1.0 - fragCoordZ ) * 1.0 );")};let o=new c.ShaderMaterial(X),l=new c.ShaderMaterial(Q);return l.depthTest=o.depthTest=!1,[e,r,a,n,o,l,t]},[m,i,s,e,h]),R=e=>{z.visible=!0,z.material=P,P.uniforms.tDiffuse.value=A.texture,P.uniforms.h.value=e/256,w.setRenderTarget(I),w.render(z,E.current),z.material=D,D.uniforms.tDiffuse.value=I.texture,D.uniforms.v.value=e/256,w.setRenderTarget(A),w.render(z,E.current),z.visible=!1},L=0;return(0,a.useFrame)(()=>{E.current&&(t===1/0||L<t)&&(L++,j=M.background,b=M.overrideMaterial,S.current.visible=!1,M.background=null,M.overrideMaterial=_,w.setRenderTarget(A),w.render(M,E.current),R(d),p&&R(.4*d),w.setRenderTarget(null),S.current.visible=!0,M.overrideMaterial=b,M.background=j)}),n.useImperativeHandle(y,()=>S.current,[]),n.createElement("group",(0,l.default)({"rotation-x":Math.PI/2},g,{ref:S}),n.createElement("mesh",{renderOrder:x,geometry:U,scale:[1,-1,1],rotation:[-Math.PI/2,0,0]},n.createElement("meshBasicMaterial",{transparent:!0,map:A.texture,opacity:r,depthWrite:v})),n.createElement("orthographicCamera",{ref:E,args:[-i/2,i/2,s/2,-s/2,u,f]}))});var et=e.i(43257),er=e.i(24205);let ei=n.forwardRef(({light:e,args:t,map:r,toneMapped:i=!1,color:s="white",form:a="rect",intensity:o=1,scale:d=1,target:u=[0,0,0],children:f,...m},p)=>{let h=n.useRef(null);return n.useImperativeHandle(p,()=>h.current,[]),n.useLayoutEffect(()=>{f||m.material||((0,er.applyProps)(h.current.material,{color:s}),h.current.material.color.multiplyScalar(o))},[s,o,f,m.material]),n.useLayoutEffect(()=>{m.rotation||h.current.quaternion.identity(),u&&!m.rotation&&("boolean"==typeof u?h.current.lookAt(0,0,0):h.current.lookAt(Array.isArray(u)?new c.Vector3(...u):u))},[u,m.rotation]),d=Array.isArray(d)&&2===d.length?[d[0],d[1],1]:d,n.createElement("mesh",(0,l.default)({ref:h,scale:d},m),"circle"===a?n.createElement("ringGeometry",{args:t||[0,.5,64]}):"ring"===a?n.createElement("ringGeometry",{args:t||[.25,.5,64]}):"rect"===a||"plane"===a?n.createElement("planeGeometry",{args:t||[1,1]}):"box"===a?n.createElement("boxGeometry",{args:t||[1,1,1]}):n.createElement(a,{args:t}),f||n.createElement("meshBasicMaterial",{toneMapped:i,map:r,side:c.DoubleSide}),e&&n.createElement("pointLight",(0,l.default)({castShadow:!0},e)))});function en({all:e,scene:t,camera:r}){let i=(0,o.useThree)(({gl:e})=>e),s=(0,o.useThree)(({camera:e})=>e),a=(0,o.useThree)(({scene:e})=>e);return n.useLayoutEffect(()=>{let n=[];e&&(t||a).traverse(e=>{!1===e.visible&&(n.push(e),e.visible=!0)}),i.compile(t||a,r||s);let o=new c.WebGLCubeRenderTarget(128);new c.CubeCamera(.01,1e5,o).update(i,t||a),o.dispose(),n.forEach(e=>e.visible=!1)},[]),null}var es=e.i(79877),ea=e.i(33623),eo=e.i(48228);let el="#eef1f6",ec="#22C55E",ed="#8B5CF6",eu="#3B82F6",ef="#F59E0B",em="#C01227";function ep(){let e=(0,o.useThree)(e=>e.gl),t=(0,n.useRef)(null),r=(0,n.useRef)({t:0,frames:0,mount:0,firstFrame:0,nav:0});return(0,n.useEffect)(()=>{let e=r.current;e.mount=performance.now();let i=performance.getEntriesByType("navigation")[0];e.nav=i?Math.round(i.loadEventEnd||i.domContentLoadedEventEnd):0;let n=document.createElement("div");return n.style.cssText="position:fixed;top:10px;left:10px;z-index:99999;font:11px/1.5 ui-monospace,monospace;background:rgba(0,0,0,.82);color:#39ff14;padding:8px 11px;border-radius:7px;white-space:pre;pointer-events:none",document.body.appendChild(n),t.current=n,()=>{n.remove()}},[]),(0,a.useFrame)((i,n)=>{let s=r.current;if(!s.firstFrame&&s.mount&&(s.firstFrame=performance.now()-s.mount),s.frames++,s.t+=n,s.t>=.5&&t.current){let r=e.info.render,i=e.info.memory;t.current.textContent=`FPS ${(s.frames/s.t).toFixed(0)}
|
||
draws ${r.calls}${r.calls<100?" ✓":" ⚠"}
|
||
triangles ${r.triangles.toLocaleString()}
|
||
geometries ${i.geometries}
|
||
textures ${i.textures}
|
||
programs ${e.info.programs?.length??0}
|
||
page load ${s.nav}ms
|
||
WF3 1st fr ${Math.round(s.firstFrame)}ms`,s.frames=0,s.t=0}}),null}function eh({progress:e,reduced:t,isMobile:r}){let i=(0,n.useRef)(new c.Vector3(...(0,eo.cameraFor)(0).look));return(0,a.useFrame)((n,s)=>{let a=(e.current??0)*(eo.N-1),{pos:o,look:l}=(0,eo.cameraFor)(a),c=n.clock.elapsedTime,d=+!!r,u=o[0]*(1-.25*d)+.22*Math.sin(.22*c),f=o[1]+1.1*d+.1*Math.sin(.3*c),m=o[2]+3*d,p=t?1:1-Math.pow(.0025,s),h=n.camera;h.position.x+=(u-h.position.x)*p,h.position.y+=(f-h.position.y)*p,h.position.z+=(m-h.position.z)*p,i.current.x+=(l[0]-i.current.x)*p,i.current.y+=(l[1]-i.current.y)*p,i.current.z+=(l[2]-i.current.z)*p,h.lookAt(i.current)}),null}function ev(e,t,r){let i=(0,n.useRef)([]);return(0,n.useEffect)(()=>{r||(i.current=[])},[r]),(0,a.useFrame)(()=>{if(!r)return;let n=(t.current??0)*(eo.N-1),s=c.MathUtils.clamp(1-(Math.abs(n-e)-.2)/.3,0,1);for(let e of i.current)e.style.opacity=String(s)}),e=>{e&&!i.current.includes(e)&&i.current.push(e)}}function ex({position:e,color:t,size:r=.1,pulse:s=!1}){let o=(0,n.useRef)(null);return(0,a.useFrame)(t=>{o.current&&o.current.scale.setScalar(1+.2*Math.sin(2*t.clock.elapsedTime+e[0]))}),(0,i.jsxs)("group",{position:e,children:[(0,i.jsxs)("mesh",{children:[(0,i.jsx)("sphereGeometry",{args:[r,16,16]}),(0,i.jsx)("meshStandardMaterial",{color:t,emissive:t,emissiveIntensity:1,toneMapped:!1})]}),s&&(0,i.jsxs)("mesh",{ref:o,rotation:[-Math.PI/2,0,0],position:[0,-(.6*r),0],children:[(0,i.jsx)("ringGeometry",{args:[1.5*r,1.8*r,24]}),(0,i.jsx)("meshBasicMaterial",{color:t,transparent:!0,opacity:.5,side:c.DoubleSide,toneMapped:!1})]})]})}function eg({curve:e,color:t,speed:r=.4,offset:s=0,size:o=.06}){let l=(0,n.useRef)(null);return(0,a.useFrame)(t=>{l.current&&l.current.position.copy(e.getPoint((t.clock.elapsedTime*r+s)%1))}),(0,i.jsxs)("mesh",{ref:l,children:[(0,i.jsx)("sphereGeometry",{args:[o,8,8]}),(0,i.jsx)("meshBasicMaterial",{color:t,toneMapped:!1})]})}function ey(e,t){return new c.LineCurve3(new c.Vector3(...e),new c.Vector3(...t))}let ej={bike:"/models/scooter.glb",auto:"/models/auto_rickshaw.glb",truck:"/models/truck.glb",van:"/models/van.glb"},eb={bike:{size:1,rotY:.72*Math.PI},auto:{size:.92,rotY:.72*Math.PI},truck:{size:1.2,rotY:.72*Math.PI},van:{size:1.02,rotY:.72*Math.PI}};function eS(e,t){let r=e.clone(!0),i=[];r.traverse(e=>{if(/wheel|tyre|tire|\brim\b/i.test(e.name)&&i.push(e),!e.isMesh)return;e.castShadow=!0,e.receiveShadow=!1;let t=e.material,r=e=>{"transmission"in e&&e.transmission>0&&(e.transmission=0,e.transparent=!1,e.opacity=1),"envMapIntensity"in e&&(e.envMapIntensity=.4),e.needsUpdate=!0};Array.isArray(t)?t.forEach(r):r(t)});let n=new c.Box3().setFromObject(r),s=new c.Vector3;n.getSize(s);let a=new c.Vector3;n.getCenter(a);let o=t/Math.max(s.x,s.y,s.z,1e-4);return r.scale.setScalar(o),r.position.set(-a.x*o,-n.min.y*o,-a.z*o),{root:r,wheels:i}}function eM({kind:e,awake:t=!0}){let r=eb[e],{scene:s}=(0,J.useGLTF)(ej[e]),{root:o}=(0,n.useMemo)(()=>eS(s,r.size),[s,r]),l=(0,n.useRef)(null);return(0,a.useFrame)(r=>{let i=l.current;if(!i||!t)return;let n=r.clock.elapsedTime;switch(e){case"bike":i.position.y=.025*Math.abs(Math.sin(3*n)),i.rotation.z=.012*Math.sin(3*n);break;case"auto":i.rotation.z=.045*Math.sin(1.6*n),i.position.x=.02*Math.sin(1.6*n);break;case"truck":i.position.y=.012*Math.sin(+n),i.rotation.x=.006*Math.sin(.8*n);break;default:i.position.y=.05+.03*Math.sin(1.3*n)}}),(0,i.jsx)("group",{ref:l,rotation:[0,r.rotY,0],children:(0,i.jsx)("primitive",{object:o})})}function ew({route:e,reduced:t,i:r,progress:s,awake:o=!0}){let{scene:l}=(0,J.useGLTF)(ej.truck),d=(0,n.useMemo)(()=>eS(l,.85),[l]),u=(0,n.useRef)([]);(0,n.useEffect)(()=>{u.current=d.wheels},[d]);let f=(0,n.useRef)(null),m=(0,n.useRef)(null),p=(0,n.useMemo)(()=>new c.Quaternion,[]),h=(0,n.useMemo)(()=>new c.Euler,[]),v=(0,n.useRef)(0);return(0,a.useFrame)((i,n)=>{let a=f.current;if(!a||!o)return;let l=(s.current??0)*(eo.N-1),d=c.MathUtils.clamp(l-(r-.5),0,1),x=e.getPointAt(d);a.position.set(x.x,.02,x.z);let g=e.getPointAt(Math.min(1,d+.02)),y=g.x-x.x,j=g.z-x.z;if(y*y+j*j>1e-7&&(h.set(0,Math.atan2(-j,y)+0,0),p.setFromEuler(h),a.quaternion.slerp(p,t?1:1-Math.pow(6e-4,n))),!t){let e=Math.abs(d-v.current),t=u.current;for(let r=0;r<t.length;r++)t[r].rotation.x+=60*e;m.current&&(m.current.position.y=.01*Math.sin(7*i.clock.elapsedTime))}v.current=d}),(0,i.jsxs)("group",{ref:f,children:[(0,i.jsx)("group",{ref:m,children:(0,i.jsx)("primitive",{object:d.root})}),(0,i.jsxs)("mesh",{position:[0,-.005,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.22,.5,28]}),(0,i.jsx)("meshBasicMaterial",{color:eu,transparent:!0,opacity:.4,side:c.DoubleSide,toneMapped:!1})]})]})}Object.values(ej).forEach(e=>J.useGLTF.preload(e));let eE=[{id:"A",veh:"EV Bike",icon:"🚲",x:-2,kind:"bike"},{id:"B",veh:"Auto",icon:"🛺",x:-.67,kind:"auto"},{id:"C",veh:"Cargo Truck",icon:"🚚",x:.67,kind:"truck"},{id:"D",veh:"EV Van",icon:"🚐",x:2,kind:"van"}];function eA({curve:e,offset:t}){let r=(0,n.useRef)(null),s=(0,n.useRef)(null);return(0,a.useFrame)(i=>{let n=(.3*i.clock.elapsedTime+t)%1;r.current&&(r.current.position.copy(e.getPoint(n)),r.current.rotation.y=6*n),s.current&&(s.current.opacity=n>.9?(1-n)*10:n<.08?12*n:1)}),(0,i.jsxs)("mesh",{ref:r,children:[(0,i.jsx)("boxGeometry",{args:[.16,.12,.16]}),(0,i.jsx)("meshStandardMaterial",{ref:s,color:"#ffffff",emissive:ec,emissiveIntensity:.6,transparent:!0,metalness:.1,roughness:.5,toneMapped:!1})]})}function eU({rider:e,register:t,awake:r,focused:s}){return(0,i.jsxs)("group",{position:[e.x,0,.1],children:[(0,i.jsxs)("mesh",{position:[0,.014,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.52,.64,36]}),(0,i.jsx)("meshBasicMaterial",{color:ec,transparent:!0,opacity:.6,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,.008,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("circleGeometry",{args:[.52,36]}),(0,i.jsx)("meshBasicMaterial",{color:ec,transparent:!0,opacity:.08,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsx)("group",{position:[0,.02,0],children:(0,i.jsx)(n.Suspense,{fallback:null,children:(0,i.jsx)(eM,{kind:e.kind,awake:r})})}),s&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,1.5,0],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-chip",ref:t,children:[(0,i.jsx)("span",{className:"dm-st3d-chip__ico",children:e.icon}),(0,i.jsxs)("span",{className:"dm-st3d-chip__txt",children:[(0,i.jsxs)("b",{children:["Rider ",e.id]}),e.veh]})]})})]})}let e_=[3.3,.45,-.7],ez=[0,.55,-1.4],eP=n.default.memo(function({i:e,progress:t,reduced:r,awake:s,focused:o}){let l=ev(e,t,s),d=(0,n.useRef)(null),u=(0,n.useRef)(null);(0,a.useFrame)((e,t)=>{if(s){if(d.current)if(r)d.current.textContent="59";else{let t=e.clock.elapsedTime%3.6;d.current.textContent=String(Math.min(59,Math.round(t/2.4*59)))}u.current&&!r&&(u.current.rotation.z+=.5*t)}});let f=(0,n.useMemo)(()=>ey(e_,ez),[]),m=(0,n.useMemo)(()=>eE.map(e=>ey(ez,[e.x,.12,.1])),[]);return(0,i.jsxs)("group",{position:(0,eo.districtPosition)(e),visible:s,children:[(0,i.jsx)(ex,{position:e_,color:ec,size:.12}),(0,i.jsx)(G,{points:f.getPoints(2),color:ec,lineWidth:1.8,transparent:!0,opacity:.5,toneMapped:!1}),s&&!r&&[0,.5].map(e=>(0,i.jsx)(eA,{curve:f,offset:e},e)),(0,i.jsxs)("group",{position:[0,0,-1.4],children:[(0,i.jsxs)("mesh",{position:[0,.02,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.95,1.12,44]}),(0,i.jsx)("meshBasicMaterial",{color:ec,transparent:!0,opacity:.5,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,.1,0],children:[(0,i.jsx)("cylinderGeometry",{args:[.72,.86,.2,6]}),(0,i.jsx)("meshStandardMaterial",{color:"#102a1d",metalness:.4,roughness:.45,emissive:ec,emissiveIntensity:.12})]}),(0,i.jsxs)("mesh",{position:[0,.55,0],children:[(0,i.jsx)("icosahedronGeometry",{args:[.32,1]}),(0,i.jsx)("meshStandardMaterial",{color:ec,emissive:ec,emissiveIntensity:1.2,toneMapped:!1,flatShading:!0})]}),(0,i.jsxs)("mesh",{ref:u,position:[0,.55,0],rotation:[Math.PI/2.4,0,0],children:[(0,i.jsx)("torusGeometry",{args:[.5,.025,10,40]}),(0,i.jsx)("meshStandardMaterial",{color:ec,emissive:ec,emissiveIntensity:1,toneMapped:!1})]})]}),m.map((e,t)=>(0,i.jsxs)("group",{children:[(0,i.jsx)(G,{points:e.getPoints(2),color:ec,lineWidth:1.6,transparent:!0,opacity:.45,toneMapped:!1}),s&&!r&&(0,i.jsx)(eg,{curve:e,color:ec,speed:.55,offset:.22*t})]},t)),(0,i.jsx)(ee,{position:[0,.02,.1],scale:[7.5,2.6],resolution:512,blur:2.6,far:1.2,opacity:.4,frames:1,color:"#1e293b"}),eE.map(e=>(0,i.jsx)(eU,{rider:e,register:l,awake:s,focused:o},e.id)),o&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[e_[0],e_[1]+.5,e_[2]],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag",style:{"--tc":ec},ref:l,children:"📄 orders.csv"})}),(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,1.8,-1.4],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-count",ref:l,children:[(0,i.jsx)("span",{ref:d,children:"0"})," Orders"]})}),(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,1.32,-1.4],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag",style:{"--tc":ec},ref:l,children:"🤖 AI Assignment Hub"})})]})]})}),eD=[{name:"EV Aware",unified:!0},{name:"Multi Trip",unified:!0},{name:"Time Aware",unified:!0},{name:"Balanced",unified:!1},{name:"Fuel Saver",unified:!1},{name:"Proximity",unified:!1}],eI=[0,1.45,-2.7],eR=n.default.memo(function({i:e,progress:t,reduced:r,awake:s,focused:o}){let l=ev(e,t,s),d=(0,n.useRef)(null),u=(0,n.useRef)(null);(0,a.useFrame)((e,t)=>{!r&&s&&(d.current&&(d.current.rotation.z+=.6*t),u.current&&(u.current.rotation.y+=.4*t))});let f=(0,n.useMemo)(()=>eD.map((e,t)=>{let r=-.3+.18*Math.abs(t-2.5),i=[-3.4+1.36*t,.62,r];return{...e,end:i,curve:ey(eI,i)}}),[]);return(0,i.jsxs)("group",{position:(0,eo.districtPosition)(e),visible:s,children:[(0,i.jsxs)("mesh",{position:[0,.06,-.6],children:[(0,i.jsx)("cylinderGeometry",{args:[5.4,5.6,.12,56]}),(0,i.jsx)("meshStandardMaterial",{color:"#161b30",metalness:.5,roughness:.42,emissive:ed,emissiveIntensity:.07})]}),(0,i.jsxs)("mesh",{position:[0,.13,-.6],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[5.2,5.42,64]}),(0,i.jsx)("meshBasicMaterial",{color:ed,transparent:!0,opacity:.4,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,.65,-2.7],children:[(0,i.jsx)("cylinderGeometry",{args:[.4,.62,1.2,24]}),(0,i.jsx)("meshStandardMaterial",{color:"#2a3350",metalness:.5,roughness:.4})]}),(0,i.jsxs)("mesh",{ref:u,position:eI,children:[(0,i.jsx)("icosahedronGeometry",{args:[.6,1]}),(0,i.jsx)("meshStandardMaterial",{color:ed,emissive:ed,emissiveIntensity:1.3,toneMapped:!1,flatShading:!0})]}),(0,i.jsxs)("mesh",{ref:d,position:eI,rotation:[Math.PI/2.4,0,0],children:[(0,i.jsx)("torusGeometry",{args:[.98,.03,10,44]}),(0,i.jsx)("meshStandardMaterial",{color:ed,emissive:ed,emissiveIntensity:1.1,toneMapped:!1})]}),o&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,2.5,-2.7],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag",style:{"--tc":ed},ref:l,children:"🤖 AI Engine"})}),f.map((e,t)=>{let n=e.unified?ed:"#a99bd6";return(0,i.jsxs)("group",{children:[(0,i.jsx)(G,{points:e.curve.getPoints(2),color:n,lineWidth:e.unified?2.4:1.6,transparent:!0,opacity:e.unified?.7:.5,toneMapped:!1}),s&&!r&&(0,i.jsx)(eg,{curve:e.curve,color:n,speed:.5,offset:.16*t,size:e.unified?.075:.06}),(0,i.jsxs)("mesh",{position:[e.end[0],.135,e.end[2]],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.34,.44,28]}),(0,i.jsx)("meshBasicMaterial",{color:n,transparent:!0,opacity:e.unified?.6:.4,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsx)(ex,{position:e.end,color:n,size:e.unified?.15:.11}),o&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[e.end[0],e.end[1]+.62,e.end[2]],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:`dm-st3d-tag ${e.unified?"is-u":"is-muted"}`,style:{"--tc":e.unified?ed:"#94a3b8"},ref:l,children:e.name})})]},e.name)})]})}),eL=[-2.9,1.9],eC=[[-1.5,-2.6],[.1,-1],[1.7,-2.3],[2.7,.3],[.9,1.5],[-.6,.5]],eB=[{t:"Route Optimization",p:[-2.7,2.5,-.4]},{t:"Battery Validation",p:[2.6,2.9,-1.2]},{t:"SLA Validation",p:[-2.3,2,1.6]},{t:"Feasibility Check",p:[2.5,1.7,1.8]}],eF=["Route Node A",null,"Route Node B",null,"Route Node C","📦 Delivery"];function eT({pos:e,i:t,progress:r}){let s=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,a.useFrame)(e=>{let i=(r.current??0)*(eo.N-1),n=c.MathUtils.clamp(i-(t-.5),0,1);if(s.current&&o.current)if(n>.85){let t=e.clock.elapsedTime%1.1/1.1;s.current.scale.setScalar(1+3*t),o.current.opacity=(1-t)*.6}else o.current.opacity=0}),(0,i.jsxs)("mesh",{ref:s,position:e,rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.2,.3,32]}),(0,i.jsx)("meshBasicMaterial",{ref:o,color:eu,transparent:!0,opacity:0,side:c.DoubleSide,toneMapped:!1})]})}function ek({pos:e,i:t,progress:r}){let s=(0,n.useRef)(null);return(0,a.useFrame)(()=>{let e=(r.current??0)*(eo.N-1),i=c.MathUtils.clamp(e-(t-.5),0,1);s.current&&(s.current.style.opacity=i>.9?"1":"0")}),(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:e,zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag is-win",style:{"--tc":eu,opacity:0},ref:s,children:"✓ Delivered"})})}let eG=n.default.memo(function({i:e,progress:t,reduced:r,awake:s,focused:a}){let o=ev(e,t,s),l=(0,n.useMemo)(()=>{let e=[eL,...eC].map(([e,t])=>new c.Vector3(e,.12,t));return new c.CatmullRomCurve3(e,!1,"catmullrom",.2)},[]),d=(0,n.useMemo)(()=>l.getPoints(100),[l]),u=eC[eC.length-1];return(0,i.jsxs)("group",{position:(0,eo.districtPosition)(e),visible:s,children:[(0,i.jsx)(G,{points:d,color:eu,lineWidth:2.6,transparent:!0,opacity:.8,toneMapped:!1}),(0,i.jsx)(n.Suspense,{fallback:null,children:(0,i.jsx)(ew,{route:l,reduced:r,i:e,progress:t,awake:s})}),(0,i.jsxs)("group",{position:[eL[0],0,eL[1]],children:[(0,i.jsxs)("mesh",{position:[0,.02,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.62,.74,36]}),(0,i.jsx)("meshBasicMaterial",{color:eu,transparent:!0,opacity:.5,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,.13,0],children:[(0,i.jsx)("cylinderGeometry",{args:[.5,.58,.26,6]}),(0,i.jsx)("meshStandardMaterial",{color:"#0f2036",emissive:eu,emissiveIntensity:.15,metalness:.4,roughness:.45})]}),(0,i.jsx)(ex,{position:[0,.52,0],color:eu,size:.14})]}),eC.map(([e,t],r)=>{let n=r===eC.length-1;return(0,i.jsxs)("group",{position:[e,0,t],children:[(0,i.jsxs)("mesh",{position:[0,.02,0],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[.16,.23,20]}),(0,i.jsx)("meshBasicMaterial",{color:eu,transparent:!0,opacity:.55,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,.3,0],children:[(0,i.jsx)("cylinderGeometry",{args:[.03,.03,.6,8]}),(0,i.jsx)("meshStandardMaterial",{color:eu,emissive:eu,emissiveIntensity:.4})]}),(0,i.jsx)(ex,{position:[0,.66,0],color:eu,size:n?.16:.12})]},r)}),s&&(0,i.jsx)(eT,{pos:[u[0],.02,u[1]],i:e,progress:t}),a&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[eL[0],1.05,eL[1]],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag",style:{"--tc":eu},ref:o,children:"🏢 Dispatch Hub"})}),eC.map(([e,t],r)=>{let n=eF[r];return n?(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[e,1.06,t],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsx)("div",{className:"dm-st3d-tag",style:{"--tc":eu},ref:o,children:n})},r):null}),(0,i.jsx)(ek,{pos:[u[0],1.42,u[1]],i:e,progress:t}),eB.map(e=>(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:e.p,zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-tag",style:{"--tc":eu},ref:o,children:["✓ ",e.t]})},e.t)),(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,3.2,-.4],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-score",style:{"--tc":eu},ref:o,children:["🗺️ Route optimized · ",(0,i.jsx)("b",{children:"−18%"})," distance"]})})]})]})}),eO=[{n:"Fulfillment",v:88,a:-.66},{n:"SLA Compliance",v:95,a:-.22},{n:"Efficiency",v:92,a:.22},{n:"Battery",v:100,a:.66}],eN=n.default.memo(function({i:e,progress:t,awake:r,focused:s}){let a=ev(e,t,r),o=(0,n.useMemo)(()=>eO.map(e=>{let t=[3.6*Math.sin(e.a),1.5,-1.4+(1-Math.cos(e.a))*3.6];return{...e,p:t,rotY:-e.a}}),[]);return(0,i.jsxs)("group",{position:(0,eo.districtPosition)(e),visible:r,children:[(0,i.jsxs)("mesh",{position:[0,.45,1.4],rotation:[-.12,0,0],children:[(0,i.jsx)("boxGeometry",{args:[5.6,.18,1.5]}),(0,i.jsx)("meshStandardMaterial",{color:"#dfe4f1",metalness:.4,roughness:.4})]}),(0,i.jsxs)("mesh",{position:[0,.12,.9],children:[(0,i.jsx)("boxGeometry",{args:[5.2,.24,.6]}),(0,i.jsx)("meshStandardMaterial",{color:"#cdd5e6",metalness:.3,roughness:.5})]}),o.map(e=>(0,i.jsxs)("group",{position:e.p,rotation:[0,e.rotY,0],children:[(0,i.jsx)(u,{args:[1.7,1.15,.06],radius:.06,smoothness:2,children:(0,i.jsx)("meshStandardMaterial",{color:"#ffffff",emissive:ef,emissiveIntensity:.18,metalness:.1,roughness:.4,transparent:!0,opacity:.92})}),s&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:8,position:[0,0,.05],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-kpi",style:{"--tc":ef},ref:a,children:[(0,i.jsx)("span",{className:"dm-st3d-kpi__n",children:e.n}),(0,i.jsxs)("span",{className:"dm-st3d-kpi__v",children:[e.v,(0,i.jsx)("i",{children:"%"})]}),(0,i.jsx)("span",{className:"dm-st3d-kpi__bar",children:(0,i.jsx)("i",{style:{width:`${e.v}%`}})})]})})]},e.n)),s&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,3.1,-.4],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-score",style:{"--tc":ef},ref:a,children:["Performance Grade ",(0,i.jsx)("b",{children:"A"})," · 4.5 / 5"]})})]})}),eV=[{n:"EV Aware",v:88,x:-2.4,win:!0},{n:"Multi Trip",v:79,x:-.8,win:!1},{n:"Balanced",v:71,x:.8,win:!1},{n:"Proximity",v:64,x:2.4,win:!1}];function eH({p:e,register:t,focused:r}){let n=.6+e.v/100*2.2,s=e.win?em:"#94a3b8";return(0,i.jsxs)("group",{position:[e.x,0,-.6],children:[(0,i.jsxs)("mesh",{position:[0,n/2+.1,0],children:[(0,i.jsx)("boxGeometry",{args:[1,n,1]}),(0,i.jsx)("meshStandardMaterial",{color:s,emissive:s,emissiveIntensity:e.win?.7:.15,metalness:.2,roughness:.4,transparent:!0,opacity:e.win?.96:.7,toneMapped:!1})]}),r&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[0,n+.45,0],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:`dm-st3d-tag ${e.win?"is-win":"is-muted"}`,style:{"--tc":s},ref:t,children:[(0,i.jsxs)("b",{children:[e.v,"%"]})," ",e.n]})})]})}let eW=n.default.memo(function({i:e,progress:t,reduced:r,isMobile:s,awake:o,focused:l}){let d=ev(e,t,o),u=(0,n.useRef)(null);return(0,a.useFrame)(e=>{u.current&&!r&&o&&(u.current.position.y=.6+.88*2.2+.95+.08*Math.sin(1.4*e.clock.elapsedTime),u.current.rotation.y+=.01)}),(0,i.jsxs)("group",{position:(0,eo.districtPosition)(e),visible:o,children:[(0,i.jsxs)("mesh",{position:[0,.05,-.6],children:[(0,i.jsx)("cylinderGeometry",{args:[4.3,4.5,.12,48]}),(0,i.jsx)("meshStandardMaterial",{color:"#1d1622",metalness:.5,roughness:.42,emissive:em,emissiveIntensity:.06})]}),(0,i.jsxs)("mesh",{position:[0,.12,-.6],rotation:[-Math.PI/2,0,0],children:[(0,i.jsx)("ringGeometry",{args:[4.1,4.32,56]}),(0,i.jsx)("meshBasicMaterial",{color:em,transparent:!0,opacity:.35,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[-2.4,.14,-.6],children:[(0,i.jsx)("cylinderGeometry",{args:[.85,.9,.14,28]}),(0,i.jsx)("meshStandardMaterial",{color:em,emissive:em,emissiveIntensity:.9,toneMapped:!1})]}),eV.map(e=>(0,i.jsx)(eH,{p:e,register:d,focused:l},e.n)),(0,i.jsxs)("mesh",{position:[-2.4,3,-.6],children:[(0,i.jsx)("coneGeometry",{args:[1,2.6,28,1,!0]}),(0,i.jsx)("meshBasicMaterial",{color:em,transparent:!0,opacity:.07,side:c.DoubleSide,toneMapped:!1})]}),(0,i.jsxs)("group",{ref:u,position:[-2.4,3.5,-.6],children:[(0,i.jsxs)("mesh",{position:[0,.18,0],children:[(0,i.jsx)("sphereGeometry",{args:[.26,24,12,0,2*Math.PI,0,Math.PI/1.7]}),(0,i.jsx)("meshStandardMaterial",{color:"#FFD45A",emissive:"#FFB020",emissiveIntensity:1.2,metalness:.6,roughness:.25,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,-.06,0],children:[(0,i.jsx)("cylinderGeometry",{args:[.05,.05,.24,10]}),(0,i.jsx)("meshStandardMaterial",{color:"#FFD45A",emissive:"#FFB020",emissiveIntensity:1,toneMapped:!1})]}),(0,i.jsxs)("mesh",{position:[0,-.22,0],children:[(0,i.jsx)("cylinderGeometry",{args:[.18,.22,.1,16]}),(0,i.jsx)("meshStandardMaterial",{color:"#FFD45A",emissive:"#FFB020",emissiveIntensity:1,toneMapped:!1})]})]}),o&&!r&&(0,i.jsx)(K,{count:s?12:16,scale:[5,4,4],position:[-2.4,2.6,-.6],size:3.2,speed:.5,opacity:.9,color:"#ff9aa9"}),l&&(0,i.jsx)(Z.Html,{center:!0,distanceFactor:9,position:[.7,3,-.6],zIndexRange:[20,0],pointerEvents:"none",children:(0,i.jsxs)("div",{className:"dm-st3d-winner3d",ref:d,children:[(0,i.jsx)("span",{className:"dm-st3d-winner3d__top",children:"🏆 Best Strategy"}),(0,i.jsx)("span",{className:"dm-st3d-winner3d__name",children:"EV Aware"}),(0,i.jsxs)("span",{className:"dm-st3d-winner3d__row",children:[(0,i.jsx)("b",{children:"88%"})," Performance Score"]}),(0,i.jsxs)("span",{className:"dm-st3d-winner3d__row",children:[(0,i.jsx)("b",{children:"52/59"})," Orders Fulfilled"]})]})})]})});function e$(){let e=(0,n.useMemo)(()=>{let e=[];for(let t=0;t<eo.N;t++){let[r,,i]=(0,eo.districtPosition)(t);e.push(new c.Vector3(r,.07,i))}return new c.CatmullRomCurve3(e,!1,"catmullrom",.3)},[]),t=(0,n.useMemo)(()=>e.getPoints(110),[e]);return(0,i.jsxs)("group",{children:[(0,i.jsx)(G,{points:t,color:"#9aa6c4",lineWidth:2,transparent:!0,opacity:.5,toneMapped:!1}),[0,.33,.66].map(t=>(0,i.jsx)(eg,{curve:e,color:"#c7cee0",speed:.06,offset:t,size:.09},t))]})}function eq(){let e=-(13*(eo.N-1))/2,t=(0,n.useMemo)(()=>{let e=new c.CanvasTexture(function(){let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d");t.fillStyle="#e7ebf3",t.fillRect(0,0,256,256),t.strokeStyle="#d3dae8",t.lineWidth=1.5;for(let e=0;e<=8;e++){let r=e/8*256+.5;t.beginPath(),t.moveTo(r,0),t.lineTo(r,256),t.stroke(),t.beginPath(),t.moveTo(0,r),t.lineTo(256,r),t.stroke()}return t.strokeStyle="#c0cadd",t.lineWidth=3,t.strokeRect(0,0,256,256),e}());return e.wrapS=e.wrapT=c.RepeatWrapping,e.repeat.set(52,52),e.colorSpace=c.SRGBColorSpace,e.anisotropy=4,e},[]);return(0,i.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.02,e],children:[(0,i.jsx)("planeGeometry",{args:[120,(eo.N+3)*13]}),(0,i.jsx)("meshStandardMaterial",{map:t,color:"#ffffff",metalness:.05,roughness:.92})]})}function eY({progress:e,reduced:t,isMobile:r,stage:s,active:a,perf:o}){let l=e=>1>=Math.abs(e-s),[c,d]=(0,n.useState)(!1);(0,n.useEffect)(()=>{a&&d(!0)},[a]);let u=c&&!t&&!r;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("color",{attach:"background",args:[el]}),(0,i.jsx)("fog",{attach:"fog",args:[el,12,40]}),(0,i.jsx)("ambientLight",{intensity:.55}),(0,i.jsx)("hemisphereLight",{args:["#ffffff","#dfe4ee",.5]}),(0,i.jsx)("directionalLight",{position:[6,12,8],intensity:.7}),(0,i.jsx)("directionalLight",{position:[-7,5,4],intensity:.22,color:"#cdd6ff"}),(0,i.jsxs)(et.Environment,{resolution:64,frames:1,children:[(0,i.jsx)(ei,{intensity:.5,position:[0,6,-3],scale:[12,6,1]}),(0,i.jsx)(ei,{intensity:.3,position:[-6,3,4],scale:[6,6,1],color:"#dfe6ff"}),(0,i.jsx)(ei,{intensity:.3,position:[6,2,2],scale:[5,5,1],color:"#ffffff"})]}),(0,i.jsx)(eh,{progress:e,reduced:t,isMobile:r}),(0,i.jsx)(eq,{}),(0,i.jsx)(e$,{}),(0,i.jsx)(eP,{i:0,progress:e,reduced:t,awake:l(0),focused:0===s}),(0,i.jsx)(eR,{i:1,progress:e,reduced:t,awake:l(1),focused:1===s}),(0,i.jsx)(eG,{i:2,progress:e,reduced:t,awake:l(2),focused:2===s}),(0,i.jsx)(eN,{i:3,progress:e,awake:l(3),focused:3===s}),(0,i.jsx)(eW,{i:4,progress:e,reduced:t,isMobile:r,awake:l(4),focused:4===s}),u&&(0,i.jsx)(K,{count:16,scale:[18,7,13*eo.N],position:[0,3,-(13*(eo.N-1))/2],size:2,speed:.22,opacity:.35,color:"#9aa6c4"}),u&&(0,i.jsx)(es.EffectComposer,{multisampling:0,children:(0,i.jsx)(es.Bloom,{mipmapBlur:!0,intensity:.7,luminanceThreshold:.74,luminanceSmoothing:.06,radius:.68,kernelSize:ea.KernelSize.SMALL})}),(0,i.jsx)(en,{all:!0}),o&&(0,i.jsx)(ep,{})]})}e.s(["default",0,function({progress:e,reduced:t=!1,isMobile:r=!1,active:n=!0,stage:a=0}){let o=new URLSearchParams(window.location.search).has("perf");return(0,i.jsx)(s.Canvas,{dpr:[1,r?1:1.25],camera:{position:[0,4,8.2],fov:50,near:.1,far:120},gl:{antialias:!1,powerPreference:"high-performance",alpha:!1},frameloop:n?"always":"never",children:(0,i.jsx)(eY,{progress:e,reduced:t,isMobile:r,stage:a,active:n,perf:o})})}],1517)},20927,e=>{e.n(e.i(1517))}]); |