agentglow 0.1.0 → 0.2.1

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.
Files changed (41) hide show
  1. package/README.md +38 -3
  2. package/dist/chunks/KitScene-C3SZiKL5.js +2793 -0
  3. package/dist/chunks/index--dwzdFRh.js +753 -0
  4. package/dist/chunks/index-B2PGx_wt.js +1010 -0
  5. package/dist/chunks/index-BZOG_CQS.js +838 -0
  6. package/dist/chunks/index-BfGluv59.js +784 -0
  7. package/dist/chunks/index-Bm4te7Ug.js +980 -0
  8. package/dist/chunks/index-Bqv_wy49.js +889 -0
  9. package/dist/chunks/index-Bsmr7FwH.js +763 -0
  10. package/dist/chunks/index-Bw31uayO.js +792 -0
  11. package/dist/chunks/index-C4F16M9q.js +887 -0
  12. package/dist/chunks/index-CRRHsMqy.js +68 -0
  13. package/dist/chunks/index-CS8eZTr_.js +818 -0
  14. package/dist/chunks/index-CdzGoWrn.js +1086 -0
  15. package/dist/chunks/index-CvDEulcq.js +492 -0
  16. package/dist/chunks/index-DXBfdHew.js +1143 -0
  17. package/dist/chunks/index-DdCs_ye9.js +605 -0
  18. package/dist/chunks/index-_KrED-np.js +677 -0
  19. package/dist/index.js +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/types/AgentScene.d.ts +14 -1
  22. package/dist/types/world.d.ts +69 -0
  23. package/package.json +1 -1
  24. package/dist/chunks/ClusterBall-CPsd6JvJ.js +0 -1489
  25. package/dist/chunks/index-0Bqa57T_.js +0 -786
  26. package/dist/chunks/index-4JCQqMml.js +0 -831
  27. package/dist/chunks/index-55W5crSg.js +0 -63
  28. package/dist/chunks/index-78lWZCrQ.js +0 -984
  29. package/dist/chunks/index-Bv6_kdaq.js +0 -768
  30. package/dist/chunks/index-Cgb5ir1r.js +0 -688
  31. package/dist/chunks/index-CqVCWpP7.js +0 -796
  32. package/dist/chunks/index-D1O5v601.js +0 -1065
  33. package/dist/chunks/index-DOoA9htC.js +0 -1181
  34. package/dist/chunks/index-K__sPGRy.js +0 -1134
  35. package/dist/chunks/index-N0zWN8NS.js +0 -857
  36. package/dist/chunks/index-NiYqQci9.js +0 -936
  37. package/dist/chunks/index-PQRnbPiJ.js +0 -565
  38. package/dist/chunks/index-VOXn1m-Q.js +0 -848
  39. package/dist/chunks/index-o4vs5msj.js +0 -837
  40. package/dist/chunks/index-yos7IepY.js +0 -890
  41. package/dist/chunks/spread-CWdeDFd9.js +0 -35
@@ -0,0 +1,1010 @@
1
+ var Ht = Object.defineProperty;
2
+ var Xt = (e, t, o) => t in e ? Ht(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var O = (e, t, o) => Xt(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { jsxs as R, Fragment as ye, jsx as s } from "react/jsx-runtime";
5
+ import { useFrame as H, useThree as Yt } from "@react-three/fiber";
6
+ import { EffectComposer as Zt, Bloom as $t, Vignette as Jt } from "@react-three/postprocessing";
7
+ import { useRef as z, useMemo as A, useEffect as pe } from "react";
8
+ import * as n from "three";
9
+ import { a as je, h as Qt, k as ie, x as Xe, c as eo, f as Ke, r as N, T as ke, w as V, L as ve, d as to, F as oo, q as Ye, S as Se, R as no, u as Gt, o as so, s as ao, K as ro, m as io, G as lo, n as co, j as po, B as uo } from "./KitScene-C3SZiKL5.js";
10
+ const Ct = 1.6, Rt = 1.1;
11
+ function _t(e, t) {
12
+ const o = Ke.spread;
13
+ return t.u0 = e.cu - e.hu - Ct * o, t.u1 = e.cu + e.hu + Ct * o, t.v0 = e.cv - e.hv - Rt * o, t.v1 = e.cv + e.hv + Rt * o, t;
14
+ }
15
+ const Ze = { plan: "planner", research: "researcher", write: "writer" };
16
+ function mo(e) {
17
+ const t = Xe(Ze.plan), o = Xe(Ze.research), r = Xe(Ze.write);
18
+ return e.b1 = (t + o) / 2, e.b2 = o + (r - o) * 0.8, e;
19
+ }
20
+ function Pt(e, t, o) {
21
+ return e === "plan" ? (t.u0 + o.b1) / 2 : e === "research" ? (o.b1 + o.b2) / 2 : (o.b2 + t.u1) / 2;
22
+ }
23
+ const ho = 1.55, it = /* @__PURE__ */ new Map();
24
+ function he(e, t) {
25
+ const o = je(e);
26
+ if (o)
27
+ return t.set(o.x, it.get(e) ?? 0.5, o.z);
28
+ }
29
+ function $e(e, t) {
30
+ const o = ie.mcp.get(e);
31
+ if (o)
32
+ return t.set(o.pos.x - o.out.x * 1.9, 1.3, o.pos.z);
33
+ }
34
+ function fo(e, t) {
35
+ const o = eo(e);
36
+ if (o)
37
+ return t.set(o.x, 0.75, o.z);
38
+ }
39
+ const te = 16, Be = 12, Y = 1, Re = 0.92, Pe = 0.42, Ae = -15 / 2, re = 0, X = te * Be, go = Pe + Be * Re + 0.1, Ft = te * Y / 2 + 0.6;
40
+ function Ue(e, t) {
41
+ const o = e % te, r = Math.floor(e / te) % Be;
42
+ return t.set(Ae + o * Y, Pe + r * Re + 0.26, re + 0.05);
43
+ }
44
+ const U = (e) => e < 0 ? 0 : e > 1 ? 1 : e, Ve = (e) => 1 - Math.pow(1 - U(e), 3), yo = (e) => Math.pow(U(e), 2.2), de = (e) => {
45
+ const t = U(e);
46
+ return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
47
+ };
48
+ function fe(e, t, o, r, a) {
49
+ const l = 1 - r;
50
+ return a.set(l * l * e.x + 2 * l * r * t.x + r * r * o.x, l * l * e.y + 2 * l * r * t.y + r * r * o.y, l * l * e.z + 2 * l * r * t.z + r * r * o.z);
51
+ }
52
+ function ze(e, t, o, r) {
53
+ return r.addVectors(e, t).multiplyScalar(0.5), r.y = Math.max(e.y, t.y) + o + e.distanceTo(t) * 0.18, r;
54
+ }
55
+ const zt = /* @__PURE__ */ new Map();
56
+ function Z(e) {
57
+ let t = zt.get(e);
58
+ return t || zt.set(e, t = new n.Color(e)), t;
59
+ }
60
+ const E = new n.Color("#ffab1a");
61
+ new n.Color("#ff6a13");
62
+ const ee = new n.Color("#ffd23f"), Ce = new n.Color("#ff2d2d"), Te = new n.Color("#ffffff");
63
+ new n.Color("#3b3440");
64
+ const vo = (e) => Qt(e, 99);
65
+ function lt(e, t, o, r = !1) {
66
+ const a = document.createElement("canvas");
67
+ a.width = e, a.height = t, o(a.getContext("2d"));
68
+ const l = new n.CanvasTexture(a);
69
+ return l.colorSpace = n.SRGBColorSpace, l.anisotropy = 4, r && (l.wrapS = l.wrapT = n.RepeatWrapping), l;
70
+ }
71
+ let Me = null;
72
+ function wo() {
73
+ return Me || (Me = lt(128, 128, (e) => {
74
+ const t = e.createRadialGradient(64, 64, 0, 64, 64, 64);
75
+ t.addColorStop(0, "rgba(255,255,255,1)"), t.addColorStop(0.18, "rgba(255,255,255,0.55)"), t.addColorStop(0.5, "rgba(255,255,255,0.12)"), t.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = t, e.fillRect(0, 0, 128, 128);
76
+ }), Me.colorSpace = n.NoColorSpace, Me);
77
+ }
78
+ let Ge = null;
79
+ function It() {
80
+ return Ge || (Ge = lt(
81
+ 128,
82
+ 32,
83
+ (e) => {
84
+ e.fillStyle = "#120d06", e.fillRect(0, 0, 128, 32), e.fillStyle = "#ffb81c";
85
+ for (let t = -32; t < 160; t += 32)
86
+ e.beginPath(), e.moveTo(t, 32), e.lineTo(t + 16, 32), e.lineTo(t + 32, 0), e.lineTo(t + 16, 0), e.closePath(), e.fill();
87
+ },
88
+ !0
89
+ ), Ge);
90
+ }
91
+ let _e = null;
92
+ function Wt() {
93
+ return _e || (_e = lt(64, 64, (e) => {
94
+ e.fillStyle = "#5a5a5a", e.fillRect(0, 0, 64, 64), e.strokeStyle = "#ffffff", e.lineWidth = 7, e.strokeRect(3.5, 3.5, 57, 57), e.lineWidth = 4, e.beginPath(), e.moveTo(6, 6), e.lineTo(58, 58), e.stroke(), e.fillStyle = "#8a8a8a", e.fillRect(6, 30, 52, 4);
95
+ }), _e);
96
+ }
97
+ function ce(e = "#fff") {
98
+ return new n.SpriteMaterial({ map: wo(), color: e, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 });
99
+ }
100
+ function We(e = "#fff", t = n.FrontSide) {
101
+ return new n.MeshBasicMaterial({ color: e, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1, side: t });
102
+ }
103
+ function le(e = "#fff") {
104
+ return new n.MeshBasicMaterial({ color: e, toneMapped: !1 });
105
+ }
106
+ const S = new n.BoxGeometry(1, 1, 1), B = new n.CylinderGeometry(1, 1, 1, 24);
107
+ new n.CylinderGeometry(1, 1, 1, 12);
108
+ const Lt = new n.RingGeometry(0.86, 1, 64).rotateX(-Math.PI / 2);
109
+ new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
110
+ const Dt = new n.ConeGeometry(1, 1, 12).translate(0, 0.5, 0), bo = new n.EdgesGeometry(S), q = N ? 220 : 900, d = {
111
+ n: q,
112
+ head: 0,
113
+ px: new Float32Array(q),
114
+ py: new Float32Array(q),
115
+ pz: new Float32Array(q),
116
+ vx: new Float32Array(q),
117
+ vy: new Float32Array(q),
118
+ vz: new Float32Array(q),
119
+ life: new Float32Array(q),
120
+ // seconds left (<=0 = dead)
121
+ max: new Float32Array(q),
122
+ r: new Float32Array(q),
123
+ g: new Float32Array(q),
124
+ b: new Float32Array(q)
125
+ };
126
+ function Je(e, t, o, r = 4, a = 1.6, l = 1) {
127
+ const u = N ? Math.ceil(t / 4) : t;
128
+ for (let i = 0; i < u; i++) {
129
+ const c = d.head;
130
+ d.head = (d.head + 1) % d.n;
131
+ const p = Math.random() * Math.PI * 2, v = a * (0.3 + Math.random() * 0.7);
132
+ d.px[c] = e.x, d.py[c] = e.y, d.pz[c] = e.z, d.vx[c] = Math.cos(p) * v, d.vz[c] = Math.sin(p) * v, d.vy[c] = l * r * (0.55 + Math.random() * 0.6);
133
+ const h = 0.45 + Math.random() * 0.75;
134
+ d.life[c] = h, d.max[c] = h;
135
+ const y = Math.random() * 0.5;
136
+ d.r[c] = o.r + (1 - o.r) * y, d.g[c] = o.g + (1 - o.g) * y, d.b[c] = o.b + (1 - o.b) * y;
137
+ }
138
+ }
139
+ class Mo {
140
+ constructor() {
141
+ O(this, "mesh");
142
+ O(this, "o", new n.Object3D());
143
+ O(this, "v", new n.Vector3());
144
+ O(this, "c", new n.Color());
145
+ const t = new n.BoxGeometry(0.035, 0.035, 1).translate(0, 0, -0.5), o = new n.MeshBasicMaterial({ transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 });
146
+ this.mesh = new n.InstancedMesh(t, o, d.n), this.mesh.frustumCulled = !1, this.mesh.count = 0, this.mesh.instanceMatrix.setUsage(n.DynamicDrawUsage), this.mesh.setColorAt(0, new n.Color());
147
+ }
148
+ update(t) {
149
+ const o = Math.min(t, 0.05);
150
+ let r = 0;
151
+ const a = this.o;
152
+ for (let l = 0; l < d.n; l++) {
153
+ if (d.life[l] <= 0 || (d.life[l] -= o, d.vy[l] -= 9.5 * o, d.px[l] += d.vx[l] * o, d.py[l] += d.vy[l] * o, d.pz[l] += d.vz[l] * o, d.py[l] < 0.02 && (d.py[l] = 0.02, d.vy[l] *= -0.32, d.vx[l] *= 0.6, d.vz[l] *= 0.6), d.life[l] <= 0)) continue;
154
+ const u = d.life[l] / d.max[l];
155
+ a.position.set(d.px[l], d.py[l], d.pz[l]), this.v.set(d.px[l] + d.vx[l], d.py[l] + d.vy[l], d.pz[l] + d.vz[l]), a.lookAt(this.v);
156
+ const i = Math.hypot(d.vx[l], d.vy[l], d.vz[l]);
157
+ a.scale.set(1, 1, Math.min(0.5, 0.03 + i * 0.045)), a.updateMatrix(), this.mesh.setMatrixAt(r, a.matrix);
158
+ const c = u * u * 2.2;
159
+ this.c.setRGB(d.r[l] * c, d.g[l] * c, d.b[l] * c), this.mesh.setColorAt(r, this.c), r++;
160
+ }
161
+ this.mesh.count = r, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
162
+ }
163
+ }
164
+ class qe {
165
+ constructor(t, o = 24) {
166
+ O(this, "seg");
167
+ O(this, "max");
168
+ O(this, "geo", new n.BufferGeometry());
169
+ O(this, "lines");
170
+ O(this, "n", 0);
171
+ O(this, "p", new n.Vector3());
172
+ O(this, "c", new n.Color());
173
+ this.max = t, this.seg = o, this.geo.setAttribute("position", new n.BufferAttribute(new Float32Array(t * o * 2 * 3), 3).setUsage(n.DynamicDrawUsage)), this.geo.setAttribute("color", new n.BufferAttribute(new Float32Array(t * o * 2 * 3), 3).setUsage(n.DynamicDrawUsage)), this.geo.boundingSphere = new n.Sphere(new n.Vector3(), 1e4), this.lines = new n.LineSegments(this.geo, new n.LineBasicMaterial({ vertexColors: !0, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending, toneMapped: !1 })), this.lines.frustumCulled = !1;
174
+ }
175
+ begin() {
176
+ this.n = 0;
177
+ }
178
+ /** head in 0..1 = bright travelling pulse position (−1 = none); dash > 0 = marching dashes in the travel direction. */
179
+ add(t, o, r, a, l, u = -1, i = 0, c = 0) {
180
+ if (this.n >= this.max || l <= 2e-3) return;
181
+ const p = this.geo.getAttribute("position"), v = this.geo.getAttribute("color"), h = this.n * this.seg * 2;
182
+ for (let y = 0; y < this.seg; y++)
183
+ for (let P = 0; P < 2; P++) {
184
+ const w = (y + P) / this.seg, f = 1 - w;
185
+ this.p.set(f * f * t.x + 2 * f * w * o.x + w * w * r.x, f * f * t.y + 2 * f * w * o.y + w * w * r.y, f * f * t.z + 2 * f * w * o.z + w * w * r.z);
186
+ const b = h + y * 2 + P;
187
+ p.setXYZ(b, this.p.x, this.p.y, this.p.z);
188
+ let C = 0.35;
189
+ i > 0 && (C += 0.55 * Math.max(0, Math.sin((w * i - c) * Math.PI * 2)) ** 3), u >= 0 && (C += 1.6 * Math.exp(-(((w - u) / 0.07) ** 2))), this.c.copy(a).multiplyScalar(l * C), v.setXYZ(b, this.c.r, this.c.g, this.c.b);
190
+ }
191
+ this.n++;
192
+ }
193
+ end() {
194
+ this.geo.setDrawRange(0, this.n * this.seg * 2), this.geo.getAttribute("position").needsUpdate = !0, this.geo.getAttribute("color").needsUpdate = !0;
195
+ }
196
+ }
197
+ const Le = class Le {
198
+ constructor(t, o, r) {
199
+ O(this, "mesh");
200
+ O(this, "n", 0);
201
+ O(this, "o", new n.Object3D());
202
+ O(this, "c", new n.Color());
203
+ O(this, "d", new n.Vector3());
204
+ this.mesh = new n.InstancedMesh(t, o, r), this.mesh.frustumCulled = !1, this.mesh.count = 0, this.mesh.instanceMatrix.setUsage(n.DynamicDrawUsage), this.mesh.setColorAt(0, new n.Color());
205
+ }
206
+ begin() {
207
+ this.n = 0;
208
+ }
209
+ /** Place at p, oriented so local +y points along dir (or yaw-only when dir is null), scaled (sx, sy, sz). */
210
+ add(t, o, r, a, l, u, i, c = 0) {
211
+ if (this.n >= this.mesh.instanceMatrix.count || i <= 2e-3) return;
212
+ const p = this.o;
213
+ p.position.copy(t), o ? p.quaternion.setFromUnitVectors(Le.UP, this.d.copy(o).normalize()) : p.quaternion.setFromAxisAngle(Le.UP, c), p.scale.set(r, a, l), p.updateMatrix(), this.mesh.setMatrixAt(this.n, p.matrix), this.mesh.setColorAt(this.n, this.c.copy(u).multiplyScalar(i)), this.n++;
214
+ }
215
+ end() {
216
+ this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
217
+ }
218
+ };
219
+ O(Le, "UP", new n.Vector3(0, 1, 0));
220
+ let ge = Le;
221
+ const De = 0.3, xo = (
222
+ /* glsl */
223
+ `
224
+ varying vec2 vUv;
225
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
226
+ ), So = (
227
+ /* glsl */
228
+ `
229
+ varying vec2 vUv;
230
+ uniform float uLen, uTime, uGrow, uOp, uFlow;
231
+ uniform vec3 uCol, uHot;
232
+ void main() {
233
+ float u = vUv.x * uLen; // metres along the belt (0 = parent)
234
+ if (vUv.x > uGrow) discard;
235
+ float v = vUv.y - 0.5; // -0.5..0.5 across
236
+ float rail = smoothstep(0.36, 0.42, abs(v));
237
+ // chevrons pointing toward the child, scrolling with the flow
238
+ float ch = fract((u - uTime * 1.4 * uFlow) / 0.62 - abs(v) * 1.1);
239
+ float chev = smoothstep(0.0, 0.08, ch) * (1.0 - smoothstep(0.16, 0.26, ch)) * (1.0 - rail);
240
+ float roll = 0.5 + 0.5 * sin(u * 18.0);
241
+ vec3 c = vec3(0.035, 0.028, 0.025) * (0.7 + 0.3 * roll);
242
+ c += uCol * chev * 0.55;
243
+ c += uHot * rail * 0.75;
244
+ // growing tip glows while the belt is being laid
245
+ c += uHot * exp(-pow((vUv.x - uGrow) * uLen / 0.35, 2.0)) * step(uGrow, 0.999) * 1.5;
246
+ gl_FragColor = vec4(c * uOp, 1.0);
247
+ #include <colorspace_fragment>
248
+ }`
249
+ ), Ao = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2);
250
+ function Co({ child: e }) {
251
+ const t = e.inst, o = z(null), r = z(null), a = A(
252
+ () => new n.ShaderMaterial({
253
+ vertexShader: xo,
254
+ fragmentShader: So,
255
+ uniforms: {
256
+ uLen: { value: 1 },
257
+ uTime: { value: 0 },
258
+ uGrow: { value: 0 },
259
+ uOp: { value: 1 },
260
+ uFlow: { value: 1 },
261
+ uCol: { value: Z(ke[t.type]).clone().lerp(E, 0.45) },
262
+ uHot: { value: E.clone() }
263
+ },
264
+ polygonOffset: !0,
265
+ polygonOffsetFactor: -1
266
+ }),
267
+ [t.type]
268
+ ), l = A(() => new n.MeshStandardMaterial({ color: "#15110f", metalness: 0.5, roughness: 0.5, transparent: !0 }), []);
269
+ pe(
270
+ () => () => {
271
+ a.dispose(), l.dispose();
272
+ },
273
+ [a, l]
274
+ );
275
+ const u = A(() => ({ k: 0, a: new n.Vector3(), b: new n.Vector3() }), []);
276
+ return H((i, c) => {
277
+ const p = t.parent ? V.instances.get(t.parent) ?? V.archive.get(t.parent) : void 0, v = t.parent ? je(t.parent) : void 0;
278
+ if (!o.current || !r.current) return;
279
+ if (!p || !v) {
280
+ o.current.visible = r.current.visible = !1;
281
+ return;
282
+ }
283
+ const h = performance.now();
284
+ u.a.copy(v), u.b.copy(e.live);
285
+ const y = u.b.x - u.a.x, P = u.b.z - u.a.z, w = Math.hypot(y, P), f = Math.atan2(-P, y), b = Ve((h - t.bornAt) / 650), C = t.exitAt ? (h - t.exitAt) / 1e3 : -1, T = C >= 0 ? de((C - 0.6) / 1.4) : 0, L = !p.exitAt;
286
+ u.k += ((L && C < 0 ? 1 : 0) - u.k) * 0.04;
287
+ const x = Math.max(C >= 0 ? 1 - T : 0, u.k), M = C < 0 && (t.status === "thinking" || t.status === "spawning");
288
+ o.current.position.set((u.a.x + u.b.x) / 2, 0, (u.a.z + u.b.z) / 2), o.current.rotation.y = f, r.current.rotation.y = f, o.current.position.y = De;
289
+ const g = Math.max(0.5, Ke.scale * 0.62);
290
+ o.current.scale.set(w, 1, g);
291
+ const m = a.uniforms;
292
+ m.uLen.value = w, m.uGrow.value = b * (1 - T), m.uOp.value = x, m.uFlow.value = N ? 0 : 1, m.uTime.value += (M ? 1 : 0.25) * Math.min(c, 0.05), m.uHot.value.copy(E).multiplyScalar(0.6 + (M ? 0.4 : 0));
293
+ const F = Math.max(1e-3, b * (1 - T));
294
+ r.current.scale.set(w * F, De - 0.02, g * 1.13), r.current.position.x = u.a.x + y * F / 2, r.current.position.z = u.a.z + P * F / 2, r.current.position.y = (De - 0.02) / 2, l.opacity = x, o.current.visible = r.current.visible = x > 0.01 && F > 2e-3;
295
+ }), /* @__PURE__ */ R(ye, { children: [
296
+ /* @__PURE__ */ s("mesh", { ref: r, geometry: S, material: l }),
297
+ /* @__PURE__ */ s("mesh", { ref: o, geometry: Ao, material: a })
298
+ ] });
299
+ }
300
+ function Ro() {
301
+ const e = A(() => {
302
+ const r = new n.MeshBasicMaterial({ map: Wt(), toneMapped: !1 });
303
+ return new ge(S, r, 64);
304
+ }, []), t = A(() => new qe(32, 28), []), o = A(() => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), p: new n.Vector3(), d: new n.Vector3(), col: new n.Color() }), []);
305
+ return H(() => {
306
+ const r = performance.now();
307
+ e.begin(), t.begin();
308
+ for (const a of V.comets) {
309
+ const l = V.instances.get(a.from) ?? V.archive.get(a.from), u = V.instances.get(a.to) ?? V.archive.get(a.to);
310
+ if (!l || !u) continue;
311
+ const i = je(a.from), c = je(a.to);
312
+ if (!i || !c) continue;
313
+ const p = U((r - a.start) / a.dur);
314
+ if (p >= 1) continue;
315
+ if (o.col.copy(Z(ke[l.type])), u.parent === l.id) {
316
+ o.a.copy(i), o.b.copy(c), o.p.lerpVectors(o.a, o.b, 0.12 + 0.76 * de(p)), o.p.y = De + 0.21;
317
+ const h = Math.atan2(-(o.b.z - o.a.z), o.b.x - o.a.x);
318
+ e.add(o.p, null, 0.42, 0.42, 0.42, o.col, 1.5, h);
319
+ } else {
320
+ if (!he(a.from, o.a) || !he(a.to, o.b)) continue;
321
+ ze(o.a, o.b, 2.2, o.c);
322
+ const h = de(p);
323
+ fe(o.a, o.c, o.b, h, o.p), o.p.y -= 0.35, e.add(o.p, null, 0.4, 0.4, 0.4, o.col, 1.5, h * 2), t.add(o.a, o.c, o.b, o.col, Math.sin(Math.PI * p) * 0.9, h, 7, r / 400);
324
+ }
325
+ }
326
+ e.end(), t.end();
327
+ }), /* @__PURE__ */ R(ye, { children: [
328
+ /* @__PURE__ */ s("primitive", { object: e.mesh }),
329
+ /* @__PURE__ */ s("primitive", { object: t.lines })
330
+ ] });
331
+ }
332
+ const me = new n.MeshStandardMaterial({ color: "#26201d", metalness: 0.65, roughness: 0.4 }), jt = new n.MeshStandardMaterial({ color: "#16120f", metalness: 0.2, roughness: 0.85 }), kt = new n.MeshStandardMaterial({ color: "#0a0909", roughness: 0.9 }), ne = new n.MeshStandardMaterial({ color: "#5a5048", metalness: 0.35, roughness: 0.5, emissive: new n.Color("#2a1608"), emissiveIntensity: 0.6 }), Qe = new n.SphereGeometry(1, 24, 12, 0, Math.PI * 2, 0, Math.PI / 2);
333
+ let et = null;
334
+ const Bt = () => {
335
+ if (et) return et;
336
+ const e = It().clone();
337
+ return e.repeat.set(3, 1), e.needsUpdate = !0, et = new n.MeshBasicMaterial({ map: e, color: new n.Color(0.55, 0.55, 0.55), toneMapped: !1 });
338
+ }, Vt = new n.MeshBasicMaterial({ color: new n.Color("#ffb020").multiplyScalar(0.32), toneMapped: !1 }), ct = (e, t, o) => t > 0 ? 1 : U(1 - (o - e) / 1400);
339
+ function Po({ mcp: e, backend: t }) {
340
+ const o = e.srv, r = t.res, a = t.k, l = z(null), u = A(() => Z(o.color), [o.color]), i = A(() => ({ band: le(u), glow: ce(u), flame: ce("#ff7a1a"), lamp: ce("#ffe2a8") }), [u]);
341
+ pe(() => () => Object.values(i).forEach((h) => h.dispose()), [i]);
342
+ const c = z(null);
343
+ H(({ clock: h }) => {
344
+ var w;
345
+ l.current && (l.current.position.copy(t.pos), l.current.rotation.y = e.out.x < 0 ? 0 : Math.PI);
346
+ const y = ct(r.activeAt, r.inflight, performance.now()), P = N ? 0 : h.elapsedTime;
347
+ i.band.color.copy(u).multiplyScalar(0.22 + y * (1.3 + 0.3 * Math.sin(P * 8))), i.glow.color.copy(u).multiplyScalar(0.05 + y * 0.3), i.flame.color.setRGB(1, 0.45, 0.1).multiplyScalar(0.2 + y * (0.9 + 0.3 * Math.sin(P * 13 + a))), i.lamp.color.setRGB(1, 0.85, 0.6).multiplyScalar(0.15 + y * 0.6), (w = c.current) == null || w.setOpacity(0.55 + y * 0.45);
348
+ });
349
+ const p = r.kind, v = p === "api" || p === "queue";
350
+ return /* @__PURE__ */ R("group", { ref: l, children: [
351
+ v ? (
352
+ // trailer backed up toward the dock (+x), cab on the far side
353
+ /* @__PURE__ */ R("group", { children: [
354
+ /* @__PURE__ */ s("mesh", { geometry: S, material: ne, scale: [p === "queue" ? 3 : 2.5, 1.15, 1.05], position: [0.25, 0.95, 0] }),
355
+ /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [p === "queue" ? 2.9 : 2.4, 0.07, 1.07], position: [0.25, 0.72, 0] }),
356
+ p === "queue" ? /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [2.9, 0.07, 1.07], position: [0.25, 1.18, 0] }) : null,
357
+ /* @__PURE__ */ s("mesh", { geometry: S, material: me, scale: [0.85, 0.95, 1], position: [p === "queue" ? -1.7 : -1.45, 0.78, 0] }),
358
+ /* @__PURE__ */ s("mesh", { geometry: S, material: i.band, scale: [0.04, 0.3, 0.8], position: [p === "queue" ? -2.13 : -1.88, 0.95, 0] }),
359
+ [-1.3, 0.2, 1.1].map((h) => /* @__PURE__ */ R("group", { children: [
360
+ /* @__PURE__ */ s("mesh", { geometry: B, material: kt, scale: [0.24, 0.16, 0.24], "rotation-x": Math.PI / 2, position: [h, 0.24, 0.5] }),
361
+ /* @__PURE__ */ s("mesh", { geometry: B, material: kt, scale: [0.24, 0.16, 0.24], "rotation-x": Math.PI / 2, position: [h, 0.24, -0.5] })
362
+ ] }, h)),
363
+ /* @__PURE__ */ s("sprite", { material: i.lamp, scale: 0.9, position: [p === "queue" ? -2.2 : -1.95, 0.6, 0.35] }),
364
+ /* @__PURE__ */ s("sprite", { material: i.lamp, scale: 0.9, position: [p === "queue" ? -2.2 : -1.95, 0.6, -0.35] })
365
+ ] })
366
+ ) : /* @__PURE__ */ R("group", { children: [
367
+ p === "warehouse" ? [-0.55, 0.55].map((h) => /* @__PURE__ */ R("group", { "position-z": h, children: [
368
+ /* @__PURE__ */ s("mesh", { geometry: B, material: ne, scale: [0.55, 2.4, 0.55], "position-y": 1.2 }),
369
+ /* @__PURE__ */ s("mesh", { geometry: Qe, material: ne, scale: [0.55, 0.3, 0.55], "position-y": 2.4 }),
370
+ /* @__PURE__ */ s("mesh", { geometry: B, material: i.band, scale: [0.565, 0.07, 0.565], "position-y": 0.7 }),
371
+ /* @__PURE__ */ s("mesh", { geometry: B, material: i.band, scale: [0.565, 0.07, 0.565], "position-y": 1.6 })
372
+ ] }, h)) : p === "storage" ? /* @__PURE__ */ R("group", { children: [
373
+ /* @__PURE__ */ s("mesh", { geometry: B, material: ne, scale: [0.95, 1.3, 0.95], "position-y": 0.65 }),
374
+ /* @__PURE__ */ s("mesh", { geometry: Qe, material: ne, scale: [0.95, 0.35, 0.95], "position-y": 1.3 }),
375
+ /* @__PURE__ */ s("mesh", { geometry: B, material: i.band, scale: [0.965, 0.07, 0.965], "position-y": 0.55 }),
376
+ /* @__PURE__ */ s("mesh", { geometry: B, material: i.band, scale: [0.965, 0.07, 0.965], "position-y": 1.05 })
377
+ ] }) : /* @__PURE__ */ R("group", { children: [
378
+ /* @__PURE__ */ s("mesh", { geometry: B, material: ne, scale: [0.7, p === "spark" ? 2.4 : 2.9, 0.7], "position-y": p === "spark" ? 1.2 : 1.45 }),
379
+ /* @__PURE__ */ s("mesh", { geometry: Qe, material: ne, scale: [0.7, 0.35, 0.7], "position-y": p === "spark" ? 2.4 : 2.9 }),
380
+ [0.6, 1.3, 2].map((h) => /* @__PURE__ */ s("mesh", { geometry: B, material: i.band, scale: [0.715, 0.07, 0.715], "position-y": h }, h)),
381
+ p === "spark" ? /* @__PURE__ */ R(ye, { children: [
382
+ /* @__PURE__ */ s("mesh", { geometry: B, material: me, scale: [0.14, 0.7, 0.14], position: [0.3, 2.9, 0] }),
383
+ /* @__PURE__ */ s("sprite", { material: i.flame, scale: 1.4, position: [0.3, 3.35, 0] })
384
+ ] }) : null
385
+ ] }),
386
+ /* @__PURE__ */ s("mesh", { geometry: B, material: jt, scale: [1.15, 0.08, 1.15], "position-y": 0.04 })
387
+ ] }),
388
+ /* @__PURE__ */ s("sprite", { material: i.glow, scale: 4, "position-y": 1.2 }),
389
+ /* @__PURE__ */ s(ve, { ref: c, position: [0, v ? 2 : p === "storage" ? 2.25 : 3.5, 0], text: r.name, color: o.color, size: 0.22, opacity: 0.6, pxRange: [7.5, 11.5] })
390
+ ] });
391
+ }
392
+ function zo({ mcp: e }) {
393
+ const t = e.srv, o = z(null), r = A(() => Z(t.color), [t.color]), a = z(null), l = z(null), u = A(() => ({ strip: le(r), inner: ce(r), spill: We(r) }), [r]);
394
+ pe(() => () => Object.values(u).forEach((c) => c.dispose()), [u]);
395
+ const i = A(() => ({ open: 0 }), []);
396
+ return H(({ clock: c }) => {
397
+ var y;
398
+ o.current && (o.current.position.copy(e.pos), o.current.rotation.y = e.out.x < 0 ? 0 : Math.PI);
399
+ const p = performance.now(), v = ct(t.activeAt, t.inflight, p);
400
+ i.open += ((t.inflight > 0 || v > 0.3 ? 1 : 0) - i.open) * 0.07;
401
+ const h = N ? 0 : c.elapsedTime;
402
+ if (a.current) {
403
+ const P = 2 * (1 - 0.82 * i.open);
404
+ a.current.scale.y = P, a.current.position.y = 0.7 + 2 - P / 2;
405
+ }
406
+ u.strip.color.copy(r).multiplyScalar(0.35 + v * (1.4 + 0.25 * Math.sin(h * 6))), u.inner.color.copy(r).multiplyScalar(0.06 + i.open * 0.45), u.spill.color.copy(r).multiplyScalar(i.open * 0.22), (y = l.current) == null || y.setOpacity(0.7 + v * 0.3);
407
+ }), /* @__PURE__ */ s("group", { children: /* @__PURE__ */ R("group", { ref: o, children: [
408
+ /* @__PURE__ */ s("mesh", { geometry: S, material: jt, scale: [3.4, 0.7, 4.6], "position-y": 0.35 }),
409
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Bt(), scale: [0.04, 0.22, 4.6], position: [1.72, 0.55, 0] }),
410
+ /* @__PURE__ */ s("mesh", { geometry: S, material: me, scale: [0.22, 2.3, 0.22], position: [1.55, 1.85, 1.45] }),
411
+ /* @__PURE__ */ s("mesh", { geometry: S, material: me, scale: [0.22, 2.3, 0.22], position: [1.55, 1.85, -1.45] }),
412
+ /* @__PURE__ */ s("mesh", { geometry: S, material: me, scale: [0.35, 0.32, 3.2], position: [1.55, 3.1, 0] }),
413
+ /* @__PURE__ */ s("mesh", { geometry: S, material: u.strip, scale: [0.04, 0.08, 2.9], position: [1.74, 3, 0] }),
414
+ /* @__PURE__ */ s("mesh", { ref: a, geometry: S, material: Bt(), scale: [0.06, 2, 2.68], position: [1.55, 1.7, 0] }),
415
+ /* @__PURE__ */ s("sprite", { material: u.inner, scale: [4.5, 3, 1], position: [1, 1.6, 0] }),
416
+ /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [3.4, 0.015, 0], material: u.spill, children: /* @__PURE__ */ s("planeGeometry", { args: [3, 2.8] }) }),
417
+ /* @__PURE__ */ s("mesh", { geometry: S, material: me, scale: [0.2, 3.3, 4.6], position: [-1.6, 1.65, 0] }),
418
+ /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [2.6, 6e-3, 0], material: Vt, children: /* @__PURE__ */ s("planeGeometry", { args: [0.09, 5.2] }) }),
419
+ /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [3.05, 6e-3, 0], material: Vt, children: /* @__PURE__ */ s("planeGeometry", { args: [0.09, 5.2] }) }),
420
+ /* @__PURE__ */ s(ve, { ref: l, position: [0.4, 3.85, 0], text: t.name, color: t.color, plate: "box", size: 0.26, pxRange: [8, 12.5] })
421
+ ] }) });
422
+ }
423
+ function Lo() {
424
+ const e = A(() => new qe(48, 32), []), t = A(() => new qe(40, 16), []), o = A(() => new ge(S, new n.MeshBasicMaterial({ toneMapped: !1 }), 64), []), r = A(() => new ge(Dt, new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 }), 64), []), a = A(
425
+ () => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), d: new n.Vector3(), e: new n.Vector3(), f: new n.Vector3(), p: new n.Vector3(), q: new n.Vector3(), col: new n.Color(), tmp: new n.Color() }),
426
+ []
427
+ ), l = (u, i) => {
428
+ const c = oo(u.name, i);
429
+ return !c || !fo(u.name, a.d) ? !1 : (a.e.copy(c), a.e.y = 0.9, a.f.addVectors(a.d, a.e).multiplyScalar(0.5), a.f.y = 1.9, !0);
430
+ };
431
+ return H(({ clock: u }) => {
432
+ const i = performance.now(), c = N ? 0 : u.elapsedTime;
433
+ e.begin(), t.begin(), o.begin(), r.begin();
434
+ for (const p of V.mcpServers.values())
435
+ for (const v of p.resources.values()) {
436
+ if (!l(p, v.name)) continue;
437
+ const h = ct(v.activeAt, v.inflight, i);
438
+ a.col.copy(Z(p.color)), t.add(a.d, a.f, a.e, a.col, 0.3 + h * 0.9, -1, h > 0.05 ? 5 : 0, c * 1.5);
439
+ }
440
+ for (const p of V.mcpPending.values()) {
441
+ const v = V.mcpServers.get(p.server);
442
+ if (!v || !he(p.instance, a.a) || !$e(v.name, a.b)) continue;
443
+ ze(a.a, a.b, 2.6, a.c);
444
+ const h = to(p, i);
445
+ a.col.copy(E).lerp(Ce, U((h - 1) / 2));
446
+ const y = U(h / 0.35);
447
+ e.add(a.a, a.c, a.b, a.col, y * (1.5 + 0.35 * Math.sin(c * 6)), -1, 9, c * 1.6), fe(a.a, a.c, a.b, 0.94, a.p), a.q.subVectors(a.b, a.p), r.add(a.p, a.q, 0.17, 0.42, 0.17, a.col, 1.6 * y);
448
+ }
449
+ for (const p of V.mcpResolved) {
450
+ const v = V.mcpServers.get(p.server);
451
+ if (!v || !he(p.instance, a.a) || !$e(v.name, a.b)) continue;
452
+ ze(a.a, a.b, 2.6, a.c);
453
+ const h = U((i - p.resolvedAt) / 700);
454
+ e.add(a.a, a.c, a.b, Te, (1 - h) * 0.9, 1 - h, 0, 0);
455
+ }
456
+ for (const p of V.mcpCalls) {
457
+ const v = V.mcpServers.get(p.server);
458
+ if (!v || !he(p.instance, a.q)) continue;
459
+ const h = U((i - p.start) / p.dur);
460
+ if (h >= 1) continue;
461
+ const y = p.phase === "call" ? h : 1 - h, w = !!p.resource && l(v, p.resource) ? 0.62 : 1;
462
+ a.col.copy(Z(v.color)), y <= w ? (a.a.copy(a.q), $e(v.name, a.b), ze(a.a, a.b, 2.6, a.c), fe(a.a, a.c, a.b, de(y / w), a.p), a.p.y -= 0.2) : fe(a.d, a.f, a.e, de((y - w) / (1 - w)), a.p);
463
+ const f = Math.min(1, h * 8, (1 - h) * 8);
464
+ o.add(a.p, null, 0.5, 0.14, 0.5, a.col, 2.2 * f, h * 3), a.p.y += 0.17, o.add(a.p, null, 0.3, 0.22, 0.3, a.tmp.copy(a.col).lerp(Te, 0.4), 1.8 * f, h * 3);
465
+ }
466
+ e.end(), t.end(), o.end(), r.end();
467
+ }), /* @__PURE__ */ R(ye, { children: [
468
+ /* @__PURE__ */ s("primitive", { object: e.lines }),
469
+ /* @__PURE__ */ s("primitive", { object: t.lines }),
470
+ /* @__PURE__ */ s("primitive", { object: o.mesh }),
471
+ /* @__PURE__ */ s("primitive", { object: r.mesh })
472
+ ] });
473
+ }
474
+ const ko = (
475
+ /* glsl */
476
+ `
477
+ varying vec3 vW;
478
+ void main() {
479
+ vec4 w = modelMatrix * vec4(position, 1.0);
480
+ vW = w.xyz;
481
+ gl_Position = projectionMatrix * viewMatrix * w;
482
+ }`
483
+ ), Bo = (
484
+ /* glsl */
485
+ `
486
+ varying vec3 vW;
487
+ uniform vec3 uBase;
488
+ uniform vec3 uGrid;
489
+ uniform vec3 uMajor;
490
+ uniform float uR;
491
+ float line(float x, float w) {
492
+ float d = abs(fract(x - 0.5) - 0.5) / fwidth(x);
493
+ return 1.0 - min(d / w, 1.0);
494
+ }
495
+ void main() {
496
+ vec2 p = vW.xz;
497
+ float minor = max(line(p.x, 0.8), line(p.y, 0.8));
498
+ float major = max(line(p.x / 4.0, 1.1), line(p.y / 4.0, 1.1));
499
+ // spotlight pools: brighter in the middle of the hall, falling off to the walls
500
+ float r = length(p * vec2(0.85, 1.1)) * (30.0 / uR);
501
+ float pool = exp(-r * r / 900.0);
502
+ float edge = smoothstep(46.0, 30.0, r);
503
+ vec3 c = uBase * (0.55 + 0.9 * pool);
504
+ c += uGrid * minor * 0.07 * edge;
505
+ c += uMajor * major * 0.16 * edge;
506
+ gl_FragColor = vec4(c, 1.0);
507
+ #include <colorspace_fragment>
508
+ }`
509
+ );
510
+ function Vo() {
511
+ const e = A(
512
+ () => new n.ShaderMaterial({
513
+ vertexShader: ko,
514
+ fragmentShader: Bo,
515
+ uniforms: {
516
+ uBase: { value: new n.Color("#0b0809") },
517
+ uGrid: { value: new n.Color("#ff8a1f") },
518
+ uMajor: { value: new n.Color("#ffb347") },
519
+ uR: { value: 30 }
520
+ }
521
+ }),
522
+ []
523
+ );
524
+ return H(() => {
525
+ const t = Math.max(30, (ie.core.r + 10) * 1.3);
526
+ e.uniforms.uR.value += (t - e.uniforms.uR.value) * 0.05;
527
+ }), /* @__PURE__ */ s("mesh", { "rotation-x": -Math.PI / 2, position: [0, 0, 0], material: e, children: /* @__PURE__ */ s("planeGeometry", { args: [260, 220] }) });
528
+ }
529
+ function To() {
530
+ return /* @__PURE__ */ R(ye, { children: [
531
+ /* @__PURE__ */ s("hemisphereLight", { args: ["#ffd9b0", "#2a1a10", 0.9] }),
532
+ /* @__PURE__ */ s("directionalLight", { position: [14, 26, 18], intensity: 1.5, color: "#ffd7a8" }),
533
+ /* @__PURE__ */ s("directionalLight", { position: [-20, 12, -8], intensity: 0.9, color: "#ff7a2e" })
534
+ ] });
535
+ }
536
+ const Eo = (
537
+ /* glsl */
538
+ `
539
+ varying vec2 vUv;
540
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
541
+ ), Oo = (
542
+ /* glsl */
543
+ `
544
+ varying vec2 vUv;
545
+ uniform float uLen, uW, uTime, uOp, uSteps, uSweep, uSweepK;
546
+ uniform vec3 uRun, uEdge, uStage; // uStage = state per zone: 0 queued, 1 running, 2 done, 3 failed
547
+ uniform vec2 uZ1; // zone boundaries (0..1 along the lane)
548
+ void main() {
549
+ float x = vUv.x * uLen;
550
+ float y = (vUv.y - 0.5) * uW;
551
+ float edge = smoothstep(uW * 0.5 - 0.16, uW * 0.5 - 0.1, abs(y)) * (1.0 - smoothstep(uW * 0.5 - 0.04, uW * 0.5, abs(y)));
552
+ float dash = step(0.5, fract(x / 0.9));
553
+ vec3 c = uEdge * edge * (0.25 + 0.55 * dash);
554
+ c += uRun * 0.006;
555
+ if (uSteps > 0.5) {
556
+ float zone = vUv.x < uZ1.x ? 0.0 : (vUv.x < uZ1.y ? 1.0 : 2.0);
557
+ float st = zone < 0.5 ? uStage.x : (zone < 1.5 ? uStage.y : uStage.z);
558
+ // stage dividers
559
+ float div = (1.0 - smoothstep(0.0, 0.05, abs(vUv.x - uZ1.x) * uLen)) + (1.0 - smoothstep(0.0, 0.05, abs(vUv.x - uZ1.y) * uLen));
560
+ c += uEdge * div * 0.35 * step(abs(y), uW * 0.5 - 0.1);
561
+ if (st > 0.5 && st < 1.5) {
562
+ float ch = fract((x - uTime * 1.2) / 1.6 - abs(y) * 0.25);
563
+ float chev = smoothstep(0.0, 0.05, ch) * (1.0 - smoothstep(0.1, 0.2, ch));
564
+ c += vec3(1.0, 0.7, 0.2) * (0.006 + chev * 0.035);
565
+ } else if (st > 1.5 && st < 2.5) {
566
+ c += vec3(0.9, 0.85, 0.8) * 0.004;
567
+ } else if (st > 2.5) {
568
+ c += vec3(1.0, 0.12, 0.1) * 0.02;
569
+ }
570
+ }
571
+ // handoff sweep: a band of light travelling into the next stage
572
+ c += vec3(1.0, 0.8, 0.35) * uSweepK * exp(-pow((vUv.x - uSweep) * uLen / 0.8, 2.0)) * 0.6;
573
+ gl_FragColor = vec4(c * uOp, 1.0);
574
+ #include <colorspace_fragment>
575
+ }`
576
+ ), Uo = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), Tt = new n.MeshStandardMaterial({ color: "#2a2320", metalness: 0.6, roughness: 0.4 }), tt = { queued: 0, running: 1, done: 2, failed: 3 }, Et = new n.Vector3(0, 1, 0), ot = new n.Vector3(), xe = new n.Vector3(), Go = new n.Vector3(), Ot = new n.Matrix4(), se = { b1: 0, b2: 0 };
577
+ function _o({ run: e }) {
578
+ const t = e.run ?? V.runs.get(e.id);
579
+ return t ? /* @__PURE__ */ s(Fo, { kr: e, run: t }) : null;
580
+ }
581
+ function Fo({ kr: e, run: t }) {
582
+ const o = A(
583
+ () => new n.ShaderMaterial({
584
+ vertexShader: Eo,
585
+ fragmentShader: Oo,
586
+ uniforms: {
587
+ uLen: { value: 1 },
588
+ uW: { value: 1 },
589
+ uTime: { value: 0 },
590
+ uOp: { value: 0 },
591
+ uSteps: { value: 0 },
592
+ uSweep: { value: -1 },
593
+ uSweepK: { value: 0 },
594
+ uRun: { value: Z(t.color).clone() },
595
+ uEdge: { value: E.clone() },
596
+ uStage: { value: new n.Vector3() },
597
+ uZ1: { value: new n.Vector2(0.33, 0.66) }
598
+ },
599
+ transparent: !0,
600
+ depthWrite: !1,
601
+ blending: n.AdditiveBlending
602
+ }),
603
+ [t.color]
604
+ );
605
+ pe(() => () => o.dispose(), [o]);
606
+ const r = A(() => Se.map(() => ({ lamp: le(E), glow: ce(E) })), []), a = z(null), l = z(null), u = z([]), i = z(null), c = A(() => ({ u0: 0, u1: 0, v0: 0, v1: 0, init: !1 }), []), p = A(() => ({ u0: 0, u1: 0, v0: 0, v1: 0 }), []);
607
+ return H(({ clock: v }, h) => {
608
+ var W, G, _;
609
+ const y = a.current;
610
+ if (!y) return;
611
+ ot.copy(e.side), xe.copy(e.axis), Go.crossVectors(ot, Et).dot(xe) < 0 && xe.negate(), Ot.makeBasis(ot, Et, xe), y.quaternion.setFromRotationMatrix(Ot), y.position.copy(e.origin).addScaledVector(e.side, -e.cu).addScaledVector(e.axis, -e.cv);
612
+ const P = xe.dot(e.axis) < 0 ? -1 : 1;
613
+ _t(e, p);
614
+ const w = c.init ? 1 - Math.exp(-Math.min(0.1, h) / 0.2) : 1;
615
+ c.init = !0, c.u0 += (p.u0 - c.u0) * w, c.u1 += (p.u1 - c.u1) * w, c.v0 += (p.v0 - c.v0) * w, c.v1 += (p.v1 - c.v1) * w;
616
+ const f = c.u1 - c.u0, b = c.v1 - c.v0, C = (P > 0 ? c.v1 : -c.v0) + 0.15;
617
+ mo(se), (W = l.current) == null || W.position.set(c.u0 + f / 2, 4e-3, (c.v0 + c.v1) / 2 * P), (G = l.current) == null || G.scale.set(f, 1, b), (_ = i.current) == null || _.position.set(c.u0 + 0.2, 0.2, (P > 0 ? c.v0 : -c.v1) - 0.25);
618
+ const T = performance.now(), L = Ve((T - t.startedAt) / 900), x = t.endedAt ? U(1 - (T - t.endedAt - (no - 2500)) / 2500) : 1, M = o.uniforms;
619
+ M.uLen.value = f, M.uW.value = b, M.uZ1.value.set((se.b1 - c.u0) / f, (se.b2 - c.u0) / f), M.uOp.value = L * x, M.uTime.value += N ? 0 : h, M.uSteps.value = t.hasSteps ? 1 : 0, M.uStage.value.set(tt[t.steps.plan], tt[t.steps.research], tt[t.steps.write]);
620
+ const g = (T - t.handoffAt) / 1e3;
621
+ if (t.handoffAt && g < 1.4) {
622
+ const k = (Pt(t.handoffFrom, c, se) - c.u0) / f, oe = (Pt(t.handoffTo, c, se) - c.u0) / f;
623
+ M.uSweep.value = k + (oe - k) * Ve(g / 1.1), M.uSweepK.value = 1 - U((g - 0.9) / 0.5);
624
+ } else M.uSweepK.value = 0;
625
+ const m = N ? 0 : v.elapsedTime, F = Math.max(0.75, Ke.spread * 0.9);
626
+ for (let k = 0; k < Se.length; k++) {
627
+ const oe = Se[k], I = t.steps[oe], $ = r[k], we = I === "running" ? ee : I === "done" ? Te : I === "failed" ? Z("#ff2d2d") : E, Ee = I === "running" ? 1.2 + 0.4 * Math.sin(m * 5) : I === "done" ? 0.55 : I === "failed" ? 1 : 0.12;
628
+ $.lamp.color.copy(we).multiplyScalar(Ee * L * x), $.glow.color.copy(we).multiplyScalar(Ee * 0.35 * L * x);
629
+ const D = u.current[k];
630
+ if (D) {
631
+ D.visible = t.hasSteps && L * x > 0.02;
632
+ const K = k === 0 ? c.u0 + 1.2 : k === 1 ? se.b1 + 0.6 : se.b2 + 0.6;
633
+ D.position.set(K, 0, C), D.scale.setScalar(F);
634
+ }
635
+ }
636
+ }), /* @__PURE__ */ R("group", { ref: a, children: [
637
+ /* @__PURE__ */ s("mesh", { ref: l, geometry: Uo, material: o }),
638
+ Se.map((v, h) => /* @__PURE__ */ R("group", { ref: (y) => void (u.current[h] = y), visible: !1, children: [
639
+ /* @__PURE__ */ s("mesh", { geometry: B, material: Tt, scale: [0.06, 1.6, 0.06], "position-y": 0.8 }),
640
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Tt, scale: [0.5, 0.18, 0.08], "position-y": 1.55 }),
641
+ /* @__PURE__ */ s("mesh", { geometry: B, material: r[h].lamp, scale: [0.1, 0.14, 0.1], "position-y": 1.72 }),
642
+ /* @__PURE__ */ s("sprite", { material: r[h].glow, scale: 1.2, "position-y": 1.72 }),
643
+ t.hasSteps ? /* @__PURE__ */ s(Io, { run: t, k: h }) : null
644
+ ] }, v)),
645
+ /* @__PURE__ */ s("group", { ref: i, children: /* @__PURE__ */ s(Wo, { run: t }) })
646
+ ] });
647
+ }
648
+ function Io({ run: e, k: t }) {
649
+ Gt();
650
+ const o = Se[t], r = e.steps[o];
651
+ return /* @__PURE__ */ s(
652
+ ve,
653
+ {
654
+ position: [0, 2.25, 0],
655
+ text: r === "done" ? `${o} · done` : o,
656
+ color: r === "running" ? "#ffd23f" : r === "done" ? "#e7e5e4" : r === "failed" ? "#ff2d2d" : "#7c5a2a",
657
+ uppercase: !0,
658
+ letterSpacing: 0.12,
659
+ size: 0.2,
660
+ opacity: r === "queued" ? 0.55 : 1,
661
+ fadeMs: 300,
662
+ pxRange: [7, 10.5]
663
+ }
664
+ );
665
+ }
666
+ function Wo({ run: e }) {
667
+ Gt();
668
+ const t = e.status !== "started";
669
+ return /* @__PURE__ */ s(
670
+ ve,
671
+ {
672
+ anchorX: "left",
673
+ anchorY: "bottom",
674
+ textAlign: "left",
675
+ plate: "box",
676
+ text: e.topic,
677
+ secondary: so(e, { base: "#a8a29e", current: "#ffd23f", done: "#e7e5e4" }, ["line running…", "line complete", "line halted"]),
678
+ color: e.color,
679
+ size: 0.34,
680
+ maxWidth: 10,
681
+ opacity: t ? 0.55 : 1,
682
+ fadeMs: 400,
683
+ fit: !0,
684
+ pxRange: [8, 14]
685
+ }
686
+ );
687
+ }
688
+ const nt = new n.Vector3(), ae = { u0: 0, u1: 0, v0: 0, v1: 0 };
689
+ function Do(e) {
690
+ for (const t of ie.runs.values())
691
+ _t(t, ae), e(Ye(t, ae.u0 + 3, ae.v0 - 1.4, nt), 1.6), e(Ye(t, ae.u1, ae.v1, nt), 0.6), e(Ye(t, ae.u0, ae.v1, nt), 0.6);
692
+ }
693
+ const jo = new n.MeshStandardMaterial({ color: "#1c1714", metalness: 0.55, roughness: 0.42 }), qo = new n.MeshStandardMaterial({ color: "#0f0c0b", metalness: 0.4, roughness: 0.6 }), Q = new n.MeshStandardMaterial({ color: "#2a2320", metalness: 0.7, roughness: 0.35 }), st = new n.MeshStandardMaterial({ color: "#e88a1a", metalness: 0.5, roughness: 0.35, emissive: new n.Color("#ff7a00"), emissiveIntensity: 0.18 });
694
+ let Fe = null;
695
+ const Ko = () => {
696
+ if (Fe) return Fe;
697
+ const e = It().clone();
698
+ return e.repeat.set(6, 1), e.needsUpdate = !0, Fe = new n.MeshBasicMaterial({ map: e, color: new n.Color(0.75, 0.75, 0.75), toneMapped: !1 }), Fe;
699
+ }, No = new n.EdgesGeometry(new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2)), Ho = new n.Color("#2a2627");
700
+ function Xo({ agent: e, selected: t, onSelect: o }) {
701
+ const r = e.inst, a = !r.subagent, l = A(() => Z(ke[r.type]), [r.type]), u = A(() => vo(r.id), [r.id]), i = z(null), c = z(null), p = z(null), v = A(() => (u - 0.5) * 0.35, [u]), h = z(null), y = z(null), P = z(null), w = z(null), f = z(null), b = z(null), C = z(null), T = z(null), L = z(null), x = z(null), M = z(null), g = A(
702
+ () => ({
703
+ screen: le(l),
704
+ vent: le(l),
705
+ trim: new n.LineBasicMaterial({ color: E, transparent: !0, toneMapped: !1 }),
706
+ beacon: le(E),
707
+ beam: We(E, n.DoubleSide),
708
+ halo: ce(l),
709
+ rim: le(ee),
710
+ shock: We(l, n.DoubleSide),
711
+ sel: We(ee, n.DoubleSide),
712
+ hatch: new n.LineBasicMaterial({ color: E, transparent: !0, toneMapped: !1, blending: n.AdditiveBlending, depthWrite: !1 }),
713
+ tip: ce(ee)
714
+ }),
715
+ [l]
716
+ );
717
+ pe(() => () => Object.values(g).forEach((k) => k.dispose()), [g]);
718
+ const m = A(
719
+ () => ({
720
+ top: new n.Vector3(),
721
+ tmp: new n.Vector3(),
722
+ c: new n.Color(),
723
+ llm: r.llmCalls,
724
+ llmAt: -1e9,
725
+ llmK: 0,
726
+ tools: r.toolCalls + r.mcpCalls,
727
+ armAt: -1e9,
728
+ armMcp: !1,
729
+ lastWeld: 0,
730
+ failedBurst: !1,
731
+ spin: u * 6.28,
732
+ think: 0
733
+ }),
734
+ // eslint-disable-next-line react-hooks/exhaustive-deps
735
+ []
736
+ );
737
+ pe(() => () => void it.delete(r.id), [r.id]), H(({ clock: k }, oe) => {
738
+ var bt, Mt, xt, St, At;
739
+ const I = performance.now(), $ = N ? 0 : k.elapsedTime, we = (I - r.bornAt) / 1e3, Ee = r.parent ? 0.55 : 0.1, D = Ve((we - Ee) / 0.9), K = r.exitAt ? (I - r.exitAt) / 1e3 : -1, pt = K >= 0 ? 1 - U(K / 0.5) : 1, ut = K >= 0 ? yo((K - 0.45) / 1.9) : 0, Ne = K < 0;
740
+ let ue = !1;
741
+ for (const J of V.mcpPending.values()) J.instance === r.id && (ue = !0);
742
+ const mt = Ne && (r.status === "thinking" || r.status === "spawning");
743
+ m.think += ((mt ? 1 : 0) - m.think) * 0.08, r.llmCalls !== m.llm && (m.llm = r.llmCalls, m.llmAt = I, m.llmK = r.pulse, x.current && (x.current.getWorldPosition(m.tmp), Je(m.tmp, Math.round(10 + m.llmK * 26), ee, 3.2 + m.llmK * 1.4, 0.9 + m.llmK * 0.5)));
744
+ const ht = r.toolCalls + r.mcpCalls;
745
+ ht !== m.tools && (m.armMcp = r.mcpCalls > 0 && ((bt = r.recent[0]) == null ? void 0 : bt.type) === "mcp", m.tools = ht, m.armAt = I), r.status === "failed" && K >= 0 && !m.failedBurst && (m.failedBurst = !0, m.tmp.copy(m.top), Je(m.tmp, 40, Ce, 4, 2.2));
746
+ const ft = -2.3 * (1 - D) - 2.4 * ut;
747
+ h.current && (h.current.position.y = ft);
748
+ const He = e.scale;
749
+ (Mt = i.current) == null || Mt.position.copy(e.live), (xt = c.current) == null || xt.scale.setScalar(He), (St = p.current) == null || St.position.set(0, 2.95 * He + (a ? 0.15 : 0.05), 0);
750
+ const dt = Math.max(0.2, (ft + ho) * He);
751
+ it.set(r.id, dt), m.top.set(e.live.x, dt, e.live.z);
752
+ const gt = (I - m.llmAt) / 1e3, Oe = Math.exp(-gt * 3.2) * m.llmK, Kt = mt ? 0.85 + 0.15 * Math.sin($ * 9 + u * 7) : 0.32 + 0.06 * Math.sin($ * 1.3 + u * 5), j = pt * D;
753
+ m.c.copy(l).multiplyScalar((Kt + Oe * 0.7) * 1.25), r.status === "failed" && m.c.lerp(Ce, 0.7), g.screen.color.copy(m.c).multiplyScalar(j).lerp(Ho, 1 - pt), g.vent.color.copy(l).multiplyScalar((0.35 + m.think * 0.5 + Oe * 0.4) * j), g.trim.color.copy(E).multiplyScalar((0.55 + m.think * 0.45 + (t ? 0.8 : 0)) * j), g.halo.color.copy(l).multiplyScalar((0.1 + m.think * 0.12 + Oe * 0.25) * j), g.rim.color.copy(ee).multiplyScalar((0.25 + Oe * 2.4) * j);
754
+ const yt = ue && Ne ? Math.sin($ * 7) > 0 || N ? 1 : 0.15 : 0;
755
+ if (ue && Ne ? g.beacon.color.copy(Ce).lerp(E, 0.25).multiplyScalar(0.4 + yt * 1.4) : g.beacon.color.copy(E).multiplyScalar((0.25 + m.think * 1.2) * j), y.current && (m.spin += oe * (N ? 0 : 5.5), y.current.rotation.y = m.spin, y.current.visible = j > 0.05 && (m.think > 0.05 || ue), g.beam.color.copy(ue ? Ce : E).multiplyScalar((ue ? 0.5 * yt : 0.42 * m.think) * j)), P.current) {
756
+ const J = U(gt / 1);
757
+ P.current.visible = J < 1 && j > 0.05, P.current.scale.setScalar(1.15 + Ve(J) * (0.35 + m.llmK * 0.55)), g.shock.color.copy(l).multiplyScalar((1 - J) * (1 - J) * 0.9 * j);
758
+ }
759
+ if (f.current) {
760
+ const J = (D > 0 && D < 1 ? 1 : 0) * (1 - D) + (K >= 0 ? U(K / 0.3) * (1 - ut) : 0) + (D <= 0 && we > 0 ? 0.6 : 0);
761
+ f.current.visible = J > 0.02, g.hatch.color.copy(E).multiplyScalar(J * 1.6);
762
+ }
763
+ w.current && (w.current.visible = t && j > 0.05, w.current.rotation.y = $ * 0.6, g.sel.color.copy(ee).multiplyScalar(0.8 + 0.25 * Math.sin($ * 3)));
764
+ const vt = U((I - m.armAt) / 1500), be = vt < 1 ? Math.sin(Math.PI * de(vt)) : 0, wt = 0.9, Nt = m.armMcp ? Math.PI - v : -Math.PI / 2 + 0.25;
765
+ b.current && (b.current.rotation.y = wt + (Nt - wt) * be + Math.sin($ * 0.7 + u * 9) * 0.04), C.current && (C.current.rotation.z = -0.15 - be * 0.85), T.current && (T.current.rotation.z = -2.1 + be * 1.05), g.tip.color.copy(ee).multiplyScalar(be * 1.2 * j), be > 0.65 && L.current && I - m.lastWeld > 45 && (m.lastWeld = I, L.current.getWorldPosition(m.tmp), Je(m.tmp, 3, E, 1.6, 1.4, 0.6)), (At = M.current) == null || At.setOpacity(ao(r.id) ? U(D * 1.4 - 0.2) * (1 - U(K / 1.2)) : 0);
766
+ });
767
+ const F = (k) => {
768
+ k.stopPropagation(), o(r.id);
769
+ }, W = () => document.body.style.cursor = "pointer", G = () => document.body.style.cursor = "", _ = r.id.split(":")[2];
770
+ return /* @__PURE__ */ R("group", { ref: i, children: [
771
+ /* @__PURE__ */ R("group", { ref: c, "rotation-y": v, children: [
772
+ /* @__PURE__ */ s("lineSegments", { ref: f, geometry: No, material: g.hatch, scale: [2.5, 1, 2.3], "position-y": 0.012 }),
773
+ /* @__PURE__ */ s("mesh", { ref: w, geometry: Lt, material: g.sel, scale: 1.85, "position-y": 0.02, visible: !1 }),
774
+ /* @__PURE__ */ s("mesh", { ref: P, geometry: Lt, material: g.shock, "position-y": 0.03, visible: !1 }),
775
+ /* @__PURE__ */ R("group", { ref: h, "position-y": -2.3, children: [
776
+ /* @__PURE__ */ s("mesh", { geometry: S, material: qo, scale: [2.2, 0.22, 2], "position-y": 0.11, onClick: F, onPointerOver: W, onPointerOut: G }),
777
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Ko(), scale: [2.24, 0.07, 2.04], "position-y": 0.19 }),
778
+ /* @__PURE__ */ s("mesh", { geometry: S, material: jo, scale: [1.7, 1.25, 1.5], "position-y": 0.845, onClick: F, onPointerOver: W, onPointerOut: G }),
779
+ /* @__PURE__ */ s("lineSegments", { geometry: bo, material: g.trim, scale: [1.71, 1.26, 1.51], "position-y": 0.845 }),
780
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Q, scale: [1.82, 0.09, 1.62], "position-y": 1.51 }),
781
+ /* @__PURE__ */ s("mesh", { geometry: S, material: g.screen, scale: [1.18, 0.4, 0.02], position: [0, 0.98, 0.755] }),
782
+ /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.62, 0.05, 0.02], position: [-0.22, 0.6, 0.755] }),
783
+ /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.22, 0.05, 0.02], position: [0.42, 0.6, 0.755] }),
784
+ [0.55, 0.75, 0.95, 1.15].map((k) => /* @__PURE__ */ s("mesh", { geometry: S, material: g.vent, scale: [0.02, 0.06, 0.9], position: [0.855, k, 0] }, k)),
785
+ /* @__PURE__ */ s("sprite", { material: g.halo, position: [0, 0.98, 0.95], scale: [2.6, 1.4, 1] }),
786
+ /* @__PURE__ */ s("mesh", { geometry: B, material: Q, scale: [0.17, 0.9, 0.17], position: [0.48, 1.98, -0.35] }),
787
+ /* @__PURE__ */ s("mesh", { geometry: B, material: g.rim, scale: [0.2, 0.06, 0.2], position: [0.48, 2.44, -0.35] }),
788
+ /* @__PURE__ */ s("group", { ref: x, position: [0.48, 2.5, -0.35] }),
789
+ a ? /* @__PURE__ */ s("mesh", { geometry: B, material: Q, scale: [0.11, 0.6, 0.11], position: [0.12, 1.84, -0.45] }) : null,
790
+ /* @__PURE__ */ s("mesh", { geometry: B, material: Q, scale: [0.15, 0.06, 0.15], position: [-0.58, 1.58, 0.42] }),
791
+ /* @__PURE__ */ s("mesh", { geometry: B, material: g.beacon, scale: [0.11, 0.2, 0.11], position: [-0.58, 1.71, 0.42] }),
792
+ /* @__PURE__ */ R("mesh", { ref: y, position: [-0.58, 1.71, 0.42], visible: !1, children: [
793
+ /* @__PURE__ */ s("coneGeometry", { args: [0.32, 1.3, 16, 1, !0] }),
794
+ /* @__PURE__ */ s("primitive", { object: g.beam, attach: "material" })
795
+ ] }),
796
+ /* @__PURE__ */ R("group", { position: [0.98, 0.22, 0.86], children: [
797
+ /* @__PURE__ */ s("mesh", { geometry: B, material: Q, scale: [0.17, 0.14, 0.17], "position-y": 0.07 }),
798
+ /* @__PURE__ */ R("group", { ref: b, "position-y": 0.14, children: [
799
+ /* @__PURE__ */ s("mesh", { geometry: B, material: st, scale: [0.12, 0.12, 0.12], "position-y": 0.06 }),
800
+ /* @__PURE__ */ R("group", { ref: C, "position-y": 0.12, children: [
801
+ /* @__PURE__ */ s("mesh", { geometry: S, material: st, scale: [0.1, 0.78, 0.1], "position-y": 0.39 }),
802
+ /* @__PURE__ */ R("group", { ref: T, "position-y": 0.78, children: [
803
+ /* @__PURE__ */ s("mesh", { geometry: B, material: Q, scale: [0.08, 0.13, 0.08], "rotation-x": Math.PI / 2 }),
804
+ /* @__PURE__ */ s("mesh", { geometry: S, material: st, scale: [0.075, 0.62, 0.075], "position-y": 0.31 }),
805
+ /* @__PURE__ */ R("group", { ref: L, "position-y": 0.66, children: [
806
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Q, scale: [0.16, 0.05, 0.08] }),
807
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Q, scale: [0.03, 0.14, 0.06], position: [-0.06, 0.08, 0] }),
808
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Q, scale: [0.03, 0.14, 0.06], position: [0.06, 0.08, 0] }),
809
+ /* @__PURE__ */ s("sprite", { material: g.tip, scale: 0.7, "position-y": 0.12 })
810
+ ] })
811
+ ] })
812
+ ] })
813
+ ] })
814
+ ] })
815
+ ] })
816
+ ] }),
817
+ /* @__PURE__ */ s("group", { ref: p, children: /* @__PURE__ */ s(
818
+ ve,
819
+ {
820
+ ref: M,
821
+ fit: !0,
822
+ text: `${r.name}${_ !== void 0 ? ` ${Number(_) + 1}` : ""}`,
823
+ color: ke[r.type],
824
+ size: a ? 0.3 : 0.22,
825
+ opacity: 0,
826
+ pxRange: a ? [9, 13.5] : [8, 11.5]
827
+ }
828
+ ) })
829
+ ] });
830
+ }
831
+ const Ie = 4, at = new n.MeshStandardMaterial({ color: "#c2560f", metalness: 0.6, roughness: 0.4, emissive: new n.Color("#ff6a00"), emissiveIntensity: 0.35 }), Ut = new n.MeshStandardMaterial({ color: "#2b2420", metalness: 0.6, roughness: 0.5 }), Yo = 64;
832
+ function Zo({ galaxy: e }) {
833
+ const t = A(() => {
834
+ const f = new n.MeshBasicMaterial({ map: Wt(), toneMapped: !1 }), b = new n.InstancedMesh(S, f, X), C = new n.Object3D(), T = new n.Vector3();
835
+ for (let L = 0; L < X; L++) {
836
+ Ue(L, T), C.position.copy(T);
837
+ const x = 0.55 + L * 37 % 7 * 0.035;
838
+ C.scale.set(0.78, x * 0.82, 0.62), C.updateMatrix(), b.setMatrixAt(L, C.matrix), b.setColorAt(L, new n.Color());
839
+ }
840
+ return b.instanceMatrix.setUsage(n.DynamicDrawUsage), b;
841
+ }, []), o = A(() => {
842
+ const f = [];
843
+ for (let b = 0; b < X; b++) {
844
+ const C = e.nodes[b % Math.max(1, e.nodes.length)], T = new n.Color(C ? ro[C.kind] ?? "#94a3b8" : "#333");
845
+ f.push(T.multiplyScalar(b < e.nodes.length ? 0.16 : 0.05));
846
+ }
847
+ return f;
848
+ }, [e]), r = A(() => /* @__PURE__ */ new Map(), [e]), a = (f) => {
849
+ let b = r.get(f);
850
+ return b === void 0 && r.set(f, b = co(e, f) % X), b;
851
+ }, l = A(() => new qe(40, 24), []), u = A(() => new ge(Dt, new n.MeshBasicMaterial({ toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 }), 40), []), i = A(
852
+ () => ({
853
+ fire: new Float32Array(X),
854
+ white: new Float32Array(X),
855
+ fireC: Array.from({ length: X }, () => new n.Color()),
856
+ push: new Float32Array(X),
857
+ dirty: new Uint8Array(X),
858
+ o: new n.Object3D(),
859
+ a: new n.Vector3(),
860
+ b: new n.Vector3(),
861
+ c: new n.Vector3(),
862
+ p: new n.Vector3(),
863
+ q: new n.Vector3(),
864
+ w: new n.Vector3(),
865
+ col: new n.Color()
866
+ }),
867
+ []
868
+ );
869
+ pe(() => void i.dirty.fill(1), [o, i]);
870
+ const c = z([]), p = z([]), v = z(Array(Ie).fill(""));
871
+ H(() => {
872
+ const f = performance.now();
873
+ i.fire.fill(0), i.white.fill(0), i.push.fill(0), l.begin(), u.begin();
874
+ const b = V.flares;
875
+ for (let x = Math.max(0, b.length - Yo); x < b.length; x++) {
876
+ const M = b[x], g = a(M.node), m = (f - M.start) / 1e3, F = V.instances.get(M.instance) ?? V.archive.get(M.instance), W = F ? Z(ke[F.type]) : E, G = M.op === "write", _ = m < 0.3 ? m / 0.3 : Math.exp(-(m - 0.3) * 1.3);
877
+ if (_ > i.fire[g] && (i.fire[g] = _, i.fireC[g].copy(G ? Te : W), i.white[g] = G ? 1 : 0), G && (i.push[g] = Math.max(i.push[g], Math.sin(Math.PI * U(m / 0.9)))), i.dirty[g] = 1, m < 2.2 && he(M.instance, i.w)) {
878
+ Ue(g, i.b), i.b.z += 0.4, io(i.w, i.a), ze(i.a, i.b, 4, i.c);
879
+ const k = Math.min(1, m / 0.25) * Math.pow(1 - m / 2.2, 1.4), oe = G ? Math.min(1, m * 0.9) : 1 - Math.min(1, m * 0.9);
880
+ i.col.copy(G ? ee : W).lerp(Te, G ? 0.5 : 0), l.add(i.a, i.c, i.b, i.col, k * 0.8, oe, 0, 0), G ? (fe(i.a, i.c, i.b, 0.9, i.p), i.q.subVectors(i.b, i.p), u.add(i.p, i.q, 0.14, 0.36, 0.14, i.col, k * 1.4)) : (fe(i.a, i.c, i.b, 0.1, i.p), i.q.subVectors(i.a, i.p), u.add(i.p, i.q, 0.14, 0.36, 0.14, i.col, k * 1.4));
881
+ }
882
+ }
883
+ l.end(), u.end();
884
+ const C = i.o;
885
+ let T = !1;
886
+ for (let x = 0; x < X; x++) {
887
+ const M = i.fire[x];
888
+ if (M > 5e-3 || i.dirty[x]) {
889
+ i.col.copy(o[x]), M > 5e-3 && i.col.lerp(i.fireC[x], Math.min(1, M)).multiplyScalar(1 + M * (1.4 + i.white[x] * 1.6)), t.setColorAt(x, i.col), Ue(x, C.position), C.position.z += i.push[x] * 0.45;
890
+ const g = 0.55 + x * 37 % 7 * 0.035;
891
+ C.scale.set(0.78, g * 0.82, 0.62), C.updateMatrix(), t.setMatrixAt(x, C.matrix), T = !0, M <= 5e-3 && (i.dirty[x] = 0);
892
+ }
893
+ }
894
+ T && (t.instanceMatrix.needsUpdate = !0, t.instanceColor && (t.instanceColor.needsUpdate = !0));
895
+ let L = 0;
896
+ for (let x = V.flares.length - 1; x >= 0 && L < Ie; x--) {
897
+ const M = V.flares[x];
898
+ if (f - M.start > 2200) break;
899
+ let g = !1;
900
+ for (let _ = 0; _ < L; _++) v.current[_] === M.node && (g = !0);
901
+ if (g) continue;
902
+ const m = a(M.node);
903
+ Ue(m, i.p);
904
+ let F = !1;
905
+ for (let _ = 0; _ < L; _++) {
906
+ const k = p.current[_];
907
+ k && Math.abs(k.position.y - (i.p.y + 0.55)) < 0.6 && Math.abs(k.position.x - i.p.x) < 3.4 && (F = !0);
908
+ }
909
+ if (F) continue;
910
+ const W = c.current[L], G = p.current[L];
911
+ W && G && (G.position.set(i.p.x, i.p.y + 0.55, i.p.z + 0.5), v.current[L] !== M.node && (W.setText(`${M.op === "write" ? "wrote" : "read"} · ${M.node}`), W.setColor(M.op === "write" ? "#ffd23f" : "#ffab1a")), W.setOpacity(1)), v.current[L] = M.node, L++;
912
+ }
913
+ for (let x = L; x < Ie; x++) {
914
+ const M = c.current[x];
915
+ M == null || M.setOpacity(0), v.current[x] = "";
916
+ }
917
+ });
918
+ const h = A(() => {
919
+ const f = [];
920
+ for (let b = 0; b <= te; b += 5) f.push(Ae - Y / 2 + Math.min(b, te) * Y);
921
+ return f[f.length - 1] < Ae - Y / 2 + te * Y - 0.01 && f.push(Ae - Y / 2 + te * Y), f;
922
+ }, []), y = te * Y, P = Ae - Y / 2 + y / 2, w = Pe + Be * Re + 0.1;
923
+ return /* @__PURE__ */ R("group", { children: [
924
+ /* @__PURE__ */ s("primitive", { object: t }),
925
+ h.map((f) => /* @__PURE__ */ R("group", { children: [
926
+ /* @__PURE__ */ s("mesh", { geometry: S, material: at, scale: [0.09, w, 0.09], position: [f, w / 2, re + 0.42] }),
927
+ /* @__PURE__ */ s("mesh", { geometry: S, material: at, scale: [0.09, w, 0.09], position: [f, w / 2, re - 0.42] })
928
+ ] }, f)),
929
+ Array.from({ length: Be + 1 }, (f, b) => /* @__PURE__ */ R("group", { children: [
930
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Ut, scale: [y, 0.05, 0.9], position: [P, Pe + b * Re - 0.03, re] }),
931
+ /* @__PURE__ */ s("mesh", { geometry: S, material: at, scale: [y, 0.07, 0.06], position: [P, Pe + b * Re, re + 0.44] })
932
+ ] }, b)),
933
+ /* @__PURE__ */ s("mesh", { geometry: S, material: Ut, scale: [y + 2, w + 1.4, 0.15], position: [P, (w + 1.4) / 2, re - 0.7] }),
934
+ /* @__PURE__ */ s("primitive", { object: l.lines }),
935
+ /* @__PURE__ */ s("primitive", { object: u.mesh }),
936
+ Array.from({ length: Ie }, (f, b) => /* @__PURE__ */ s("group", { ref: (C) => void (p.current[b] = C), children: /* @__PURE__ */ s(ve, { ref: (C) => void (c.current[b] = C), text: "", plate: "box", size: 0.22, opacity: 0, fadeMs: 250, pxRange: [7.5, 11.5] }) }, b)),
937
+ /* @__PURE__ */ s(lo, { position: [P, w + 1.6, re], suffix: " · rack", color: "#ffab1a", plate: "box", letterSpacing: 0.04, size: 0.7, opacity: 0.85, pxRange: [9, 13] })
938
+ ] });
939
+ }
940
+ function $o() {
941
+ const e = A(() => new Mo(), []);
942
+ return H((t, o) => e.update(o)), /* @__PURE__ */ s("primitive", { object: e.mesh });
943
+ }
944
+ const rt = new n.Vector3(), qt = 3.6;
945
+ function Jo(e) {
946
+ Do(e);
947
+ for (const t of ie.mcp.values()) e(rt.set(t.target.x, 3.4, t.target.z), 2.4);
948
+ for (const t of uo()) e(rt.copy(ie.clusterTarget[t]).setY(1.4), 3.6);
949
+ if (ie.graphWanted) {
950
+ const t = ie.graph;
951
+ e(rt.set(t.target.x, (go + 2) * (qt / Ft), t.target.z), 1.6);
952
+ }
953
+ }
954
+ function Qo() {
955
+ const e = Yt((t) => t.scene);
956
+ return H(() => {
957
+ const t = e.fog;
958
+ if (!t) return;
959
+ const o = Ke.cam.dist || 40;
960
+ t.near = o * 1.1, t.far = o * 2.9;
961
+ }), null;
962
+ }
963
+ const en = /* @__PURE__ */ R(ye, { children: [
964
+ /* @__PURE__ */ s(Qo, {}),
965
+ /* @__PURE__ */ s("fog", { attach: "fog", args: ["#07050a", 70, 160] }),
966
+ /* @__PURE__ */ s(To, {}),
967
+ /* @__PURE__ */ s(Vo, {})
968
+ ] });
969
+ function ln() {
970
+ return /* @__PURE__ */ R(
971
+ po,
972
+ {
973
+ title: "factory · neon floor",
974
+ subtitle: "Agents are machines (big = parent, compact = subagent) · belts carry crates parent → child · sparks = LLM calls · robot arms = tool calls · ⬢ docks = MCP servers with their trucks & silos · the rack is graph memory",
975
+ preset: "lanes",
976
+ plane: "xz",
977
+ camera: { position: [6, 29, 34], fov: 38, near: 0.5, far: 300 },
978
+ controls: { maxPolarAngle: 1.32 },
979
+ bg: "#07050a",
980
+ gl: { antialias: !0 },
981
+ fit: { nRef: 4, min: 0.62, max: 1.45, minRadius: 6.5 },
982
+ agentRadius: 1.6,
983
+ agentHeight: 3.1,
984
+ graph: { natural: Ft, radius: qt },
985
+ peripheryGap: 5,
986
+ Background: en,
987
+ Agent: Xo,
988
+ Edge: Co,
989
+ RunMarker: _o,
990
+ McpServer: zo,
991
+ Backend: Po,
992
+ GraphResource: Zo,
993
+ cluster: { radius: 1.35, variant: "orb", color: "#ff8a1f" },
994
+ clusterOffset: [0, 2.4, 0],
995
+ extents: Jo,
996
+ PostFX: /* @__PURE__ */ R(Zt, { multisampling: 0, children: [
997
+ /* @__PURE__ */ s($t, { mipmapBlur: !0, intensity: 0.95, luminanceThreshold: 0.32, luminanceSmoothing: 0.25, radius: 0.7 }),
998
+ /* @__PURE__ */ s(Jt, { eskil: !1, offset: 0.24, darkness: 0.85 })
999
+ ] }),
1000
+ children: [
1001
+ /* @__PURE__ */ s(Ro, {}),
1002
+ /* @__PURE__ */ s(Lo, {}),
1003
+ /* @__PURE__ */ s($o, {})
1004
+ ]
1005
+ }
1006
+ );
1007
+ }
1008
+ export {
1009
+ ln as default
1010
+ };