agentglow 0.1.0

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.
@@ -0,0 +1,688 @@
1
+ import { jsxs as g, jsx as t, Fragment as de } from "react/jsx-runtime";
2
+ import { Sparkles as ot, Stars as at, Grid as it, OrbitControls as ct } from "@react-three/drei";
3
+ import { useFrame as F, Canvas as lt } from "@react-three/fiber";
4
+ import { EffectComposer as pt, Bloom as ut, Vignette as ft, Noise as dt } from "@react-three/postprocessing";
5
+ import { useRef as G, useMemo as A, useEffect as mt, useState as fe } from "react";
6
+ import { l as ce, m as ht, j as Mt, K as gt, w as S, G as yt, T as Ee, n as wt, L as me, C as bt, R as St, S as Ce, u as xt, p as At, e as vt, a as Bt, b as Ct, c as Rt, M as Gt, f as Pt, H as Et, t as Tt, g as It, d as kt, i as zt } from "./ClusterBall-CPsd6JvJ.js";
7
+ import * as n from "three";
8
+ import { i as _t, r as He, j as Re, a as Dt } from "./spread-CWdeDFd9.js";
9
+ var qe;
10
+ const j = typeof window < "u" && !!((qe = window.matchMedia) != null && qe.call(window, "(prefers-reduced-motion: reduce)").matches), B = {
11
+ STEM: 4.6,
12
+ // where the line leaves the Graph Central concourse
13
+ PLAN: 7.6,
14
+ RES: 12,
15
+ SPLIT_A: 13.9,
16
+ // spurs fully diverged
17
+ SPLIT_B: 16.5,
18
+ // spurs start merging
19
+ MERGE: 18.3,
20
+ WRITE: 19.8,
21
+ END: 21.8
22
+ }, ye = { plan: B.PLAN, research: B.RES, write: B.WRITE }, ee = 0.05, we = 0.3, Q = 0.5, be = [270, 30, 150, 210, 330, 90];
23
+ function $e(e) {
24
+ return be[e % be.length] * Math.PI / 180 + Math.floor(e / be.length) * 0.22;
25
+ }
26
+ function Ke(e, r) {
27
+ return $e(r) + Re(e, 21) * 0.36;
28
+ }
29
+ const Le = (e) => {
30
+ const r = Math.min(1, Math.max(0, e));
31
+ return r * r * (3 - 2 * r);
32
+ };
33
+ function ue(e) {
34
+ return e <= B.RES || e >= B.MERGE ? 0 : e < B.SPLIT_A ? Le((e - B.RES) / (B.SPLIT_A - B.RES)) : e <= B.SPLIT_B ? 1 : Le(1 - (e - B.SPLIT_B) / (B.MERGE - B.SPLIT_B));
35
+ }
36
+ function Ge(e, r) {
37
+ return (e - (Math.max(1, r) - 1) / 2) * 1.45;
38
+ }
39
+ function Se(e, r, s, a, c) {
40
+ const o = Math.cos(e), l = Math.sin(e);
41
+ return c.set(o * r - l * s, a, l * r + o * s);
42
+ }
43
+ function Lt(e) {
44
+ return e === "planner" ? B.PLAN : e === "researcher" ? B.RES : e === "writer" ? B.WRITE : (B.SPLIT_A + B.SPLIT_B) / 2;
45
+ }
46
+ const Te = _t, Je = (e) => He(e);
47
+ function Ot(e) {
48
+ const r = Lt(e.type);
49
+ return Te(e.type) ? r + Re(e.id, 22) * 1.3 : r + Re(e.id, 23) * 0.7 + Dt(He(e)) * 1.3;
50
+ }
51
+ const $ = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map(), ie = { angle: 0, pos: [] };
52
+ function Qe(e, r) {
53
+ const s = ie.pos[e];
54
+ if (!s) return r.set(0, Q, 0);
55
+ const a = Math.cos(ie.angle), c = Math.sin(ie.angle);
56
+ return r.set(s.x * a + s.z * c, s.y + Q, -s.x * c + s.z * a);
57
+ }
58
+ const V = 25.5;
59
+ function et(e) {
60
+ return (e * 72 - 54) * Math.PI / 180;
61
+ }
62
+ function Ie(e, r) {
63
+ const s = et(e);
64
+ return r.set(Math.cos(s) * V, 0.9, Math.sin(s) * V);
65
+ }
66
+ function T(e, r) {
67
+ return new n.Color(e).multiplyScalar(r);
68
+ }
69
+ function tt(e, r) {
70
+ return ce.grouped ? ht(e) + 6 * Mt(e) : r;
71
+ }
72
+ const Oe = 2.55;
73
+ function Nt(e) {
74
+ const r = [];
75
+ for (let s = 0; s < e; s++) {
76
+ const a = s / e * Math.PI * 2 + (Math.random() - 0.5) * 0.1, c = Math.random() * Math.PI * 2, o = 0.25 + 0.6 * Math.sqrt(Math.random());
77
+ r.push(new n.Vector3((Oe + o * Math.cos(c)) * Math.cos(a), o * Math.sin(c) * 0.7, (Oe + o * Math.cos(c)) * Math.sin(a)));
78
+ }
79
+ return r;
80
+ }
81
+ const nt = 200, ke = (e, r) => wt(e, r) % Math.min(nt, e.nodes.length);
82
+ function Wt({ galaxy: e }) {
83
+ const r = Math.min(nt, e.nodes.length), s = G(null), a = G(null), c = G(null), o = A(() => Nt(r), [r]);
84
+ ie.pos = o;
85
+ const l = A(() => e.nodes.slice(0, r).map((i) => new n.Color(gt[i.kind] ?? "#94a3b8")), [e]), f = A(() => new Float32Array(Math.max(1, r)), [r]), m = A(() => new Uint8Array(Math.max(1, r)), [r]), d = A(() => new n.Object3D(), []), p = A(() => new n.Color(), []), P = A(() => new n.Color(5, 5, 5.5), []), C = G(/* @__PURE__ */ new Map()), M = A(() => {
86
+ const i = [];
87
+ for (let v = 0; v < r; v++) {
88
+ const R = [];
89
+ for (let u = 0; u < r; u++) {
90
+ if (v === u) continue;
91
+ const w = o[v].distanceToSquared(o[u]);
92
+ R.push([w, u]);
93
+ }
94
+ R.sort((u, w) => u[0] - w[0]);
95
+ for (const [, u] of R.slice(0, 2)) (u > v || v % 3 === 0) && i.push(o[v].x, o[v].y, o[v].z, o[u].x, o[u].y, o[u].z);
96
+ }
97
+ const h = new Map(e.nodes.slice(0, r).map((v, R) => [v.id, R]));
98
+ for (const v of e.links) {
99
+ const R = h.get(v.source), u = h.get(v.target);
100
+ R === void 0 || u === void 0 || o[R].distanceTo(o[u]) > 3 || i.push(o[R].x, o[R].y, o[R].z, o[u].x, o[u].y, o[u].z);
101
+ }
102
+ const x = new n.BufferGeometry();
103
+ return x.setAttribute("position", new n.Float32BufferAttribute(i, 3)), x;
104
+ }, [e, o]);
105
+ return F((i, h) => {
106
+ s.current && (s.current.rotation.y = ie.angle);
107
+ const x = a.current;
108
+ if (!x) return;
109
+ const v = performance.now();
110
+ f.fill(0), m.fill(0);
111
+ let R = 0;
112
+ for (const u of S.flares) {
113
+ let w = C.current.get(u.node);
114
+ w === void 0 && (w = ke(e, u.node), C.current.set(u.node, w));
115
+ const y = (v - u.start) / 1e3, E = Math.exp(-y * 1.3) * Math.min(1, y * 8);
116
+ E > f[w] && (f[w] = E), u.op === "write" && (m[w] = 1), R = Math.max(R, E);
117
+ }
118
+ for (let u = 0; u < r; u++) {
119
+ const w = f[u];
120
+ d.position.copy(o[u]), d.scale.setScalar(1 + w * (m[u] ? 4.5 : 3)), d.updateMatrix(), x.setMatrixAt(u, d.matrix), p.copy(l[u]).multiplyScalar(0.75 + w * 4), m[u] && w > 0.01 && p.lerp(P, w * 0.8), x.setColorAt(u, p);
121
+ }
122
+ x.instanceMatrix.needsUpdate = !0, x.instanceColor && (x.instanceColor.needsUpdate = !0), c.current && c.current.material.color.set("#c7d2fe").multiplyScalar(1.4 + R * 2.2 + (j ? 0 : Math.sin(v / 700) * 0.2));
123
+ }), /* @__PURE__ */ g("group", { position: [0, Q, 0], children: [
124
+ /* @__PURE__ */ g("group", { ref: s, children: [
125
+ /* @__PURE__ */ g("instancedMesh", { ref: a, args: [void 0, void 0, Math.max(1, r)], children: [
126
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.095, 10, 10] }),
127
+ /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
128
+ ] }),
129
+ /* @__PURE__ */ t("lineSegments", { geometry: M, children: /* @__PURE__ */ t("lineBasicMaterial", { color: "#8b9cff", transparent: !0, opacity: 0.42, blending: n.AdditiveBlending, depthWrite: !1 }) })
130
+ ] }),
131
+ /* @__PURE__ */ g("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -Q + 0.04, 0], children: [
132
+ /* @__PURE__ */ t("ringGeometry", { args: [B.STEM - 0.18, B.STEM + 0.18, 128] }),
133
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T("#a5b4fc", 1.3), transparent: !0, opacity: 0.55, toneMapped: !1, side: n.DoubleSide })
134
+ ] }),
135
+ /* @__PURE__ */ g("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -Q + 0.03, 0], children: [
136
+ /* @__PURE__ */ t("circleGeometry", { args: [B.STEM - 0.2, 96] }),
137
+ /* @__PURE__ */ t("meshBasicMaterial", { color: "#0b1030", transparent: !0, opacity: 0.75 })
138
+ ] }),
139
+ /* @__PURE__ */ g("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -Q + 0.05, 0], children: [
140
+ /* @__PURE__ */ t("ringGeometry", { args: [1.35, 1.45, 96] }),
141
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T("#818cf8", 1.6), transparent: !0, opacity: 0.6, toneMapped: !1 })
142
+ ] }),
143
+ /* @__PURE__ */ g("mesh", { ref: c, position: [0, 0.1, 0], children: [
144
+ /* @__PURE__ */ t("octahedronGeometry", { args: [0.55, 0] }),
145
+ /* @__PURE__ */ t("meshBasicMaterial", { color: "#c7d2fe", toneMapped: !1, wireframe: !0 })
146
+ ] }),
147
+ /* @__PURE__ */ g("mesh", { position: [0, 0.1, 0], children: [
148
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.22, 20, 20] }),
149
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T("#e0e7ff", 3), toneMapped: !1 })
150
+ ] }),
151
+ /* @__PURE__ */ t(ot, { count: j ? 20 : 60, scale: [7, 1.4, 7], size: 1.8, speed: 0.25, color: "#a5b4fc", opacity: 0.55 }),
152
+ /* @__PURE__ */ t(yt, { position: [0, 2.1, 0], suffix: " · Graph Central", color: "#a5b4fc", size: 0.36, pxRange: [9.5, 14] })
153
+ ] });
154
+ }
155
+ const ne = 48;
156
+ function Ut({ galaxy: e }) {
157
+ const r = G(null), s = G(null), a = A(() => {
158
+ const d = new n.BufferGeometry();
159
+ return d.setAttribute("position", new n.BufferAttribute(new Float32Array(ne * 6), 3)), d.setAttribute("color", new n.BufferAttribute(new Float32Array(ne * 6), 3)), d;
160
+ }, []), c = A(() => new n.Object3D(), []), o = A(() => new n.Vector3(), []), l = A(() => new n.Color(), []), f = A(() => Object.fromEntries(Object.entries(Ee).map(([d, p]) => [d, new n.Color(p)])), []), m = G(/* @__PURE__ */ new Map());
161
+ return F(() => {
162
+ const d = r.current, p = s.current;
163
+ if (!d || !p) return;
164
+ const P = performance.now(), C = a.getAttribute("position"), M = a.getAttribute("color");
165
+ let i = 0;
166
+ const h = S.flares;
167
+ for (let x = h.length - 1; x >= 0 && i < ne; x--) {
168
+ const v = h[x], R = (P - v.start) / 2600;
169
+ if (R >= 1) continue;
170
+ let u = m.current.get(v.node);
171
+ u === void 0 && (u = ke(e, v.node), m.current.set(v.node, u)), Qe(u, o);
172
+ const w = v.op === "write", y = S.instances.get(v.instance), E = y ? f[y.type] : f.researcher;
173
+ c.position.copy(o), c.rotation.set(-Math.PI / 2, 0, 0), c.scale.setScalar((w ? 0.35 : 0.2) + R * (w ? 1.6 : 0.8)), c.updateMatrix(), d.setMatrixAt(i, c.matrix), w ? l.setRGB(4, 4, 4.4).multiplyScalar(1 - R) : l.copy(E).multiplyScalar(2.4 * (1 - R)), d.setColorAt(i, l);
174
+ const I = U.get(v.instance), b = Math.min(1, (P - v.start) / 700);
175
+ if (I && R < 0.75) {
176
+ const _ = 1 - R / 0.75;
177
+ C.setXYZ(i * 2, I.pos.x, I.pos.y, I.pos.z), C.setXYZ(i * 2 + 1, o.x, o.y, o.z), w ? l.setRGB(2.6, 2.6, 3).multiplyScalar(_) : l.copy(E).multiplyScalar(1.2 * _), M.setXYZ(i * 2, l.r, l.g, l.b), M.setXYZ(i * 2 + 1, l.r * 0.7, l.g * 0.7, l.b * 0.7);
178
+ const z = w ? b : 1 - b;
179
+ c.position.set(I.pos.x + (o.x - I.pos.x) * z, I.pos.y + (o.y - I.pos.y) * z + Math.sin(z * Math.PI) * 0.6, I.pos.z + (o.z - I.pos.z) * z), c.rotation.set(0, 0, 0), c.scale.setScalar(b >= 1 ? 1e-4 : w ? 1.4 : 1), c.updateMatrix(), p.setMatrixAt(i, c.matrix), w ? l.setRGB(6, 6, 6.5) : l.copy(E).multiplyScalar(4), p.setColorAt(i, l);
180
+ } else
181
+ C.setXYZ(i * 2, 0, 0, 0), C.setXYZ(i * 2 + 1, 0, 0, 0), c.scale.setScalar(1e-4), c.updateMatrix(), p.setMatrixAt(i, c.matrix);
182
+ i++;
183
+ }
184
+ d.count = i, p.count = i, d.instanceMatrix.needsUpdate = !0, p.instanceMatrix.needsUpdate = !0, d.instanceColor && (d.instanceColor.needsUpdate = !0), p.instanceColor && (p.instanceColor.needsUpdate = !0), a.setDrawRange(0, i * 2), C.needsUpdate = !0, M.needsUpdate = !0;
185
+ }), /* @__PURE__ */ g("group", { children: [
186
+ /* @__PURE__ */ g("instancedMesh", { ref: r, args: [void 0, void 0, ne], frustumCulled: !1, children: [
187
+ /* @__PURE__ */ t("torusGeometry", { args: [1, 0.05, 6, 40] }),
188
+ /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
189
+ ] }),
190
+ /* @__PURE__ */ g("instancedMesh", { ref: s, args: [void 0, void 0, ne], frustumCulled: !1, children: [
191
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.1, 10, 10] }),
192
+ /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
193
+ ] }),
194
+ /* @__PURE__ */ t("lineSegments", { geometry: a, frustumCulled: !1, children: /* @__PURE__ */ t("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
195
+ ] });
196
+ }
197
+ function Ne({ galaxy: e, op: r }) {
198
+ const s = G(null), a = G(null), c = G(0);
199
+ return F(() => {
200
+ const o = performance.now();
201
+ let l = null;
202
+ for (let m = S.flares.length - 1; m >= 0; m--) if (S.flares[m].op === r) {
203
+ l = S.flares[m];
204
+ break;
205
+ }
206
+ const f = l ? o - l.start : 1e9;
207
+ if (!(!s.current || !a.current)) {
208
+ if (!l || f > 1700) {
209
+ a.current.setOpacity(0);
210
+ return;
211
+ }
212
+ l.id !== c.current && (c.current = l.id, a.current.setText((r === "write" ? "wrote · " : "") + l.node), Qe(ke(e, l.node), s.current.position)), a.current.setOpacity(Math.min(1, (1700 - f) / 400));
213
+ }
214
+ }), /* @__PURE__ */ t("group", { ref: s, children: /* @__PURE__ */ t(me, { ref: a, position: [0, r === "write" ? 1.1 : 0.7, 0], text: "", color: r === "write" ? "#ffffff" : "#a5b4fc", size: 0.28, opacity: 0, fadeMs: 200, pxRange: [8, 12] }) });
215
+ }
216
+ function Vt({ galaxy: e }) {
217
+ return /* @__PURE__ */ g(de, { children: [
218
+ /* @__PURE__ */ t(Ne, { galaxy: e, op: "read" }),
219
+ /* @__PURE__ */ t(Ne, { galaxy: e, op: "write" })
220
+ ] });
221
+ }
222
+ function Ft(e, r) {
223
+ const s = ce.laneExpanded[e] > 0, a = $e(e) - (s ? 0.45 : 0), c = s ? 15.5 : 15;
224
+ return r.set(Math.cos(a) * c, 1.9, Math.sin(a) * c);
225
+ }
226
+ function Yt() {
227
+ return /* @__PURE__ */ t(bt, { place: Ft, radius: 1.9, variant: "stars", pointSize: 1.1 });
228
+ }
229
+ const xe = { queued: "#64748b", running: "#fbbf24", done: "#22c55e", failed: "#ef4444" };
230
+ function We(e, r, s) {
231
+ const a = new n.LineCurve3(new n.Vector3(e, ee, 0), new n.Vector3(r, ee, 0));
232
+ return new n.TubeGeometry(a, 1, s, 8, !1);
233
+ }
234
+ function Ue(e, r) {
235
+ const s = [];
236
+ for (let a = 0; a <= 40; a++) {
237
+ const c = B.RES + (B.MERGE - B.RES) * a / 40;
238
+ s.push(new n.Vector3(c, ee, e * ue(c)));
239
+ }
240
+ return new n.TubeGeometry(new n.CatmullRomCurve3(s), 80, r, 8, !1);
241
+ }
242
+ function Xt({ runId: e, slot: r, color: s, scouts: a }) {
243
+ const c = Ke(e, r), o = G(null), l = G(null), f = G([]), m = G([]), d = G(null), p = G(null), P = A(() => new n.Color(), []), C = A(
244
+ () => ({
245
+ trunk: We(B.STEM, B.END, 0.075),
246
+ trunkGlow: We(B.STEM, B.END, 0.26),
247
+ spurs: Array.from({ length: a }, (i, h) => Ue(Ge(h, a), 0.06)),
248
+ spursGlow: Array.from({ length: a }, (i, h) => Ue(Ge(h, a), 0.22))
249
+ }),
250
+ [a]
251
+ ), M = A(
252
+ () => ({
253
+ trunk: new n.MeshBasicMaterial({ color: T(s, 1.5), toneMapped: !1, transparent: !0 }),
254
+ glow: new n.MeshBasicMaterial({ color: T(s, 0.5), toneMapped: !1, transparent: !0, opacity: 0.22, blending: n.AdditiveBlending, depthWrite: !1 }),
255
+ spur: new n.MeshBasicMaterial({ color: T(s, 1.9), toneMapped: !1, transparent: !0 }),
256
+ platform: new n.MeshBasicMaterial({ color: T(s, 0.35), toneMapped: !1, transparent: !0, opacity: 0.6 })
257
+ }),
258
+ [s]
259
+ );
260
+ return F(({ clock: i }) => {
261
+ const h = S.runs.get(e);
262
+ if (!h) return;
263
+ const x = performance.now(), v = i.elapsedTime, R = Math.min(1, (x - h.startedAt) / 1300), u = 1 - Math.pow(1 - R, 3), w = h.endedAt ? Math.max(0, 1 - (x - h.endedAt) / St) : 1;
264
+ o.current && o.current.scale.set(Math.max(1e-3, u), 1, 1), l.current && l.current.scale.setScalar(Math.max(1e-3, Math.min(1, (R - 0.3) * 1.6))), M.trunk.opacity = w, M.glow.opacity = 0.22 * w, M.spur.opacity = w * (h.steps.research === "queued" ? 0.25 : 1), M.platform.opacity = 0.6 * w, Ce.forEach((z, D) => {
265
+ const L = h.steps[z], N = f.current[D], Y = L === "running", Z = Y ? j ? 0.5 : 0.5 + 0.5 * Math.sin(v * 5.5) : 0;
266
+ N && (P.set(xe[L] ?? xe.queued).multiplyScalar((L === "queued" ? 0.6 : Y ? 1.8 + Z * 2.2 : 2.4) * w), N.material.color.copy(P), N.scale.setScalar(Y ? 1.05 + Z * 0.22 : 1));
267
+ const O = m.current[D];
268
+ if (O) {
269
+ O.visible = Y || L === "done";
270
+ const le = O.material;
271
+ le.color.set(xe[L]).multiplyScalar(Y ? 1.2 + Z : 0.5), le.opacity = (Y ? 0.5 : 0.18) * w, O.scale.y = Y ? 1 : 0.45;
272
+ }
273
+ });
274
+ const y = h.handoffAt ? (x - h.handoffAt) / 1200 : 2, E = ye[h.handoffFrom], I = ye[h.handoffTo], b = y >= 1 ? 1 : 1 - Math.pow(1 - Math.max(0, y), 3), _ = E + (I - E) * b;
275
+ if (d.current && (d.current.position.set(_, 0.32, 0), d.current.scale.setScalar(y < 1 ? 1 : 1e-3)), p.current) {
276
+ const z = y < 1.6;
277
+ if (p.current.visible = z, z) {
278
+ const D = Math.max(0.01, _ - E);
279
+ p.current.position.set(E + D / 2, ee + 0.02, 0), p.current.scale.set(D, 1, 1), p.current.material.opacity = y < 1 ? 0.9 : Math.max(0, 1 - (y - 1) / 0.6) * 0.9;
280
+ }
281
+ }
282
+ }), /* @__PURE__ */ g("group", { rotation: [0, -c, 0], children: [
283
+ /* @__PURE__ */ g("group", { ref: o, children: [
284
+ /* @__PURE__ */ t("mesh", { geometry: C.trunk, material: M.trunk }),
285
+ /* @__PURE__ */ t("mesh", { geometry: C.trunkGlow, material: M.glow }),
286
+ C.spurs.map((i, h) => /* @__PURE__ */ t("mesh", { geometry: i, material: M.spur }, h)),
287
+ C.spursGlow.map((i, h) => /* @__PURE__ */ t("mesh", { geometry: i, material: M.glow }, `g${h}`)),
288
+ /* @__PURE__ */ t("mesh", { position: [B.END, ee + 0.12, 0], material: M.trunk, children: /* @__PURE__ */ t("boxGeometry", { args: [0.12, 0.25, 0.9] }) })
289
+ ] }),
290
+ /* @__PURE__ */ g("group", { ref: l, children: [
291
+ Ce.map((i, h) => /* @__PURE__ */ g("group", { position: [ye[i], ee, 0], children: [
292
+ /* @__PURE__ */ g("mesh", { ref: (x) => void (f.current[h] = x), rotation: [-Math.PI / 2, 0, 0], position: [0, 0.03, 0], children: [
293
+ /* @__PURE__ */ t("ringGeometry", { args: [0.62, 0.86, 48] }),
294
+ /* @__PURE__ */ t("meshBasicMaterial", { color: "#64748b", toneMapped: !1, transparent: !0, side: n.DoubleSide })
295
+ ] }),
296
+ /* @__PURE__ */ g("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.02, 0], children: [
297
+ /* @__PURE__ */ t("circleGeometry", { args: [0.6, 40] }),
298
+ /* @__PURE__ */ t("meshBasicMaterial", { color: "#060a18" })
299
+ ] }),
300
+ /* @__PURE__ */ t("mesh", { position: [0, 0.02, -1.15], rotation: [-Math.PI / 2, 0, 0], material: M.platform, children: /* @__PURE__ */ t("planeGeometry", { args: [2.2, 0.32] }) }),
301
+ /* @__PURE__ */ g("mesh", { ref: (x) => void (m.current[h] = x), position: [0, 1.6, 0], visible: !1, children: [
302
+ /* @__PURE__ */ t("cylinderGeometry", { args: [0.07, 0.3, 3.2, 12, 1, !0] }),
303
+ /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide })
304
+ ] }),
305
+ /* @__PURE__ */ t(me, { position: [0, 0, -1.75], text: i, color: s, textColor: "#cbd5e1", uppercase: !0, letterSpacing: 0.08, size: 0.26, opacity: 0.85, pxRange: [7.5, 11] })
306
+ ] }, i)),
307
+ /* @__PURE__ */ t(Zt, { runId: e, color: s })
308
+ ] }),
309
+ /* @__PURE__ */ g("mesh", { ref: p, visible: !1, children: [
310
+ /* @__PURE__ */ t("boxGeometry", { args: [1, 0.05, 0.28] }),
311
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T("#fde68a", 3), toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
312
+ ] }),
313
+ /* @__PURE__ */ g("mesh", { ref: d, position: [B.PLAN, 0.32, 0], scale: 1e-3, children: [
314
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.22, 14, 14] }),
315
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T("#fff7d6", 7), toneMapped: !1 })
316
+ ] })
317
+ ] });
318
+ }
319
+ const jt = { running: "#fde68a", done: "#bbf7d0", failed: "#fecaca", queued: "#64748b" };
320
+ function Zt({ runId: e, color: r }) {
321
+ const a = xt().runs.get(e);
322
+ if (!a) return null;
323
+ const c = [];
324
+ return Ce.forEach((o, l) => c.push({ text: `${l ? " " : ""}${o.toUpperCase()}`, color: jt[a.steps[o]] ?? "#94a3b8" })), /* @__PURE__ */ t(
325
+ me,
326
+ {
327
+ position: [B.END + 1.9, 0.2, 0],
328
+ anchorX: "left",
329
+ textAlign: "left",
330
+ plate: "box",
331
+ text: `${a.hasSteps ? "hatchet · " : ""}${a.topic}`,
332
+ secondary: c,
333
+ letterSpacing: 0.02,
334
+ color: r,
335
+ size: 0.34,
336
+ secondarySize: 0.24,
337
+ maxWidth: 11,
338
+ opacity: a.status === "started" ? 1 : 0.55,
339
+ fadeMs: 300,
340
+ pxRange: [9.5, 13.5]
341
+ }
342
+ );
343
+ }
344
+ const W = {
345
+ body: new n.CapsuleGeometry(0.27, 0.95, 6, 16).rotateZ(Math.PI / 2),
346
+ window: new n.BoxGeometry(0.2, 0.1, 0.57),
347
+ roof: new n.BoxGeometry(1.1, 0.04, 0.12),
348
+ lamp: new n.SphereGeometry(0.075, 12, 12),
349
+ beam: new n.ConeGeometry(0.35, 1.6, 20, 1, !0).rotateZ(Math.PI / 2),
350
+ halo: new n.SphereGeometry(0.62, 20, 20),
351
+ shimmer: new n.CylinderGeometry(0.75, 0.75, 3.2, 28, 1, !0),
352
+ portal: new n.TorusGeometry(0.75, 0.07, 10, 48),
353
+ portalDisc: new n.CircleGeometry(0.72, 40),
354
+ sel: new n.RingGeometry(0.95, 1.08, 48)
355
+ }, qt = [-0.48, -0.16, 0.16, 0.48], H = new n.Vector3(), re = new n.Vector3();
356
+ function Ht({ id: e, selected: r, onSelect: s }) {
357
+ const a = S.instances.get(e), c = Ee[a.type], o = Te(a.type), l = A(() => o ? Je(a) : 0, [a, o]), f = A(() => Ot(a), [a]), m = G(null), d = G(null), p = G(null), P = G(null), C = G(null), M = G(null), i = A(
358
+ () => ({
359
+ body: new n.MeshStandardMaterial({ color: new n.Color(c).multiplyScalar(0.18), emissive: new n.Color(c), emissiveIntensity: 0.6, metalness: 0.55, roughness: 0.3, transparent: !0, toneMapped: !1 }),
360
+ win: new n.MeshBasicMaterial({ color: T(c, 2.5), toneMapped: !1, transparent: !0 }),
361
+ lampF: new n.MeshBasicMaterial({ color: T("#ffffff", 6), toneMapped: !1, transparent: !0 }),
362
+ lampR: new n.MeshBasicMaterial({ color: T("#ff3355", 3), toneMapped: !1, transparent: !0 }),
363
+ beam: new n.MeshBasicMaterial({ color: T("#fff7e0", 0.9), toneMapped: !1, transparent: !0, opacity: 0.14, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
364
+ halo: new n.MeshBasicMaterial({ color: T(c, 1), toneMapped: !1, transparent: !0, opacity: 0.1, blending: n.AdditiveBlending, depthWrite: !1 }),
365
+ shimmer: new n.MeshBasicMaterial({ color: T(c, 2), toneMapped: !1, transparent: !0, opacity: 0, blending: n.AdditiveBlending, depthWrite: !1, side: n.DoubleSide }),
366
+ portal: new n.MeshBasicMaterial({ color: T(c, 3), toneMapped: !1, transparent: !0 }),
367
+ portalDisc: new n.MeshBasicMaterial({ color: new n.Color("#000000"), transparent: !0, opacity: 0.85, side: n.DoubleSide }),
368
+ sel: new n.MeshBasicMaterial({ color: T("#ffffff", 2.5), toneMapped: !1, transparent: !0, side: n.DoubleSide })
369
+ }),
370
+ [c]
371
+ ), h = A(() => new n.Color(c), [c]), x = A(() => new n.Color("#ffffff"), []), v = G({ r: -1, phase: Math.random() * 6, dir: 1, exitR: 0, exitYaw: 0, exitPos: new n.Vector3(), yaw: 0, slot: 0 });
372
+ mt(() => {
373
+ const u = { pos: new n.Vector3(), r: 0 };
374
+ return U.set(e, u), () => void U.delete(e);
375
+ }, [e]), F(({ clock: u }, w) => {
376
+ const y = S.instances.get(e), E = m.current;
377
+ if (!y || !E) return;
378
+ const I = S.runs.get(y.run), b = v.current;
379
+ I && (b.slot = I.slot);
380
+ const _ = Ke(y.run, tt(y.run, b.slot)), z = Math.min(0.05, w), D = performance.now(), L = At(y, D), N = vt(y, D), Y = $.get(y.run) ?? l + 1, Z = o ? Ge(l, Y) : 0;
381
+ let O = !1;
382
+ for (const k of S.mcpPending.values()) k.instance === e && (O = !0);
383
+ if (b.r < 0) {
384
+ const k = y.parent ? U.get(y.parent) : null;
385
+ b.r = k ? k.r : B.STEM;
386
+ }
387
+ const le = b.r;
388
+ let he = f, Me = 2.2;
389
+ if (y.exitAt)
390
+ b.exitR || (b.exitR = b.r), he = b.exitR + 3.4, Me = 1.6;
391
+ else if (y.status === "thinking") {
392
+ b.phase += z * (j ? 0.25 : 0.8 + N * 2.4) * (O ? 0.25 : 1);
393
+ const k = o ? 1.05 : y.type === "researcher" ? 1.5 : 1.6;
394
+ he = f + k * Math.sin(b.phase), Me = 3;
395
+ }
396
+ b.r += (he - b.r) * (1 - Math.exp(-z * Me));
397
+ const ze = b.r - le;
398
+ Math.abs(ze) > 15e-4 && (b.dir = ze > 0 ? 1 : -1), Se(_, b.r, Z * ue(b.r), we, H), Se(_, b.r + 0.05, Z * ue(b.r + 0.05), we, re), E.position.copy(H);
399
+ const _e = Math.atan2(-(re.z - H.z), re.x - H.x);
400
+ b.yaw = _e, E.rotation.y = _e;
401
+ const ge = U.get(e);
402
+ ge && (ge.pos.copy(H), ge.r = b.r);
403
+ const pe = u.elapsedTime, K = y.status === "waiting" || O, te = j ? 0.5 : 0.5 + 0.5 * Math.sin(pe * (O ? 2.2 : 1.4) + b.phase), X = y.exitAt ? Math.min(1, (D - y.exitAt) / Bt(y)) : 0;
404
+ if (d.current) {
405
+ const k = (o ? 1.1 : 1.35) * Ct();
406
+ y.exitAt ? d.current.scale.set(k * (1 + X * 1.8), k * Math.max(0.05, 1 - X), k * Math.max(0.05, 1 - X)) : d.current.scale.setScalar(k * Math.max(1e-3, L) * (1 + N * 0.06) * (O ? 1 + te * 0.06 : 1)), d.current.scale.x *= b.dir;
407
+ }
408
+ const rt = y.exitAt ? 3 * (1 - X) : K ? 0.25 + te * (O ? 0.9 : 0.35) : 1.1 + N * 2.6;
409
+ i.body.emissiveIntensity = rt, i.body.opacity = Math.min(1, L * 1.2);
410
+ const st = y.exitAt ? 4 * (1 - X) : K ? 0.5 + te * (O ? 1.4 : 0.5) : 2.2 + N * 3;
411
+ i.win.color.copy(h).multiplyScalar(st), y.exitAt && X < 0.25 && i.win.color.lerp(x, 1 - X * 4).multiplyScalar(1.5), i.win.opacity = L, i.lampF.opacity = L * (K ? 0.4 : 1), i.lampR.opacity = L, i.beam.opacity = (K ? 0.04 : 0.13 + N * 0.08) * L, p.current && (p.current.scale.setScalar(0.9 + N * 0.6 + (K ? te * 0.25 : 0)), i.halo.opacity = L * (K ? 0.04 + te * 0.04 : 0.07 + N * 0.08));
412
+ const De = (D - y.bornAt) / 1e3;
413
+ if (P.current) {
414
+ const k = De < 1.2;
415
+ if (P.current.visible = k, k) {
416
+ const q = De / 1.2;
417
+ P.current.scale.set(1 - q * 0.5, Math.min(1, q * 4), 1 - q * 0.5), P.current.rotation.y = pe * 3, i.shimmer.opacity = 0.75 * (1 - q) * (0.75 + 0.25 * Math.sin(pe * 40));
418
+ }
419
+ }
420
+ if (C.current) {
421
+ const k = !!y.exitAt;
422
+ if (C.current.visible = k, k) {
423
+ b.exitPos.lengthSq() || Se(_, b.exitR + 2.7, Z * ue(b.exitR + 2.7), we + 0.15, b.exitPos), C.current.position.copy(b.exitPos), C.current.rotation.set(0, Math.atan2(re.x - H.x, re.z - H.z), 0);
424
+ const q = Math.sin(Math.PI * Math.min(1, X * 1.15));
425
+ C.current.scale.setScalar(Math.max(1e-3, q) * (o ? 0.85 : 1)), i.portal.color.copy(h).multiplyScalar(2 + 3 * q);
426
+ }
427
+ }
428
+ M.current && (M.current.visible = r, M.current.rotation.z = pe);
429
+ });
430
+ const R = (u) => {
431
+ u.stopPropagation(), s(e);
432
+ };
433
+ return /* @__PURE__ */ g(de, { children: [
434
+ /* @__PURE__ */ g("group", { ref: m, children: [
435
+ /* @__PURE__ */ g("group", { ref: d, children: [
436
+ /* @__PURE__ */ t("mesh", { geometry: W.body, material: i.body, onClick: R, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
437
+ qt.map((u) => /* @__PURE__ */ t("mesh", { geometry: W.window, material: i.win, position: [u, 0.06, 0] }, u)),
438
+ /* @__PURE__ */ t("mesh", { geometry: W.roof, material: i.win, position: [0, 0.27, 0] }),
439
+ /* @__PURE__ */ t("mesh", { geometry: W.lamp, material: i.lampF, position: [0.74, 0.02, 0] }),
440
+ /* @__PURE__ */ t("mesh", { geometry: W.lamp, material: i.lampR, position: [-0.74, 0.02, 0], scale: 0.7 }),
441
+ /* @__PURE__ */ t("mesh", { geometry: W.beam, material: i.beam, position: [1.55, -0.05, 0] })
442
+ ] }),
443
+ /* @__PURE__ */ t("mesh", { ref: p, geometry: W.halo, material: i.halo }),
444
+ /* @__PURE__ */ t("mesh", { ref: P, geometry: W.shimmer, material: i.shimmer, position: [0, 1.2, 0], visible: !1 }),
445
+ /* @__PURE__ */ t("mesh", { ref: M, geometry: W.sel, material: i.sel, rotation: [-Math.PI / 2, 0, 0], position: [0, -0.22, 0], visible: !1 })
446
+ ] }),
447
+ /* @__PURE__ */ g("group", { ref: C, visible: !1, children: [
448
+ /* @__PURE__ */ t("mesh", { geometry: W.portal, material: i.portal }),
449
+ /* @__PURE__ */ t("mesh", { geometry: W.portalDisc, material: i.portalDisc })
450
+ ] })
451
+ ] });
452
+ }
453
+ const se = new n.Vector3();
454
+ function Pe(e, r, s, a, c) {
455
+ se.copy(e).add(r).multiplyScalar(0.5), se.y += a;
456
+ const o = 1 - s;
457
+ return c.set(o * o * e.x + 2 * o * s * se.x + s * s * r.x, o * o * e.y + 2 * o * s * se.y + s * s * r.y, o * o * e.z + 2 * o * s * se.z + s * s * r.z);
458
+ }
459
+ const $t = new n.Vector3(0, 0.6, 0), Ae = (e) => {
460
+ var r;
461
+ return ((r = U.get(e)) == null ? void 0 : r.pos) ?? $t;
462
+ }, J = 10, Ve = 48, Fe = new n.Vector3(), ve = new n.Vector3(), oe = new n.Object3D(), Ye = new n.Color(), Xe = Object.fromEntries(Object.entries(Ee).map(([e, r]) => [e, new n.Color(r)])), je = /* @__PURE__ */ new Map();
463
+ function Kt() {
464
+ const e = G(null);
465
+ return F(() => {
466
+ const r = e.current;
467
+ if (!r) return;
468
+ const s = performance.now();
469
+ let a = 0;
470
+ const c = (l, f, m, d, p, P, C) => {
471
+ for (let M = 0; M < J && a < Ve * J; M++) {
472
+ const i = m - M / J * C;
473
+ i < 0 || m >= 1 ? oe.scale.setScalar(1e-4) : (Pe(l, f, i, d, Fe), oe.position.copy(Fe), oe.scale.setScalar(P * (1 - M / J * 0.75))), oe.updateMatrix(), r.setMatrixAt(a, oe.matrix), Ye.copy(p).multiplyScalar(M === 0 ? 5 : 3 * (1 - M / J)), r.setColorAt(a, Ye), a++;
474
+ }
475
+ }, o = ce.grouped;
476
+ for (const l of S.comets) {
477
+ if (o && (!U.has(l.from) || !U.has(l.to))) continue;
478
+ const f = Math.min(1, (s - l.start) / l.dur), m = f < 0.5 ? 2 * f * f : 1 - Math.pow(-2 * f + 2, 2) / 2, d = S.instances.get(l.from);
479
+ c(Ae(l.from), Ae(l.to), m, 0.9, d ? Xe[d.type] : Xe.planner, 1, 0.22);
480
+ }
481
+ for (const l of S.mcpCalls) {
482
+ const f = S.mcpServers.get(l.server);
483
+ if (!f || o && !U.has(l.instance)) continue;
484
+ Ie(f.slot, ve);
485
+ const m = Math.min(1, (s - l.start) / l.dur), d = 1 - Math.pow(1 - m, 2.2);
486
+ let p = je.get(f.name);
487
+ p || je.set(f.name, p = new n.Color(f.color));
488
+ const P = Ae(l.instance);
489
+ l.phase === "call" ? c(P, ve, d, 3.2, p, 1.5, 0.3) : c(ve, P, d, 3.2, Jt, 1.5, 0.3);
490
+ }
491
+ r.count = a, r.instanceMatrix.needsUpdate = !0, r.instanceColor && (r.instanceColor.needsUpdate = !0);
492
+ }), /* @__PURE__ */ g("instancedMesh", { ref: e, args: [void 0, void 0, Ve * J], frustumCulled: !1, children: [
493
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.12, 10, 10] }),
494
+ /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1 })
495
+ ] });
496
+ }
497
+ const Jt = new n.Color("#ffffff"), Ze = new n.Vector3();
498
+ function Qt({ name: e }) {
499
+ const r = S.mcpServers.get(e), s = r.color ?? Gt[e] ?? "#94a3b8", a = et(r.slot), c = G(null), o = G(null), l = G(null), f = A(() => {
500
+ const p = [];
501
+ for (let M = 0; M < 20; M += 1) {
502
+ const i = a - 0.42 + 0.84 * M / 20, h = i + 0.84 / 20 * 0.6;
503
+ p.push(Math.cos(i) * V, 0.04, Math.sin(i) * V, Math.cos(h) * V, 0.04, Math.sin(h) * V);
504
+ }
505
+ const C = new n.BufferGeometry();
506
+ return C.setAttribute("position", new n.Float32BufferAttribute(p, 3)), C;
507
+ }, [a]), m = A(() => new n.LineBasicMaterial({ color: T(s, 0.9), transparent: !0, opacity: 0.45, toneMapped: !1 }), [s]);
508
+ Ie(r.slot, Ze);
509
+ const d = A(() => Ze.clone(), [r.slot]);
510
+ return F(({ clock: p }, P) => {
511
+ const C = S.mcpServers.get(e);
512
+ if (!C) return;
513
+ const M = performance.now(), i = Math.exp(-(M - C.activeAt) / 450), h = C.inflight > 0;
514
+ c.current && (c.current.rotation.y += P * (j ? 0.1 : h ? 2.4 : 0.25)), o.current && (o.current.material.color.set(s).multiplyScalar(1.5 + i * 5 + (h ? 1 + Math.sin(p.elapsedTime * 8) : 0)), o.current.scale.setScalar(1 + i * 0.8)), l.current && l.current.material.color.set(s).multiplyScalar(0.5 + i * 2 + (h ? 0.6 : 0)), m.opacity = 0.3 + i * 0.6 + (h ? 0.25 : 0);
515
+ }), /* @__PURE__ */ g("group", { children: [
516
+ /* @__PURE__ */ t("lineSegments", { geometry: f, material: m }),
517
+ /* @__PURE__ */ g("group", { position: d, children: [
518
+ /* @__PURE__ */ g("mesh", { ref: l, rotation: [-Math.PI / 2, 0, 0], position: [0, -0.85, 0], children: [
519
+ /* @__PURE__ */ t("ringGeometry", { args: [1.25, 1.55, 6] }),
520
+ /* @__PURE__ */ t("meshBasicMaterial", { color: s, toneMapped: !1, side: n.DoubleSide })
521
+ ] }),
522
+ /* @__PURE__ */ g("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, -0.86, 0], children: [
523
+ /* @__PURE__ */ t("circleGeometry", { args: [1.25, 6] }),
524
+ /* @__PURE__ */ t("meshBasicMaterial", { color: "#070b18" })
525
+ ] }),
526
+ /* @__PURE__ */ g("mesh", { position: [0, -0.35, 0], children: [
527
+ /* @__PURE__ */ t("cylinderGeometry", { args: [0.18, 0.3, 1, 8] }),
528
+ /* @__PURE__ */ t("meshStandardMaterial", { color: "#111827", emissive: s, emissiveIntensity: 0.4, metalness: 0.6, roughness: 0.3 })
529
+ ] }),
530
+ /* @__PURE__ */ g("group", { ref: c, position: [0, 0.3, 0], children: [
531
+ /* @__PURE__ */ g("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
532
+ /* @__PURE__ */ t("torusGeometry", { args: [0.85, 0.045, 8, 48] }),
533
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T(s, 2), toneMapped: !1 })
534
+ ] }),
535
+ /* @__PURE__ */ g("mesh", { rotation: [Math.PI / 2.6, 0, 0], children: [
536
+ /* @__PURE__ */ t("torusGeometry", { args: [0.62, 0.03, 8, 40] }),
537
+ /* @__PURE__ */ t("meshBasicMaterial", { color: T(s, 1.6), toneMapped: !1 })
538
+ ] })
539
+ ] }),
540
+ /* @__PURE__ */ g("mesh", { ref: o, position: [0, 0.3, 0], children: [
541
+ /* @__PURE__ */ t("sphereGeometry", { args: [0.2, 16, 16] }),
542
+ /* @__PURE__ */ t("meshBasicMaterial", { color: s, toneMapped: !1 })
543
+ ] }),
544
+ /* @__PURE__ */ t(me, { position: [0, 1.55, 0], text: e, color: s, size: 0.34, pxRange: [9, 13] })
545
+ ] })
546
+ ] });
547
+ }
548
+ function en() {
549
+ const e = A(() => {
550
+ const r = [];
551
+ for (let c = 0; c < 180; c++) {
552
+ const o = c / 180 * Math.PI * 2, l = o + Math.PI * 2 / 180 * 0.5;
553
+ r.push(Math.cos(o) * V, 0.03, Math.sin(o) * V, Math.cos(l) * V, 0.03, Math.sin(l) * V);
554
+ }
555
+ const a = new n.BufferGeometry();
556
+ return a.setAttribute("position", new n.Float32BufferAttribute(r, 3)), a;
557
+ }, []);
558
+ return /* @__PURE__ */ t("lineSegments", { geometry: e, children: /* @__PURE__ */ t("lineBasicMaterial", { color: "#6366f1", transparent: !0, opacity: 0.28 }) });
559
+ }
560
+ function tn() {
561
+ const [e, r] = fe([]), s = G(0);
562
+ return F(() => {
563
+ S.mcpServers.size !== s.current && (s.current = S.mcpServers.size, r([...S.mcpServers.keys()]));
564
+ }), /* @__PURE__ */ g("group", { children: [
565
+ /* @__PURE__ */ t(en, {}),
566
+ e.map((a) => /* @__PURE__ */ t(Qt, { name: a }, a))
567
+ ] });
568
+ }
569
+ const ae = 36, Be = 24;
570
+ function nn() {
571
+ const e = A(() => {
572
+ const m = new n.BufferGeometry();
573
+ return m.setAttribute("position", new n.BufferAttribute(new Float32Array(Be * ae * 6), 3)), m.setAttribute("color", new n.BufferAttribute(new Float32Array(Be * ae * 6), 3)), m;
574
+ }, []), r = A(() => new n.Vector3(), []), s = A(() => new n.Vector3(), []), a = A(() => new n.Vector3(), []), c = A(() => new n.Color(), []), o = A(() => new n.Color("#fbbf24"), []), l = A(() => new n.Color("#ef4444"), []), f = A(() => new n.Color(), []);
575
+ return F(({ clock: m }) => {
576
+ const d = e.getAttribute("position"), p = e.getAttribute("color"), P = performance.now(), C = m.elapsedTime;
577
+ let M = 0, i = 0;
578
+ const h = (x, v, R, u) => {
579
+ const w = S.mcpServers.get(v), y = U.get(x);
580
+ if (!(!w || !y || i >= Be)) {
581
+ if (i++, Ie(w.slot, r), c.set(w.color), R === "pending") {
582
+ const E = u;
583
+ E < 1 ? c.lerp(o, E) : c.copy(o).lerp(l, Math.min(1, (E - 1) / 1));
584
+ }
585
+ for (let E = 0; E < ae; E++) {
586
+ const I = E / ae, b = (E + 1) / ae;
587
+ Pe(y.pos, r, I, 3.2, s), Pe(y.pos, r, b, 3.2, a);
588
+ let _;
589
+ if (R === "pending") {
590
+ const z = ((I * 7 - C * (j ? 0.4 : 1.8)) % 1 + 1) % 1;
591
+ _ = (0.35 + Math.min(1.6, u * 0.8)) * (0.25 + (z < 0.35 ? 1.6 : 0));
592
+ } else {
593
+ const z = 1 - u, D = Math.abs(I - z);
594
+ _ = Math.exp(-D * D * 120) * 7 + 0.6 * (1 - u), c.set("#ffffff");
595
+ }
596
+ f.copy(c).multiplyScalar(_), d.setXYZ(M, s.x, s.y, s.z), p.setXYZ(M++, f.r, f.g, f.b), d.setXYZ(M, a.x, a.y, a.z), p.setXYZ(M++, f.r, f.g, f.b);
597
+ }
598
+ }
599
+ };
600
+ for (const x of S.mcpPending.values()) h(x.instance, x.server, "pending", Rt(x, P));
601
+ for (const x of S.mcpResolved) h(x.instance, x.server, "resolved", Math.min(1, (P - x.resolvedAt) / 700));
602
+ e.setDrawRange(0, M), d.needsUpdate = !0, p.needsUpdate = !0;
603
+ }), /* @__PURE__ */ t("lineSegments", { geometry: e, frustumCulled: !1, children: /* @__PURE__ */ t("lineBasicMaterial", { vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) });
604
+ }
605
+ function rn({ selected: e, onSelect: r }) {
606
+ const [s, a] = fe([]), [c, o] = fe([]), l = G({ ids: /* @__PURE__ */ new Set(), runs: /* @__PURE__ */ new Set(), scouts: -1, version: -1 });
607
+ return F(() => {
608
+ Tt(), It();
609
+ let f = 0;
610
+ for (const p of S.instances.values()) {
611
+ if (!Te(p.type)) continue;
612
+ const P = Je(p) + 1;
613
+ P > ($.get(p.run) ?? 0) && $.set(p.run, P);
614
+ }
615
+ for (const p of S.runs.keys()) f += $.get(p) ?? 0;
616
+ const m = l.current;
617
+ let d = m.version !== ce.version || m.scouts !== f || m.ids.size !== S.instances.size || m.runs.size !== S.runs.size;
618
+ if (!d) {
619
+ for (const p of S.instances.keys()) if (!m.ids.has(p)) {
620
+ d = !0;
621
+ break;
622
+ }
623
+ }
624
+ if (!d) {
625
+ for (const p of S.runs.keys()) if (!m.runs.has(p)) {
626
+ d = !0;
627
+ break;
628
+ }
629
+ }
630
+ if (d) {
631
+ m.version = ce.version, m.scouts = f, m.ids = new Set(S.instances.keys()), m.runs = new Set(S.runs.keys()), a([...S.runs.values()].filter((p) => kt(p.id)).map((p) => ({ id: p.id, slot: tt(p.id, p.slot), color: p.color, scouts: $.get(p.id) ?? 0 }))), o([...S.instances.values()].filter(zt).map((p) => p.id));
632
+ for (const p of $.keys()) S.runs.has(p) || $.delete(p);
633
+ }
634
+ }), /* @__PURE__ */ g(de, { children: [
635
+ s.map((f) => /* @__PURE__ */ t(Xt, { runId: f.id, slot: f.slot, color: f.color, scouts: f.scouts }, f.id)),
636
+ c.map((f) => /* @__PURE__ */ t(Ht, { id: f, selected: e === f, onSelect: r }, f))
637
+ ] });
638
+ }
639
+ function sn({ galaxy: e, selected: r, onSelect: s }) {
640
+ return /* @__PURE__ */ g(de, { children: [
641
+ /* @__PURE__ */ t("color", { attach: "background", args: ["#02040a"] }),
642
+ /* @__PURE__ */ t("fog", { attach: "fog", args: ["#02040a", 48, 95] }),
643
+ /* @__PURE__ */ t("ambientLight", { intensity: 0.35 }),
644
+ /* @__PURE__ */ t("pointLight", { position: [0, 8, 0], intensity: 60, distance: 40, color: "#818cf8" }),
645
+ /* @__PURE__ */ t("directionalLight", { position: [10, 20, 8], intensity: 0.6, color: "#c7d2fe" }),
646
+ /* @__PURE__ */ t(at, { radius: 120, depth: 50, count: j ? 1200 : 3500, factor: 3, saturation: 0.3, fade: !0, speed: 0.4 }),
647
+ /* @__PURE__ */ t(
648
+ it,
649
+ {
650
+ position: [0, -0.02, 0],
651
+ args: [120, 120],
652
+ cellSize: 1,
653
+ cellThickness: 0.5,
654
+ cellColor: "#0f1733",
655
+ sectionSize: 6,
656
+ sectionThickness: 0.9,
657
+ sectionColor: "#1e2a5a",
658
+ fadeDistance: 70,
659
+ fadeStrength: 1.6,
660
+ infiniteGrid: !0
661
+ }
662
+ ),
663
+ /* @__PURE__ */ t(Wt, { galaxy: e }),
664
+ /* @__PURE__ */ t(Ut, { galaxy: e }),
665
+ /* @__PURE__ */ t(Vt, { galaxy: e }),
666
+ /* @__PURE__ */ t(rn, { selected: r, onSelect: s }),
667
+ /* @__PURE__ */ t(Yt, {}),
668
+ /* @__PURE__ */ t(Kt, {}),
669
+ /* @__PURE__ */ t(tn, {}),
670
+ /* @__PURE__ */ t(nn, {}),
671
+ /* @__PURE__ */ t(ct, { target: [0, 0, 2.5], makeDefault: !0, enableDamping: !0, dampingFactor: 0.06, minDistance: 14, maxDistance: 80, maxPolarAngle: Math.PI * 0.42, minPolarAngle: Math.PI * 0.12 }),
672
+ /* @__PURE__ */ g(pt, { multisampling: 0, children: [
673
+ /* @__PURE__ */ t(ut, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.22, luminanceSmoothing: 0.25, radius: 0.72 }),
674
+ /* @__PURE__ */ t(ft, { eskil: !1, offset: 0.22, darkness: 0.85 }),
675
+ /* @__PURE__ */ t(dt, { opacity: 0.025 })
676
+ ] })
677
+ ] });
678
+ }
679
+ function dn() {
680
+ const e = Pt(), [r, s] = fe(null);
681
+ return /* @__PURE__ */ g("div", { className: "scene-root", children: [
682
+ /* @__PURE__ */ t(lt, { camera: { position: [0, 29, 35], fov: 46 }, dpr: [1, 2], gl: { antialias: !1, powerPreference: "high-performance", preserveDrawingBuffer: !0 }, onPointerMissed: () => s(null), children: /* @__PURE__ */ t(sn, { galaxy: e, selected: r, onSelect: s }) }),
683
+ /* @__PURE__ */ t(Et, { title: "subway", subtitle: "neon transit map · each hatchet run is a line, each agent a train, the knowledge graph is Graph Central, MCP servers are airports", selected: r, onClose: () => s(null) })
684
+ ] });
685
+ }
686
+ export {
687
+ dn as default
688
+ };