@photon-ai/pho-ui 4.7.1 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,18 @@
1
1
  "use client";
2
- import { t as P } from "./cn-ChIgwEl3.js";
3
- import { t as U } from "./createReactComponent-BqCmnqfX.js";
4
- import { t as Se } from "./IconChevronDown-CZilB71T.js";
5
- import { t as Ge } from "./IconChevronRight-CzoJnYNI.js";
6
- import { t as Ie } from "./IconChevronUp-CrpWSgIl.js";
7
- import { t as Xe } from "./IconX-pZ9vrtSr.js";
8
- import { t as fe } from "./collapsible-Dv306QOT.js";
9
- import { t as He } from "./ghost-search-AmVXd0zE.js";
10
- import { i as Ze, r as Je } from "./badge-DlLJPLeZ.js";
11
- import { createContext as de, useCallback as F, useContext as ue, useEffect as ae, useId as Ye, useMemo as L, useRef as he, useState as Y } from "react";
12
- import { Fragment as _e, jsx as o, jsxs as w } from "react/jsx-runtime";
2
+ import { t as S } from "./cn-ChIgwEl3.js";
3
+ import { t as j } from "./createReactComponent-BqCmnqfX.js";
4
+ import { t as Ie } from "./IconChevronDown-CZilB71T.js";
5
+ import { t as He } from "./IconChevronRight-CzoJnYNI.js";
6
+ import { t as Te } from "./IconChevronUp-CrpWSgIl.js";
7
+ import { t as Ze } from "./IconX-pZ9vrtSr.js";
8
+ import { t as ge } from "./collapsible-Dv306QOT.js";
9
+ import { t as he } from "./skeleton-DwjSl4vC.js";
10
+ import { a as Je, i as Ye, n as Qe, r as qe, t as et } from "./ghost-search-CNVs9k1o.js";
11
+ import { i as tt, r as nt } from "./badge-DlLJPLeZ.js";
12
+ import { createContext as de, useCallback as F, useContext as ue, useEffect as ae, useId as at, useMemo as O, useRef as fe, useState as Y } from "react";
13
+ import { Fragment as Ee, jsx as s, jsxs as N } from "react/jsx-runtime";
13
14
  import { useRender as q } from "@base-ui/react/use-render";
14
- var Qe = [
15
+ var rt = [
15
16
  ["path", {
16
17
  d: "M5 12l14 0",
17
18
  key: "svg-0"
@@ -24,25 +25,25 @@ var Qe = [
24
25
  d: "M15 8l4 4",
25
26
  key: "svg-2"
26
27
  }]
27
- ], qe = U("outline", "arrow-narrow-right", "ArrowNarrowRight", Qe), et = [["path", {
28
+ ], st = j("outline", "arrow-narrow-right", "ArrowNarrowRight", rt), ot = [["path", {
28
29
  d: "M7 10h14l-4 -4",
29
30
  key: "svg-0"
30
31
  }], ["path", {
31
32
  d: "M17 14h-14l4 4",
32
33
  key: "svg-1"
33
- }]], tt = U("outline", "arrows-exchange", "ArrowsExchange", et), nt = [["path", {
34
+ }]], it = j("outline", "arrows-exchange", "ArrowsExchange", ot), lt = [["path", {
34
35
  d: "M7 7l5 5l5 -5",
35
36
  key: "svg-0"
36
37
  }], ["path", {
37
38
  d: "M7 13l5 5l5 -5",
38
39
  key: "svg-1"
39
- }]], at = U("outline", "chevrons-down", "ChevronsDown", nt), rt = [["path", {
40
+ }]], ct = j("outline", "chevrons-down", "ChevronsDown", lt), dt = [["path", {
40
41
  d: "M7 11l5 -5l5 5",
41
42
  key: "svg-0"
42
43
  }], ["path", {
43
44
  d: "M7 17l5 -5l5 5",
44
45
  key: "svg-1"
45
- }]], st = U("outline", "chevrons-up", "ChevronsUp", rt), ot = [
46
+ }]], ut = j("outline", "chevrons-up", "ChevronsUp", dt), pt = [
46
47
  ["path", {
47
48
  d: "M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",
48
49
  key: "svg-0"
@@ -55,7 +56,7 @@ var Qe = [
55
56
  d: "M4 12v6a8 3 0 0 0 16 0v-6",
56
57
  key: "svg-2"
57
58
  }]
58
- ], it = U("outline", "database", "Database", ot), lt = [
59
+ ], ht = j("outline", "database", "Database", pt), mt = [
59
60
  ["path", {
60
61
  d: "M14 3v4a1 1 0 0 0 1 1h4",
61
62
  key: "svg-0"
@@ -72,7 +73,7 @@ var Qe = [
72
73
  d: "M18.5 19.5l2.5 2.5",
73
74
  key: "svg-3"
74
75
  }]
75
- ], ct = U("outline", "file-search", "FileSearch", lt), dt = [
76
+ ], ft = j("outline", "file-search", "FileSearch", mt), vt = [
76
77
  ["path", {
77
78
  d: "M8 9h8",
78
79
  key: "svg-0"
@@ -85,7 +86,7 @@ var Qe = [
85
86
  d: "M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12",
86
87
  key: "svg-2"
87
88
  }]
88
- ], ut = U("outline", "message", "Message", dt), pt = [
89
+ ], gt = j("outline", "message", "Message", vt), bt = [
89
90
  ["path", {
90
91
  d: "M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4",
91
92
  key: "svg-0"
@@ -122,13 +123,13 @@ var Qe = [
122
123
  d: "M14 8v.01",
123
124
  key: "svg-8"
124
125
  }]
125
- ], ht = U("outline", "robot", "Robot", pt), mt = [["path", {
126
+ ], xt = j("outline", "robot", "Robot", bt), yt = [["path", {
126
127
  d: "M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m0 -12a2 2 0 0 1 2 2a2 2 0 0 1 2 -2a2 2 0 0 1 -2 -2a2 2 0 0 1 -2 2m-7 12a6 6 0 0 1 6 -6a6 6 0 0 1 -6 -6a6 6 0 0 1 -6 6a6 6 0 0 1 6 6",
127
128
  key: "svg-0"
128
- }]], ve = U("outline", "sparkles", "Sparkles", mt), ft = [["path", {
129
+ }]], be = j("outline", "sparkles", "Sparkles", yt), wt = [["path", {
129
130
  d: "M7 10h3v-3l-3.5 -3.5a6 6 0 0 1 8 8l6 6a2 2 0 0 1 -3 3l-6 -6a6 6 0 0 1 -8 -8l3.5 3.5",
130
131
  key: "svg-0"
131
- }]], vt = U("outline", "tool", "Tool", ft), bt = [
132
+ }]], Nt = j("outline", "tool", "Tool", wt), kt = [
132
133
  ["path", {
133
134
  d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",
134
135
  key: "svg-0"
@@ -149,61 +150,61 @@ var Qe = [
149
150
  d: "M12.5 3a17 17 0 0 1 0 18",
150
151
  key: "svg-4"
151
152
  }]
152
- ], gt = U("outline", "world", "World", bt), be = [0, 1], J = 1e-3, X = (e) => typeof e == "number" && Number.isFinite(e);
153
- function xt(e) {
153
+ ], Mt = j("outline", "world", "World", kt), xe = [0, 1], J = 1e-3, X = (e) => typeof e == "number" && Number.isFinite(e);
154
+ function At(e) {
154
155
  const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
155
156
  for (const r of e.values()) r.parentSpanId != null && e.has(r.parentSpanId) ? t.set(r.id, r.parentSpanId) : (t.set(r.id, null), r.parentSpanId != null && n.add(r.id));
156
157
  const a = /* @__PURE__ */ new Set();
157
158
  for (const r of e.keys()) {
158
159
  if (a.has(r)) continue;
159
- const s = [], l = /* @__PURE__ */ new Set();
160
+ const o = [], l = /* @__PURE__ */ new Set();
160
161
  let i = r;
161
162
  for (; i !== null && !a.has(i); ) {
162
163
  if (l.has(i)) {
163
164
  t.set(i, null), n.add(i);
164
165
  break;
165
166
  }
166
- s.push(i), l.add(i), i = t.get(i) ?? null;
167
+ o.push(i), l.add(i), i = t.get(i) ?? null;
167
168
  }
168
- for (const d of s) a.add(d);
169
+ for (const c of o) a.add(c);
169
170
  }
170
171
  return {
171
172
  parents: t,
172
173
  orphans: n
173
174
  };
174
175
  }
175
- function Te(e) {
176
- const t = new Map(e.map((h) => [h.id, h])), { parents: n, orphans: a } = xt(t), r = /* @__PURE__ */ new Map();
176
+ function $e(e) {
177
+ const t = new Map(e.map((h) => [h.id, h])), { parents: n, orphans: a } = At(t), r = /* @__PURE__ */ new Map();
177
178
  for (const h of t.values()) {
178
- const v = n.get(h.id) ?? null, M = r.get(v) ?? [];
179
- M.push(h), r.set(v, M);
179
+ const g = n.get(h.id) ?? null, M = r.get(g) ?? [];
180
+ M.push(h), r.set(g, M);
180
181
  }
181
- let s = 1 / 0;
182
- for (const h of t.values()) X(h.startedAt) && h.startedAt < s && (s = h.startedAt);
183
- s === 1 / 0 && (s = 0);
184
- const l = (h, v) => {
182
+ let o = 1 / 0;
183
+ for (const h of t.values()) X(h.startedAt) && h.startedAt < o && (o = h.startedAt);
184
+ o === 1 / 0 && (o = 0);
185
+ const l = (h, g) => {
185
186
  let M = !1, m = h.startedAt;
186
- X(m) || (m = v ?? s, M = !0);
187
- let g = h.endedAt;
188
- g != null && (!X(g) || g < m) && (g = m, M = !0);
189
- const N = X(h.latencyMs) && h.latencyMs >= 0 ? h.latencyMs : null;
187
+ X(m) || (m = g ?? o, M = !0);
188
+ let b = h.endedAt;
189
+ b != null && (!X(b) || b < m) && (b = m, M = !0);
190
+ const k = X(h.latencyMs) && h.latencyMs >= 0 ? h.latencyMs : null;
190
191
  return {
191
192
  startedAt: m,
192
- endedAt: g,
193
- latencyMs: N,
193
+ endedAt: b,
194
+ latencyMs: k,
194
195
  repaired: M
195
196
  };
196
- }, i = [], d = /* @__PURE__ */ new Map();
197
- let c = 0;
198
- const k = (h, v, M) => {
199
- const m = l(h, M), g = r.get(h.id) ?? [], N = {
197
+ }, i = [], c = /* @__PURE__ */ new Map();
198
+ let d = 0;
199
+ const x = (h, g, M) => {
200
+ const m = l(h, M), b = r.get(h.id) ?? [], k = {
200
201
  ...h,
201
202
  parentSpanId: n.get(h.id) ?? null,
202
203
  startedAt: m.startedAt,
203
204
  endedAt: m.endedAt,
204
205
  latencyMs: m.latencyMs,
205
- depth: v,
206
- hasChildren: g.length > 0,
206
+ depth: g,
207
+ hasChildren: b.length > 0,
207
208
  isCollapsed: !1,
208
209
  descendants: 0,
209
210
  descendantErrors: 0,
@@ -211,32 +212,32 @@ function Te(e) {
211
212
  repaired: m.repaired,
212
213
  serverChildId: null
213
214
  };
214
- m.repaired && (c += 1), i.push(N), d.set(N.id, N);
215
- const x = g.map((E) => ({
216
- kid: E,
217
- start: X(E.startedAt) ? E.startedAt : m.startedAt
215
+ m.repaired && (d += 1), i.push(k), c.set(k.id, k);
216
+ const y = b.map(($) => ({
217
+ kid: $,
218
+ start: X($.startedAt) ? $.startedAt : m.startedAt
218
219
  }));
219
- x.sort((E, T) => E.start - T.start);
220
- let _ = 0, D = 0;
221
- for (const { kid: E } of x) {
222
- const T = k(E, v + 1, m.startedAt);
223
- _ += 1 + T.descendants, D += (T.status === "failed" ? 1 : 0) + T.descendantErrors, N.kind === "client" && N.serverChildId == null && T.kind === "server" && (N.serverChildId = T.id);
220
+ y.sort(($, E) => $.start - E.start);
221
+ let T = 0, z = 0;
222
+ for (const { kid: $ } of y) {
223
+ const E = x($, g + 1, m.startedAt);
224
+ T += 1 + E.descendants, z += (E.status === "failed" ? 1 : 0) + E.descendantErrors, k.kind === "client" && k.serverChildId == null && E.kind === "server" && (k.serverChildId = E.id);
224
225
  }
225
- return N.descendants = _, N.descendantErrors = D, N;
226
- }, b = (r.get(null) ?? []).map((h) => ({
226
+ return k.descendants = T, k.descendantErrors = z, k;
227
+ }, v = (r.get(null) ?? []).map((h) => ({
227
228
  root: h,
228
- start: X(h.startedAt) ? h.startedAt : s
229
+ start: X(h.startedAt) ? h.startedAt : o
229
230
  }));
230
- b.sort((h, v) => h.start - v.start);
231
- for (const { root: h } of b) k(h, 0, null);
231
+ v.sort((h, g) => h.start - g.start);
232
+ for (const { root: h } of v) x(h, 0, null);
232
233
  return {
233
234
  spans: i,
234
- byId: d,
235
+ byId: c,
235
236
  orphans: a.size,
236
- repaired: c
237
+ repaired: d
237
238
  };
238
239
  }
239
- function Ee(e, t) {
240
+ function Pe(e, t) {
240
241
  const n = [];
241
242
  let a = null;
242
243
  for (const r of e.spans) {
@@ -251,42 +252,42 @@ function Ee(e, t) {
251
252
  }
252
253
  return n;
253
254
  }
254
- function Wn(e, t = /* @__PURE__ */ new Set()) {
255
- return Ee(Te(e), t);
255
+ function Hn(e, t = /* @__PURE__ */ new Set()) {
256
+ return Pe($e(e), t);
256
257
  }
257
- function yt(e, t) {
258
+ function Ct(e, t) {
258
259
  const n = [];
259
260
  let a = e.get(t)?.parentSpanId ?? null;
260
261
  for (; a != null && !n.includes(a); )
261
262
  n.push(a), a = e.get(a)?.parentSpanId ?? null;
262
263
  return n;
263
264
  }
264
- function wt(e) {
265
+ function St(e) {
265
266
  return e.filter((t) => t.hasChildren).map((t) => t.id);
266
267
  }
267
- function Nt(e, t) {
268
+ function _t(e, t) {
268
269
  return e.filter((n) => n.hasChildren).every((n) => t.has(n.id));
269
270
  }
270
- function kt(e, t) {
271
+ function It(e, t) {
271
272
  const n = new Set(t);
272
273
  let a;
273
274
  for (const r of e) a && r.depth <= a.depth ? (n.add(a.id), a = r.hasChildren && !n.has(r.id) ? r : void 0) : r.hasChildren && !n.has(r.id) && (a = r);
274
275
  return a && n.add(a.id), Array.from(n);
275
276
  }
276
- function Mt(e, t) {
277
+ function Tt(e, t) {
277
278
  const n = new Set(t);
278
279
  let a = -1, r = !0;
279
- for (const s of e)
280
- s.depth <= a && (r = !0), r && n.has(s.id) && (n.delete(s.id), r = !1, a = s.depth);
280
+ for (const o of e)
281
+ o.depth <= a && (r = !0), r && n.has(o.id) && (n.delete(o.id), r = !1, a = o.depth);
281
282
  return Array.from(n);
282
283
  }
283
- function At(e, t) {
284
+ function Et(e, t) {
284
285
  let n = 1 / 0, a = -1 / 0;
285
286
  for (const r of e) {
286
287
  if (!X(r.startedAt)) continue;
287
288
  r.startedAt < n && (n = r.startedAt);
288
- const s = X(r.endedAt) ? r.endedAt : t ?? r.startedAt;
289
- s > a && (a = s);
289
+ const o = X(r.endedAt) ? r.endedAt : t ?? r.startedAt;
290
+ o > a && (a = o);
290
291
  }
291
292
  return n === 1 / 0 ? {
292
293
  min: 0,
@@ -305,42 +306,42 @@ function ie(e) {
305
306
  }
306
307
  return [t, n];
307
308
  }
308
- function Ct(e, t) {
309
+ function $t(e, t) {
309
310
  const n = e.max - e.min;
310
311
  return {
311
312
  min: e.min + t[0] * n,
312
313
  max: e.min + t[1] * n
313
314
  };
314
315
  }
315
- function St(e, t, n = 0.5) {
316
- const [a, r] = e, s = r - a, l = Math.min(1, Math.max(J, s * t));
317
- let i = a + n * s - n * l;
316
+ function Pt(e, t, n = 0.5) {
317
+ const [a, r] = e, o = r - a, l = Math.min(1, Math.max(J, o * t));
318
+ let i = a + n * o - n * l;
318
319
  return i = Math.min(Math.max(i, 0), 1 - l), ie([i, i + l]);
319
320
  }
320
- function It(e, t) {
321
+ function Dt(e, t) {
321
322
  const [n, a] = e, r = a - n;
322
- let s = n + t * r;
323
- return s = Math.min(Math.max(s, 0), 1 - r), ie([s, s + r]);
323
+ let o = n + t * r;
324
+ return o = Math.min(Math.max(o, 0), 1 - r), ie([o, o + r]);
324
325
  }
325
- function Kn(e, t) {
326
+ function Zn(e, t) {
326
327
  return e[0] + t * (e[1] - e[0]);
327
328
  }
328
- function _t(e) {
329
+ function Rt(e) {
329
330
  return e[0] <= 0 && e[1] >= 1;
330
331
  }
331
- function Tt({ startedAt: e, endedAt: t, timeRange: n, now: a }) {
332
- const r = Math.max(1, n.max - n.min), s = t ?? a ?? n.max, l = (e - n.min) / r * 100, i = (s - n.min) / r * 100, d = Math.min(100, Math.max(0, l)), c = Math.min(100, Math.max(d, i));
332
+ function zt({ startedAt: e, endedAt: t, timeRange: n, now: a }) {
333
+ const r = Math.max(1, n.max - n.min), o = t ?? a ?? n.max, l = (e - n.min) / r * 100, i = (o - n.min) / r * 100, c = Math.min(100, Math.max(0, l)), d = Math.min(100, Math.max(c, i));
333
334
  return {
334
- leftPercent: d,
335
- endPercent: c,
336
- widthPercent: c - d,
337
- durationMs: Math.max(0, s - e),
338
- effectiveEnd: s,
335
+ leftPercent: c,
336
+ endPercent: d,
337
+ widthPercent: d - c,
338
+ durationMs: Math.max(0, o - e),
339
+ effectiveEnd: o,
339
340
  clippedStart: l < 0 && i > 0,
340
341
  clippedEnd: i > 100 && l < 100
341
342
  };
342
343
  }
343
- function Et(e) {
344
+ function Lt(e) {
344
345
  if (e == null) return "";
345
346
  if (typeof e == "object") try {
346
347
  return JSON.stringify(e);
@@ -349,32 +350,32 @@ function Et(e) {
349
350
  }
350
351
  return String(e);
351
352
  }
352
- function $t(e, t) {
353
+ function Ot(e, t) {
353
354
  if (e == null || e.trim() === "") return null;
354
355
  const n = [], a = [];
355
356
  for (const i of e.match(/[^\s"]+|"([^"]*)"/g) ?? []) {
356
- const d = i.replace(/^"(.*)"$/, "$1").toLowerCase();
357
- d && (d.startsWith("-") && d.length > 1 ? a.push(d.slice(1)) : n.push(d));
357
+ const c = i.replace(/^"(.*)"$/, "$1").toLowerCase();
358
+ c && (c.startsWith("-") && c.length > 1 ? a.push(c.slice(1)) : n.push(c));
358
359
  }
359
360
  if (n.length === 0) return /* @__PURE__ */ new Set();
360
361
  const r = (i) => {
361
- const d = i.toLowerCase();
362
- return n.some((c) => d.includes(c));
363
- }, s = (i) => {
364
- const d = i.toLowerCase();
365
- return a.some((c) => d.includes(c));
362
+ const c = i.toLowerCase();
363
+ return n.some((d) => c.includes(d));
364
+ }, o = (i) => {
365
+ const c = i.toLowerCase();
366
+ return a.some((d) => c.includes(d));
366
367
  }, l = /* @__PURE__ */ new Set();
367
368
  for (const i of t) {
368
- if (r(i.name) || i.service != null && r(i.service) || i.type !== "" && r(i.type) || i.kind != null && r(i.kind) || n.some((c) => c === i.id.toLowerCase())) {
369
+ if (r(i.name) || i.service != null && r(i.service) || i.type !== "" && r(i.type) || i.kind != null && r(i.kind) || n.some((d) => d === i.id.toLowerCase())) {
369
370
  l.add(i.id);
370
371
  continue;
371
372
  }
372
- const d = i.attributes;
373
- if (d != null)
374
- for (const c of Object.keys(d)) {
375
- if (s(c)) continue;
376
- const k = Et(d[c]);
377
- if (k !== "" && (r(c) || r(k) || r(`${c}=${k}`))) {
373
+ const c = i.attributes;
374
+ if (c != null)
375
+ for (const d of Object.keys(c)) {
376
+ if (o(d)) continue;
377
+ const x = Lt(c[d]);
378
+ if (x !== "" && (r(d) || r(x) || r(`${d}=${x}`))) {
378
379
  l.add(i.id);
379
380
  break;
380
381
  }
@@ -382,115 +383,115 @@ function $t(e, t) {
382
383
  }
383
384
  return l;
384
385
  }
385
- var $e = de(null), Pe = de(null), ze = de(null);
386
+ var De = de(null), Re = de(null), ze = de(null);
386
387
  function G() {
387
- const e = ue($e);
388
+ const e = ue(De);
388
389
  if (e == null) throw new Error("SpanPrimitive parts render inside SpanPrimitive.Provider.");
389
390
  return e;
390
391
  }
391
392
  function ee() {
392
- const e = ue(Pe);
393
+ const e = ue(Re);
393
394
  if (e == null) throw new Error("SpanPrimitive parts render inside SpanPrimitive.Children.");
394
395
  return e;
395
396
  }
396
- var ge = [];
397
- function Pt({ spans: e, defaultCollapsed: t, collapsed: n, onCollapsedChange: a, now: r, query: s = "", keepFoldsOnMatch: l = !1, defaultView: i, view: d, onViewChange: c, children: k }) {
398
- const b = L(() => Te(e), [e]), [h, v] = Y(() => t ?? ge), M = n ?? h, m = L(() => new Set(M), [M]), g = F((I) => {
399
- const $ = Array.from(new Set(I));
400
- n == null && v($), a?.($);
401
- }, [n, a]), N = F((I) => {
402
- const $ = new Set(m);
403
- $.has(I) ? $.delete(I) : $.add(I), g(Array.from($));
404
- }, [m, g]), { spans: x, byId: _ } = b, D = F(() => g(ge), [g]), E = F(() => g(wt(x)), [x, g]), T = F(() => g(Mt(x, m)), [
405
- x,
397
+ var ye = [];
398
+ function Ft({ spans: e, defaultCollapsed: t, collapsed: n, onCollapsedChange: a, now: r, query: o = "", keepFoldsOnMatch: l = !1, defaultView: i, view: c, onViewChange: d, children: x }) {
399
+ const v = O(() => $e(e), [e]), [h, g] = Y(() => t ?? ye), M = n ?? h, m = O(() => new Set(M), [M]), b = F((I) => {
400
+ const P = Array.from(new Set(I));
401
+ n == null && g(P), a?.(P);
402
+ }, [n, a]), k = F((I) => {
403
+ const P = new Set(m);
404
+ P.has(I) ? P.delete(I) : P.add(I), b(Array.from(P));
405
+ }, [m, b]), { spans: y, byId: T } = v, z = F(() => b(ye), [b]), $ = F(() => b(St(y)), [y, b]), E = F(() => b(Tt(y, m)), [
406
+ y,
406
407
  m,
407
- g
408
- ]), C = F(() => g(kt(x, m)), [
409
- x,
408
+ b
409
+ ]), C = F(() => b(It(y, m)), [
410
+ y,
410
411
  m,
411
- g
412
- ]), S = !Nt(x, m), O = x.some((I) => I.hasChildren && m.has(I.id)), p = L(() => $t(s, x), [s, x]);
412
+ b
413
+ ]), _ = !_t(y, m), L = y.some((I) => I.hasChildren && m.has(I.id)), p = O(() => Ot(o, y), [o, y]);
413
414
  ae(() => {
414
415
  if (l || p == null || p.size === 0) return;
415
416
  const I = /* @__PURE__ */ new Set();
416
- for (const $ of p) for (const Z of yt(_, $)) m.has(Z) && I.add(Z);
417
- I.size !== 0 && g(M.filter(($) => !I.has($)));
417
+ for (const P of p) for (const Z of Ct(T, P)) m.has(Z) && I.add(Z);
418
+ I.size !== 0 && b(M.filter((P) => !I.has(P)));
418
419
  }, [
419
420
  p,
420
421
  l,
421
- _,
422
+ T,
422
423
  m,
423
424
  M,
424
- g
425
+ b
425
426
  ]);
426
- const f = L(() => Ee(b, m), [b, m]), y = L(() => At(x, r), [x, r]), [A, te] = Y(() => ie(i ?? be)), z = L(() => ie(d ?? A), [d, A]), R = F((I) => {
427
- const $ = ie(I);
428
- d == null && te($), c?.($);
429
- }, [d, c]), V = F((I, $) => R(St(z, I, $)), [z, R]), W = F((I) => R(It(z, I)), [z, R]), ne = F(() => R(be), [R]), j = L(() => Ct(y, z), [y, z]), re = L(() => ({
427
+ const f = O(() => Pe(v, m), [v, m]), w = O(() => Et(y, r), [y, r]), [A, te] = Y(() => ie(i ?? xe)), D = O(() => ie(c ?? A), [c, A]), R = F((I) => {
428
+ const P = ie(I);
429
+ c == null && te(P), d?.(P);
430
+ }, [c, d]), B = F((I, P) => R(Pt(D, I, P)), [D, R]), W = F((I) => R(Dt(D, I)), [D, R]), ne = F(() => R(xe), [R]), V = O(() => $t(w, D), [w, D]), re = O(() => ({
430
431
  spans: f,
431
- all: x,
432
- byId: _,
433
- orphans: b.orphans,
434
- repaired: b.repaired,
435
- range: y,
436
- view: z,
437
- viewRange: j,
438
- zoomed: !_t(z),
432
+ all: y,
433
+ byId: T,
434
+ orphans: v.orphans,
435
+ repaired: v.repaired,
436
+ range: w,
437
+ view: D,
438
+ viewRange: V,
439
+ zoomed: !Rt(D),
439
440
  now: r,
440
441
  collapsed: m,
441
- toggle: N,
442
- setCollapsed: g,
443
- expandAll: D,
444
- collapseAll: E,
445
- expandOne: T,
442
+ toggle: k,
443
+ setCollapsed: b,
444
+ expandAll: z,
445
+ collapseAll: $,
446
+ expandOne: E,
446
447
  collapseOne: C,
447
- canExpand: O,
448
- canCollapse: S,
449
- query: s,
448
+ canExpand: L,
449
+ canCollapse: _,
450
+ query: o,
450
451
  matches: p,
451
452
  setView: R,
452
- zoom: V,
453
+ zoom: B,
453
454
  pan: W,
454
455
  resetView: ne
455
456
  }), [
456
457
  f,
457
- x,
458
- _,
459
- b.orphans,
460
- b.repaired,
461
458
  y,
462
- z,
463
- j,
459
+ T,
460
+ v.orphans,
461
+ v.repaired,
462
+ w,
463
+ D,
464
+ V,
464
465
  r,
465
466
  m,
466
- N,
467
- g,
468
- D,
467
+ k,
468
+ b,
469
+ z,
470
+ $,
469
471
  E,
470
- T,
471
472
  C,
472
- O,
473
- S,
474
- s,
473
+ L,
474
+ _,
475
+ o,
475
476
  p,
476
477
  R,
477
- V,
478
+ B,
478
479
  W,
479
480
  ne
480
481
  ]);
481
- return /* @__PURE__ */ o($e.Provider, {
482
+ return /* @__PURE__ */ s(De.Provider, {
482
483
  value: re,
483
- children: k
484
+ children: x
484
485
  });
485
486
  }
486
- function zt({ children: e }) {
487
+ function Wt({ children: e }) {
487
488
  const { spans: t } = G();
488
- return t.map((n) => /* @__PURE__ */ o(Pe.Provider, {
489
+ return t.map((n) => /* @__PURE__ */ s(Re.Provider, {
489
490
  value: n,
490
491
  children: e(n)
491
492
  }, n.id));
492
493
  }
493
- function Rt({ render: e, ref: t, ...n }) {
494
+ function Kt({ render: e, ref: t, ...n }) {
494
495
  const a = ee(), { matches: r } = G();
495
496
  return q({
496
497
  render: e,
@@ -509,14 +510,14 @@ function Rt({ render: e, ref: t, ...n }) {
509
510
  }
510
511
  });
511
512
  }
512
- function Dt({ render: e, ref: t, baseIndent: n = 8, indentPerLevel: a = 12, style: r, ...s }) {
513
+ function Bt({ render: e, ref: t, baseIndent: n = 8, indentPerLevel: a = 12, style: r, ...o }) {
513
514
  const l = ee();
514
515
  return q({
515
516
  render: e,
516
517
  ref: t,
517
518
  defaultTagName: "div",
518
519
  props: {
519
- ...s,
520
+ ...o,
520
521
  style: {
521
522
  ...r,
522
523
  paddingLeft: n + l.depth * a
@@ -525,8 +526,8 @@ function Dt({ render: e, ref: t, baseIndent: n = 8, indentPerLevel: a = 12, styl
525
526
  }
526
527
  });
527
528
  }
528
- function Ot({ render: e, ref: t, onClick: n, ...a }) {
529
- const r = ee(), { toggle: s } = G();
529
+ function Vt({ render: e, ref: t, onClick: n, ...a }) {
530
+ const r = ee(), { toggle: o } = G();
530
531
  return q({
531
532
  render: e,
532
533
  ref: t,
@@ -537,12 +538,12 @@ function Ot({ render: e, ref: t, onClick: n, ...a }) {
537
538
  ...a,
538
539
  "data-collapsed": r.isCollapsed ? "" : void 0,
539
540
  onClick: (l) => {
540
- l.stopPropagation(), s(r.id), n?.(l);
541
+ l.stopPropagation(), o(r.id), n?.(l);
541
542
  }
542
543
  }
543
544
  });
544
545
  }
545
- function Lt({ render: e, ref: t, ...n }) {
546
+ function Ut({ render: e, ref: t, ...n }) {
546
547
  const a = ee();
547
548
  return q({
548
549
  render: e,
@@ -555,7 +556,7 @@ function Lt({ render: e, ref: t, ...n }) {
555
556
  }
556
557
  });
557
558
  }
558
- function Ft({ render: e, ref: t, children: n, ...a }) {
559
+ function jt({ render: e, ref: t, children: n, ...a }) {
559
560
  const r = ee();
560
561
  return q({
561
562
  render: e,
@@ -568,7 +569,7 @@ function Ft({ render: e, ref: t, children: n, ...a }) {
568
569
  }
569
570
  });
570
571
  }
571
- function Wt({ render: e, ref: t, children: n, ...a }) {
572
+ function Gt({ render: e, ref: t, children: n, ...a }) {
572
573
  const r = ee();
573
574
  return q({
574
575
  render: e,
@@ -580,86 +581,86 @@ function Wt({ render: e, ref: t, children: n, ...a }) {
580
581
  }
581
582
  });
582
583
  }
583
- function Kt({ render: e, ref: t, timeRange: n, paddingEnd: a = 0, style: r, ...s }) {
584
- const l = G(), i = L(() => {
585
- const b = n ?? l.viewRange, h = Math.max(1, b.max - b.min);
584
+ function Xt({ render: e, ref: t, timeRange: n, paddingEnd: a = 0, style: r, ...o }) {
585
+ const l = G(), i = O(() => {
586
+ const v = n ?? l.viewRange, h = Math.max(1, v.max - v.min);
586
587
  return {
587
- min: b.min,
588
- max: b.max + h * Math.max(0, a)
588
+ min: v.min,
589
+ max: v.max + h * Math.max(0, a)
589
590
  };
590
591
  }, [
591
592
  n,
592
593
  l.viewRange,
593
594
  a
594
- ]), d = Math.max(1, i.max - i.min), c = {
595
+ ]), c = Math.max(1, i.max - i.min), d = {
595
596
  ...r,
596
597
  "--span-timeline-min-ms": i.min,
597
598
  "--span-timeline-max-ms": i.max,
598
- "--span-timeline-range-ms": d
599
- }, k = q({
599
+ "--span-timeline-range-ms": c
600
+ }, x = q({
600
601
  render: e,
601
602
  ref: t,
602
603
  defaultTagName: "div",
603
604
  props: {
604
- ...s,
605
- style: c,
605
+ ...o,
606
+ style: d,
606
607
  "data-span-timeline": ""
607
608
  }
608
609
  });
609
- return /* @__PURE__ */ o(ze.Provider, {
610
+ return /* @__PURE__ */ s(ze.Provider, {
610
611
  value: i,
611
- children: k
612
+ children: x
612
613
  });
613
614
  }
614
- function Vt({ render: e, ref: t, now: n, timeRange: a, style: r, ...s }) {
615
- const l = ee(), i = G(), d = ue(ze), c = Tt({
615
+ function Ht({ render: e, ref: t, now: n, timeRange: a, style: r, ...o }) {
616
+ const l = ee(), i = G(), c = ue(ze), d = zt({
616
617
  startedAt: l.startedAt,
617
618
  endedAt: l.endedAt,
618
- timeRange: a ?? d ?? i.viewRange,
619
+ timeRange: a ?? c ?? i.viewRange,
619
620
  now: n ?? i.now
620
- }), k = {
621
+ }), x = {
621
622
  ...r,
622
623
  position: "absolute",
623
624
  insetInlineStart: "var(--span-timeline-left)",
624
625
  inlineSize: "max(var(--span-timeline-width), var(--span-timeline-min-width, 0px))",
625
- "--span-timeline-left": `${c.leftPercent}%`,
626
- "--span-timeline-end": `${c.endPercent}%`,
627
- "--span-timeline-width": `${c.widthPercent}%`,
628
- "--span-timeline-duration-ms": c.durationMs
626
+ "--span-timeline-left": `${d.leftPercent}%`,
627
+ "--span-timeline-end": `${d.endPercent}%`,
628
+ "--span-timeline-width": `${d.widthPercent}%`,
629
+ "--span-timeline-duration-ms": d.durationMs
629
630
  };
630
631
  return q({
631
632
  render: e,
632
633
  ref: t,
633
634
  defaultTagName: "div",
634
635
  props: {
635
- ...s,
636
- style: k,
636
+ ...o,
637
+ style: x,
637
638
  "data-span-status": l.status,
638
639
  "data-span-type": l.type,
639
640
  "data-span-running": l.endedAt === null ? "" : void 0,
640
- "data-clipped-start": c.clippedStart ? "" : void 0,
641
- "data-clipped-end": c.clippedEnd ? "" : void 0
641
+ "data-clipped-start": d.clippedStart ? "" : void 0,
642
+ "data-clipped-end": d.clippedEnd ? "" : void 0
642
643
  }
643
644
  });
644
645
  }
645
646
  var H = {
646
- Provider: Pt,
647
- Children: zt,
648
- Root: Rt,
649
- Indent: Dt,
650
- CollapseToggle: Ot,
651
- StatusIndicator: Lt,
652
- TypeBadge: Ft,
653
- Name: Wt,
654
- Timeline: Kt,
655
- TimelineBar: Vt
656
- }, jt = (e) => {
647
+ Provider: Ft,
648
+ Children: Wt,
649
+ Root: Kt,
650
+ Indent: Bt,
651
+ CollapseToggle: Vt,
652
+ StatusIndicator: Ut,
653
+ TypeBadge: jt,
654
+ Name: Gt,
655
+ Timeline: Xt,
656
+ TimelineBar: Ht
657
+ }, Zt = (e) => {
657
658
  const t = Number(e.trim());
658
659
  return t >= 500 && t < 600;
659
- }, Re = [
660
+ }, Le = [
660
661
  {
661
662
  namespace: "db",
662
- icon: it,
663
+ icon: ht,
663
664
  pills: [{
664
665
  label: "db.system",
665
666
  keys: ["db.system.name", "db.system"]
@@ -667,11 +668,11 @@ var H = {
667
668
  },
668
669
  {
669
670
  namespace: "http",
670
- icon: gt,
671
+ icon: Mt,
671
672
  pills: [{
672
673
  label: "http.status_code",
673
674
  keys: ["http.response.status_code", "http.status_code"],
674
- error: jt
675
+ error: Zt
675
676
  }, {
676
677
  label: "http.method",
677
678
  keys: ["http.request.method", "http.method"]
@@ -679,11 +680,11 @@ var H = {
679
680
  },
680
681
  {
681
682
  namespace: "messaging",
682
- icon: ut
683
+ icon: gt
683
684
  },
684
685
  {
685
686
  namespace: "rpc",
686
- icon: tt,
687
+ icon: it,
687
688
  pills: [{
688
689
  label: "rpc.system",
689
690
  keys: ["rpc.system.name", "rpc.system"]
@@ -696,28 +697,28 @@ var H = {
696
697
  keys: ["gen_ai.request.model"]
697
698
  }]
698
699
  }
699
- ], Bt = {
700
+ ], Jt = {
700
701
  agent: {
701
- icon: ht,
702
+ icon: xt,
702
703
  label: "Agent"
703
704
  },
704
705
  llm: {
705
- icon: ve,
706
+ icon: be,
706
707
  label: "LLM call"
707
708
  },
708
709
  tool: {
709
- icon: vt,
710
+ icon: Nt,
710
711
  label: "Tool call"
711
712
  },
712
713
  retrieval: {
713
- icon: ct,
714
+ icon: ft,
714
715
  label: "Retrieval"
715
716
  },
716
717
  generic: {
717
- icon: ve,
718
+ icon: be,
718
719
  label: "GenAI span"
719
720
  }
720
- }, Ut = {
721
+ }, Yt = {
721
722
  chat: "llm",
722
723
  text_completion: "llm",
723
724
  generate_content: "llm",
@@ -727,7 +728,7 @@ var H = {
727
728
  embeddings: "retrieval",
728
729
  retrieve: "retrieval"
729
730
  };
730
- function Gt(e) {
731
+ function Qt(e) {
731
732
  if (e == null) return "";
732
733
  if (e instanceof Uint8Array) return JSON.stringify(Array.from(e));
733
734
  if (typeof e == "object") try {
@@ -737,50 +738,50 @@ function Gt(e) {
737
738
  }
738
739
  return String(e).trim();
739
740
  }
740
- function me(e, t) {
741
+ function ve(e, t) {
741
742
  if (e == null) return null;
742
743
  for (const n of t) {
743
744
  if (!(n in e)) continue;
744
- const a = Gt(e[n]);
745
+ const a = Qt(e[n]);
745
746
  if (a !== "") return a;
746
747
  }
747
748
  return null;
748
749
  }
749
- function Xt(e) {
750
+ function qt(e) {
750
751
  if (e == null) return null;
751
- const t = me(e, ["gen_ai.operation.name"]);
752
- return t != null ? Ut[t.toLowerCase()] ?? "generic" : Object.keys(e).some((n) => n.startsWith("gen_ai.")) ? "generic" : null;
752
+ const t = ve(e, ["gen_ai.operation.name"]);
753
+ return t != null ? Yt[t.toLowerCase()] ?? "generic" : Object.keys(e).some((n) => n.startsWith("gen_ai.")) ? "generic" : null;
753
754
  }
754
- function Ht(e) {
755
- const t = Xt(e);
756
- if (t != null) return Bt[t];
755
+ function en(e) {
756
+ const t = qt(e);
757
+ if (t != null) return Jt[t];
757
758
  if (e == null) return null;
758
759
  const n = /* @__PURE__ */ new Set();
759
760
  for (const a of Object.keys(e)) {
760
761
  const r = a.indexOf(".");
761
762
  r > 0 && n.add(a.slice(0, r));
762
763
  }
763
- for (const a of Re) if (a.icon && n.has(a.namespace)) return { icon: a.icon };
764
+ for (const a of Le) if (a.icon && n.has(a.namespace)) return { icon: a.icon };
764
765
  return null;
765
766
  }
766
- function Zt(e) {
767
+ function tn(e) {
767
768
  const t = [];
768
769
  if (e == null) return t;
769
- for (const n of Re) for (const a of n.pills ?? []) {
770
- const r = me(e, a.keys);
770
+ for (const n of Le) for (const a of n.pills ?? []) {
771
+ const r = ve(e, a.keys);
771
772
  if (r == null) continue;
772
- const s = {
773
+ const o = {
773
774
  label: a.label,
774
775
  value: r
775
776
  };
776
- a.error?.(r) && (s.error = !0), t.push(s);
777
+ a.error?.(r) && (o.error = !0), t.push(o);
777
778
  }
778
779
  return t;
779
780
  }
780
- function Jt(e) {
781
- return me(e, ["peer.service", "server.address"]);
781
+ function nn(e) {
782
+ return ve(e, ["peer.service", "server.address"]);
782
783
  }
783
- function Yt(e) {
784
+ function an(e) {
784
785
  return e.map((t) => {
785
786
  const n = t.endedAt ?? null, a = {
786
787
  id: t.id,
@@ -795,18 +796,18 @@ function Yt(e) {
795
796
  return t.kind != null && (a.kind = t.kind), t.service != null && (a.service = t.service), t.attributes != null && (a.attributes = t.attributes), a;
796
797
  });
797
798
  }
798
- function Qt(e, t) {
799
+ function rn(e, t) {
799
800
  return e.latencyMs != null ? Math.max(0, e.latencyMs) : e.endedAt != null ? Math.max(0, e.endedAt - e.startedAt) : t != null ? Math.max(0, t - e.startedAt) : null;
800
801
  }
801
- var xe = (e) => Math.min(1, Math.max(0, e));
802
- function ye(e, t, n) {
803
- const a = Math.max(1, t.max - t.min), r = e.endedAt ?? n ?? t.max, s = xe((e.startedAt - t.min) / a);
802
+ var we = (e) => Math.min(1, Math.max(0, e));
803
+ function Ne(e, t, n) {
804
+ const a = Math.max(1, t.max - t.min), r = e.endedAt ?? n ?? t.max, o = we((e.startedAt - t.min) / a);
804
805
  return {
805
- left: s,
806
- width: xe(Math.max(s, (r - t.min) / a)) - s
806
+ left: o,
807
+ width: we(Math.max(o, (r - t.min) / a)) - o
807
808
  };
808
809
  }
809
- function qt(e, t = 6) {
810
+ function sn(e, t = 6) {
810
811
  if (e <= 0) return 1;
811
812
  const n = e / t, a = 10 ** Math.floor(Math.log10(n));
812
813
  for (const r of [
@@ -817,14 +818,14 @@ function qt(e, t = 6) {
817
818
  ]) if (r * a >= n) return r * a;
818
819
  return 10 * a;
819
820
  }
820
- function en(e, t) {
821
+ function on(e, t) {
821
822
  const n = t - e;
822
823
  if (!(n > 0)) return [{
823
824
  at: 0,
824
825
  ms: e
825
826
  }];
826
- const a = qt(n), r = [], s = Math.ceil(e / a - 1e-9) * a;
827
- for (let l = s; l <= t + 1e-9; l += a) {
827
+ const a = sn(n), r = [], o = Math.ceil(e / a - 1e-9) * a;
828
+ for (let l = o; l <= t + 1e-9; l += a) {
828
829
  const i = Number(l.toFixed(6));
829
830
  r.push({
830
831
  at: (i - e) / n,
@@ -838,28 +839,28 @@ function Q(e) {
838
839
  const t = Math.abs(e);
839
840
  return t < 10 ? `${e.toFixed(2)} ms` : t < 100 ? `${e.toFixed(1)} ms` : t < 1e3 ? `${Math.round(e)} ms` : t < 6e4 ? `${(e / 1e3).toFixed(2)} s` : `${(e / 6e4).toFixed(1)} min`;
840
841
  }
841
- function De(e) {
842
+ function Oe(e) {
842
843
  return e === 0 ? "0" : e >= 1e3 ? `${Number((e / 1e3).toFixed(2))} s` : `${Number(e.toFixed(2))} ms`;
843
844
  }
844
- var tn = 7.5, oe = 4, nn = 4;
845
- function Oe(e, t) {
845
+ var ln = 7.5, oe = 4, cn = 4;
846
+ function Fe(e, t) {
846
847
  if (e.length === 0 || t <= 0) return [];
847
848
  const n = [];
848
849
  for (const a of e) {
849
- const r = De(a.ms), s = Math.max(r.length * tn, 8), l = a.at * t, i = l + oe + s > t, d = i ? "end" : "start", c = i ? l - oe - s : l + oe, k = i ? l - oe : l + oe + s;
850
- let b = !1;
851
- for (; n.length > 0 && !(c >= n[n.length - 1].right + nn); ) {
850
+ const r = Oe(a.ms), o = Math.max(r.length * ln, 8), l = a.at * t, i = l + oe + o > t, c = i ? "end" : "start", d = i ? l - oe - o : l + oe, x = i ? l - oe : l + oe + o;
851
+ let v = !1;
852
+ for (; n.length > 0 && !(d >= n[n.length - 1].right + cn); ) {
852
853
  if (!i) {
853
- b = !0;
854
+ v = !0;
854
855
  break;
855
856
  }
856
857
  n.pop();
857
858
  }
858
- b || n.push({
859
+ v || n.push({
859
860
  tick: a,
860
- align: d,
861
- left: c,
862
- right: k
861
+ align: c,
862
+ left: d,
863
+ right: x
863
864
  });
864
865
  }
865
866
  return n.map(({ tick: a, align: r }) => ({
@@ -867,141 +868,141 @@ function Oe(e, t) {
867
868
  align: r
868
869
  }));
869
870
  }
870
- function Vn(e, t) {
871
- return Oe(e, t).map((n) => n.ms);
871
+ function Jn(e, t) {
872
+ return Fe(e, t).map((n) => n.ms);
872
873
  }
873
874
  function K(e) {
874
875
  return `${Number((e * 100).toFixed(4))}%`;
875
876
  }
876
- var Le = "rounded-base border border-pho-secondary bg-pho-primary overflow-hidden", Fe = "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)]", an = "absolute inset-y-0 left-5 right-5", We = 20, Ke = 16, rn = 26;
877
- function sn(e) {
878
- return `${We + e * Ke + rn}px`;
877
+ var We = S(Ye, "overflow-hidden"), Ke = "grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)]", dn = "absolute inset-y-0 left-5 right-5", Be = 20, Ve = 16, un = 26;
878
+ function pn(e) {
879
+ return `${Be + e * Ve + un}px`;
879
880
  }
880
- var on = 250, we = 0.8, Ne = 0.5, ln = 0.1, cn = 0.3, dn = 5e-3, un = {
881
+ var hn = 250, ke = 0.8, Me = 0.5, mn = 0.1, fn = 0.3, vn = 5e-3, gn = {
881
882
  completed: "bg-pho-inverse/25",
882
883
  failed: "bg-pho-error-ink",
883
884
  running: "bg-pho-inverse/15 motion-safe:animate-pulse",
884
885
  skipped: "border-pho-secondary border border-dashed bg-transparent"
885
- }, ke = {
886
+ }, Ae = {
886
887
  completed: "bg-pho-inverse",
887
888
  failed: "bg-pho-error-ink",
888
889
  running: "bg-pho-inverse/40",
889
890
  skipped: "border-pho-secondary border bg-transparent"
890
- }, pn = "border-pho-error-ink border bg-transparent", hn = {
891
+ }, bn = "border-pho-error-ink border bg-transparent", xn = {
891
892
  completed: null,
892
893
  failed: "Failed.",
893
894
  running: "Running.",
894
895
  skipped: "Skipped."
895
- }, se = "text-pho-secondary outline-pho-brand hover:bg-pho-ghost-hover hover:text-pho-secondary-hover flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors duration-100 ease-linear focus-visible:outline-2 disabled:pointer-events-none disabled:opacity-40", Me = (e) => ({ backgroundImage: `linear-gradient(to ${e === "left" ? "right" : "left"}, color-mix(in srgb, var(--background-color-pho-inverse) 18%, transparent), transparent)` }), ce = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`;
896
- function Ve({ className: e, clippedStart: t, clippedEnd: n, children: a }) {
897
- return /* @__PURE__ */ w("div", {
898
- className: P("border-pho-secondary relative border-l", e),
896
+ }, se = "text-pho-secondary outline-pho-brand hover:bg-pho-ghost-hover hover:text-pho-secondary-hover flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors duration-100 ease-linear focus-visible:outline-2 disabled:pointer-events-none disabled:opacity-40", Ce = (e) => ({ backgroundImage: `linear-gradient(to ${e === "left" ? "right" : "left"}, color-mix(in srgb, var(--background-color-pho-inverse) 18%, transparent), transparent)` }), ce = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`;
897
+ function Ue({ className: e, clippedStart: t, clippedEnd: n, children: a }) {
898
+ return /* @__PURE__ */ N("div", {
899
+ className: S("border-pho-secondary relative border-l", e),
899
900
  children: [
900
- /* @__PURE__ */ o("div", {
901
+ /* @__PURE__ */ s("div", {
901
902
  "data-trace-track": "",
902
- className: an,
903
+ className: dn,
903
904
  children: a
904
905
  }),
905
- t ? /* @__PURE__ */ o("span", {
906
+ t ? /* @__PURE__ */ s("span", {
906
907
  "aria-hidden": !0,
907
908
  "data-trace-clipped": "start",
908
909
  className: "pointer-events-none absolute top-1/2 left-0 h-4 w-2 -translate-y-1/2",
909
- style: Me("left")
910
+ style: Ce("left")
910
911
  }) : null,
911
- n ? /* @__PURE__ */ o("span", {
912
+ n ? /* @__PURE__ */ s("span", {
912
913
  "aria-hidden": !0,
913
914
  "data-trace-clipped": "end",
914
915
  className: "pointer-events-none absolute top-1/2 right-0 h-4 w-2 -translate-y-1/2",
915
- style: Me("right")
916
+ style: Ce("right")
916
917
  }) : null
917
918
  ]
918
919
  });
919
920
  }
920
- function mn(e, t) {
921
+ function yn(e, t) {
921
922
  return t > 0.5 ? "inside" : e + t > 0.8 ? "before" : "after";
922
923
  }
923
- function fn(e) {
924
+ function wn(e) {
924
925
  if (!(e instanceof HTMLElement)) return !1;
925
926
  const t = e.tagName;
926
927
  return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable;
927
928
  }
928
929
  var je = de(null);
929
- function Be() {
930
+ function Ge() {
930
931
  const e = ue(je);
931
932
  if (e == null) throw new Error("Trace rows render inside Trace.Waterfall only.");
932
933
  return e;
933
934
  }
934
- function vn() {
935
- const e = Be(), t = ee(), { viewRange: n, now: a, byId: r, matches: s } = G(), { id: l, name: i, type: d, status: c, depth: k, isCollapsed: b, hasChildren: h } = t, v = e.spans.get(l), M = e.selectedId != null && e.selectedId === l, m = M && v != null ? e.renderSpanDetail?.(v) ?? null : null, g = e.renderSpanDetail != null ? `${e.idBase}-span-${l}` : void 0, N = e.onSelect ? () => e.onSelect?.(M ? null : l) : void 0, { left: x, width: _ } = ye(t, n, a), D = t.endedAt ?? a ?? n.max, E = t.startedAt < n.min && D > n.min, T = D > n.max && t.startedAt < n.max, C = D <= n.min, S = C || t.startedAt >= n.max, O = C ? "before" : "after", p = mn(x, _), f = Qt(t, a), y = f == null ? null : Q(f), A = [t.service, d].filter(Boolean).join(", "), te = b ? t.descendants : 0, z = b ? t.descendantErrors : 0, R = hn[c], V = c === "failed", W = Ht(t.attributes), ne = Zt(t.attributes), j = b && t.kind === "client" && t.serverChildId != null ? r.get(t.serverChildId) : void 0, re = j != null ? j.service ?? j.name : !h && (t.kind === "client" || t.kind === "producer") ? Jt(t.attributes) : null, I = j ? ye(j, n, a) : null, $ = s?.has(l) ?? !1, Z = e.activeMatchId === l, pe = (u) => u === "after" ? {
936
- left: `calc(${K(x + _)} + 0.375rem)`,
937
- maxWidth: `calc(${K(1 - x - _)} - 0.375rem)`
935
+ function Nn() {
936
+ const e = Ge(), t = ee(), { viewRange: n, now: a, byId: r, matches: o } = G(), { id: l, name: i, type: c, status: d, depth: x, isCollapsed: v, hasChildren: h } = t, g = e.spans.get(l), M = e.selectedId != null && e.selectedId === l, m = M && g != null ? e.renderSpanDetail?.(g) ?? null : null, b = e.renderSpanDetail != null ? `${e.idBase}-span-${l}` : void 0, k = e.onSelect ? () => e.onSelect?.(M ? null : l) : void 0, { left: y, width: T } = Ne(t, n, a), z = t.endedAt ?? a ?? n.max, $ = t.startedAt < n.min && z > n.min, E = z > n.max && t.startedAt < n.max, C = z <= n.min, _ = C || t.startedAt >= n.max, L = C ? "before" : "after", p = yn(y, T), f = rn(t, a), w = f == null ? null : Q(f), A = [t.service, c].filter(Boolean).join(", "), te = v ? t.descendants : 0, D = v ? t.descendantErrors : 0, R = xn[d], B = d === "failed", W = en(t.attributes), ne = tn(t.attributes), V = v && t.kind === "client" && t.serverChildId != null ? r.get(t.serverChildId) : void 0, re = V != null ? V.service ?? V.name : !h && (t.kind === "client" || t.kind === "producer") ? nn(t.attributes) : null, I = V ? Ne(V, n, a) : null, P = o?.has(l) ?? !1, Z = e.activeMatchId === l, pe = (u) => u === "after" ? {
937
+ left: `calc(${K(y + T)} + 0.375rem)`,
938
+ maxWidth: `calc(${K(1 - y - T)} - 0.375rem)`
938
939
  } : {
939
- right: `calc(${K(1 - x)} + 0.375rem)`,
940
- maxWidth: `calc(${K(x)} - 0.375rem)`
940
+ right: `calc(${K(1 - y)} + 0.375rem)`,
941
+ maxWidth: `calc(${K(y)} - 0.375rem)`
941
942
  };
942
- return /* @__PURE__ */ w("li", {
943
+ return /* @__PURE__ */ N("li", {
943
944
  className: "m-0",
944
- style: { "--trace-indent": sn(k) },
945
- children: [/* @__PURE__ */ w(H.Root, {
945
+ style: { "--trace-indent": pn(x) },
946
+ children: [/* @__PURE__ */ N(H.Root, {
946
947
  "data-trace-row": "",
947
948
  "data-selected": M || void 0,
948
949
  "data-active-match": Z || void 0,
949
- className: P(Fe, "relative min-h-9 items-center transition-colors", "has-[[data-trace-select]:focus-visible]:outline-pho-brand has-[[data-trace-select]:focus-visible]:outline-2 has-[[data-trace-select]:focus-visible]:-outline-offset-2", N != null && "hover:bg-pho-primary-hover", $ && "bg-pho-brand-secondary", Z && "ring-pho-brand ring-1 ring-inset", M && "bg-pho-primary-hover"),
950
- children: [/* @__PURE__ */ w(H.Indent, {
951
- baseIndent: We,
952
- indentPerLevel: Ke,
950
+ className: S(Ke, "relative min-h-9 items-center transition-colors", "has-[[data-trace-select]:focus-visible]:outline-pho-brand has-[[data-trace-select]:focus-visible]:outline-2 has-[[data-trace-select]:focus-visible]:-outline-offset-2", k != null && "hover:bg-pho-primary-hover", P && "bg-pho-brand-secondary", Z && "ring-pho-brand ring-1 ring-inset", M && "bg-pho-primary-hover"),
951
+ children: [/* @__PURE__ */ N(H.Indent, {
952
+ baseIndent: Be,
953
+ indentPerLevel: Ve,
953
954
  className: "flex min-w-0 items-center gap-1.5 py-1.5 pr-5",
954
955
  children: [
955
- h ? /* @__PURE__ */ o(H.CollapseToggle, {
956
- "aria-expanded": !b,
957
- "aria-label": `${b ? "Expand" : "Collapse"} ${i}`,
956
+ h ? /* @__PURE__ */ s(H.CollapseToggle, {
957
+ "aria-expanded": !v,
958
+ "aria-label": `${v ? "Expand" : "Collapse"} ${i}`,
958
959
  className: "text-pho-secondary outline-pho-brand hover:bg-pho-ghost-hover hover:text-pho-secondary-hover relative z-10 flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-sm transition-[color,background-color,transform] duration-100 ease-linear focus-visible:outline-2",
959
- children: /* @__PURE__ */ o(Ge, {
960
+ children: /* @__PURE__ */ s(He, {
960
961
  "aria-hidden": !0,
961
- className: P("size-4 transition-transform duration-150 ease-out", !b && "rotate-90")
962
+ className: S("size-4 transition-transform duration-150 ease-out", !v && "rotate-90")
962
963
  })
963
- }) : /* @__PURE__ */ o("span", {
964
+ }) : /* @__PURE__ */ s("span", {
964
965
  "aria-hidden": !0,
965
966
  className: "size-5 shrink-0"
966
967
  }),
967
- /* @__PURE__ */ o(H.StatusIndicator, {
968
+ /* @__PURE__ */ s(H.StatusIndicator, {
968
969
  "aria-hidden": !0,
969
- className: P("size-1.5 shrink-0 rounded-full", V ? ke.failed : z > 0 ? pn : ke[c])
970
+ className: S("size-1.5 shrink-0 rounded-full", B ? Ae.failed : D > 0 ? bn : Ae[d])
970
971
  }),
971
- W ? /* @__PURE__ */ o(W.icon, {
972
+ W ? /* @__PURE__ */ s(W.icon, {
972
973
  "data-trace-icon": "",
973
974
  role: W.label ? "img" : void 0,
974
975
  "aria-label": W.label,
975
976
  "aria-hidden": W.label ? void 0 : !0,
976
977
  className: "text-pho-description size-3.5 shrink-0"
977
978
  }) : null,
978
- /* @__PURE__ */ w(bn, {
979
+ /* @__PURE__ */ N(kn, {
979
980
  selected: M,
980
981
  expanded: e.renderSpanDetail != null ? m != null : void 0,
981
- controls: m != null ? g : void 0,
982
- onSelect: N,
982
+ controls: m != null ? b : void 0,
983
+ onSelect: k,
983
984
  children: [
984
- /* @__PURE__ */ o(H.Name, { className: "text-pho-primary truncate text-base" }),
985
- re ? /* @__PURE__ */ w("span", {
985
+ /* @__PURE__ */ s(H.Name, { className: "text-pho-primary truncate text-base" }),
986
+ re ? /* @__PURE__ */ N("span", {
986
987
  "data-trace-callee": "",
987
988
  className: "text-pho-description flex shrink-0 items-center gap-0.5 text-xs",
988
989
  children: [
989
- /* @__PURE__ */ o(qe, {
990
+ /* @__PURE__ */ s(st, {
990
991
  "aria-hidden": !0,
991
992
  className: "size-3"
992
993
  }),
993
- /* @__PURE__ */ o("span", {
994
+ /* @__PURE__ */ s("span", {
994
995
  className: "sr-only",
995
996
  children: "calls "
996
997
  }),
997
998
  re
998
999
  ]
999
1000
  }) : null,
1000
- A ? /* @__PURE__ */ o("span", {
1001
+ A ? /* @__PURE__ */ s("span", {
1001
1002
  className: "text-pho-description shrink-[3] truncate text-xs",
1002
1003
  children: A
1003
1004
  }) : null,
1004
- ne.map((u) => /* @__PURE__ */ o(Je, {
1005
+ ne.map((u) => /* @__PURE__ */ s(nt, {
1005
1006
  size: "xs",
1006
1007
  contrast: "low",
1007
1008
  color: u.error ? "error" : "gray",
@@ -1012,43 +1013,43 @@ function vn() {
1012
1013
  className: "max-w-32 shrink-0 truncate",
1013
1014
  children: u.value
1014
1015
  }, u.label)),
1015
- te > 0 ? /* @__PURE__ */ w("span", {
1016
+ te > 0 ? /* @__PURE__ */ N("span", {
1016
1017
  className: "text-pho-description shrink-0 text-xs tabular-nums",
1017
1018
  children: [
1018
1019
  "(",
1019
1020
  te,
1020
- z > 0 ? `, ${ce(z, "error")}` : "",
1021
+ D > 0 ? `, ${ce(D, "error")}` : "",
1021
1022
  ")"
1022
1023
  ]
1023
1024
  }) : null,
1024
- R ? /* @__PURE__ */ o("span", {
1025
+ R ? /* @__PURE__ */ s("span", {
1025
1026
  className: "sr-only",
1026
1027
  children: R
1027
1028
  }) : null,
1028
- z > 0 ? /* @__PURE__ */ w("span", {
1029
+ D > 0 ? /* @__PURE__ */ N("span", {
1029
1030
  className: "sr-only",
1030
- children: [ce(z, "error"), " hidden."]
1031
+ children: [ce(D, "error"), " hidden."]
1031
1032
  }) : null
1032
1033
  ]
1033
1034
  })
1034
1035
  ]
1035
- }), /* @__PURE__ */ w(Ve, {
1036
+ }), /* @__PURE__ */ N(Ue, {
1036
1037
  className: "h-9",
1037
- clippedStart: E,
1038
- clippedEnd: T,
1038
+ clippedStart: $,
1039
+ clippedEnd: E,
1039
1040
  children: [
1040
- /* @__PURE__ */ o(H.TimelineBar, {
1041
+ /* @__PURE__ */ s(H.TimelineBar, {
1041
1042
  "aria-hidden": !0,
1042
1043
  "data-trace-bar": "",
1043
- className: P("top-1/2 h-4 -translate-y-1/2 rounded-sm transition-[inset-inline-start,inline-size] duration-200 ease-out motion-reduce:transition-none", un[c], E && "-ml-5 box-content rounded-l-none pl-5", T && "box-content rounded-r-none pr-5", S && "invisible"),
1044
+ className: S("top-1/2 h-4 -translate-y-1/2 rounded-sm transition-[inset-inline-start,inline-size] duration-200 ease-out motion-reduce:transition-none", gn[d], $ && "-ml-5 box-content rounded-l-none pl-5", E && "box-content rounded-r-none pr-5", _ && "invisible"),
1044
1045
  style: { "--span-timeline-min-width": "2px" },
1045
- children: p === "inside" && y ? /* @__PURE__ */ o("span", {
1046
+ children: p === "inside" && w ? /* @__PURE__ */ s("span", {
1046
1047
  "data-trace-label": "short",
1047
- className: P("absolute inset-y-0 flex items-center text-xs whitespace-nowrap tabular-nums", T ? "right-[1.625rem]" : "right-1.5", V ? "text-pho-on-brand" : "text-pho-primary"),
1048
- children: y
1048
+ className: S("absolute inset-y-0 flex items-center text-xs whitespace-nowrap tabular-nums", E ? "right-[1.625rem]" : "right-1.5", B ? "text-pho-on-brand" : "text-pho-primary"),
1049
+ children: w
1049
1050
  }) : null
1050
1051
  }),
1051
- j && I ? /* @__PURE__ */ o("span", {
1052
+ V && I ? /* @__PURE__ */ s("span", {
1052
1053
  "aria-hidden": !0,
1053
1054
  "data-trace-rpc": "",
1054
1055
  className: "bg-pho-inverse/45 absolute top-1/2 h-2 -translate-y-1/2 rounded-sm",
@@ -1058,32 +1059,32 @@ function vn() {
1058
1059
  minWidth: "2px"
1059
1060
  }
1060
1061
  }) : null,
1061
- S && y ? /* @__PURE__ */ o("span", {
1062
+ _ && w ? /* @__PURE__ */ s("span", {
1062
1063
  "aria-hidden": !0,
1063
1064
  "data-trace-label": "outside",
1064
- "data-side": O,
1065
- className: P("text-pho-description absolute top-1/2 -translate-y-1/2 text-xs whitespace-nowrap tabular-nums opacity-60", O === "before" ? "left-0" : "right-0"),
1066
- children: O === "before" ? `‹ ${y}` : `${y} ›`
1065
+ "data-side": L,
1066
+ className: S("text-pho-description absolute top-1/2 -translate-y-1/2 text-xs whitespace-nowrap tabular-nums opacity-60", L === "before" ? "left-0" : "right-0"),
1067
+ children: L === "before" ? `‹ ${w}` : `${w} ›`
1067
1068
  }) : null,
1068
- !S && p !== "inside" && y ? /* @__PURE__ */ o("span", {
1069
+ !_ && p !== "inside" && w ? /* @__PURE__ */ s("span", {
1069
1070
  "aria-hidden": !0,
1070
1071
  "data-trace-label": "short",
1071
1072
  className: "text-pho-description absolute top-1/2 -translate-y-1/2 truncate text-xs tabular-nums",
1072
1073
  style: pe(p),
1073
- children: y
1074
+ children: w
1074
1075
  }) : null,
1075
- y ? /* @__PURE__ */ o("span", {
1076
+ w ? /* @__PURE__ */ s("span", {
1076
1077
  className: "sr-only",
1077
- children: y
1078
+ children: w
1078
1079
  }) : null
1079
1080
  ]
1080
1081
  })]
1081
- }), m != null ? /* @__PURE__ */ o(fe.Root, {
1082
+ }), m != null ? /* @__PURE__ */ s(ge.Root, {
1082
1083
  open: !0,
1083
- children: /* @__PURE__ */ o(fe.Panel, {
1084
+ children: /* @__PURE__ */ s(ge.Panel, {
1084
1085
  className: "motion-reduce:transition-none",
1085
- children: /* @__PURE__ */ o("section", {
1086
- id: g,
1086
+ children: /* @__PURE__ */ s("section", {
1087
+ id: b,
1087
1088
  "data-trace-detail": "",
1088
1089
  className: "border-pho-secondary bg-pho-page border-t py-3 pr-5",
1089
1090
  style: { paddingLeft: "var(--trace-indent)" },
@@ -1093,144 +1094,144 @@ function vn() {
1093
1094
  }) : null]
1094
1095
  });
1095
1096
  }
1096
- function bn({ selected: e, expanded: t, controls: n, onSelect: a, children: r }) {
1097
- const s = "flex min-w-0 flex-1 items-baseline gap-2 text-left";
1098
- return a == null ? /* @__PURE__ */ o("span", {
1099
- className: s,
1097
+ function kn({ selected: e, expanded: t, controls: n, onSelect: a, children: r }) {
1098
+ const o = "flex min-w-0 flex-1 items-baseline gap-2 text-left";
1099
+ return a == null ? /* @__PURE__ */ s("span", {
1100
+ className: o,
1100
1101
  children: r
1101
- }) : /* @__PURE__ */ o("button", {
1102
+ }) : /* @__PURE__ */ s("button", {
1102
1103
  type: "button",
1103
1104
  "data-trace-select": "",
1104
1105
  "aria-current": e ? "true" : void 0,
1105
1106
  "aria-expanded": t,
1106
1107
  "aria-controls": n,
1107
1108
  onClick: a,
1108
- className: P(s, "cursor-pointer outline-none after:absolute after:inset-0 after:content-['']"),
1109
+ className: S(o, "cursor-pointer outline-none after:absolute after:inset-0 after:content-['']"),
1109
1110
  children: r
1110
1111
  });
1111
1112
  }
1112
- function gn(e) {
1113
+ function Mn(e) {
1113
1114
  const [t, n] = Y(void 0);
1114
1115
  return ae(() => {
1115
1116
  if (!e) return;
1116
1117
  n(Date.now());
1117
- const a = setInterval(() => n(Date.now()), on);
1118
+ const a = setInterval(() => n(Date.now()), hn);
1118
1119
  return () => clearInterval(a);
1119
1120
  }, [e]), e ? t : void 0;
1120
1121
  }
1121
- function xn({ spans: e, now: t, selectedId: n, onSelect: a, renderSpanDetail: r, defaultCollapsed: s, collapsed: l, onCollapsedChange: i, foldControls: d = !0, search: c, query: k, onQueryChange: b, defaultView: h, view: v, onViewChange: M, shortcuts: m = "focus", footer: g, className: N, ...x }) {
1122
- const _ = L(() => Yt(e), [e]), D = L(() => new Map(e.map((y) => [y.id, y])), [e]), E = gn(_.some((y) => y.endedAt == null) && t === void 0), T = t ?? E, [C, S] = Y(""), O = k ?? C, p = F((y) => {
1123
- k == null && S(y), b?.(y);
1124
- }, [k, b]), f = L(() => _.filter((y) => y.status === "failed").length, [_]);
1125
- return /* @__PURE__ */ o(H.Provider, {
1126
- spans: _,
1127
- now: T,
1128
- defaultCollapsed: s,
1122
+ function An({ spans: e, now: t, selectedId: n, onSelect: a, renderSpanDetail: r, defaultCollapsed: o, collapsed: l, onCollapsedChange: i, foldControls: c = !0, search: d, query: x, onQueryChange: v, defaultView: h, view: g, onViewChange: M, shortcuts: m = "focus", footer: b, className: k, ...y }) {
1123
+ const T = O(() => an(e), [e]), z = O(() => new Map(e.map((w) => [w.id, w])), [e]), $ = Mn(T.some((w) => w.endedAt == null) && t === void 0), E = t ?? $, [C, _] = Y(""), L = x ?? C, p = F((w) => {
1124
+ x == null && _(w), v?.(w);
1125
+ }, [x, v]), f = O(() => T.filter((w) => w.status === "failed").length, [T]);
1126
+ return /* @__PURE__ */ s(H.Provider, {
1127
+ spans: T,
1128
+ now: E,
1129
+ defaultCollapsed: o,
1129
1130
  collapsed: l,
1130
1131
  onCollapsedChange: i,
1131
- query: O,
1132
+ query: L,
1132
1133
  defaultView: h,
1133
- view: v,
1134
+ view: g,
1134
1135
  onViewChange: M,
1135
- children: /* @__PURE__ */ o(yn, {
1136
- sources: D,
1137
- spanCount: _.length,
1136
+ children: /* @__PURE__ */ s(Cn, {
1137
+ sources: z,
1138
+ spanCount: T.length,
1138
1139
  errorCount: f,
1139
1140
  selectedId: n,
1140
1141
  onSelect: a,
1141
1142
  renderSpanDetail: r,
1142
- foldControls: d,
1143
- search: c,
1144
- query: O,
1143
+ foldControls: c,
1144
+ search: d,
1145
+ query: L,
1145
1146
  setQuery: p,
1146
1147
  shortcuts: m,
1147
- footer: g,
1148
- className: N,
1149
- ...x
1148
+ footer: b,
1149
+ className: k,
1150
+ ...y
1150
1151
  })
1151
1152
  });
1152
1153
  }
1153
- function yn({ sources: e, spanCount: t, errorCount: n, selectedId: a, onSelect: r, renderSpanDetail: s, foldControls: l, search: i, query: d, setQuery: c, shortcuts: k, footer: b, className: h, ref: v, ...M }) {
1154
- const { all: m, matches: g, zoomed: N, zoom: x, pan: _, resetView: D, expandAll: E, collapseAll: T, expandOne: C, collapseOne: S } = G(), O = Ye(), p = he(null), f = he(null), y = F((u) => {
1155
- p.current = u, typeof v == "function" ? v(u) : v != null && (v.current = u);
1156
- }, [v]), A = L(() => g == null ? [] : m.filter((u) => g.has(u.id)).map((u) => u.id), [m, g]), [te, z] = Y(0);
1157
- ae(() => z(0), [d]);
1158
- const R = A.length > 0 ? A[te % A.length] ?? null : null, V = F((u) => {
1159
- A.length !== 0 && z((B) => (B + u + A.length) % A.length);
1154
+ function Cn({ sources: e, spanCount: t, errorCount: n, selectedId: a, onSelect: r, renderSpanDetail: o, foldControls: l, search: i, query: c, setQuery: d, shortcuts: x, footer: v, className: h, ref: g, ...M }) {
1155
+ const { all: m, matches: b, zoomed: k, zoom: y, pan: T, resetView: z, expandAll: $, collapseAll: E, expandOne: C, collapseOne: _ } = G(), L = at(), p = fe(null), f = fe(null), w = F((u) => {
1156
+ p.current = u, typeof g == "function" ? g(u) : g != null && (g.current = u);
1157
+ }, [g]), A = O(() => b == null ? [] : m.filter((u) => b.has(u.id)).map((u) => u.id), [m, b]), [te, D] = Y(0);
1158
+ ae(() => D(0), [c]);
1159
+ const R = A.length > 0 ? A[te % A.length] ?? null : null, B = F((u) => {
1160
+ A.length !== 0 && D((U) => (U + u + A.length) % A.length);
1160
1161
  }, [A.length]);
1161
1162
  ae(() => {
1162
1163
  if (R == null) return;
1163
1164
  const u = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(R) : R.replace(/"/g, '\\"');
1164
1165
  p.current?.querySelector(`[data-trace-row][data-span-id="${u}"]`)?.scrollIntoView?.({ block: "nearest" });
1165
1166
  }, [R]);
1166
- const W = d !== "", ne = a != null && r != null;
1167
+ const W = c !== "", ne = a != null && r != null;
1167
1168
  ae(() => {
1168
- if (!W && !N && !ne || k === !1) return;
1169
- const u = (B) => {
1170
- B.key === "Escape" && (k === "focus" && !(B.target instanceof Node && p.current?.contains(B.target)) || (B.preventDefault(), B.stopPropagation(), W ? c("") : N ? D() : r?.(null)));
1169
+ if (!W && !k && !ne || x === !1) return;
1170
+ const u = (U) => {
1171
+ U.key === "Escape" && (x === "focus" && !(U.target instanceof Node && p.current?.contains(U.target)) || (U.preventDefault(), U.stopPropagation(), W ? d("") : k ? z() : r?.(null)));
1171
1172
  };
1172
1173
  return document.addEventListener("keydown", u, !0), () => document.removeEventListener("keydown", u, !0);
1173
1174
  }, [
1174
1175
  W,
1175
- N,
1176
- ne,
1177
1176
  k,
1178
- c,
1179
- D,
1177
+ ne,
1178
+ x,
1179
+ d,
1180
+ z,
1180
1181
  r
1181
1182
  ]);
1182
- const j = F((u) => {
1183
- if (u.metaKey || u.ctrlKey || u.altKey || fn(u.target)) return !1;
1183
+ const V = F((u) => {
1184
+ if (u.metaKey || u.ctrlKey || u.altKey || wn(u.target)) return !1;
1184
1185
  switch (u.key) {
1185
1186
  case "[":
1186
- return E(), !0;
1187
+ return $(), !0;
1187
1188
  case "]":
1188
- return T(), !0;
1189
+ return E(), !0;
1189
1190
  case "o":
1190
1191
  return C(), !0;
1191
1192
  case "p":
1192
- return S(), !0;
1193
+ return _(), !0;
1193
1194
  case "ArrowUp":
1194
- return x(u.shiftKey ? Ne : we), !0;
1195
+ return y(u.shiftKey ? Me : ke), !0;
1195
1196
  case "ArrowDown":
1196
- return N ? (x(u.shiftKey ? 1 / Ne : 1 / we), !0) : !1;
1197
+ return k ? (y(u.shiftKey ? 1 / Me : 1 / ke), !0) : !1;
1197
1198
  case "ArrowLeft":
1198
- return N ? (_(u.shiftKey ? -0.3 : -0.1), !0) : !1;
1199
+ return k ? (T(u.shiftKey ? -0.3 : -0.1), !0) : !1;
1199
1200
  case "ArrowRight":
1200
- return N ? (_(u.shiftKey ? cn : ln), !0) : !1;
1201
+ return k ? (T(u.shiftKey ? fn : mn), !0) : !1;
1201
1202
  case "/":
1202
1203
  return f.current == null ? !1 : (f.current.focus(), !0);
1203
1204
  case "f":
1204
- return A.length === 0 ? !1 : (V(1), !0);
1205
+ return A.length === 0 ? !1 : (B(1), !0);
1205
1206
  case "b":
1206
- return A.length === 0 ? !1 : (V(-1), !0);
1207
+ return A.length === 0 ? !1 : (B(-1), !0);
1207
1208
  default:
1208
1209
  return !1;
1209
1210
  }
1210
1211
  }, [
1212
+ $,
1211
1213
  E,
1212
- T,
1213
1214
  C,
1214
- S,
1215
- x,
1216
1215
  _,
1217
- N,
1216
+ y,
1217
+ T,
1218
+ k,
1218
1219
  A.length,
1219
- V
1220
+ B
1220
1221
  ]);
1221
1222
  ae(() => {
1222
- if (k === !1) return;
1223
- const u = (B) => {
1224
- k === "focus" && !(B.target instanceof Node && p.current?.contains(B.target)) || j(B) && B.preventDefault();
1223
+ if (x === !1) return;
1224
+ const u = (U) => {
1225
+ x === "focus" && !(U.target instanceof Node && p.current?.contains(U.target)) || V(U) && U.preventDefault();
1225
1226
  };
1226
1227
  return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
1227
- }, [k, j]);
1228
- const re = L(() => ({
1228
+ }, [x, V]);
1229
+ const re = O(() => ({
1229
1230
  spans: e,
1230
1231
  selectedId: a,
1231
1232
  onSelect: r,
1232
- renderSpanDetail: s,
1233
- idBase: O,
1233
+ renderSpanDetail: o,
1234
+ idBase: L,
1234
1235
  spanCount: t,
1235
1236
  errorCount: n,
1236
1237
  activeMatchId: R
@@ -1238,163 +1239,163 @@ function yn({ sources: e, spanCount: t, errorCount: n, selectedId: a, onSelect:
1238
1239
  e,
1239
1240
  a,
1240
1241
  r,
1241
- s,
1242
- O,
1242
+ o,
1243
+ L,
1243
1244
  t,
1244
1245
  n,
1245
1246
  R
1246
- ]), I = m.some((u) => u.hasChildren), $ = i === !0 || typeof i == "string", Z = typeof i == "string" ? i : "Search spans", pe = b === void 0 ? t > 0 ? /* @__PURE__ */ o(Ue, {}) : null : b;
1247
- return /* @__PURE__ */ o(je.Provider, {
1247
+ ]), I = m.some((u) => u.hasChildren), P = i === !0 || typeof i == "string", Z = typeof i == "string" ? i : "Search spans", pe = v === void 0 ? t > 0 ? /* @__PURE__ */ s(Xe, {}) : null : v;
1248
+ return /* @__PURE__ */ s(je.Provider, {
1248
1249
  value: re,
1249
- children: /* @__PURE__ */ w("section", {
1250
- ref: y,
1250
+ children: /* @__PURE__ */ N("section", {
1251
+ ref: w,
1251
1252
  "data-trace": "",
1252
- "data-zoomed": N || void 0,
1253
+ "data-zoomed": k || void 0,
1253
1254
  "aria-label": "Trace",
1254
- tabIndex: k === "focus" ? -1 : void 0,
1255
- className: P(Le, "min-w-0 outline-none", h),
1255
+ tabIndex: x === "focus" ? -1 : void 0,
1256
+ className: S(We, "min-w-0 outline-none", h),
1256
1257
  ...M,
1257
1258
  children: [
1258
- $ ? /* @__PURE__ */ w("div", {
1259
+ P ? /* @__PURE__ */ N("div", {
1259
1260
  "data-trace-toolbar": "",
1260
1261
  className: "border-pho-secondary flex min-h-10 items-center gap-3 border-b px-5",
1261
- children: [/* @__PURE__ */ o(He, {
1262
+ children: [/* @__PURE__ */ s(et, {
1262
1263
  ref: f,
1263
- value: d,
1264
- onChange: c,
1264
+ value: c,
1265
+ onChange: d,
1265
1266
  placeholder: Z,
1266
1267
  "aria-label": Z,
1267
1268
  onKeyDown: (u) => {
1268
- u.key === "Enter" ? (u.preventDefault(), V(u.shiftKey ? -1 : 1)) : u.key === "Escape" && d !== "" && (u.preventDefault(), c(""));
1269
+ u.key === "Enter" ? (u.preventDefault(), B(u.shiftKey ? -1 : 1)) : u.key === "Escape" && c !== "" && (u.preventDefault(), d(""));
1269
1270
  }
1270
- }), W ? /* @__PURE__ */ w(_e, { children: [/* @__PURE__ */ o("span", {
1271
+ }), W ? /* @__PURE__ */ N(Ee, { children: [/* @__PURE__ */ s("span", {
1271
1272
  "data-trace-match-count": "",
1272
1273
  "aria-live": "polite",
1273
1274
  className: "text-pho-description shrink-0 text-xs tabular-nums",
1274
1275
  children: A.length === 0 ? "No matches" : `${te % A.length + 1} of ${A.length}`
1275
- }), /* @__PURE__ */ w("span", {
1276
+ }), /* @__PURE__ */ N("span", {
1276
1277
  className: "flex shrink-0 items-center",
1277
- children: [/* @__PURE__ */ o("button", {
1278
+ children: [/* @__PURE__ */ s("button", {
1278
1279
  type: "button",
1279
1280
  "aria-label": "Previous match",
1280
1281
  title: "Previous match (b)",
1281
1282
  disabled: A.length === 0,
1282
- onClick: () => V(-1),
1283
+ onClick: () => B(-1),
1283
1284
  className: se,
1284
- children: /* @__PURE__ */ o(Ie, {
1285
+ children: /* @__PURE__ */ s(Te, {
1285
1286
  "aria-hidden": !0,
1286
1287
  className: "size-4"
1287
1288
  })
1288
- }), /* @__PURE__ */ o("button", {
1289
+ }), /* @__PURE__ */ s("button", {
1289
1290
  type: "button",
1290
1291
  "aria-label": "Next match",
1291
1292
  title: "Next match (f)",
1292
1293
  disabled: A.length === 0,
1293
- onClick: () => V(1),
1294
+ onClick: () => B(1),
1294
1295
  className: se,
1295
- children: /* @__PURE__ */ o(Se, {
1296
+ children: /* @__PURE__ */ s(Ie, {
1296
1297
  "aria-hidden": !0,
1297
1298
  className: "size-4"
1298
1299
  })
1299
1300
  })]
1300
1301
  })] }) : null]
1301
1302
  }) : null,
1302
- /* @__PURE__ */ w("div", {
1303
+ /* @__PURE__ */ N("div", {
1303
1304
  "data-trace-axis": "",
1304
- className: P(Fe, "border-pho-secondary h-10 border-b"),
1305
- children: [/* @__PURE__ */ w("div", {
1305
+ className: S(Ke, "border-pho-secondary h-10 border-b"),
1306
+ children: [/* @__PURE__ */ N("div", {
1306
1307
  className: "flex h-10 min-w-0 items-center gap-2 px-5",
1307
- children: [N ? /* @__PURE__ */ o(wn, {}) : null, l && I ? /* @__PURE__ */ o(Nn, {}) : null]
1308
- }), /* @__PURE__ */ o(kn, {})]
1308
+ children: [k ? /* @__PURE__ */ s(Sn, {}) : null, l && I ? /* @__PURE__ */ s(_n, {}) : null]
1309
+ }), /* @__PURE__ */ s(In, {})]
1309
1310
  }),
1310
- /* @__PURE__ */ o(H.Timeline, {
1311
- render: /* @__PURE__ */ o("ol", {
1311
+ /* @__PURE__ */ s(H.Timeline, {
1312
+ render: /* @__PURE__ */ s("ol", {
1312
1313
  "aria-label": "Spans",
1313
1314
  className: "m-0 list-none p-0"
1314
1315
  }),
1315
- children: /* @__PURE__ */ o(H.Children, { children: () => /* @__PURE__ */ o(vn, {}) })
1316
+ children: /* @__PURE__ */ s(H.Children, { children: () => /* @__PURE__ */ s(Nn, {}) })
1316
1317
  }),
1317
1318
  pe
1318
1319
  ]
1319
1320
  })
1320
1321
  });
1321
1322
  }
1322
- function wn() {
1323
+ function Sn() {
1323
1324
  const { range: e, viewRange: t, resetView: n } = G(), a = `${Q(t.min - e.min)} – ${Q(t.max - e.min)}`;
1324
- return /* @__PURE__ */ w("button", {
1325
+ return /* @__PURE__ */ N("button", {
1325
1326
  type: "button",
1326
1327
  "data-trace-zoom-chip": "",
1327
1328
  onClick: n,
1328
1329
  title: "Reset zoom (Esc)",
1329
1330
  "aria-label": `Zoomed to ${a}. Reset zoom`,
1330
- className: P(Ze({
1331
+ className: S(tt({
1331
1332
  size: "xs",
1332
1333
  contrast: "low",
1333
1334
  color: "brand"
1334
1335
  }), "outline-pho-brand shrink-0 cursor-pointer focus-visible:outline-2"),
1335
- children: [/* @__PURE__ */ o("span", {
1336
+ children: [/* @__PURE__ */ s("span", {
1336
1337
  "aria-hidden": !0,
1337
1338
  children: a
1338
- }), /* @__PURE__ */ o(Xe, {
1339
+ }), /* @__PURE__ */ s(Ze, {
1339
1340
  "aria-hidden": !0,
1340
1341
  className: "size-3"
1341
1342
  })]
1342
1343
  });
1343
1344
  }
1344
- function Nn() {
1345
- const { canExpand: e, canCollapse: t, expandAll: n, collapseAll: a, expandOne: r, collapseOne: s } = G();
1346
- return /* @__PURE__ */ w("fieldset", {
1345
+ function _n() {
1346
+ const { canExpand: e, canCollapse: t, expandAll: n, collapseAll: a, expandOne: r, collapseOne: o } = G();
1347
+ return /* @__PURE__ */ N("fieldset", {
1347
1348
  "data-trace-fold-controls": "",
1348
1349
  className: "m-0 ml-auto flex min-w-0 shrink-0 items-center border-0 p-0",
1349
1350
  children: [
1350
- /* @__PURE__ */ o("legend", {
1351
+ /* @__PURE__ */ s("legend", {
1351
1352
  className: "sr-only",
1352
1353
  children: "Fold"
1353
1354
  }),
1354
- /* @__PURE__ */ o("button", {
1355
+ /* @__PURE__ */ s("button", {
1355
1356
  type: "button",
1356
1357
  "aria-label": "Expand one level",
1357
1358
  title: "Expand one level (o)",
1358
1359
  disabled: !e,
1359
1360
  onClick: r,
1360
1361
  className: se,
1361
- children: /* @__PURE__ */ o(Se, {
1362
+ children: /* @__PURE__ */ s(Ie, {
1362
1363
  "aria-hidden": !0,
1363
1364
  className: "size-4"
1364
1365
  })
1365
1366
  }),
1366
- /* @__PURE__ */ o("button", {
1367
+ /* @__PURE__ */ s("button", {
1367
1368
  type: "button",
1368
1369
  "aria-label": "Collapse one level",
1369
1370
  title: "Collapse one level (p)",
1370
1371
  disabled: !t,
1371
- onClick: s,
1372
+ onClick: o,
1372
1373
  className: se,
1373
- children: /* @__PURE__ */ o(Ie, {
1374
+ children: /* @__PURE__ */ s(Te, {
1374
1375
  "aria-hidden": !0,
1375
1376
  className: "size-4"
1376
1377
  })
1377
1378
  }),
1378
- /* @__PURE__ */ o("button", {
1379
+ /* @__PURE__ */ s("button", {
1379
1380
  type: "button",
1380
1381
  "aria-label": "Expand all",
1381
1382
  title: "Expand all ([)",
1382
1383
  disabled: !e,
1383
1384
  onClick: n,
1384
1385
  className: se,
1385
- children: /* @__PURE__ */ o(at, {
1386
+ children: /* @__PURE__ */ s(ct, {
1386
1387
  "aria-hidden": !0,
1387
1388
  className: "size-4"
1388
1389
  })
1389
1390
  }),
1390
- /* @__PURE__ */ o("button", {
1391
+ /* @__PURE__ */ s("button", {
1391
1392
  type: "button",
1392
1393
  "aria-label": "Collapse all",
1393
1394
  title: "Collapse all (])",
1394
1395
  disabled: !t,
1395
1396
  onClick: a,
1396
1397
  className: se,
1397
- children: /* @__PURE__ */ o(st, {
1398
+ children: /* @__PURE__ */ s(ut, {
1398
1399
  "aria-hidden": !0,
1399
1400
  className: "size-4"
1400
1401
  })
@@ -1402,61 +1403,61 @@ function Nn() {
1402
1403
  ]
1403
1404
  });
1404
1405
  }
1405
- function kn() {
1406
- const { range: e, view: t, zoomed: n, setView: a, resetView: r } = G(), s = e.max - e.min, l = L(() => en(0, s), [s]), [i, d] = Y(280), c = he(null);
1406
+ function In() {
1407
+ const { range: e, view: t, zoomed: n, setView: a, resetView: r } = G(), o = e.max - e.min, l = O(() => on(0, o), [o]), [i, c] = Y(280), d = fe(null);
1407
1408
  ae(() => {
1408
- const p = c.current;
1409
+ const p = d.current;
1409
1410
  if (p == null) return;
1410
1411
  const f = () => {
1411
1412
  const A = p.clientWidth;
1412
- A > 0 && d(A);
1413
+ A > 0 && c(A);
1413
1414
  };
1414
1415
  f();
1415
- const y = new ResizeObserver(f);
1416
- return y.observe(p), () => y.disconnect();
1416
+ const w = new ResizeObserver(f);
1417
+ return w.observe(p), () => w.disconnect();
1417
1418
  }, []);
1418
- const k = new Map(Oe(l, i).map((p) => [p.ms, p.align])), [b, h] = Y(null), [v, M] = Y(null), m = (p) => {
1419
- const f = c.current?.getBoundingClientRect();
1419
+ const x = new Map(Fe(l, i).map((p) => [p.ms, p.align])), [v, h] = Y(null), [g, M] = Y(null), m = (p) => {
1420
+ const f = d.current?.getBoundingClientRect();
1420
1421
  return f == null || f.width <= 0 ? 0 : Math.min(1, Math.max(0, (p.clientX - f.left) / f.width));
1421
- }, g = (p, f) => {
1422
- c.current?.setPointerCapture?.(p.pointerId), M(f);
1423
- }, N = (p) => {
1422
+ }, b = (p, f) => {
1423
+ d.current?.setPointerCapture?.(p.pointerId), M(f);
1424
+ }, k = (p) => {
1424
1425
  if (p.button !== 0) return;
1425
1426
  const f = m(p);
1426
- g(p, {
1427
+ b(p, {
1427
1428
  kind: "select",
1428
1429
  from: f,
1429
1430
  to: f
1430
1431
  });
1431
- }, x = (p) => (f) => {
1432
- f.button === 0 && (f.stopPropagation(), g(f, {
1432
+ }, y = (p) => (f) => {
1433
+ f.button === 0 && (f.stopPropagation(), b(f, {
1433
1434
  kind: "resize",
1434
1435
  edge: p
1435
1436
  }));
1436
- }, _ = (p) => {
1437
+ }, T = (p) => {
1437
1438
  const f = m(p);
1438
- if (v == null) {
1439
+ if (g == null) {
1439
1440
  h(f);
1440
1441
  return;
1441
1442
  }
1442
- v.kind === "select" ? M({
1443
- ...v,
1443
+ g.kind === "select" ? M({
1444
+ ...g,
1444
1445
  to: f
1445
- }) : a(v.edge === "start" ? [Math.min(f, t[1] - J), t[1]] : [t[0], Math.max(f, t[0] + J)]);
1446
- }, D = (p) => {
1447
- if (v == null) return;
1446
+ }) : a(g.edge === "start" ? [Math.min(f, t[1] - J), t[1]] : [t[0], Math.max(f, t[0] + J)]);
1447
+ }, z = (p) => {
1448
+ if (g == null) return;
1448
1449
  const f = m(p);
1449
- if (M(null), v.kind !== "select") {
1450
- a(v.edge === "start" ? [Math.min(f, t[1] - J), t[1]] : [t[0], Math.max(f, t[0] + J)]);
1450
+ if (M(null), g.kind !== "select") {
1451
+ a(g.edge === "start" ? [Math.min(f, t[1] - J), t[1]] : [t[0], Math.max(f, t[0] + J)]);
1451
1452
  return;
1452
1453
  }
1453
- const [y, A] = v.from < f ? [v.from, f] : [f, v.from];
1454
- A - y < dn || a([y, A]);
1455
- }, E = () => {
1454
+ const [w, A] = g.from < f ? [g.from, f] : [f, g.from];
1455
+ A - w < vn || a([w, A]);
1456
+ }, $ = () => {
1456
1457
  h(null), M(null);
1457
- }, T = () => {
1458
- h(null), v?.kind === "select" && M(null);
1459
- }, C = v?.kind === "select" ? v : null, S = C != null ? C.from < C.to ? {
1458
+ }, E = () => {
1459
+ h(null), g?.kind === "select" && M(null);
1460
+ }, C = g?.kind === "select" ? g : null, _ = C != null ? C.from < C.to ? {
1460
1461
  left: C.from,
1461
1462
  width: C.to - C.from
1462
1463
  } : {
@@ -1465,242 +1466,252 @@ function kn() {
1465
1466
  } : n ? {
1466
1467
  left: t[0],
1467
1468
  width: t[1] - t[0]
1468
- } : null, O = (p) => p * s;
1469
- return /* @__PURE__ */ o(Ve, {
1469
+ } : null, L = (p) => p * o;
1470
+ return /* @__PURE__ */ s(Ue, {
1470
1471
  className: "h-10",
1471
- children: /* @__PURE__ */ w("div", {
1472
- ref: c,
1472
+ children: /* @__PURE__ */ N("div", {
1473
+ ref: d,
1473
1474
  "aria-hidden": !0,
1474
1475
  role: "presentation",
1475
1476
  "data-trace-axis-track": "",
1476
1477
  title: "Drag to zoom, double-click to reset",
1477
1478
  className: "absolute inset-0 cursor-crosshair touch-none select-none",
1478
- onPointerDown: N,
1479
- onPointerMove: _,
1480
- onPointerUp: D,
1481
- onPointerCancel: E,
1482
- onPointerLeave: T,
1479
+ onPointerDown: k,
1480
+ onPointerMove: T,
1481
+ onPointerUp: z,
1482
+ onPointerCancel: $,
1483
+ onPointerLeave: E,
1483
1484
  onDoubleClick: r,
1484
1485
  children: [
1485
1486
  l.map((p) => {
1486
- const f = k.get(p.ms);
1487
- return /* @__PURE__ */ w("span", {
1487
+ const f = x.get(p.ms);
1488
+ return /* @__PURE__ */ N("span", {
1488
1489
  "data-trace-tick": "",
1489
1490
  "data-labeled": f != null || void 0,
1490
1491
  className: "text-pho-description absolute inset-y-0 text-xs tabular-nums",
1491
1492
  style: { left: K(p.at) },
1492
- children: [/* @__PURE__ */ o("span", { className: "bg-pho-secondary absolute bottom-0 left-0 h-1.5 w-px" }), f != null ? /* @__PURE__ */ o("span", {
1493
- className: P("absolute inset-y-0 flex items-center whitespace-nowrap", f === "end" ? "right-1" : "left-1"),
1494
- children: De(p.ms)
1493
+ children: [/* @__PURE__ */ s("span", { className: "bg-pho-secondary absolute bottom-0 left-0 h-1.5 w-px" }), f != null ? /* @__PURE__ */ s("span", {
1494
+ className: S("absolute inset-y-0 flex items-center whitespace-nowrap", f === "end" ? "right-1" : "left-1"),
1495
+ children: Oe(p.ms)
1495
1496
  }) : null]
1496
1497
  }, p.ms);
1497
1498
  }),
1498
- b != null && v == null ? /* @__PURE__ */ o("span", {
1499
+ v != null && g == null ? /* @__PURE__ */ s("span", {
1499
1500
  "data-trace-cursor": "",
1500
1501
  className: "bg-pho-inverse/40 pointer-events-none absolute inset-y-0 w-px",
1501
- style: { left: K(b) },
1502
- children: /* @__PURE__ */ o("span", {
1503
- className: P("bg-pho-primary text-pho-secondary absolute top-1/2 z-10 -translate-y-1/2 rounded-sm px-1 text-[10px] whitespace-nowrap tabular-nums", b > 0.8 ? "right-1" : "left-1"),
1504
- children: Q(O(b))
1502
+ style: { left: K(v) },
1503
+ children: /* @__PURE__ */ s("span", {
1504
+ className: S("bg-pho-primary text-pho-secondary absolute top-1/2 z-10 -translate-y-1/2 rounded-sm px-1 text-[10px] whitespace-nowrap tabular-nums", v > 0.8 ? "right-1" : "left-1"),
1505
+ children: Q(L(v))
1505
1506
  })
1506
1507
  }) : null,
1507
- S ? /* @__PURE__ */ w(_e, { children: [
1508
- /* @__PURE__ */ o("span", {
1508
+ _ ? /* @__PURE__ */ N(Ee, { children: [
1509
+ /* @__PURE__ */ s("span", {
1509
1510
  "data-trace-selection-shade": "start",
1510
1511
  className: "bg-pho-inverse/10 pointer-events-none absolute inset-y-0 left-0",
1511
- style: { width: K(S.left) }
1512
+ style: { width: K(_.left) }
1512
1513
  }),
1513
- /* @__PURE__ */ o("span", {
1514
+ /* @__PURE__ */ s("span", {
1514
1515
  "data-trace-selection-shade": "end",
1515
1516
  className: "bg-pho-inverse/10 pointer-events-none absolute inset-y-0 right-0",
1516
- style: { width: K(1 - S.left - S.width) }
1517
+ style: { width: K(1 - _.left - _.width) }
1517
1518
  }),
1518
- /* @__PURE__ */ o("span", {
1519
+ /* @__PURE__ */ s("span", {
1519
1520
  "data-trace-selection": "",
1520
1521
  "data-selecting": C != null || void 0,
1521
1522
  className: "border-pho-ink bg-pho-primary pointer-events-none absolute inset-y-0 flex items-center justify-center border-x-2",
1522
1523
  style: {
1523
- left: K(S.left),
1524
- width: K(S.width)
1524
+ left: K(_.left),
1525
+ width: K(_.width)
1525
1526
  },
1526
- children: /* @__PURE__ */ w("span", {
1527
+ children: /* @__PURE__ */ N("span", {
1527
1528
  className: "bg-pho-primary text-pho-primary z-10 rounded-sm px-1 text-[10px] whitespace-nowrap tabular-nums",
1528
1529
  children: [
1529
- Q(O(S.left)),
1530
+ Q(L(_.left)),
1530
1531
  " –",
1531
1532
  " ",
1532
- Q(O(S.left + S.width))
1533
+ Q(L(_.left + _.width))
1533
1534
  ]
1534
1535
  })
1535
1536
  }),
1536
- /* @__PURE__ */ o(Ae, {
1537
- at: S.left,
1537
+ /* @__PURE__ */ s(Se, {
1538
+ at: _.left,
1538
1539
  "data-trace-selection-handle": "start",
1539
- className: P(C == null && "cursor-ew-resize"),
1540
- onPointerDown: C == null ? x("start") : void 0
1540
+ className: S(C == null && "cursor-ew-resize"),
1541
+ onPointerDown: C == null ? y("start") : void 0
1541
1542
  }),
1542
- /* @__PURE__ */ o(Ae, {
1543
- at: S.left + S.width,
1543
+ /* @__PURE__ */ s(Se, {
1544
+ at: _.left + _.width,
1544
1545
  "data-trace-selection-handle": "end",
1545
- className: P(C == null && "cursor-ew-resize"),
1546
- onPointerDown: C == null ? x("end") : void 0
1546
+ className: S(C == null && "cursor-ew-resize"),
1547
+ onPointerDown: C == null ? y("end") : void 0
1547
1548
  })
1548
1549
  ] }) : null
1549
1550
  ]
1550
1551
  })
1551
1552
  });
1552
1553
  }
1553
- function Ae({ at: e, className: t, ...n }) {
1554
- return /* @__PURE__ */ w("span", {
1554
+ function Se({ at: e, className: t, ...n }) {
1555
+ return /* @__PURE__ */ N("span", {
1555
1556
  "aria-hidden": !0,
1556
- className: P("border-pho-ink bg-pho-primary absolute top-1/2 z-10 flex h-5 w-2.5 -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-0.5 rounded-sm border shadow-sm", t),
1557
+ className: S("border-pho-ink bg-pho-primary absolute top-1/2 z-10 flex h-5 w-2.5 -translate-x-1/2 -translate-y-1/2 items-center justify-center gap-0.5 rounded-sm border shadow-sm", t),
1557
1558
  style: { left: K(e) },
1558
1559
  ...n,
1559
- children: [/* @__PURE__ */ o("span", { className: "bg-pho-inverse h-2.5 w-px" }), /* @__PURE__ */ o("span", { className: "bg-pho-inverse h-2.5 w-px" })]
1560
+ children: [/* @__PURE__ */ s("span", { className: "bg-pho-inverse h-2.5 w-px" }), /* @__PURE__ */ s("span", { className: "bg-pho-inverse h-2.5 w-px" })]
1560
1561
  });
1561
1562
  }
1562
- function Mn({ spanCount: e, errorCount: t, orphanCount: n = 0, durationMs: a }) {
1563
+ function Tn({ spanCount: e, errorCount: t, orphanCount: n = 0, durationMs: a }) {
1563
1564
  const r = [ce(e, "span")];
1564
1565
  return t > 0 && r.push(ce(t, "error")), n > 0 && r.push(`${n} missing ${n === 1 ? "parent" : "parents"}`), r.push(`${Q(a)} total`), r;
1565
1566
  }
1566
- function Ue({ className: e, ...t }) {
1567
- const { spanCount: n, errorCount: a } = Be(), { range: r, orphans: s } = G(), l = Mn({
1567
+ function Xe({ className: e, ...t }) {
1568
+ const { spanCount: n, errorCount: a } = Ge(), { range: r, orphans: o } = G(), l = Tn({
1568
1569
  spanCount: n,
1569
1570
  errorCount: a,
1570
- orphanCount: s,
1571
+ orphanCount: o,
1571
1572
  durationMs: r.max - r.min
1572
1573
  });
1573
- return /* @__PURE__ */ w("div", {
1574
+ return /* @__PURE__ */ N("div", {
1574
1575
  "data-trace-footer": "",
1575
- className: P("border-pho-secondary text-pho-description @container flex h-10 items-center justify-between gap-3 border-t px-5 text-xs", e),
1576
+ className: S("border-pho-secondary text-pho-description @container flex h-10 items-center justify-between gap-3 border-t px-5 text-xs", e),
1576
1577
  ...t,
1577
- children: [/* @__PURE__ */ w("ul", {
1578
+ children: [/* @__PURE__ */ N("ul", {
1578
1579
  "data-trace-legend": "",
1579
1580
  className: "hidden shrink-0 items-center gap-3 @2xl:flex",
1580
- children: [/* @__PURE__ */ o(Ce, {
1581
+ children: [/* @__PURE__ */ s(_e, {
1581
1582
  className: "bg-pho-inverse/25",
1582
1583
  label: "Span"
1583
- }), /* @__PURE__ */ o(Ce, {
1584
+ }), /* @__PURE__ */ s(_e, {
1584
1585
  className: "bg-pho-error-ink",
1585
1586
  label: "Error"
1586
1587
  })]
1587
- }), /* @__PURE__ */ o("ul", {
1588
+ }), /* @__PURE__ */ s("ul", {
1588
1589
  className: "flex min-w-0 items-center gap-3 overflow-hidden tabular-nums",
1589
- children: l.map((i) => /* @__PURE__ */ o("li", {
1590
+ children: l.map((i) => /* @__PURE__ */ s("li", {
1590
1591
  className: "shrink-0 last:min-w-0 last:truncate",
1591
1592
  children: i
1592
1593
  }, i))
1593
1594
  })]
1594
1595
  });
1595
1596
  }
1596
- function Ce({ className: e, label: t }) {
1597
- return /* @__PURE__ */ w("li", {
1597
+ function _e({ className: e, label: t }) {
1598
+ return /* @__PURE__ */ N("li", {
1598
1599
  className: "flex items-center gap-1.5",
1599
- children: [/* @__PURE__ */ o("span", {
1600
+ children: [/* @__PURE__ */ s("span", {
1600
1601
  "aria-hidden": !0,
1601
- className: P("size-2.5 shrink-0 rounded-sm", e)
1602
+ className: S("size-2.5 shrink-0 rounded-sm", e)
1602
1603
  }), t]
1603
1604
  });
1604
1605
  }
1605
- var An = {
1606
+ var En = {
1606
1607
  debug: "text-pho-description",
1607
1608
  info: "text-pho-secondary",
1608
1609
  warn: "text-pho-warning",
1609
1610
  error: "text-pho-error"
1610
- };
1611
- function Cn({ logs: e, spans: t, title: n = "Logs", className: a, ...r }) {
1612
- const s = L(() => new Map((t ?? []).map((l) => [l.id, l.name])), [t]);
1613
- return e == null || e.length === 0 ? null : /* @__PURE__ */ w("section", {
1611
+ }, me = "grid grid-cols-[5rem_3.5rem_minmax(0,1fr)] gap-3 px-5", $n = 5;
1612
+ function Pn({ logs: e, spans: t, loading: n, title: a, className: r, ...o }) {
1613
+ const l = O(() => new Map((t ?? []).map((c) => [c.id, c.name])), [t]), i = n ? Array.from({ length: n === !0 ? $n : n }) : [];
1614
+ return i.length === 0 && (e == null || e.length === 0) ? null : /* @__PURE__ */ N("section", {
1615
+ ...o,
1614
1616
  "data-trace-logs": "",
1615
- className: P(Le, "min-w-0", a),
1616
- ...r,
1617
- children: [/* @__PURE__ */ w("div", {
1618
- className: "border-pho-secondary flex min-h-10 items-center justify-between gap-3 border-b px-5",
1619
- children: [/* @__PURE__ */ o("div", {
1620
- className: "text-pho-secondary min-w-0 truncate text-xs font-medium",
1621
- children: n
1622
- }), /* @__PURE__ */ w("div", {
1623
- className: "text-pho-description shrink-0 text-xs tabular-nums",
1617
+ "aria-busy": i.length > 0 ? !0 : void 0,
1618
+ className: S(We, "min-w-0", Je.sm, r),
1619
+ children: [
1620
+ a ? /* @__PURE__ */ s("span", {
1621
+ className: "sr-only",
1622
+ children: a
1623
+ }) : null,
1624
+ /* @__PURE__ */ N("div", {
1625
+ "data-trace-logs-header": "",
1626
+ className: S(me, qe, "items-center"),
1624
1627
  children: [
1625
- e.length,
1626
- " ",
1627
- e.length === 1 ? "line" : "lines"
1628
+ /* @__PURE__ */ s("span", { children: "Offset" }),
1629
+ /* @__PURE__ */ s("span", { children: "Level" }),
1630
+ /* @__PURE__ */ s("span", { children: "Message" })
1628
1631
  ]
1629
- })]
1630
- }), /* @__PURE__ */ o("ol", {
1631
- className: "divide-pho-secondary m-0 list-none divide-y p-0 font-mono text-xs",
1632
- children: e.map((l, i) => {
1633
- const d = l.level ?? "info", c = l.spanId ? s.get(l.spanId) : void 0;
1634
- return /* @__PURE__ */ w("li", {
1635
- className: "grid grid-cols-[5rem_3.5rem_minmax(0,1fr)] items-baseline gap-3 px-5 py-1.5",
1632
+ }),
1633
+ /* @__PURE__ */ s("ol", {
1634
+ className: S(Qe, "m-0 list-none p-0 font-mono"),
1635
+ children: i.length > 0 ? i.map((c, d) => /* @__PURE__ */ N("li", {
1636
+ className: S(me, "h-10 items-center"),
1636
1637
  children: [
1637
- /* @__PURE__ */ w("span", {
1638
- className: "text-pho-description tabular-nums",
1639
- children: ["+", Q(l.offsetMs)]
1640
- }),
1641
- /* @__PURE__ */ o("span", {
1642
- className: P("truncate", An[d]),
1643
- children: d.charAt(0).toUpperCase() + d.slice(1)
1644
- }),
1645
- /* @__PURE__ */ w("span", {
1646
- className: "text-pho-primary [overflow-wrap:anywhere] whitespace-pre-wrap",
1647
- children: [l.message, c ? /* @__PURE__ */ w("span", {
1648
- className: "text-pho-description",
1649
- children: [" ", c]
1650
- }) : null]
1651
- })
1638
+ /* @__PURE__ */ s(he, { className: "h-3.5 w-14" }),
1639
+ /* @__PURE__ */ s(he, { className: "h-3.5 w-9" }),
1640
+ /* @__PURE__ */ s(he, { className: "h-3.5 w-64 max-w-full" })
1652
1641
  ]
1653
- }, l.id ?? i);
1642
+ }, d)) : e.map((c, d) => {
1643
+ const x = c.level ?? "info", v = c.spanId ? l.get(c.spanId) : void 0;
1644
+ return /* @__PURE__ */ N("li", {
1645
+ className: S(me, "items-baseline py-1.5"),
1646
+ children: [
1647
+ /* @__PURE__ */ N("span", {
1648
+ className: "text-pho-description tabular-nums",
1649
+ children: ["+", Q(c.offsetMs)]
1650
+ }),
1651
+ /* @__PURE__ */ s("span", {
1652
+ className: S("truncate", En[x]),
1653
+ children: x.charAt(0).toUpperCase() + x.slice(1)
1654
+ }),
1655
+ /* @__PURE__ */ N("span", {
1656
+ className: "text-pho-primary [overflow-wrap:anywhere] whitespace-pre-wrap",
1657
+ children: [c.message, v ? /* @__PURE__ */ N("span", {
1658
+ className: "text-pho-description",
1659
+ children: [" ", v]
1660
+ }) : null]
1661
+ })
1662
+ ]
1663
+ }, c.id ?? d);
1664
+ })
1654
1665
  })
1655
- })]
1666
+ ]
1656
1667
  });
1657
1668
  }
1658
- var Sn = Object.assign(xn, { Footer: Ue }), jn = {
1659
- Waterfall: Sn,
1660
- Logs: Cn
1669
+ var Dn = Object.assign(An, { Footer: Xe }), Yn = {
1670
+ Waterfall: Dn,
1671
+ Logs: Pn
1661
1672
  };
1662
1673
  export {
1663
- kt as A,
1664
- Ee as B,
1665
- be as C,
1666
- Wn as D,
1667
- yt as E,
1668
- It as F,
1669
- Tt as I,
1670
- At as L,
1671
- Mt as M,
1672
- $t as N,
1674
+ It as A,
1675
+ Pe as B,
1676
+ xe as C,
1677
+ Hn as D,
1678
+ Ct as E,
1679
+ Dt as F,
1680
+ zt as I,
1681
+ Et as L,
1682
+ Tt as M,
1683
+ Ot as N,
1673
1684
  ie as O,
1674
- _t as P,
1675
- Kn as R,
1685
+ Rt as P,
1686
+ Zn as R,
1676
1687
  G as S,
1677
- Nt as T,
1678
- St as V,
1679
- Jt as _,
1680
- ye as a,
1688
+ _t as T,
1689
+ Pt as V,
1690
+ nn as _,
1691
+ Ne as a,
1681
1692
  H as b,
1682
- Vn as c,
1683
- Yt as d,
1684
- Qt as f,
1685
- Xt as g,
1686
- Gt as h,
1687
- en as i,
1688
- Te as j,
1689
- wt as k,
1690
- Oe as l,
1691
- me as m,
1692
- Mn as n,
1693
+ Jn as c,
1694
+ an as d,
1695
+ rn as f,
1696
+ qt as g,
1697
+ Qt as h,
1698
+ on as i,
1699
+ $e as j,
1700
+ St as k,
1701
+ Fe as l,
1702
+ ve as m,
1703
+ Tn as n,
1693
1704
  Q as o,
1694
- Bt as p,
1695
- sn as r,
1696
- De as s,
1697
- jn as t,
1698
- qt as u,
1699
- Ht as v,
1705
+ Jt as p,
1706
+ pn as r,
1707
+ Oe as s,
1708
+ Yn as t,
1709
+ sn as u,
1710
+ en as v,
1700
1711
  J as w,
1701
1712
  ee as x,
1702
- Zt as y,
1703
- Ct as z
1713
+ tn as y,
1714
+ $t as z
1704
1715
  };
1705
1716
 
1706
- //# sourceMappingURL=trace-CjOi3_IP.js.map
1717
+ //# sourceMappingURL=trace-D1fOFzJt.js.map