@photon-ai/pho-ui 3.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/chunks/{basic-page-CYDwfVjO.js → basic-page-C3qjXfBe.js} +423 -419
  2. package/dist/chunks/basic-page-C3qjXfBe.js.map +1 -0
  3. package/dist/chunks/data-table-BeUwsjmX.js +297 -0
  4. package/dist/chunks/data-table-BeUwsjmX.js.map +1 -0
  5. package/dist/chunks/date-picker-Ddeo1fNE.js +422 -0
  6. package/dist/chunks/date-picker-Ddeo1fNE.js.map +1 -0
  7. package/dist/chunks/{ghost-search-BvBFa9su.js → ghost-search-AmVXd0zE.js} +2 -2
  8. package/dist/chunks/{ghost-search-BvBFa9su.js.map → ghost-search-AmVXd0zE.js.map} +1 -1
  9. package/dist/chunks/trace-Hku-rImp.js +1706 -0
  10. package/dist/chunks/trace-Hku-rImp.js.map +1 -0
  11. package/dist/components/data-table.js +2 -2
  12. package/dist/components/date-picker.js +1 -1
  13. package/dist/components/phone-input.js +3 -3
  14. package/dist/components/phone-input.js.map +1 -1
  15. package/dist/components/trace.js +38 -37
  16. package/dist/index.js +130 -129
  17. package/dist/sections/basic-page.js +2 -2
  18. package/dist/src/components/data-table/data-table.d.ts +8 -6
  19. package/dist/src/components/date-picker/date-picker.d.ts +28 -1
  20. package/dist/src/components/trace/index.d.ts +1 -1
  21. package/dist/src/components/trace/layout.d.ts +11 -5
  22. package/dist/src/components/trace/trace.d.ts +5 -27
  23. package/dist/src/sections/basic-page/basic-page.d.ts +12 -1
  24. package/package.json +1 -1
  25. package/dist/chunks/basic-page-CYDwfVjO.js.map +0 -1
  26. package/dist/chunks/data-table-DcwCgXJU.js +0 -293
  27. package/dist/chunks/data-table-DcwCgXJU.js.map +0 -1
  28. package/dist/chunks/date-picker-Bwa6J4ik.js +0 -381
  29. package/dist/chunks/date-picker-Bwa6J4ik.js.map +0 -1
  30. package/dist/chunks/trace-Ba1RMBfk.js +0 -1645
  31. package/dist/chunks/trace-Ba1RMBfk.js.map +0 -1
@@ -0,0 +1,1706 @@
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-if7ncPbI.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";
13
+ import { useRender as q } from "@base-ui/react/use-render";
14
+ var Qe = [
15
+ ["path", {
16
+ d: "M5 12l14 0",
17
+ key: "svg-0"
18
+ }],
19
+ ["path", {
20
+ d: "M15 16l4 -4",
21
+ key: "svg-1"
22
+ }],
23
+ ["path", {
24
+ d: "M15 8l4 4",
25
+ key: "svg-2"
26
+ }]
27
+ ], qe = U("outline", "arrow-narrow-right", "ArrowNarrowRight", Qe), et = [["path", {
28
+ d: "M7 10h14l-4 -4",
29
+ key: "svg-0"
30
+ }], ["path", {
31
+ d: "M17 14h-14l4 4",
32
+ key: "svg-1"
33
+ }]], tt = U("outline", "arrows-exchange", "ArrowsExchange", et), nt = [["path", {
34
+ d: "M7 7l5 5l5 -5",
35
+ key: "svg-0"
36
+ }], ["path", {
37
+ d: "M7 13l5 5l5 -5",
38
+ key: "svg-1"
39
+ }]], at = U("outline", "chevrons-down", "ChevronsDown", nt), rt = [["path", {
40
+ d: "M7 11l5 -5l5 5",
41
+ key: "svg-0"
42
+ }], ["path", {
43
+ d: "M7 17l5 -5l5 5",
44
+ key: "svg-1"
45
+ }]], st = U("outline", "chevrons-up", "ChevronsUp", rt), ot = [
46
+ ["path", {
47
+ d: "M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",
48
+ key: "svg-0"
49
+ }],
50
+ ["path", {
51
+ d: "M4 6v6a8 3 0 0 0 16 0v-6",
52
+ key: "svg-1"
53
+ }],
54
+ ["path", {
55
+ d: "M4 12v6a8 3 0 0 0 16 0v-6",
56
+ key: "svg-2"
57
+ }]
58
+ ], it = U("outline", "database", "Database", ot), lt = [
59
+ ["path", {
60
+ d: "M14 3v4a1 1 0 0 0 1 1h4",
61
+ key: "svg-0"
62
+ }],
63
+ ["path", {
64
+ d: "M12 21h-5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v4.5",
65
+ key: "svg-1"
66
+ }],
67
+ ["path", {
68
+ d: "M14 17.5a2.5 2.5 0 1 0 5 0a2.5 2.5 0 1 0 -5 0",
69
+ key: "svg-2"
70
+ }],
71
+ ["path", {
72
+ d: "M18.5 19.5l2.5 2.5",
73
+ key: "svg-3"
74
+ }]
75
+ ], ct = U("outline", "file-search", "FileSearch", lt), dt = [
76
+ ["path", {
77
+ d: "M8 9h8",
78
+ key: "svg-0"
79
+ }],
80
+ ["path", {
81
+ d: "M8 13h6",
82
+ key: "svg-1"
83
+ }],
84
+ ["path", {
85
+ 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
+ key: "svg-2"
87
+ }]
88
+ ], ut = U("outline", "message", "Message", dt), pt = [
89
+ ["path", {
90
+ 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
+ key: "svg-0"
92
+ }],
93
+ ["path", {
94
+ d: "M12 2v2",
95
+ key: "svg-1"
96
+ }],
97
+ ["path", {
98
+ d: "M9 12v9",
99
+ key: "svg-2"
100
+ }],
101
+ ["path", {
102
+ d: "M15 12v9",
103
+ key: "svg-3"
104
+ }],
105
+ ["path", {
106
+ d: "M5 16l4 -2",
107
+ key: "svg-4"
108
+ }],
109
+ ["path", {
110
+ d: "M15 14l4 2",
111
+ key: "svg-5"
112
+ }],
113
+ ["path", {
114
+ d: "M9 18h6",
115
+ key: "svg-6"
116
+ }],
117
+ ["path", {
118
+ d: "M10 8v.01",
119
+ key: "svg-7"
120
+ }],
121
+ ["path", {
122
+ d: "M14 8v.01",
123
+ key: "svg-8"
124
+ }]
125
+ ], ht = U("outline", "robot", "Robot", pt), mt = [["path", {
126
+ 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
+ key: "svg-0"
128
+ }]], ve = U("outline", "sparkles", "Sparkles", mt), ft = [["path", {
129
+ 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
+ key: "svg-0"
131
+ }]], vt = U("outline", "tool", "Tool", ft), bt = [
132
+ ["path", {
133
+ d: "M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",
134
+ key: "svg-0"
135
+ }],
136
+ ["path", {
137
+ d: "M3.6 9h16.8",
138
+ key: "svg-1"
139
+ }],
140
+ ["path", {
141
+ d: "M3.6 15h16.8",
142
+ key: "svg-2"
143
+ }],
144
+ ["path", {
145
+ d: "M11.5 3a17 17 0 0 0 0 18",
146
+ key: "svg-3"
147
+ }],
148
+ ["path", {
149
+ d: "M12.5 3a17 17 0 0 1 0 18",
150
+ key: "svg-4"
151
+ }]
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) {
154
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set();
155
+ 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
+ const a = /* @__PURE__ */ new Set();
157
+ for (const r of e.keys()) {
158
+ if (a.has(r)) continue;
159
+ const s = [], l = /* @__PURE__ */ new Set();
160
+ let i = r;
161
+ for (; i !== null && !a.has(i); ) {
162
+ if (l.has(i)) {
163
+ t.set(i, null), n.add(i);
164
+ break;
165
+ }
166
+ s.push(i), l.add(i), i = t.get(i) ?? null;
167
+ }
168
+ for (const d of s) a.add(d);
169
+ }
170
+ return {
171
+ parents: t,
172
+ orphans: n
173
+ };
174
+ }
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();
177
+ 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);
180
+ }
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) => {
185
+ 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;
190
+ return {
191
+ startedAt: m,
192
+ endedAt: g,
193
+ latencyMs: N,
194
+ repaired: M
195
+ };
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 = {
200
+ ...h,
201
+ parentSpanId: n.get(h.id) ?? null,
202
+ startedAt: m.startedAt,
203
+ endedAt: m.endedAt,
204
+ latencyMs: m.latencyMs,
205
+ depth: v,
206
+ hasChildren: g.length > 0,
207
+ isCollapsed: !1,
208
+ descendants: 0,
209
+ descendantErrors: 0,
210
+ orphan: a.has(h.id),
211
+ repaired: m.repaired,
212
+ serverChildId: null
213
+ };
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
218
+ }));
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);
224
+ }
225
+ return N.descendants = _, N.descendantErrors = D, N;
226
+ }, b = (r.get(null) ?? []).map((h) => ({
227
+ root: h,
228
+ start: X(h.startedAt) ? h.startedAt : s
229
+ }));
230
+ b.sort((h, v) => h.start - v.start);
231
+ for (const { root: h } of b) k(h, 0, null);
232
+ return {
233
+ spans: i,
234
+ byId: d,
235
+ orphans: a.size,
236
+ repaired: c
237
+ };
238
+ }
239
+ function Ee(e, t) {
240
+ const n = [];
241
+ let a = null;
242
+ for (const r of e.spans) {
243
+ if (a != null) {
244
+ if (r.depth > a) continue;
245
+ a = null;
246
+ }
247
+ t.has(r.id) ? (n.push({
248
+ ...r,
249
+ isCollapsed: !0
250
+ }), r.hasChildren && (a = r.depth)) : n.push(r);
251
+ }
252
+ return n;
253
+ }
254
+ function Wn(e, t = /* @__PURE__ */ new Set()) {
255
+ return Ee(Te(e), t);
256
+ }
257
+ function yt(e, t) {
258
+ const n = [];
259
+ let a = e.get(t)?.parentSpanId ?? null;
260
+ for (; a != null && !n.includes(a); )
261
+ n.push(a), a = e.get(a)?.parentSpanId ?? null;
262
+ return n;
263
+ }
264
+ function wt(e) {
265
+ return e.filter((t) => t.hasChildren).map((t) => t.id);
266
+ }
267
+ function Nt(e, t) {
268
+ return e.filter((n) => n.hasChildren).every((n) => t.has(n.id));
269
+ }
270
+ function kt(e, t) {
271
+ const n = new Set(t);
272
+ let a;
273
+ 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
+ return a && n.add(a.id), Array.from(n);
275
+ }
276
+ function Mt(e, t) {
277
+ const n = new Set(t);
278
+ 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);
281
+ return Array.from(n);
282
+ }
283
+ function At(e, t) {
284
+ let n = 1 / 0, a = -1 / 0;
285
+ for (const r of e) {
286
+ if (!X(r.startedAt)) continue;
287
+ r.startedAt < n && (n = r.startedAt);
288
+ const s = X(r.endedAt) ? r.endedAt : t ?? r.startedAt;
289
+ s > a && (a = s);
290
+ }
291
+ return n === 1 / 0 ? {
292
+ min: 0,
293
+ max: 0
294
+ } : {
295
+ min: n,
296
+ max: Math.max(a, n)
297
+ };
298
+ }
299
+ var le = (e) => Math.min(1, Math.max(0, e));
300
+ function ie(e) {
301
+ let [t, n] = e;
302
+ if (X(t) || (t = 0), X(n) || (n = 1), n < t && ([t, n] = [n, t]), t = le(t), n = le(n), n - t < 1e-3) {
303
+ const a = (t + n) / 2;
304
+ t = le(a - J / 2), n = le(t + J), t = n - J;
305
+ }
306
+ return [t, n];
307
+ }
308
+ function Ct(e, t) {
309
+ const n = e.max - e.min;
310
+ return {
311
+ min: e.min + t[0] * n,
312
+ max: e.min + t[1] * n
313
+ };
314
+ }
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;
318
+ return i = Math.min(Math.max(i, 0), 1 - l), ie([i, i + l]);
319
+ }
320
+ function It(e, t) {
321
+ 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]);
324
+ }
325
+ function Kn(e, t) {
326
+ return e[0] + t * (e[1] - e[0]);
327
+ }
328
+ function _t(e) {
329
+ return e[0] <= 0 && e[1] >= 1;
330
+ }
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));
333
+ return {
334
+ leftPercent: d,
335
+ endPercent: c,
336
+ widthPercent: c - d,
337
+ durationMs: Math.max(0, s - e),
338
+ effectiveEnd: s,
339
+ clippedStart: l < 0 && i > 0,
340
+ clippedEnd: i > 100 && l < 100
341
+ };
342
+ }
343
+ function Et(e) {
344
+ if (e == null) return "";
345
+ if (typeof e == "object") try {
346
+ return JSON.stringify(e);
347
+ } catch {
348
+ return String(e);
349
+ }
350
+ return String(e);
351
+ }
352
+ function $t(e, t) {
353
+ if (e == null || e.trim() === "") return null;
354
+ const n = [], a = [];
355
+ 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));
358
+ }
359
+ if (n.length === 0) return /* @__PURE__ */ new Set();
360
+ 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));
366
+ }, l = /* @__PURE__ */ new Set();
367
+ 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
+ l.add(i.id);
370
+ continue;
371
+ }
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}`))) {
378
+ l.add(i.id);
379
+ break;
380
+ }
381
+ }
382
+ }
383
+ return l;
384
+ }
385
+ var $e = de(null), Pe = de(null), ze = de(null);
386
+ function G() {
387
+ const e = ue($e);
388
+ if (e == null) throw new Error("SpanPrimitive parts render inside SpanPrimitive.Provider.");
389
+ return e;
390
+ }
391
+ function ee() {
392
+ const e = ue(Pe);
393
+ if (e == null) throw new Error("SpanPrimitive parts render inside SpanPrimitive.Children.");
394
+ return e;
395
+ }
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,
406
+ m,
407
+ g
408
+ ]), C = F(() => g(kt(x, m)), [
409
+ x,
410
+ 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]);
413
+ ae(() => {
414
+ if (l || p == null || p.size === 0) return;
415
+ 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($)));
418
+ }, [
419
+ p,
420
+ l,
421
+ _,
422
+ m,
423
+ M,
424
+ g
425
+ ]);
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(() => ({
430
+ 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),
439
+ now: r,
440
+ collapsed: m,
441
+ toggle: N,
442
+ setCollapsed: g,
443
+ expandAll: D,
444
+ collapseAll: E,
445
+ expandOne: T,
446
+ collapseOne: C,
447
+ canExpand: O,
448
+ canCollapse: S,
449
+ query: s,
450
+ matches: p,
451
+ setView: R,
452
+ zoom: V,
453
+ pan: W,
454
+ resetView: ne
455
+ }), [
456
+ f,
457
+ x,
458
+ _,
459
+ b.orphans,
460
+ b.repaired,
461
+ y,
462
+ z,
463
+ j,
464
+ r,
465
+ m,
466
+ N,
467
+ g,
468
+ D,
469
+ E,
470
+ T,
471
+ C,
472
+ O,
473
+ S,
474
+ s,
475
+ p,
476
+ R,
477
+ V,
478
+ W,
479
+ ne
480
+ ]);
481
+ return /* @__PURE__ */ o($e.Provider, {
482
+ value: re,
483
+ children: k
484
+ });
485
+ }
486
+ function zt({ children: e }) {
487
+ const { spans: t } = G();
488
+ return t.map((n) => /* @__PURE__ */ o(Pe.Provider, {
489
+ value: n,
490
+ children: e(n)
491
+ }, n.id));
492
+ }
493
+ function Rt({ render: e, ref: t, ...n }) {
494
+ const a = ee(), { matches: r } = G();
495
+ return q({
496
+ render: e,
497
+ ref: t,
498
+ defaultTagName: "div",
499
+ props: {
500
+ ...n,
501
+ "data-span-id": a.id,
502
+ "data-span-status": a.status,
503
+ "data-span-type": a.type,
504
+ "data-span-depth": a.depth,
505
+ "data-span-kind": a.kind,
506
+ "data-collapsed": a.isCollapsed ? "" : void 0,
507
+ "data-match": r?.has(a.id) ? "" : void 0,
508
+ "data-orphan": a.orphan ? "" : void 0
509
+ }
510
+ });
511
+ }
512
+ function Dt({ render: e, ref: t, baseIndent: n = 8, indentPerLevel: a = 12, style: r, ...s }) {
513
+ const l = ee();
514
+ return q({
515
+ render: e,
516
+ ref: t,
517
+ defaultTagName: "div",
518
+ props: {
519
+ ...s,
520
+ style: {
521
+ ...r,
522
+ paddingLeft: n + l.depth * a
523
+ },
524
+ "data-span-depth": l.depth
525
+ }
526
+ });
527
+ }
528
+ function Ot({ render: e, ref: t, onClick: n, ...a }) {
529
+ const r = ee(), { toggle: s } = G();
530
+ return q({
531
+ render: e,
532
+ ref: t,
533
+ enabled: r.hasChildren,
534
+ defaultTagName: "button",
535
+ props: {
536
+ type: "button",
537
+ ...a,
538
+ "data-collapsed": r.isCollapsed ? "" : void 0,
539
+ onClick: (l) => {
540
+ l.stopPropagation(), s(r.id), n?.(l);
541
+ }
542
+ }
543
+ });
544
+ }
545
+ function Lt({ render: e, ref: t, ...n }) {
546
+ const a = ee();
547
+ return q({
548
+ render: e,
549
+ ref: t,
550
+ defaultTagName: "span",
551
+ props: {
552
+ ...n,
553
+ "data-span-status": a.status,
554
+ "data-descendant-errors": a.isCollapsed && a.descendantErrors > 0 ? a.descendantErrors : void 0
555
+ }
556
+ });
557
+ }
558
+ function Ft({ render: e, ref: t, children: n, ...a }) {
559
+ const r = ee();
560
+ return q({
561
+ render: e,
562
+ ref: t,
563
+ defaultTagName: "span",
564
+ props: {
565
+ ...a,
566
+ "data-span-type": r.type,
567
+ children: n ?? r.type
568
+ }
569
+ });
570
+ }
571
+ function Wt({ render: e, ref: t, children: n, ...a }) {
572
+ const r = ee();
573
+ return q({
574
+ render: e,
575
+ ref: t,
576
+ defaultTagName: "span",
577
+ props: {
578
+ ...a,
579
+ children: n ?? r.name
580
+ }
581
+ });
582
+ }
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);
586
+ return {
587
+ min: b.min,
588
+ max: b.max + h * Math.max(0, a)
589
+ };
590
+ }, [
591
+ n,
592
+ l.viewRange,
593
+ a
594
+ ]), d = Math.max(1, i.max - i.min), c = {
595
+ ...r,
596
+ "--span-timeline-min-ms": i.min,
597
+ "--span-timeline-max-ms": i.max,
598
+ "--span-timeline-range-ms": d
599
+ }, k = q({
600
+ render: e,
601
+ ref: t,
602
+ defaultTagName: "div",
603
+ props: {
604
+ ...s,
605
+ style: c,
606
+ "data-span-timeline": ""
607
+ }
608
+ });
609
+ return /* @__PURE__ */ o(ze.Provider, {
610
+ value: i,
611
+ children: k
612
+ });
613
+ }
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({
616
+ startedAt: l.startedAt,
617
+ endedAt: l.endedAt,
618
+ timeRange: a ?? d ?? i.viewRange,
619
+ now: n ?? i.now
620
+ }), k = {
621
+ ...r,
622
+ position: "absolute",
623
+ insetInlineStart: "var(--span-timeline-left)",
624
+ 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
629
+ };
630
+ return q({
631
+ render: e,
632
+ ref: t,
633
+ defaultTagName: "div",
634
+ props: {
635
+ ...s,
636
+ style: k,
637
+ "data-span-status": l.status,
638
+ "data-span-type": l.type,
639
+ "data-span-running": l.endedAt === null ? "" : void 0,
640
+ "data-clipped-start": c.clippedStart ? "" : void 0,
641
+ "data-clipped-end": c.clippedEnd ? "" : void 0
642
+ }
643
+ });
644
+ }
645
+ 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) => {
657
+ const t = Number(e.trim());
658
+ return t >= 500 && t < 600;
659
+ }, Re = [
660
+ {
661
+ namespace: "db",
662
+ icon: it,
663
+ pills: [{
664
+ label: "db.system",
665
+ keys: ["db.system.name", "db.system"]
666
+ }]
667
+ },
668
+ {
669
+ namespace: "http",
670
+ icon: gt,
671
+ pills: [{
672
+ label: "http.status_code",
673
+ keys: ["http.response.status_code", "http.status_code"],
674
+ error: jt
675
+ }, {
676
+ label: "http.method",
677
+ keys: ["http.request.method", "http.method"]
678
+ }]
679
+ },
680
+ {
681
+ namespace: "messaging",
682
+ icon: ut
683
+ },
684
+ {
685
+ namespace: "rpc",
686
+ icon: tt,
687
+ pills: [{
688
+ label: "rpc.system",
689
+ keys: ["rpc.system.name", "rpc.system"]
690
+ }]
691
+ },
692
+ {
693
+ namespace: "gen_ai",
694
+ pills: [{
695
+ label: "gen_ai.request.model",
696
+ keys: ["gen_ai.request.model"]
697
+ }]
698
+ }
699
+ ], Bt = {
700
+ agent: {
701
+ icon: ht,
702
+ label: "Agent"
703
+ },
704
+ llm: {
705
+ icon: ve,
706
+ label: "LLM call"
707
+ },
708
+ tool: {
709
+ icon: vt,
710
+ label: "Tool call"
711
+ },
712
+ retrieval: {
713
+ icon: ct,
714
+ label: "Retrieval"
715
+ },
716
+ generic: {
717
+ icon: ve,
718
+ label: "GenAI span"
719
+ }
720
+ }, Ut = {
721
+ chat: "llm",
722
+ text_completion: "llm",
723
+ generate_content: "llm",
724
+ execute_tool: "tool",
725
+ invoke_agent: "agent",
726
+ create_agent: "agent",
727
+ embeddings: "retrieval",
728
+ retrieve: "retrieval"
729
+ };
730
+ function Gt(e) {
731
+ if (e == null) return "";
732
+ if (e instanceof Uint8Array) return JSON.stringify(Array.from(e));
733
+ if (typeof e == "object") try {
734
+ return JSON.stringify(e);
735
+ } catch {
736
+ return "[unserializable]";
737
+ }
738
+ return String(e).trim();
739
+ }
740
+ function me(e, t) {
741
+ if (e == null) return null;
742
+ for (const n of t) {
743
+ if (!(n in e)) continue;
744
+ const a = Gt(e[n]);
745
+ if (a !== "") return a;
746
+ }
747
+ return null;
748
+ }
749
+ function Xt(e) {
750
+ 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;
753
+ }
754
+ function Ht(e) {
755
+ const t = Xt(e);
756
+ if (t != null) return Bt[t];
757
+ if (e == null) return null;
758
+ const n = /* @__PURE__ */ new Set();
759
+ for (const a of Object.keys(e)) {
760
+ const r = a.indexOf(".");
761
+ r > 0 && n.add(a.slice(0, r));
762
+ }
763
+ for (const a of Re) if (a.icon && n.has(a.namespace)) return { icon: a.icon };
764
+ return null;
765
+ }
766
+ function Zt(e) {
767
+ const t = [];
768
+ if (e == null) return t;
769
+ for (const n of Re) for (const a of n.pills ?? []) {
770
+ const r = me(e, a.keys);
771
+ if (r == null) continue;
772
+ const s = {
773
+ label: a.label,
774
+ value: r
775
+ };
776
+ a.error?.(r) && (s.error = !0), t.push(s);
777
+ }
778
+ return t;
779
+ }
780
+ function Jt(e) {
781
+ return me(e, ["peer.service", "server.address"]);
782
+ }
783
+ function Yt(e) {
784
+ return e.map((t) => {
785
+ const n = t.endedAt ?? null, a = {
786
+ id: t.id,
787
+ parentSpanId: t.parentSpanId ?? null,
788
+ name: t.name,
789
+ type: t.type ?? "",
790
+ status: t.status ?? (n == null ? "running" : "completed"),
791
+ startedAt: t.startedAt,
792
+ endedAt: n,
793
+ latencyMs: t.latencyMs ?? (n == null ? null : Math.max(0, n - t.startedAt))
794
+ };
795
+ 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
+ }
798
+ function Qt(e, t) {
799
+ 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
+ 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);
804
+ return {
805
+ left: s,
806
+ width: xe(Math.max(s, (r - t.min) / a)) - s
807
+ };
808
+ }
809
+ function qt(e, t = 6) {
810
+ if (e <= 0) return 1;
811
+ const n = e / t, a = 10 ** Math.floor(Math.log10(n));
812
+ for (const r of [
813
+ 1,
814
+ 2,
815
+ 5,
816
+ 10
817
+ ]) if (r * a >= n) return r * a;
818
+ return 10 * a;
819
+ }
820
+ function en(e, t) {
821
+ const n = t - e;
822
+ if (!(n > 0)) return [{
823
+ at: 0,
824
+ ms: e
825
+ }];
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) {
828
+ const i = Number(l.toFixed(6));
829
+ r.push({
830
+ at: (i - e) / n,
831
+ ms: i
832
+ });
833
+ }
834
+ return r;
835
+ }
836
+ function Q(e) {
837
+ if (!Number.isFinite(e)) return "";
838
+ const t = Math.abs(e);
839
+ 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
+ function De(e) {
842
+ return e === 0 ? "0" : e >= 1e3 ? `${Number((e / 1e3).toFixed(2))} s` : `${Number(e.toFixed(2))} ms`;
843
+ }
844
+ var tn = 7.5, oe = 4, nn = 4;
845
+ function Oe(e, t) {
846
+ if (e.length === 0 || t <= 0) return [];
847
+ const n = [];
848
+ 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); ) {
852
+ if (!i) {
853
+ b = !0;
854
+ break;
855
+ }
856
+ n.pop();
857
+ }
858
+ b || n.push({
859
+ tick: a,
860
+ align: d,
861
+ left: c,
862
+ right: k
863
+ });
864
+ }
865
+ return n.map(({ tick: a, align: r }) => ({
866
+ ...a,
867
+ align: r
868
+ }));
869
+ }
870
+ function Vn(e, t) {
871
+ return Oe(e, t).map((n) => n.ms);
872
+ }
873
+ function K(e) {
874
+ return `${Number((e * 100).toFixed(4))}%`;
875
+ }
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`;
879
+ }
880
+ var on = 250, we = 0.8, Ne = 0.5, ln = 0.1, cn = 0.3, dn = 5e-3, un = {
881
+ completed: "bg-pho-inverse/25",
882
+ failed: "bg-pho-error-ink",
883
+ running: "bg-pho-inverse/15 motion-safe:animate-pulse",
884
+ skipped: "border-pho-secondary border border-dashed bg-transparent"
885
+ }, ke = {
886
+ completed: "bg-pho-inverse",
887
+ failed: "bg-pho-error-ink",
888
+ running: "bg-pho-inverse/40",
889
+ skipped: "border-pho-secondary border bg-transparent"
890
+ }, pn = "border-pho-error-ink border bg-transparent", hn = {
891
+ completed: null,
892
+ failed: "Failed.",
893
+ running: "Running.",
894
+ 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),
899
+ children: [
900
+ /* @__PURE__ */ o("div", {
901
+ "data-trace-track": "",
902
+ className: an,
903
+ children: a
904
+ }),
905
+ t ? /* @__PURE__ */ o("span", {
906
+ "aria-hidden": !0,
907
+ "data-trace-clipped": "start",
908
+ className: "pointer-events-none absolute top-1/2 left-0 h-4 w-2 -translate-y-1/2",
909
+ style: Me("left")
910
+ }) : null,
911
+ n ? /* @__PURE__ */ o("span", {
912
+ "aria-hidden": !0,
913
+ "data-trace-clipped": "end",
914
+ className: "pointer-events-none absolute top-1/2 right-0 h-4 w-2 -translate-y-1/2",
915
+ style: Me("right")
916
+ }) : null
917
+ ]
918
+ });
919
+ }
920
+ function mn(e, t) {
921
+ return t > 0.5 ? "inside" : e + t > 0.8 ? "before" : "after";
922
+ }
923
+ function fn(e) {
924
+ if (!(e instanceof HTMLElement)) return !1;
925
+ const t = e.tagName;
926
+ return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" || e.isContentEditable;
927
+ }
928
+ var je = de(null);
929
+ function Be() {
930
+ const e = ue(je);
931
+ if (e == null) throw new Error("Trace rows render inside Trace.Waterfall only.");
932
+ return e;
933
+ }
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)`
938
+ } : {
939
+ right: `calc(${K(1 - x)} + 0.375rem)`,
940
+ maxWidth: `calc(${K(x)} - 0.375rem)`
941
+ };
942
+ return /* @__PURE__ */ w("li", {
943
+ className: "m-0",
944
+ style: { "--trace-indent": sn(k) },
945
+ children: [/* @__PURE__ */ w(H.Root, {
946
+ "data-trace-row": "",
947
+ "data-selected": M || void 0,
948
+ "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,
953
+ className: "flex min-w-0 items-center gap-1.5 py-1.5 pr-5",
954
+ children: [
955
+ h ? /* @__PURE__ */ o(H.CollapseToggle, {
956
+ "aria-expanded": !b,
957
+ "aria-label": `${b ? "Expand" : "Collapse"} ${i}`,
958
+ 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
+ "aria-hidden": !0,
961
+ className: P("size-4 transition-transform duration-150 ease-out", !b && "rotate-90")
962
+ })
963
+ }) : /* @__PURE__ */ o("span", {
964
+ "aria-hidden": !0,
965
+ className: "size-5 shrink-0"
966
+ }),
967
+ /* @__PURE__ */ o(H.StatusIndicator, {
968
+ "aria-hidden": !0,
969
+ className: P("size-1.5 shrink-0 rounded-full", V ? ke.failed : z > 0 ? pn : ke[c])
970
+ }),
971
+ W ? /* @__PURE__ */ o(W.icon, {
972
+ "data-trace-icon": "",
973
+ role: W.label ? "img" : void 0,
974
+ "aria-label": W.label,
975
+ "aria-hidden": W.label ? void 0 : !0,
976
+ className: "text-pho-description size-3.5 shrink-0"
977
+ }) : null,
978
+ /* @__PURE__ */ w(bn, {
979
+ selected: M,
980
+ expanded: e.renderSpanDetail != null ? m != null : void 0,
981
+ controls: m != null ? g : void 0,
982
+ onSelect: N,
983
+ children: [
984
+ /* @__PURE__ */ o(H.Name, { className: "text-pho-primary truncate text-base" }),
985
+ re ? /* @__PURE__ */ w("span", {
986
+ "data-trace-callee": "",
987
+ className: "text-pho-description flex shrink-0 items-center gap-0.5 text-xs",
988
+ children: [
989
+ /* @__PURE__ */ o(qe, {
990
+ "aria-hidden": !0,
991
+ className: "size-3"
992
+ }),
993
+ /* @__PURE__ */ o("span", {
994
+ className: "sr-only",
995
+ children: "calls "
996
+ }),
997
+ re
998
+ ]
999
+ }) : null,
1000
+ A ? /* @__PURE__ */ o("span", {
1001
+ className: "text-pho-description shrink-[3] truncate text-xs",
1002
+ children: A
1003
+ }) : null,
1004
+ ne.map((u) => /* @__PURE__ */ o(Je, {
1005
+ size: "xs",
1006
+ contrast: "low",
1007
+ color: u.error ? "error" : "gray",
1008
+ title: `${u.label}: ${u.value}`,
1009
+ "aria-label": `${u.label}: ${u.value}`,
1010
+ "data-trace-pill": u.label,
1011
+ "data-error": u.error || void 0,
1012
+ className: "max-w-32 shrink-0 truncate",
1013
+ children: u.value
1014
+ }, u.label)),
1015
+ te > 0 ? /* @__PURE__ */ w("span", {
1016
+ className: "text-pho-description shrink-0 text-xs tabular-nums",
1017
+ children: [
1018
+ "(",
1019
+ te,
1020
+ z > 0 ? `, ${ce(z, "error")}` : "",
1021
+ ")"
1022
+ ]
1023
+ }) : null,
1024
+ R ? /* @__PURE__ */ o("span", {
1025
+ className: "sr-only",
1026
+ children: R
1027
+ }) : null,
1028
+ z > 0 ? /* @__PURE__ */ w("span", {
1029
+ className: "sr-only",
1030
+ children: [ce(z, "error"), " hidden."]
1031
+ }) : null
1032
+ ]
1033
+ })
1034
+ ]
1035
+ }), /* @__PURE__ */ w(Ve, {
1036
+ className: "h-9",
1037
+ clippedStart: E,
1038
+ clippedEnd: T,
1039
+ children: [
1040
+ /* @__PURE__ */ o(H.TimelineBar, {
1041
+ "aria-hidden": !0,
1042
+ "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
+ style: { "--span-timeline-min-width": "2px" },
1045
+ children: p === "inside" && y ? /* @__PURE__ */ o("span", {
1046
+ "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
1049
+ }) : null
1050
+ }),
1051
+ j && I ? /* @__PURE__ */ o("span", {
1052
+ "aria-hidden": !0,
1053
+ "data-trace-rpc": "",
1054
+ className: "bg-pho-inverse/45 absolute top-1/2 h-2 -translate-y-1/2 rounded-sm",
1055
+ style: {
1056
+ left: K(I.left),
1057
+ width: K(I.width),
1058
+ minWidth: "2px"
1059
+ }
1060
+ }) : null,
1061
+ S && y ? /* @__PURE__ */ o("span", {
1062
+ "aria-hidden": !0,
1063
+ "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} ›`
1067
+ }) : null,
1068
+ !S && p !== "inside" && y ? /* @__PURE__ */ o("span", {
1069
+ "aria-hidden": !0,
1070
+ "data-trace-label": "short",
1071
+ className: "text-pho-description absolute top-1/2 -translate-y-1/2 truncate text-xs tabular-nums",
1072
+ style: pe(p),
1073
+ children: y
1074
+ }) : null,
1075
+ y ? /* @__PURE__ */ o("span", {
1076
+ className: "sr-only",
1077
+ children: y
1078
+ }) : null
1079
+ ]
1080
+ })]
1081
+ }), m != null ? /* @__PURE__ */ o(fe.Root, {
1082
+ open: !0,
1083
+ children: /* @__PURE__ */ o(fe.Panel, {
1084
+ className: "motion-reduce:transition-none",
1085
+ children: /* @__PURE__ */ o("section", {
1086
+ id: g,
1087
+ "data-trace-detail": "",
1088
+ className: "border-pho-secondary bg-pho-page border-t py-3 pr-5",
1089
+ style: { paddingLeft: "var(--trace-indent)" },
1090
+ children: m
1091
+ })
1092
+ })
1093
+ }) : null]
1094
+ });
1095
+ }
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,
1100
+ children: r
1101
+ }) : /* @__PURE__ */ o("button", {
1102
+ type: "button",
1103
+ "data-trace-select": "",
1104
+ "aria-current": e ? "true" : void 0,
1105
+ "aria-expanded": t,
1106
+ "aria-controls": n,
1107
+ onClick: a,
1108
+ className: P(s, "cursor-pointer outline-none after:absolute after:inset-0 after:content-['']"),
1109
+ children: r
1110
+ });
1111
+ }
1112
+ function gn(e) {
1113
+ const [t, n] = Y(void 0);
1114
+ return ae(() => {
1115
+ if (!e) return;
1116
+ n(Date.now());
1117
+ const a = setInterval(() => n(Date.now()), on);
1118
+ return () => clearInterval(a);
1119
+ }, [e]), e ? t : void 0;
1120
+ }
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,
1129
+ collapsed: l,
1130
+ onCollapsedChange: i,
1131
+ query: O,
1132
+ defaultView: h,
1133
+ view: v,
1134
+ onViewChange: M,
1135
+ children: /* @__PURE__ */ o(yn, {
1136
+ sources: D,
1137
+ spanCount: _.length,
1138
+ errorCount: f,
1139
+ selectedId: n,
1140
+ onSelect: a,
1141
+ renderSpanDetail: r,
1142
+ foldControls: d,
1143
+ search: c,
1144
+ query: O,
1145
+ setQuery: p,
1146
+ shortcuts: m,
1147
+ footer: g,
1148
+ className: N,
1149
+ ...x
1150
+ })
1151
+ });
1152
+ }
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);
1160
+ }, [A.length]);
1161
+ ae(() => {
1162
+ if (R == null) return;
1163
+ const u = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(R) : R.replace(/"/g, '\\"');
1164
+ p.current?.querySelector(`[data-trace-row][data-span-id="${u}"]`)?.scrollIntoView?.({ block: "nearest" });
1165
+ }, [R]);
1166
+ const W = d !== "", ne = a != null && r != null;
1167
+ 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)));
1171
+ };
1172
+ return document.addEventListener("keydown", u, !0), () => document.removeEventListener("keydown", u, !0);
1173
+ }, [
1174
+ W,
1175
+ N,
1176
+ ne,
1177
+ k,
1178
+ c,
1179
+ D,
1180
+ r
1181
+ ]);
1182
+ const j = F((u) => {
1183
+ if (u.metaKey || u.ctrlKey || u.altKey || fn(u.target)) return !1;
1184
+ switch (u.key) {
1185
+ case "[":
1186
+ return E(), !0;
1187
+ case "]":
1188
+ return T(), !0;
1189
+ case "o":
1190
+ return C(), !0;
1191
+ case "p":
1192
+ return S(), !0;
1193
+ case "ArrowUp":
1194
+ return x(u.shiftKey ? Ne : we), !0;
1195
+ case "ArrowDown":
1196
+ return N ? (x(u.shiftKey ? 1 / Ne : 1 / we), !0) : !1;
1197
+ case "ArrowLeft":
1198
+ return N ? (_(u.shiftKey ? -0.3 : -0.1), !0) : !1;
1199
+ case "ArrowRight":
1200
+ return N ? (_(u.shiftKey ? cn : ln), !0) : !1;
1201
+ case "/":
1202
+ return f.current == null ? !1 : (f.current.focus(), !0);
1203
+ case "f":
1204
+ return A.length === 0 ? !1 : (V(1), !0);
1205
+ case "b":
1206
+ return A.length === 0 ? !1 : (V(-1), !0);
1207
+ default:
1208
+ return !1;
1209
+ }
1210
+ }, [
1211
+ E,
1212
+ T,
1213
+ C,
1214
+ S,
1215
+ x,
1216
+ _,
1217
+ N,
1218
+ A.length,
1219
+ V
1220
+ ]);
1221
+ 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();
1225
+ };
1226
+ return document.addEventListener("keydown", u), () => document.removeEventListener("keydown", u);
1227
+ }, [k, j]);
1228
+ const re = L(() => ({
1229
+ spans: e,
1230
+ selectedId: a,
1231
+ onSelect: r,
1232
+ renderSpanDetail: s,
1233
+ idBase: O,
1234
+ spanCount: t,
1235
+ errorCount: n,
1236
+ activeMatchId: R
1237
+ }), [
1238
+ e,
1239
+ a,
1240
+ r,
1241
+ s,
1242
+ O,
1243
+ t,
1244
+ n,
1245
+ 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, {
1248
+ value: re,
1249
+ children: /* @__PURE__ */ w("section", {
1250
+ ref: y,
1251
+ "data-trace": "",
1252
+ "data-zoomed": N || void 0,
1253
+ "aria-label": "Trace",
1254
+ tabIndex: k === "focus" ? -1 : void 0,
1255
+ className: P(Le, "min-w-0 outline-none", h),
1256
+ ...M,
1257
+ children: [
1258
+ $ ? /* @__PURE__ */ w("div", {
1259
+ "data-trace-toolbar": "",
1260
+ className: "border-pho-secondary flex min-h-10 items-center gap-3 border-b px-5",
1261
+ children: [/* @__PURE__ */ o(He, {
1262
+ ref: f,
1263
+ value: d,
1264
+ onChange: c,
1265
+ placeholder: Z,
1266
+ "aria-label": Z,
1267
+ onKeyDown: (u) => {
1268
+ u.key === "Enter" ? (u.preventDefault(), V(u.shiftKey ? -1 : 1)) : u.key === "Escape" && d !== "" && (u.preventDefault(), c(""));
1269
+ }
1270
+ }), W ? /* @__PURE__ */ w(_e, { children: [/* @__PURE__ */ o("span", {
1271
+ "data-trace-match-count": "",
1272
+ "aria-live": "polite",
1273
+ className: "text-pho-description shrink-0 text-xs tabular-nums",
1274
+ children: A.length === 0 ? "No matches" : `${te % A.length + 1} of ${A.length}`
1275
+ }), /* @__PURE__ */ w("span", {
1276
+ className: "flex shrink-0 items-center",
1277
+ children: [/* @__PURE__ */ o("button", {
1278
+ type: "button",
1279
+ "aria-label": "Previous match",
1280
+ title: "Previous match (b)",
1281
+ disabled: A.length === 0,
1282
+ onClick: () => V(-1),
1283
+ className: se,
1284
+ children: /* @__PURE__ */ o(Ie, {
1285
+ "aria-hidden": !0,
1286
+ className: "size-4"
1287
+ })
1288
+ }), /* @__PURE__ */ o("button", {
1289
+ type: "button",
1290
+ "aria-label": "Next match",
1291
+ title: "Next match (f)",
1292
+ disabled: A.length === 0,
1293
+ onClick: () => V(1),
1294
+ className: se,
1295
+ children: /* @__PURE__ */ o(Se, {
1296
+ "aria-hidden": !0,
1297
+ className: "size-4"
1298
+ })
1299
+ })]
1300
+ })] }) : null]
1301
+ }) : null,
1302
+ /* @__PURE__ */ w("div", {
1303
+ "data-trace-axis": "",
1304
+ className: P(Fe, "border-pho-secondary h-10 border-b"),
1305
+ children: [/* @__PURE__ */ w("div", {
1306
+ 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, {})]
1309
+ }),
1310
+ /* @__PURE__ */ o(H.Timeline, {
1311
+ render: /* @__PURE__ */ o("ol", {
1312
+ "aria-label": "Spans",
1313
+ className: "m-0 list-none p-0"
1314
+ }),
1315
+ children: /* @__PURE__ */ o(H.Children, { children: () => /* @__PURE__ */ o(vn, {}) })
1316
+ }),
1317
+ pe
1318
+ ]
1319
+ })
1320
+ });
1321
+ }
1322
+ function wn() {
1323
+ 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
+ type: "button",
1326
+ "data-trace-zoom-chip": "",
1327
+ onClick: n,
1328
+ title: "Reset zoom (Esc)",
1329
+ "aria-label": `Zoomed to ${a}. Reset zoom`,
1330
+ className: P(Ze({
1331
+ size: "xs",
1332
+ contrast: "low",
1333
+ color: "brand"
1334
+ }), "outline-pho-brand shrink-0 cursor-pointer focus-visible:outline-2"),
1335
+ children: [/* @__PURE__ */ o("span", {
1336
+ "aria-hidden": !0,
1337
+ children: a
1338
+ }), /* @__PURE__ */ o(Xe, {
1339
+ "aria-hidden": !0,
1340
+ className: "size-3"
1341
+ })]
1342
+ });
1343
+ }
1344
+ function Nn() {
1345
+ const { canExpand: e, canCollapse: t, expandAll: n, collapseAll: a, expandOne: r, collapseOne: s } = G();
1346
+ return /* @__PURE__ */ w("fieldset", {
1347
+ "data-trace-fold-controls": "",
1348
+ className: "m-0 ml-auto flex min-w-0 shrink-0 items-center border-0 p-0",
1349
+ children: [
1350
+ /* @__PURE__ */ o("legend", {
1351
+ className: "sr-only",
1352
+ children: "Fold"
1353
+ }),
1354
+ /* @__PURE__ */ o("button", {
1355
+ type: "button",
1356
+ "aria-label": "Expand one level",
1357
+ title: "Expand one level (o)",
1358
+ disabled: !e,
1359
+ onClick: r,
1360
+ className: se,
1361
+ children: /* @__PURE__ */ o(Se, {
1362
+ "aria-hidden": !0,
1363
+ className: "size-4"
1364
+ })
1365
+ }),
1366
+ /* @__PURE__ */ o("button", {
1367
+ type: "button",
1368
+ "aria-label": "Collapse one level",
1369
+ title: "Collapse one level (p)",
1370
+ disabled: !t,
1371
+ onClick: s,
1372
+ className: se,
1373
+ children: /* @__PURE__ */ o(Ie, {
1374
+ "aria-hidden": !0,
1375
+ className: "size-4"
1376
+ })
1377
+ }),
1378
+ /* @__PURE__ */ o("button", {
1379
+ type: "button",
1380
+ "aria-label": "Expand all",
1381
+ title: "Expand all ([)",
1382
+ disabled: !e,
1383
+ onClick: n,
1384
+ className: se,
1385
+ children: /* @__PURE__ */ o(at, {
1386
+ "aria-hidden": !0,
1387
+ className: "size-4"
1388
+ })
1389
+ }),
1390
+ /* @__PURE__ */ o("button", {
1391
+ type: "button",
1392
+ "aria-label": "Collapse all",
1393
+ title: "Collapse all (])",
1394
+ disabled: !t,
1395
+ onClick: a,
1396
+ className: se,
1397
+ children: /* @__PURE__ */ o(st, {
1398
+ "aria-hidden": !0,
1399
+ className: "size-4"
1400
+ })
1401
+ })
1402
+ ]
1403
+ });
1404
+ }
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);
1407
+ ae(() => {
1408
+ const p = c.current;
1409
+ if (p == null) return;
1410
+ const f = () => {
1411
+ const A = p.clientWidth;
1412
+ A > 0 && d(A);
1413
+ };
1414
+ f();
1415
+ const y = new ResizeObserver(f);
1416
+ return y.observe(p), () => y.disconnect();
1417
+ }, []);
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();
1420
+ 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) => {
1424
+ if (p.button !== 0) return;
1425
+ const f = m(p);
1426
+ g(p, {
1427
+ kind: "select",
1428
+ from: f,
1429
+ to: f
1430
+ });
1431
+ }, x = (p) => (f) => {
1432
+ f.button === 0 && (f.stopPropagation(), g(f, {
1433
+ kind: "resize",
1434
+ edge: p
1435
+ }));
1436
+ }, _ = (p) => {
1437
+ const f = m(p);
1438
+ if (v == null) {
1439
+ h(f);
1440
+ return;
1441
+ }
1442
+ v.kind === "select" ? M({
1443
+ ...v,
1444
+ 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;
1448
+ 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)]);
1451
+ return;
1452
+ }
1453
+ const [y, A] = v.from < f ? [v.from, f] : [f, v.from];
1454
+ A - y < dn || a([y, A]);
1455
+ }, E = () => {
1456
+ 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 ? {
1460
+ left: C.from,
1461
+ width: C.to - C.from
1462
+ } : {
1463
+ left: C.to,
1464
+ width: C.from - C.to
1465
+ } : n ? {
1466
+ left: t[0],
1467
+ width: t[1] - t[0]
1468
+ } : null, O = (p) => p * s;
1469
+ return /* @__PURE__ */ o(Ve, {
1470
+ className: "h-10",
1471
+ children: /* @__PURE__ */ w("div", {
1472
+ ref: c,
1473
+ "aria-hidden": !0,
1474
+ role: "presentation",
1475
+ "data-trace-axis-track": "",
1476
+ title: "Drag to zoom, double-click to reset",
1477
+ className: "absolute inset-0 cursor-crosshair touch-none select-none",
1478
+ onPointerDown: N,
1479
+ onPointerMove: _,
1480
+ onPointerUp: D,
1481
+ onPointerCancel: E,
1482
+ onPointerLeave: T,
1483
+ onDoubleClick: r,
1484
+ children: [
1485
+ l.map((p) => {
1486
+ const f = k.get(p.ms);
1487
+ return /* @__PURE__ */ w("span", {
1488
+ "data-trace-tick": "",
1489
+ "data-labeled": f != null || void 0,
1490
+ className: "text-pho-description absolute inset-y-0 text-xs tabular-nums",
1491
+ 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)
1495
+ }) : null]
1496
+ }, p.ms);
1497
+ }),
1498
+ b != null && v == null ? /* @__PURE__ */ o("span", {
1499
+ "data-trace-cursor": "",
1500
+ 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))
1505
+ })
1506
+ }) : null,
1507
+ S ? /* @__PURE__ */ w(_e, { children: [
1508
+ /* @__PURE__ */ o("span", {
1509
+ "data-trace-selection-shade": "start",
1510
+ className: "bg-pho-inverse/10 pointer-events-none absolute inset-y-0 left-0",
1511
+ style: { width: K(S.left) }
1512
+ }),
1513
+ /* @__PURE__ */ o("span", {
1514
+ "data-trace-selection-shade": "end",
1515
+ className: "bg-pho-inverse/10 pointer-events-none absolute inset-y-0 right-0",
1516
+ style: { width: K(1 - S.left - S.width) }
1517
+ }),
1518
+ /* @__PURE__ */ o("span", {
1519
+ "data-trace-selection": "",
1520
+ "data-selecting": C != null || void 0,
1521
+ className: "border-pho-ink bg-pho-primary pointer-events-none absolute inset-y-0 flex items-center justify-center border-x-2",
1522
+ style: {
1523
+ left: K(S.left),
1524
+ width: K(S.width)
1525
+ },
1526
+ children: /* @__PURE__ */ w("span", {
1527
+ className: "bg-pho-primary text-pho-primary z-10 rounded-sm px-1 text-[10px] whitespace-nowrap tabular-nums",
1528
+ children: [
1529
+ Q(O(S.left)),
1530
+ " –",
1531
+ " ",
1532
+ Q(O(S.left + S.width))
1533
+ ]
1534
+ })
1535
+ }),
1536
+ /* @__PURE__ */ o(Ae, {
1537
+ at: S.left,
1538
+ "data-trace-selection-handle": "start",
1539
+ className: P(C == null && "cursor-ew-resize"),
1540
+ onPointerDown: C == null ? x("start") : void 0
1541
+ }),
1542
+ /* @__PURE__ */ o(Ae, {
1543
+ at: S.left + S.width,
1544
+ "data-trace-selection-handle": "end",
1545
+ className: P(C == null && "cursor-ew-resize"),
1546
+ onPointerDown: C == null ? x("end") : void 0
1547
+ })
1548
+ ] }) : null
1549
+ ]
1550
+ })
1551
+ });
1552
+ }
1553
+ function Ae({ at: e, className: t, ...n }) {
1554
+ return /* @__PURE__ */ w("span", {
1555
+ "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
+ style: { left: K(e) },
1558
+ ...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
+ });
1561
+ }
1562
+ function Mn({ spanCount: e, errorCount: t, orphanCount: n = 0, durationMs: a }) {
1563
+ const r = [ce(e, "span")];
1564
+ 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
+ function Ue({ className: e, ...t }) {
1567
+ const { spanCount: n, errorCount: a } = Be(), { range: r, orphans: s } = G(), l = Mn({
1568
+ spanCount: n,
1569
+ errorCount: a,
1570
+ orphanCount: s,
1571
+ durationMs: r.max - r.min
1572
+ });
1573
+ return /* @__PURE__ */ w("div", {
1574
+ "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
+ ...t,
1577
+ children: [/* @__PURE__ */ w("ul", {
1578
+ "data-trace-legend": "",
1579
+ className: "hidden shrink-0 items-center gap-3 @2xl:flex",
1580
+ children: [/* @__PURE__ */ o(Ce, {
1581
+ className: "bg-pho-inverse/25",
1582
+ label: "Span"
1583
+ }), /* @__PURE__ */ o(Ce, {
1584
+ className: "bg-pho-error-ink",
1585
+ label: "Error"
1586
+ })]
1587
+ }), /* @__PURE__ */ o("ul", {
1588
+ className: "flex min-w-0 items-center gap-3 overflow-hidden tabular-nums",
1589
+ children: l.map((i) => /* @__PURE__ */ o("li", {
1590
+ className: "shrink-0 last:min-w-0 last:truncate",
1591
+ children: i
1592
+ }, i))
1593
+ })]
1594
+ });
1595
+ }
1596
+ function Ce({ className: e, label: t }) {
1597
+ return /* @__PURE__ */ w("li", {
1598
+ className: "flex items-center gap-1.5",
1599
+ children: [/* @__PURE__ */ o("span", {
1600
+ "aria-hidden": !0,
1601
+ className: P("size-2.5 shrink-0 rounded-sm", e)
1602
+ }), t]
1603
+ });
1604
+ }
1605
+ var An = {
1606
+ debug: "text-pho-description",
1607
+ info: "text-pho-secondary",
1608
+ warn: "text-pho-warning",
1609
+ 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", {
1614
+ "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",
1624
+ children: [
1625
+ e.length,
1626
+ " ",
1627
+ e.length === 1 ? "line" : "lines"
1628
+ ]
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",
1636
+ 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
+ })
1652
+ ]
1653
+ }, l.id ?? i);
1654
+ })
1655
+ })]
1656
+ });
1657
+ }
1658
+ var Sn = Object.assign(xn, { Footer: Ue }), jn = {
1659
+ Waterfall: Sn,
1660
+ Logs: Cn
1661
+ };
1662
+ 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,
1673
+ ie as O,
1674
+ _t as P,
1675
+ Kn as R,
1676
+ G as S,
1677
+ Nt as T,
1678
+ St as V,
1679
+ Jt as _,
1680
+ ye as a,
1681
+ 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
+ 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,
1700
+ J as w,
1701
+ ee as x,
1702
+ Zt as y,
1703
+ Ct as z
1704
+ };
1705
+
1706
+ //# sourceMappingURL=trace-Hku-rImp.js.map