@overdoser/react-toolkit 0.9.0 → 0.11.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,396 +1,469 @@
1
- import { jsx as n, jsxs as r, Fragment as R } from "react/jsx-runtime";
2
- import { forwardRef as Ht, useRef as M, useState as x, useCallback as le, useEffect as Et, useLayoutEffect as Pt, useMemo as Bt } from "react";
1
+ import { jsx as l, jsxs as a, Fragment as P } from "react/jsx-runtime";
2
+ import { forwardRef as ul, useRef as p, useState as v, useEffect as ae, useCallback as ie, useLayoutEffect as ml, useMemo as Ct } from "react";
3
3
  import c from "clsx";
4
- import a from "./Timeline.module.scss.js";
5
- import l from "./TraceTimeline.module.scss.js";
6
- import { fmtDateISO as Re, fmtISO as I, ticks as Dt, fmtClockUTC as Je, TL_COLORS as v, fmtDur as se, eventMatches as It, tint as H, TIMELINE_PALETTE_VARS as Qe } from "./timelineCore.js";
7
- import { traceChipWidth as qt, layoutTraceBand as Wt } from "./traceLayout.js";
8
- import { TimelineSummary as Ot, TimelineZoomControls as At, TimelineLegend as Vt, HighlightText as Ut, TimelineTooltip as Xt } from "./TimelineShared.js";
9
- import { useNowTicker as $t, useContainerWidth as Ft, useTimelinePan as Kt, useWheelZoom as jt, animateScrollTo as zt } from "./useTimeline.js";
10
- const g = 84, et = 24, Zt = 51, ae = 300, an = Ht(
11
- function(tt, nt) {
4
+ import i from "./Timeline.module.scss.js";
5
+ import t from "./TraceTimeline.module.scss.js";
6
+ import { fmtDateISO as be, fmtClockUTC as A, fmtISO as V, ticks as hl, tickSubdiv as pl, TL_COLORS as S, fmtDur as we, eventMatches as fl, tint as D, TIMELINE_PALETTE_VARS as Tt } from "./timelineCore.js";
7
+ import { traceChipWidth as gl, layoutTraceBand as vl } from "./traceLayout.js";
8
+ import { TimelineSummary as Nl, TimelineZoomControls as yl, TimelineLegend as bl, HighlightText as kt, TimelineTooltip as wl } from "./TimelineShared.js";
9
+ import { useNowTicker as xl, useContainerWidth as Sl, useTimelinePan as Cl, useWheelZoom as Tl, animateScrollTo as Mt } from "./useTimeline.js";
10
+ import { CopyButton as xe } from "../ActionButton/CopyButton.js";
11
+ const N = 84, Lt = 24, F = 400, kl = 51, Se = 300, Il = ul(
12
+ function(Bt, Rt) {
12
13
  const {
13
- events: d,
14
- title: ie,
15
- meta: re,
16
- highlight: ce,
17
- defaultHighlight: lt,
18
- onHighlightChange: st,
19
- showSearch: at = !0,
20
- renderSearch: He,
21
- services: Ee,
22
- serviceColors: it,
23
- compactRows: rt = !1,
24
- showGridlines: ct = !0,
25
- showControls: Pe = !0,
26
- showLegend: ot = !0,
27
- showSummary: K = !1,
28
- summaryPlacement: E = "left",
29
- summaryDefaultPosition: dt,
30
- maxHeight: ut = "80vh",
31
- selectedEventId: oe,
32
- defaultSelectedEventId: ht = null,
33
- onEventSelect: mt,
34
- renderChip: Be,
35
- renderTooltip: de,
36
- renderDetails: ue,
37
- classes: h,
38
- className: pt,
39
- style: ft
40
- } = tt, m = M(null), [De, Ie] = x(null), [qe, We] = x(!0), [p, he] = x(null), [vt, Oe] = x(null), [T, me] = x(null), [q, Ae] = x(null), [gt, Nt] = x(null), [yt, wt] = x(ht), P = oe !== void 0 ? oe : yt, [j, xt] = x({ l: 0, w: 0 }), Ve = M(K);
41
- Ve.current = K;
42
- const pe = le(() => {
43
- const e = m.current;
44
- e && xt(
45
- (t) => t.l === e.scrollLeft && t.w === e.clientWidth ? t : { l: e.scrollLeft, w: e.clientWidth }
14
+ events: u,
15
+ title: Ce,
16
+ meta: Te,
17
+ highlight: ke,
18
+ defaultHighlight: Ht,
19
+ onHighlightChange: Et,
20
+ showSearch: Pt = !0,
21
+ renderSearch: Ze,
22
+ services: _e,
23
+ serviceColors: Dt,
24
+ compactRows: qt = !1,
25
+ showGridlines: Ot = !0,
26
+ showControls: Ye = !0,
27
+ showLegend: Wt = !0,
28
+ showSummary: re = !0,
29
+ summaryPlacement: R = "bubble",
30
+ summaryDefaultPosition: It,
31
+ showDock: C = !0,
32
+ defaultDock: At = null,
33
+ maxHeight: Vt = "80vh",
34
+ minHeight: Ft = 420,
35
+ selectedEventId: U,
36
+ defaultSelectedEventId: Qe = null,
37
+ onEventSelect: Ut,
38
+ renderChip: et,
39
+ renderTooltip: Me,
40
+ renderDetails: Le,
41
+ classes: m,
42
+ className: zt,
43
+ style: $t
44
+ } = Bt, f = p(null), [tt, lt] = v(null), [nt, st] = v(!0), [y, Be] = v(null), [Jt, at] = v(null), [H, Re] = v(null), [z, it] = v(null), [Kt, Xt] = v(null), [jt, Gt] = v(null), rt = p(!1), [Zt, _t] = v(Qe), g = U !== void 0 ? U : Zt, [x, $] = v(
45
+ () => C ? At ?? ((U !== void 0 ? U : Qe) != null ? "details" : null) : null
46
+ ), ct = p(g);
47
+ ae(() => {
48
+ g != null && g !== ct.current && C && x == null && $("details"), ct.current = g;
49
+ }, [g, C, x]);
50
+ const [ce, Yt] = v({ l: 0, w: 0 }), ot = p(re);
51
+ ot.current = re;
52
+ const He = ie(() => {
53
+ const e = f.current;
54
+ e && Yt(
55
+ (n) => n.l === e.scrollLeft && n.w === e.clientWidth ? n : { l: e.scrollLeft, w: e.clientWidth }
46
56
  );
47
57
  }, []);
48
- Et(() => {
49
- K && pe();
58
+ ae(() => {
59
+ re && He();
50
60
  });
51
- const Ue = d.some((e) => e.end == null), b = $t(Ue, 400), fe = Ft(m), W = Kt(m), [bt, Mt] = x(lt ?? ""), ve = ce !== void 0 ? ce : bt, L = ve.trim(), Xe = (e) => {
52
- ce === void 0 && Mt(e), st?.(e);
53
- }, $e = He ? He({ value: ve, setValue: Xe }) : at ? /* @__PURE__ */ n(
61
+ const [J, Qt] = v({ l: 0, w: 2e3 }), Ee = p(J);
62
+ Ee.current = J;
63
+ const Pe = ie(() => {
64
+ const e = f.current;
65
+ if (!e) return;
66
+ const n = Math.floor(e.scrollLeft / F) * F, s = (Math.ceil((e.clientWidth || 1600) / F) + 1) * F;
67
+ (n !== Ee.current.l || s !== Ee.current.w) && Qt({ l: n, w: s });
68
+ }, []), dt = u.some((e) => e.end == null), M = xl(dt, 400), oe = Sl(f), K = Cl(f), X = p(null), j = p(null), ut = p(null), [el, mt] = v(null), G = p(null);
69
+ ae(
70
+ () => () => {
71
+ G.current && clearTimeout(G.current);
72
+ },
73
+ []
74
+ );
75
+ const [tl, ll] = v(Ht ?? ""), De = ke !== void 0 ? ke : tl, B = De.trim(), ht = (e) => {
76
+ ke === void 0 && ll(e), Et?.(e);
77
+ }, pt = Ze ? Ze({ value: De, setValue: ht }) : Pt ? /* @__PURE__ */ l(
54
78
  "input",
55
79
  {
56
- className: c(a.searchInput, h?.search),
80
+ className: c(i.searchInput, m?.search),
57
81
  placeholder: "Highlight keyword in events…",
58
82
  "aria-label": "Highlight keyword",
59
- value: ve,
60
- onChange: (e) => Xe(e.target.value)
83
+ value: De,
84
+ onChange: (e) => ht(e.target.value)
61
85
  }
62
- ) : null, O = (e) => e.op || e.requestId || e.reqHeaders && e.reqHeaders["x-request-id"] || e.id, z = (e) => e.source || "client";
63
- let u, k;
64
- d.length ? (u = Math.min(...d.map((e) => e.start)), k = Math.max(u + 1e3, ...d.map((e) => e.end ?? b))) : (u = b - 3e4, k = b + 5e3);
65
- const ge = (k - u) * 0.03;
66
- u -= ge, k += ge;
67
- const A = k - u, Fe = Math.max(240, fe - g - et), Z = Math.max(Fe * 0.45, Fe - 210) / A, N = qe || !De ? Z : De, Ne = M(Z), B = M(N), ye = M(u), we = M(1e9);
68
- Ne.current = Z, B.current = N, ye.current = u;
69
- const _ = M(null);
70
- Pt(() => {
71
- _.current != null && m.current && (m.current.scrollLeft = _.current, _.current = null);
86
+ ) : null, q = (e) => e.op || e.requestId || e.reqHeaders && e.reqHeaders["x-request-id"] || e.id, Z = (e) => e.source || "client";
87
+ let d, _;
88
+ u.length ? (d = Math.min(...u.map((e) => e.start)), _ = Math.max(d + 1e3, ...u.map((e) => e.end ?? M))) : (d = M - 3e4, _ = M + 5e3);
89
+ const qe = (_ - d) * 0.03;
90
+ d -= qe, _ += qe;
91
+ const Oe = _ - d, ft = Math.max(240, oe - N - Lt), de = Math.max(ft * 0.45, ft - 210) / Oe, b = nt || !tt ? de : tt, We = p(de), O = p(b), Ie = p(d), Ae = p(1e9);
92
+ We.current = de, O.current = b, Ie.current = d;
93
+ const ue = p(null);
94
+ ml(() => {
95
+ ue.current != null && f.current && (f.current.scrollLeft = ue.current, ue.current = null), Pe();
72
96
  });
73
- const xe = le((e, t) => {
74
- const s = m.current;
97
+ const Ve = ie((e, n) => {
98
+ const s = f.current;
75
99
  if (!s) return;
76
- const y = B.current || 1e-3, o = Math.max(Ne.current ? Ne.current * 0.2 : 1e-7, Math.min(10, y * e)), f = (s.scrollLeft + t - g) / y;
77
- _.current = f * o + g - t, We(!1), Ie(o);
100
+ const h = O.current || 1e-3, o = Math.max(We.current ? We.current * 0.2 : 1e-7, Math.min(10, h * e)), w = (s.scrollLeft + n - N) / h;
101
+ ue.current = w * o + N - n, st(!1), lt(o);
78
102
  }, []);
79
- jt(m, (e) => {
103
+ Tl(f, (e) => {
80
104
  e.preventDefault();
81
- const t = m.current;
82
- t && xe(
105
+ const n = f.current;
106
+ n && Ve(
83
107
  Math.exp(-(e.deltaY || e.deltaX) * 22e-4),
84
- e.clientX - t.getBoundingClientRect().left
108
+ e.clientX - n.getBoundingClientRect().left
85
109
  );
86
110
  });
87
- const be = M(null), St = le(() => {
88
- be.current == null && (be.current = requestAnimationFrame(() => {
89
- be.current = null;
90
- const e = m.current;
91
- if (!e || !B.current) return;
92
- const t = ye.current + Math.max(0, e.scrollLeft + 117 - g) / B.current;
93
- Nt(Re(t)), Ve.current && pe();
111
+ const Fe = p(null), nl = ie(() => {
112
+ Fe.current == null && (Fe.current = requestAnimationFrame(() => {
113
+ Fe.current = null;
114
+ const e = f.current;
115
+ if (!e || !O.current) return;
116
+ const n = Ie.current + Math.max(0, e.scrollLeft + 117 - N) / O.current;
117
+ Xt(be(n)), Gt(rt.current ? A(n) : null), Pe(), ot.current && He();
94
118
  }));
95
- }, [pe]), Me = M(null), Tt = le((e) => {
96
- const t = e.clientX;
97
- Me.current == null && (Me.current = requestAnimationFrame(() => {
98
- Me.current = null;
99
- const s = m.current;
119
+ }, [He, Pe]), Ue = p(null), sl = ie((e) => {
120
+ const n = e.clientX;
121
+ Ue.current == null && (Ue.current = requestAnimationFrame(() => {
122
+ Ue.current = null;
123
+ const s = f.current;
100
124
  if (!s) return;
101
- const y = s.getBoundingClientRect(), o = t - y.left + s.scrollLeft;
102
- if (o < g + 5 || !B.current) {
103
- me(null);
125
+ const h = s.getBoundingClientRect(), o = n - h.left + s.scrollLeft;
126
+ if (o < N + 5 || !O.current) {
127
+ Re(null);
104
128
  return;
105
129
  }
106
- const f = ye.current + (o - g) / B.current, w = Math.max(88, Math.min(Math.round(o), we.current - 88));
107
- me({ left: Math.round(o), chipLeft: w, label: I(f, !0), t: f });
130
+ const w = Ie.current + (o - N) / O.current, k = Math.max(88, Math.min(Math.round(o), Ae.current - 88));
131
+ Re({ left: Math.round(o), chipLeft: k, label: V(w, !0), t: w });
108
132
  }));
109
- }, []), Se = (e) => {
110
- oe === void 0 && wt(e ? e.id : null), mt?.(e);
111
- }, Ke = Bt(() => {
133
+ }, []), me = (e) => {
134
+ U === void 0 && _t(e ? e.id : null), Ut?.(e);
135
+ }, ze = Ct(() => {
112
136
  const e = [];
113
- return (Ee || []).forEach((t) => {
114
- d.some((s) => s.service === t) && e.push(t);
115
- }), d.forEach((t) => {
116
- e.includes(t.service) || e.push(t.service);
137
+ return (_e || []).forEach((n) => {
138
+ u.some((s) => s.service === n) && e.push(n);
139
+ }), u.forEach((n) => {
140
+ e.includes(n.service) || e.push(n.service);
117
141
  }), e;
118
- }, [d, Ee]), S = {};
119
- Ke.forEach((e, t) => {
120
- S[e] = Qe[t % Qe.length];
121
- }), Object.assign(S, it);
122
- const je = rt, ze = je ? 20 : 26, Lt = je ? 60 : 66, kt = d.map((e) => ({
142
+ }, [u, _e]), L = {};
143
+ ze.forEach((e, n) => {
144
+ L[e] = Tt[n % Tt.length];
145
+ }), Object.assign(L, Dt);
146
+ const gt = qt, vt = gt ? 20 : 26, al = gt ? 60 : 66, il = u.map((e) => ({
123
147
  id: e.id,
124
- left: Math.round(g + (e.start - u) * N),
125
- width: Math.round(Math.max(12, ((e.end ?? b) - e.start) * N)),
126
- labelW: qt(z(e), e.service, String(O(e)))
127
- })), Y = Wt(kt, {
128
- barH: ze,
129
- rowH: Lt,
130
- chipH: Zt,
131
- minH: 420
132
- }), G = new Map(Y.items.map((e) => [e.id, e])), Ze = Dt(u, k, A * N, 64), Te = [];
133
- let _e = null;
134
- Ze.list.forEach((e) => {
135
- const t = Re(e.t);
136
- Te.push({
137
- left: Math.round(g + (e.t - u) * N),
138
- label: Je(e.t),
139
- dateLabel: t !== _e ? t : null
140
- }), _e = t;
148
+ left: Math.round(N + (e.start - d) * b),
149
+ width: Math.round(Math.max(12, ((e.end ?? M) - e.start) * b)),
150
+ labelW: gl(Z(e), e.service, String(q(e)))
151
+ })), he = vl(il, {
152
+ barH: vt,
153
+ rowH: al,
154
+ chipH: kl,
155
+ minH: Ft
156
+ }), pe = new Map(he.items.map((e) => [e.id, e])), $e = Math.ceil(Math.max(N + Oe * b + Lt + 60, he.maxExt + 26));
157
+ Ae.current = $e;
158
+ const rl = d + ($e - N) / b, Y = Math.max(d, d + (J.l - F - N) / b), fe = Math.min(rl, d + (J.l + J.w + F - N) / b), E = hl(Y, fe, Math.max(1, (fe - Y) * b), 64), ge = E.step < 1e3;
159
+ rt.current = ge;
160
+ const Je = [], Nt = Math.max(d, (E.list.length ? E.list[0].t : Y) - E.step);
161
+ let yt = be(Nt), bt = A(Nt);
162
+ E.list.forEach((e) => {
163
+ const n = be(e.t), s = A(e.t);
164
+ Je.push({
165
+ left: Math.round(N + (e.t - d) * b),
166
+ date: n !== yt ? n : null,
167
+ time: !ge || s !== bt ? s : null,
168
+ sub: ge ? "." + String(new Date(e.t).getUTCMilliseconds()).padStart(3, "0") : null
169
+ }), yt = n, bt = s;
141
170
  });
142
- const Ye = [], J = Ze.step / 4;
143
- if (A / J < 700)
144
- for (let e = Math.ceil(u / J); e * J <= k; e++)
145
- e % 4 !== 0 && Ye.push(Math.round(g + (e * J - u) * N));
146
- const Ge = Math.ceil(Math.max(g + A * N + et + 60, Y.maxExt + 26));
147
- we.current = Ge;
148
- const Le = T ? T.t : null, i = P != null && d.find((e) => e.id === P) || null, Ct = (e, t) => {
149
- const s = G.get(e.id);
171
+ const wt = [], W = pl(E.step);
172
+ if (W.parts > 1) {
173
+ const e = E.step / W.parts;
174
+ if ((fe - Y) / e < 2e3)
175
+ for (let n = Math.ceil(Y / e); n * e <= fe; n++)
176
+ n % W.parts !== 0 && wt.push({
177
+ left: Math.round(N + (n * e - d) * b),
178
+ medium: W.medium > 0 && n % W.parts === W.medium
179
+ });
180
+ }
181
+ const Ke = H ? H.t : null, r = g != null && u.find((e) => e.id === g) || null;
182
+ ae(() => {
183
+ const e = X.current;
184
+ if (e == null) return;
185
+ const n = f.current;
186
+ if (!n) {
187
+ X.current = null;
188
+ return;
189
+ }
190
+ if (n.clientWidth && n.clientWidth !== oe) return;
191
+ X.current = null;
192
+ const s = pe.get(e);
193
+ s && Mt(n, { left: Math.max(0, s.left + s.width / 2 - n.clientWidth / 2) });
194
+ }), ae(() => {
195
+ const e = j.current;
196
+ if (e == null) return;
197
+ const n = ut.current;
198
+ if (!n) return;
199
+ j.current = null;
200
+ const s = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/"/g, '\\"'), h = n.querySelector(`[data-crk-log-id="${s}"]`);
201
+ if (!h) return;
202
+ const o = Math.max(
203
+ 0,
204
+ n.scrollTop + h.getBoundingClientRect().top - n.getBoundingClientRect().top - 8
205
+ );
206
+ Mt(n, { top: o }, 600), mt(e), G.current && clearTimeout(G.current), G.current = setTimeout(() => mt(null), 1200);
207
+ });
208
+ const cl = (e, n) => {
209
+ const s = pe.get(e.id);
150
210
  if (!s) return;
151
- const y = e.end == null, o = (e.end ?? b) - e.start;
152
- if (Ae({
211
+ const h = e.end == null, o = (e.end ?? M) - e.start;
212
+ if (it({
153
213
  left: s.left,
154
- chipLeft: Math.max(88, Math.min(s.left, we.current - 88)),
155
- label: I(e.start, !0)
156
- }), Oe(e.id), P === e.id) return;
157
- const f = m.current, w = f ? f.getBoundingClientRect() : { left: 0 }, V = f ? f.scrollLeft : 0, ee = window.innerWidth || 1200, U = window.innerHeight || 800, te = s.showLabel ? s.labelW : 0, X = s.showLabel ? s.labelX : s.left, Ce = w.left - V + Math.min(s.left, X), $ = w.left - V + Math.max(s.left + s.width, X + te), F = t.currentTarget.getBoundingClientRect();
158
- let C = $ + 28, ne = Math.max(95, Math.min(t.clientY, U - 120));
159
- C + ae > ee - 12 && (C = Ce - ae - 28), C < 12 && (C = Math.max(12, Math.min(ee - ae - 12, t.clientX - ae / 2)), ne = F.bottom + 108, ne > U - 95 && (ne = Math.max(95, F.top - 108))), he({
214
+ chipLeft: Math.max(88, Math.min(s.left, Ae.current - 88)),
215
+ label: V(e.start, !0)
216
+ }), at(e.id), g === e.id) return;
217
+ const w = f.current, k = w ? w.getBoundingClientRect() : { left: 0 }, ee = w ? w.scrollLeft : 0, ve = window.innerWidth || 1200, te = window.innerHeight || 800, Ne = s.showLabel ? s.labelW : 0, le = s.showLabel ? s.labelX : s.left, Ge = k.left - ee + Math.min(s.left, le), ne = k.left - ee + Math.max(s.left + s.width, le + Ne), se = n.currentTarget.getBoundingClientRect();
218
+ let T = ne + 28, ye = Math.max(95, Math.min(n.clientY, te - 120));
219
+ T + Se > ve - 12 && (T = Ge - Se - 28), T < 12 && (T = Math.max(12, Math.min(ve - Se - 12, n.clientX - Se / 2)), ye = se.bottom + 108, ye > te - 95 && (ye = Math.max(95, se.top - 108))), Be({
160
220
  id: e.id,
161
- x: C,
162
- y: ne,
163
- rid: String(O(e)),
164
- route: z(e) + " → " + e.service,
221
+ x: T,
222
+ y: ye,
223
+ rid: String(q(e)),
224
+ route: Z(e) + " → " + e.service,
165
225
  label: e.label || (e.method || "GET") + " " + (e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : e.id),
166
- time: I(e.start, !0),
167
- durLine: y ? "in flight · " + se(o) + " so far" : se(o) + " · status " + (e.status ?? "—"),
226
+ time: V(e.start, !0),
227
+ durLine: h ? "in flight · " + we(o) + " so far" : we(o) + " · status " + (e.status ?? "—"),
168
228
  url: e.url || ""
169
229
  });
170
- }, Rt = () => {
171
- he(null), Ae(null), Oe(null);
172
- }, ke = (e) => Object.entries(e || {}).map(([t, s]) => ({ k: t, v: String(s) })), D = i ? i.end == null : !1, Q = K ? /* @__PURE__ */ n(
173
- Ot,
230
+ }, ol = () => {
231
+ Be(null), it(null), at(null);
232
+ }, Xe = (e) => Object.entries(e || {}).map(([n, s]) => ({ k: n, v: String(s) })), I = r ? r.end == null : !1, xt = C ? x === "details" : r != null, dl = C && x === "log", je = () => {
233
+ me(null), C && $(null);
234
+ }, St = Ct(() => u.slice().sort((e, n) => e.start - n.start), [u]), Q = re ? /* @__PURE__ */ l(
235
+ Nl,
174
236
  {
175
- className: h?.summary,
176
- placement: E,
177
- floatingDefaultPosition: dt,
178
- items: d.slice().sort((e, t) => e.start - t.start).map((e, t) => {
179
- const s = G.get(e.id);
237
+ className: m?.summary,
238
+ placement: R,
239
+ floatingDefaultPosition: It,
240
+ bubbleGlyphColors: ze.slice(0, 3).map((e) => L[e]),
241
+ items: St.map((e, n) => {
242
+ const s = pe.get(e.id);
180
243
  return {
181
244
  id: e.id,
182
- number: String(t + 1).padStart(2, "0"),
183
- label: String(O(e)),
184
- color: S[e.service] || v.body,
185
- time: Je(e.start),
186
- inView: !s || !j.w ? !0 : s.left < j.l + j.w && s.left + s.width > j.l,
187
- selected: P === e.id
245
+ number: String(n + 1).padStart(2, "0"),
246
+ label: String(q(e)),
247
+ color: L[e.service] || S.body,
248
+ time: A(e.start),
249
+ inView: !s || !ce.w ? !0 : s.left < ce.l + ce.w && s.left + s.width > ce.l,
250
+ selected: g === e.id
188
251
  };
189
252
  }),
190
253
  onPick: (e) => {
191
- const t = G.get(e), s = m.current;
192
- !t || !s || zt(s, {
193
- left: Math.max(0, t.left + t.width / 2 - s.clientWidth / 2)
194
- });
254
+ const n = u.find((s) => s.id === e);
255
+ n && (me(n), x === "log" && (j.current = e)), X.current = e;
195
256
  }
196
257
  }
197
258
  ) : null;
198
- return /* @__PURE__ */ r("div", { ref: nt, className: c(a.root, h?.root, pt), style: ft, children: [
199
- (Pe || $e || ie != null || re != null) && /* @__PURE__ */ r("div", { className: c(a.toolbar, h?.toolbar), children: [
200
- /* @__PURE__ */ r("div", { className: a.toolbarText, children: [
201
- ie != null && /* @__PURE__ */ n("span", { className: a.toolbarTitle, children: ie }),
202
- /* @__PURE__ */ n("span", { className: a.toolbarMeta, children: re ?? (d.length ? `${d.length} events · span ${se(A - 2 * ge)} · times in UTC` : "No events") })
259
+ return /* @__PURE__ */ a("div", { ref: Rt, className: c(i.root, m?.root, zt), style: $t, children: [
260
+ (Ye || pt || Ce != null || Te != null) && /* @__PURE__ */ a("div", { className: c(i.toolbar, m?.toolbar), children: [
261
+ /* @__PURE__ */ a("div", { className: i.toolbarText, children: [
262
+ Ce != null && /* @__PURE__ */ l("span", { className: i.toolbarTitle, children: Ce }),
263
+ /* @__PURE__ */ l("span", { className: i.toolbarMeta, children: Te ?? (u.length ? `${u.length} events · span ${we(Oe - 2 * qe)} · times in UTC` : "No events") })
203
264
  ] }),
204
- $e,
205
- Pe && /* @__PURE__ */ n(
206
- At,
265
+ pt,
266
+ Ye && /* @__PURE__ */ l(
267
+ yl,
207
268
  {
208
- zoomPct: `${Math.round(N / Z * 100)}%`,
209
- fitActive: qe,
210
- onZoomIn: () => xe(1.5, fe / 2),
211
- onZoomOut: () => xe(1 / 1.5, fe / 2),
269
+ zoomPct: `${Math.round(b / de * 100)}%`,
270
+ fitActive: nt,
271
+ onZoomIn: () => Ve(1.5, oe / 2),
272
+ onZoomOut: () => Ve(1 / 1.5, oe / 2),
212
273
  onFit: () => {
213
- We(!0), Ie(null);
274
+ st(!0), lt(null);
214
275
  },
215
276
  hint: "scroll zooms · drag pans"
216
277
  }
217
278
  )
218
279
  ] }),
219
- ot && /* @__PURE__ */ n(
220
- Vt,
280
+ Wt && /* @__PURE__ */ l(
281
+ bl,
221
282
  {
222
- className: h?.legend,
223
- items: Ke.map((e) => ({ name: e, color: S[e] }))
283
+ className: m?.legend,
284
+ items: ze.map((e) => ({ name: e, color: L[e] }))
224
285
  }
225
286
  ),
226
- E === "top" && Q,
227
- /* @__PURE__ */ r("div", { className: a.layout, children: [
228
- E === "left" && Q,
229
- /* @__PURE__ */ r("div", { className: a.main, children: [
230
- /* @__PURE__ */ n("div", { className: c(a.card, h?.card), children: /* @__PURE__ */ n(
287
+ R === "top" && Q,
288
+ /* @__PURE__ */ a("div", { className: i.layout, children: [
289
+ R === "left" && Q,
290
+ /* @__PURE__ */ a("div", { className: i.main, children: [
291
+ /* @__PURE__ */ l("div", { className: c(i.card, m?.card), children: /* @__PURE__ */ l(
231
292
  "div",
232
293
  {
233
- ref: m,
234
- className: c(a.scroller, l.scroller, h?.scroller),
235
- style: { maxHeight: ut },
236
- onPointerDown: W.onPointerDown,
237
- onPointerMove: W.onPointerMove,
238
- onPointerUp: W.onPointerUp,
294
+ ref: f,
295
+ className: c(i.scroller, t.scroller, m?.scroller),
296
+ style: { maxHeight: Vt },
297
+ onPointerDown: K.onPointerDown,
298
+ onPointerMove: K.onPointerMove,
299
+ onPointerUp: K.onPointerUp,
239
300
  onPointerLeave: () => {
240
- W.onPointerUp(), me(null);
301
+ K.onPointerUp(), Re(null);
241
302
  },
242
- onMouseMove: Tt,
243
- onScroll: St,
244
- children: /* @__PURE__ */ r("div", { className: l.inner, style: { width: Ge }, children: [
245
- ct && Te.map((e, t) => /* @__PURE__ */ n("div", { className: l.gridline, style: { left: e.left } }, t)),
246
- Ue && /* @__PURE__ */ n(
303
+ onMouseMove: sl,
304
+ onScroll: nl,
305
+ children: /* @__PURE__ */ a("div", { className: t.inner, style: { width: $e }, children: [
306
+ Ot && Je.map((e, n) => /* @__PURE__ */ l("div", { className: t.gridline, style: { left: e.left } }, n)),
307
+ dt && /* @__PURE__ */ l(
247
308
  "div",
248
309
  {
249
- className: l.nowLine,
250
- style: { left: Math.round(g + (b - u) * N) }
310
+ className: t.nowLine,
311
+ style: { left: Math.round(N + (M - d) * b) }
251
312
  }
252
313
  ),
253
- T && !p && /* @__PURE__ */ n("div", { className: l.cursorLine, style: { left: T.left } }),
254
- q && /* @__PURE__ */ n("div", { className: l.eventLine, style: { left: q.left } }),
255
- /* @__PURE__ */ r("div", { className: c(l.axis, h?.axis), children: [
256
- /* @__PURE__ */ n("div", { className: l.axisDivider }),
257
- /* @__PURE__ */ r("div", { className: l.axisSticky, children: [
258
- /* @__PURE__ */ n("span", { className: l.axisUtc, children: "UTC" }),
259
- /* @__PURE__ */ n("span", { className: l.axisViewDate, children: gt || (d.length ? Re(u) : "") })
314
+ H && !y && /* @__PURE__ */ l("div", { className: t.cursorLine, style: { left: H.left } }),
315
+ z && /* @__PURE__ */ l("div", { className: t.eventLine, style: { left: z.left } }),
316
+ /* @__PURE__ */ a("div", { className: c(t.axis, m?.axis), children: [
317
+ /* @__PURE__ */ l("div", { className: t.axisDivider }),
318
+ /* @__PURE__ */ a("div", { className: t.axisSticky, children: [
319
+ /* @__PURE__ */ l("span", { className: t.axisUtc, children: "UTC" }),
320
+ /* @__PURE__ */ l("span", { className: t.axisViewDate, children: Kt || (u.length ? be(d) : "") }),
321
+ ge && /* @__PURE__ */ l("span", { className: t.axisViewTime, children: jt || A(d) })
260
322
  ] }),
261
- Te.map((e, t) => /* @__PURE__ */ r("span", { children: [
262
- /* @__PURE__ */ n("span", { className: l.axisTickLabel, style: { left: e.left }, children: e.label }),
263
- e.dateLabel && /* @__PURE__ */ n("span", { className: l.axisDateLabel, style: { left: e.left }, children: e.dateLabel }),
264
- /* @__PURE__ */ n("span", { className: l.axisTickMark, style: { left: e.left } })
265
- ] }, t)),
266
- Ye.map((e, t) => /* @__PURE__ */ n("span", { className: l.axisMinorMark, style: { left: e } }, t)),
267
- T && !p && /* @__PURE__ */ n("div", { className: l.axisChip, style: { left: T.chipLeft }, children: T.label }),
268
- q && /* @__PURE__ */ r(
323
+ Je.map((e, n) => /* @__PURE__ */ a("span", { children: [
324
+ e.date && /* @__PURE__ */ l("span", { className: t.axisDateLabel, style: { left: e.left }, children: e.date }),
325
+ e.time && /* @__PURE__ */ l("span", { className: t.axisTickLabel, style: { left: e.left }, children: e.time }),
326
+ e.sub && /* @__PURE__ */ l("span", { className: t.axisSubLabel, style: { left: e.left }, children: e.sub }),
327
+ /* @__PURE__ */ l("span", { className: t.axisTickMark, style: { left: e.left } })
328
+ ] }, n)),
329
+ wt.map((e, n) => /* @__PURE__ */ l(
330
+ "span",
331
+ {
332
+ className: c(t.axisMinorMark, e.medium && t.axisMinorMedium),
333
+ style: { left: e.left }
334
+ },
335
+ n
336
+ )),
337
+ H && !y && /* @__PURE__ */ l("div", { className: t.axisChip, style: { left: H.chipLeft }, children: H.label }),
338
+ z && /* @__PURE__ */ a(
269
339
  "div",
270
340
  {
271
- className: c(l.axisChip, l.axisChipEvent),
272
- style: { left: q.chipLeft },
341
+ className: c(t.axisChip, t.axisChipEvent),
342
+ style: { left: z.chipLeft },
273
343
  children: [
274
344
  "▸ ",
275
- q.label
345
+ z.label
276
346
  ]
277
347
  }
278
348
  )
279
349
  ] }),
280
- /* @__PURE__ */ r("div", { className: l.lane, style: { height: Y.h }, children: [
281
- /* @__PURE__ */ n("div", { className: l.axisLine, style: { top: Y.axisY } }),
282
- d.map((e) => {
283
- const t = G.get(e.id);
284
- if (!t) return null;
285
- const s = S[e.service] || v.body, y = e.end == null, o = It(e, L), f = Le != null && Le >= e.start && Le <= (e.end ?? b), w = vt === e.id, V = L && !o ? 0.25 : 1, ee = String(O(e)), U = z(e), te = S[U] || v.body, X = S[e.service] || v.body, Ce = w ? `0 0 0 3px ${H(s, 55)}, 0 4px 14px rgba(35,32,28,.22)` : L && o ? `0 0 0 3px ${v.hlRing}` : P === e.id ? `0 0 0 3px ${v.selectedRing}` : f ? `0 0 0 3px ${H(s, 30)}` : "none", $ = w ? s : f ? v.stemHot : v.stem, F = {
350
+ /* @__PURE__ */ a("div", { className: t.lane, style: { height: he.h }, children: [
351
+ /* @__PURE__ */ l("div", { className: t.axisLine, style: { top: he.axisY } }),
352
+ u.map((e) => {
353
+ const n = pe.get(e.id);
354
+ if (!n) return null;
355
+ const s = L[e.service] || S.body, h = e.end == null, o = fl(e, B), w = Ke != null && Ke >= e.start && Ke <= (e.end ?? M), k = Jt === e.id, ee = B && !o ? 0.25 : 1, ve = String(q(e)), te = Z(e), Ne = L[te] || S.body, le = L[e.service] || S.body, Ge = k ? `0 0 0 3px ${D(s, 55)}, 0 4px 14px rgba(35,32,28,.22)` : B && o ? `0 0 0 3px ${S.hlRing}` : g === e.id ? `0 0 0 3px ${S.selectedRing}` : w ? `0 0 0 3px ${D(s, 30)}` : "none", ne = k ? s : w ? S.stemHot : S.stem, se = {
286
356
  onClick: () => {
287
- W.wasDragSuppressed() || (he(null), Se(P === e.id ? null : e));
357
+ if (K.wasDragSuppressed()) return;
358
+ Be(null);
359
+ const T = g === e.id ? null : e;
360
+ me(T), T && x === "log" && (j.current = T.id);
288
361
  },
289
- onMouseEnter: (C) => Ct(e, C),
290
- onMouseLeave: Rt
362
+ onMouseEnter: (T) => cl(e, T),
363
+ onMouseLeave: ol
291
364
  };
292
- return /* @__PURE__ */ r("span", { children: [
293
- t.showLabel && /* @__PURE__ */ r(R, { children: [
294
- t.conn && !t.hconn && /* @__PURE__ */ n(
365
+ return /* @__PURE__ */ a("span", { children: [
366
+ n.showLabel && /* @__PURE__ */ a(P, { children: [
367
+ n.conn && !n.hconn && /* @__PURE__ */ l(
295
368
  "div",
296
369
  {
297
- className: l.stem,
370
+ className: t.stem,
298
371
  style: {
299
- left: t.left,
300
- top: t.connTop,
301
- height: t.connH,
302
- background: $
372
+ left: n.left,
373
+ top: n.connTop,
374
+ height: n.connH,
375
+ background: ne
303
376
  }
304
377
  }
305
378
  ),
306
- t.conn && t.hconn && /* @__PURE__ */ r(R, { children: [
307
- /* @__PURE__ */ n(
379
+ n.conn && n.hconn && /* @__PURE__ */ a(P, { children: [
380
+ /* @__PURE__ */ l(
308
381
  "div",
309
382
  {
310
- className: l.stem,
383
+ className: t.stem,
311
384
  style: {
312
- left: t.left,
313
- top: t.connTop,
314
- height: t.connH,
315
- background: $
385
+ left: n.left,
386
+ top: n.connTop,
387
+ height: n.connH,
388
+ background: ne
316
389
  }
317
390
  }
318
391
  ),
319
- /* @__PURE__ */ n(
392
+ /* @__PURE__ */ l(
320
393
  "div",
321
394
  {
322
- className: l.elbow,
395
+ className: t.elbow,
323
396
  style: {
324
- left: t.hconnLeft,
325
- top: t.hconnTop,
326
- width: t.hconnW,
327
- background: $
397
+ left: n.hconnLeft,
398
+ top: n.hconnTop,
399
+ width: n.hconnW,
400
+ background: ne
328
401
  }
329
402
  }
330
403
  )
331
404
  ] }),
332
- /* @__PURE__ */ n(
405
+ /* @__PURE__ */ l(
333
406
  "div",
334
407
  {
335
- ...F,
336
- className: c(l.chip, h?.chip),
408
+ ...se,
409
+ className: c(t.chip, m?.chip),
337
410
  style: {
338
- left: t.labelX,
339
- top: t.labelTop,
340
- opacity: V,
341
- background: w ? H(s, 7) : L && o ? v.hlWashSoft : void 0,
342
- borderColor: w ? s : L && o ? v.hlBorder : f ? s : void 0,
343
- boxShadow: w ? `0 0 0 2px ${H(s, 40)}, 0 4px 12px rgba(35,32,28,.16)` : "0 1px 2px rgba(35,32,28,.06)"
411
+ left: n.labelX,
412
+ top: n.labelTop,
413
+ opacity: ee,
414
+ background: k ? D(s, 7) : B && o ? S.hlWashSoft : void 0,
415
+ borderColor: k ? s : B && o ? S.hlBorder : w ? s : void 0,
416
+ boxShadow: k ? `0 0 0 2px ${D(s, 40)}, 0 4px 12px rgba(35,32,28,.16)` : "0 1px 2px rgba(35,32,28,.06)"
344
417
  },
345
- children: Be ? Be(e, {
418
+ children: et ? et(e, {
346
419
  color: s,
347
- pending: y,
348
- durationMs: (e.end ?? b) - e.start
349
- }) : /* @__PURE__ */ r(R, { children: [
350
- /* @__PURE__ */ r("div", { children: [
351
- /* @__PURE__ */ n(
420
+ pending: h,
421
+ durationMs: (e.end ?? M) - e.start
422
+ }) : /* @__PURE__ */ a(P, { children: [
423
+ /* @__PURE__ */ a("div", { children: [
424
+ /* @__PURE__ */ l(
352
425
  "span",
353
426
  {
354
- className: l.chipBadge,
355
- style: { background: H(te, 14), color: te },
356
- children: U
427
+ className: t.chipBadge,
428
+ style: { background: D(Ne, 14), color: Ne },
429
+ children: te
357
430
  }
358
431
  ),
359
- /* @__PURE__ */ n("span", { className: l.chipArrow, children: " → " }),
360
- /* @__PURE__ */ n(
432
+ /* @__PURE__ */ l("span", { className: t.chipArrow, children: " → " }),
433
+ /* @__PURE__ */ l(
361
434
  "span",
362
435
  {
363
- className: l.chipBadge,
364
- style: { background: H(X, 14), color: X },
436
+ className: t.chipBadge,
437
+ style: { background: D(le, 14), color: le },
365
438
  children: e.service
366
439
  }
367
440
  )
368
441
  ] }),
369
- /* @__PURE__ */ n("div", { className: l.chipOp, children: /* @__PURE__ */ n(Ut, { text: ee, query: L }) }),
370
- /* @__PURE__ */ n("div", { className: l.chipTime, children: I(e.start, !0) })
442
+ /* @__PURE__ */ l("div", { className: t.chipOp, children: /* @__PURE__ */ l(kt, { text: ve, query: B }) }),
443
+ /* @__PURE__ */ l("div", { className: t.chipTime, children: V(e.start, !0) })
371
444
  ] })
372
445
  }
373
446
  )
374
447
  ] }),
375
- /* @__PURE__ */ n(
448
+ /* @__PURE__ */ l(
376
449
  "div",
377
450
  {
378
- ...F,
379
- className: c(l.bar, y && l.barPending, h?.bar),
451
+ ...se,
452
+ className: c(t.bar, h && t.barPending, m?.bar),
380
453
  style: {
381
- left: t.left,
382
- top: t.barTop,
383
- width: t.width,
384
- height: ze,
385
- background: L && o ? v.hlBarBg : H(s, 22),
454
+ left: n.left,
455
+ top: n.barTop,
456
+ width: n.width,
457
+ height: vt,
458
+ background: B && o ? S.hlBarBg : D(s, 22),
386
459
  borderColor: s,
387
- opacity: V,
388
- boxShadow: Ce
460
+ opacity: ee,
461
+ boxShadow: Ge
389
462
  },
390
- children: y && /* @__PURE__ */ n(
463
+ children: h && /* @__PURE__ */ l(
391
464
  "span",
392
465
  {
393
- className: c(a.pulseDot, l.barDot),
466
+ className: c(i.pulseDot, t.barDot),
394
467
  style: { background: s }
395
468
  }
396
469
  )
@@ -402,103 +475,283 @@ const g = 84, et = 24, Zt = 51, ae = 300, an = Ht(
402
475
  ] })
403
476
  }
404
477
  ) }),
405
- /* @__PURE__ */ n("div", { className: c(a.footnote, h?.footnote), children: "Click an event to open its details in the side panel · dashed pills are still in flight" })
478
+ /* @__PURE__ */ l("div", { className: c(i.footnote, m?.footnote), children: "Click an event to open its details in the side panel · dashed pills are still in flight" }),
479
+ R === "bubble" && Q
406
480
  ] }),
407
- i && ue && /* @__PURE__ */ n("aside", { className: c(a.aside, l.drawerCustom, h?.drawer), children: ue(i, { close: () => Se(null), pending: D }) }),
408
- i && !ue && /* @__PURE__ */ r("aside", { className: c(a.aside, h?.drawer), children: [
409
- /* @__PURE__ */ r("div", { className: l.drawerHead, children: [
410
- /* @__PURE__ */ r("div", { className: l.drawerHeadRow, children: [
411
- /* @__PURE__ */ n("span", { className: l.methodBadge, children: i.method || "—" }),
412
- /* @__PURE__ */ n(
413
- "span",
414
- {
415
- className: c(
416
- l.statusBadge,
417
- D && l.statusPending,
418
- !D && (i.status ?? 0) >= 400 && l.statusError
419
- ),
420
- children: D ? "pending" : String(i.status ?? "—")
421
- }
422
- ),
423
- /* @__PURE__ */ n("span", { className: l.drawerRoute, children: z(i) + " → " + i.service }),
424
- /* @__PURE__ */ n("div", { className: l.drawerSpacer }),
425
- /* @__PURE__ */ n(
426
- "button",
427
- {
428
- type: "button",
429
- className: a.asideClose,
430
- "aria-label": "Close details",
431
- onClick: () => Se(null),
432
- children: "✕"
433
- }
434
- )
435
- ] }),
436
- /* @__PURE__ */ n("div", { className: l.drawerUrl, children: i.url || i.label || i.id }),
437
- /* @__PURE__ */ n("div", { className: l.drawerRid, children: String(O(i)) }),
438
- /* @__PURE__ */ n("div", { className: l.drawerXrid, children: i.reqHeaders && i.reqHeaders["x-request-id"] || i.requestId || i.id }),
439
- /* @__PURE__ */ n("div", { className: l.drawerTiming, children: I(i.start, !0) + (D ? " · in flight" : " → " + I(i.end, !0) + " · " + se(i.end - i.start)) })
481
+ xt && r && Le && /* @__PURE__ */ l("aside", { className: c(i.aside, t.drawerCustom, m?.drawer), children: Le(r, { close: je, pending: I }) }),
482
+ xt && !(r && Le) && /* @__PURE__ */ a("aside", { className: c(i.aside, C && t.dockAside, m?.drawer), children: [
483
+ C && /* @__PURE__ */ a("div", { className: t.dockHead, children: [
484
+ /* @__PURE__ */ l("span", { className: t.dockTitle, children: "Event details" }),
485
+ /* @__PURE__ */ l("div", { className: t.drawerSpacer }),
486
+ /* @__PURE__ */ l(
487
+ "button",
488
+ {
489
+ type: "button",
490
+ className: i.asideClose,
491
+ "aria-label": "Close details",
492
+ onClick: je,
493
+ children: "✕"
494
+ }
495
+ )
440
496
  ] }),
441
- /* @__PURE__ */ r("div", { className: l.drawerBody, children: [
442
- /* @__PURE__ */ n("div", { className: l.drawerSection, children: "Request" }),
443
- !!Object.keys(i.query || {}).length && /* @__PURE__ */ r(R, { children: [
444
- /* @__PURE__ */ n("div", { className: a.asideSection, children: "Query parameters" }),
445
- ke(i.query).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
446
- /* @__PURE__ */ n("span", { className: c(l.kvKey, l.kvKeyQuery), children: e.k }),
447
- /* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
448
- ] }, e.k))
449
- ] }),
450
- /* @__PURE__ */ n("div", { className: a.asideSection, children: "Headers" }),
451
- ke(i.reqHeaders).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
452
- /* @__PURE__ */ n("span", { className: l.kvKey, children: e.k }),
453
- /* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
454
- ] }, e.k)),
455
- i.reqBody != null && /* @__PURE__ */ r(R, { children: [
456
- /* @__PURE__ */ n("div", { className: a.asideSection, children: "Body" }),
457
- /* @__PURE__ */ n("pre", { className: a.asideRaw, children: JSON.stringify(i.reqBody, null, 2) })
497
+ r ? /* @__PURE__ */ a("div", { className: C ? t.dockScroll : void 0, children: [
498
+ /* @__PURE__ */ a("div", { className: t.drawerHead, children: [
499
+ /* @__PURE__ */ a("div", { className: t.drawerHeadRow, children: [
500
+ /* @__PURE__ */ l("span", { className: t.methodBadge, children: r.method || "—" }),
501
+ /* @__PURE__ */ l(
502
+ "span",
503
+ {
504
+ className: c(
505
+ t.statusBadge,
506
+ I && t.statusPending,
507
+ !I && (r.status ?? 0) >= 400 && t.statusError
508
+ ),
509
+ children: I ? "pending" : String(r.status ?? "—")
510
+ }
511
+ ),
512
+ /* @__PURE__ */ l("span", { className: t.drawerRoute, children: Z(r) + " → " + r.service }),
513
+ /* @__PURE__ */ l("div", { className: t.drawerSpacer }),
514
+ !C && /* @__PURE__ */ l(
515
+ "button",
516
+ {
517
+ type: "button",
518
+ className: i.asideClose,
519
+ "aria-label": "Close details",
520
+ onClick: je,
521
+ children: "✕"
522
+ }
523
+ )
524
+ ] }),
525
+ /* @__PURE__ */ l("div", { className: t.drawerUrl, children: r.url || r.label || r.id }),
526
+ /* @__PURE__ */ l("div", { className: t.drawerRid, children: String(q(r)) }),
527
+ /* @__PURE__ */ l("div", { className: t.drawerXrid, children: r.reqHeaders && r.reqHeaders["x-request-id"] || r.requestId || r.id }),
528
+ /* @__PURE__ */ l("div", { className: t.drawerTiming, children: V(r.start, !0) + (I ? " · in flight" : " → " + V(r.end, !0) + " · " + we(r.end - r.start)) })
458
529
  ] }),
459
- /* @__PURE__ */ n("div", { className: l.drawerSection, children: "Response" }),
460
- D ? /* @__PURE__ */ r("div", { className: l.awaiting, children: [
461
- /* @__PURE__ */ n("span", { className: c(a.pulseDot, l.awaitingDot) }),
462
- "Awaiting response…"
463
- ] }) : /* @__PURE__ */ r(R, { children: [
464
- /* @__PURE__ */ n("div", { className: a.asideSection, children: "Headers" }),
465
- ke(i.resHeaders).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
466
- /* @__PURE__ */ n("span", { className: l.kvKey, children: e.k }),
467
- /* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
530
+ /* @__PURE__ */ a("div", { className: t.drawerBody, children: [
531
+ /* @__PURE__ */ l("div", { className: t.drawerSection, children: "Request" }),
532
+ !!Object.keys(r.query || {}).length && /* @__PURE__ */ a(P, { children: [
533
+ /* @__PURE__ */ l("div", { className: i.asideSection, children: "Query parameters" }),
534
+ Xe(r.query).map((e) => /* @__PURE__ */ a("div", { className: t.kvRow, children: [
535
+ /* @__PURE__ */ l("span", { className: c(t.kvKey, t.kvKeyQuery), children: e.k }),
536
+ /* @__PURE__ */ l("span", { className: t.kvVal, children: e.v })
537
+ ] }, e.k))
538
+ ] }),
539
+ /* @__PURE__ */ l("div", { className: i.asideSection, children: "Headers" }),
540
+ Xe(r.reqHeaders).map((e) => /* @__PURE__ */ a("div", { className: t.kvRow, children: [
541
+ /* @__PURE__ */ l("span", { className: t.kvKey, children: e.k }),
542
+ /* @__PURE__ */ l("span", { className: t.kvVal, children: e.v })
468
543
  ] }, e.k)),
469
- /* @__PURE__ */ n("div", { className: a.asideSection, children: "Body" }),
470
- /* @__PURE__ */ n("pre", { className: a.asideRaw, children: i.resBody != null ? JSON.stringify(i.resBody, null, 2) : "(empty)" })
544
+ r.reqBody != null && /* @__PURE__ */ a(P, { children: [
545
+ /* @__PURE__ */ a("div", { className: t.bodyHead, children: [
546
+ /* @__PURE__ */ l("span", { className: c(i.asideSection, t.bodyLabel), children: "Body" }),
547
+ /* @__PURE__ */ l(
548
+ xe,
549
+ {
550
+ size: "sm",
551
+ className: t.payloadCopy,
552
+ value: () => JSON.stringify(r.reqBody, null, 2),
553
+ "aria-label": "Copy request payload"
554
+ }
555
+ )
556
+ ] }),
557
+ /* @__PURE__ */ l("pre", { className: i.asideRaw, children: JSON.stringify(r.reqBody, null, 2) })
558
+ ] }),
559
+ /* @__PURE__ */ l("div", { className: t.drawerSection, children: "Response" }),
560
+ I ? /* @__PURE__ */ a("div", { className: t.awaiting, children: [
561
+ /* @__PURE__ */ l("span", { className: c(i.pulseDot, t.awaitingDot) }),
562
+ "Awaiting response…"
563
+ ] }) : /* @__PURE__ */ a(P, { children: [
564
+ /* @__PURE__ */ l("div", { className: i.asideSection, children: "Headers" }),
565
+ Xe(r.resHeaders).map((e) => /* @__PURE__ */ a("div", { className: t.kvRow, children: [
566
+ /* @__PURE__ */ l("span", { className: t.kvKey, children: e.k }),
567
+ /* @__PURE__ */ l("span", { className: t.kvVal, children: e.v })
568
+ ] }, e.k)),
569
+ /* @__PURE__ */ a("div", { className: t.bodyHead, children: [
570
+ /* @__PURE__ */ l("span", { className: c(i.asideSection, t.bodyLabel), children: "Body" }),
571
+ r.resBody != null && /* @__PURE__ */ l(
572
+ xe,
573
+ {
574
+ size: "sm",
575
+ className: t.payloadCopy,
576
+ value: () => JSON.stringify(r.resBody, null, 2),
577
+ "aria-label": "Copy response payload"
578
+ }
579
+ )
580
+ ] }),
581
+ /* @__PURE__ */ l("pre", { className: i.asideRaw, children: r.resBody != null ? JSON.stringify(r.resBody, null, 2) : "(empty)" })
582
+ ] })
471
583
  ] })
472
- ] })
584
+ ] }) : /* @__PURE__ */ l("div", { className: t.dockEmpty, children: "Click an event on the timeline to inspect it." })
585
+ ] }),
586
+ dl && /* @__PURE__ */ a("aside", { className: c(i.aside, t.dockAside, t.logAside, m?.log), children: [
587
+ /* @__PURE__ */ a("div", { className: t.dockHead, children: [
588
+ /* @__PURE__ */ l("span", { className: t.dockTitle, children: "Full log" }),
589
+ /* @__PURE__ */ a("span", { className: t.dockCount, children: [
590
+ u.length,
591
+ " events"
592
+ ] }),
593
+ /* @__PURE__ */ l("div", { className: t.drawerSpacer }),
594
+ /* @__PURE__ */ l(
595
+ "button",
596
+ {
597
+ type: "button",
598
+ className: i.asideClose,
599
+ "aria-label": "Close full log",
600
+ onClick: () => $(null),
601
+ children: "✕"
602
+ }
603
+ )
604
+ ] }),
605
+ /* @__PURE__ */ l("div", { ref: ut, className: c(t.dockScroll, t.logBody), children: St.map((e, n) => {
606
+ const s = e.end == null, h = e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : "";
607
+ return /* @__PURE__ */ a(
608
+ "div",
609
+ {
610
+ "data-crk-log-id": e.id,
611
+ className: c(
612
+ t.logEntry,
613
+ g === e.id && t.logEntrySelected,
614
+ el === e.id && t.logEntryFlash
615
+ ),
616
+ onClick: () => {
617
+ me(e), X.current = e.id;
618
+ },
619
+ children: [
620
+ /* @__PURE__ */ a("div", { className: t.logTop, children: [
621
+ /* @__PURE__ */ l("span", { className: t.logNum, children: String(n + 1).padStart(2, "0") }),
622
+ /* @__PURE__ */ l("span", { className: c(t.methodBadge, t.badgeSm), children: e.method || "—" }),
623
+ /* @__PURE__ */ l(
624
+ "span",
625
+ {
626
+ className: c(
627
+ t.statusBadge,
628
+ t.badgeSm,
629
+ s && t.statusPending,
630
+ !s && (e.status ?? 0) >= 400 && t.statusError
631
+ ),
632
+ children: s ? "pending" : String(e.status ?? "—")
633
+ }
634
+ ),
635
+ /* @__PURE__ */ l("span", { className: t.logPair, children: Z(e) + " → " + e.service }),
636
+ /* @__PURE__ */ l("div", { className: t.drawerSpacer }),
637
+ /* @__PURE__ */ l("span", { className: t.logClock, children: A(e.start) })
638
+ ] }),
639
+ /* @__PURE__ */ l("div", { className: t.logOp, children: /* @__PURE__ */ l(kt, { text: String(q(e)), query: B }) }),
640
+ h && /* @__PURE__ */ l("div", { className: t.logPath, children: h }),
641
+ /* @__PURE__ */ a("div", { className: t.logPayloadHead, children: [
642
+ /* @__PURE__ */ l("span", { className: t.logPayloadLabel, children: "Request" }),
643
+ e.reqBody != null && /* @__PURE__ */ l(
644
+ "span",
645
+ {
646
+ className: t.copyStop,
647
+ onClick: (o) => o.stopPropagation(),
648
+ children: /* @__PURE__ */ l(
649
+ xe,
650
+ {
651
+ size: "sm",
652
+ className: t.payloadCopy,
653
+ value: () => JSON.stringify(e.reqBody, null, 2),
654
+ "aria-label": "Copy request payload"
655
+ }
656
+ )
657
+ }
658
+ )
659
+ ] }),
660
+ /* @__PURE__ */ l("pre", { className: c(i.asideRaw, t.logPre), children: e.reqBody != null ? JSON.stringify(e.reqBody, null, 2) : "(empty)" }),
661
+ /* @__PURE__ */ a("div", { className: t.logPayloadHead, children: [
662
+ /* @__PURE__ */ l("span", { className: t.logPayloadLabel, children: "Response" }),
663
+ !s && e.resBody != null && /* @__PURE__ */ l(
664
+ "span",
665
+ {
666
+ className: t.copyStop,
667
+ onClick: (o) => o.stopPropagation(),
668
+ children: /* @__PURE__ */ l(
669
+ xe,
670
+ {
671
+ size: "sm",
672
+ className: t.payloadCopy,
673
+ value: () => JSON.stringify(e.resBody, null, 2),
674
+ "aria-label": "Copy response payload"
675
+ }
676
+ )
677
+ }
678
+ )
679
+ ] }),
680
+ s ? /* @__PURE__ */ a("div", { className: t.awaiting, children: [
681
+ /* @__PURE__ */ l("span", { className: c(i.pulseDot, t.awaitingDot) }),
682
+ "Awaiting response…"
683
+ ] }) : /* @__PURE__ */ l("pre", { className: c(i.asideRaw, t.logPre), children: e.resBody != null ? JSON.stringify(e.resBody, null, 2) : "(empty)" })
684
+ ]
685
+ },
686
+ e.id
687
+ );
688
+ }) })
473
689
  ] }),
474
- (E === "right" || E === "floating") && Q
690
+ (R === "right" || R === "floating") && Q,
691
+ C && /* @__PURE__ */ a("div", { className: c(t.rail, m?.rail), children: [
692
+ /* @__PURE__ */ l(
693
+ "button",
694
+ {
695
+ type: "button",
696
+ title: "Event details",
697
+ "aria-label": "Toggle event details drawer",
698
+ "aria-pressed": x === "details",
699
+ className: c(t.railBtn, x === "details" && t.railBtnActive),
700
+ onClick: () => $(x === "details" ? null : "details"),
701
+ children: /* @__PURE__ */ a("span", { className: t.railGlyphDetails, "aria-hidden": !0, children: [
702
+ /* @__PURE__ */ l("span", {}),
703
+ /* @__PURE__ */ l("span", {}),
704
+ /* @__PURE__ */ l("span", {})
705
+ ] })
706
+ }
707
+ ),
708
+ /* @__PURE__ */ l(
709
+ "button",
710
+ {
711
+ type: "button",
712
+ title: "Full log",
713
+ "aria-label": "Toggle full log drawer",
714
+ "aria-pressed": x === "log",
715
+ className: c(t.railBtn, x === "log" && t.railBtnActive),
716
+ onClick: () => {
717
+ const e = x === "log" ? null : "log";
718
+ e === "log" && g != null && (j.current = g), $(e);
719
+ },
720
+ children: /* @__PURE__ */ a("span", { className: t.railGlyphLog, "aria-hidden": !0, children: [
721
+ /* @__PURE__ */ l("span", {}),
722
+ /* @__PURE__ */ l("span", {}),
723
+ /* @__PURE__ */ l("span", {})
724
+ ] })
725
+ }
726
+ )
727
+ ] })
475
728
  ] }),
476
- E === "bottom" && Q,
477
- p && (() => {
478
- const e = d.find((s) => s.id === p.id), t = e && de ? de(e, {
479
- color: S[e.service] || v.body,
729
+ R === "bottom" && Q,
730
+ y && (() => {
731
+ const e = u.find((s) => s.id === y.id), n = e && Me ? Me(e, {
732
+ color: L[e.service] || S.body,
480
733
  pending: e.end == null,
481
- durationMs: (e.end ?? b) - e.start
734
+ durationMs: (e.end ?? M) - e.start
482
735
  }) : void 0;
483
- return de && t == null ? null : /* @__PURE__ */ n(Xt, { x: p.x, y: p.y, className: h?.tooltip, children: t !== void 0 ? t : /* @__PURE__ */ r(R, { children: [
484
- /* @__PURE__ */ n("div", { className: c(a.tooltipTitle, a.tooltipMono), children: p.rid }),
485
- /* @__PURE__ */ n("div", { className: a.tooltipLine, style: { marginTop: 4 }, children: p.route }),
486
- /* @__PURE__ */ n(
736
+ return Me && n == null ? null : /* @__PURE__ */ l(wl, { x: y.x, y: y.y, className: m?.tooltip, children: n !== void 0 ? n : /* @__PURE__ */ a(P, { children: [
737
+ /* @__PURE__ */ l("div", { className: c(i.tooltipTitle, i.tooltipMono), children: y.rid }),
738
+ /* @__PURE__ */ l("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: y.route }),
739
+ /* @__PURE__ */ l(
487
740
  "div",
488
741
  {
489
- className: c(a.tooltipLine, a.tooltipMono),
742
+ className: c(i.tooltipLine, i.tooltipMono),
490
743
  style: { marginTop: 2 },
491
- children: p.label
744
+ children: y.label
492
745
  }
493
746
  ),
494
- /* @__PURE__ */ n("div", { className: a.tooltipLine, style: { marginTop: 4 }, children: p.time }),
495
- /* @__PURE__ */ n("div", { className: a.tooltipLine, children: p.durLine }),
496
- p.url && /* @__PURE__ */ n(
747
+ /* @__PURE__ */ l("div", { className: i.tooltipLine, style: { marginTop: 4 }, children: y.time }),
748
+ /* @__PURE__ */ l("div", { className: i.tooltipLine, children: y.durLine }),
749
+ y.url && /* @__PURE__ */ l(
497
750
  "div",
498
751
  {
499
- className: c(a.tooltipDim, a.tooltipMono),
752
+ className: c(i.tooltipDim, i.tooltipMono),
500
753
  style: { marginTop: 4, wordBreak: "break-all", fontSize: "10.5px" },
501
- children: p.url
754
+ children: y.url
502
755
  }
503
756
  )
504
757
  ] }) });
@@ -507,5 +760,5 @@ const g = 84, et = 24, Zt = 51, ae = 300, an = Ht(
507
760
  }
508
761
  );
509
762
  export {
510
- an as TraceTimeline
763
+ Il as TraceTimeline
511
764
  };