agentglow 0.1.0 → 0.2.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.
Files changed (41) hide show
  1. package/README.md +38 -3
  2. package/dist/chunks/KitScene-BuFtYuhc.js +2737 -0
  3. package/dist/chunks/index-BPyTLdiF.js +792 -0
  4. package/dist/chunks/index-Bo5HRf-O.js +784 -0
  5. package/dist/chunks/index-C42Ihyo1.js +605 -0
  6. package/dist/chunks/index-C5YqtHnC.js +677 -0
  7. package/dist/chunks/index-Cyv7bII1.js +818 -0
  8. package/dist/chunks/index-D0UvupqM.js +1143 -0
  9. package/dist/chunks/index-D733n3Hf.js +1086 -0
  10. package/dist/chunks/index-DCmhxN8v.js +1010 -0
  11. package/dist/chunks/index-DO9SAG-u.js +753 -0
  12. package/dist/chunks/index-Dn6oRasS.js +887 -0
  13. package/dist/chunks/index-HyfZ0ePz.js +838 -0
  14. package/dist/chunks/index-XMOz-HBf.js +492 -0
  15. package/dist/chunks/index-ZT88hgW-.js +763 -0
  16. package/dist/chunks/index-e6egU2Q6.js +889 -0
  17. package/dist/chunks/index-jLXx_Wgk.js +68 -0
  18. package/dist/chunks/index-tonipLb2.js +980 -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 +59 -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
@@ -1,768 +0,0 @@
1
- import { jsxs as m, jsx as t, Fragment as We } from "react/jsx-runtime";
2
- import { useFrame as ee, useThree as st, Canvas as Mt } from "@react-three/fiber";
3
- import { EffectComposer as gt, Bloom as yt, ChromaticAberration as wt, Vignette as xt, Noise as bt } from "@react-three/postprocessing";
4
- import { useMemo as w, useRef as h, useState as $e, useEffect as be } from "react";
5
- import * as o from "three";
6
- import { t as St, g as At, w as F, K as at, G as Ct, L as Je, n as vt, l as Ze, d as Bt, S as ct, c as Tt, i as kt, T as Et, h as it, p as Gt, e as zt, b as Rt, C as Pt, f as It, H as Ot } from "./ClusterBall-CPsd6JvJ.js";
7
- import { j as Pe, r as Lt, a as lt, i as Wt } from "./spread-CWdeDFd9.js";
8
- var ft;
9
- const Ie = typeof window < "u" && !!((ft = window.matchMedia) != null && ft.call(window, "(prefers-reduced-motion: reduce)").matches), Y = Ie ? 0.15 : 1, ue = 7, ae = 4.9, he = 10.5, Qe = 8, He = 12, Dt = -9, Q = { plan: 0, research: -He, write: -He * 2 }, _t = {
10
- planner: Q.plan + 2,
11
- researcher: Q.research + 2,
12
- graph_scout: Q.research - 5,
13
- records_scout: Q.research - 5,
14
- data_scout: Q.research - 5,
15
- writer: Q.write + 2
16
- }, oe = { start: Q.research + 2, out: Q.research - 2.2, back: Q.research - 7.8, end: Q.research - 10.5 }, Fe = [212, 328, 90, 270, 32, 148], ht = (r) => Fe[r % Fe.length] * Math.PI / 180 + Math.floor(r / Fe.length) * 0.22, mt = (r, e) => ht(e) + Pe(r, 61) * 0.4, le = { speed: 1, paused: !1 }, me = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ new Map(), Nt = [0, 180, 120, 300, 240, 60], Ut = [-27, -31, -23, -35, -29, -25];
17
- function Vt(r, e) {
18
- const n = Nt[r % 6] * Math.PI / 180 + Math.floor(r / 6) * 0.3;
19
- return e.set(Math.cos(n) * (he + 0.6), Math.sin(n) * (he + 0.6), Ut[r % 6] - Math.floor(r / 6) * 8);
20
- }
21
- const Ye = (r) => 1 - Math.pow(1 - Math.min(1, Math.max(0, r)), 3), ut = (r, e, n) => {
22
- const s = Math.min(1, Math.max(0, (n - r) / (e - r)));
23
- return s * s * (3 - 2 * s);
24
- };
25
- let ke = null;
26
- function et() {
27
- if (ke) return ke;
28
- const r = document.createElement("canvas");
29
- r.width = r.height = 128;
30
- const e = r.getContext("2d"), n = e.createRadialGradient(64, 64, 0, 64, 64, 64);
31
- return n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.18, "rgba(255,255,255,0.55)"), n.addColorStop(0.5, "rgba(255,255,255,0.12)"), n.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = n, e.fillRect(0, 0, 128, 128), ke = new o.CanvasTexture(r), ke;
32
- }
33
- let Ee = null;
34
- function Ft() {
35
- if (Ee) return Ee;
36
- const r = document.createElement("canvas");
37
- r.width = r.height = 128;
38
- const e = r.getContext("2d");
39
- e.translate(64, 64);
40
- const n = (i, a, c) => {
41
- e.save(), e.rotate(c);
42
- const l = e.createLinearGradient(-i, 0, i, 0);
43
- l.addColorStop(0, "rgba(255,255,255,0)"), l.addColorStop(0.5, "rgba(255,255,255,1)"), l.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = l, e.beginPath(), e.moveTo(-i, 0), e.lineTo(0, -a), e.lineTo(i, 0), e.lineTo(0, a), e.closePath(), e.fill(), e.restore();
44
- };
45
- n(62, 3.2, 0), n(62, 3.2, Math.PI / 2), n(36, 2, Math.PI / 4), n(36, 2, -Math.PI / 4);
46
- const s = e.createRadialGradient(0, 0, 0, 0, 0, 20);
47
- return s.addColorStop(0, "rgba(255,255,255,1)"), s.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = s, e.fillRect(-20, -20, 40, 40), Ee = new o.CanvasTexture(r), Ee;
48
- }
49
- const Me = -215, Oe = 12, xe = Oe - Me;
50
- function jt() {
51
- return ee((r, e) => {
52
- const n = Math.min(e, 0.5), s = performance.now();
53
- St(s), At(s), le.speed += ((le.paused ? 0 : 1) - le.speed) * Math.min(1, n * 2.5);
54
- for (const i of F.runs.values()) {
55
- let a = me.get(i.id);
56
- a === void 0 && (a = -175);
57
- const c = i.steps.write !== "queued" ? 2 : i.steps.research !== "queued" ? 1 : 0;
58
- if (i.endedAt && s - i.endedAt > 1400) {
59
- const l = (s - i.endedAt - 1400) / 1e3;
60
- a += n * (5 + 34 * l * l) * Math.max(0.35, Y);
61
- } else {
62
- const l = Dt + He * c;
63
- a += (l - a) * (1 - Math.exp(-n * 1.15));
64
- }
65
- me.set(i.id, a);
66
- }
67
- for (const i of me.keys()) F.runs.has(i) || me.delete(i);
68
- }), null;
69
- }
70
- function Xt() {
71
- const e = h(null), n = w(() => new o.Object3D(), []), s = w(() => new o.Color(), []), i = w(() => [new o.Color("#4f46e5"), new o.Color("#22d3ee"), new o.Color("#7c3aed")], []), a = h(0);
72
- return ee((c, l) => {
73
- const u = e.current;
74
- if (!u) return;
75
- a.current = (a.current + Math.min(l, 0.1) * 3.5 * Y * le.speed) % xe;
76
- const M = xe / 48;
77
- for (let y = 0; y < 48; y++) {
78
- const g = Me + (y * M + a.current) % xe;
79
- n.position.set(0, 0, g), n.rotation.set(0, 0, 0), n.scale.setScalar(1), n.updateMatrix(), u.setMatrixAt(y, n.matrix);
80
- const v = y % 4 === 0, z = Math.min(1, Math.max(0, (Qe + 2 - g) / 10));
81
- s.copy(i[y % 3]).multiplyScalar((v ? 1.5 : 0.55) * z), u.setColorAt(y, s);
82
- }
83
- u.instanceMatrix.needsUpdate = !0, u.instanceColor && (u.instanceColor.needsUpdate = !0);
84
- }), /* @__PURE__ */ m("instancedMesh", { ref: e, args: [void 0, void 0, 48], frustumCulled: !1, children: [
85
- /* @__PURE__ */ t("torusGeometry", { args: [ue, 0.03, 4, 120] }),
86
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, opacity: 0.85, blending: o.AdditiveBlending, depthWrite: !1 })
87
- ] });
88
- }
89
- function qt() {
90
- const r = w(() => {
91
- const n = new Float32Array(144);
92
- for (let i = 0; i < 24; i++) {
93
- const a = i / 24 * Math.PI * 2, c = Math.cos(a) * ue, l = Math.sin(a) * ue;
94
- n.set([c, l, Oe, c, l, Me], i * 6);
95
- }
96
- const s = new o.BufferGeometry();
97
- return s.setAttribute("position", new o.BufferAttribute(n, 3)), s;
98
- }, []);
99
- return /* @__PURE__ */ t("lineSegments", { geometry: r, children: /* @__PURE__ */ t("lineBasicMaterial", { color: new o.Color("#3730a3").multiplyScalar(1.1), transparent: !0, opacity: 0.35, toneMapped: !1, blending: o.AdditiveBlending, depthWrite: !1 }) });
100
- }
101
- function Kt() {
102
- const r = Ie ? 120 : 300, e = h(null), n = w(() => {
103
- const c = new Float32Array(r * 5);
104
- for (let l = 0; l < r; l++) {
105
- const u = 1.6 + Math.pow(Math.random(), 0.45) * (ue - 1.3);
106
- c.set([Math.random() * Math.PI * 2, u, Me + Math.random() * xe, 9 + Math.random() * 12, 1 + Math.random() * 3.5], l * 5);
107
- }
108
- return c;
109
- }, [r]), s = w(() => new o.Object3D(), []), i = w(() => new o.Color(), []), a = w(() => [new o.Color("#a5b4fc"), new o.Color("#67e8f9"), new o.Color("#f0abfc"), new o.Color("#ffffff")], []);
110
- return ee((c, l) => {
111
- const u = e.current;
112
- if (!u) return;
113
- const M = Math.min(l, 0.1);
114
- for (let y = 0; y < r; y++) {
115
- const g = y * 5;
116
- let v = n[g + 2] + M * n[g + 3] * Y * le.speed;
117
- v > Oe && (v -= xe), n[g + 2] = v;
118
- const z = n[g], L = n[g + 1];
119
- s.position.set(Math.cos(z) * L, Math.sin(z) * L, v), s.scale.set(0.022, 0.022, n[g + 4] * (Ie ? 0.4 : 1)), s.updateMatrix(), u.setMatrixAt(y, s.matrix);
120
- const x = Math.min(1, Math.max(0, (v - Me) / 60)) * Math.min(1, Math.max(0, (Oe - v) / 6));
121
- i.copy(a[y % 4]).multiplyScalar((0.15 + 0.6 * x * (L / ue)) * (0.25 + 0.75 * le.speed)), u.setColorAt(y, i);
122
- }
123
- u.instanceMatrix.needsUpdate = !0, u.instanceColor && (u.instanceColor.needsUpdate = !0);
124
- }), /* @__PURE__ */ m("instancedMesh", { ref: e, args: [void 0, void 0, r], frustumCulled: !1, children: [
125
- /* @__PURE__ */ t("boxGeometry", { args: [1, 1, 1] }),
126
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, fog: !1 })
127
- ] });
128
- }
129
- function $t() {
130
- const r = w(() => et(), []), e = h(null);
131
- return ee(({ clock: n }) => {
132
- e.current && e.current.scale.setScalar(1 + Math.sin(n.elapsedTime * 0.8) * 0.03 * Y);
133
- }), /* @__PURE__ */ m("group", { position: [0, 0, Me + 5], children: [
134
- /* @__PURE__ */ m("mesh", { ref: e, children: [
135
- /* @__PURE__ */ t("planeGeometry", { args: [80, 80] }),
136
- /* @__PURE__ */ t("meshBasicMaterial", { map: r, color: new o.Color("#818cf8").multiplyScalar(1.1), transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1, fog: !1 })
137
- ] }),
138
- /* @__PURE__ */ m("mesh", { children: [
139
- /* @__PURE__ */ t("planeGeometry", { args: [18, 18] }),
140
- /* @__PURE__ */ t("meshBasicMaterial", { map: r, color: new o.Color("#e0e7ff").multiplyScalar(2), transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1, fog: !1 })
141
- ] })
142
- ] });
143
- }
144
- function Zt() {
145
- const r = st((i) => i.camera), e = w(() => new o.Vector3(), []), n = st((i) => i.pointer), s = h({ x: 0, y: 0 });
146
- return ee(() => {
147
- s.current.x += (n.x - s.current.x) * 0.04, s.current.y += (n.y - s.current.y) * 0.04, r.position.set(s.current.x * 0.9, s.current.y * 0.6, Qe), e.set(s.current.x * 2, s.current.y * 1.3, -40), r.lookAt(e);
148
- }), null;
149
- }
150
- const fe = 48, Ht = 220, je = 3, Yt = new o.Vector3(0, 1, 0), Jt = new o.Vector3(0, 0, 1);
151
- function Qt({ galaxy: r }) {
152
- const e = w(() => {
153
- const B = r.nodes.slice(0, Ht), U = new Set(B.map((W) => W.id));
154
- return { nodes: B, links: r.links.filter((W) => U.has(W.source) && U.has(W.target)) };
155
- }, [r]), n = e.nodes.length, s = h(null), i = h(null), a = h(null), c = h(null), l = h(null), u = w(() => {
156
- const B = 2 * Math.PI * he, U = -12, W = 78, k = new Float32Array(n), I = new Float32Array(n);
157
- for (let T = 0; T < n; T++)
158
- k[T] = Math.random() * B, I[T] = Math.random() * W;
159
- const A = new Map(e.nodes.map((T, f) => [T.id, f])), _ = [];
160
- for (const T of e.links) {
161
- const f = A.get(T.source), p = A.get(T.target);
162
- f !== void 0 && p !== void 0 && f !== p && _.push([f, p]);
163
- }
164
- const O = new Float32Array(n), P = new Float32Array(n), Z = (T) => T > B / 2 ? T - B : T < -B / 2 ? T + B : T;
165
- for (let T = 0; T < 120; T++) {
166
- O.fill(0), P.fill(0);
167
- for (let p = 0; p < n; p++)
168
- for (let G = p + 1; G < n; G++) {
169
- const N = Z(k[p] - k[G]), q = I[p] - I[G], J = N * N + q * q + 0.01;
170
- if (J > 100) continue;
171
- const K = 6 / J;
172
- O[p] += N * K, P[p] += q * K, O[G] -= N * K, P[G] -= q * K;
173
- }
174
- for (const [p, G] of _) {
175
- const N = Z(k[G] - k[p]), q = I[G] - I[p];
176
- O[p] += N * 0.08, P[p] += q * 0.08, O[G] -= N * 0.08, P[G] -= q * 0.08;
177
- }
178
- const f = 0.9 * (1 - T / 120) + 0.05;
179
- for (let p = 0; p < n; p++)
180
- k[p] = (k[p] + Math.max(-2, Math.min(2, O[p])) * f + B) % B, I[p] = Math.max(0, Math.min(W, I[p] + Math.max(-2, Math.min(2, P[p])) * f));
181
- }
182
- const X = new Float32Array(n * 3);
183
- for (let T = 0; T < n; T++) {
184
- const f = k[T] / he, p = he + 0.6 + Math.sin(T * 7.3) * 0.6;
185
- X.set([Math.cos(f) * p, Math.sin(f) * p, U - I[T]], T * 3);
186
- }
187
- return X;
188
- }, [n, e]), M = w(() => e.nodes.map((B) => new o.Color(at[B.kind] ?? "#94a3b8")), [e]), y = w(() => {
189
- const B = new Map(e.nodes.map((k, I) => [k.id, I])), U = [];
190
- for (const k of e.links) {
191
- const I = B.get(k.source), A = B.get(k.target);
192
- if (I === void 0 || A === void 0 || I === A) continue;
193
- const _ = u[I * 3] - u[A * 3], O = u[I * 3 + 1] - u[A * 3 + 1], P = u[I * 3 + 2] - u[A * 3 + 2];
194
- _ * _ + O * O + P * P > 484 || U.push(u[I * 3], u[I * 3 + 1], u[I * 3 + 2], u[A * 3], u[A * 3 + 1], u[A * 3 + 2]);
195
- }
196
- const W = new o.BufferGeometry();
197
- return W.setAttribute("position", new o.Float32BufferAttribute(U, 3)), W;
198
- }, [e, u]), g = w(() => /* @__PURE__ */ new Map(), [e]), v = (B) => {
199
- let U = g.get(B);
200
- return U === void 0 && g.set(B, U = vt(e, B)), U;
201
- }, z = w(() => new Float32Array(n), [n]), L = w(() => new Uint8Array(n), [n]), x = w(() => new o.Object3D(), []), R = w(() => new o.Color(), []), C = w(() => new o.Color("#ffffff"), []), S = w(() => new o.Vector3(), []), b = w(() => new o.Vector3(), []), E = w(() => Ft(), []), d = h([]), j = h([]), V = h([]), $ = h([-1, -1, -1]);
202
- return ee(({ clock: B }) => {
203
- var T;
204
- const U = s.current, W = i.current;
205
- if (!U || !W) return;
206
- const k = 1, I = 0, A = performance.now(), _ = B.elapsedTime;
207
- z.fill(0), L.fill(0);
208
- let O = 0, P = 0, Z = 0;
209
- for (const f of F.flares) {
210
- const p = v(f.node), G = (A - f.start) / 1e3, N = Math.exp(-G * 1.2) * Math.min(1, G * 10);
211
- N > z[p] && (z[p] = N), f.op === "write" && (L[p] = 1);
212
- const q = u[p * 3] * k - u[p * 3 + 1] * I, J = u[p * 3] * I + u[p * 3 + 1] * k, K = u[p * 3 + 2], H = f.op === "write", ce = Math.max(0, 1 - G / 2.6);
213
- a.current && O < fe && (x.position.set(q, J, K), x.quaternion.identity(), x.scale.setScalar((H ? 0.6 : 0.35) + G * (H ? 2.6 : 1.5)), x.updateMatrix(), a.current.setMatrixAt(O, x.matrix), R.copy(H ? C : M[p]).multiplyScalar((H ? 4 : 2.4) * ce), a.current.setColorAt(O++, R)), H && c.current && P < fe && (x.position.set(q, J, K), x.quaternion.setFromAxisAngle(Jt, G * 0.8), x.scale.setScalar(1.5 + 3 * N), x.updateMatrix(), c.current.setMatrixAt(P, x.matrix), R.copy(C).multiplyScalar(3.2 * ce), c.current.setColorAt(P++, R));
214
- const se = te.get(f.instance);
215
- if (se && l.current && Z < fe && se.presence > 0.02) {
216
- S.set(q, J, K), b.subVectors(S, se.pos);
217
- const Ae = b.length();
218
- x.position.copy(se.pos).addScaledVector(b, 0.5), x.quaternion.setFromUnitVectors(Yt, b.normalize());
219
- const Ce = H ? 1.6 : 1;
220
- x.scale.set(Ce * (0.5 + N), Ae, Ce * (0.5 + N)), x.updateMatrix(), l.current.setMatrixAt(Z, x.matrix), R.copy(H ? C : se.color).multiplyScalar((H ? 3.2 : 2.4) * ce * ce), l.current.setColorAt(Z++, R);
221
- }
222
- }
223
- let X = 0;
224
- for (let f = F.flares.length - 1; f >= 0 && X < je; f--) {
225
- const p = F.flares[f], G = (A - p.start) / 1e3;
226
- if (G > 1.6) break;
227
- const N = v(p.node);
228
- let q = !1;
229
- for (let H = 0; H < X; H++) $.current[H] === N && (q = !0);
230
- if (q) continue;
231
- const J = d.current[X], K = j.current[X];
232
- J && K && (J.position.set(u[N * 3] * 1, u[N * 3 + 1] * 1, u[N * 3 + 2]), J.position.multiplyScalar(1), ($.current[X] !== N || V.current[X] !== p.op) && (K.setText((p.op === "write" ? "wrote · " : "") + p.node), V.current[X] = p.op, K.setColor(p.op === "write" ? "#ffffff" : at[(T = e.nodes[N]) == null ? void 0 : T.kind] ?? "#a5b4fc")), K.setOpacity(Math.min(1, (1.6 - G) * 2.5)), $.current[X] = N), X++;
233
- }
234
- for (let f = X; f < je; f++) {
235
- $.current[f] = -1;
236
- const p = j.current[f];
237
- p == null || p.setOpacity(0);
238
- }
239
- for (const f of [a.current, c.current, l.current])
240
- f && (f.count = f === a.current ? O : f === c.current ? P : Z, f.instanceMatrix.needsUpdate = !0, f.instanceColor && (f.instanceColor.needsUpdate = !0));
241
- for (let f = 0; f < n; f++) {
242
- const p = z[f];
243
- x.position.set(u[f * 3], u[f * 3 + 1], u[f * 3 + 2]), x.quaternion.identity(), x.scale.setScalar(1 + p * 3.4), x.updateMatrix(), W.setMatrixAt(f, x.matrix);
244
- const G = 0.75 + 0.25 * Math.sin(_ * 1.7 + f * 1.3);
245
- R.copy(M[f]).multiplyScalar(1.1 * G + p * 5), L[f] && R.lerp(C, Math.min(1, p) * 0.6).multiplyScalar(1 + p), W.setColorAt(f, R);
246
- }
247
- W.instanceMatrix.needsUpdate = !0, W.instanceColor && (W.instanceColor.needsUpdate = !0);
248
- }), /* @__PURE__ */ m(We, { children: [
249
- /* @__PURE__ */ m("group", { ref: s, children: [
250
- /* @__PURE__ */ m("instancedMesh", { ref: i, args: [void 0, void 0, Math.max(1, n)], frustumCulled: !1, children: [
251
- /* @__PURE__ */ t("icosahedronGeometry", { args: [0.16, 1] }),
252
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
253
- ] }),
254
- /* @__PURE__ */ t("lineSegments", { geometry: y, children: /* @__PURE__ */ t("lineBasicMaterial", { color: new o.Color("#a5b4fc").multiplyScalar(1.3), transparent: !0, opacity: 0.42, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
255
- ] }),
256
- /* @__PURE__ */ m("instancedMesh", { ref: a, args: [void 0, void 0, fe], frustumCulled: !1, children: [
257
- /* @__PURE__ */ t("ringGeometry", { args: [0.82, 1, 40] }),
258
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: o.DoubleSide })
259
- ] }),
260
- /* @__PURE__ */ m("instancedMesh", { ref: c, args: [void 0, void 0, fe], frustumCulled: !1, children: [
261
- /* @__PURE__ */ t("planeGeometry", { args: [1, 1] }),
262
- /* @__PURE__ */ t("meshBasicMaterial", { map: E, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
263
- ] }),
264
- /* @__PURE__ */ m("instancedMesh", { ref: l, args: [void 0, void 0, fe], frustumCulled: !1, children: [
265
- /* @__PURE__ */ t("cylinderGeometry", { args: [0.035, 0.035, 1, 6, 1, !0] }),
266
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
267
- ] }),
268
- /* @__PURE__ */ t("group", { position: [0, he + 2.2, -30], children: /* @__PURE__ */ t(Ct, { color: "#a5b4fc", letterSpacing: 0.04, size: 0.5, pxRange: [10, 14] }) }),
269
- Array.from({ length: je }, (B, U) => /* @__PURE__ */ t("group", { ref: (W) => void (d.current[U] = W), children: /* @__PURE__ */ t(Je, { ref: (W) => void (j.current[U] = W), position: [0, 0.7, 0], text: "", size: 0.3, opacity: 0, pxRange: [8, 12] }) }, U))
270
- ] });
271
- }
272
- function tt(r, e) {
273
- const [n, s] = $e([]), i = h(/* @__PURE__ */ new Set()), a = h(-1);
274
- return ee(() => {
275
- const c = r();
276
- let l = c.size === i.current.size && a.current === Ze.version;
277
- if (l) {
278
- for (const u of c.keys())
279
- if (!i.current.has(u)) {
280
- l = !1;
281
- break;
282
- }
283
- }
284
- l || (i.current = new Set(c.keys()), a.current = Ze.version, s(e ? [...c.keys()].filter(e) : [...c.keys()]));
285
- }), n;
286
- }
287
- const en = new o.Color("#4ade80"), pt = new o.Color("#fde68a"), tn = new o.Color("#ef4444"), Xe = 14, Ge = 18, qe = -42;
288
- function nn({ id: r }) {
289
- const e = F.runs.get(r), n = w(() => new o.Color((e == null ? void 0 : e.color) ?? "#818cf8"), [e == null ? void 0 : e.color]), s = mt(r, (e == null ? void 0 : e.slot) ?? 0), i = h(null), a = h([]), c = h([]), l = h([]), u = h(null), M = h(null), y = h(null), g = h(null), v = h(""), z = h({ plan: "", research: "", write: "" }), L = h({ plan: 0, research: 0, write: 0 }), x = w(() => new o.Object3D(), []), R = w(() => new o.Color(), []), C = w(() => n.clone().lerp(new o.Color("#ffffff"), 0.55).multiplyScalar(5), [n]), S = h(0);
290
- return ee(({ clock: b }, E) => {
291
- var A;
292
- const d = F.runs.get(r), j = i.current;
293
- if (!d || !j) return;
294
- const V = performance.now(), $ = b.elapsedTime;
295
- j.position.z = me.get(r) ?? -175;
296
- let B = "plan";
297
- ct.forEach((_, O) => {
298
- const P = d.steps[_];
299
- P !== "queued" && (B = _), z.current[_] !== P && (z.current[_] = P, L.current[_] = V);
300
- const Z = Math.exp(-(V - L.current[_]) / 280), X = a.current[O], T = c.current[O], f = l.current[O];
301
- if (!X || !T || !f) return;
302
- const p = P === "running";
303
- P === "queued" ? R.copy(n).multiplyScalar(0.32) : p ? R.copy(n).lerp(pt, 0.35).multiplyScalar(1.35 + Math.sin($ * 5) * 0.45 * Y) : P === "done" ? R.copy(en).multiplyScalar(1.15) : R.copy(tn).multiplyScalar(2.2), R.multiplyScalar(1 + Z * 1.6), X.material.color.copy(R), X.scale.setScalar(1 + Z * 0.45 + (p ? Math.sin($ * 6) * 0.05 * Y : 0)), T.visible = p, p && (T.rotation.z += E * 3.2 * Math.max(0.3, Y));
304
- const G = f.material;
305
- G.opacity = P === "queued" ? 0.02 : p ? 0.1 + Math.sin($ * 5) * 0.04 : 0.04, G.color.copy(R), f.scale.setScalar(1 + Z * 0.8);
306
- });
307
- const U = u.current;
308
- if (U) {
309
- const _ = d.handoffAt ? (V - d.handoffAt) / 950 : 2;
310
- if (U.visible = _ >= 0 && _ < 1, U.visible) {
311
- const O = Q[d.handoffFrom], P = Q[d.handoffTo];
312
- U.position.set(ae, 0, O + (P - O) * Ye(_)), U.scale.set(1, 1, 1 + 9 * Math.sin(Math.PI * _));
313
- }
314
- }
315
- const W = M.current;
316
- if (W) {
317
- const _ = Ge - qe;
318
- for (let O = 0; O < Xe; O++) {
319
- const P = Ge - (O * (_ / Xe) + $ * 6 * Y) % _;
320
- x.position.set(ae, 0, P), x.scale.set(1, 1, 1), x.updateMatrix(), W.setMatrixAt(O, x.matrix);
321
- }
322
- W.instanceMatrix.needsUpdate = !0;
323
- }
324
- S.current += (Q[B] - S.current) * Math.min(1, E * 3), (A = y.current) == null || A.position.set(ae - 2.4, 0, S.current);
325
- const k = d.steps[B], I = `${d.topic}|${B}|${k}|${d.status}`;
326
- I !== v.current && g.current && (v.current = I, g.current.setText(d.topic, d.status === "completed" ? "run complete" : d.hasSteps ? `hatchet · ${B} ${k}` : "running…"));
327
- }), /* @__PURE__ */ m("group", { ref: i, rotation: [0, 0, s], position: [0, 0, -175], children: [
328
- [-0.62, 0.62].map((b) => /* @__PURE__ */ m("mesh", { position: [ae, b, (Ge + qe) / 2], children: [
329
- /* @__PURE__ */ t("boxGeometry", { args: [0.035, 0.035, Ge - qe] }),
330
- /* @__PURE__ */ t("meshBasicMaterial", { color: n.clone().multiplyScalar(1.6), toneMapped: !1, transparent: !0, opacity: 0.75 })
331
- ] }, b)),
332
- /* @__PURE__ */ m("instancedMesh", { ref: M, args: [void 0, void 0, Xe], frustumCulled: !1, children: [
333
- /* @__PURE__ */ t("boxGeometry", { args: [0.05, 0.05, 0.9] }),
334
- /* @__PURE__ */ t("meshBasicMaterial", { color: n.clone().multiplyScalar(2.4), toneMapped: !1, transparent: !0, opacity: 0.8, blending: o.AdditiveBlending, depthWrite: !1 })
335
- ] }),
336
- ct.map((b, E) => /* @__PURE__ */ m("group", { position: [ae, 0, Q[b]], children: [
337
- /* @__PURE__ */ m("mesh", { ref: (d) => void (a.current[E] = d), children: [
338
- /* @__PURE__ */ t("torusGeometry", { args: [1.3, 0.075, 10, 64] }),
339
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
340
- ] }),
341
- /* @__PURE__ */ m("mesh", { ref: (d) => void (c.current[E] = d), visible: !1, children: [
342
- /* @__PURE__ */ t("torusGeometry", { args: [1.6, 0.045, 6, 48, Math.PI * 0.7] }),
343
- /* @__PURE__ */ t("meshBasicMaterial", { color: pt.clone().multiplyScalar(1.8), toneMapped: !1 })
344
- ] }),
345
- /* @__PURE__ */ m("mesh", { ref: (d) => void (l.current[E] = d), children: [
346
- /* @__PURE__ */ t("circleGeometry", { args: [1.25, 48] }),
347
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, opacity: 0.05, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: o.DoubleSide })
348
- ] })
349
- ] }, b)),
350
- /* @__PURE__ */ m("mesh", { ref: u, visible: !1, children: [
351
- /* @__PURE__ */ t("sphereGeometry", { args: [0.2, 16, 12] }),
352
- /* @__PURE__ */ t("meshBasicMaterial", { color: C, toneMapped: !1 })
353
- ] }),
354
- /* @__PURE__ */ t("group", { ref: y, children: /* @__PURE__ */ t(Je, { ref: g, text: "", secondary: "", color: (e == null ? void 0 : e.color) ?? "#818cf8", letterSpacing: 0.02, size: 0.42, maxWidth: 14, pxRange: [10, 14.5] }) })
355
- ] });
356
- }
357
- function rn() {
358
- const r = tt(() => F.runs, Bt);
359
- return /* @__PURE__ */ t("group", { children: r.map((e) => /* @__PURE__ */ t(nn, { id: e }, e)) });
360
- }
361
- const ze = 12, we = 40, on = new o.Vector3(0, 1, 0), Le = new o.Color("#ffffff"), sn = new o.Color("#f59e0b"), an = new o.Color("#ef4444"), Ke = (r, e, n, s) => (1 - s) * (1 - s) * r + 2 * (1 - s) * s * e + s * s * n, cn = (r) => r < 0.5 ? 2 * r * r : 1 - Math.pow(-2 * r + 2, 2) / 2;
362
- function ln(r, e, n, s) {
363
- const i = n - r, a = s - e, c = i * i + a * a, l = 2 * (r * i + e * a), u = r * r + e * e - ue * ue, M = l * l - 4 * c * u;
364
- if (c < 1e-6 || M < 0) return -1;
365
- const y = Math.sqrt(M), g = (-l + y) / (2 * c), v = (-l - y) / (2 * c);
366
- return g >= 0 && g <= 1 ? g : v >= 0 && v <= 1 ? v : -1;
367
- }
368
- function un() {
369
- const r = h(null), e = h(null), n = w(() => new o.Object3D(), []), s = w(() => new o.Color(), []), i = w(() => new o.Color(), []), a = w(() => new o.Vector3(), []), c = w(() => new o.Vector3(), []), l = w(() => new o.Vector3(), []), u = w(() => /* @__PURE__ */ new Map(), []);
370
- return ee(() => {
371
- var R;
372
- const M = r.current, y = e.current;
373
- if (!M || !y) return;
374
- const g = performance.now();
375
- let v = 0, z = 0, L = 0;
376
- const x = (C, S, b) => {
377
- const E = cn(Math.min(1, Math.max(0, C)));
378
- for (let d = 0; d < ze; d++) {
379
- const j = Math.max(0, E - d * 0.028);
380
- n.position.set(Ke(a.x, l.x, c.x, j), Ke(a.y, l.y, c.y, j), Ke(a.z, l.z, c.z, j)), n.scale.setScalar(S * (1 - d / ze) * (C >= 1 ? 0 : 1)), n.updateMatrix(), M.setMatrixAt(v, n.matrix), s.copy(d === 0 ? Le : i).lerp(i, d === 0 ? 0.35 : 0).multiplyScalar((d === 0 ? 5 : 3.2) * (1 - d / ze) * b), M.setColorAt(v++, s);
381
- }
382
- return E;
383
- };
384
- for (const C of F.comets) {
385
- if (L >= we) break;
386
- const S = te.get(C.from), b = te.get(C.to);
387
- if (!S || !b) continue;
388
- const E = (g - C.start) / C.dur;
389
- E > 1.05 || (a.copy(S.pos), c.copy(b.pos), l.copy(a).add(c).multiplyScalar(0.5), l.x *= 0.12, l.y *= 0.12, l.z -= 3, i.copy(S.color), x(E, 0.2, 1), L++);
390
- }
391
- for (const C of F.mcpCalls) {
392
- if (L >= we) break;
393
- const S = te.get(C.instance), b = Se.get(C.server);
394
- if (!S || !b) continue;
395
- const E = (g - C.start) / C.dur;
396
- if (E > 1.05) continue;
397
- C.phase === "call" ? (a.copy(S.pos), c.copy(b)) : (a.copy(b), c.copy(S.pos)), l.copy(a).add(c).multiplyScalar(0.5), l.x *= 1.08, l.y *= 1.08;
398
- let d = u.get(C.server);
399
- d || u.set(C.server, d = new o.Color(((R = F.mcpServers.get(C.server)) == null ? void 0 : R.color) ?? "#94a3b8")), i.copy(d);
400
- const j = x(E, 0.17, 1.1);
401
- L++;
402
- const V = ln(a.x, a.y, c.x, c.y);
403
- if (V >= 0 && j > V && z < we) {
404
- const $ = j - V;
405
- n.position.set(a.x + (c.x - a.x) * V, a.y + (c.y - a.y) * V, a.z + (c.z - a.z) * V), n.scale.setScalar(0.25 + $ * 2.4), n.updateMatrix(), y.setMatrixAt(z, n.matrix), s.copy(d).lerp(Le, 0.4).multiplyScalar(4 * Math.exp(-$ * 4)), y.setColorAt(z++, s);
406
- }
407
- }
408
- M.count = v, y.count = z, M.instanceMatrix.needsUpdate = !0, y.instanceMatrix.needsUpdate = !0, M.instanceColor && (M.instanceColor.needsUpdate = !0), y.instanceColor && (y.instanceColor.needsUpdate = !0);
409
- }), /* @__PURE__ */ m(We, { children: [
410
- /* @__PURE__ */ m("instancedMesh", { ref: r, args: [void 0, void 0, we * ze], frustumCulled: !1, children: [
411
- /* @__PURE__ */ t("sphereGeometry", { args: [1, 12, 8] }),
412
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1 })
413
- ] }),
414
- /* @__PURE__ */ m("instancedMesh", { ref: e, args: [void 0, void 0, we], frustumCulled: !1, children: [
415
- /* @__PURE__ */ t("ringGeometry", { args: [0.7, 1, 32] }),
416
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, side: o.DoubleSide })
417
- ] })
418
- ] });
419
- }
420
- function pn() {
421
- const n = h(null), s = h(null), i = w(() => new o.Object3D(), []), a = w(() => new o.Color(), []), c = w(() => new o.Vector3(), []), l = w(() => /* @__PURE__ */ new Map(), []), u = (M) => {
422
- var g;
423
- let y = l.get(M);
424
- return y || l.set(M, y = new o.Color(((g = F.mcpServers.get(M)) == null ? void 0 : g.color) ?? "#94a3b8")), y;
425
- };
426
- return ee(({ clock: M }) => {
427
- const y = n.current, g = s.current;
428
- if (!y || !g) return;
429
- const v = performance.now(), z = M.elapsedTime * Math.max(0.25, Y);
430
- let L = 0, x = 0;
431
- const R = (S, b, E) => {
432
- c.subVectors(b, S);
433
- const d = c.length();
434
- i.position.copy(S).addScaledVector(c, 0.5), i.quaternion.setFromUnitVectors(on, c.normalize()), i.scale.set(E, d, E), i.updateMatrix(), y.setMatrixAt(L, i.matrix), y.setColorAt(L++, a);
435
- }, C = (S, b, E, d) => {
436
- i.position.lerpVectors(S, b, E), i.quaternion.identity(), i.scale.setScalar(d), i.updateMatrix(), g.setMatrixAt(x, i.matrix), g.setColorAt(x++, a);
437
- };
438
- for (const S of F.mcpPending.values()) {
439
- if (L >= 24) break;
440
- const b = te.get(S.instance), E = Se.get(S.server);
441
- if (!b || !E || b.presence < 0.02) continue;
442
- const d = Tt(S, v), j = Math.min(1, d / 0.35);
443
- a.copy(u(S.server)), d > 0.6 && a.lerp(sn, Math.min(1, (d - 0.6) / 0.9)), d > 1.6 && a.lerp(an, Math.min(1, (d - 1.6) / 0.8));
444
- const V = (0.9 + Math.min(2.2, d * 0.7)) * j * (0.85 + 0.15 * Math.sin(z * 9));
445
- a.multiplyScalar(V), R(b.pos, E, 0.6 + Math.min(1.4, d * 0.4)), a.multiplyScalar(1.8);
446
- for (let $ = 0; $ < 8 && x < 192; $++) {
447
- const B = (z * (0.7 + Math.min(1.2, d * 0.35)) + $ / 8) % 1;
448
- B > j || C(b.pos, E, B, 0.09 + Math.min(0.08, d * 0.03));
449
- }
450
- }
451
- for (const S of F.mcpResolved) {
452
- if (L >= 24) break;
453
- const b = te.get(S.instance), E = Se.get(S.server);
454
- if (!b || !E) continue;
455
- const d = Math.min(1, (v - S.resolvedAt) / 700);
456
- a.copy(u(S.server)).lerp(Le, 0.6).multiplyScalar(2.6 * (1 - d)), R(b.pos, E, 1.6 * (1 - d * 0.7)), a.copy(Le).multiplyScalar(6);
457
- const j = 1 - Math.pow(1 - d, 2);
458
- for (let V = 0; V < 5 && x < 192; V++) C(E, b.pos, Math.max(0, j - V * 0.035), 0.26 * (1 - V / 5));
459
- }
460
- y.count = L, g.count = x, y.instanceMatrix.needsUpdate = !0, g.instanceMatrix.needsUpdate = !0, y.instanceColor && (y.instanceColor.needsUpdate = !0), g.instanceColor && (g.instanceColor.needsUpdate = !0);
461
- }), /* @__PURE__ */ m(We, { children: [
462
- /* @__PURE__ */ m("instancedMesh", { ref: n, args: [void 0, void 0, 24], frustumCulled: !1, children: [
463
- /* @__PURE__ */ t("cylinderGeometry", { args: [0.03, 0.03, 1, 6, 1, !0] }),
464
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1 })
465
- ] }),
466
- /* @__PURE__ */ m("instancedMesh", { ref: s, args: [void 0, void 0, 192], frustumCulled: !1, children: [
467
- /* @__PURE__ */ t("sphereGeometry", { args: [1, 10, 8] }),
468
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1 })
469
- ] })
470
- ] });
471
- }
472
- function dn({ name: r }) {
473
- const e = F.mcpServers.get(r), n = w(() => new o.Color((e == null ? void 0 : e.color) ?? "#94a3b8"), [e == null ? void 0 : e.color]), s = w(() => Vt((e == null ? void 0 : e.slot) ?? 0, new o.Vector3()), [e == null ? void 0 : e.slot]), i = w(() => et(), []), a = h(null), c = h(null), l = h(null), u = h(null), M = h(null), y = h(null);
474
- return be(() => (Se.set(r, s), () => void Se.delete(r)), [r, s]), ee(({ clock: g }, v) => {
475
- const z = F.mcpServers.get(r);
476
- if (!z) return;
477
- const L = performance.now(), x = g.elapsedTime, R = Math.exp(-(L - z.activeAt) / 450), C = z.inflight > 0 ? 1 : 0, S = (C * 2.6 + R * 2) * Math.max(0.2, Y);
478
- a.current && (a.current.rotation.z += v * S), c.current && (c.current.rotation.x += v * S * 0.7), l.current && (l.current.material.color.copy(n).multiplyScalar(1.3 + C * 1.4 + R * 3 + (C ? Math.sin(x * 7) * 0.5 : 0)), l.current.scale.setScalar(1 + R * 0.35)), u.current && (u.current.material.opacity = 0.22 + C * 0.25 + R * 0.45, u.current.scale.setScalar(1 + R * 0.7 + C * 0.2)), M.current && (M.current.visible = Math.sin(x * 4 + z.slot) > 0.6 || C === 1);
479
- }), /* @__PURE__ */ m("group", { position: s, children: [
480
- /* @__PURE__ */ m("group", { ref: y, children: [
481
- /* @__PURE__ */ m("mesh", { ref: l, children: [
482
- /* @__PURE__ */ t("octahedronGeometry", { args: [0.55, 0] }),
483
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
484
- ] }),
485
- [-1, 1].map((g) => /* @__PURE__ */ m("mesh", { position: [g * 1.55, 0, 0], children: [
486
- /* @__PURE__ */ t("boxGeometry", { args: [1.5, 0.6, 0.04] }),
487
- /* @__PURE__ */ t("meshStandardMaterial", { color: "#0f172a", emissive: n, emissiveIntensity: 0.35, metalness: 0.8, roughness: 0.35, toneMapped: !1 })
488
- ] }, g)),
489
- /* @__PURE__ */ m("mesh", { position: [0, 0, 0], children: [
490
- /* @__PURE__ */ t("boxGeometry", { args: [1.6, 0.06, 0.06] }),
491
- /* @__PURE__ */ t("meshBasicMaterial", { color: n.clone().multiplyScalar(0.8), toneMapped: !1 })
492
- ] }),
493
- /* @__PURE__ */ m("mesh", { ref: M, position: [0, 0.85, 0], children: [
494
- /* @__PURE__ */ t("sphereGeometry", { args: [0.09, 10, 8] }),
495
- /* @__PURE__ */ t("meshBasicMaterial", { color: new o.Color(4, 3.2, 3.2), toneMapped: !1 })
496
- ] })
497
- ] }),
498
- /* @__PURE__ */ m("mesh", { ref: a, children: [
499
- /* @__PURE__ */ t("torusGeometry", { args: [1.05, 0.04, 6, 64, Math.PI * 1.6] }),
500
- /* @__PURE__ */ t("meshBasicMaterial", { color: n.clone().multiplyScalar(2.2), toneMapped: !1 })
501
- ] }),
502
- /* @__PURE__ */ m("mesh", { ref: c, rotation: [Math.PI / 2, 0, 0], children: [
503
- /* @__PURE__ */ t("torusGeometry", { args: [0.8, 0.03, 6, 48] }),
504
- /* @__PURE__ */ t("meshBasicMaterial", { color: n.clone().multiplyScalar(1.6), toneMapped: !1 })
505
- ] }),
506
- /* @__PURE__ */ m("mesh", { ref: u, children: [
507
- /* @__PURE__ */ t("planeGeometry", { args: [4.2, 4.2] }),
508
- /* @__PURE__ */ t("meshBasicMaterial", { map: i, color: n, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
509
- ] }),
510
- /* @__PURE__ */ t("group", { position: [0, -1.55, 0], children: /* @__PURE__ */ t(Je, { text: `mcp · ${r}`, color: (e == null ? void 0 : e.color) ?? "#94a3b8", size: 0.36, pxRange: [9, 13] }) })
511
- ] });
512
- }
513
- function fn() {
514
- const r = tt(() => F.mcpServers);
515
- return /* @__PURE__ */ t("group", { children: r.map((e) => /* @__PURE__ */ t(dn, { name: e }, e)) });
516
- }
517
- const hn = new o.Color("#f59e0b"), mn = new o.Color("#ef4444"), Re = new o.Color("#ffffff"), Mn = (() => {
518
- const e = new Float32Array(132);
519
- for (let s = 0; s < 22; s++) {
520
- const i = s / 22 * Math.PI * 2 + Math.random() * 0.2, a = (Math.random() - 0.5) * 2.4, c = Math.cos(i), l = Math.sin(i), u = 0.7 + Math.random() * 0.6;
521
- e.set([c * 0.25, l * 0.25, a * 0.2, c * u, l * u, a * u], s * 6);
522
- }
523
- const n = new o.BufferGeometry();
524
- return n.setAttribute("position", new o.BufferAttribute(e, 3)), n;
525
- })();
526
- function gn(r) {
527
- return ut(0, 1, (oe.start - r) / (oe.start - oe.out)) * (1 - ut(0, 1, (oe.back - r) / (oe.back - oe.end)));
528
- }
529
- function yn(r) {
530
- const e = [];
531
- for (let s = 0; s <= 14; s++) {
532
- const i = oe.start + (oe.end - oe.start) * s / 14, a = gn(i), c = r * a, l = ae - 0.25 * a;
533
- e.push(new o.Vector3(Math.cos(c) * l, Math.sin(c) * l, i));
534
- }
535
- return new o.TubeGeometry(new o.CatmullRomCurve3(e), 56, 0.045, 5, !1);
536
- }
537
- function wn({ id: r, selected: e, onSelect: n }) {
538
- const s = F.instances.get(r), i = (s == null ? void 0 : s.type) ?? "planner", a = Wt(i), c = w(() => new o.Color(Et[i]), [i]), l = w(() => ({ pos: new o.Vector3(0, 0, -200), color: c.clone(), energy: 0, active: 0, presence: 0, seed: Math.random() }), [c]);
539
- be(() => (te.set(r, l), () => {
540
- te.get(r) === l && te.delete(r);
541
- }), [r, l]);
542
- const u = h(null), M = h(null), y = h(null), g = h(null), v = h(null), z = h(null), L = h(null), x = h(null), R = h(null), C = h(null), S = h(null), b = h(null), E = h(null), d = h(null), j = h(0), V = w(() => {
543
- const k = F.instances.get(r);
544
- if (!k) return { fan: 0, dz: 0 };
545
- const I = Lt(k);
546
- if (a) {
547
- const A = it(k.run, 63) < 0.5 ? -1 : 1;
548
- return { fan: Pe(k.run, 64) * 0.14 + A * lt(I) * (0.34 + 0.08 * it(k.run, 65)), dz: Pe(r, 66) * 1.6 };
549
- }
550
- return { fan: 0, dz: Pe(r, 67) * 1.6 + lt(I) * 2.4 };
551
- }, [r, a]), $ = h(Number.NaN), B = w(() => new o.Color(), []), U = w(() => et(), []), W = w(() => c.clone().lerp(Re, 0.55), [c]);
552
- return be(() => () => {
553
- var k;
554
- return (k = b.current) == null ? void 0 : k.geometry.dispose();
555
- }, []), ee(({ clock: k }, I) => {
556
- const A = F.instances.get(r), _ = u.current;
557
- if (!A || !_) return;
558
- const O = Math.min(I, 0.1), P = performance.now(), Z = k.elapsedTime, X = F.runs.get(A.run), T = mt(A.run, (X == null ? void 0 : X.slot) ?? 0), f = me.get(A.run) ?? -175, p = Gt(A, P), G = zt(A, P), N = (P - A.bornAt) / 1e3, q = A.status === "thinking" || A.status === "spawning";
559
- let J = 0;
560
- for (const D of F.mcpPending.values()) D.instance === r && (J = Math.max(J, (P - D.since) / 1e3 + 0.01));
561
- const K = !q && !A.exitAt;
562
- let H = 0;
563
- a && (j.current += (V.fan - j.current) * Math.min(1, O * 3), H = j.current);
564
- const ce = _t[A.type] + V.dz, se = T + H, Ae = ae - (a ? 0.25 : 0), Ce = Math.sin(Z * 1.1 + l.seed * 6) * 0.35 * Y, nt = Math.cos(se) * Ae, rt = Math.sin(se) * Ae;
565
- if (!E.current) {
566
- const D = A.parent ? te.get(A.parent) : void 0;
567
- E.current = D && D.presence > 0 ? { x: D.pos.x, y: D.pos.y, zl: D.pos.z - f } : { x: nt * 0.7, y: rt * 0.7, zl: ce - 45 };
568
- }
569
- const ne = E.current, ve = Ye(N / 1.15);
570
- let De = ne.x + (nt - ne.x) * ve, _e = ne.y + (rt - ne.y) * ve, Be = f + ne.zl + (ce + Ce - ne.zl) * ve, ge = p, Ne = p * (1 + 4 * (1 - ve)), Te = Math.max(0, 1 - N / 0.5) * 2.5, pe = 0;
571
- if (A.exitAt) {
572
- if (pe = (P - A.exitAt) / 1e3, d.current || (d.current = new o.Vector3(De, _e, Be)), A.status === "failed")
573
- ge *= Math.max(0, 1 - pe * 1.3), Ne = ge;
574
- else {
575
- const D = Math.max(0, pe - 0.18);
576
- Be -= (6 * D + 120 * D * D) * Math.max(0.3, Y), Ne = p * (1 + 34 * Math.min(1, D * 1.6)), ge *= 1 - 0.55 * Math.min(1, D * 2);
577
- }
578
- Te += Math.max(0, 1 - pe / 0.5) * 4;
579
- }
580
- const ot = K ? (J ? 0.07 * Math.sin(Z * 3.2) : 0.05 * Math.sin(Z * 1.6)) * Y : 0;
581
- _.position.set(De, _e, Be);
582
- const Ue = Rt();
583
- _.scale.set(ge * (1 + ot) * (e ? 1.15 : 1) * Ue, ge * (1 + ot) * (e ? 1.15 : 1) * Ue, Ne * Ue), M.current && (M.current.rotation.z += O * (q ? 5.5 : K ? 0.5 : 2) * (1 + G * 1.6) * Math.max(0.25, Y));
584
- const ye = y.current;
585
- if (ye) {
586
- const D = q ? 1.7 + Math.sin(Z * 5) * 0.45 * Y : K ? J ? 0.55 + 0.35 * Math.sin(Z * 3.2) : 0.35 + 0.15 * Math.sin(Z * 1.6) : 1.1;
587
- ye.emissiveIntensity = D * 0.8 + G * 2.6 + Te, J ? ye.emissive.copy(c).lerp(hn, Math.min(0.55, J * 0.3)) : ye.emissive.copy(c), ye.opacity = Math.min(1, p * 1.4);
588
- }
589
- if (g.current) {
590
- const D = (q ? 1 + Math.sin(Z * 14) * 0.18 * Y : K ? 0.55 : 0.85) + G * 1.3;
591
- g.current.scale.setScalar(D), g.current.material.color.copy(W).multiplyScalar((K ? 0.8 : 1.9) + G * 2.5 + Te);
592
- }
593
- if (v.current) {
594
- const D = v.current.material;
595
- D.opacity = Math.min(1, ((K ? 0.1 : 0.24) + G * 0.25 + Te * 0.06) * p), v.current.scale.setScalar(1 + G * 0.8);
596
- }
597
- z.current && (z.current.visible = e, z.current.rotation.z -= O * 1.5), l.pos.set(De, _e, Be), l.energy = G, l.active = q ? 1 : K ? 0.2 : 0.6, l.presence = A.exitAt ? p * Math.max(0, 1 - pe * 2) : p;
598
- const de = L.current;
599
- if (de) {
600
- const D = N / 0.9, Ve = A.exitAt ? pe / 0.7 : 2, re = D < 1 ? D : Ve;
601
- if (de.visible = re < 1, de.visible) {
602
- D < 1 ? de.position.set(ne.x, ne.y, f + ne.zl) : d.current && de.position.copy(d.current);
603
- const ie = 1 - re;
604
- de.scale.setScalar(0.35 + re * 1.9), B.copy(D < 1 ? c : A.status === "failed" ? mn : Re).lerp(Re, 0.3).multiplyScalar(2.4 * ie), x.current.material.color.copy(B), x.current.material.opacity = ie * ie, R.current.material.color.copy(B), R.current.material.opacity = ie, C.current.material.color.copy(B), C.current.material.opacity = ie, C.current.scale.set(1 + re * 1.5, 1 + re * 1.5, 1 + re * 4);
605
- }
606
- }
607
- if (a && S.current && b.current) {
608
- if (S.current.position.z = f, S.current.rotation.z = T, Math.abs(H - $.current) > 4e-3 || Number.isNaN($.current)) {
609
- $.current = H;
610
- const ie = b.current.geometry;
611
- b.current.geometry = yn(H), ie.dispose();
612
- }
613
- const D = b.current.geometry, Ve = Ye(N / 1.3);
614
- D.setDrawRange(0, Math.floor(56 * Ve) * 5 * 6);
615
- const re = b.current.material;
616
- re.color.copy(c).multiplyScalar(1.4 + G * 2 + (q ? 0.6 : 0)), re.opacity = p * 0.9;
617
- }
618
- }), /* @__PURE__ */ m(We, { children: [
619
- /* @__PURE__ */ m("group", { ref: u, position: [0, 0, -200], children: [
620
- /* @__PURE__ */ m("group", { ref: M, children: [
621
- /* @__PURE__ */ m("mesh", { rotation: [Math.PI / 2, 0, 0], children: [
622
- /* @__PURE__ */ t("capsuleGeometry", { args: [0.36, 1.15, 6, 18] }),
623
- /* @__PURE__ */ t("meshStandardMaterial", { ref: y, color: c.clone().multiplyScalar(0.35), emissive: c, emissiveIntensity: 1, metalness: 0.5, roughness: 0.3, toneMapped: !1, transparent: !0 })
624
- ] }),
625
- [0, 1, 2].map((k) => /* @__PURE__ */ m("mesh", { rotation: [0, 0, k * Math.PI * 2 / 3], position: [0, 0, 0.45], children: [
626
- /* @__PURE__ */ t("boxGeometry", { args: [0.05, 1.25, 0.5] }),
627
- /* @__PURE__ */ t("meshBasicMaterial", { color: c.clone().lerp(Re, 0.3).multiplyScalar(1.6), toneMapped: !1 })
628
- ] }, k))
629
- ] }),
630
- /* @__PURE__ */ m("mesh", { ref: g, position: [0, 0, 0.95], children: [
631
- /* @__PURE__ */ t("sphereGeometry", { args: [0.22, 16, 12] }),
632
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1 })
633
- ] }),
634
- /* @__PURE__ */ m("mesh", { ref: v, position: [0, 0, 0.6], children: [
635
- /* @__PURE__ */ t("planeGeometry", { args: [2.6, 2.6] }),
636
- /* @__PURE__ */ t("meshBasicMaterial", { map: U, color: c.clone().multiplyScalar(1.6), transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
637
- ] }),
638
- /* @__PURE__ */ m("mesh", { ref: z, visible: !1, children: [
639
- /* @__PURE__ */ t("torusGeometry", { args: [1.05, 0.035, 6, 48] }),
640
- /* @__PURE__ */ t("meshBasicMaterial", { color: new o.Color(3, 3, 3), toneMapped: !1 })
641
- ] }),
642
- /* @__PURE__ */ m(
643
- "mesh",
644
- {
645
- onClick: (k) => (k.stopPropagation(), n(r)),
646
- onPointerOver: () => document.body.style.cursor = "pointer",
647
- onPointerOut: () => document.body.style.cursor = "",
648
- children: [
649
- /* @__PURE__ */ t("sphereGeometry", { args: [1.1, 10, 8] }),
650
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, opacity: 0, depthWrite: !1, colorWrite: !1 })
651
- ]
652
- }
653
- )
654
- ] }),
655
- /* @__PURE__ */ m("group", { ref: L, visible: !1, children: [
656
- /* @__PURE__ */ m("mesh", { ref: x, children: [
657
- /* @__PURE__ */ t("sphereGeometry", { args: [0.45, 16, 12] }),
658
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
659
- ] }),
660
- /* @__PURE__ */ m("mesh", { ref: R, children: [
661
- /* @__PURE__ */ t("ringGeometry", { args: [0.85, 1, 48] }),
662
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1, side: o.DoubleSide })
663
- ] }),
664
- /* @__PURE__ */ t("lineSegments", { ref: C, geometry: Mn, children: /* @__PURE__ */ t("lineBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 }) })
665
- ] }),
666
- a && /* @__PURE__ */ t("group", { ref: S, children: /* @__PURE__ */ m("mesh", { ref: b, children: [
667
- /* @__PURE__ */ t("bufferGeometry", {}),
668
- /* @__PURE__ */ t("meshBasicMaterial", { transparent: !0, blending: o.AdditiveBlending, depthWrite: !1, toneMapped: !1 })
669
- ] }) })
670
- ] });
671
- }
672
- function xn() {
673
- const n = h(null), s = w(() => new o.Object3D(), []), i = w(() => new o.Color(), []);
674
- return ee(({ clock: a }) => {
675
- const c = n.current;
676
- if (!c) return;
677
- const l = a.elapsedTime * Math.max(0.2, Y);
678
- let u = 0;
679
- for (const M of te.values()) {
680
- if (u + 9 > 270) break;
681
- if (M.presence <= 0.01) continue;
682
- const y = 0.6 + M.active * 1.4 + M.energy * 1.5;
683
- for (let g = 0; g < 9; g++) {
684
- const v = (l * y + g / 9 + M.seed * 7) % 1, z = M.seed * 40 + g * 2.39996, L = 0.25 + 0.55 * ((g * 0.618 + M.seed) % 1), x = 0.5 + M.active * 0.9 + M.energy * 2.6;
685
- s.position.set(M.pos.x + Math.cos(z) * L, M.pos.y + Math.sin(z) * L, M.pos.z + 1 + v * (2.5 + M.energy * 4)), s.scale.set(0.035, 0.035, x), s.updateMatrix(), c.setMatrixAt(u, s.matrix), i.copy(M.color).multiplyScalar((0.25 + M.active * 0.9 + M.energy * 2.2) * (1 - v) * M.presence), c.setColorAt(u, i), u++;
686
- }
687
- }
688
- c.count = u, c.instanceMatrix.needsUpdate = !0, c.instanceColor && (c.instanceColor.needsUpdate = !0);
689
- }), /* @__PURE__ */ m("instancedMesh", { ref: n, args: [void 0, void 0, 270], frustumCulled: !1, children: [
690
- /* @__PURE__ */ t("boxGeometry", { args: [1, 1, 1] }),
691
- /* @__PURE__ */ t("meshBasicMaterial", { toneMapped: !1, transparent: !0, blending: o.AdditiveBlending, depthWrite: !1 })
692
- ] });
693
- }
694
- function bn({ selected: r, onSelect: e }) {
695
- const n = tt(() => F.instances, kt);
696
- return /* @__PURE__ */ m("group", { children: [
697
- n.map((s) => /* @__PURE__ */ t(wn, { id: s, selected: r === s, onSelect: e }, s)),
698
- /* @__PURE__ */ t(xn, {})
699
- ] });
700
- }
701
- const dt = ae - 0.7, Sn = -5;
702
- function An(r, e, n) {
703
- const s = Ze.laneExpanded[r] > 0, i = ht(r) + (s ? Math.PI / 6 : 0), a = Math.sin(n * 0.7 + r * 1.7) * 0.2 * Y;
704
- return e.set(Math.cos(i) * dt, Math.sin(i) * dt + a, Sn);
705
- }
706
- function Cn() {
707
- return /* @__PURE__ */ t(Pt, { place: An, radius: 0.85, variant: "swarm", glowGain: 1.1, labelBelow: 1.1 });
708
- }
709
- const vn = new o.Vector2(9e-4, 6e-4);
710
- function Rn() {
711
- const r = It(), [e, n] = $e(null), [s, i] = $e(!1);
712
- return be(() => {
713
- le.paused = s;
714
- }, [s]), be(() => {
715
- const a = (c) => {
716
- c.code === "Space" && !(c.target instanceof HTMLInputElement) && (c.preventDefault(), i((l) => !l));
717
- };
718
- return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
719
- }, []), /* @__PURE__ */ m("div", { className: "scene-root", children: [
720
- /* @__PURE__ */ m(
721
- Mt,
722
- {
723
- camera: { position: [0, 0, Qe], fov: 62, near: 0.1, far: 400 },
724
- dpr: [1, 2],
725
- gl: { antialias: !1, powerPreference: "high-performance" },
726
- onPointerMissed: () => n(null),
727
- children: [
728
- /* @__PURE__ */ t("color", { attach: "background", args: ["#02030a"] }),
729
- /* @__PURE__ */ t("fog", { attach: "fog", args: ["#02030a", 45, 190] }),
730
- /* @__PURE__ */ t("ambientLight", { intensity: 0.35 }),
731
- /* @__PURE__ */ t("directionalLight", { position: [0, 4, 10], intensity: 1.2, color: "#c7d2fe" }),
732
- /* @__PURE__ */ t(jt, {}),
733
- /* @__PURE__ */ t(Zt, {}),
734
- /* @__PURE__ */ t($t, {}),
735
- /* @__PURE__ */ t(Xt, {}),
736
- /* @__PURE__ */ t(qt, {}),
737
- /* @__PURE__ */ t(Kt, {}),
738
- /* @__PURE__ */ t(Qt, { galaxy: r }),
739
- /* @__PURE__ */ t(fn, {}),
740
- /* @__PURE__ */ t(rn, {}),
741
- /* @__PURE__ */ t(bn, { selected: e, onSelect: n }),
742
- /* @__PURE__ */ t(Cn, {}),
743
- /* @__PURE__ */ t(un, {}),
744
- /* @__PURE__ */ t(pn, {}),
745
- /* @__PURE__ */ m(gt, { multisampling: 0, children: [
746
- /* @__PURE__ */ t(yt, { mipmapBlur: !0, intensity: 1.25, luminanceThreshold: 0.2, luminanceSmoothing: 0.25, radius: 0.72 }),
747
- /* @__PURE__ */ t(wt, { offset: Ie ? new o.Vector2() : vn, radialModulation: !0, modulationOffset: 0.25 }),
748
- /* @__PURE__ */ t(xt, { eskil: !1, offset: 0.22, darkness: 0.9 }),
749
- /* @__PURE__ */ t(bt, { opacity: 0.03 })
750
- ] })
751
- ]
752
- }
753
- ),
754
- /* @__PURE__ */ t(Ot, { title: "tunnel", subtitle: "time warp · hatchet lanes & gates · ships = agents · stars = falkordb · stations = mcp", selected: e, onClose: () => n(null), children: /* @__PURE__ */ t(
755
- "button",
756
- {
757
- className: "hud",
758
- onClick: () => i((a) => !a),
759
- title: "Space",
760
- style: { top: 16, left: "50%", transform: "translateX(-50%)", padding: "7px 14px", color: "#e2e8f0", font: "600 11px/1 'Public Sans', system-ui, sans-serif", letterSpacing: "0.08em", textTransform: "uppercase", cursor: "pointer" },
761
- children: s ? "▶ resume warp" : "❚❚ pause warp"
762
- }
763
- ) })
764
- ] });
765
- }
766
- export {
767
- Rn as default
768
- };