agentglow 0.2.10 → 0.2.12

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,1143 +0,0 @@
1
- var Xt = Object.defineProperty;
2
- var jt = (e, o, t) => o in e ? Xt(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
3
- var ae = (e, o, t) => jt(e, typeof o != "symbol" ? o + "" : o, t);
4
- import { jsxs as H, Fragment as ce, jsx as c } from "react/jsx-runtime";
5
- import { EffectComposer as Kt, Bloom as Ht, Vignette as $t } from "@react-three/postprocessing";
6
- import * as n from "three";
7
- import { D as Yt, h as Re, T as _t, k as me, S as lt, w as J, R as Zt, q as Jt, f as Qe, u as Qt, L as Ee, o as eo, d as to, a as Gt, c as oo, K as no, m as ro, G as ao, n as so, p as io, e as lo, s as co, g as uo, b as Ct, j as fo } from "./KitScene-Bm1I35Zc.js";
8
- import { useFrame as Z, useThree as rt } from "@react-three/fiber";
9
- import { useMemo as S, useRef as _, useState as et } from "react";
10
- import { Stars as po } from "@react-three/drei";
11
- var Bt;
12
- const I = typeof window < "u" && !!((Bt = window.matchMedia) != null && Bt.call(window, "(prefers-reduced-motion: reduce)").matches), he = {
13
- bg: "#02080b",
14
- fog: "#071c20",
15
- ground: "#041214",
16
- moon: "#dff7ef",
17
- teal: "#5eead4",
18
- mint: "#86efac",
19
- amber: "#fbbf24",
20
- red: "#ff3d4a"
21
- }, te = new n.Color(he.teal);
22
- new n.Color(he.mint);
23
- const tt = new n.Color(he.amber), Vt = new n.Color(he.red), ie = new n.Color(1, 1, 1), mo = new n.Color("#3b4d52"), gt = Object.fromEntries(Object.entries(_t).map(([e, o]) => [e, new n.Color(o).lerp(te, 0.12)])), le = (e) => e < 0 ? 0 : e > 1 ? 1 : e, De = (e) => 1 - Math.pow(1 - le(e), 3), at = (e) => (e = le(e), e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2), ho = (e) => {
24
- e = le(e);
25
- const o = 1.9;
26
- return 1 + (o + 1) * Math.pow(e - 1, 3) + o * Math.pow(e - 1, 2);
27
- };
28
- let Xe = null;
29
- function vt() {
30
- if (Xe) return Xe;
31
- const e = document.createElement("canvas");
32
- e.width = e.height = 128;
33
- const o = e.getContext("2d"), t = o.createRadialGradient(64, 64, 0, 64, 64, 64);
34
- return t.addColorStop(0, "rgba(255,255,255,1)"), t.addColorStop(0.15, "rgba(255,255,255,0.6)"), t.addColorStop(0.45, "rgba(255,255,255,0.14)"), t.addColorStop(1, "rgba(255,255,255,0)"), o.fillStyle = t, o.fillRect(0, 0, 128, 128), Xe = new n.CanvasTexture(e), Xe;
35
- }
36
- let je = null;
37
- function go() {
38
- if (je) return je;
39
- const e = document.createElement("canvas");
40
- e.width = 256, e.height = 128;
41
- const o = e.getContext("2d");
42
- let t = 7;
43
- const r = () => (t = t * 16807 % 2147483647) / 2147483647;
44
- for (let s = 0; s < 14; s++) {
45
- const i = 50 + r() * 156, a = 50 + r() * 28, l = 26 + r() * 30, g = o.createRadialGradient(i, a, 0, i, a, l);
46
- g.addColorStop(0, "rgba(255,255,255,0.22)"), g.addColorStop(1, "rgba(255,255,255,0)"), o.fillStyle = g, o.fillRect(0, 0, 256, 128);
47
- }
48
- return je = new n.CanvasTexture(e), je;
49
- }
50
- function Ae(e = "#fff") {
51
- return new n.SpriteMaterial({ map: vt(), color: e, blending: n.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, fog: !1 });
52
- }
53
- function de(e = "#fff", o = n.FrontSide) {
54
- return new n.MeshBasicMaterial({ color: e, blending: n.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, side: o, fog: !1 });
55
- }
56
- function vo(e = "#fff") {
57
- return new n.LineBasicMaterial({ color: e, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1, fog: !1 });
58
- }
59
- function Ue(e = "#fff") {
60
- return new n.MeshBasicMaterial({ map: vt(), color: e, blending: n.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, fog: !1 });
61
- }
62
- new n.SphereGeometry(1, 24, 16);
63
- const Le = new n.PlaneGeometry(1, 1).rotateX(-Math.PI / 2), wt = new n.ConeGeometry(1, 1, 12).translate(0, 0.5, 0);
64
- function wo(e = 48, o = 6) {
65
- const t = [], r = [];
66
- for (let i = 0; i <= e; i++) {
67
- const a = i / e;
68
- for (let l = 0; l < o; l++) {
69
- const g = l / o * Math.PI * 2;
70
- t.push(a, Math.cos(g), Math.sin(g));
71
- }
72
- }
73
- for (let i = 0; i < e; i++)
74
- for (let a = 0; a < o; a++) {
75
- const l = i * o + a, g = i * o + (a + 1) % o, h = (i + 1) * o + a, f = (i + 1) * o + (a + 1) % o;
76
- r.push(l, h, g, g, h, f);
77
- }
78
- const s = new n.BufferGeometry();
79
- return s.setAttribute("position", new n.Float32BufferAttribute(t, 3)), s.setIndex(r), s.boundingSphere = new n.Sphere(new n.Vector3(), 1e4), s;
80
- }
81
- const Dt = wo(), yo = (
82
- /* glsl */
83
- `
84
- uniform vec3 uP0; uniform vec3 uP1; uniform vec3 uP2; uniform float uRadius; uniform float uTaper;
85
- varying float vT; varying float vRim;
86
- void main(){
87
- float t = position.x; float a = 1.0 - t;
88
- vec3 p = a*a*uP0 + 2.0*a*t*uP1 + t*t*uP2;
89
- vec3 tg = 2.0*a*(uP1-uP0) + 2.0*t*(uP2-uP1);
90
- tg = length(tg) > 1e-5 ? normalize(tg) : vec3(1.0,0.0,0.0);
91
- vec3 up = abs(tg.y) > 0.92 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,0.0);
92
- vec3 n = normalize(cross(tg, up)); vec3 b = cross(tg, n);
93
- vec3 off = n*position.y + b*position.z;
94
- vec4 mv = modelViewMatrix * vec4(p + off * uRadius * mix(1.0, uTaper, t), 1.0);
95
- vRim = abs(dot(normalize(normalMatrix * off), normalize(-mv.xyz)));
96
- vT = t;
97
- gl_Position = projectionMatrix * mv;
98
- }`
99
- ), Mo = (
100
- /* glsl */
101
- `
102
- uniform vec3 uColor; uniform float uOpacity; uniform float uGrow; uniform float uTime; uniform float uFlow; uniform float uFlowDir;
103
- uniform float uHead; uniform float uTail; uniform vec3 uHeadColor;
104
- varying float vT; varying float vRim;
105
- void main(){
106
- if (vT > uGrow) discard;
107
- float core = 0.3 + 0.7 * vRim * vRim;
108
- float tip = smoothstep(uGrow - 0.08, uGrow, vT) * step(uGrow, 0.995);
109
- float head = 0.0;
110
- if (uHead >= 0.0) { float d = vT - uHead; head = d > 0.0 ? exp(-d * d / 0.0008) : exp(d / max(uTail, 0.001)); }
111
- // directional flow: soft beads travelling start (t=0) → end (t=1) (or reversed with uFlowDir = -1)
112
- float flow = uFlow * pow(max(0.0, sin((vT * 9.0 - uTime * 0.9 * uFlowDir) * 3.14159)), 6.0);
113
- vec3 col = uColor * uOpacity * (core + tip * 3.0 + flow * 2.4) + uHeadColor * head * (0.6 + vRim);
114
- gl_FragColor = vec4(col, 1.0);
115
- }`
116
- );
117
- function Et(e = "#fff", o = 0.06, t = 0.4) {
118
- return new n.ShaderMaterial({
119
- uniforms: {
120
- uP0: { value: new n.Vector3() },
121
- uP1: { value: new n.Vector3() },
122
- uP2: { value: new n.Vector3() },
123
- uRadius: { value: o },
124
- uTaper: { value: t },
125
- uColor: { value: new n.Color(e) },
126
- uOpacity: { value: 1 },
127
- uGrow: { value: 1 },
128
- uTime: { value: 0 },
129
- uFlow: { value: 0 },
130
- uFlowDir: { value: 1 },
131
- uHead: { value: -1 },
132
- uTail: { value: 0.12 },
133
- uHeadColor: { value: new n.Color(4, 4, 4) }
134
- },
135
- vertexShader: yo,
136
- fragmentShader: Mo,
137
- transparent: !0,
138
- depthWrite: !1,
139
- blending: n.AdditiveBlending
140
- });
141
- }
142
- function xe(e, o, t, r, s) {
143
- const i = 1 - r;
144
- return s.set(i * i * e.x + 2 * i * r * o.x + r * r * t.x, i * i * e.y + 2 * i * r * o.y + r * r * t.y, i * i * e.z + 2 * i * r * o.z + r * r * t.z);
145
- }
146
- function yt(e, o, t, r, s) {
147
- s.copy(e).add(o).multiplyScalar(0.5);
148
- const i = o.x - e.x, a = o.z - e.z, l = Math.hypot(i, a) || 1;
149
- return s.x += -a / l * t * l, s.z += i / l * t * l, s.y = r, s;
150
- }
151
- function Ut(e, o, t, r) {
152
- return r.copy(e).add(o).multiplyScalar(0.5), r.y = Math.max(e.y, o.y) + t, r;
153
- }
154
- function Pt(e, o, t) {
155
- return e.r += o.r * t, e.g += o.g * t, e.b += o.b * t, e;
156
- }
157
- const nt = class nt {
158
- constructor(o) {
159
- ae(this, "mesh");
160
- ae(this, "colors");
161
- ae(this, "n", 0);
162
- ae(this, "max");
163
- ae(this, "o", new n.Object3D());
164
- ae(this, "a", new n.Vector3());
165
- ae(this, "b", new n.Vector3());
166
- ae(this, "d", new n.Vector3());
167
- this.max = o, this.colors = new Float32Array(o * 3), this.mesh = new n.InstancedMesh(wt, new n.MeshBasicMaterial({ blending: n.AdditiveBlending, depthWrite: !1, transparent: !0, toneMapped: !1, fog: !1 }), o), this.mesh.instanceColor = new n.InstancedBufferAttribute(this.colors, 3), this.mesh.frustumCulled = !1, this.mesh.count = 0;
168
- }
169
- begin() {
170
- this.n = 0;
171
- }
172
- add(o, t, r, s, i, a, l, g = 1) {
173
- this.n >= this.max || (xe(o, t, r, s, this.a), xe(o, t, r, Math.min(1, Math.max(0, s + 0.02 * i)), this.b), this.d.subVectors(this.b, this.a), !(this.d.lengthSq() < 1e-8) && (this.o.position.copy(this.a), this.o.quaternion.setFromUnitVectors(nt.UP, this.d.normalize()), this.o.scale.set(a * 0.42, a, a * 0.42), this.o.updateMatrix(), this.mesh.setMatrixAt(this.n, this.o.matrix), this.colors[this.n * 3] = l.r * g, this.colors[this.n * 3 + 1] = l.g * g, this.colors[this.n * 3 + 2] = l.b * g, this.n++));
174
- }
175
- end() {
176
- this.mesh.count = this.n, this.mesh.instanceMatrix.needsUpdate = !0, this.mesh.instanceColor && (this.mesh.instanceColor.needsUpdate = !0);
177
- }
178
- };
179
- ae(nt, "UP", new n.Vector3(0, 1, 0));
180
- let ot = nt;
181
- const ct = new n.Vector3(), Ke = new n.Vector3(), bo = new n.Vector3(0, 1, 0);
182
- function ft(e, o, t, r, s, i, a) {
183
- xe(o, t, r, s, ct), xe(o, t, r, Math.min(1, Math.max(0, s + 0.02 * i)), Ke), e.position.copy(ct), Ke.sub(ct), Ke.lengthSq() > 1e-8 && e.quaternion.setFromUnitVectors(bo, Ke.normalize()), e.scale.set(a * 0.42, a, a * 0.42);
184
- }
185
- const Mt = (e) => (e.subagent ? 2.1 : 4.6) * (0.92 + 0.16 * Re(e.id, 11)), So = (e) => e.subagent ? 0.72 : 1.45, bt = (e) => e.scale / Yt(e.inst);
186
- function pt(e, o) {
187
- const t = me.agents.get(e);
188
- if (t)
189
- return o.set(t.live.x, t.live.y + Mt(t.inst) * 0.62 * bt(t), t.live.z);
190
- }
191
- const Ao = new n.DodecahedronGeometry(0.32, 0), xo = new n.MeshStandardMaterial({ color: "#1b2e2d", roughness: 0.9, flatShading: !0 }), Co = -2.3, Po = 5.6;
192
- function Lt(e, o) {
193
- return o.w = Math.abs(e.side.x) * e.hu + Math.abs(e.axis.x) * e.hv, o.d = Math.abs(e.side.z) * e.hu + Math.abs(e.axis.z) * e.hv, o;
194
- }
195
- const mt = (e) => e.target.z < -0.5 ? -1 : 1;
196
- function Ot(e, o, t = mt(e)) {
197
- return Lt(e, ut), t < 0 ? o.set(e.origin.x, Po * Math.min(1.4, Math.max(0.75, Qe.scale)), e.origin.z - ut.d - 0.4) : o.set(e.origin.x, 0.3, e.origin.z + ut.d + 1.2);
198
- }
199
- const ut = { w: 0, d: 0 };
200
- function To({ run: e }) {
201
- const o = S(() => new n.Color(e.color).lerp(te, 0.35), [e.color]), t = S(() => Ue("#000"), []), r = S(() => lt.map(() => Ae("#000")), []), s = _(null), i = _(null), a = _([]), l = _([]), g = S(() => ({ w: 0, d: 0 }), []), h = e.run, [f, m] = et(!!(h != null && h.hasSteps)), [p, x] = et(() => mt(e));
202
- return Z(({ clock: R }) => {
203
- const M = performance.now(), y = e.run ?? J.runs.get(e.id), u = y ? De((M - y.startedAt) / 1200) : 1, U = y != null && y.endedAt ? le(1 - (M - y.endedAt - (Zt - 2500)) / 2500) : 1, N = I ? 1 : 0.9 + 0.1 * Math.sin(R.elapsedTime * 0.6 + e.index);
204
- t.color.copy(o).multiplyScalar(0.085 * u * U * N), Lt(e, g), s.current && (s.current.position.set(e.origin.x, 0.015, e.origin.z), s.current.scale.set(g.w * 2.6 + 6, 1, g.d * 2.6 + 6));
205
- const j = mt(e);
206
- j !== p && x(j), i.current && Ot(e, i.current.position, p);
207
- const D = !!(y != null && y.hasSteps);
208
- D !== f && m(D), y && D && lt.forEach((v, d) => {
209
- var V;
210
- const C = l.current[d];
211
- C && Jt(e, e.cu + (d - 1) * 1.7 * Qe.spread, Co * Qe.spread, C.position).setY(0);
212
- const T = y.steps[v], L = I ? 1 : 0.8 + 0.2 * Math.sin(R.elapsedTime * 7 + d * 2) * Math.sin(R.elapsedTime * 3.1 + d), G = r[d];
213
- T === "running" ? G.color.copy(tt).multiplyScalar(0.9 * L) : T === "done" ? G.color.copy(te).multiplyScalar(0.35) : T === "failed" ? G.color.copy(Vt).multiplyScalar(0.6) : G.color.setScalar(0.04), G.color.multiplyScalar(U), (V = a.current[d]) == null || V.scale.setScalar(T === "running" ? 1.9 : 1.2);
214
- });
215
- }), /* @__PURE__ */ H(ce, { children: [
216
- /* @__PURE__ */ c("mesh", { ref: s, geometry: Le, material: t }),
217
- f && lt.map((R, M) => /* @__PURE__ */ H("group", { ref: (y) => void (l.current[M] = y), children: [
218
- /* @__PURE__ */ c("mesh", { geometry: Ao, material: xo, position: [0, 0.22, 0], scale: [1, 0.8, 1] }),
219
- /* @__PURE__ */ c("sprite", { ref: (y) => void (a.current[M] = y), material: r[M], position: [0, 0.62, 0] })
220
- ] }, M)),
221
- /* @__PURE__ */ c("group", { ref: i, children: h && /* @__PURE__ */ c(zo, { run: h, anchorY: p > 0 ? "top" : "middle" }) })
222
- ] });
223
- }
224
- function zo({ run: e, anchorY: o }) {
225
- Qt();
226
- const t = e.status !== "started";
227
- return /* @__PURE__ */ c(
228
- Ee,
229
- {
230
- text: e.topic,
231
- secondary: eo(e, { base: "#94a3b8", current: "#fde68a", done: "#cbd5e1" }, ["growing…", "grove at rest"]),
232
- color: e.color,
233
- size: 0.36,
234
- maxWidth: 10,
235
- opacity: t ? 0.5 : 1,
236
- fadeMs: 400,
237
- anchorY: o,
238
- pxRange: [10, 15]
239
- }
240
- );
241
- }
242
- const oe = 1400, w = {
243
- pos: new Float32Array(oe * 3),
244
- vel: new Float32Array(oe * 3),
245
- col: new Float32Array(oe * 3),
246
- size: new Float32Array(oe),
247
- life: new Float32Array(oe),
248
- // seconds left (≤0 = dead)
249
- max: new Float32Array(oe),
250
- seed: new Float32Array(oe),
251
- kind: new Uint8Array(oe),
252
- // 0 = firefly (wanders), 1 = trail (still, quick fade)
253
- next: 0
254
- };
255
- function kt() {
256
- for (let o = 0; o < 24; o++) {
257
- const t = (w.next + o) % oe;
258
- if (w.life[t] <= 0)
259
- return w.next = (t + 1) % oe, t;
260
- }
261
- const e = w.next;
262
- return w.next = (w.next + 1) % oe, e;
263
- }
264
- function Ro(e, o, t, r, s) {
265
- I && (o = Math.ceil(o * 0.4));
266
- for (let i = 0; i < o; i++) {
267
- const a = kt(), l = Math.random() * Math.PI * 2, g = s * Math.sqrt(Math.random());
268
- w.pos[a * 3] = e.x + Math.cos(l) * g, w.pos[a * 3 + 1] = e.y + (Math.random() - 0.3) * s * 0.9, w.pos[a * 3 + 2] = e.z + Math.sin(l) * g;
269
- const h = 0.9 + Math.random() * 1.6;
270
- w.vel[a * 3] = Math.cos(l) * h, w.vel[a * 3 + 1] = 0.9 + Math.random() * 1.8, w.vel[a * 3 + 2] = Math.sin(l) * h;
271
- const f = Math.random() * 0.35;
272
- w.col[a * 3] = t.r * (1 - f) + f * 1, w.col[a * 3 + 1] = t.g * (1 - f) + f * 1, w.col[a * 3 + 2] = t.b * (1 - f) + f * 0.6, w.size[a] = r * (0.6 + Math.random() * 0.8), w.max[a] = w.life[a] = 1.8 + Math.random() * 2.2, w.seed[a] = Math.random() * 100, w.kind[a] = 0;
273
- }
274
- }
275
- function It(e, o, t, r = 0.55) {
276
- const s = kt();
277
- w.pos[s * 3] = e.x, w.pos[s * 3 + 1] = e.y, w.pos[s * 3 + 2] = e.z, w.vel[s * 3] = w.vel[s * 3 + 1] = w.vel[s * 3 + 2] = 0, w.col[s * 3] = o.r, w.col[s * 3 + 1] = o.g, w.col[s * 3 + 2] = o.b, w.size[s] = t, w.max[s] = w.life[s] = r, w.seed[s] = Math.random() * 100, w.kind[s] = 1;
278
- }
279
- const Fo = (
280
- /* glsl */
281
- `
282
- attribute float aSize; attribute vec3 aColor; attribute float aAlpha; attribute float aSeed;
283
- uniform float uScale; uniform float uTime; varying vec3 vC;
284
- void main(){
285
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
286
- float flick = 0.65 + 0.35 * sin(uTime * (5.0 + fract(aSeed) * 6.0) + aSeed * 7.0);
287
- vC = aColor * aAlpha * flick;
288
- gl_PointSize = aSize * uScale / -mv.z;
289
- gl_Position = projectionMatrix * mv;
290
- }`
291
- ), Bo = (
292
- /* glsl */
293
- `
294
- varying vec3 vC;
295
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
296
- float core = smoothstep(0.35, 0.0, r); float halo = pow(1.0 - r, 2.6);
297
- gl_FragColor = vec4(vC * (core * 1.6 + halo * 0.55), 1.0); }`
298
- );
299
- function St(e, o, t) {
300
- return e.height * o.getPixelRatio() / (2 * Math.tan((t.fov ?? 50) * Math.PI / 360));
301
- }
302
- function _o() {
303
- const { size: e, gl: o, camera: t } = rt(), { geo: r, mat: s } = S(() => {
304
- const i = new n.BufferGeometry();
305
- i.setAttribute("position", new n.BufferAttribute(w.pos, 3).setUsage(n.DynamicDrawUsage)), i.setAttribute("aColor", new n.BufferAttribute(w.col, 3).setUsage(n.DynamicDrawUsage)), i.setAttribute("aSize", new n.BufferAttribute(w.size, 1).setUsage(n.DynamicDrawUsage)), i.setAttribute("aSeed", new n.BufferAttribute(w.seed, 1).setUsage(n.DynamicDrawUsage)), i.setAttribute("aAlpha", new n.BufferAttribute(new Float32Array(oe), 1).setUsage(n.DynamicDrawUsage)), i.boundingSphere = new n.Sphere(new n.Vector3(), 1e4);
306
- const a = new n.ShaderMaterial({ uniforms: { uScale: { value: 400 }, uTime: { value: 0 } }, vertexShader: Fo, fragmentShader: Bo, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending });
307
- return { geo: i, mat: a };
308
- }, []);
309
- return Z(({ clock: i }, a) => {
310
- a = Math.min(a, 0.05);
311
- const l = i.elapsedTime;
312
- s.uniforms.uScale.value = St(e, o, t), s.uniforms.uTime.value = I ? 0 : l;
313
- const g = r.getAttribute("aAlpha"), h = g.array, f = Math.exp(-a * 1.6);
314
- for (let m = 0; m < oe; m++) {
315
- if (w.life[m] <= 0) {
316
- h[m] = 0;
317
- continue;
318
- }
319
- w.life[m] -= a;
320
- const p = 1 - w.life[m] / w.max[m];
321
- if (w.kind[m] === 0) {
322
- const x = w.seed[m];
323
- w.vel[m * 3] = w.vel[m * 3] * f + Math.sin(l * 1.7 + x) * 0.9 * a, w.vel[m * 3 + 1] = w.vel[m * 3 + 1] * f + (0.25 + Math.sin(l * 2.3 + x * 1.3) * 0.5) * a, w.vel[m * 3 + 2] = w.vel[m * 3 + 2] * f + Math.cos(l * 1.5 + x * 0.7) * 0.9 * a, w.pos[m * 3] += w.vel[m * 3] * a, w.pos[m * 3 + 1] += w.vel[m * 3 + 1] * a, w.pos[m * 3 + 2] += w.vel[m * 3 + 2] * a, h[m] = Math.min(1, p * 8) * (1 - p) * (1 - p) * 1.3;
324
- } else h[m] = (1 - p) * (1 - p);
325
- }
326
- r.getAttribute("position").needsUpdate = !0, r.getAttribute("aColor").needsUpdate = !0, r.getAttribute("aSize").needsUpdate = !0, r.getAttribute("aSeed").needsUpdate = !0, g.needsUpdate = !0;
327
- }), /* @__PURE__ */ c("points", { geometry: r, material: s, frustumCulled: !1 });
328
- }
329
- const se = 700, P = {
330
- pos: new Float32Array(se * 3),
331
- vel: new Float32Array(se * 3),
332
- col: new Float32Array(se * 3),
333
- size: new Float32Array(se),
334
- life: new Float32Array(se),
335
- max: new Float32Array(se),
336
- seed: new Float32Array(se),
337
- next: 0
338
- };
339
- function Go(e, o, t, r, s) {
340
- I && (o = Math.ceil(o * 0.5));
341
- for (let i = 0; i < o; i++) {
342
- const a = P.next;
343
- P.next = (P.next + 1) % se;
344
- const l = Math.random() * Math.PI * 2, g = r * Math.sqrt(Math.random());
345
- P.pos[a * 3] = e.x + Math.cos(l) * g, P.pos[a * 3 + 1] = e.y + (Math.random() - 0.5) * r * 1.4, P.pos[a * 3 + 2] = e.z + Math.sin(l) * g, P.vel[a * 3] = Math.cos(l) * 0.4, P.vel[a * 3 + 1] = -0.2 - Math.random() * 0.4, P.vel[a * 3 + 2] = Math.sin(l) * 0.4;
346
- const h = 0.55 + Math.random() * 0.45;
347
- P.col[a * 3] = t.r * h, P.col[a * 3 + 1] = t.g * h, P.col[a * 3 + 2] = t.b * h, P.size[a] = s * (0.7 + Math.random() * 0.6), P.max[a] = P.life[a] = 3 + Math.random() * 1.2, P.seed[a] = Math.random() * 100;
348
- }
349
- }
350
- const Vo = (
351
- /* glsl */
352
- `
353
- attribute float aSize; attribute vec3 aColor; attribute float aAlpha; attribute float aSeed;
354
- uniform float uScale; uniform float uTime; varying vec3 vC; varying float vRot;
355
- void main(){
356
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
357
- vC = aColor * aAlpha;
358
- vRot = aSeed * 3.0 + uTime * (1.2 + fract(aSeed) * 2.0);
359
- gl_PointSize = aSize * uScale / -mv.z;
360
- gl_Position = projectionMatrix * mv;
361
- }`
362
- ), Do = (
363
- /* glsl */
364
- `
365
- varying vec3 vC; varying float vRot;
366
- void main(){
367
- vec2 p = gl_PointCoord - 0.5;
368
- float c = cos(vRot), s = sin(vRot);
369
- p = vec2(c * p.x - s * p.y, s * p.x + c * p.y);
370
- // almond leaf with a slightly flipped (tumbling) width
371
- float w = 0.18 + 0.1 * abs(sin(vRot * 0.7));
372
- float d = (p.x * p.x) / (w * w) + (p.y * p.y) / 0.2;
373
- if (d > 1.0) discard;
374
- float vein = 1.0 - smoothstep(0.0, 0.03, abs(p.x));
375
- gl_FragColor = vec4(vC * (0.8 + vein * 0.6) * (1.0 - d * 0.5), 1.0);
376
- }`
377
- );
378
- function Eo() {
379
- const { size: e, gl: o, camera: t } = rt(), { geo: r, mat: s } = S(() => {
380
- const i = new n.BufferGeometry();
381
- i.setAttribute("position", new n.BufferAttribute(P.pos, 3).setUsage(n.DynamicDrawUsage)), i.setAttribute("aColor", new n.BufferAttribute(P.col, 3).setUsage(n.DynamicDrawUsage)), i.setAttribute("aSize", new n.BufferAttribute(P.size, 1).setUsage(n.DynamicDrawUsage)), i.setAttribute("aSeed", new n.BufferAttribute(P.seed, 1).setUsage(n.DynamicDrawUsage)), i.setAttribute("aAlpha", new n.BufferAttribute(new Float32Array(se), 1).setUsage(n.DynamicDrawUsage)), i.boundingSphere = new n.Sphere(new n.Vector3(), 1e4);
382
- const a = new n.ShaderMaterial({ uniforms: { uScale: { value: 400 }, uTime: { value: 0 } }, vertexShader: Vo, fragmentShader: Do, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending });
383
- return { geo: i, mat: a };
384
- }, []);
385
- return Z(({ clock: i }, a) => {
386
- a = Math.min(a, 0.05);
387
- const l = i.elapsedTime;
388
- s.uniforms.uScale.value = St(e, o, t), s.uniforms.uTime.value = I ? 0 : l;
389
- const g = r.getAttribute("aAlpha"), h = g.array;
390
- for (let f = 0; f < se; f++) {
391
- if (P.life[f] <= 0) {
392
- h[f] = 0;
393
- continue;
394
- }
395
- P.life[f] -= a;
396
- const m = 1 - P.life[f] / P.max[f], p = P.seed[f], x = P.pos[f * 3 + 1];
397
- x > 0.04 && (P.vel[f * 3] += Math.sin(l * 2.2 + p) * 1.6 * a - P.vel[f * 3] * 0.8 * a, P.vel[f * 3 + 2] += Math.cos(l * 1.9 + p * 1.7) * 1.6 * a - P.vel[f * 3 + 2] * 0.8 * a, P.vel[f * 3 + 1] += (-0.9 - P.vel[f * 3 + 1]) * 1.5 * a, P.pos[f * 3] += P.vel[f * 3] * a, P.pos[f * 3 + 1] = Math.max(0.04, x + P.vel[f * 3 + 1] * a), P.pos[f * 3 + 2] += P.vel[f * 3 + 2] * a), h[f] = Math.min(1, m * 10) * (1 - m * m) * 0.9;
398
- }
399
- r.getAttribute("position").needsUpdate = !0, r.getAttribute("aColor").needsUpdate = !0, r.getAttribute("aSize").needsUpdate = !0, r.getAttribute("aSeed").needsUpdate = !0, g.needsUpdate = !0;
400
- }), /* @__PURE__ */ c("points", { geometry: r, material: s, frustumCulled: !1 });
401
- }
402
- const Uo = (
403
- /* glsl */
404
- `
405
- attribute float aSeed; uniform float uScale; uniform float uTime; varying float vA;
406
- void main(){
407
- float s = aSeed;
408
- vec3 p = position + vec3(sin(uTime * 0.21 + s) * 1.6, sin(uTime * 0.33 + s * 2.1) * 0.5, cos(uTime * 0.17 + s * 1.3) * 1.6);
409
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
410
- float blink = pow(max(0.0, sin(uTime * (0.5 + fract(s) * 0.7) + s * 9.0)), 6.0);
411
- vA = 0.08 + blink * 0.9;
412
- gl_PointSize = (0.22 + blink * 0.18) * uScale / -mv.z;
413
- gl_Position = projectionMatrix * mv;
414
- }`
415
- ), Lo = (
416
- /* glsl */
417
- `
418
- uniform vec3 uColor; varying float vA;
419
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
420
- gl_FragColor = vec4(uColor * vA * (smoothstep(0.4, 0.0, r) * 1.4 + pow(1.0 - r, 2.5) * 0.5), 1.0); }`
421
- );
422
- function Oo({ count: e = 170 }) {
423
- const { size: o, gl: t, camera: r } = rt(), { geo: s, mat: i } = S(() => {
424
- const a = new Float32Array(e * 3), l = new Float32Array(e);
425
- let g = 11;
426
- const h = () => (g = g * 16807 % 2147483647) / 2147483647;
427
- for (let p = 0; p < e; p++) {
428
- const x = h() * Math.PI * 2, R = 6 + Math.sqrt(h()) * 22;
429
- a.set([Math.cos(x) * R, 0.6 + h() * 5.5, Math.sin(x) * R], p * 3), l[p] = h() * 100;
430
- }
431
- const f = new n.BufferGeometry();
432
- f.setAttribute("position", new n.BufferAttribute(a, 3)), f.setAttribute("aSeed", new n.BufferAttribute(l, 1)), f.boundingSphere = new n.Sphere(new n.Vector3(), 1e4);
433
- const m = new n.ShaderMaterial({
434
- uniforms: { uScale: { value: 400 }, uTime: { value: 0 }, uColor: { value: new n.Color("#c8ff9e") } },
435
- vertexShader: Uo,
436
- fragmentShader: Lo,
437
- transparent: !0,
438
- depthWrite: !1,
439
- blending: n.AdditiveBlending
440
- });
441
- return { geo: f, mat: m };
442
- }, [e]);
443
- return Z(({ clock: a }) => {
444
- i.uniforms.uScale.value = St(o, t, r), i.uniforms.uTime.value = I ? 20 : a.elapsedTime;
445
- }), /* @__PURE__ */ c("points", { geometry: s, material: i, frustumCulled: !1 });
446
- }
447
- const dt = new n.CylinderGeometry(0.15, 0.24, 1, 10).translate(0, 0.5, 0), ko = new n.SphereGeometry(1, 22, 10, 0, Math.PI * 2, 0, Math.PI / 2), Io = new n.CircleGeometry(1, 22).rotateX(Math.PI / 2), No = new n.ConeGeometry(1, 1, 18, 1, !0).translate(0, 0.5, 0), Wo = new n.CylinderGeometry(1, 1, 0.12, 20, 1, !1, 0, Math.PI), Tt = new n.SphereGeometry(1, 20, 14);
448
- function be(e, o, t, r, s) {
449
- s.push({ geo: dt, cap: !1, pos: [e, 0, o], scale: [r * 0.75, t, r * 0.75] }), s.push({ geo: ko, cap: !0, pos: [e, t, o], scale: [r, r * 0.62, r] }), s.push({ geo: Io, cap: !0, pos: [e, t + 0.01, o], scale: [r * 0.96, 1, r * 0.96] });
450
- }
451
- function qo(e) {
452
- const o = [];
453
- switch (e) {
454
- case "db":
455
- o.push({ geo: dt, cap: !1, pos: [0, 0, 0], scale: [0.5, 1, 0.5] }), o.push({ geo: No, cap: !0, pos: [0, 0.72, 0], scale: [0.44, 0.95, 0.44] });
456
- break;
457
- case "warehouse":
458
- o.push({ geo: dt, cap: !1, pos: [0, 0, 0], scale: [1.6, 1.3, 1.6] });
459
- for (let t = 0; t < 3; t++) o.push({ geo: Wo, cap: !0, pos: [0, 0.35 + t * 0.38, 0.12], scale: [0.85 - t * 0.15, 1, 0.65 - t * 0.1] });
460
- break;
461
- case "spark":
462
- for (let t = 0; t < 6; t++) {
463
- const r = t / 6 * Math.PI * 2;
464
- be(Math.cos(r) * 0.45, Math.sin(r) * 0.45, 0.35 + t % 3 * 0.18, 0.2 + t % 2 * 0.06, o);
465
- }
466
- be(0, 0, 0.75, 0.32, o);
467
- break;
468
- case "api":
469
- for (let t = 0; t < 7; t++) {
470
- const r = t / 7 * Math.PI * 2;
471
- be(Math.cos(r) * 0.7, Math.sin(r) * 0.7, 0.3 + t % 2 * 0.12, 0.17, o);
472
- }
473
- break;
474
- case "storage":
475
- o.push({ geo: Tt, cap: !0, pos: [0, 0.42, 0], scale: [0.5, 0.42, 0.5] }), o.push({ geo: Tt, cap: !0, pos: [0.55, 0.24, 0.2], scale: [0.28, 0.24, 0.28] });
476
- break;
477
- case "queue":
478
- for (let t = 0; t < 3; t++) be((t - 1) * 0.55, 0, 0.35 + t * 0.2, 0.22 + t * 0.05, o);
479
- break;
480
- }
481
- return o;
482
- }
483
- const Xo = (() => {
484
- const e = [];
485
- return be(0, 0, 1.7, 1.2, e), be(0.95, 0.55, 0.7, 0.42, e), be(-0.8, 0.7, 0.5, 0.3, e), e;
486
- })();
487
- function Nt({ parts: e, cap: o, stem: t }) {
488
- return /* @__PURE__ */ c(ce, { children: e.map((r, s) => /* @__PURE__ */ c("mesh", { geometry: r.geo, material: r.cap ? o : t, position: r.pos, scale: r.scale, rotation: r.rot }, s)) });
489
- }
490
- function jo({ mcp: e, backend: o }) {
491
- const t = e.srv, r = o.res, s = o.k, i = S(() => qo(r.kind), [r.kind]), a = S(() => new n.Color(t.color).lerp(te, 0.25).lerp(ie, 0.15), [t.color]), l = S(
492
- () => ({ edge: Et(a, 0.04, 1), arrow: de(a), cap: de(a), stem: de(a), halo: Ae(a), pool: Ue(a) }),
493
- [a]
494
- ), g = _(null), h = _(null), f = _(null), m = _(null), p = _(null), x = _("");
495
- return Z(({ clock: R }) => {
496
- var L, G;
497
- const M = l.edge.uniforms;
498
- M.uP0.value.set(e.pos.x, 0.05, e.pos.z), M.uP2.value.set(o.pos.x, 0.05, o.pos.z), yt(M.uP0.value, M.uP2.value, 0.18 * (s % 2 ? 1 : -1), 0.05, M.uP1.value), (L = g.current) == null || L.position.copy(o.pos);
499
- const y = performance.now(), u = r.inflight > 0, U = Math.exp(-((y - r.activeAt) / 1e3) * 1.5), N = u && !I ? 0.5 + 0.5 * Math.sin(R.elapsedTime * 5) : u ? 0.5 : 0, j = u ? 1.5 + N * 0.9 : 0.16 + U * 0.9;
500
- l.cap.color.copy(a).multiplyScalar(j * 0.5), l.stem.color.copy(a).multiplyScalar(j * 0.16), l.halo.color.copy(a).multiplyScalar(u ? 0.35 + N * 0.2 : 0.03 + U * 0.2), l.pool.color.copy(a).multiplyScalar(u ? 0.32 : 0.06 + U * 0.2), (G = f.current) == null || G.scale.setScalar(u ? 3.6 + N * 0.6 : 2.2 + U), h.current && h.current.scale.setScalar(u ? 1.12 + N * 0.06 : 1 + U * 0.08);
501
- let D = r.name, v = null;
502
- for (const V of J.mcpCalls) V.server === t.name && V.resource === r.name && (!v || V.start > v.start) && (v = V);
503
- if (u) {
504
- let V = "";
505
- for (const F of J.mcpPending.values()) F.server === t.name && F.resource === r.name && (V = F.tool);
506
- D = `${r.name} ▶ ${V || "query"}()`;
507
- } else v && v.phase === "result" && y - v.start < 1800 && (D = `${r.name} ✓ returned`);
508
- p.current && (D !== x.current && (p.current.setText(D), x.current = D), p.current.setOpacity(u ? 1 : 0.55 + U * 0.45), p.current.setEmphasis(u));
509
- const d = l.edge.uniforms;
510
- d.uTime.value = I ? 0 : R.elapsedTime;
511
- const C = v && v.phase === "result" ? (y - v.start) / v.dur : 9, T = m.current;
512
- C < 1 ? (d.uRadius.value = 0.07, d.uOpacity.value = 0.9 * (1 - C * 0.6), d.uFlow.value = 0, d.uHead.value = 1 - at(C), d.uTail.value = 0.2, d.uHeadColor.value.copy(a).multiplyScalar(3), T && (T.visible = !0, ft(T, d.uP0.value, d.uP1.value, d.uP2.value, 0.14, -1, 0.5), l.arrow.color.copy(a).multiplyScalar(2 * (1 - C * 0.7)))) : u ? (d.uRadius.value = 0.04, d.uOpacity.value = 0.55, d.uFlow.value = 1, d.uHead.value = -1, T && (T.visible = !0, ft(T, d.uP0.value, d.uP1.value, d.uP2.value, 0.82, 1, 0.42), l.arrow.color.copy(a).multiplyScalar(1.2))) : (d.uRadius.value = 0.035, d.uOpacity.value = 0.14 + U * 0.4, d.uFlow.value = 0, d.uHead.value = -1, T && (T.visible = !1));
513
- }), /* @__PURE__ */ H(ce, { children: [
514
- /* @__PURE__ */ c("mesh", { geometry: Dt, material: l.edge, frustumCulled: !1 }),
515
- /* @__PURE__ */ c("mesh", { ref: m, geometry: wt, material: l.arrow, visible: !1 }),
516
- /* @__PURE__ */ H("group", { ref: g, children: [
517
- /* @__PURE__ */ c("mesh", { geometry: Le, material: l.pool, position: [0, 0.02, 0], scale: 3.2 }),
518
- /* @__PURE__ */ c("sprite", { ref: f, material: l.halo, position: [0, 0.8, 0] }),
519
- /* @__PURE__ */ c("group", { ref: h, children: /* @__PURE__ */ c(Nt, { parts: i, cap: l.cap, stem: l.stem }) }),
520
- /* @__PURE__ */ c(Ee, { ref: p, position: [0, -0.35, 0], offset: [0, -0.32], text: r.name, color: t.color, size: 0.22, opacity: 0.55, pxRange: [7.5, 11.5] })
521
- ] })
522
- ] });
523
- }
524
- function Ko({ mcp: e }) {
525
- const o = e.srv, t = S(() => new n.Color(o.color).lerp(te, 0.2), [o.color]), r = S(() => ({ cap: de(t), stem: de(t), halo: Ae(t), pool: Ue(t) }), [t]), s = _(null), i = _(null), a = _(null);
526
- return Z(({ clock: l }) => {
527
- var x, R;
528
- (x = a.current) == null || x.position.copy(e.pos);
529
- const g = performance.now(), h = o.inflight > 0, f = Math.exp(-((g - o.activeAt) / 1e3) * 1.5), m = h && !I ? 0.5 + 0.5 * Math.sin(l.elapsedTime * 3) : 0, p = (h ? 0.8 + m * 0.3 : 0.3) + f * 0.45;
530
- r.cap.color.copy(t).multiplyScalar(p * 0.55), r.stem.color.copy(t).multiplyScalar(p * 0.18), r.halo.color.copy(t).multiplyScalar(h ? 0.3 : 0.1 + f * 0.15), r.pool.color.copy(t).multiplyScalar(h ? 0.3 : 0.1 + f * 0.15), (R = s.current) == null || R.scale.setScalar(5.5 + (h ? m * 0.8 : 0)), i.current && i.current.scale.setScalar(1 + f * 0.05 + m * 0.03);
531
- }), /* @__PURE__ */ H("group", { ref: a, children: [
532
- /* @__PURE__ */ c("mesh", { geometry: Le, material: r.pool, position: [0, 0.02, 0], scale: 6 }),
533
- /* @__PURE__ */ c("sprite", { ref: s, material: r.halo, position: [0, 1.6, 0] }),
534
- /* @__PURE__ */ c("group", { ref: i, children: /* @__PURE__ */ c(Nt, { parts: Xo, cap: r.cap, stem: r.stem }) }),
535
- /* @__PURE__ */ c(Ee, { position: [0, 2.95, 0], text: `MCP · ${o.name}`, color: o.color, size: 0.3, pxRange: [9, 13] })
536
- ] });
537
- }
538
- const He = 28, Pe = 44, Ve = 3;
539
- function Ho() {
540
- const e = S(() => {
541
- const s = new n.BufferGeometry();
542
- return s.setAttribute("position", new n.BufferAttribute(new Float32Array(He * Ve * Pe * 2 * 3), 3)), s.setAttribute("color", new n.BufferAttribute(new Float32Array(He * Ve * Pe * 2 * 3), 3)), s.boundingSphere = new n.Sphere(new n.Vector3(), 1e4), s;
543
- }, []), o = S(() => new n.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }), []), t = S(() => new ot(He), []), r = S(() => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), p: new n.Vector3(), col: new n.Color(), k: new n.Color() }), []);
544
- return Z(({ clock: s }) => {
545
- const i = performance.now(), a = I ? 0 : s.elapsedTime, l = e.getAttribute("position"), g = e.getAttribute("color");
546
- let h = 0;
547
- t.begin();
548
- const f = (p, x, R, M, y) => {
549
- if (h >= He) return;
550
- const u = Gt(p), U = J.mcpServers.get(x), N = oo(x);
551
- if (!u || !U || !N) return;
552
- const { a: j, b: D, c: v, p: d, col: C, k: T } = r;
553
- j.set(u.x, 0.07, u.z), D.set(N.x, 0.07, N.z), yt(j, D, 0.16 * (y % 2 ? 1 : -1), 0.07, v), C.set(U.color).lerp(te, 0.3);
554
- let L;
555
- R === 0 ? (C.lerp(tt, le(M / 1.2)), M > 1.2 && C.lerp(Vt, le((M - 1.2) / 1)), L = (0.3 + Math.min(0.6, M * 0.25)) * De(M / 0.3)) : (T.copy(C).lerp(ie, 0.35), L = 1.3 * (M < 0.75 ? 1 : 1 - (M - 0.75) / 0.25));
556
- const G = 1 - at(M / 0.75), V = R === 0 ? De(M / 0.45) : 1;
557
- for (let F = 0; F < Ve; F++)
558
- for (let K = 0; K < Pe; K++)
559
- for (let W = 0; W < 2; W++) {
560
- const O = (K + W) / Pe;
561
- xe(j, v, D, O, d);
562
- const q = Math.sin(O * Math.PI) * (0.1 + F * 0.06) * Math.sin(O * (17 + F * 6) + F * 2.1 + y), A = ((h * Ve + F) * Pe + K) * 2 + W;
563
- l.setXYZ(A, d.x + q, d.y + Math.abs(q) * 0.3, d.z - q);
564
- let z;
565
- if (R === 0) {
566
- const $ = Math.pow(Math.max(0, Math.sin(O * 22 - a * 2.4)), 8);
567
- z = O > V ? 0 : L * (0.3 + $ * 1.5) * (F === 0 ? 1 : 0.35);
568
- } else z = L * (0.25 + Math.exp(-(((O - G) / 0.07) ** 2)) * 3 * (M < 0.8 ? 1 : 0)) * (F === 0 ? 1 : 0.6);
569
- const E = R === 0 ? C : T;
570
- g.setXYZ(A, E.r * z, E.g * z, E.b * z);
571
- }
572
- R === 0 ? V > 0.9 && t.add(j, v, D, 0.9, 1, 0.5, C, 0.4 + L * 1.4) : (t.add(j, v, D, 0.08, -1, 0.66, T, L * 1.6), M < 0.75 && (xe(j, v, D, G, d), d.y += 0.12, It(d, T, 0.45, 0.4))), h++;
573
- };
574
- let m = 0;
575
- for (const p of J.mcpPending.values()) f(p.instance, p.server, 0, to(p, i), m++);
576
- for (const p of J.mcpCalls) p.phase === "result" && f(p.instance, p.server, 1, le((i - p.start) / p.dur), p.id);
577
- e.setDrawRange(0, h * Ve * Pe * 2), l.needsUpdate = !0, g.needsUpdate = !0, t.end();
578
- }), /* @__PURE__ */ H(ce, { children: [
579
- /* @__PURE__ */ c("lineSegments", { geometry: e, material: o, frustumCulled: !1 }),
580
- /* @__PURE__ */ c("primitive", { object: t.mesh })
581
- ] });
582
- }
583
- const $o = (
584
- /* glsl */
585
- `
586
- attribute float aPhase; uniform float uTime; varying float vK; varying float vD;
587
- void main(){
588
- vec4 mv = modelViewMatrix * vec4(position, 1.0);
589
- vK = pow(max(0.0, sin(aPhase * 0.9 - uTime * 0.8)), 12.0);
590
- vD = -mv.z;
591
- gl_Position = projectionMatrix * mv;
592
- }`
593
- ), Yo = (
594
- /* glsl */
595
- `
596
- uniform vec3 uColor; varying float vK; varying float vD;
597
- void main(){ float fade = 1.0 - smoothstep(30.0, 60.0, vD); gl_FragColor = vec4(uColor * (0.07 + vK * 0.7) * fade, 1.0); }`
598
- );
599
- function Zo() {
600
- const { geo: e, mat: o } = S(() => {
601
- let t = 3;
602
- const r = () => (t = t * 16807 % 2147483647) / 2147483647, s = [], i = [], a = (h, f, m, p, x, R) => {
603
- let M = x;
604
- for (let y = 0; y < p; y++) {
605
- m += (r() - 0.5) * 0.7;
606
- const u = h + Math.cos(m) * 0.55, U = f + Math.sin(m) * 0.55;
607
- s.push(h, 0.035, f, u, 0.035, U), i.push(M, M + 0.55), M += 0.55, h = u, f = U, R < 3 && r() < 0.09 && a(h, f, m + (r() < 0.5 ? 0.9 : -0.9), Math.floor(p * 0.5), M, R + 1);
608
- }
609
- };
610
- for (let h = 0; h < 30; h++) {
611
- const f = r() * Math.PI * 2, m = 1.5 + r() * 21;
612
- a(Math.cos(f) * m, Math.sin(f) * m, r() * Math.PI * 2, 18 + Math.floor(r() * 22), r() * 20, 0);
613
- }
614
- const l = new n.BufferGeometry();
615
- l.setAttribute("position", new n.Float32BufferAttribute(s, 3)), l.setAttribute("aPhase", new n.Float32BufferAttribute(i, 1));
616
- const g = new n.ShaderMaterial({ uniforms: { uTime: { value: 0 }, uColor: { value: te.clone().multiplyScalar(0.5) } }, vertexShader: $o, fragmentShader: Yo, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending });
617
- return { geo: l, mat: g };
618
- }, []);
619
- return Z(({ clock: t }) => {
620
- o.uniforms.uTime.value = I ? 0 : t.elapsedTime;
621
- }), /* @__PURE__ */ c("lineSegments", { geometry: e, material: o });
622
- }
623
- function Jo() {
624
- return /* @__PURE__ */ H(ce, { children: [
625
- /* @__PURE__ */ c(Zo, {}),
626
- /* @__PURE__ */ c(Ho, {})
627
- ] });
628
- }
629
- const ze = 4.4, ht = ze + 1.35, Qo = ht + 0.9;
630
- function en(e, o, t) {
631
- const r = ze * 0.9 * Math.sqrt((e + 0.6) / o), s = e * 2.39996323;
632
- return t.set(Math.cos(s) * r, 0.08, Math.sin(s) * r);
633
- }
634
- const tn = 64, on = 180, $e = 40, Te = 18, Se = 12, Ye = 3, Me = 11, nn = (
635
- /* glsl */
636
- `
637
- varying vec2 vP;
638
- // pond-local ground coords: the disc is rotated -90deg about X, local (x, y) -> (x, 0, -y)
639
- void main(){ vP = vec2(position.x, -position.y); gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }`
640
- ), rn = (
641
- /* glsl */
642
- `
643
- uniform float uTime; uniform float uR;
644
- uniform vec4 uRip[${Se}]; uniform vec3 uRipC[${Se}];
645
- varying vec2 vP;
646
- void main(){
647
- float r = length(vP) / uR;
648
- vec3 deep = vec3(0.004, 0.026, 0.032);
649
- vec3 shallow = vec3(0.01, 0.055, 0.062);
650
- vec3 col = mix(deep, shallow, smoothstep(0.35, 1.0, r));
651
- // gentle swell bands
652
- float sw = sin(vP.x * 1.7 + uTime * 0.5) * sin(vP.y * 1.3 - uTime * 0.4);
653
- col += vec3(0.015, 0.045, 0.045) * sw * 0.4;
654
- // broken moon path on the water (toward the camera)
655
- float lane = exp(-pow((vP.x + 1.1 + sin(vP.y * 3.0 + uTime) * 0.12) / 0.55, 2.0));
656
- float glint = pow(max(0.0, sin(vP.y * 9.0 + uTime * 1.3 + sin(vP.x * 4.0) * 1.5)), 6.0);
657
- col += vec3(0.55, 0.85, 0.8) * lane * (0.05 + glint * 0.32) * smoothstep(-0.2, 1.0, vP.y / uR + 0.4);
658
- // luminous shore
659
- col += vec3(0.25, 0.85, 0.75) * smoothstep(0.88, 1.0, r) * 0.22;
660
- // ripples
661
- for (int i = 0; i < ${Se}; i++) {
662
- vec4 q = uRip[i];
663
- if (q.z < 0.0 || q.z > 1.0) continue;
664
- float d = length(vP - q.xy);
665
- float ring = q.z * (1.2 + q.w * 2.2);
666
- float k = exp(-pow((d - ring) / (0.07 + q.z * 0.08), 2.0)) * (1.0 - q.z) * (1.0 - q.z);
667
- col += uRipC[i] * k * (1.0 + q.w * 1.2);
668
- }
669
- float edge = 1.0 - smoothstep(0.985, 1.0, r);
670
- gl_FragColor = vec4(col, edge);
671
- }`
672
- ), an = (
673
- /* glsl */
674
- `
675
- attribute float aSize; attribute vec3 aColor; uniform float uScale; uniform float uTime; varying vec3 vC;
676
- void main(){
677
- vec3 p = position; p.y += sin(uTime * 0.9 + position.x * 2.1 + position.z * 1.7) * 0.03;
678
- vec4 mv = modelViewMatrix * vec4(p, 1.0);
679
- gl_PointSize = aSize * uScale / -mv.z; vC = aColor; gl_Position = projectionMatrix * mv; }`
680
- ), sn = (
681
- /* glsl */
682
- `
683
- varying vec3 vC;
684
- void main(){ float r = length(gl_PointCoord - 0.5) * 2.0; if (r > 1.0) discard;
685
- float core = smoothstep(0.45, 0.0, r); float halo = pow(1.0 - r, 2.2);
686
- gl_FragColor = vec4(vC * (core * 1.25 + halo * 0.45), 1.0); }`
687
- );
688
- function ln({ galaxy: e }) {
689
- const [o, t] = et("center"), r = S(() => ({ nodes: e.nodes.slice(0, on), links: e.links }), [e]), s = r.nodes.length, { size: i, gl: a, camera: l } = rt(), g = _([]), h = _([]), f = _(Array(Ye).fill("")), m = _([]), p = S(() => {
690
- const v = new Float32Array(s * 3), d = new n.Vector3();
691
- for (let A = 0; A < s; A++) v.set(en(A, s, d).toArray(), A * 3);
692
- const C = r.nodes.map((A) => new n.Color(no[A.kind] ?? "#94a3b8").lerp(te, 0.45).multiplyScalar(0.5)), T = new n.BufferGeometry();
693
- T.setAttribute("position", new n.BufferAttribute(v, 3)), T.setAttribute("aSize", new n.BufferAttribute(new Float32Array(s), 1)), T.setAttribute("aColor", new n.BufferAttribute(new Float32Array(s * 3), 3)), T.boundingSphere = new n.Sphere(new n.Vector3(), 1e4);
694
- const L = new Map(r.nodes.map((A, z) => [A.id, z])), G = [], V = [], F = (A, z) => (v[A * 3] - v[z * 3]) ** 2 + (v[A * 3 + 2] - v[z * 3 + 2]) ** 2;
695
- for (const A of r.links) {
696
- const z = L.get(A.source), E = L.get(A.target);
697
- z !== void 0 && E !== void 0 && z !== E && F(z, E) < 4.5 && (G.push(z, E), V.push(1));
698
- }
699
- for (let A = 0; A < s; A++) {
700
- let z = -1, E = 1e9;
701
- for (let $ = 0; $ < s; $++) $ !== A && F(A, $) < E && (E = F(A, $), z = $);
702
- z > A && (G.push(A, z), V.push(0));
703
- }
704
- const K = V.length, W = new Float32Array(K * 2 * 3);
705
- for (let A = 0; A < K; A++)
706
- for (let z = 0; z < 2; z++) {
707
- const E = G[A * 2 + z];
708
- W.set([v[E * 3], 0.05, v[E * 3 + 2]], (A * 2 + z) * 3);
709
- }
710
- const O = new n.BufferGeometry();
711
- O.setAttribute("position", new n.BufferAttribute(W, 3)), O.setAttribute("color", new n.BufferAttribute(new Float32Array(K * 2 * 3), 3));
712
- const q = new n.BufferGeometry();
713
- return q.setAttribute("position", new n.BufferAttribute(new Float32Array($e * Te * 2 * 3), 3)), q.setAttribute("color", new n.BufferAttribute(new Float32Array($e * Te * 2 * 3), 3)), q.boundingSphere = new n.Sphere(new n.Vector3(), 1e4), { pos: v, base: C, ngeo: T, lgeo: O, pairs: G, strong: V, np: K, bgeo: q, fire: new Float32Array(s), white: new Float32Array(s), fireC: Array.from({ length: s }, () => new n.Color()) };
714
- }, [r, s]), x = S(() => {
715
- const v = [];
716
- for (let d = 0; d < Me; d++) {
717
- const C = d / Me * Math.PI * 2 + 0.2;
718
- v.push({ a: C, x: Math.cos(C) * ht, z: Math.sin(C) * ht, h: 0.7 + Re(`stone${d}`, 1) * 0.6, rot: Re(`stone${d}`, 2) * 3, tilt: (Re(`stone${d}`, 3) - 0.5) * 0.18 });
719
- }
720
- return v;
721
- }, []), R = S(() => new Float32Array(Me), []), M = S(() => new n.DodecahedronGeometry(1, 0), []), y = S(
722
- () => ({
723
- water: new n.ShaderMaterial({
724
- uniforms: {
725
- uTime: { value: 0 },
726
- uR: { value: ze },
727
- uRip: { value: Array.from({ length: Se }, () => new n.Vector4(0, 0, -1, 0)) },
728
- uRipC: { value: Array.from({ length: Se }, () => new n.Color()) }
729
- },
730
- vertexShader: nn,
731
- fragmentShader: rn,
732
- transparent: !0,
733
- depthWrite: !1
734
- }),
735
- nodes: new n.ShaderMaterial({ uniforms: { uScale: { value: 400 }, uTime: { value: 0 } }, vertexShader: an, fragmentShader: sn, transparent: !0, depthWrite: !1, blending: n.AdditiveBlending }),
736
- threads: new n.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
737
- beam: new n.LineBasicMaterial({ vertexColors: !0, transparent: !0, blending: n.AdditiveBlending, depthWrite: !1, toneMapped: !1 }),
738
- stone: new n.MeshStandardMaterial({ color: "#1a2c2c", roughness: 0.92, metalness: 0, flatShading: !0 }),
739
- rune: Ae(te)
740
- }),
741
- []
742
- ), u = S(() => x.map(() => Ae(te)), [x]), U = S(() => /* @__PURE__ */ new Map(), []), N = S(() => new ot($e), []), j = S(() => ({ v: new n.Vector3(), v2: new n.Vector3(), mid: new n.Vector3(), sp: new n.Vector3(), c: new n.Color(), c2: new n.Color() }), []), D = (v) => {
743
- let d = U.get(v);
744
- return d === void 0 && U.set(v, d = so(r, v)), d;
745
- };
746
- return Z(({ clock: v }, d) => {
747
- const C = me.graph.out.x < -0.5 ? "left" : "center";
748
- C !== o && t(C);
749
- const T = performance.now(), L = I ? 0 : v.elapsedTime, { pos: G, base: V, fire: F, white: K, fireC: W } = p, O = Math.max(0.05, me.graph.scale);
750
- y.nodes.uniforms.uScale.value = i.height * a.getPixelRatio() / (2 * Math.tan(l.fov * Math.PI / 360)) * O, y.nodes.uniforms.uTime.value = L, y.water.uniforms.uTime.value = L, F.fill(0), K.fill(0);
751
- for (let b = 0; b < Me; b++) R[b] *= Math.exp(-d * 1.4);
752
- const { v: q, v2: A, mid: z, c: E, c2: $ } = j, Fe = p.bgeo.getAttribute("position"), Be = p.bgeo.getAttribute("color"), Oe = y.water.uniforms.uRip.value, ke = y.water.uniforms.uRipC.value;
753
- let ge = 0, ue = 0;
754
- N.begin();
755
- const Ce = J.flares;
756
- for (let b = Math.max(0, Ce.length - tn); b < Ce.length; b++) {
757
- const B = Ce[b], Y = D(B.node), X = (T - B.start) / 1e3, Ge = J.instances.get(B.instance), fe = Ge ? gt[Ge.type] : te, ee = B.op === "write", re = X < 0.35 ? X / 0.35 : Math.exp(-(X - 0.35) * 1.2);
758
- re > F[Y] && (F[Y] = re, W[Y].copy(ee ? ie : fe), K[Y] = ee ? 1 : 0);
759
- const ve = G[Y * 3], st = G[Y * 3 + 2], At = X / (ee ? 2.2 : 1.4);
760
- if (At < 1 && ue < Se && (Oe[ue].set(ve, st, At, ee ? 1 : 0), ke[ue].copy(ee ? ie : fe).multiplyScalar(ee ? 0.7 : 0.5), ue++), X < 0.05) {
761
- let ye = Math.atan2(st, ve) - 0.2;
762
- ye < 0 && (ye += Math.PI * 2);
763
- const Ne = Math.round(ye / (Math.PI * 2) * Me) % Me;
764
- R[Ne] = Math.min(1.6, R[Ne] + (ee ? 0.9 : 0.5));
765
- }
766
- const it = pt(B.instance, j.sp), we = it ? ro(it, it) : void 0;
767
- if (we && X < 2.2 && ge < $e) {
768
- q.set(ve, 0.1, st), Ut(we, q, 1.6 / O, z);
769
- const ye = Math.min(1, X / 0.3) * (1 - X / 2.2) ** 1.5, Ne = ee ? Math.min(1, X * 0.85) : 1 - Math.min(1, X * 0.85);
770
- for (let We = 0; We < Te; We++)
771
- for (let qe = 0; qe < 2; qe++) {
772
- const ne = (We + qe) / Te, pe = 1 - ne;
773
- A.set(pe * pe * we.x + 2 * pe * ne * z.x + ne * ne * q.x, pe * pe * we.y + 2 * pe * ne * z.y + ne * ne * q.y, pe * pe * we.z + 2 * pe * ne * z.z + ne * ne * q.z);
774
- const xt = (ge * Te + We) * 2 + qe;
775
- Fe.setXYZ(xt, A.x, A.y, A.z);
776
- const qt = Math.exp(-(((ne - Ne) / 0.09) ** 2)) * 1.4;
777
- $.copy(ee ? ie : fe).multiplyScalar(ye * ((ee ? 0.4 : 0.16) + qt) * 0.8), Be.setXYZ(xt, $.r, $.g, $.b);
778
- }
779
- ee ? N.add(we, z, q, 0.9, 1, 0.4, ie, ye * 1.1) : N.add(we, z, q, 0.1, -1, 0.4 / O, fe, ye * 1.3), ge++;
780
- }
781
- }
782
- for (let b = ue; b < Se; b++) Oe[b].z = -1;
783
- p.bgeo.setDrawRange(0, ge * Te * 2), Fe.needsUpdate = !0, Be.needsUpdate = !0, N.end();
784
- const Q = p.ngeo.getAttribute("aSize"), Ie = p.ngeo.getAttribute("aColor");
785
- for (let b = 0; b < s; b++) {
786
- const B = F[b];
787
- Q.setX(b, 0.2 + B * (0.5 + K[b] * 0.25)), E.copy(V[b]), B > 0.01 && Pt(Pt(E, W[b], B * 1.6), ie, B * (0.3 + K[b] * 1.1)), Ie.setXYZ(b, E.r, E.g, E.b);
788
- }
789
- Q.needsUpdate = !0, Ie.needsUpdate = !0;
790
- const _e = p.lgeo.getAttribute("color");
791
- for (let b = 0; b < p.np; b++) {
792
- const B = Math.max(F[p.pairs[b * 2]], F[p.pairs[b * 2 + 1]]), Y = p.strong[b] ? 0.13 : 0.06;
793
- for (let X = 0; X < 2; X++) _e.setXYZ(b * 2 + X, 0.3 * Y + B * 0.25, 0.85 * Y + B * 0.4, 0.75 * Y + B * 0.38);
794
- }
795
- _e.needsUpdate = !0;
796
- for (let b = 0; b < Me; b++) {
797
- const B = m.current[b], Y = R[b];
798
- u[b].color.copy(te).multiplyScalar(0.05 + Math.min(1, Y) * 0.6), B && B.scale.setScalar(0.5 + Math.min(1, Y) * 0.5);
799
- }
800
- let k = 0;
801
- for (let b = J.flares.length - 1; b >= 0 && k < Ye; b--) {
802
- const B = J.flares[b];
803
- if (T - B.start > 2200) break;
804
- let Y = !1;
805
- for (let re = 0; re < k; re++) f.current[re] === B.node && (Y = !0);
806
- if (Y) continue;
807
- const X = D(B.node);
808
- let Ge = !1;
809
- for (let re = 0; re < k; re++) {
810
- const ve = h.current[re];
811
- ve && Math.abs(ve.position.z - G[X * 3 + 2]) * me.graph.scale < 1.1 && Math.abs(ve.position.x - G[X * 3]) * me.graph.scale < 4 && (Ge = !0);
812
- }
813
- if (Ge) continue;
814
- const fe = g.current[k], ee = h.current[k];
815
- fe && ee && (ee.position.set(G[X * 3], 0.5, G[X * 3 + 2]), f.current[k] !== B.node && (fe.setText(`${B.op === "write" ? "wrote" : "read"} · ${B.node}`), fe.setColor(B.op === "write" ? "#ffffff" : "#5eead4")), fe.setOpacity(1)), f.current[k] = B.node, k++;
816
- }
817
- for (let b = k; b < Ye; b++) {
818
- const B = g.current[b];
819
- B == null || B.setOpacity(0), f.current[b] = "";
820
- }
821
- }), /* @__PURE__ */ H(ce, { children: [
822
- /* @__PURE__ */ c("mesh", { rotation: [-Math.PI / 2, 0, 0], position: [0, 0.03, 0], material: y.water, renderOrder: -1, children: /* @__PURE__ */ c("circleGeometry", { args: [ze, 96] }) }),
823
- /* @__PURE__ */ c("lineSegments", { geometry: p.lgeo, material: y.threads, frustumCulled: !1 }),
824
- /* @__PURE__ */ c("points", { geometry: p.ngeo, material: y.nodes, frustumCulled: !1 }),
825
- x.map((v, d) => /* @__PURE__ */ H("group", { position: [v.x, 0, v.z], rotation: [v.tilt, v.rot, v.tilt * 0.6], children: [
826
- /* @__PURE__ */ c("mesh", { geometry: M, material: y.stone, position: [0, v.h * 0.5, 0], scale: [0.34, v.h * 0.6, 0.24] }),
827
- /* @__PURE__ */ c("sprite", { ref: (C) => void (m.current[d] = C), material: u[d], position: [0, v.h * 0.62, 0], scale: 0.5 })
828
- ] }, d)),
829
- /* @__PURE__ */ c("lineSegments", { geometry: p.bgeo, material: y.beam, frustumCulled: !1 }),
830
- /* @__PURE__ */ c("primitive", { object: N.mesh }),
831
- Array.from({ length: Ye }, (v, d) => /* @__PURE__ */ c("group", { ref: (C) => void (h.current[d] = C), children: /* @__PURE__ */ c(Ee, { ref: (C) => void (g.current[d] = C), text: "", offset: [0, 0.36], anchorX: o, size: 0.24, opacity: 0, fadeMs: 250, pxRange: [8, 12] }) }, d)),
832
- /* @__PURE__ */ c(ao, { position: [o === "left" ? -ze : 0, 0.2, ze + 2.2], anchorX: o, suffix: " · pond", color: "#5eead4", size: 0.28, opacity: 0.75, pxRange: [8, 12] })
833
- ] });
834
- }
835
- const cn = 26, zt = () => Math.max(1, (me.core.r + 9) / cn), un = (
836
- /* glsl */
837
- `
838
- varying vec3 vDir;
839
- void main(){ vDir = normalize(position); vec4 p = projectionMatrix * modelViewMatrix * vec4(position, 1.0); gl_Position = p.xyww; }`
840
- ), fn = (
841
- /* glsl */
842
- `
843
- uniform vec3 uMoonDir; varying vec3 vDir;
844
- void main(){
845
- float h = clamp(vDir.y, -0.2, 1.0);
846
- vec3 horizon = vec3(0.035, 0.11, 0.115);
847
- vec3 mid = vec3(0.012, 0.045, 0.055);
848
- vec3 zenith = vec3(0.004, 0.012, 0.02);
849
- vec3 col = mix(horizon, mid, smoothstep(0.0, 0.18, h));
850
- col = mix(col, zenith, smoothstep(0.18, 0.75, h));
851
- float m = max(0.0, dot(normalize(vDir), uMoonDir));
852
- col += vec3(0.35, 0.6, 0.58) * pow(m, 40.0) * 0.35 + vec3(0.1, 0.25, 0.24) * pow(m, 6.0) * 0.12;
853
- gl_FragColor = vec4(col, 1.0);
854
- }`
855
- ), Rt = new n.Vector3(-0.42, 0.42, -0.8).normalize();
856
- let Ze = null;
857
- function pn() {
858
- if (Ze) return Ze;
859
- const e = document.createElement("canvas");
860
- e.width = e.height = 256;
861
- const o = e.getContext("2d"), t = o.createRadialGradient(118, 116, 10, 128, 128, 96);
862
- t.addColorStop(0, "rgba(250,255,250,1)"), t.addColorStop(0.85, "rgba(214,240,232,1)"), t.addColorStop(1, "rgba(190,225,216,1)"), o.fillStyle = t, o.beginPath(), o.arc(128, 128, 96, 0, Math.PI * 2), o.fill(), o.fillStyle = "rgba(150,190,182,0.22)";
863
- for (const [r, s, i] of [[100, 105, 26], [150, 140, 20], [120, 160, 14], [160, 100, 11]])
864
- o.beginPath(), o.arc(r, s, i, 0, Math.PI * 2), o.fill();
865
- return Ze = new n.CanvasTexture(e), Ze;
866
- }
867
- function mn() {
868
- const e = S(() => {
869
- const o = new n.ConeGeometry(1, 1.6, 7).translate(0, 0.8, 0), t = 340, r = new n.InstancedMesh(o, new n.MeshStandardMaterial({ color: "#04110f", roughness: 1, flatShading: !0 }), t * 3), s = new n.Object3D();
870
- let i = 5;
871
- const a = () => (i = i * 16807 % 2147483647) / 2147483647;
872
- let l = 0;
873
- for (let g = 0; g < t; g++) {
874
- const h = a() * Math.PI * 2, f = 30 + Math.pow(a(), 0.7) * 34, m = Math.cos(h) * f, p = Math.sin(h) * f;
875
- if (p > 18 && Math.abs(m) < 26) continue;
876
- const x = 5 + a() * 7, R = x * (0.22 + a() * 0.06);
877
- for (let M = 0; M < 3; M++)
878
- s.position.set(m, x * (0.12 + M * 0.26), p), s.rotation.set(0, a() * 6, 0), s.scale.set(R * (1 - M * 0.25), x / 1.6 * 0.42, R * (1 - M * 0.25)), s.updateMatrix(), r.setMatrixAt(l++, s.matrix);
879
- }
880
- return r.count = l, r.instanceMatrix.needsUpdate = !0, r;
881
- }, []);
882
- return /* @__PURE__ */ c("primitive", { object: e });
883
- }
884
- function dn() {
885
- const e = S(() => {
886
- let r = 17;
887
- const s = () => (r = r * 16807 % 2147483647) / 2147483647;
888
- return Array.from({ length: 16 }, () => {
889
- const i = s() * Math.PI * 2, a = 6 + s() * 22;
890
- return { x: Math.cos(i) * a, z: Math.sin(i) * a, y: 0.5 + s() * 1.4, w: 12 + s() * 12, sp: 0.1 + s() * 0.15, ph: s() * 6 };
891
- });
892
- }, []), o = S(
893
- () => new n.SpriteMaterial({ map: go(), color: new n.Color("#7fd6c6").multiplyScalar(0.55), transparent: !0, opacity: 0.1, depthWrite: !1, fog: !1 }),
894
- []
895
- ), t = _([]);
896
- return Z(({ clock: r }) => {
897
- if (I) return;
898
- const s = r.elapsedTime;
899
- e.forEach((i, a) => {
900
- const l = t.current[a];
901
- l && l.position.set(i.x + Math.sin(s * 0.05 * i.sp * 6 + i.ph) * 3, i.y, i.z + Math.cos(s * 0.04 + i.ph) * 1.5);
902
- });
903
- }), /* @__PURE__ */ c(ce, { children: e.map((r, s) => /* @__PURE__ */ c("sprite", { ref: (i) => void (t.current[s] = i), material: o, position: [r.x, r.y, r.z], scale: [r.w, r.w * 0.32, 1] }, s)) });
904
- }
905
- function hn() {
906
- const e = _(null);
907
- return Z(() => {
908
- var o;
909
- (o = e.current) == null || o.scale.set(zt(), 1, zt());
910
- }), /* @__PURE__ */ H("group", { ref: e, children: [
911
- /* @__PURE__ */ c(mn, {}),
912
- /* @__PURE__ */ c(dn, {})
913
- ] });
914
- }
915
- function gn() {
916
- const e = S(() => Ue(new n.Color(he.moon).lerp(new n.Color("#5eead4"), 0.4).multiplyScalar(0.075)), []), o = _(null);
917
- return Z(() => {
918
- var r;
919
- const t = me.core;
920
- (r = o.current) == null || r.scale.set(t.hw * 2.6 + 9, 1, t.hh * 2.6 + 9);
921
- }), /* @__PURE__ */ c("mesh", { ref: o, geometry: Le, material: e, position: [0, 0.01, 0] });
922
- }
923
- function vn() {
924
- return Z(({ scene: e, camera: o }) => {
925
- const t = e.fog;
926
- if (!t || !("density" in t)) return;
927
- const r = Qe.cam.dist || o.position.length();
928
- t.density = 0.016 * Math.min(1, 36 / Math.max(1, r));
929
- }), null;
930
- }
931
- function wn() {
932
- const e = S(
933
- () => new n.ShaderMaterial({ uniforms: { uMoonDir: { value: Rt } }, vertexShader: un, fragmentShader: fn, side: n.BackSide, depthWrite: !1, fog: !1 }),
934
- []
935
- ), o = S(() => new n.SpriteMaterial({ map: pn(), color: new n.Color(1.1, 1.15, 1.12), fog: !1, depthWrite: !1, transparent: !0, toneMapped: !1 }), []), t = S(() => new n.SpriteMaterial({ map: vt(), color: new n.Color(he.moon).multiplyScalar(0.22), fog: !1, blending: n.AdditiveBlending, depthWrite: !1, transparent: !0 }), []), r = S(() => Rt.clone().multiplyScalar(140), []);
936
- return /* @__PURE__ */ H(ce, { children: [
937
- /* @__PURE__ */ c("mesh", { material: e, renderOrder: -10, frustumCulled: !1, children: /* @__PURE__ */ c("sphereGeometry", { args: [180, 32, 16] }) }),
938
- /* @__PURE__ */ c(po, { radius: 150, depth: 20, count: I ? 700 : 1400, factor: 3.2, saturation: 0.1, fade: !0, speed: I ? 0 : 0.3 }),
939
- /* @__PURE__ */ c("sprite", { material: t, position: r, scale: 70 }),
940
- /* @__PURE__ */ c("sprite", { material: o, position: r, scale: 11 }),
941
- /* @__PURE__ */ c("hemisphereLight", { args: ["#2a6b66", "#020807", 0.55] }),
942
- /* @__PURE__ */ c("directionalLight", { position: [-30, 40, -60], intensity: 0.9, color: "#a8f0e2" }),
943
- /* @__PURE__ */ c("ambientLight", { intensity: 0.08, color: "#5eead4" }),
944
- /* @__PURE__ */ c("fogExp2", { attach: "fog", args: [he.fog, 0.016] }),
945
- /* @__PURE__ */ c(vn, {}),
946
- /* @__PURE__ */ H("mesh", { rotation: [-Math.PI / 2, 0, 0], receiveShadow: !0, children: [
947
- /* @__PURE__ */ c("circleGeometry", { args: [170, 64] }),
948
- /* @__PURE__ */ c("meshStandardMaterial", { color: he.ground, roughness: 1, metalness: 0 })
949
- ] }),
950
- /* @__PURE__ */ c(gn, {}),
951
- /* @__PURE__ */ c(hn, {})
952
- ] });
953
- }
954
- const Wt = new n.ConeGeometry(1, 1, 7, 1, !1).translate(0, 0.5, 0), yn = new n.EdgesGeometry(Wt, 1), Mn = new n.CylinderGeometry(0.05, 0.13, 1, 7).translate(0, 0.5, 0), Ft = new n.TorusGeometry(1, 0.035, 6, 72).rotateX(Math.PI / 2), bn = new n.Color("#07130f");
955
- function Sn(e, o, t) {
956
- const r = e.subagent ? 2 : 3, s = [];
957
- for (let i = 0; i < r; i++) {
958
- const a = r === 2 ? i * 1.4 : i;
959
- s.push({ y: o * (0.3 + a * 0.19), r: t * (1 - a * 0.27), h: o * (0.46 - a * 0.04), rot: Re(e.id, 20 + i) * 6.28 });
960
- }
961
- return s;
962
- }
963
- function An({ agent: e, onSelect: o }) {
964
- const t = e.inst, r = _(null), s = _(null), i = _(null), a = _(null), l = _(null), g = _(null), h = _(null), f = _(null), m = gt[t.type], p = S(() => Mt(t), [t]), x = So(t), R = S(() => Sn(t, p, x), [t, p, x]), M = S(() => Re(t.id, 9), [t.id]), y = S(
965
- () => ({
966
- fill: de(m),
967
- line: vo(m),
968
- trunk: new n.MeshBasicMaterial({ color: bn }),
969
- halo: Ae(m),
970
- pool: Ue(m),
971
- ring: de(tt),
972
- sel: de(ie),
973
- root: Et(m.clone().lerp(te, 0.3), t.subagent ? 0.055 : 0.08, 0.55),
974
- arrow: de(m)
975
- }),
976
- [m, t.subagent]
977
- ), u = S(
978
- () => ({
979
- base: new n.Vector3(),
980
- crown: new n.Vector3(),
981
- top: new n.Vector3(),
982
- p0: new n.Vector3(),
983
- p1: new n.Vector3(),
984
- p2: new n.Vector3(),
985
- p0set: !1,
986
- parentK: 0,
987
- ringK: 0,
988
- llm: t.llmCalls,
989
- tok: t.tokens,
990
- shed: !1,
991
- c: new n.Color(),
992
- c2: new n.Color()
993
- }),
994
- // eslint-disable-next-line react-hooks/exhaustive-deps
995
- []
996
- );
997
- Z(({ clock: v }) => {
998
- var _e;
999
- const d = performance.now(), C = v.elapsedTime;
1000
- u.base.copy(e.live);
1001
- const T = bt(e), L = I ? 0 : 0.05;
1002
- u.crown.set(u.base.x + Math.sin(C * 0.6 + M * 20) * L * p * T, p * 0.62 * T, u.base.z + Math.cos(C * 0.5 + M * 13) * L * p * 0.6 * T), u.top.set(u.crown.x, p * T, u.crown.z);
1003
- const G = (d - t.bornAt) / 1e3, V = !!t.parent, F = V ? De(G / 0.9) : 1, K = ho((G - (V ? 0.7 : 0.05)) / 0.95), W = t.exitAt ? (d - t.exitAt) / 1e3 : -1, O = W >= 0 ? le(W / 2.3) : 0, q = io(t, d), A = W < 0 && (t.status === "thinking" || t.status === "spawning"), z = lo(t, d), E = I ? 0 : 1, $ = 0.5 + 0.5 * Math.sin(C * 2 + M * 9) * E, Fe = 0.5 + 0.5 * Math.sin(C * 0.9 + M * 5) * E;
1004
- let Be = !1;
1005
- for (const k of J.mcpPending.values()) k.instance === t.id && (Be = !0);
1006
- if (u.ringK += ((Be && W < 0 ? 1 : 0) - u.ringK) * 0.08, t.llmCalls > u.llm) {
1007
- const k = Math.max(0, t.tokens - u.tok), b = Math.round(Math.min(46, 7 + k / 160));
1008
- u.c2.copy(m).lerp(ie, 0.35).multiplyScalar(1.4), Ro(u.top, b, u.c2, 0.3 + Math.min(0.55, k / 4500), x * 0.9 * T);
1009
- }
1010
- if (u.llm = t.llmCalls, u.tok = t.tokens, W >= 0 && !u.shed && (u.shed = !0, u.c2.copy(m).multiplyScalar(0.6), Go(u.crown, t.subagent ? 16 : 34, u.c2, x * 1.1 * T, t.subagent ? 0.2 : 0.27)), r.current && (r.current.position.copy(u.base), r.current.scale.setScalar(T)), s.current) {
1011
- const k = Math.max(1e-4, K * (1 - O * 0.2));
1012
- s.current.scale.set(k, Math.max(1e-4, De((G - (V ? 0.7 : 0.05)) / 0.8) * (1 - O * 0.12)), k), s.current.rotation.z = Math.sin(C * 0.6 + M * 20) * L * 0.5, s.current.rotation.x = Math.cos(C * 0.5 + M * 13) * L * 0.3;
1013
- }
1014
- const Oe = A ? 0.7 + $ * 0.3 : 0.32 + Fe * 0.12;
1015
- u.c.copy(m).multiplyScalar(Oe + z * 0.45), W >= 0 && u.c.lerp(mo, O).multiplyScalar(1 - O * 0.8), y.fill.color.copy(u.c).multiplyScalar(0.2), y.line.color.copy(u.c).multiplyScalar(1.15), i.current && (i.current.position.set(0, p * 0.55, 0), i.current.scale.setScalar(Math.max(1e-4, x * (A ? 3.4 + $ * 0.4 : 2.6) + z * 0.6)), y.halo.color.copy(m).multiplyScalar(((A ? 0.2 : 0.08) + z * 0.12) * (1 - O)));
1016
- const ke = J.selected === t.id;
1017
- a.current && (a.current.scale.setScalar(Math.max(1e-4, x * 4.2 * K)), y.pool.color.copy(m).multiplyScalar((0.12 + (A ? 0.08 : 0) + z * 0.08 + (ke ? 0.18 : 0)) * q)), l.current && (l.current.visible = u.ringK > 0.02, l.current.scale.setScalar(x * 0.95 * (1 + 0.04 * Math.sin(C * 3))), l.current.rotation.y = C * 0.4, y.ring.color.copy(tt).multiplyScalar(1.4 * u.ringK * (0.6 + Fe * 0.4))), g.current && (g.current.visible = ke, g.current.scale.setScalar(x * 1.3), y.sel.color.setScalar(0.5 + 0.2 * $)), (_e = f.current) == null || _e.setOpacity(co(t.id) ? le(K) * (1 - O) * (t.subagent ? 0.85 : 0.95) : 0);
1018
- const ge = t.parent ? J.instances.get(t.parent) : void 0, ue = t.parent ? Gt(t.parent) : void 0;
1019
- ue ? (u.p0.set(ue.x, 0.06, ue.z), u.p0set = !0) : u.p0set || u.p0.set(u.base.x, 0.06, u.base.z), u.p2.set(u.base.x, 0.06, u.base.z), yt(u.p0, u.p2, (M - 0.5) * 0.5, 0.06, u.p1);
1020
- const Ce = !!ge && !ge.exitAt;
1021
- u.parentK += ((V && !t.exitAt && Ce ? 1 : 0) - u.parentK) * (Ce ? 0.05 : 0.035);
1022
- const Q = y.root.uniforms;
1023
- Q.uP0.value.copy(u.p0), Q.uP1.value.copy(u.p1), Q.uP2.value.copy(u.p2);
1024
- const Ie = W >= 0 ? at(W / 1.6) : 0;
1025
- if (Q.uGrow.value = V ? F * (1 - Ie) : 0, Q.uHead.value = F < 1 ? F : -1, Q.uTail.value = 0.12, Q.uHeadColor.value.copy(m).multiplyScalar(1.6), Q.uOpacity.value = (A ? 0.9 : 0.6) * Math.min(u.parentK, q > 0 ? 1 : 0) + (F < 1 ? 0.4 : 0), Q.uTime.value = I ? 0 : C, Q.uFlow.value = F >= 1 ? u.parentK : 0, h.current) {
1026
- const k = V && F >= 1 && u.parentK > 0.05 && Q.uGrow.value > 0.9;
1027
- h.current.visible = k, k && (ft(h.current, u.p0, u.p1, u.p2, 0.78, 1, (t.subagent ? 0.42 : 0.55) * Math.min(1.3, T)), y.arrow.color.copy(m).multiplyScalar(1.5 * u.parentK));
1028
- }
1029
- });
1030
- const U = (v) => {
1031
- v.stopPropagation(), o(t.id);
1032
- }, N = () => document.body.style.cursor = "pointer", j = () => document.body.style.cursor = "", D = t.id.split(":")[2];
1033
- return /* @__PURE__ */ H(ce, { children: [
1034
- /* @__PURE__ */ c("mesh", { geometry: Dt, material: y.root, frustumCulled: !1 }),
1035
- /* @__PURE__ */ c("mesh", { ref: h, geometry: wt, material: y.arrow, visible: !1 }),
1036
- /* @__PURE__ */ H("group", { ref: r, children: [
1037
- /* @__PURE__ */ c("mesh", { ref: a, geometry: Le, material: y.pool, position: [0, 0.02, 0], scale: 1e-4 }),
1038
- /* @__PURE__ */ c("mesh", { ref: l, geometry: Ft, material: y.ring, position: [0, 0.06, 0], visible: !1 }),
1039
- /* @__PURE__ */ c("mesh", { ref: g, geometry: Ft, material: y.sel, position: [0, 0.05, 0], visible: !1 }),
1040
- /* @__PURE__ */ H("group", { ref: s, scale: 1e-4, children: [
1041
- /* @__PURE__ */ c("mesh", { geometry: Mn, material: y.trunk, scale: [t.subagent ? 0.7 : 1.2, p * 0.75, t.subagent ? 0.7 : 1.2], onClick: U, onPointerOver: N, onPointerOut: j }),
1042
- R.map((v, d) => /* @__PURE__ */ H("group", { position: [0, v.y, 0], rotation: [0, v.rot, 0], scale: [v.r, v.h, v.r], children: [
1043
- /* @__PURE__ */ c("mesh", { geometry: Wt, material: y.fill, onClick: U, onPointerOver: N, onPointerOut: j }),
1044
- /* @__PURE__ */ c("lineSegments", { geometry: yn, material: y.line })
1045
- ] }, d)),
1046
- /* @__PURE__ */ c("sprite", { ref: i, material: y.halo })
1047
- ] }),
1048
- /* @__PURE__ */ c(
1049
- Ee,
1050
- {
1051
- ref: f,
1052
- fit: !0,
1053
- position: [0, p * 1.1 + (t.subagent ? 0.15 : 0.45), 0],
1054
- text: `${t.name}${D !== void 0 && !Number.isNaN(Number(D)) ? ` ${Number(D) + 1}` : ""}`,
1055
- color: _t[t.type],
1056
- size: t.subagent ? 0.24 : 0.3,
1057
- opacity: 0,
1058
- pxRange: t.subagent ? [8, 11.5] : [9, 13.5]
1059
- }
1060
- )
1061
- ] })
1062
- ] });
1063
- }
1064
- function xn({ comet: e }) {
1065
- const o = _(null), t = J.instances.get(e.from), r = S(() => (t ? gt[t.type] : te).clone().lerp(ie, 0.3), [t]), s = S(() => Ae(r.clone().multiplyScalar(1.6)), [r]), i = S(() => ({ a: new n.Vector3(), b: new n.Vector3(), c: new n.Vector3(), h: new n.Vector3(), tc: r.clone().multiplyScalar(0.9) }), [r]);
1066
- return Z(() => {
1067
- const a = pt(e.from, i.a), l = pt(e.to, i.b);
1068
- if (!o.current) return;
1069
- if (!a || !l) {
1070
- o.current.visible = !1;
1071
- return;
1072
- }
1073
- Ut(a, l, 2.6, i.c);
1074
- const g = le((performance.now() - e.start) / e.dur);
1075
- xe(a, i.c, l, at(g), i.h), o.current.visible = g < 1, o.current.position.copy(i.h), o.current.scale.setScalar(1.3), g < 1 && g > 0.02 && It(i.h, i.tc, 0.32, 0.6);
1076
- }), /* @__PURE__ */ c("sprite", { ref: o, material: s, visible: !1 });
1077
- }
1078
- function Cn() {
1079
- const [e, o] = et([]), t = _({ n: -1, last: -1, first: -1 });
1080
- return Z(() => {
1081
- const r = J.comets, s = t.current, i = r.length ? r[0].id : -1, a = r.length ? r[r.length - 1].id : -1;
1082
- (r.length !== s.n || i !== s.first || a !== s.last) && (s.n = r.length, s.first = i, s.last = a, o(Tn(r)));
1083
- }), /* @__PURE__ */ c(ce, { children: e.map((r) => /* @__PURE__ */ c(xn, { comet: r }, r.id)) });
1084
- }
1085
- const Pn = 40;
1086
- function Tn(e) {
1087
- const o = [];
1088
- for (let t = e.length - 1; t >= 0 && o.length < Pn; t--) {
1089
- const r = e[t];
1090
- (!uo.grouped || Ct(r.from) && Ct(r.to)) && o.push(r);
1091
- }
1092
- return o.reverse();
1093
- }
1094
- const Je = new n.Vector3();
1095
- function zn(e) {
1096
- for (const o of me.agents.values()) {
1097
- const t = bt(o);
1098
- Je.copy(o.target), Je.y = Mt(o.inst) * 1.12 * t + 0.45, e(Je, 0.9);
1099
- }
1100
- for (const o of me.runs.values()) e(Ot(o, Je), 1.6);
1101
- }
1102
- function En() {
1103
- return /* @__PURE__ */ H(
1104
- fo,
1105
- {
1106
- title: "forest · night grove",
1107
- subtitle: "Agents grow as glowing trees (saplings = subagents, roots point parent → child) · fireflies = LLM calls sized by tokens · mushrooms = MCP servers & backends on the mycelium · the pond is graph memory · exits shed their leaves",
1108
- preset: "radial",
1109
- plane: "xz",
1110
- camera: { position: [0, 17.5, 31], fov: 46 },
1111
- target: [0, 2.4, 0],
1112
- controls: { maxPolarAngle: 1.42 },
1113
- bg: he.bg,
1114
- fit: { nRef: 4, min: 0.62, max: 1.5, minRadius: 4.5 },
1115
- agentRadius: 1.1,
1116
- graph: { natural: Qo, radius: 3 },
1117
- peripheryGap: 4,
1118
- Background: /* @__PURE__ */ c(wn, {}),
1119
- Agent: An,
1120
- RunMarker: To,
1121
- McpServer: Ko,
1122
- Backend: jo,
1123
- GraphResource: ln,
1124
- cluster: { radius: 1.35, variant: "swarm", color: "#b6f36a", pointSize: 0.85 },
1125
- clusterOffset: [0, 3.2, 0],
1126
- extents: zn,
1127
- PostFX: /* @__PURE__ */ H(Kt, { multisampling: 0, children: [
1128
- /* @__PURE__ */ c(Ht, { mipmapBlur: !0, intensity: 1, luminanceThreshold: 0.22, luminanceSmoothing: 0.3, radius: 0.72 }),
1129
- /* @__PURE__ */ c($t, { eskil: !1, offset: 0.24, darkness: 0.85 })
1130
- ] }),
1131
- children: [
1132
- /* @__PURE__ */ c(Jo, {}),
1133
- /* @__PURE__ */ c(Cn, {}),
1134
- /* @__PURE__ */ c(Oo, { count: I ? 70 : 170 }),
1135
- /* @__PURE__ */ c(_o, {}),
1136
- /* @__PURE__ */ c(Eo, {})
1137
- ]
1138
- }
1139
- );
1140
- }
1141
- export {
1142
- En as default
1143
- };