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,1015 +0,0 @@
1
- var Be = Object.defineProperty;
2
- var ke = (t, o, n) => o in t ? Be(t, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[o] = n;
3
- var B = (t, o, n) => ke(t, typeof o != "symbol" ? o + "" : o, n);
4
- import { jsxs as lt, Fragment as Et, jsx as M } from "react/jsx-runtime";
5
- import { EffectComposer as Ke, Bloom as Oe, Vignette as Ve } from "@react-three/postprocessing";
6
- import { useThree as Gt, useFrame as pt } from "@react-three/fiber";
7
- import { useMemo as K, useRef as k } from "react";
8
- import * as r from "three";
9
- import { Q as Ge, T as de, h as Rt, K as Ie, y as ee, w as N, a as yt, D as Le, J as Fe, L as It, G as je, A as De, m as Ce, c as we, d as We, M as Ne, R as Ue, u as Xe, C as $e, l as He, P as Ye, U as qe, e as Ze, s as Je, j as Qe, k as to, n as eo, f as Qt, v as oo } from "./KitScene-DQRuKA06.js";
10
- var Ae;
11
- const D = typeof window < "u" && !!((Ae = window.matchMedia) != null && Ae.call(window, "(prefers-reduced-motion: reduce)").matches), J = (t) => t < 0 ? 0 : t > 1 ? 1 : t, ue = (t) => 1 - Math.pow(1 - J(t), 3), te = (t) => (t = J(t), t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2), I = new r.Color(1, 1, 1), H = new r.Color("#ffc46b"), Wt = new r.Color("#ff7a2e"), no = new r.Color("#fbbf24"), Dt = new r.Color("#ff2d4a"), ze = new r.Color("#8a93b8"), Nt = Object.fromEntries(Object.entries(de).map(([t, o]) => [t, new r.Color(o).lerp(I, 0.12)])), ro = Object.fromEntries(Object.entries(de).map(([t, o]) => [t, new r.Color(o).lerp(H, 0.35).lerp(I, 0.25)]));
12
- function pe(t, o) {
13
- const n = document.createElement("canvas");
14
- n.width = n.height = t, o(n.getContext("2d"), t);
15
- const e = new r.CanvasTexture(n);
16
- return e.colorSpace = r.SRGBColorSpace, e;
17
- }
18
- let so = null;
19
- function Ct() {
20
- return so ?? (so = pe(128, (t, o) => {
21
- const n = t.createRadialGradient(o / 2, o / 2, 0, o / 2, o / 2, o / 2);
22
- n.addColorStop(0, "rgba(255,255,255,1)"), n.addColorStop(0.1, "rgba(255,255,255,0.7)"), n.addColorStop(0.35, "rgba(255,255,255,0.14)"), n.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = n, t.fillRect(0, 0, o, o);
23
- }));
24
- }
25
- let ao = null;
26
- function Pe() {
27
- return ao ?? (ao = pe(256, (t, o) => {
28
- const n = o / 2, e = t.createRadialGradient(n, n, n * 0.7, n, n, n * 0.98);
29
- e.addColorStop(0, "rgba(255,255,255,0)"), e.addColorStop(0.6, "rgba(255,255,255,0.85)"), e.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = e, t.fillRect(0, 0, o, o);
30
- }));
31
- }
32
- let io = null;
33
- function co() {
34
- return io ?? (io = pe(256, (t, o) => {
35
- const n = o / 2;
36
- for (const u of [0, Math.PI / 2, Math.PI / 4, -Math.PI / 4]) {
37
- const f = u % (Math.PI / 2) === 0 ? n : n * 0.5;
38
- t.save(), t.translate(n, n), t.rotate(u);
39
- const m = t.createLinearGradient(-f, 0, f, 0);
40
- m.addColorStop(0, "rgba(255,255,255,0)"), m.addColorStop(0.5, "rgba(255,255,255,1)"), m.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = m, t.beginPath(), t.moveTo(-f, 0), t.lineTo(0, -3), t.lineTo(f, 0), t.lineTo(0, 3), t.closePath(), t.fill(), t.restore();
41
- }
42
- const e = t.createRadialGradient(n, n, 0, n, n, n * 0.25);
43
- e.addColorStop(0, "rgba(255,255,255,1)"), e.addColorStop(1, "rgba(255,255,255,0)"), t.fillStyle = e, t.fillRect(0, 0, o, o);
44
- }));
45
- }
46
- function ct(t, o = "#fff") {
47
- return new r.SpriteMaterial({ map: t, color: o, blending: r.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1 });
48
- }
49
- const Te = () => new r.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), lo = new r.TorusGeometry(1, 0.014, 6, 96), uo = new r.SphereGeometry(1, 20, 14);
50
- function ne(t, o, n) {
51
- return t * o / (2 * Math.tan(n * Math.PI / 360));
52
- }
53
- const fo = {
54
- name: "show",
55
- local: { topGap: 3.9, fanLen: 3.5, subGap: 2.9, fan: "spread", stackGap: 2.1, pad: 1.45 },
56
- run(t, o, n) {
57
- const e = o.n;
58
- if (n.angle = Math.PI / 2, e <= 1) {
59
- n.a = 0, n.b = 0;
60
- return;
61
- }
62
- const u = 2 * o.hu + 2.6, f = 2 * o.hv + 3.4, m = Math.max(1, Math.min(e, Math.round(Math.sqrt(e * o.aspect * f / u)))), c = Math.ceil(e / m), s = Math.floor(t / m), v = s === c - 1 ? e - s * m : m, a = t - s * m;
63
- n.a = (a - (v - 1) / 2) * u, n.b = ((c - 1) / 2 - s) * f;
64
- },
65
- cluster: Ge.cluster,
66
- periphery: "sides"
67
- }, ho = 24576, dt = 0, wt = 1, fe = 2, po = 3, mo = (
68
- /* glsl */
69
- `
70
- attribute vec4 iP; attribute vec4 iV; attribute vec4 iT; attribute vec4 iC;
71
- #ifdef STREAK
72
- attribute float aEnd;
73
- #endif
74
- uniform float uTime; uniform float uScale; uniform float uTrail;
75
- varying vec3 vC; varying float vSmoke;
76
- float h1(float n){ return fract(sin(n) * 43758.5453); }
77
- vec3 at(float a){
78
- float k = iV.w;
79
- float e = (1.0 - exp(-k * a)) / k;
80
- return iP.xyz + iV.xyz * e - vec3(0.0, iT.z * (a - e) / k, 0.0);
81
- }
82
- void main(){
83
- float a = uTime - iT.x;
84
- float life = iT.y;
85
- float kind = iC.w;
86
- vSmoke = kind > 1.5 && kind < 2.5 ? 1.0 : 0.0;
87
- #ifdef STREAK
88
- bool dead = a < 0.0 || a > life || vSmoke > 0.5;
89
- #else
90
- bool dead = a < 0.0 || a > life;
91
- #endif
92
- if (dead) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; vC = vec3(0.0); return; }
93
- float u = a / life;
94
- float f = 1.0 - u;
95
- float lum = pow(f, 1.25) * min(1.0, a * 30.0 + 0.2);
96
- vec3 col = mix(vec3(1.0, 0.96, 0.88), iC.rgb, smoothstep(0.0, 0.2, u));
97
- col = mix(col, vec3(1.0, 0.42, 0.12) * 0.85, smoothstep(0.55, 1.0, u) * 0.55);
98
- float seed = iT.w;
99
- if (kind > 0.5 && kind < 1.5) {
100
- float fl = step(0.52, h1(floor(uTime * 24.0) * 0.731 + seed * 91.7));
101
- lum *= 0.1 + fl * 2.1;
102
- } else if (kind > 2.5) {
103
- lum *= 0.65 + 0.35 * sin(uTime * 11.0 + seed * 40.0);
104
- }
105
- float size = iP.w;
106
- if (vSmoke > 0.5) {
107
- col = mix(iC.rgb, vec3(0.55, 0.6, 0.78), 0.55);
108
- lum = 0.05 * sin(3.14159 * min(1.0, u * 1.6 + 0.02)) * f;
109
- size *= 1.0 + u * 2.6;
110
- }
111
- vec3 p = at(a);
112
- #ifdef STREAK
113
- if (aEnd > 0.5) { p = at(max(0.0, a - uTrail)); lum = 0.0; }
114
- lum *= 0.55;
115
- #endif
116
- vC = col * lum;
117
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
118
- gl_Position = projectionMatrix * mv;
119
- #ifndef STREAK
120
- float px = size * uScale / -mv.z;
121
- // sub-pixel sparks would shimmer: keep 1.4px and dim them instead
122
- if (px < 1.4) { vC *= px / 1.4; px = 1.4; }
123
- gl_PointSize = px;
124
- #endif
125
- }`
126
- ), vo = (
127
- /* glsl */
128
- `
129
- varying vec3 vC; varying float vSmoke;
130
- void main(){
131
- #ifdef STREAK
132
- gl_FragColor = vec4(vC, 1.0);
133
- #else
134
- float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
135
- float k = vSmoke > 0.5 ? pow(1.0 - r, 2.0) : smoothstep(0.42, 0.0, r) * 1.3 + pow(1.0 - r, 3.0) * 0.3;
136
- gl_FragColor = vec4(vC * k, 1.0);
137
- #endif
138
- }`
139
- ), go = {};
140
- class yo {
141
- constructor() {
142
- B(this, "cap", ho);
143
- B(this, "base", performance.now());
144
- B(this, "P");
145
- B(this, "V");
146
- B(this, "T");
147
- B(this, "C");
148
- B(this, "head", 0);
149
- B(this, "dirtyStart", 0);
150
- B(this, "dirtyN", 0);
151
- B(this, "attrs");
152
- B(this, "points");
153
- B(this, "streaks");
154
- B(this, "pmat");
155
- B(this, "smat");
156
- const o = this.cap, n = () => new r.InstancedBufferAttribute(new Float32Array(o * 4), 4).setUsage(r.DynamicDrawUsage);
157
- this.P = n(), this.V = n(), this.T = n(), this.C = n(), this.attrs = [this.P, this.V, this.T, this.C];
158
- for (let s = 0; s < o; s++)
159
- this.T.array[s * 4] = 1e9, this.T.array[s * 4 + 1] = 1, this.V.array[s * 4 + 3] = 1;
160
- const e = (s) => (s.setAttribute("iP", this.P), s.setAttribute("iV", this.V), s.setAttribute("iT", this.T), s.setAttribute("iC", this.C), s.instanceCount = o, s.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), s), u = e(new r.InstancedBufferGeometry());
161
- u.setAttribute("position", new r.BufferAttribute(new Float32Array(3), 3));
162
- const f = e(new r.InstancedBufferGeometry());
163
- f.setAttribute("position", new r.BufferAttribute(new Float32Array(6), 3)), f.setAttribute("aEnd", new r.BufferAttribute(new Float32Array([0, 1]), 1));
164
- const c = { uniforms: { uTime: { value: 0 }, uScale: { value: 400 }, uTrail: { value: 0.085 } }, vertexShader: mo, fragmentShader: vo, transparent: !0, depthWrite: !1, depthTest: !1, blending: r.AdditiveBlending };
165
- this.pmat = new r.ShaderMaterial(c), this.smat = new r.ShaderMaterial({ ...c, defines: { STREAK: 1 } }), this.points = new r.Points(u, this.pmat), this.streaks = new r.LineSegments(f, this.smat), this.points.frustumCulled = this.streaks.frustumCulled = !1, this.points.renderOrder = this.streaks.renderOrder = 2;
166
- }
167
- /** shader clock (seconds) */
168
- time() {
169
- return (performance.now() - this.base) / 1e3;
170
- }
171
- /**
172
- * Emit one particle. p = start (stage), v = velocity (units/s), drag (1/s, > 0), grav (units/s^2 downward),
173
- * life (s), size (world units), color + brightness k, kind, delay (s).
174
- */
175
- emit(o, n, e, u, f, m, c, s, v, a, g, y, i, p = 0) {
176
- const w = this.head;
177
- this.head = (this.head + 1) % this.cap, this.dirtyN === 0 && (this.dirtyStart = w), this.dirtyN++;
178
- const b = w * 4, h = this.P.array, d = this.V.array, C = this.T.array, A = this.C.array;
179
- h[b] = o, h[b + 1] = n, h[b + 2] = e, h[b + 3] = a, d[b] = u, d[b + 1] = f, d[b + 2] = m, d[b + 3] = Math.max(0.05, c), C[b] = this.time() + p, C[b + 1] = v, C[b + 2] = s, C[b + 3] = Math.random(), A[b] = g.r * y, A[b + 1] = g.g * y, A[b + 2] = g.b * y, A[b + 3] = i;
180
- }
181
- /**
182
- * A spherical burst at (x, y, z): n particles, speed ~ `speed` (with spread), a share of glitter.
183
- * `flat` squashes the z velocity (bursts read best facing the camera).
184
- */
185
- burst(o, n, e, u, f, m, c, s = go) {
186
- const v = s.drag ?? 2.4, a = s.grav ?? 1.4, g = s.life ?? 1.8, y = s.size ?? 0.12, i = s.glitter ?? 0.2, p = s.flat ?? 0.45, w = s.jitter ?? 0.12, b = Math.PI * (3 - Math.sqrt(5)), h = Math.random() * 6.283;
187
- for (let d = 0; d < u; d++) {
188
- const C = 1 - 2 * (d + 0.5) / u, A = Math.sqrt(1 - C * C), l = d * b + h, U = f * (1 - w + Math.random() * 2 * w), nt = s.kind ?? (Math.random() < i ? wt : dt), X = s.c2 && d % 3 === 0 ? s.c2 : m;
189
- this.emit(o, n, e, Math.cos(l) * A * U, C * U, Math.sin(l) * A * U * p, v, a, g * (0.75 + Math.random() * 0.5), y * (0.8 + Math.random() * 0.4), X, c, nt);
190
- }
191
- }
192
- setScale(o, n, e) {
193
- this.pmat.uniforms.uScale.value = ne(o, n, e);
194
- }
195
- /** upload what was emitted since the last flush (one or two contiguous ranges) */
196
- flush() {
197
- if (this.pmat.uniforms.uTime.value = this.time(), !this.dirtyN) return;
198
- const o = Math.min(this.dirtyN, this.cap), n = o >= this.cap ? 0 : this.dirtyStart;
199
- for (const e of this.attrs)
200
- e.clearUpdateRanges(), n + o <= this.cap ? e.addUpdateRange(n * 4, o * 4) : (e.addUpdateRange(n * 4, (this.cap - n) * 4), e.addUpdateRange(0, (n + o - this.cap) * 4)), e.needsUpdate = !0;
201
- this.dirtyN = 0;
202
- }
203
- }
204
- let wo = null;
205
- const Bt = () => wo ?? (wo = new yo()), ot = D ? 0.4 : 1, jt = 84;
206
- function Re(t) {
207
- const o = new r.BufferGeometry(), n = t ? 2 : 1, e = new Float32Array(jt * n * 3), u = new Float32Array(jt * n * 4), f = new Float32Array(jt * n), m = Math.PI * (3 - Math.sqrt(5));
208
- let c = 9173;
209
- const s = () => (c = c * 16807 % 2147483647) / 2147483647;
210
- for (let v = 0; v < jt; v++) {
211
- const a = 1 - 2 * (v + 0.5) / jt, g = Math.sqrt(1 - a * a), y = v * m, i = Math.cos(y) * g + (s() - 0.5) * 0.08, p = a + (s() - 0.5) * 0.08, w = Math.sin(y) * g + (s() - 0.5) * 0.08, b = Math.hypot(i, p, w) || 1, h = [s(), s(), s(), s()];
212
- for (let d = 0; d < n; d++) {
213
- const C = v * n + d;
214
- e.set([i / b, p / b, w / b], C * 3), u.set(h, C * 4), f[C] = d;
215
- }
216
- }
217
- return o.setAttribute("position", new r.BufferAttribute(e.slice(), 3)), o.setAttribute("aDir", new r.BufferAttribute(e, 3)), o.setAttribute("aRnd", new r.BufferAttribute(u, 4)), t && o.setAttribute("aEnd", new r.BufferAttribute(f, 1)), o.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), o;
218
- }
219
- const bo = Re(!1), Mo = Re(!0), xo = (
220
- /* glsl */
221
- `
222
- attribute vec3 aDir; attribute vec4 aRnd;
223
- #ifdef STREAK
224
- attribute float aEnd;
225
- #endif
226
- uniform vec3 uC; uniform float uR; uniform float uAge; uniform float uTime; uniform vec3 uCol; uniform vec3 uCol2;
227
- uniform float uLvl; uniform float uCrackle; uniform float uDone; uniform float uWait; uniform float uScale; uniform float uOpacity;
228
- uniform float uSeed; uniform float uSize;
229
- varying vec3 vC;
230
- float h1(float n){ return fract(sin(n) * 43758.5453); }
231
- void main(){
232
- float a = uAge;
233
- if (a < 0.0) { gl_Position = vec4(2.0, 2.0, 2.0, 1.0); gl_PointSize = 0.0; vC = vec3(0.0); return; }
234
- // burst: fast expansion with a little overshoot, then a slow breathing hold
235
- float ex = 1.0 - exp(-a * 5.5);
236
- ex *= 1.0 + 0.07 * exp(-a * 1.6) * sin(a * 7.0);
237
- float wob = 1.0 + 0.035 * sin(uTime * (0.7 + aRnd.x * 0.6) + aRnd.z * 6.283);
238
- float rr = uR * (0.8 + 0.24 * aRnd.y) * ex * wob * mix(1.0, 0.5, uWait);
239
- // slow spin about a tilted axis: stars glide across the shell (the 3D sphere sparkles as it turns)
240
- float sp = uTime * (0.09 + 0.06 * uSeed) + uSeed * 6.283;
241
- float cs = cos(sp), sn = sin(sp);
242
- vec3 d = vec3(aDir.x * cs + aDir.z * sn, aDir.y, -aDir.x * sn + aDir.z * cs);
243
- float sag = uR * (0.1 * (1.0 - exp(-a * 1.2)) + uWait * 0.18 * (1.0 - d.y));
244
- vec3 c0 = uC - vec3(0.0, sag * 0.4, 0.0);
245
- vec3 p = c0 + d * rr;
246
- p.y -= sag * (0.6 + 0.5 * aRnd.w);
247
- // done: the stars fall away and spread like a dying willow
248
- p += d * uDone * uR * 0.3;
249
- p.y -= uDone * uDone * uR * (0.7 + 1.3 * aRnd.z);
250
- float tw = 0.55 + 0.45 * sin(uTime * (1.2 + aRnd.x * 2.6) + aRnd.z * 40.0);
251
- float flash = exp(-a * 3.0) * 0.8;
252
- float gl = uCrackle * step(1.0 - uCrackle * 0.6, h1(floor(uTime * 22.0) * 0.37 + aRnd.x * 137.0 + uSeed * 11.0));
253
- float lvl = uLvl * (0.35 + 0.65 * tw) + flash + gl * 2.4;
254
- lvl *= mix(1.0, 0.42, uWait) * (1.0 - uDone * 0.3);
255
- vec3 col = mix(uCol, uCol2, step(0.62, aRnd.y));
256
- col = mix(col, vec3(1.0), clamp(flash * 0.25 + gl * 0.7, 0.0, 1.0));
257
- col = mix(col, vec3(1.0, 0.5, 0.16), uWait * 0.55 + uDone * 0.45);
258
- #ifdef STREAK
259
- // petal streak toward the centre: long while fresh (the burst), short once it hangs
260
- float tail = mix(0.42, 0.8, smoothstep(0.2, 3.0, a)) + uDone * 0.1;
261
- if (aEnd > 0.5) { p = c0 + (p - c0) * tail; lvl = 0.0; }
262
- lvl *= 0.5 * (1.0 - uWait * 0.6);
263
- #endif
264
- vC = col * lvl * uOpacity;
265
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
266
- gl_Position = projectionMatrix * mv;
267
- #ifndef STREAK
268
- float px = uSize * (0.7 + 0.6 * aRnd.w) * (1.0 + gl * 0.5 + flash * 0.3) * uScale / -mv.z;
269
- if (px < 1.5) { vC *= px / 1.5; px = 1.5; }
270
- gl_PointSize = px;
271
- #endif
272
- }`
273
- ), So = (
274
- /* glsl */
275
- `
276
- varying vec3 vC;
277
- void main(){
278
- #ifdef STREAK
279
- gl_FragColor = vec4(vC, 1.0);
280
- #else
281
- float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
282
- gl_FragColor = vec4(vC * (smoothstep(0.45, 0.0, r) * 1.25 + pow(1.0 - r, 3.0) * 0.35), 1.0);
283
- #endif
284
- }`
285
- );
286
- function Ao(t, o, n) {
287
- const e = {
288
- uC: { value: new r.Vector3() },
289
- uR: { value: 1 },
290
- uAge: { value: -1 },
291
- uTime: { value: 0 },
292
- uCol: { value: t.clone() },
293
- uCol2: { value: o.clone() },
294
- uLvl: { value: 1 },
295
- uCrackle: { value: 0 },
296
- uDone: { value: 0 },
297
- uWait: { value: 0 },
298
- uScale: { value: 400 },
299
- uOpacity: { value: 1 },
300
- uSeed: { value: n },
301
- uSize: { value: 0.1 }
302
- }, u = { uniforms: e, vertexShader: xo, fragmentShader: So, transparent: !0, depthWrite: !1, depthTest: !1, blending: r.AdditiveBlending };
303
- return { u: e, pts: new r.ShaderMaterial(u), lines: new r.ShaderMaterial({ ...u, defines: { STREAK: 1 } }) };
304
- }
305
- function _t(t, o, n, e, u) {
306
- const f = 1 - e;
307
- return u.set(f * f * t.x + 2 * f * e * o.x + e * e * n.x, f * f * t.y + 2 * f * e * o.y + e * e * n.y, f * f * t.z + 2 * f * e * o.z + e * e * n.z);
308
- }
309
- function zt(t, o, n, e, u) {
310
- const f = o.x - t.x, m = o.y - t.y, c = Math.hypot(f, m) || 1;
311
- return u.copy(t).add(o).multiplyScalar(0.5), u.x += -m / c * n, u.y += f / c * n + e, u;
312
- }
313
- class me {
314
- constructor(o, n = 28) {
315
- B(this, "geo", new r.BufferGeometry());
316
- B(this, "obj");
317
- B(this, "P");
318
- B(this, "C");
319
- B(this, "n", 0);
320
- B(this, "p", new r.Vector3());
321
- this.max = o, this.seg = n, this.P = new r.BufferAttribute(new Float32Array(o * n * 6), 3), this.C = new r.BufferAttribute(new Float32Array(o * n * 6), 3), 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, Te()), this.obj.frustumCulled = !1;
322
- }
323
- begin() {
324
- this.n = 0;
325
- }
326
- add(o, n, e, u, f, m, c, s, v, a, g) {
327
- if (this.n >= this.max || c <= m) return;
328
- const y = this.seg;
329
- for (let i = 0; i < y; i++)
330
- for (let p = 0; p < 2; p++) {
331
- const w = m + (c - m) * (i + p) / y;
332
- _t(o, n, e, w, this.p);
333
- const b = (this.n * y + i) * 2 + p;
334
- this.P.setXYZ(b, this.p.x, this.p.y, this.p.z);
335
- let h = f;
336
- s > 0 && (h += s * Math.pow(Math.max(0, Math.sin((w * 8 - v * 1.1) * Math.PI)), 8)), h *= 0.25 + 0.75 * J(Math.min((w - m) / 0.08, (c - w) / 0.05)), a >= 0 && (h += g * Math.exp(-(((w - a) / 0.05) ** 2))), this.C.setXYZ(b, u.r * h, u.g * h, u.b * h);
337
- }
338
- this.n++;
339
- }
340
- end() {
341
- this.geo.setDrawRange(0, this.n * this.seg * 2), this.P.needsUpdate = !0, this.C.needsUpdate = !0;
342
- }
343
- }
344
- const Co = (
345
- /* glsl */
346
- `
347
- attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
348
- void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; gl_PointSize = max(1.5, aSize * uScale / -mv.z); gl_Position = projectionMatrix * mv; }`
349
- ), zo = (
350
- /* glsl */
351
- `
352
- varying vec3 vC;
353
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
354
- gl_FragColor = vec4(vC * (smoothstep(0.35, 0.0, r) * 1.4 + pow(1.0 - r, 2.6) * 0.45), 1.0); }`
355
- );
356
- class ve {
357
- constructor(o) {
358
- B(this, "geo", new r.BufferGeometry());
359
- B(this, "mat", new r.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: Co, fragmentShader: zo, transparent: !0, depthWrite: !1, blending: r.AdditiveBlending }));
360
- B(this, "obj");
361
- B(this, "P");
362
- B(this, "S");
363
- B(this, "C");
364
- B(this, "n", 0);
365
- this.max = o, this.P = new r.BufferAttribute(new Float32Array(o * 3), 3), this.S = new r.BufferAttribute(new Float32Array(o), 1), this.C = new r.BufferAttribute(new Float32Array(o * 3), 3), this.geo.setAttribute("position", this.P), this.geo.setAttribute("aSize", this.S), 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;
366
- }
367
- setScale(o, n, e) {
368
- this.mat.uniforms.uScale.value = ne(o, n, e);
369
- }
370
- begin() {
371
- this.n = 0;
372
- }
373
- add(o, n, e, u) {
374
- this.n >= this.max || (this.P.setXYZ(this.n, o.x, o.y, o.z), this.S.setX(this.n, n), this.C.setXYZ(this.n, e.r * u, e.g * u, e.b * u), this.n++);
375
- }
376
- end() {
377
- this.geo.setDrawRange(0, this.n), this.P.needsUpdate = !0, this.S.needsUpdate = !0, this.C.needsUpdate = !0;
378
- }
379
- }
380
- const he = 9, ae = 6, Po = 220, be = 40, ie = 8, Yt = 4, To = (
381
- /* glsl */
382
- `
383
- attribute float aSize; attribute vec3 aColor; uniform float uScale; varying vec3 vC;
384
- void main(){ vec4 mv = modelViewMatrix * vec4(position, 1.0); vC = aColor; float px = aSize * uScale / -mv.z;
385
- if (px < 1.6) { vC *= px / 1.6; px = 1.6; } gl_PointSize = px; gl_Position = projectionMatrix * mv; }`
386
- ), Ro = (
387
- /* glsl */
388
- `
389
- varying vec3 vC;
390
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
391
- gl_FragColor = vec4(vC * (smoothstep(0.4, 0.0, r) * 1.2 + pow(1.0 - r, 2.4) * 0.4), 1.0); }`
392
- );
393
- function _o({ galaxy: t }) {
394
- const o = K(() => ({ nodes: t.nodes.slice(0, Po), links: t.links }), [t]), n = o.nodes.length, { size: e, gl: u, camera: f } = Gt(), m = k([]), c = k([]), s = k(Array(Yt).fill("")), v = k([]), a = K(() => {
395
- const h = new Float32Array(n * 3);
396
- o.nodes.forEach((E, j) => {
397
- const P = Math.sqrt(Rt(E.id, 2)) * 0.95, mt = Rt(E.id, 3) * Math.PI * 2;
398
- h.set([Math.cos(mt) * P * he, Math.sin(mt) * P * ae, (Rt(E.id, 4) - 0.5) * 2], j * 3);
399
- });
400
- const d = o.nodes.map((E) => new r.Color(Ie[E.kind] ?? "#94a3b8").lerp(Wt, 0.55).multiplyScalar(0.55)), C = o.nodes.map((E) => 0.32 + Math.pow(Rt(E.id, 5), 4) * 0.45), A = new r.BufferGeometry();
401
- A.setAttribute("position", new r.BufferAttribute(h, 3)), A.setAttribute("aSize", new r.BufferAttribute(new Float32Array(n), 1)), A.setAttribute("aColor", new r.BufferAttribute(new Float32Array(n * 3), 3));
402
- const l = new Map(o.nodes.map((E, j) => [E.id, j])), U = [], nt = new r.Vector3(), X = new r.Vector3();
403
- for (const E of o.links) {
404
- const j = l.get(E.source), P = l.get(E.target);
405
- j === void 0 || P === void 0 || j === P || (nt.fromArray(h, j * 3), X.fromArray(h, P * 3), nt.distanceTo(X) < 3.4 && U.push(j, P));
406
- }
407
- const G = new Float32Array(U.length * 3);
408
- U.forEach((E, j) => G.set([h[E * 3], h[E * 3 + 1], h[E * 3 + 2]], j * 3));
409
- const q = new r.BufferGeometry();
410
- return q.setAttribute("position", new r.BufferAttribute(G, 3)), q.setAttribute("color", new r.BufferAttribute(new Float32Array(U.length * 3), 3)), { pos: h, base: d, baseSize: C, ngeo: A, lgeo: q, owner: Int32Array.from(U), fire: new Float32Array(n), white: new Float32Array(n), fireC: Array.from({ length: n }, () => new r.Color()), phase: o.nodes.map((E) => Rt(E.id, 6) * 6.283) };
411
- }, [o, n]), g = K(
412
- () => ({
413
- haze: ct(Ct(), "#000"),
414
- nodes: new r.ShaderMaterial({ uniforms: { uScale: { value: 400 } }, vertexShader: To, fragmentShader: Ro, transparent: !0, depthWrite: !1, blending: r.AdditiveBlending }),
415
- fil: new r.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
416
- ripples: Array.from({ length: ie }, () => ct(Pe(), "#000"))
417
- }),
418
- []
419
- ), y = K(() => new me(be, 24), []), i = K(() => new ve(be), []), p = K(() => /* @__PURE__ */ new Map(), [o]), w = K(() => ({ v: new r.Vector3(), w: new r.Vector3(), ctrl: new r.Vector3(), h: new r.Vector3(), c: new r.Color(), act: 0 }), []), b = (h) => {
420
- let d = p.get(h);
421
- return d === void 0 && p.set(h, d = De(o, h)), d;
422
- };
423
- return pt(({ clock: h }) => {
424
- var Kt;
425
- const d = performance.now(), C = Math.max(1e-4, ee.graph.scale), A = D ? 0 : h.elapsedTime, l = f.fov, U = u.getPixelRatio();
426
- g.nodes.uniforms.uScale.value = ne(e.height, U, l) * ee.graph.scale * 1.8, i.setScale(e.height, U, l);
427
- const { pos: nt, base: X, baseSize: G, fire: q, white: E, fireC: j, phase: P } = a, { v: mt, w: x, ctrl: F, h: Ut, c: V } = w;
428
- q.fill(0), E.fill(0), y.begin(), i.begin();
429
- let vt = 0, kt = 0;
430
- for (const S of N.flares) {
431
- const T = b(S.node), W = (d - S.start) / 1e3, bt = N.instances.get(S.instance), rt = bt ? Nt[bt.type] : H, L = S.op === "write", $ = W < 0.3 ? W / 0.3 : Math.exp(-(W - 0.3) * 1.1);
432
- if (kt = Math.max(kt, $), $ > q[T] && (q[T] = $, j[T].copy(L ? I : rt), E[T] = L ? 1 : 0), mt.fromArray(nt, T * 3), L && W < 1.6 && vt < ie) {
433
- const at = v.current[vt];
434
- if (at) {
435
- const it = W / 1.6;
436
- at.visible = !0, at.position.copy(mt), at.scale.setScalar(0.4 + it * 3), g.ripples[vt].color.copy(H).multiplyScalar((1 - it) * (1 - it) * 0.9);
437
- }
438
- vt++;
439
- }
440
- const st = yt(S.instance);
441
- if (st && W < 2) {
442
- Le(mt, x), zt(st, x, 1, 1.4, F);
443
- const at = Math.min(1, W / 0.25) * Math.pow(1 - W / 2, 1.5), it = L ? Math.min(1, W * 0.9) : 1 - Math.min(1, W * 0.9);
444
- V.copy(L ? I : rt).lerp(H, 0.25), y.add(st, F, x, V, (L ? 0.4 : 0.3) * at, 0.05, 0.99, 0, A, it, 1.7 * at), it > 0.02 && it < 0.98 && (_t(st, F, x, it, Ut), i.add(Ut, 0.6, V, 1.5 * at));
445
- }
446
- }
447
- for (let S = vt; S < ie; S++) {
448
- const T = v.current[S];
449
- T && (T.visible = !1);
450
- }
451
- y.end(), i.end(), w.act += (kt - w.act) * 0.05, g.haze.color.copy(Wt).multiplyScalar(0.05 + w.act * 0.05);
452
- const Q = a.ngeo.getAttribute("aSize"), Lt = a.ngeo.getAttribute("aColor");
453
- for (let S = 0; S < n; S++) {
454
- const T = q[S], W = D ? 1 : 0.7 + 0.3 * Math.sin(A * (0.7 + P[S] % 1) + P[S]);
455
- Q.setX(S, G[S] + T * (0.8 + E[S] * 0.4)), V.copy(X[S]).multiplyScalar(W), T > 0.01 && (V.r += j[S].r * T * 1.4 + T * (0.2 + E[S]), V.g += j[S].g * T * 1.4 + T * (0.2 + E[S]), V.b += j[S].b * T * 1.4 + T * (0.2 + E[S])), Lt.setXYZ(S, V.r, V.g, V.b);
456
- }
457
- Q.needsUpdate = !0, Lt.needsUpdate = !0;
458
- const Xt = a.lgeo.getAttribute("color"), ut = a.owner;
459
- for (let S = 0; S < ut.length; S++) {
460
- const T = Math.max(q[ut[S]], q[ut[S ^ 1]]);
461
- Xt.setXYZ(S, 0.2 + T * 0.6, 0.11 + T * 0.45, 0.07 + T * 0.25);
462
- }
463
- Xt.needsUpdate = !0;
464
- let et = 0;
465
- for (let S = N.flares.length - 1; S >= 0 && et < Yt; S--) {
466
- const T = N.flares[S];
467
- if (d - T.start > 2200) break;
468
- let W = !1;
469
- for (let $ = 0; $ < et; $++) s.current[$] === T.node && (W = !0);
470
- if (W) continue;
471
- const bt = b(T.node);
472
- for (let $ = 0; $ < et; $++) {
473
- const st = c.current[$];
474
- st && Math.abs(st.position.y - nt[bt * 3 + 1]) < 0.9 / C && Math.abs(st.position.x - nt[bt * 3]) < 4.5 / C && (W = !0);
475
- }
476
- if (W) continue;
477
- const rt = m.current[et], L = c.current[et];
478
- rt && L && (L.position.fromArray(nt, bt * 3), s.current[et] !== T.node && (rt.setText(`${T.op === "write" ? "wrote" : "read"} · ${T.node}`), rt.setColor(T.op === "write" ? "#ffffff" : "#ffc46b")), rt.setOpacity(J(1.4 - (d - T.start) / 1600))), s.current[et] = T.node, et++;
479
- }
480
- for (let S = et; S < Yt; S++)
481
- (Kt = m.current[S]) == null || Kt.setOpacity(0), s.current[S] = "";
482
- }), /* @__PURE__ */ lt(Et, { children: [
483
- /* @__PURE__ */ M("sprite", { material: g.haze, scale: [he * 3.2, ae * 3.2, 1], position: [0, 0, -0.5] }),
484
- /* @__PURE__ */ M("lineSegments", { geometry: a.lgeo, material: g.fil, frustumCulled: !1 }),
485
- /* @__PURE__ */ M("points", { geometry: a.ngeo, material: g.nodes, frustumCulled: !1 }),
486
- g.ripples.map((h, d) => /* @__PURE__ */ M("sprite", { ref: (C) => void (v.current[d] = C), material: h, visible: !1 }, d)),
487
- /* @__PURE__ */ lt(Fe, { children: [
488
- /* @__PURE__ */ M("primitive", { object: y.obj }),
489
- /* @__PURE__ */ M("primitive", { object: i.obj })
490
- ] }),
491
- Array.from({ length: Yt }, (h, d) => /* @__PURE__ */ M("group", { ref: (C) => void (c.current[d] = C), children: /* @__PURE__ */ M(It, { ref: (C) => void (m.current[d] = C), text: "", offset: [0, 0.4], size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, d)),
492
- /* @__PURE__ */ M(je, { position: [0, ae * 1.18, 0], suffix: " · embers", color: "#ffb066", letterSpacing: 0.04, size: 0.28, opacity: 0.85, pxRange: [8, 12] })
493
- ] });
494
- }
495
- const qt = 8, tt = 0.85, Zt = new r.Vector3();
496
- function Eo({ mcp: t }) {
497
- const o = t.srv, n = K(() => new r.Color(o.color), [o.color]), e = K(() => Rt(o.name, 7), [o.name]), u = e < 0.5 ? 1 : -1, f = K(() => {
498
- const a = [];
499
- for (let y = 0; y < qt; y++) {
500
- const i = y / qt * Math.PI * 2, p = i - 0.55;
501
- a.push(Math.cos(i) * 0.12, Math.sin(i) * 0.12, 0, Math.cos(i) * tt, Math.sin(i) * tt, 0), a.push(Math.cos(i) * tt, Math.sin(i) * tt, 0, Math.cos(p) * tt * 0.86, Math.sin(p) * tt * 0.86, 0);
502
- }
503
- for (let y = 0; y < 48; y++) {
504
- const i = y / 48 * Math.PI * 2, p = (y + 1) / 48 * Math.PI * 2;
505
- a.push(Math.cos(i) * tt * 0.5, Math.sin(i) * tt * 0.5, 0, Math.cos(p) * tt * 0.5, Math.sin(p) * tt * 0.5, 0);
506
- }
507
- const g = new r.BufferGeometry();
508
- return g.setAttribute("position", new r.Float32BufferAttribute(a, 3)), g;
509
- }, []), m = K(
510
- () => ({
511
- wheel: new r.LineBasicMaterial({ color: "#000", transparent: !0, blending: r.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
512
- halo: ct(Ct(), "#000"),
513
- hub: ct(Ct(), "#000")
514
- }),
515
- []
516
- ), c = k(null), s = k(null), v = K(() => ({ rot: e * 6, w: 0.25 }), [e]);
517
- return pt((a, g) => {
518
- var w;
519
- const y = performance.now();
520
- (w = c.current) == null || w.position.copy(t.pos);
521
- const i = o.inflight > 0, p = Ce(o.activeAt, y, 1.4);
522
- if (v.w += ((i ? 7 : 0.3 + p * 2) - v.w) * Math.min(1, g * 2.5), D || (v.rot += v.w * u * Math.min(g, 0.05)), s.current && (s.current.rotation.z = v.rot), m.wheel.color.copy(n).lerp(I, i ? 0.45 : 0.1).multiplyScalar(i ? 1.3 : 0.38 + p * 0.6), m.halo.color.copy(n).multiplyScalar(i ? 0.32 : 0.06 + p * 0.18), m.hub.color.copy(I).lerp(n, 0.4).multiplyScalar(i ? 1.2 : 0.35 + p * 0.4), i && !D) {
523
- const b = Bt();
524
- for (let h = 0; h < qt; h++) {
525
- if (Math.random() > 0.45 * ot) continue;
526
- const d = v.rot * 1 + h / qt * Math.PI * 2;
527
- Zt.set(t.pos.x + Math.cos(d) * tt, t.pos.y + Math.sin(d) * tt, t.pos.z);
528
- const C = -Math.sin(d) * u, A = Math.cos(d) * u, l = 2.2 + Math.random() * 1.6;
529
- b.emit(Zt.x, Zt.y, Zt.z, -C * l, -A * l, 0, 2.4, 2.2, 0.4 + Math.random() * 0.35, 0.06, Math.random() < 0.4 ? I : h % 2 ? H : n, 1, Math.random() < 0.3 ? wt : dt);
530
- }
531
- }
532
- }), /* @__PURE__ */ lt("group", { ref: c, children: [
533
- /* @__PURE__ */ M("sprite", { material: m.halo, scale: tt * 5 }),
534
- /* @__PURE__ */ M("group", { ref: s, children: /* @__PURE__ */ M("lineSegments", { geometry: f, material: m.wheel }) }),
535
- /* @__PURE__ */ M("sprite", { material: m.hub, scale: 0.55 }),
536
- /* @__PURE__ */ M(It, { position: [0, tt + 0.75, 0], text: `MCP · ${o.name}`, color: o.color, size: 0.28, pxRange: [9, 13] })
537
- ] });
538
- }
539
- function Bo({ mcp: t, backend: o }) {
540
- const n = t.srv, e = o.res, u = K(() => new r.Color(n.color).lerp(H, 0.55), [n.color]), f = K(
541
- () => ({
542
- body: new r.MeshBasicMaterial({ color: "#000", toneMapped: !1 }),
543
- halo: ct(Ct(), "#000")
544
- }),
545
- []
546
- ), m = k(null), c = k(null), s = k(null), v = k("");
547
- pt(({ clock: g }) => {
548
- var C, A;
549
- const y = performance.now(), i = D ? 0 : g.elapsedTime;
550
- (C = m.current) == null || C.position.set(o.pos.x + Math.sin(i * 0.37 + o.k * 2.1) * 0.06, o.pos.y + Math.sin(i * 0.53 + o.k * 1.3) * 0.09, o.pos.z);
551
- const p = e.inflight > 0, w = Ce(e.activeAt, y, 1.4), b = D ? 1 : 0.9 + 0.1 * Math.sin(g.elapsedTime * 7 + o.k * 3) * Math.sin(g.elapsedTime * 3.1), h = p ? 1 : 0.25 + w * 0.6;
552
- if (f.body.color.copy(u).multiplyScalar((0.18 + h * 0.75) * b), f.halo.color.copy(u).multiplyScalar((p ? 0.45 : 0.06 + w * 0.25) * b), (A = s.current) == null || A.scale.setScalar(p ? 2.6 : 1.7 + w * 0.6), p && !D && Math.random() < 0.7 * ot) {
553
- const l = o.pos;
554
- Bt().emit(l.x + (Math.random() - 0.5) * 0.08, l.y + 0.3, l.z, (Math.random() - 0.5) * 0.7, 2 + Math.random() * 1.2, 0, 1.8, 3.2, 0.6 + Math.random() * 0.3, 0.055, Math.random() < 0.4 ? I : u, 1, dt);
555
- }
556
- let d = e.name;
557
- if (p) {
558
- let l = "";
559
- for (const U of N.mcpPending.values()) U.server === n.name && U.resource === e.name && (l = U.tool);
560
- d = `${e.name} › ${l || "query"}()`;
561
- } else w > 0.25 && e.calls > 0 && (d = `${e.name} ·`);
562
- c.current && (d !== v.current && c.current.setText(v.current = d), c.current.setOpacity(p ? 1 : 0.55 + w * 0.45), c.current.setEmphasis(p));
563
- });
564
- const a = e.kind === "warehouse" || e.kind === "spark" ? 1.15 : 1;
565
- return /* @__PURE__ */ lt("group", { ref: m, children: [
566
- /* @__PURE__ */ M("sprite", { ref: s, material: f.halo }),
567
- /* @__PURE__ */ M("mesh", { geometry: ko, material: f.body, scale: [0.2 * a, 0.27 * a, 0.2 * a] }),
568
- /* @__PURE__ */ M(It, { position: [0, -0.6, 0], text: e.name, color: n.color, size: 0.2, opacity: 0.55, pxRange: [7.5, 11.5] })
569
- ] });
570
- }
571
- const ko = new r.SphereGeometry(1, 16, 12), Me = 48, Mt = new r.Vector3(), ft = new r.Vector3(), xt = new r.Vector3(), ht = new r.Vector3(), gt = new r.Color();
572
- function Ko() {
573
- const { size: t, gl: o, camera: n } = Gt(), e = K(() => new me(Me, 32), []), u = K(() => new ve(Me), []);
574
- return pt(({ clock: f }) => {
575
- const m = performance.now(), c = D ? 0 : f.elapsedTime;
576
- u.setScale(t.height, o.getPixelRatio(), n.fov), e.begin(), u.begin();
577
- const s = Bt();
578
- for (const v of N.mcpPending.values()) {
579
- const a = yt(v.instance), g = we(v.server), y = N.mcpServers.get(v.server);
580
- if (!a || !y || !g) continue;
581
- Mt.copy(a), ft.copy(g), zt(Mt, ft, 0.8, 1.2, xt);
582
- const i = We(v, m);
583
- gt.set(y.color).lerp(no, J(i / 1.2)), i > 1.2 && gt.lerp(Dt, J((i - 1.2) / 1));
584
- const p = (0.16 + Math.min(0.3, i * 0.12)) * ue(i / 0.3), w = 0.05 + 0.9 * ue(i / 0.5);
585
- if (e.add(Mt, xt, ft, gt, p, 0.05, w, 0.7, c, i < 0.5 ? w : -1, 1.2), i < 0.5 && (_t(Mt, xt, ft, w, ht), u.add(ht, 0.5, I, 1.4), D || s.emit(ht.x, ht.y, ht.z, (Math.random() - 0.5) * 0.4, -0.4, 0, 2.5, 1.4, 0.45, 0.06, gt, 1, wt)), v.resource) {
586
- const b = Ne(v.server, v.resource);
587
- b && (zt(ft, b, 0.25, 0.2, xt), e.add(ft, xt, b, gt, p * 0.9, 0.15, 0.85, 0.7, c, -1, 0));
588
- }
589
- }
590
- for (const v of N.mcpCalls) {
591
- if (v.phase !== "result") continue;
592
- const a = J((m - v.start) / v.dur);
593
- if (a >= 1) continue;
594
- const g = yt(v.instance), y = we(v.server), i = N.mcpServers.get(v.server);
595
- if (!g || !i || !y) continue;
596
- ft.copy(y), gt.set(i.color).lerp(I, 0.45), Mt.copy(g), zt(Mt, ft, 0.8, 1.2, xt);
597
- const p = te(a), w = 1 - Math.max(0, (p - 0.85) / 0.15);
598
- e.add(Mt, xt, ft, gt, 0, Math.max(0.03, 1 - p - 0.02), Math.min(0.97, 1 - p + 0.2), 0, c, 1 - p, 1.5 * w), _t(Mt, xt, ft, 1 - p, ht), u.add(ht, 0.65, gt, 1.6 * w), !D && Math.random() < 0.8 && s.emit(ht.x, ht.y, ht.z, (Math.random() - 0.5) * 0.4, -0.3, 0, 2.5, 1.2, 0.5, 0.06, gt, 1, dt);
599
- }
600
- e.end(), u.end();
601
- }), /* @__PURE__ */ lt(Et, { children: [
602
- /* @__PURE__ */ M("primitive", { object: e.obj }),
603
- /* @__PURE__ */ M("primitive", { object: u.obj })
604
- ] });
605
- }
606
- function Oo({ run: t }) {
607
- const o = K(() => new r.Color(t.color), [t.color]), n = K(() => ({ haze: ct(Ct(), "#000") }), []), e = k(null), u = k(null), f = K(() => ({ x: 0, fresh: !0 }), []);
608
- return pt(({ clock: m }) => {
609
- var h;
610
- const c = performance.now(), s = t.run ?? N.runs.get(t.id), v = s ? ue((c - s.startedAt) / 1500) : 1, a = s != null && s.endedAt ? J(1 - (c - s.endedAt - (Ue - 2500)) / 2500) : 1, g = D ? 0 : m.elapsedTime, y = Math.abs(t.side.x) * t.hu + Math.abs(t.axis.x) * t.hv, i = Math.abs(t.side.y) * t.hu + Math.abs(t.axis.y) * t.hv;
611
- e.current && (e.current.position.set(t.origin.x, t.origin.y, -0.4), e.current.scale.set(y * 2.6 + 5, i * 2.6 + 4, 1), n.haze.color.copy(o).multiplyScalar(0.045 * v * a * (0.9 + 0.1 * Math.sin(g * 0.4 + t.index))));
612
- let p = 0, w = 0;
613
- for (const d of ee.agents.values()) d.run === t && d.depth === 0 && (p += d.live.x, w++);
614
- const b = w ? p / w : t.origin.x;
615
- f.x = f.fresh ? b : f.x + (b - f.x) * 0.06, f.fresh = !1, (h = u.current) == null || h.position.set(f.x, t.origin.y + i + 0.6, 0);
616
- }), /* @__PURE__ */ lt(Et, { children: [
617
- /* @__PURE__ */ M("sprite", { ref: e, material: n.haze, renderOrder: -4 }),
618
- /* @__PURE__ */ M("group", { ref: u, children: t.run && /* @__PURE__ */ M(Vo, { run: t.run }) })
619
- ] });
620
- }
621
- function Vo({ run: t }) {
622
- Xe();
623
- const o = t.status !== "started";
624
- return /* @__PURE__ */ M(
625
- It,
626
- {
627
- text: t.topic,
628
- secondary: $e(t, { base: "#a39bb8", current: "#ffd28a", done: "#d6d0e6" }, ["running…", "run complete"]),
629
- color: t.color,
630
- textColor: "#fff3e6",
631
- plate: "none",
632
- anchorY: "bottom",
633
- uppercase: !0,
634
- letterSpacing: 0.12,
635
- size: 0.34,
636
- maxWidth: 11,
637
- opacity: o ? 0.5 : 0.92,
638
- fadeMs: 600,
639
- pxRange: [10, 14],
640
- glow: 1.1
641
- }
642
- );
643
- }
644
- const ce = 6;
645
- function Go() {
646
- const t = k(/* @__PURE__ */ new Set()), o = k([]), n = k([]), e = k([]), u = k([]), f = K(() => new r.Color(), []);
647
- return pt(() => {
648
- const m = performance.now();
649
- for (const c of N.runs.values()) {
650
- if (!c.final || t.current.has(c.id)) continue;
651
- t.current.add(c.id);
652
- const s = ee.runs.get(c.id);
653
- if (!s) continue;
654
- let v;
655
- for (const i of N.instances.values()) i.run === c.id && !i.parent && (v = yt(i.id) ?? v);
656
- const a = (v ?? s.origin).clone();
657
- a.y += 2.2, o.current.push({ run: c.id, start: m, at: a, text: c.final }), o.current.length > ce && o.current.shift();
658
- const g = Bt();
659
- f.set(c.color).lerp(H, 0.6);
660
- const y = Math.round(110 * ot);
661
- for (let i = 0; i < y; i++) {
662
- const p = i / y * Math.PI * 2, w = 6.5 * (0.95 + Math.random() * 0.1);
663
- g.emit(a.x, a.y, a.z, Math.cos(p) * w, Math.sin(p) * w * 0.92, 0, 1.6, 0.9, 2.4 + Math.random() * 0.8, 0.1, i % 2 ? H : f, 1.1, i % 3 === 0 ? dt : wt), i % 2 === 0 && g.emit(a.x, a.y, a.z, Math.cos(p) * w * 0.5, Math.sin(p) * w * 0.5, 0, 1.8, 0.7, 1.6, 0.08, I, 1, dt);
664
- }
665
- for (let i = 0; i < 6 * ot; i++) g.emit(a.x + (Math.random() - 0.5) * 3, a.y + (Math.random() - 0.5) * 2, a.z, 0.15, 0.12, 0, 0.5, -0.03, 5, 3.2, ze, 1, fe);
666
- }
667
- if (t.current.size > 200)
668
- for (const c of t.current) N.runs.has(c) || t.current.delete(c);
669
- o.current.length && m - o.current[0].start > 5600 && o.current.shift();
670
- for (let c = 0; c < ce; c++) {
671
- const s = o.current[c], v = n.current[c], a = e.current[c];
672
- if (!v || !a) continue;
673
- if (!s) {
674
- v.setOpacity(0);
675
- continue;
676
- }
677
- const g = (m - s.start) / 1e3;
678
- a.position.set(s.at.x, s.at.y - 3.4, s.at.z), u.current[c] !== s.run + s.start && (u.current[c] = s.run + s.start, v.setText(`finale · ${s.text.length > 64 ? s.text.slice(0, 62) + "…" : s.text}`)), v.setOpacity(J(g / 0.3) * J((5.4 - g) / 1.2));
679
- }
680
- }), /* @__PURE__ */ M(Et, { children: Array.from({ length: ce }, (m, c) => /* @__PURE__ */ M("group", { ref: (s) => void (e.current[c] = s), children: /* @__PURE__ */ M(It, { ref: (s) => void (n.current[c] = s), text: "", color: "#ffd28a", size: 0.26, maxWidth: 11, opacity: 0, pxRange: [8, 12], renderOrder: 24 }) }, c)) });
681
- }
682
- const Io = 1.7, _e = 0.5, Lo = 1.5, Fo = new r.MeshBasicMaterial({ colorWrite: !1, depthWrite: !1, transparent: !0, opacity: 0 }), R = new r.Vector3(), xe = new r.Color(), _ = Math.random, Z = new r.Vector3();
683
- function le(t, o, n, e, u, f) {
684
- t = Math.max(0, t);
685
- const m = o ? 1 - (1 - t) * (1 - t) : 1 - Math.pow(1 - t, 1.8);
686
- return _t(n, e, u, m, f);
687
- }
688
- function jo(t, o, n, e, u, f) {
689
- const m = o * Math.PI * 2 + (n - 0.5) * 0.5, c = e * (0.85 + n * 0.2);
690
- u.set(t.x + Math.cos(m) * c, t.y + c * (0.42 + o * 0.12), t.z + Math.sin(m) * c * 0.7), f.copy(u).add(t).multiplyScalar(0.5), f.y += c * 0.12;
691
- }
692
- const oe = 18;
693
- function Do() {
694
- const t = new r.BufferGeometry();
695
- return t.setAttribute("position", new r.BufferAttribute(new Float32Array(oe * 6), 3)), t.setAttribute("color", new r.BufferAttribute(new Float32Array(oe * 6), 3)), t.boundingSphere = new r.Sphere(new r.Vector3(), 1e5), t;
696
- }
697
- function Ot(t) {
698
- const o = _() * Math.PI * 2, n = _() * 2 - 1, e = Math.sqrt(1 - n * n);
699
- return t.set(Math.cos(o) * e, n, Math.sin(o) * e * 0.4);
700
- }
701
- function Wo({ agent: t, selected: o, onSelect: n }) {
702
- const e = t.inst, { size: u, gl: f, camera: m } = Gt(), c = k(null), s = k(null), v = k(null), a = k(null), g = k(null), y = k(null), i = k(null), p = k(null), w = k(null), b = k(null), h = K(() => [...e.id].reduce((X, G) => (X * 31 + G.charCodeAt(0)) % 9973, 7) / 9973, [e.id]), d = Nt[e.type], C = ro[e.type], A = K(() => ({
703
- sh: Ao(d, C, h),
704
- halo: ct(Ct(), "#000"),
705
- core: ct(Ct(), "#000"),
706
- flash: ct(Pe(), "#000"),
707
- salute: ct(co(), "#000"),
708
- rocket: ct(Ct(), "#000"),
709
- tailGeo: Do(),
710
- tail: Te(),
711
- sel: new r.MeshBasicMaterial({ color: "#000", blending: r.AdditiveBlending, transparent: !0, depthWrite: !1, toneMapped: !1 })
712
- }), [d, C, h]), l = K(() => {
713
- const X = performance.now(), G = X - e.bornAt < 600;
714
- return {
715
- launch: G,
716
- burstAt: G ? -1 : X - 2e3,
717
- mountAt: X,
718
- burst: !G,
719
- calls: e.llmCalls,
720
- tools: e.toolCalls,
721
- decAt: X,
722
- saluteAt: -1e9,
723
- done: !1,
724
- doneK: 0,
725
- waitK: 0,
726
- selK: 0,
727
- from: new r.Vector3(),
728
- ctrl: new r.Vector3(),
729
- aimed: !1
730
- };
731
- }, []);
732
- pt(({ clock: X }) => {
733
- var it, ge;
734
- const G = performance.now(), q = D ? 0 : X.elapsedTime, E = Bt(), j = t.scale, P = Lo * j * (t.depth > 0 ? 1.4 : 1), mt = D ? 0 : 0.06 * Qt.spread;
735
- t.live.set(t.pos.x + Math.sin(q * 0.23 + h * 20) * mt, t.pos.y + Math.cos(q * 0.19 + h * 13) * mt * 0.7, t.pos.z);
736
- const x = t.live, F = !!e.parent && t.depth > 0, Ut = F ? _e : Io;
737
- if (l.launch && l.burstAt < 0) {
738
- const z = (G - e.bornAt) / 1e3 / Ut;
739
- if (z >= 1) l.burstAt = G;
740
- else {
741
- const O = F ? yt(e.parent) : void 0;
742
- O ? (l.from.copy(O), zt(l.from, x, 0.4 * j, 0.6 * j, l.ctrl)) : l.aimed || (l.aimed = !0, jo(x, Rt(t.run.id, 3), h, Math.max(12, m.position.length()), l.from, l.ctrl)), le(z, F, l.from, l.ctrl, x, R);
743
- const Y = F ? 1 : J(z / 0.12);
744
- g.current && (g.current.visible = !0, g.current.position.copy(R), g.current.scale.setScalar((F ? 0.5 : 1.15) * (D ? 1 : 0.85 + 0.15 * Math.sin(q * 37 + h * 9)))), A.rocket.color.copy(H).lerp(I, 0.6).multiplyScalar(1.5 * Y);
745
- const Pt = A.tailGeo.getAttribute("position"), Ft = A.tailGeo.getAttribute("color"), $t = F ? 0.3 : 0.32;
746
- for (let Tt = 0; Tt < oe; Tt++)
747
- for (let Ht = 0; Ht < 2; Ht++) {
748
- const re = (Tt + Ht) / oe;
749
- le(z - $t * (1 - re), F, l.from, l.ctrl, x, Z);
750
- const ye = Tt * 2 + Ht;
751
- Pt.setXYZ(ye, Z.x, Z.y, Z.z);
752
- const se = re * re * (F ? 1.1 : 1.6) * Y;
753
- Ft.setXYZ(ye, H.r * se, H.g * se * 0.92, H.b * se * 0.8);
754
- }
755
- Pt.needsUpdate = !0, Ft.needsUpdate = !0, y.current && (y.current.visible = !0);
756
- const Ee = (F ? 2 : 9) * ot * Y;
757
- for (let Tt = 0; Tt < Ee; Tt++)
758
- le(z - _() * (F ? 0.04 : 0.025), F, l.from, l.ctrl, x, Z), F ? E.emit(Z.x, Z.y, Z.z, (_() - 0.5) * 0.9, -0.3 - _() * 1.2, (_() - 0.5) * 0.2, 2.2, 2, 0.35 + _() * 0.55, 0.06, _() < 0.3 ? I : H, 0.95, _() < 0.4 ? wt : dt) : E.emit(Z.x, Z.y, Z.z, (_() - 0.5) * 0.35, (_() - 0.5) * 0.35, (_() - 0.5) * 0.15, 1.6, 0.45, 0.9 + _() * 1.2, 0.08, _() < 0.4 ? I : _() < 0.5 ? H : d, 0.95, _() < 0.65 ? wt : dt);
759
- }
760
- }
761
- (!l.launch || l.burstAt >= 0) && (g.current && (g.current.visible = !1), y.current && (y.current.visible = !1));
762
- const V = l.burstAt < 0 ? -1 : (G - l.burstAt) / 1e3;
763
- if (l.burstAt >= 0 && !l.burst) {
764
- l.burst = !0;
765
- const z = Math.round((F ? 100 : 230) * ot), O = 2.4;
766
- E.burst(x.x, x.y, x.z, z, P * 2.6 * O, d, 1.55, { drag: O, grav: 1.1, life: F ? 1.7 : 2.5, size: F ? 0.095 : 0.13, glitter: 0.3, c2: C });
767
- for (let Y = 0; Y < 5 * ot; Y++)
768
- Ot(R), E.emit(x.x + R.x * P * 0.4, x.y + R.y * P * 0.4, x.z, R.x * 0.35, R.y * 0.35 + 0.1, 0, 0.8, -0.05, 3.2 + _(), P * 1.5, d, 0.9, fe);
769
- }
770
- const vt = e.exitAt ? (G - e.exitAt) / Math.max(400, He(e)) : -1, kt = vt >= 0 ? J(vt) : 0, Q = vt < 0 && !e.doneAt, Lt = e.status === "failed";
771
- if (!Q && !l.done && V > 0) {
772
- l.done = !0;
773
- const z = Math.round((F ? 26 : 50) * ot);
774
- for (let O = 0; O < z; O++) {
775
- Ot(R);
776
- const Y = P * (0.75 + _() * 0.3);
777
- E.emit(x.x + R.x * Y, x.y + R.y * Y, x.z + R.z * Y, R.x * 0.5, R.y * 0.3 - 0.2, 0, 1.3, 0.9, 2.2 + _() * 1.2, 0.075, Lt ? Dt : _() < 0.5 ? H : Wt, 0.85, po);
778
- }
779
- for (let O = 0; O < 6 * ot; O++)
780
- Ot(R), E.emit(x.x + R.x * P * 0.6, x.y + R.y * P * 0.6, x.z, R.x * 0.25 + 0.08, 0.18 + _() * 0.15, 0, 0.6, -0.04, 4 + _() * 1.5, P * 1.6, ze, 1, fe);
781
- }
782
- l.doneK += ((Q ? 0 : 1) - l.doneK) * (D ? 1 : 0.035);
783
- const Xt = Q && e.status === "waiting";
784
- if (l.waitK += ((Xt ? 1 : 0) - l.waitK) * 0.05, e.llmCalls !== l.calls && (l.calls = e.llmCalls, Q && V > 0)) {
785
- const z = Math.round((10 + 26 * (e.pulse / 2.5)) * ot);
786
- for (let O = 0; O < z; O++) {
787
- Ot(R);
788
- const Y = P * (0.7 + _() * 0.35);
789
- E.emit(x.x + R.x * Y, x.y + R.y * Y, x.z + R.z * Y, R.x * P * 0.9, R.y * P * 0.9, R.z * P * 0.4, 3.2, 0.5, 0.45 + _() * 0.55 * (e.pulse / 1.5), 0.065, _() < 0.5 ? I : C, 1, wt, _() * 0.25);
790
- }
791
- }
792
- if (e.toolCalls !== l.tools && (l.tools = e.toolCalls, Q && V > 0)) {
793
- Ot(R), R.y = Math.abs(R.y) * 0.6 + 0.3, R.normalize();
794
- for (let z = 0; z < 7 * ot; z++) {
795
- const O = P * (3.2 + z * 0.25);
796
- E.emit(x.x + R.x * P * 0.8, x.y + R.y * P * 0.8, x.z, R.x * O + (_() - 0.5) * 0.3, R.y * O + (_() - 0.5) * 0.3, 0, 3, 1.4, 0.5 + z * 0.05, 0.07, z === 0 ? I : C, 1, dt, z * 0.018);
797
- }
798
- }
799
- const ut = e.decisions;
800
- for (let z = ut.length - 1; z >= 0; z--) {
801
- const O = ut[z];
802
- if (O.at <= l.decAt) break;
803
- if (!(O.at > G) && Ye(O) && G - l.saluteAt > 450 && Q) {
804
- l.saluteAt = G;
805
- const Y = Math.round(30 * ot);
806
- for (let Pt = 0; Pt < Y; Pt++) {
807
- const Ft = Pt / Y * Math.PI * 2, $t = P * 7 * (0.85 + _() * 0.3);
808
- E.emit(x.x, x.y, x.z + 0.05, Math.cos(Ft) * $t, Math.sin(Ft) * $t, 0, 6, 0.8, 0.35 + _() * 0.2, 0.08, Pt % 4 === 0 ? I : Dt, 1.2, dt);
809
- }
810
- }
811
- }
812
- let et = l.decAt;
813
- for (let z = ut.length - 1; z >= 0; z--) ut[z].at <= G && ut[z].at > et && (et = ut[z].at);
814
- l.decAt = et;
815
- const Kt = e.hv ? qe(e.hv, G) : 0, S = e.hv ? Math.min(1, e.hv.rate / 6) : 0;
816
- if (Q && Kt > 0.05 && V > 0 && _() < (0.35 + S * 0.9) * Kt * ot) {
817
- Ot(R);
818
- const z = P * (0.8 + _() * 0.3);
819
- E.emit(x.x + R.x * z, x.y + R.y * z, x.z, R.x * P * 0.6, R.y * P * 0.6, 0, 3, 0.4, 0.35 + _() * 0.3, 0.06, _() < 0.6 ? I : C, 1, wt);
820
- }
821
- const T = Ze(e, G), W = Q && (e.status === "thinking" || e.status === "spawning"), bt = l.launch ? 1 : J((G - l.mountAt) / 500), rt = (1 - kt) * bt, L = A.sh.u;
822
- L.uC.value.copy(x), L.uR.value = P, L.uAge.value = V, L.uTime.value = q, L.uLvl.value = (W ? 1.3 : 1) + T * 0.3, L.uCrackle.value = Math.min(1, T * 0.45 + Kt * (0.45 + S * 0.4)) * (Q ? 1 : 0) * (D ? 0.3 : 1), L.uDone.value = l.doneK, L.uWait.value = l.waitK, L.uScale.value = ne(u.height, f.getPixelRatio(), m.fov), L.uOpacity.value = rt, L.uSize.value = (F ? 0.1 : 0.13) * Math.max(0.75, Math.min(1.5, j)), L.uCol2.value.copy(Lt && !Q ? Dt : C);
823
- const $ = V >= 0, st = $ ? 1 - Math.exp(-V * 5.5) : 0, at = 0.55 + 0.45 * Math.sin(q * 2.2 + h * 6);
824
- if (s.current && (s.current.visible = $, s.current.position.copy(x), s.current.scale.setScalar(Math.max(1e-4, P * (0.55 + T * 0.12 + l.waitK * 0.25 * at) * st)), xe.copy(I).lerp(d, 0.25).lerp(Wt, l.waitK * 0.85 + l.doneK * 0.6), A.core.color.copy(xe).multiplyScalar((0.8 + T * 0.3) * (1 - l.waitK * 0.35 * (1 - at)) * (1 - l.doneK * 0.8) * rt)), c.current && (c.current.visible = $, c.current.position.copy(x), c.current.position.z -= 0.05, c.current.scale.setScalar(Math.max(1e-4, P * 3.4 * st * (1 - l.waitK * 0.35))), A.halo.color.copy(d).lerp(Wt, l.waitK * 0.7).multiplyScalar((0.19 + T * 0.07 + ($ ? Math.exp(-V * 2.5) * 0.3 : 0)) * (1 - l.doneK * 0.7) * rt)), v.current) {
825
- const z = l.launch && $ && V < 1;
826
- if (v.current.visible = z, z) {
827
- const O = 1 - Math.pow(1 - V, 3);
828
- v.current.position.copy(x), v.current.scale.setScalar(P * (0.5 + O * 2.6)), A.flash.color.copy(d).lerp(I, 0.5).multiplyScalar((1 - V) * (1 - V) * (1 - V) * 0.7);
829
- }
830
- }
831
- if (a.current) {
832
- const z = (G - l.saluteAt) / 1e3, O = z < 0.5;
833
- a.current.visible = O, O && (a.current.position.copy(x), a.current.position.z += 0.1, a.current.scale.setScalar(P * (1.6 + z * 5)), A.salute.color.copy(I).lerp(Dt, J(z * 4)).multiplyScalar(1.6 * (1 - z / 0.5) * (1 - z / 0.5)));
834
- }
835
- l.selK += ((o ? 1 : 0) - l.selK) * 0.12, i.current && (i.current.visible = l.selK > 0.02, i.current.position.copy(x), i.current.scale.setScalar(P * (1.35 + (1 - l.selK) * 0.5)), A.sel.color.setScalar(0.85 * l.selK * rt)), p.current && (p.current.position.copy(x), p.current.scale.setScalar(Math.max(1e-4, P * 0.95))), (it = w.current) == null || it.position.set(x.x, x.y - P * (1.05 - l.waitK * 0.35) - 0.28, x.z), (ge = b.current) == null || ge.setOpacity(Je(e.id) ? ($ ? J(V * 2) : 0) * (Q ? 0.95 : 0.6) * (1 - kt) : 0);
836
- });
837
- const U = (X) => {
838
- X.stopPropagation(), n(e.id);
839
- }, nt = e.id.split(":")[2];
840
- return /* @__PURE__ */ lt(Et, { children: [
841
- /* @__PURE__ */ M("mesh", { ref: p, geometry: uo, material: Fo, scale: 1e-4, onClick: U, onPointerOver: () => document.body.style.cursor = "pointer", onPointerOut: () => document.body.style.cursor = "" }),
842
- /* @__PURE__ */ M("sprite", { ref: c, material: A.halo, visible: !1 }),
843
- /* @__PURE__ */ M("lineSegments", { geometry: Mo, material: A.sh.lines, frustumCulled: !1, renderOrder: 3 }),
844
- /* @__PURE__ */ M("points", { geometry: bo, material: A.sh.pts, frustumCulled: !1, renderOrder: 4 }),
845
- /* @__PURE__ */ M("sprite", { ref: s, material: A.core, visible: !1, renderOrder: 5 }),
846
- /* @__PURE__ */ M("sprite", { ref: v, material: A.flash, visible: !1 }),
847
- /* @__PURE__ */ M("sprite", { ref: a, material: A.salute, visible: !1, renderOrder: 6 }),
848
- /* @__PURE__ */ M("sprite", { ref: g, material: A.rocket, visible: !1 }),
849
- /* @__PURE__ */ M("lineSegments", { ref: y, geometry: A.tailGeo, material: A.tail, visible: !1, frustumCulled: !1 }),
850
- /* @__PURE__ */ M("mesh", { ref: i, geometry: lo, material: A.sel, visible: !1 }),
851
- /* @__PURE__ */ M("group", { ref: w, children: /* @__PURE__ */ M(
852
- It,
853
- {
854
- ref: b,
855
- text: `${e.name}${nt !== void 0 ? ` ${Number(nt) + 1}` : ""}`,
856
- live: e.job ? () => Qe(e) : null,
857
- color: de[e.type],
858
- size: e.subagent ? 0.22 : 0.28,
859
- letterSpacing: 0.02,
860
- opacity: 0,
861
- fit: !0,
862
- pxRange: e.subagent ? [8, 11.5] : [9, 13.5]
863
- }
864
- ) })
865
- ] });
866
- }
867
- const No = 96, Se = 32, Jt = new r.Vector3(), St = new r.Vector3(), Vt = new r.Vector3(), At = new r.Color();
868
- function Uo() {
869
- const { size: t, gl: o, camera: n } = Gt(), e = K(() => new me(No + Se, 22), []), u = K(() => new ve(Se), []), f = K(() => /* @__PURE__ */ new Map(), []);
870
- return pt(({ clock: m }) => {
871
- const c = performance.now(), s = D ? 0 : m.elapsedTime;
872
- u.setScale(t.height, o.getPixelRatio(), n.fov), e.begin(), u.begin();
873
- for (const a of f.keys()) N.instances.has(a) || f.delete(a);
874
- for (const a of N.instances.values()) {
875
- if (!a.parent) continue;
876
- const g = yt(a.parent), y = yt(a.id);
877
- if (!g || !y) continue;
878
- const i = N.instances.get(a.parent), w = (c - a.bornAt) / 1e3 > _e && i && !i.exitAt && !a.exitAt && !a.doneAt ? 1 : 0;
879
- let b = f.get(a.id) ?? 0;
880
- if (b += (w - b) * (w ? 0.04 : 0.03), f.set(a.id, b), b < 0.01) continue;
881
- const h = Qt.scale;
882
- zt(g, y, 0.4 * h, 0.6 * h, St);
883
- const d = g.distanceTo(y) || 1, C = Math.min(0.35, 0.75 * h * 1.35 / d), A = 1 - Math.min(0.35, 0.75 * h * 0.6 / d);
884
- At.copy(Nt[a.type]).lerp(H, 0.5), e.add(g, St, y, At, 0.16 * b, C, A, 0.12 * b, s, -1, 0);
885
- }
886
- const v = Bt();
887
- for (const a of N.comets) {
888
- const g = yt(a.from), y = yt(a.to);
889
- if (!g || !y) continue;
890
- const i = to(a, c);
891
- if (!eo(a, c)) continue;
892
- const p = N.instances.get(a.from), w = N.instances.get(a.to);
893
- if ((w == null ? void 0 : w.parent) === a.from || (p == null ? void 0 : p.parent) === a.to) {
894
- const h = (w == null ? void 0 : w.parent) === a.from;
895
- Z.copy(h ? g : y), Jt.copy(h ? y : g), zt(Z, Jt, 0.4 * Qt.scale, 0.6 * Qt.scale, St);
896
- const d = h ? te(i) : 1 - te(i);
897
- _t(Z, St, Jt, d, Vt), At.copy(p ? Nt[p.type] : H).lerp(I, 0.45);
898
- const C = Math.min(1, i / 0.1) * Math.min(1, (1 - i) / 0.15);
899
- e.add(Z, St, Jt, At, 0, h ? Math.max(0, d - 0.25) : d, h ? d : Math.min(1, d + 0.25), 0, s, d, 1.4 * C);
900
- } else {
901
- zt(g, y, 1.2, 1, St);
902
- const h = te(i);
903
- _t(g, St, y, h, Vt), At.copy(p ? Nt[p.type] : H).lerp(I, 0.45);
904
- const d = Math.min(1, i / 0.1) * Math.min(1, (1 - i) / 0.15);
905
- e.add(g, St, y, At, 0, Math.max(0, h - 0.22), h, 0, s, h, 1.4 * d);
906
- }
907
- u.add(Vt, 0.55, At, 1.5), !D && _() < 0.7 && v.emit(Vt.x, Vt.y, Vt.z, (_() - 0.5) * 0.4, -0.3 - _() * 0.3, 0, 2.5, 1.2, 0.5, 0.06, At, 0.9, wt);
908
- }
909
- e.end(), u.end();
910
- }), /* @__PURE__ */ lt(Et, { children: [
911
- /* @__PURE__ */ M("primitive", { object: e.obj }),
912
- /* @__PURE__ */ M("primitive", { object: u.obj })
913
- ] });
914
- }
915
- const Xo = (
916
- /* glsl */
917
- `
918
- varying vec3 vW;
919
- void main(){ vec4 w = modelMatrix * vec4(position, 1.0); vW = w.xyz; gl_Position = projectionMatrix * viewMatrix * w; }`
920
- ), $o = (
921
- /* glsl */
922
- `
923
- uniform float uTime; uniform float uK; uniform float uPx;
924
- varying vec3 vW;
925
- float h(vec2 p){ return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
926
- void main(){
927
- vec3 d = normalize(vW - cameraPosition);
928
- // deep navy overhead, a faint violet glow lower in the sky (no horizon line: it just thins out)
929
- float y = d.y;
930
- vec3 col = mix(vec3(0.019, 0.015, 0.038), vec3(0.004, 0.006, 0.022), smoothstep(-0.55, 0.45, y));
931
- col += vec3(0.020, 0.009, 0.016) * smoothstep(0.2, -0.6, y);
932
- // stars on the sky sphere: one candidate per ~2.2 css px cell (in angle), sparse and twinkling. Drawn with a
933
- // pixel-sized falloff so they stay crisp and don't crawl while the camera turns
934
- vec2 g = vec2(atan(d.z, d.x), asin(clamp(y, -1.0, 1.0))) * uK;
935
- vec2 cell = floor(g);
936
- float r = h(cell);
937
- if (r > 0.955) {
938
- vec2 c = vec2(h(cell + 1.7), h(cell + 4.3)) * 0.6 + 0.2;
939
- float dp = length(fract(g) - c) * 2.2 * uPx;
940
- float m = pow(h(cell + 9.1), 3.0);
941
- float tw = 0.65 + 0.35 * sin(uTime * (0.8 + r * 2.0) + r * 60.0);
942
- col += vec3(0.75, 0.8, 1.0) * smoothstep(0.8 + m * 0.9, 0.0, dp) * (0.16 + m * 0.75) * tw;
943
- }
944
- gl_FragColor = vec4(col, 1.0);
945
- }`
946
- );
947
- function Ho() {
948
- const { size: t, gl: o, camera: n } = Gt(), e = K(
949
- () => new r.ShaderMaterial({
950
- uniforms: { uTime: { value: 0 }, uK: { value: 300 }, uPx: { value: 1 } },
951
- vertexShader: Xo,
952
- fragmentShader: $o,
953
- depthWrite: !1,
954
- depthTest: !1
955
- }),
956
- []
957
- ), u = k(null);
958
- return pt(({ clock: f }) => {
959
- const m = e.uniforms, c = Math.atan2(n.position.x, n.position.z), s = Math.cos(c), v = Math.sin(c);
960
- u.current && (u.current.position.set(-v * 0.6, 0, -s * 0.6), u.current.rotation.y = c), m.uTime.value = D ? 0 : f.elapsedTime, m.uPx.value = o.getPixelRatio();
961
- const a = n.fov;
962
- m.uK.value = t.height / (2.2 * 2 * Math.tan(a * Math.PI / 360));
963
- }), /* @__PURE__ */ M("mesh", { ref: u, material: e, position: [0, 0, -0.6], renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ M("planeGeometry", { args: [6e3, 6e3] }) });
964
- }
965
- function Yo() {
966
- const { size: t, gl: o, camera: n } = Gt(), e = Bt();
967
- return pt(() => {
968
- e.setScale(t.height, o.getPixelRatio(), n.fov), e.flush();
969
- }), /* @__PURE__ */ lt(Et, { children: [
970
- /* @__PURE__ */ M("primitive", { object: e.streaks }),
971
- /* @__PURE__ */ M("primitive", { object: e.points })
972
- ] });
973
- }
974
- const qo = {
975
- minPolarAngle: Math.PI * 0.3,
976
- maxPolarAngle: Math.PI * 0.68
977
- };
978
- function nn() {
979
- return /* @__PURE__ */ lt(
980
- oo,
981
- {
982
- title: "fireworks · night show",
983
- subtitle: "Each agent streaks in as a shooting star and bursts into a star shell (subagents = secondary bursts) · shells crackle on LLM calls · ✦ comets on tool calls · red salute = deny · ember = waiting · willow = done · ◎ MCP Catherine wheels with backend lanterns · graph = embers",
984
- preset: fo,
985
- plane: "xy",
986
- camera: { position: [0, 0, 34], fov: 46, far: 1200 },
987
- controls: qo,
988
- bg: "#03040d",
989
- gl: { antialias: !0 },
990
- fit: { nRef: 4, min: 0.62, max: 1.6, minRadius: 5.5 },
991
- agentRadius: 1.7,
992
- graph: { natural: he * 1.1, radius: 3.4 },
993
- Background: /* @__PURE__ */ M(Ho, {}),
994
- Agent: Wo,
995
- RunMarker: Oo,
996
- McpServer: Eo,
997
- Backend: Bo,
998
- GraphResource: _o,
999
- cluster: { radius: 1.5, variant: "stars", glowGain: 0.9 },
1000
- PostFX: /* @__PURE__ */ lt(Ke, { multisampling: 0, children: [
1001
- /* @__PURE__ */ M(Oe, { mipmapBlur: !0, intensity: 0.85, luminanceThreshold: 0.3, luminanceSmoothing: 0.3, radius: 0.65 }),
1002
- /* @__PURE__ */ M(Ve, { eskil: !1, offset: 0.35, darkness: 0.5 })
1003
- ] }),
1004
- children: [
1005
- /* @__PURE__ */ M(Uo, {}),
1006
- /* @__PURE__ */ M(Ko, {}),
1007
- /* @__PURE__ */ M(Go, {}),
1008
- /* @__PURE__ */ M(Yo, {})
1009
- ]
1010
- }
1011
- );
1012
- }
1013
- export {
1014
- nn as default
1015
- };