agentglow 0.4.0 → 0.4.2

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.
@@ -1,990 +0,0 @@
1
- var Oe = Object.defineProperty;
2
- var Ve = (t, e, s) => e in t ? Oe(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var k = (t, e, s) => Ve(t, typeof e != "symbol" ? e + "" : e, s);
4
- import { jsxs as Z, Fragment as Bt, jsx as b } from "react/jsx-runtime";
5
- import { EffectComposer as Fe, Bloom as je, Vignette as qe } from "@react-three/postprocessing";
6
- import * as r from "three";
7
- import { useFrame as lt, useThree as We } from "@react-three/fiber";
8
- import { useMemo as B, useRef as z, useEffect as le } from "react";
9
- import { T as fe, h as ot, f as Tt, K as Ke, w as G, D as Ue, a as Ct, J as $e, L as dt, A as Xe, u as Te, y as rt, m as Ie, c as be, d as Ne, E as He, R as Ze, C as Ye, P as Qe, e as Je, s as to, j as eo, k as oo, n as no, v as so } from "./KitScene-DQRuKA06.js";
10
- import { R as ro } from "./ResourceWire-BWuyirO3.js";
11
- var _e;
12
- const H = typeof window < "u" && !!((_e = window.matchMedia) != null && _e.call(window, "(prefers-reduced-motion: reduce)").matches), at = (t) => t < 0 ? 0 : t > 1 ? 1 : t, qt = (t) => 1 - Math.pow(1 - at(t), 3), re = (t) => (t = at(t), t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2), mt = () => performance.now() / 1e3, V = new r.Color(1, 1, 1), N = new r.Color("#bff3ff");
13
- new r.Color("#2dd4bf");
14
- const Nt = new r.Color("#fbbf24"), _t = new r.Color("#ff3048"), It = Object.fromEntries(Object.entries(fe).map(([t, e]) => [t, new r.Color(e).lerp(N, 0.38)])), ao = Object.fromEntries(Object.entries(fe).map(([t, e]) => [t, new r.Color(e)]));
15
- let Gt = null;
16
- function io() {
17
- if (Gt) return Gt;
18
- const t = document.createElement("canvas");
19
- t.width = t.height = 128;
20
- const e = t.getContext("2d"), s = e.createRadialGradient(64, 64, 0, 64, 64, 64);
21
- return s.addColorStop(0, "rgba(255,255,255,1)"), s.addColorStop(0.1, "rgba(255,255,255,0.7)"), s.addColorStop(0.35, "rgba(255,255,255,0.14)"), s.addColorStop(1, "rgba(255,255,255,0)"), e.fillStyle = s, e.fillRect(0, 0, 128, 128), Gt = new r.CanvasTexture(t), Gt.colorSpace = r.SRGBColorSpace, Gt;
22
- }
23
- function ae(t = "#fff") {
24
- return new r.SpriteMaterial({ map: io(), color: t, blending: r.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
25
- }
26
- function Zt(t = "#fff") {
27
- return new r.MeshBasicMaterial({ color: t, blending: r.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, side: r.DoubleSide });
28
- }
29
- function J(t) {
30
- return new r.LineBasicMaterial({ color: t ?? "#fff", vertexColors: t === void 0, transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 });
31
- }
32
- const xe = (() => {
33
- const t = [];
34
- for (let s = 0; s < 48; s++) {
35
- const o = s / 48 * Math.PI * 2, h = (s + 0.55) / 48 * Math.PI * 2;
36
- t.push(Math.cos(o), Math.sin(o), 0, Math.cos(h), Math.sin(h), 0);
37
- }
38
- return new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
39
- })(), co = new r.SphereGeometry(1, 12, 8);
40
- function $t(t, e, s, o, h) {
41
- const c = 1 - o;
42
- return h.set(c * c * t.x + 2 * c * o * e.x + o * o * s.x, c * c * t.y + 2 * c * o * e.y + o * o * s.y, c * c * t.z + 2 * c * o * e.z + o * o * s.z);
43
- }
44
- function Wt(t, e, s, o) {
45
- const h = e.x - t.x, c = e.y - t.y;
46
- return o.copy(t).add(e).multiplyScalar(0.5), o.x += -c * s, o.y += h * s, o;
47
- }
48
- const lo = (
49
- /* glsl */
50
- `
51
- attribute vec4 aData; attribute vec3 aColor;
52
- uniform float uTime; uniform float uScale; uniform float uMinPx;
53
- varying vec3 vC; varying float vKind;
54
- void main(){
55
- float age = uTime - aData.x;
56
- float u = age / aData.y;
57
- if (age < 0.0 || u >= 1.0) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; return; }
58
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
59
- float kind = aData.w;
60
- float sz; float a;
61
- if (kind < 0.5) {
62
- sz = aData.z * (0.6 + 0.4 * smoothstep(0.0, 0.08, u));
63
- a = (1.0 - smoothstep(0.3, 1.0, u)) * (1.0 + 1.6 * exp(-age * 7.0));
64
- } else if (kind < 1.5) {
65
- sz = aData.z * (0.55 + 0.9 * sqrt(u));
66
- a = (1.0 - u) * (1.0 - u);
67
- } else {
68
- sz = aData.z * (0.15 + 1.6 * sqrt(u));
69
- a = (1.0 - u) * (1.0 - u) * 1.2;
70
- }
71
- vC = aColor * a; vKind = kind;
72
- float px = sz * uScale / -mv.z;
73
- // tiny far bubbles keep a readable dot (a little dimmer instead of vanishing)
74
- if (kind < 0.5 && px < uMinPx) { vC *= 0.55 + 0.45 * px / uMinPx; px = uMinPx; }
75
- gl_PointSize = clamp(px, 0.0, 256.0);
76
- gl_Position = projectionMatrix * mv;
77
- }`
78
- ), fo = (
79
- /* glsl */
80
- `
81
- varying vec3 vC; varying float vKind;
82
- void main(){
83
- vec2 p = gl_PointCoord - 0.5;
84
- float r = length(p) * 2.0;
85
- if (r > 1.0) discard;
86
- float k;
87
- if (vKind < 0.5) {
88
- // a bubble: bright core with a faint refracting rim
89
- k = smoothstep(1.0, 0.15, r) * 0.9 + smoothstep(0.55, 0.8, r) * smoothstep(1.0, 0.82, r) * 0.45;
90
- } else if (vKind < 1.5) {
91
- k = exp(-r * r * 9.0) * 1.5 + pow(1.0 - r, 3.0) * 0.4;
92
- } else {
93
- k = smoothstep(0.72, 0.9, r) * smoothstep(1.0, 0.92, r) * 1.6;
94
- }
95
- gl_FragColor = vec4(vC * k, 1.0);
96
- }`
97
- ), uo = 32768;
98
- class ho {
99
- constructor(e = uo) {
100
- k(this, "geo", new r.BufferGeometry());
101
- k(this, "mat", new r.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uScale: { value: 400 }, uMinPx: { value: 2.4 } }, vertexShader: lo, fragmentShader: fo, transparent: !0, depthWrite: !1, blending: r.AdditiveBlending }));
102
- k(this, "obj");
103
- k(this, "P");
104
- k(this, "D");
105
- k(this, "C");
106
- k(this, "head", 0);
107
- k(this, "lo", -1);
108
- k(this, "n", 0);
109
- this.max = e, this.P = new r.BufferAttribute(new Float32Array(e * 3), 3).setUsage(r.DynamicDrawUsage);
110
- const s = new Float32Array(e * 4);
111
- for (let o = 0; o < e; o++) s[o * 4 + 1] = 1e-3;
112
- this.D = new r.BufferAttribute(s, 4).setUsage(r.DynamicDrawUsage), this.C = new r.BufferAttribute(new Float32Array(e * 3), 3).setUsage(r.DynamicDrawUsage), this.geo.setAttribute("position", this.P), this.geo.setAttribute("aData", this.D), this.geo.setAttribute("aColor", this.C), this.geo.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), this.obj = new r.Points(this.geo, this.mat), this.obj.frustumCulled = !1, this.obj.renderOrder = 2;
113
- }
114
- /** one bubble/flash; `birth` in nowS() seconds (future = drawn later), colour premultiplied by `k` */
115
- emit(e, s, o, h, c, a, l, f, u = 0) {
116
- const i = this.head;
117
- this.head = (i + 1) % this.max, this.lo < 0 && (this.lo = i), this.n++;
118
- const m = this.P.array, p = this.D.array, d = this.C.array;
119
- m[i * 3] = e, m[i * 3 + 1] = s, m[i * 3 + 2] = o, p[i * 4] = f, p[i * 4 + 1] = l, p[i * 4 + 2] = h, p[i * 4 + 3] = u, d[i * 3] = c.r * a, d[i * 3 + 1] = c.g * a, d[i * 3 + 2] = c.b * a;
120
- }
121
- /** upload the slots written since the last flush (one or two ranges) */
122
- flush() {
123
- if (this.lo < 0) return;
124
- const e = [this.P, this.D, this.C];
125
- for (const s of e) {
126
- s.clearUpdateRanges();
127
- const o = s.itemSize;
128
- this.n >= this.max ? s.addUpdateRange(0, this.max * o) : this.lo + this.n <= this.max ? s.addUpdateRange(this.lo * o, this.n * o) : (s.addUpdateRange(this.lo * o, (this.max - this.lo) * o), s.addUpdateRange(0, (this.lo + this.n - this.max) * o)), s.needsUpdate = !0;
129
- }
130
- this.lo = -1, this.n = 0;
131
- }
132
- setScale(e, s, o) {
133
- this.mat.uniforms.uScale.value = e * s / (2 * Math.tan(o * Math.PI / 360)), this.mat.uniforms.uMinPx.value = 2.4 * s;
134
- }
135
- }
136
- let po = null;
137
- const tt = () => po ?? (po = new ho());
138
- function ie(t, e, s, o, h, c, a, l) {
139
- const f = tt();
140
- for (let u = 0; u < e; u++) {
141
- const i = Math.random() * 2 - 1, m = Math.random() * Math.PI * 2, p = Math.sqrt(1 - i * i), d = s * Math.cbrt(Math.random());
142
- f.emit(t.x + Math.cos(m) * p * d, t.y + Math.sin(m) * p * d, t.z + i * d, o * (0.7 + Math.random() * 0.7), h, c * (0.7 + Math.random() * 0.5), a * (0.8 + Math.random() * 0.4), l + Math.random() * 0.08, 0);
143
- }
144
- }
145
- function Be(t, e, s, o, h, c, a, l, f, u, i, m = 0) {
146
- const p = tt(), d = t.x + Math.cos(e + i * Math.PI * 0.5) * s, y = t.y + Math.sin(e + i * Math.PI * 0.5) * s, n = e - i * Math.PI * 0.5;
147
- for (let v = 0; v < h; v++) {
148
- const g = v / (h - 1), x = n + i * g * o * Math.PI * 2, T = s * (1 - 0.82 * g);
149
- p.emit(d + Math.cos(x) * T, y + Math.sin(x) * T, t.z + m * Math.sqrt(g), c * (1 - 0.35 * g), a, l, f, u + g * 0.35, 0);
150
- }
151
- }
152
- class Jt {
153
- constructor(e, s = 32) {
154
- k(this, "geo", new r.BufferGeometry());
155
- k(this, "obj");
156
- k(this, "P");
157
- k(this, "C");
158
- k(this, "n", 0);
159
- k(this, "p", new r.Vector3());
160
- this.max = e, this.seg = s, this.P = new r.BufferAttribute(new Float32Array(e * s * 6), 3).setUsage(r.DynamicDrawUsage), this.C = new r.BufferAttribute(new Float32Array(e * s * 6), 3).setUsage(r.DynamicDrawUsage), this.geo.setAttribute("position", this.P), this.geo.setAttribute("color", this.C), this.geo.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), this.obj = new r.LineSegments(this.geo, J()), this.obj.frustumCulled = !1;
161
- }
162
- begin() {
163
- this.n = 0;
164
- }
165
- add(e, s, o, h, c, a, l, f, u, i, m) {
166
- if (this.n >= this.max || l <= a || c < 3e-3 && m < 3e-3) return;
167
- const p = this.seg, d = this.P, y = this.C;
168
- for (let n = 0; n < p; n++) {
169
- const v = a + (l - a) * (n + 0.5) / p;
170
- let g = 1;
171
- f > 0 && (g = Math.sin((v * f - u) * Math.PI * 2) > -0.1 ? 1 : 0);
172
- for (let x = 0; x < 2; x++) {
173
- const T = a + (l - a) * (n + x) / p;
174
- $t(e, s, o, T, this.p);
175
- const P = (this.n * p + n) * 2 + x;
176
- d.setXYZ(P, this.p.x, this.p.y, this.p.z);
177
- let C = c * g;
178
- i >= 0 && (C += m * Math.exp(-(((T - i) / 0.05) ** 2))), y.setXYZ(P, h.r * C, h.g * C, h.b * C);
179
- }
180
- }
181
- this.n++;
182
- }
183
- end() {
184
- this.geo.setDrawRange(0, this.n * this.seg * 2), this.P.needsUpdate = !0, this.C.needsUpdate = !0;
185
- }
186
- }
187
- class ue {
188
- constructor() {
189
- k(this, "x", 0);
190
- k(this, "y", 0);
191
- k(this, "z", 0);
192
- k(this, "acc", 0);
193
- k(this, "started", !1);
194
- }
195
- reset() {
196
- this.started = !1, this.acc = 0;
197
- }
198
- step(e, s, o, h, c, a, l, f = 8) {
199
- if (!this.started) {
200
- this.started = !0, this.x = e.x, this.y = e.y, this.z = e.z;
201
- return;
202
- }
203
- const u = e.x - this.x, i = e.y - this.y, m = e.z - this.z, p = Math.sqrt(u * u + i * i + m * m);
204
- if (p > s * 40) {
205
- this.x = e.x, this.y = e.y, this.z = e.z, this.acc = 0;
206
- return;
207
- }
208
- this.acc += p;
209
- const d = tt();
210
- let y = 0;
211
- for (; this.acc >= s && y < f; ) {
212
- this.acc -= s;
213
- const n = p > 1e-6 ? 1 - this.acc / p : 1, v = (Math.random() - 0.5) * s * 0.35;
214
- d.emit(this.x + u * n + v, this.y + i * n - v, this.z + m * n, o * (0.65 + Math.random() * 0.7), h, c * (0.75 + Math.random() * 0.4), a, l, 0), y++;
215
- }
216
- this.acc > s && (this.acc = s), this.x = e.x, this.y = e.y, this.z = e.z;
217
- }
218
- }
219
- const Yt = /* @__PURE__ */ new Map();
220
- function oe(t, e, s, o, h = performance.now()) {
221
- let c = Yt.get(t);
222
- c || Yt.set(t, c = { x: 0, y: 0, z: 0, at: -1e9 }), c.x = e, c.y = s, c.z = o, c.at = h;
223
- }
224
- const mo = (t) => t < 0 ? 0 : t < 50 ? t / 50 : Math.exp(-(t - 50) / 260), zt = /* @__PURE__ */ new Map(), I = { rx: 9, ry: 6, hz: 5 }, Ht = /* @__PURE__ */ new Map();
225
- function yo(t, e) {
226
- if (e < 2) return 0;
227
- const s = Math.min(2 * (I.hz - 2.6), (e - 1) * 5);
228
- return ((t % 2 === 0 ? t / 2 : e - 1 - (t - 1) / 2) / (e - 1) - 0.5) * s;
229
- }
230
- function De(t) {
231
- var a;
232
- const e = ((a = Ht.get(t.run.id)) == null ? void 0 : a.z) ?? 0, s = ot(t.id, 77) - 0.5, o = Math.max(t.inst.parent ? 2 : 1.2, I.hz * (t.inst.parent ? 0.34 + 0.05 * Math.min(2, t.depth - 1) : 0.14)), h = e + s * 2 * o * Math.max(0.85, Math.min(1.2, Tt.spread)), c = Math.max(0.5, I.hz - 1.1);
233
- return h < -c ? -c : h > c ? c : h;
234
- }
235
- const St = 7, Kt = 8, he = 5, ut = 6.2, ht = 3.5, pe = 0.08, Ge = 0.92, Le = 0.52, go = 0.09, Mo = 1.15, Ft = Kt * he, it = St * Ft, de = ut / Kt, me = ht / he, Ee = (St - 1) / 2 * Ge + ht / 2 * Math.sin(Le), wo = Math.hypot(ut / 2 + 0.6, Ee + 0.4), vo = 32, Xt = 3, ke = new r.BoxGeometry(ut, pe, ht), bo = new r.EdgesGeometry(ke), xo = (() => {
236
- const t = [], e = pe / 2 + 4e-3;
237
- for (let s = 1; s < Kt; s++) {
238
- const o = -ut / 2 + s * de;
239
- t.push(o, e, -ht / 2, o, e, ht / 2);
240
- }
241
- for (let s = 1; s < he; s++) {
242
- const o = -ht / 2 + s * me;
243
- t.push(-ut / 2, e, o, ut / 2, e, o);
244
- }
245
- return t.push(-ut / 2 + 0.15, e, ht / 2 - 0.14, -ut / 2 + 1.4, e, ht / 2 - 0.14), new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
246
- })(), zo = new r.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), So = (t, e, s) => {
247
- e.set(0, (t - (St - 1) / 2) * Ge, 0), Se.set(Le, (t - (St - 1) / 2) * go, 0, "YXZ"), s.setFromEuler(Se);
248
- }, ze = (t, e) => {
249
- const s = t % Ft;
250
- return e.set(-ut / 2 + (s % Kt + 0.5) * de, pe / 2 + 0.01, -ht / 2 + (Math.floor(s / Kt) + 0.5) * me);
251
- }, Se = new r.Euler();
252
- function Co({ galaxy: t }) {
253
- const e = t.nodes.length, s = B(() => {
254
- const v = new Int32Array(e), g = new Float32Array(it), x = Array.from({ length: it }, () => new r.Color(0, 0, 0)), T = new r.Color();
255
- t.nodes.forEach((P, C) => {
256
- const S = Math.floor(ot(P.id, 9) * it) % it;
257
- v[C] = S, g[S]++, x[S].add(T.set(Ke[P.kind] ?? "#94a3b8"));
258
- });
259
- for (let P = 0; P < it; P++) g[P] && x[P].multiplyScalar(1 / g[P]).lerp(N, 0.35);
260
- return { cellOf: v, occ: g, base: x, dep: new Float32Array(it), white: new Float32Array(it), depC: Array.from({ length: it }, () => new r.Color()) };
261
- }, [t, e]), o = B(
262
- () => Array.from({ length: St }, () => ({
263
- fill: Zt("#000"),
264
- edge: J("#000"),
265
- grid: J("#000"),
266
- m: new r.Matrix4(),
267
- pos: new r.Vector3(),
268
- q: new r.Quaternion(),
269
- slide: 0,
270
- act: 0,
271
- read: 0,
272
- tint: new r.Color(),
273
- want: new r.Color()
274
- })),
275
- []
276
- ), h = z([]), c = B(() => new r.MeshBasicMaterial({ blending: r.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, side: r.DoubleSide }), []), a = B(() => {
277
- const v = new r.InstancedMesh(zo, c, it);
278
- return v.instanceColor = new r.InstancedBufferAttribute(new Float32Array(it * 3), 3), v.frustumCulled = !1, v.renderOrder = 3, v;
279
- }, [c]), l = B(() => new Jt(vo, 24), []), f = B(() => /* @__PURE__ */ new Map(), [t]), u = B(() => /* @__PURE__ */ new Set(), []), i = z([]), m = z([]), p = z(Array(Xt).fill("")), d = B(
280
- () => ({ v: new r.Vector3(), w: new r.Vector3(), ctrl: new r.Vector3(), h: new r.Vector3(), c: new r.Color(), cm: new r.Matrix4(), sm: new r.Matrix4(), off: new r.Vector3(), one: new r.Vector3(1, 1, 1) }),
281
- []
282
- ), y = (v) => {
283
- let g = f.get(v);
284
- return g === void 0 && f.set(v, g = Xe(t, v)), s.cellOf[g] ?? 0;
285
- }, n = (v, g) => ze(v, g).applyMatrix4(o[Math.floor(v / Ft)].m);
286
- return lt(({ clock: v }, g) => {
287
- var Q;
288
- const x = performance.now(), T = mt(), P = Math.min(0.05, g), C = H ? 0 : v.elapsedTime, { occ: S, base: A, dep: j, white: F, depC: D } = s, { v: L, w: E, ctrl: K, h: et, c: Y, cm: yt, sm: gt, off: Mt, one: At } = d;
289
- j.fill(0), F.fill(0);
290
- for (const w of o)
291
- w.act = 0, w.read = 0, w.want.setRGB(0, 0, 0);
292
- for (const w of G.flares) {
293
- const M = y(w.node), R = (x - w.start) / 1e3, U = G.instances.get(w.instance), O = U ? It[U.type] : N, q = w.op === "write", $ = R < 0.25 ? R / 0.25 : Math.exp(-(R - 0.25) * 1.1);
294
- $ > j[M] && (j[M] = $, D[M].copy(q ? V : O), F[M] = q ? 1 : 0);
295
- const st = o[Math.floor(M / Ft)];
296
- $ > st.act && (st.act = $, st.want.copy(q ? V : O)), !q && R < 2.2 && (st.read = Math.max(st.read, R < 0.2 ? R / 0.2 : at((2.2 - R) / 0.8)));
297
- }
298
- for (let w = 0; w < St; w++) {
299
- const M = o[w];
300
- M.slide += (M.read - M.slide) * Math.min(1, P * (M.read > M.slide ? 7 : 2.5)), So(w, M.pos, M.q), Mt.set(0, 0.06, Mo).applyQuaternion(M.q).multiplyScalar(Ao(M.slide)), M.pos.add(Mt), M.m.compose(M.pos, M.q, At);
301
- const R = h.current[w];
302
- R && (R.position.copy(M.pos), R.quaternion.copy(M.q)), M.tint.lerp(M.act > 0.02 ? M.want : N, Math.min(1, P * 6));
303
- const U = H ? 1 : 0.9 + 0.1 * Math.sin(C * 0.7 + w * 1.3), O = M.act;
304
- M.edge.color.copy(N).lerp(M.tint, O).multiplyScalar((0.2 + 0.06 * w / St) * U + O * 0.75 + M.slide * 0.2), M.grid.color.copy(N).lerp(M.tint, O).multiplyScalar(0.06 + O * 0.18), M.fill.color.copy(Y.set("#4fd1c5")).lerp(M.tint, O * 0.8).multiplyScalar(0.03 + O * 0.06 + M.slide * 0.03);
305
- }
306
- l.begin();
307
- for (const w of u) {
308
- let M = !1;
309
- for (const R of G.flares) R.id === w && (M = !0);
310
- M || u.delete(w);
311
- }
312
- for (const w of G.flares) {
313
- const M = y(w.node), R = (x - w.start) / 1e3, U = G.instances.get(w.instance), O = U ? It[U.type] : N, q = w.op === "write";
314
- n(M, L), Ue(L, E), q && !u.has(w.id) && R > 0.55 && (u.add(w.id), ie(E, 12, 0.45, 0.1, V, 1, 2.2, T), tt().emit(E.x, E.y, E.z, 1.2, V, 0.9, 0.5, T, 2));
315
- const $ = Ct(w.instance);
316
- if ($ && R < 1.9) {
317
- Wt($, E, 0.1, K);
318
- const st = Math.min(1, R / 0.2) * Math.pow(1 - R / 1.9, 1.5), pt = q ? Math.min(1, R * 1.6) : 1 - Math.min(1, R * 1.6);
319
- Y.copy(q ? V : O).lerp(V, 0.2), l.add($, K, E, Y, (q ? 0.32 : 0.24) * st, 0.03, 0.99, 0, 0, pt, 1.5 * st), pt > 0.02 && pt < 0.98 && ($t($, K, E, pt, et), tt().emit(et.x, et.y, et.z, 0.45, Y, 1.3 * st, 0.12, T, 1));
320
- }
321
- }
322
- l.end();
323
- const wt = a.instanceColor;
324
- for (let w = 0; w < it; w++) {
325
- const M = j[w], R = S[w] > 0, U = H ? 1 : 0.85 + 0.15 * Math.sin(C * 0.8 + w * 1.7), O = R || M > 0.01 ? 0.36 + 0.12 * Math.min(1, S[w] / 3) + 0.4 * M : 1e-4;
326
- ze(w, L), gt.makeScale(O * de, 1, O * me).setPosition(L), yt.multiplyMatrices(o[Math.floor(w / Ft)].m, gt), a.setMatrixAt(w, yt), Y.copy(A[w]).multiplyScalar(R ? (0.3 + 0.15 * Math.min(1, S[w] / 3)) * U : 0), M > 0.01 && (Y.r += D[w].r * M * 1.5 + M * 0.25 * (1 + F[w]), Y.g += D[w].g * M * 1.5 + M * 0.25 * (1 + F[w]), Y.b += D[w].b * M * 1.5 + M * 0.25 * (1 + F[w])), wt.setXYZ(w, Y.r, Y.g, Y.b);
327
- }
328
- a.instanceMatrix.needsUpdate = !0, wt.needsUpdate = !0;
329
- let nt = 0;
330
- for (let w = G.flares.length - 1; w >= 0 && nt < Xt; w--) {
331
- const M = G.flares[w];
332
- if (x - M.start > 2200) break;
333
- let R = !1;
334
- n(y(M.node), L);
335
- for (let q = 0; q < nt; q++) {
336
- const $ = m.current[q];
337
- (p.current[q] === M.node || $ && Math.abs($.position.y - L.y) < 0.55 && Math.abs($.position.x - L.x) < 3.2) && (R = !0);
338
- }
339
- if (R) continue;
340
- const U = i.current[nt], O = m.current[nt];
341
- U && O && (O.position.copy(L), p.current[nt] !== M.node && (U.setText(`${M.op === "write" ? "wrote" : "read"} · ${M.node}`), U.setColor(M.op === "write" ? "#ffffff" : "#8fe9f5")), U.setOpacity(at(1.4 - (x - M.start) / 1600))), p.current[nt] = M.node, nt++;
342
- }
343
- for (let w = nt; w < Xt; w++)
344
- (Q = i.current[w]) == null || Q.setOpacity(0), p.current[w] = "";
345
- }), /* @__PURE__ */ Z(Bt, { children: [
346
- o.map((v, g) => /* @__PURE__ */ Z("group", { ref: (x) => void (h.current[g] = x), children: [
347
- /* @__PURE__ */ b("mesh", { geometry: ke, material: v.fill }),
348
- /* @__PURE__ */ b("lineSegments", { geometry: bo, material: v.edge }),
349
- /* @__PURE__ */ b("lineSegments", { geometry: xo, material: v.grid })
350
- ] }, g)),
351
- /* @__PURE__ */ b("primitive", { object: a }),
352
- /* @__PURE__ */ b($e, { children: /* @__PURE__ */ b("primitive", { object: l.obj }) }),
353
- Array.from({ length: Xt }, (v, g) => /* @__PURE__ */ b("group", { ref: (x) => void (m.current[g] = x), children: /* @__PURE__ */ b(dt, { ref: (x) => void (i.current[g] = x), text: "", offset: [0, 0.45], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, g)),
354
- /* @__PURE__ */ b(Po, {})
355
- ] });
356
- }
357
- const Ao = (t) => 1 - Math.pow(1 - at(t), 2);
358
- function Po() {
359
- const t = Te(), e = t.graphLabel === "knowledge graph" ? "FalkorDB" : t.graphLabel;
360
- return /* @__PURE__ */ b(
361
- dt,
362
- {
363
- declutter: "resource",
364
- position: [0, Ee + 0.75, 0],
365
- text: `${e} · event archive`,
366
- color: "#5eead4",
367
- letterSpacing: 0.04,
368
- size: 0.28,
369
- opacity: 0.85,
370
- pxRange: [8, 12]
371
- }
372
- );
373
- }
374
- const Ro = (
375
- /* glsl */
376
- "varying vec2 vW; void main(){ vW = position.xy; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }"
377
- ), _o = (
378
- /* glsl */
379
- `
380
- uniform float uTime; varying vec2 vW;
381
- float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
382
- float n(vec2 p){ vec2 i = floor(p); vec2 f = fract(p); f = f*f*(3.0-2.0*f);
383
- return mix(mix(h(i), h(i+vec2(1,0)), f.x), mix(h(i+vec2(0,1)), h(i+vec2(1,1)), f.x), f.y); }
384
- void main(){
385
- float r = length(vW * vec2(0.85, 1.0));
386
- // back-lit chamber: a soft cool glow in the middle, deep blue-black at the edges
387
- vec3 col = mix(vec3(0.010, 0.030, 0.036), vec3(0.003, 0.007, 0.012), smoothstep(4.0, 46.0, r));
388
- // emulsion: very low-frequency blotches
389
- float b = n(vW * 0.07) * 0.6 + n(vW * 0.19 + 3.0) * 0.4;
390
- col *= 0.8 + 0.45 * b;
391
- // film grain (screen space, animated)
392
- float g = h(gl_FragCoord.xy + fract(uTime * 7.31) * 113.0) - 0.5;
393
- col += vec3(0.006, 0.011, 0.013) * g * 2.0;
394
- gl_FragColor = vec4(col, 1.0);
395
- }`
396
- ), To = (
397
- /* glsl */
398
- `
399
- varying vec3 vN; varying vec3 vV; varying float vZ;
400
- void main(){
401
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
402
- vN = normalize(normalMatrix * normal); vV = normalize(-mv.xyz); vZ = position.y;
403
- gl_Position = projectionMatrix * mv;
404
- }`
405
- ), Io = (
406
- /* glsl */
407
- `
408
- uniform vec3 uC; varying vec3 vN; varying vec3 vV; varying float vZ;
409
- void main(){
410
- float f = 1.0 - abs(dot(normalize(vN), normalize(vV)));
411
- float k = pow(f, 4.0) * 0.8 + 0.012;
412
- // faint streaks along the axis (the steel staves' reflections in the glass)
413
- k *= 0.85 + 0.15 * smoothstep(0.6, 1.0, abs(vZ));
414
- gl_FragColor = vec4(uC * k, 1.0);
415
- }`
416
- ), jt = Math.PI * 2;
417
- function Bo() {
418
- const t = (u, i, m, p = 128) => {
419
- for (let d = 0; d < p; d++) {
420
- const y = d / p * jt, n = (d + 1) / p * jt;
421
- u.push(Math.cos(y) * i, Math.sin(y) * i, m, Math.cos(n) * i, Math.sin(n) * i, m);
422
- }
423
- }, e = [];
424
- for (const u of [-1, 1])
425
- t(e, 1, u), t(e, 1.045, u), t(e, 1.045, u * 0.97);
426
- const s = [], o = 24;
427
- for (let u = 0; u < o; u++) {
428
- const i = u / o * jt, m = Math.cos(i) * 1.045, p = Math.sin(i) * 1.045;
429
- for (let d = 0; d < 40; d++) {
430
- if (d % 2) continue;
431
- const y = -1 + d / 40 * 2, n = -1 + (d + 1) / 40 * 2;
432
- s.push(m, p, y, m, p, n);
433
- }
434
- }
435
- for (const u of [-0.34, 0.34]) t(s, 1.045, u, 96);
436
- const h = [];
437
- for (const u of [-0.72, 0.72]) for (let i = 0; i < 4; i++) t(h, 1.1 + i % 2 * 0.025, u + (i - 1.5) * 0.035, 128);
438
- const c = [];
439
- let a = 9001;
440
- const l = () => (a = a * 16807 % 2147483647) / 2147483647;
441
- for (let u = 0; u < 14; u++) {
442
- const i = -0.85 + l() * 1.7, m = -0.92 + l() * 1.84, p = (6 + l() * 14) * (l() < 0.5 ? 1 : -1), d = 0.012;
443
- for (let y = -1.1; y < 1.1; y += d) {
444
- if (l() < 0.42) continue;
445
- const n = y + d * 0.45, v = i + y * y / (2 * p), g = i + n * n / (2 * p);
446
- y * y + v * v > 0.97 || n * n + g * g > 0.97 || c.push(y, v, m, n, g, m);
447
- }
448
- }
449
- const f = (u) => new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(u, 3));
450
- return { steel: f(e), staves: f(s), coils: f(h), beams: f(c) };
451
- }
452
- function Do(t, e) {
453
- const s = [];
454
- for (let c = -Math.floor(t / 3) * 3; c <= t; c += 3)
455
- for (let a = -Math.floor(e / 3) * 3; a <= e; a += 3)
456
- if (!((c / t) ** 2 + (a / e) ** 2 > 0.86))
457
- for (const l of [-1, 1]) s.push(c - 0.26, a, l, c + 0.26, a, l, c, a - 0.26, l, c, a + 0.26, l);
458
- return new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(s, 3));
459
- }
460
- const Go = (() => {
461
- const t = [];
462
- for (let e = 0; e < 24; e++) e % 2 === 0 && t.push(0, 0, -1 + e / 24 * 2, 0, 0, -1 + (e + 1) / 24 * 2);
463
- return t.push(0, 0, 1, 0.09, 0, 0.84, 0, 0, 1, -0.09, 0, 0.84, 0, 0, 1, 0, 0.09, 0.84, 0, 0, 1, 0, -0.09, 0.84), new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
464
- })();
465
- function Lo() {
466
- const t = B(Bo, []), e = B(
467
- () => ({
468
- back: new r.ShaderMaterial({ uniforms: { uTime: { value: 0 } }, vertexShader: Ro, fragmentShader: _o, depthWrite: !1 }),
469
- steel: J(new r.Color("#9fd8e0").multiplyScalar(0.15)),
470
- staves: J(new r.Color("#7cc6d0").multiplyScalar(0.07)),
471
- coils: J(new r.Color("#d79a52").multiplyScalar(0.12)),
472
- beams: J(new r.Color("#8fdcea").multiplyScalar(0.07)),
473
- fid: J(new r.Color("#4fd1c5").multiplyScalar(0.22)),
474
- arrow: J(new r.Color("#d79a52").multiplyScalar(0.45)),
475
- glass: new r.ShaderMaterial({
476
- uniforms: { uC: { value: new r.Color("#6fd3e0").multiplyScalar(0.075) } },
477
- vertexShader: To,
478
- fragmentShader: Io,
479
- transparent: !0,
480
- depthWrite: !1,
481
- blending: r.AdditiveBlending,
482
- side: r.DoubleSide
483
- })
484
- }),
485
- []
486
- ), s = B(() => new r.CylinderGeometry(1.045, 1.045, 2, 96, 1, !0).rotateX(Math.PI / 2), []), o = z(null), h = z(null), c = z("");
487
- le(() => () => {
488
- var d;
489
- return (d = o.current) == null ? void 0 : d.dispose();
490
- }, []);
491
- const a = z(0), l = z(null), f = z(null), u = z(null), i = z(null), m = z(null), p = z(!1);
492
- return lt(({ clock: d, camera: y }, n) => {
493
- var L, E, K, et;
494
- e.back.uniforms.uTime.value = H ? 0 : d.elapsedTime, l.current && (y.getWorldDirection(Ae), l.current.position.copy(Ae).multiplyScalar(14), l.current.quaternion.copy(y.quaternion));
495
- const v = rt.core, g = v.hw + 0.9, x = v.hh + 0.9, T = r.MathUtils.clamp(0.72 * Math.min(g, x), 5, 13), P = p.current ? Math.min(1, n * 2.5) : 1;
496
- p.current = !0, I.rx += (g - I.rx) * P, I.ry += (x - I.ry) * P, I.hz += (T - I.hz) * P, (L = f.current) == null || L.scale.set(I.rx, I.ry, I.hz), (E = u.current) == null || E.scale.set(1, 1, I.hz);
497
- const C = `${Math.round(I.rx * 2)}:${Math.round(I.ry * 2)}`;
498
- C !== c.current && h.current && (c.current = C, (K = o.current) == null || K.dispose(), o.current = Do(I.rx, I.ry), h.current.geometry = o.current), i.current && (i.current.position.set(0, I.ry * 1.13 + 0.25, 0), i.current.scale.set(1, 1, I.hz * 0.55)), (et = m.current) == null || et.position.set(0, I.ry * 1.13 + 0.62, I.hz * 0.55);
499
- const S = mt();
500
- if (H || S < a.current) return;
501
- a.current = S + 1.4 + Math.random() * 2.2;
502
- const A = Math.random() * jt, j = Math.sqrt(Math.random()) * 0.85;
503
- Ce.set(Math.cos(A) * j * I.rx, Math.sin(A) * j * I.ry, (Math.random() - 0.5) * 1.7 * I.hz);
504
- const F = Math.random() < 0.3, D = Math.random() < 0.5 ? 1 : -1;
505
- Be(Ce, Math.random() * jt, F ? 0.9 + Math.random() * 0.8 : 0.3 + Math.random() * 0.4, F ? 2.4 : 1.6, F ? 70 : 30, 0.075, N, 0.3, 6, S, D, D * (F ? 1.4 : 0.6));
506
- }), /* @__PURE__ */ Z(Bt, { children: [
507
- /* @__PURE__ */ b("mesh", { ref: l, material: e.back, position: [0, 0, -14], renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ b("planeGeometry", { args: [700, 500] }) }),
508
- /* @__PURE__ */ Z("group", { ref: f, children: [
509
- /* @__PURE__ */ b("mesh", { geometry: s, material: e.glass, renderOrder: -5, frustumCulled: !1 }),
510
- /* @__PURE__ */ b("lineSegments", { geometry: t.steel, material: e.steel, frustumCulled: !1 }),
511
- /* @__PURE__ */ b("lineSegments", { geometry: t.staves, material: e.staves, frustumCulled: !1 }),
512
- /* @__PURE__ */ b("lineSegments", { geometry: t.coils, material: e.coils, frustumCulled: !1 }),
513
- /* @__PURE__ */ b("lineSegments", { geometry: t.beams, material: e.beams, frustumCulled: !1 })
514
- ] }),
515
- /* @__PURE__ */ b("group", { ref: u, children: /* @__PURE__ */ b("lineSegments", { ref: h, material: e.fid, frustumCulled: !1 }) }),
516
- /* @__PURE__ */ b("group", { ref: i, children: /* @__PURE__ */ b("lineSegments", { geometry: Go, material: e.arrow, frustumCulled: !1 }) }),
517
- /* @__PURE__ */ b("group", { ref: m, children: /* @__PURE__ */ b(dt, { text: "B field", color: "#e0a868", size: 0.26, plate: "none", opacity: 0.75, pxRange: [9, 12] }) })
518
- ] });
519
- }
520
- const Ce = new r.Vector3(), Ae = new r.Vector3();
521
- function Eo() {
522
- const { size: t, gl: e, camera: s } = We(), o = B(() => tt(), []);
523
- return lt(() => {
524
- o.flush(), o.mat.uniforms.uTime.value = mt(), o.setScale(t.height, e.getPixelRatio(), s.fov);
525
- }, -1), /* @__PURE__ */ b("primitive", { object: o.obj });
526
- }
527
- const Qt = 0.34, X = 2.1, Ut = 12, ko = (() => {
528
- const t = [], e = (s, o, h, c) => t.push(s, o, 0, h, c, 0);
529
- for (const s of [-0.28, 0.28]) {
530
- const o = s - Qt / 2, h = s + Qt / 2;
531
- e(o, -X / 2, h, -X / 2), e(h, -X / 2, h, X / 2), e(h, X / 2, o, X / 2), e(o, X / 2, o, -X / 2);
532
- for (let c = 1; c < Ut; c++) {
533
- const a = -X / 2 + c / Ut * X;
534
- e(o, a, h, a);
535
- }
536
- }
537
- return new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
538
- })(), Pe = new r.PlaneGeometry(Qt, X), Oo = new r.PlaneGeometry(Qt * 0.92, X / Ut * 0.8), Vo = (() => {
539
- const t = [];
540
- for (let e = 0; e < 6; e++) {
541
- const s = e / 6 * Math.PI * 2 + Math.PI / 6, o = (e + 1) / 6 * Math.PI * 2 + Math.PI / 6;
542
- t.push(Math.cos(s), Math.sin(s), 0, Math.cos(o), Math.sin(o), 0), t.push(Math.cos(s) * 0.62, Math.sin(s) * 0.62, 0, Math.cos(o) * 0.62, Math.sin(o) * 0.62, 0);
543
- }
544
- return new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
545
- })(), Fo = new r.CircleGeometry(1, 6, Math.PI / 6);
546
- function jo({ mcp: t }) {
547
- const e = t.srv, s = B(() => new r.Color(e.color).lerp(V, 0.25), [e.color]), o = B(() => ({ line: J(s), fill: Zt(s), strip: Zt(s) }), [s]), h = z(null), c = z(null), a = z(null), l = z(null);
548
- return lt(({ clock: f }) => {
549
- var n, v;
550
- const u = performance.now(), i = Math.atan2(t.out.y, t.out.x);
551
- (n = h.current) == null || n.position.copy(t.pos), c.current && (c.current.rotation.z = i);
552
- const m = e.inflight > 0, p = Ie(e.activeAt, u, 1.4), d = m && !H ? 0.5 + 0.5 * Math.sin(f.elapsedTime * 6) : m ? 0.5 : 0;
553
- o.line.color.copy(s).multiplyScalar(0.32 + p * 0.5 + (m ? 0.35 + d * 0.25 : 0)), o.fill.color.copy(s).multiplyScalar(0.035 + p * 0.06 + (m ? 0.05 : 0));
554
- let y = "";
555
- for (const g of G.mcpPending.values()) g.server === e.name && (y = g.tool);
556
- if (!y)
557
- for (const g of G.mcpCalls) g.server === e.name && (y = g.tool);
558
- if (a.current) {
559
- const g = m ? 0.55 + d * 0.5 : p * 0.6;
560
- a.current.visible = g > 0.02 && y !== "", y && a.current.position.set(0.28, -X / 2 + (Math.floor(ot(y, 3) * Ut) + 0.5) * (X / Ut), 0.01), o.strip.color.copy(s).lerp(V, 0.3).multiplyScalar(g);
561
- }
562
- (v = l.current) == null || v.position.set(0, Math.abs(Math.cos(i)) * (X / 2) + 0.5, 0);
563
- }), /* @__PURE__ */ Z("group", { ref: h, children: [
564
- /* @__PURE__ */ Z("group", { ref: c, children: [
565
- /* @__PURE__ */ b("lineSegments", { geometry: ko, material: o.line }),
566
- /* @__PURE__ */ b("mesh", { geometry: Pe, material: o.fill, position: [-0.28, 0, 0] }),
567
- /* @__PURE__ */ b("mesh", { geometry: Pe, material: o.fill, position: [0.28, 0, 0] }),
568
- /* @__PURE__ */ b("mesh", { ref: a, geometry: Oo, material: o.strip, visible: !1 })
569
- ] }),
570
- /* @__PURE__ */ b("group", { ref: l, children: /* @__PURE__ */ b(dt, { text: `MCP · ${e.name}`, color: e.color, size: 0.28, anchorY: "bottom", pxRange: [9, 13] }) })
571
- ] });
572
- }
573
- function qo({ mcp: t, backend: e }) {
574
- const s = t.srv, o = e.res, h = B(() => new r.Color(s.color).lerp(V, 0.3), [s.color]), c = B(() => ({ line: J(h), fill: Zt(h) }), [h]), a = z(null), l = z(null), f = z(null), u = z(""), i = o.kind === "warehouse" || o.kind === "spark" ? 0.4 : 0.33;
575
- return lt(({ clock: m }) => {
576
- var g;
577
- const p = performance.now();
578
- (g = a.current) == null || g.position.copy(e.pos);
579
- const d = o.inflight > 0, y = Ie(o.activeAt, p, 1.4), n = d && !H ? 0.5 + 0.5 * Math.sin(m.elapsedTime * 5) : d ? 0.5 : 0;
580
- c.line.color.copy(h).multiplyScalar(0.35 + y * 0.6 + (d ? 0.5 + n * 0.4 : 0)), c.fill.color.copy(h).multiplyScalar(0.04 + y * 0.12 + (d ? 0.12 + n * 0.1 : 0)), l.current && (l.current.rotation.z = H ? 0 : m.elapsedTime * (d ? 0.6 : 0.05));
581
- let v = o.name;
582
- if (d) {
583
- let x = "";
584
- for (const T of G.mcpPending.values()) T.server === s.name && T.resource === o.name && (x = T.tool);
585
- v = `${o.name} ▸ ${x || "query"}()`;
586
- } else y > 0.25 && o.calls > 0 && (v = `${o.name} ✓`);
587
- f.current && (v !== u.current && f.current.setText(u.current = v), f.current.setOpacity(d ? 1 : 0.55 + y * 0.45), f.current.setEmphasis(d));
588
- }), /* @__PURE__ */ Z(Bt, { children: [
589
- /* @__PURE__ */ b(ro, { mcp: t, backend: e, gain: 0.7 }),
590
- /* @__PURE__ */ Z("group", { ref: a, children: [
591
- /* @__PURE__ */ Z("group", { ref: l, scale: i, children: [
592
- /* @__PURE__ */ b("lineSegments", { geometry: Vo, material: c.line }),
593
- /* @__PURE__ */ b("mesh", { geometry: Fo, material: c.fill })
594
- ] }),
595
- /* @__PURE__ */ b(dt, { ref: f, position: [0, -i - 0.32, 0], text: o.name, color: s.color, size: 0.2, opacity: 0.55, pxRange: [7.5, 11.5] })
596
- ] })
597
- ] });
598
- }
599
- const Wo = 48, Lt = new r.Vector3(), Et = new r.Vector3(), vt = new r.Color();
600
- function Ko() {
601
- const t = B(() => new Jt(Wo, 36), []), e = B(() => /* @__PURE__ */ new Map(), []);
602
- return lt(({ clock: s }) => {
603
- const o = performance.now(), h = mt(), c = H ? 0 : s.elapsedTime;
604
- t.begin();
605
- for (const a of G.mcpPending.values()) {
606
- const l = Ct(a.instance), f = be(a.server), u = G.mcpServers.get(a.server);
607
- if (!l || !f || !u) continue;
608
- Wt(l, f, 0.12, Lt);
609
- const i = Ne(a, o);
610
- vt.set(u.color).lerp(Nt, at(i / 1.2)), i > 1.2 && vt.lerp(_t, at((i - 1.2) / 1));
611
- const m = l.distanceTo(f), p = 0.04 + 0.92 * qt(i / 0.45);
612
- t.add(l, Lt, f, vt, (0.3 + Math.min(0.3, i * 0.12)) * qt(i / 0.3), 0.04, p, Math.max(4, Math.round(m / 0.5)), c * 1.4, i < 0.45 ? p : -1, 1);
613
- }
614
- for (const a of e.keys()) {
615
- let l = !1;
616
- for (const f of G.mcpCalls) f.id === a && (l = !0);
617
- l || e.delete(a);
618
- }
619
- for (const a of G.mcpCalls) {
620
- if (a.phase !== "result") continue;
621
- const l = at((o - a.start) / a.dur);
622
- if (l >= 1) continue;
623
- const f = Ct(a.instance), u = be(a.server), i = G.mcpServers.get(a.server);
624
- if (!f || !u || !i) continue;
625
- let m = e.get(a.id);
626
- m || e.set(a.id, m = new ue()), Wt(f, u, 0.12, Lt);
627
- const p = re(l);
628
- $t(f, Lt, u, 1 - p, Et), vt.set(i.color).lerp(V, 0.45);
629
- const d = 1 - Math.max(0, (p - 0.85) / 0.15);
630
- t.add(f, Lt, u, vt, 0.1 * d, 0.04, 0.96, 0, 0, 1 - p, 1.3 * d), m.step(Et, 0.065, 0.08, vt, 0.95 * d, 2.6, h, 6), tt().emit(Et.x, Et.y, Et.z, 0.5, vt, 1.3 * d, 0.12, h, 1);
631
- }
632
- t.end();
633
- }), /* @__PURE__ */ b("primitive", { object: t.obj });
634
- }
635
- const Uo = (() => {
636
- const t = [];
637
- for (let e = 0; e < 4; e++) {
638
- const s = Math.PI / 4 + e * Math.PI / 2;
639
- t.push(Math.cos(s) * 0.22, Math.sin(s) * 0.22, 0, Math.cos(s) * 0.55, Math.sin(s) * 0.55, 0);
640
- }
641
- return new r.BufferGeometry().setAttribute("position", new r.Float32BufferAttribute(t, 3));
642
- })(), $o = new r.Vector3(1, 0.07, 0).normalize(), ne = new r.Vector3(), Xo = new r.Vector3();
643
- function No(t, e, s, o) {
644
- const h = tt(), c = mt();
645
- h.emit(t.x, t.y, t.z, 1.6 * o, V, 1.4, 0.6, c, 1), h.emit(t.x, t.y, t.z, 3.2 * o, s, 1, 0.9, c, 2);
646
- const a = 5 + Math.floor(ot(e, 41) * 3);
647
- for (let l = 0; l < a; l++) {
648
- const f = l / a * Math.PI * 2 + ot(e, 50 + l) * 0.9, u = (1.2 + ot(e, 60 + l) * 4) * o, i = (1.1 + ot(e, 70 + l) * 1.8) * o, m = ot(e, 80 + l) < 0.5 ? 1 : -1, p = (ot(e, 90 + l) - 0.5) * 1.6, d = Math.max(6, Math.round(i / (0.075 * o))), y = t.x + Math.cos(f + m * Math.PI * 0.5) * u, n = t.y + Math.sin(f + m * Math.PI * 0.5) * u, v = f - m * Math.PI * 0.5;
649
- for (let g = 1; g <= d; g++) {
650
- const x = g / d * i, T = v + m * x / u;
651
- h.emit(y + Math.cos(T) * u, n + Math.sin(T) * u, t.z + x * p, 0.085 * o * (0.7 + Math.random() * 0.6), s, 0.85, 5, c + x / (7 * o), 0);
652
- }
653
- }
654
- }
655
- function Ho({ run: t }) {
656
- const e = B(() => new r.Color(t.color).lerp(N, 0.35), [t.color]), s = B(() => ae("#000"), []), o = B(() => J("#000"), []), h = z(null), c = B(() => new Jt(1, 64), []), a = z(null), l = z(null), f = B(() => ({ p: new r.Vector3(), fired: !1, init: !1, dep: { z: 0, tz: 0 } }), []);
657
- return le(() => (zt.set(t.id, f.p), Ht.set(t.id, f.dep), () => {
658
- zt.get(t.id) === f.p && zt.delete(t.id), Ht.get(t.id) === f.dep && Ht.delete(t.id);
659
- }), [t.id, f]), lt(({ clock: u, camera: i }, m) => {
660
- var E;
661
- const p = performance.now(), d = t.run ?? G.runs.get(t.id);
662
- let y = 0, n = 0, v = 1e9;
663
- for (const K of rt.agents.values())
664
- K.run !== t || K.inst.parent || (y += K.eu, n++, K.ev < v && (v = K.ev));
665
- const g = n ? y / n : t.cu, x = (n ? v : t.cv - t.hv) - 1.55 * Tt.spread;
666
- He(t, g, x, f.p), f.dep.tz = yo(t.index, t.count), f.dep.z = f.init ? f.dep.z + (f.dep.tz - f.dep.z) * Math.min(1, Math.min(0.05, m) * 1.2) : f.dep.tz, f.p.z = f.dep.z, f.init = !0;
667
- const T = d ? (p - d.startedAt) / 1e3 : 99;
668
- f.fired || (f.fired = !0, T < 1.2 && No(f.p, t.id, e, Math.max(0.6, Tt.scale)));
669
- const P = qt(T / 0.8), C = d ? d.status !== "started" : !1, S = d != null && d.endedAt ? at(1 - (p - d.endedAt - (Ze - 2500)) / 2500) : 1, A = H || C ? 1 : 0.85 + 0.15 * Math.sin(u.elapsedTime * 2.2 + t.index);
670
- a.current && (a.current.position.copy(f.p), a.current.scale.setScalar((0.9 + (C ? 0 : 0.25)) * Math.max(0.7, Tt.scale))), h.current && (h.current.position.copy(f.p), h.current.quaternion.copy(i.quaternion), h.current.scale.setScalar(Math.max(0.7, Tt.scale))), o.color.copy(e).lerp(V, 0.3).multiplyScalar((C ? 0.3 : 0.75) * P * S), s.color.copy(e).lerp(V, 0.4).multiplyScalar((C ? 0.35 : 0.8) * A * P * S), c.begin();
671
- const j = 7 + rt.core.hw * 0.6;
672
- ne.copy(f.p).addScaledVector($o, -j);
673
- const F = Xo.copy(ne).add(f.p).multiplyScalar(0.5);
674
- c.add(ne, F, f.p, e, 0.16 * P * S * (C ? 0.6 : 1), 0, 0.985 * P, Math.round(j / 0.16), 0, 1, 0.35 * S), c.end();
675
- const D = Math.abs(t.side.y) * t.hu + Math.abs(t.axis.y) * t.hv, L = Math.max(t.origin.y + D, f.p.y + 0.4);
676
- (E = l.current) == null || E.position.set(t.origin.x, L + 0.75, f.p.z);
677
- }), /* @__PURE__ */ Z(Bt, { children: [
678
- /* @__PURE__ */ b("primitive", { object: c.obj }),
679
- /* @__PURE__ */ b("sprite", { ref: a, material: s }),
680
- /* @__PURE__ */ b("lineSegments", { ref: h, geometry: Uo, material: o }),
681
- /* @__PURE__ */ b("group", { ref: l, children: t.run && /* @__PURE__ */ b(Zo, { run: t.run }) })
682
- ] });
683
- }
684
- function Zo({ run: t }) {
685
- Te();
686
- const e = t.status !== "started";
687
- return /* @__PURE__ */ b(
688
- dt,
689
- {
690
- text: t.topic,
691
- secondary: Ye(t, { base: "#8fb3bd", current: "#fde68a", done: "#cfe9ee" }, ["running…", "run complete"]),
692
- color: t.color,
693
- textColor: "#e3fbff",
694
- plate: "none",
695
- anchorY: "bottom",
696
- uppercase: !0,
697
- letterSpacing: 0.12,
698
- size: 0.34,
699
- maxWidth: 11,
700
- opacity: e ? 0.5 : 0.92,
701
- fadeMs: 600,
702
- pxRange: [10, 14],
703
- glow: 1.1
704
- }
705
- );
706
- }
707
- const se = 4;
708
- function Yo() {
709
- const t = z(/* @__PURE__ */ new Set()), e = z([]), s = z([]), o = z([]), h = z([]);
710
- return lt(() => {
711
- const c = performance.now();
712
- for (const a of G.runs.values()) {
713
- if (!a.final || t.current.has(a.id)) continue;
714
- t.current.add(a.id);
715
- const l = rt.runs.get(a.id);
716
- if (!l) continue;
717
- let f;
718
- for (const S of G.instances.values()) S.run === a.id && !S.parent && (f = Ct(S.id) ?? f);
719
- const u = (f ?? zt.get(a.id) ?? l.origin).clone(), i = Math.abs(u.x) > 0.5 ? u.x < 0 ? -1 : 1 : ot(a.id, 23) < 0.5 ? 1 : -1, m = Math.atan2(-0.35 - ot(a.id, 22) * 0.4, i), p = 40 * (ot(a.id, 24) < 0.5 ? 1 : -1), d = (ot(a.id, 25) - 0.5) * 0.35, y = rt.core.r + 9, n = new r.Color(a.color).lerp(V, 0.6), v = tt(), g = mt(), x = u.x + Math.cos(m + Math.PI * 0.5) * p, T = u.y + Math.sin(m + Math.PI * 0.5) * p, P = m - Math.PI * 0.5, C = Math.round(y / 0.085);
720
- for (let S = 1; S <= C; S++) {
721
- const A = S / C * y, j = P + A / p, F = x + Math.cos(j) * p, D = T + Math.sin(j) * p, L = g + A / 11, E = u.z + A * d;
722
- v.emit(F, D, E, 0.09 * (0.75 + Math.random() * 0.5), n, 0.7, 5.5, L, 0), S % 3 === 0 && v.emit(F, D, E, 0.6, V, 0.9, 0.16, L, 1);
723
- }
724
- v.emit(u.x, u.y, u.z, 1.6, V, 1.3, 0.6, g, 1), e.current.push({ run: a.id, at: c, from: u, text: a.final }), e.current.length > se && e.current.shift();
725
- }
726
- if (t.current.size > 200)
727
- for (const a of t.current) G.runs.has(a) || t.current.delete(a);
728
- for (let a = 0; a < se; a++) {
729
- const l = e.current[a], f = s.current[a], u = o.current[a];
730
- if (!f || !u) continue;
731
- const i = l ? (c - l.at) / 1e3 : 99;
732
- if (!l || i > 5.5) {
733
- f.setOpacity(0);
734
- continue;
735
- }
736
- u.position.set(l.from.x, l.from.y - 2.2, l.from.z), h.current[a] !== l.run + l.at && (h.current[a] = l.run + l.at, f.setText(`final answer - ${l.text.length > 64 ? l.text.slice(0, 62) + "…" : l.text}`)), f.setOpacity(at(i / 0.3) * at((5.5 - i) / 1.2));
737
- }
738
- }), /* @__PURE__ */ b(Bt, { children: Array.from({ length: se }, (c, a) => /* @__PURE__ */ b("group", { ref: (l) => void (o.current[a] = l), children: /* @__PURE__ */ b(dt, { ref: (l) => void (s.current[a] = l), text: "", color: "#cff8ff", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, a)) });
739
- }
740
- const kt = Math.PI * 2, ce = 0.85, Re = 6.5, Qo = new r.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 }), ct = new r.Vector3(), xt = new r.Vector3(), Ot = new r.Vector3();
741
- function Jo({ agent: t, selected: e, onSelect: s }) {
742
- const o = t.inst, h = z(null), c = z(null), a = z(null), l = z(null), f = z(null), u = z(null), i = z(null), m = z(null), p = B(() => [...o.id].reduce((x, T) => (x * 31 + T.charCodeAt(0)) % 9973, 7) / 9973, [o.id]), d = ao[o.type], y = B(
743
- () => ({
744
- halo: ae(d),
745
- core: ae("#fff"),
746
- sel: J("#e6fbff"),
747
- wait: J(Nt)
748
- }),
749
- [d]
750
- ), n = B(
751
- () => ({
752
- // charge: which way the field curls this particle
753
- q: p < 0.5 ? 1 : -1,
754
- th: p * kt,
755
- ph: p * 17,
756
- rc: 0.3,
757
- rg: 0.25,
758
- w: kt * 0.6,
759
- boost: 0,
760
- red: 0,
761
- waitK: 0,
762
- selK: 0,
763
- calls: o.llmCalls,
764
- tools: o.toolCalls,
765
- decAt: performance.now(),
766
- first: !0,
767
- fly: !1,
768
- from: new r.Vector3(),
769
- trail: new ue(),
770
- col: new r.Color(),
771
- stopped: !1,
772
- hx: t.pos.x,
773
- hy: t.pos.y,
774
- move: 0,
775
- // depth: mirror-bounce phase along the field and its amplitude (the home depth is <AgentDepth/>'s)
776
- ps: p * 23,
777
- lz: 0.6
778
- }),
779
- // eslint-disable-next-line react-hooks/exhaustive-deps
780
- []
781
- );
782
- le(() => () => void Yt.delete(o.id), [o.id]), lt(({ camera: x }, T) => {
783
- var Me, we;
784
- const P = performance.now(), C = mt(), S = Math.min(0.05, T), A = t.scale, j = H ? 0.3 : 1, F = !o.exitAt, D = !F || o.doneAt > 0, L = !D && (o.status === "thinking" || o.status === "spawning");
785
- let E = !1;
786
- if (!D)
787
- for (const _ of G.mcpPending.values()) _.instance === o.id && (E = !0);
788
- const K = (P - o.bornAt) / 1e3;
789
- if (n.first && (n.first = !1, K < ce * 0.8 && !t.fresh)) {
790
- const _ = o.parent ? Ct(o.parent) : void 0, W = zt.get(o.run), Pt = _ ?? W;
791
- if (Pt) {
792
- n.fly = !0, n.from.copy(Pt), ct.subVectors(n.from, t.pos);
793
- const ft = 4.2 * Math.max(0.6, Tt.spread);
794
- ct.length() > ft && n.from.copy(t.pos).addScaledVector(ct.normalize(), ft);
795
- const Dt = tt(), Rt = n.from;
796
- if (Dt.emit(Rt.x, Rt.y, Rt.z, 0.9 * A, N, 1.3, 0.45, C, 1), Dt.emit(Rt.x, Rt.y, Rt.z, 1.5 * A, It[o.type], 0.9, 0.6, C, 2), _ && o.parent) {
797
- const ve = rt.agents.get(o.parent);
798
- ct.copy(t.pos).sub(n.from);
799
- const te = ct.length() || 1, ee = ve ? ve.scale : A;
800
- oe(o.parent, -ct.x / te * 0.32 * ee, -ct.y / te * 0.32 * ee, -ct.z / te * 0.32 * ee, P);
801
- }
802
- }
803
- }
804
- const et = n.th + n.q * Math.PI * 0.5;
805
- if (o.llmCalls !== n.calls && (n.calls = o.llmCalls, !D)) {
806
- const _ = Math.min(2.5, Math.max(0.6, o.pulse));
807
- n.boost = Math.min(1.1, n.boost + 0.25 + _ * 0.22);
808
- const W = t.live;
809
- ie(W, Math.round(6 + _ * 7), (0.14 + _ * 0.12) * A, 0.12 * A, N, 1, 2.8, C), tt().emit(W.x, W.y, W.z, (0.7 + _ * 0.45) * A, N, 0.9, 0.45, C, 1), H || Be(W, et + n.q * 0.9, (0.14 + _ * 0.07) * A, 1.7, 22, 0.07 * A, N, 0.85, 3.4, C, -n.q, -n.q * (0.25 + _ * 0.1) * A);
810
- }
811
- if (o.toolCalls !== n.tools && (n.tools = o.toolCalls, !D)) {
812
- const _ = Math.random() < 0.5 ? 1 : -1;
813
- oe(o.id, Math.cos(et + _ * 1.4) * 0.2 * A, Math.sin(et + _ * 1.4) * 0.2 * A, _ * 0.16 * A, P);
814
- const W = t.live;
815
- tt().emit(W.x, W.y, W.z, 0.55 * A, V, 1.1, 0.3, C + 0.05, 1);
816
- }
817
- const Y = o.decisions;
818
- for (let _ = 0; _ < Y.length; _++) {
819
- const W = Y[_];
820
- if (W.at <= n.decAt || W.at > P || (n.decAt = W.at, W.hidden || !Qe(W) || D)) continue;
821
- const Pt = Math.random() < 0.5 ? 1 : -1;
822
- oe(o.id, Math.cos(et + Pt * 1.9) * 0.42 * A, Math.sin(et + Pt * 1.9) * 0.42 * A, -Pt * 0.36 * A, P), n.red = 1;
823
- const ft = t.live, Dt = tt();
824
- Dt.emit(ft.x, ft.y, ft.z, 1 * A, _t, 1.4, 0.55, C + 0.05, 1), Dt.emit(ft.x, ft.y, ft.z, 1.9 * A, _t, 1, 0.75, C + 0.05, 2), ie(ft, 5, 0.18 * A, 0.11 * A, _t, 1, 2, C + 0.05);
825
- }
826
- n.boost *= Math.exp(-S / 2.4), n.red *= Math.exp(-S / 0.6);
827
- let yt, gt, Mt, At, wt;
828
- D ? (yt = 0, gt = 0, Mt = kt * 0.95, At = 0, wt = 0.5) : L && !E ? (yt = 0.34, gt = 0.28, Mt = kt * 0.6, At = 1.5, wt = 0.5) : (yt = 0.15, gt = 0.06, Mt = kt * 0.22, At = 0.32, wt = 0.2);
829
- const nt = Math.min(1, S * (D ? 1.3 : 2.6));
830
- n.rc += (yt + (D ? 0 : n.boost * 0.4) - n.rc) * nt, n.rg += (gt - n.rg) * nt, n.w += (Mt - n.w) * Math.min(1, S * 2), n.lz += (At + (D ? 0 : n.boost * 0.5) - n.lz) * nt, n.th += n.q * n.w * S * j, n.ph += n.q * 0.42 * S * j, n.ps += wt * S * j;
831
- const Q = t.live;
832
- Q.copy(t.pos);
833
- const w = Math.max(A, 0.72);
834
- Q.x += (Math.cos(n.ph) * n.rg + Math.cos(n.th) * n.rc) * w, Q.y += (Math.sin(n.ph) * n.rg * 0.7 + Math.sin(n.th) * n.rc) * w, Q.z += Math.sin(n.ps) * n.lz * w;
835
- const M = Yt.get(o.id);
836
- if (M) {
837
- const _ = mo(P - M.at);
838
- Q.x += M.x * _, Q.y += M.y * _, Q.z += M.z * _;
839
- }
840
- let R = !1;
841
- if (n.fly) {
842
- const _ = K / ce;
843
- _ >= 1 ? n.fly = !1 : (R = !0, ct.copy(Q), Wt(n.from, ct, n.q * 0.24, xt), $t(n.from, xt, ct, qt(_ * 0.85 + 0.15 * _ * _), Q));
844
- }
845
- const U = Math.hypot(t.pos.x - n.hx, t.pos.y - n.hy) / Math.max(1e-3, S) / Math.max(0.3, A);
846
- n.hx = t.pos.x, n.hy = t.pos.y, n.move += (Math.min(1, Math.max(0, U - 0.4) * 0.5) - n.move) * Math.min(1, S * 8), n.waitK += ((E ? 1 : 0) - n.waitK) * Math.min(1, S * 4), n.col.copy(It[o.type]).lerp(Nt, n.waitK * 0.75).lerp(_t, n.red * 0.85), o.status === "failed" && n.col.lerp(_t, 0.5);
847
- const O = n.rc + n.rg + (R ? 1 : 0);
848
- if (!n.stopped) {
849
- const _ = (R ? 1.5 : D ? 0.7 : L ? 1.55 : 0.95) * (R ? 1 : 1 - 0.85 * n.move);
850
- n.trail.step(Q, 0.065 * w, 0.13 * w, n.col, _, R ? Re + 1 : Re, C, 10), D && O < 0.015 && (n.stopped = !0);
851
- }
852
- !D && n.stopped && (n.stopped = !1, n.trail.reset());
853
- const q = o.exitAt ? (P - o.exitAt) / 1e3 : -1, $ = q >= 0 ? at(q / 1.6) : 0, st = qt(K / 0.35), pt = Je(o, P), ye = ((D ? 0.45 : L ? 1 : 0.6) + pt * 0.25 + n.boost * 0.4 + (R ? 0.5 : 0)) * (1 - $);
854
- if (h.current && (h.current.position.copy(Q), h.current.scale.setScalar(Math.max(1e-4, A * st))), l.current && (l.current.scale.setScalar(0.5 + pt * 0.1 + n.boost * 0.12), y.core.color.copy(V).lerp(n.col, 0.2).multiplyScalar(Math.min(2, 1.5 * ye))), a.current) {
855
- const _ = Math.min(1, Math.sqrt(1.3 / Math.max(0.1, A)));
856
- a.current.scale.setScalar(((L ? 2 : 1.5) + pt * 0.4 + n.boost * 0.6) * _), y.halo.color.copy(d).lerp(n.col, 0.4).multiplyScalar(0.62 * ye);
857
- }
858
- c.current && (c.current.position.copy(t.pos), c.current.quaternion.copy(x.quaternion), c.current.scale.setScalar(Math.max(1e-4, w)));
859
- const ge = 0.34 + 0.28 + 0.3;
860
- n.selK += ((e ? 1 : 0) - n.selK) * 0.14, f.current && (f.current.visible = n.selK > 0.02, f.current.scale.setScalar(ge + 0.18 + (1 - n.selK) * 0.3), f.current.rotation.z = H ? 0 : C * 0.15, y.sel.color.setScalar(0.85 * n.selK)), u.current && (u.current.visible = n.waitK > 0.02, u.current.scale.setScalar(0.5 + 0.03 * Math.sin(C * 3)), u.current.rotation.z = H ? 0 : -C * 0.8, y.wait.color.copy(Nt).multiplyScalar(0.9 * n.waitK)), (Me = i.current) == null || Me.position.set(t.pos.x, t.pos.y - (ge + 0.12) * w - 0.3, t.pos.z), (we = m.current) == null || we.setOpacity(to(o.id) ? st * (F ? 0.95 : 0.6 * (1 - $)) : 0);
861
- });
862
- const v = (x) => {
863
- x.stopPropagation(), s(o.id);
864
- }, g = o.id.split(":")[2];
865
- return /* @__PURE__ */ Z(Bt, { children: [
866
- /* @__PURE__ */ Z("group", { ref: c, scale: 1e-4, children: [
867
- /* @__PURE__ */ b("mesh", { geometry: co, material: Qo, scale: 0.85, onClick: v, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
868
- /* @__PURE__ */ b("lineSegments", { ref: f, geometry: xe, material: y.sel, visible: !1 }),
869
- /* @__PURE__ */ b("lineSegments", { ref: u, geometry: xe, material: y.wait, visible: !1 })
870
- ] }),
871
- /* @__PURE__ */ Z("group", { ref: h, scale: 1e-4, children: [
872
- /* @__PURE__ */ b("sprite", { ref: a, material: y.halo }),
873
- /* @__PURE__ */ b("sprite", { ref: l, material: y.core })
874
- ] }),
875
- /* @__PURE__ */ b("group", { ref: i, children: /* @__PURE__ */ b(
876
- dt,
877
- {
878
- ref: m,
879
- text: `${o.name}${g !== void 0 ? ` ${Number(g) + 1}` : ""}`,
880
- live: o.job ? () => eo(o) : null,
881
- color: fe[o.type],
882
- size: o.subagent ? 0.22 : 0.28,
883
- letterSpacing: 0.02,
884
- opacity: 0,
885
- fit: !0,
886
- pxRange: o.subagent ? [8, 11.5] : [9, 13.5]
887
- }
888
- ) })
889
- ] });
890
- }
891
- const Vt = /* @__PURE__ */ new Map();
892
- function tn() {
893
- return lt((t, e) => {
894
- const s = Math.min(1, Math.min(0.05, e) * 1.6);
895
- for (const o of rt.agents.values()) {
896
- const h = De(o), c = Vt.get(o.id), a = c === void 0 ? h : c + (h - c) * s;
897
- Vt.set(o.id, a), o.pos.z = a, o.live.z = a;
898
- }
899
- if (Vt.size > rt.agents.size + 64)
900
- for (const o of Vt.keys()) rt.agents.has(o) || Vt.delete(o);
901
- }, -1), null;
902
- }
903
- const en = 160, on = 32;
904
- function nn() {
905
- const t = B(() => new Jt(en + on, 24), []), e = B(() => /* @__PURE__ */ new Map(), []), s = B(() => ({ a: new r.Vector3(), b: new r.Vector3(), col: new r.Color() }), []);
906
- return lt(({ clock: o }) => {
907
- const h = performance.now(), c = mt(), a = H ? 0 : o.elapsedTime;
908
- t.begin();
909
- const { a: l, b: f, col: u } = s;
910
- for (const i of rt.agents.values()) {
911
- const m = i.inst, p = m.parent ? rt.agents.get(m.parent) : void 0, d = p ? p.pos : m.parent ? void 0 : zt.get(m.run);
912
- if (!d) continue;
913
- const y = i.pos.distanceTo(d);
914
- if (y < 0.5) continue;
915
- const n = Math.min(0.4, ((p ? 0.85 * p.scale : 0.25) + 0.05) / y), v = Math.max(n + 0.05, 1 - (0.85 * i.scale + 0.05) / y), g = (h - m.bornAt) / 1e3, x = re(g / ce), T = (p ? 0.3 : 0.2) * (1 - 0.65 * i.dim) * x;
916
- u.copy(It[m.type]).lerp(N, 0.4), l.copy(d), f.copy(i.pos), xt.copy(l).add(f).multiplyScalar(0.5), t.add(l, xt, f, u, T, n, n + (v - n) * x, Math.max(3, Math.round(y / 0.42)), a * 0.35, -1, 0);
917
- }
918
- for (const i of e.keys()) {
919
- let m = !1;
920
- for (const p of G.comets) p.id === i && (m = !0);
921
- m || e.delete(i);
922
- }
923
- for (const i of G.comets) {
924
- const m = Ct(i.from), p = Ct(i.to);
925
- if (!m || !p) continue;
926
- const d = oo(i, h);
927
- if (!no(i, h)) continue;
928
- let y = e.get(i.id);
929
- y || e.set(i.id, y = new ue()), Wt(m, p, i.id % 2 ? 0.22 : -0.22, xt);
930
- const n = re(d);
931
- $t(m, xt, p, n, Ot);
932
- const v = G.instances.get(i.from);
933
- u.copy(v ? It[v.type] : N).lerp(V, 0.35);
934
- const g = Math.min(1, d / 0.08) * Math.min(1, (1 - d) / 0.12);
935
- t.add(m, xt, p, u, 0, 0, 1, 0, 0, n, 1.1 * g), y.step(Ot, 0.06, 0.07, u, 0.9 * g, 2.4, c, 6), tt().emit(Ot.x, Ot.y, Ot.z, 0.42, u, 1.2 * g, 0.12, c, 1);
936
- }
937
- t.end();
938
- }), /* @__PURE__ */ b("primitive", { object: t.obj });
939
- }
940
- const sn = {
941
- minPolarAngle: Math.PI * 0.25,
942
- maxPolarAngle: Math.PI * 0.75
943
- };
944
- function rn(t) {
945
- for (const e of zt.values()) t(e, 0.9);
946
- for (const e of rt.agents.values()) t(bt.set(e.target.x, e.target.y, De(e)), 1.1 * e.scale);
947
- t(bt.set(I.rx, 0, 0), 0), t(bt.set(-I.rx, 0, 0), 0), t(bt.set(0, I.ry, 0), 0), t(bt.set(0, -I.ry, 0), 0), t(bt.set(0, 0, I.hz), 0), t(bt.set(0, 0, -I.hz), 0);
948
- }
949
- const bt = new r.Vector3();
950
- function dn() {
951
- return /* @__PURE__ */ Z(
952
- so,
953
- {
954
- title: "bubble chamber · particle tracks",
955
- subtitle: "Agents are charged particles on helices along the field (tight = thinking, slow orbit = waiting, spiral in = done) · a spawn is a decay into a V · LLM calls burst bubbles, tools kink the track, a deny flashes red · each run is an event at its vertex · ▭ MCP detector plates, ⬡ backend cells · graph = event archive (a read pulls its plate out)",
956
- preset: "radial",
957
- plane: "xy",
958
- camera: { position: [0, 0, 34], fov: 46, far: 1200 },
959
- controls: sn,
960
- bg: "#010406",
961
- gl: { antialias: !0 },
962
- fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
963
- agentRadius: 1.1,
964
- graph: { natural: wo * 1.05, radius: 4.4 },
965
- peripheryGap: 3.8,
966
- extents: rn,
967
- Background: /* @__PURE__ */ b(Lo, {}),
968
- Agent: Jo,
969
- RunMarker: Ho,
970
- McpServer: jo,
971
- Backend: qo,
972
- GraphResource: Co,
973
- cluster: { radius: 1.4, variant: "swarm", glowGain: 0.9 },
974
- PostFX: /* @__PURE__ */ Z(Fe, { multisampling: 0, children: [
975
- /* @__PURE__ */ b(je, { mipmapBlur: !0, intensity: 0.9, luminanceThreshold: 0.2, luminanceSmoothing: 0.3, radius: 0.6 }),
976
- /* @__PURE__ */ b(qe, { eskil: !1, offset: 0.22, darkness: 0.85 })
977
- ] }),
978
- children: [
979
- /* @__PURE__ */ b(tn, {}),
980
- /* @__PURE__ */ b(nn, {}),
981
- /* @__PURE__ */ b(Ko, {}),
982
- /* @__PURE__ */ b(Yo, {}),
983
- /* @__PURE__ */ b(Eo, {})
984
- ]
985
- }
986
- );
987
- }
988
- export {
989
- dn as default
990
- };