@motiadev/plugin-observability 0.13.0-beta.162-315243 → 0.13.0-beta.162-687645

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.
package/dist/index.js CHANGED
@@ -11,72 +11,7 @@ import "react18-json-view/src/style.css";
11
11
  import { formatDistanceToNow } from "date-fns";
12
12
 
13
13
  import './index.css';
14
- //#region rolldown:runtime
15
- var __getOwnPropNames = Object.getOwnPropertyNames;
16
- var __commonJS = (cb, mod) => function() {
17
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
- };
19
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
20
- if (typeof require !== "undefined") return require.apply(this, arguments);
21
- throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
22
- });
23
-
24
- //#endregion
25
- //#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-compiler-runtime.production.js
26
- /**
27
- * @license React
28
- * react-compiler-runtime.production.js
29
- *
30
- * Copyright (c) Meta Platforms, Inc. and affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */
35
- var require_react_compiler_runtime_production = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-compiler-runtime.production.js": ((exports) => {
36
- var ReactSharedInternals = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
37
- exports.c = function(size) {
38
- return ReactSharedInternals.H.useMemoCache(size);
39
- };
40
- }) });
41
-
42
- //#endregion
43
- //#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-compiler-runtime.development.js
44
- /**
45
- * @license React
46
- * react-compiler-runtime.development.js
47
- *
48
- * Copyright (c) Meta Platforms, Inc. and affiliates.
49
- *
50
- * This source code is licensed under the MIT license found in the
51
- * LICENSE file in the root directory of this source tree.
52
- */
53
- var require_react_compiler_runtime_development = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-compiler-runtime.development.js": ((exports) => {
54
- "production" !== process.env.NODE_ENV && function() {
55
- var ReactSharedInternals$1 = __require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
56
- exports.c = function(size) {
57
- var dispatcher = ReactSharedInternals$1.H;
58
- null === dispatcher && console.error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.");
59
- return dispatcher.useMemoCache(size);
60
- };
61
- }();
62
- }) });
63
-
64
- //#endregion
65
- //#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/compiler-runtime.js
66
- /**
67
- * Copyright (c) Meta Platforms, Inc. and affiliates.
68
- *
69
- * This source code is licensed under the MIT license found in the
70
- * LICENSE file in the root directory of this source tree.
71
- */
72
- var require_compiler_runtime = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/compiler-runtime.js": ((exports, module) => {
73
- if (process.env.NODE_ENV === "production") module.exports = require_react_compiler_runtime_production();
74
- else module.exports = require_react_compiler_runtime_development();
75
- }) });
76
-
77
- //#endregion
78
14
  //#region src/stores/use-observability-store.ts
79
- var import_compiler_runtime$24 = require_compiler_runtime();
80
15
  const useObservabilityStore = create()((set) => ({
81
16
  selectedTraceGroupId: "",
82
17
  selectedTraceId: void 0,
@@ -92,170 +27,64 @@ const useObservabilityStore = create()((set) => ({
92
27
  //#endregion
93
28
  //#region src/components/search-bar.tsx
94
29
  const SearchBar = memo(() => {
95
- const $ = (0, import_compiler_runtime$24.c)(23);
96
- const search = useObservabilityStore(_temp$6);
97
- const setSearch = useObservabilityStore(_temp2$2);
98
- const clearTraces = useObservabilityStore(_temp3);
99
- let t0;
100
- if ($[0] !== setSearch) {
101
- t0 = (e) => setSearch(e.target.value);
102
- $[0] = setSearch;
103
- $[1] = t0;
104
- } else t0 = $[1];
105
- let t1;
106
- if ($[2] !== search || $[3] !== t0) {
107
- t1 = /* @__PURE__ */ jsx(Input, {
108
- variant: "shade",
109
- value: search,
110
- onChange: t0,
111
- className: "px-9! font-medium",
112
- placeholder: "Search by Trace ID or Step Name"
113
- });
114
- $[2] = search;
115
- $[3] = t0;
116
- $[4] = t1;
117
- } else t1 = $[4];
118
- let t2;
119
- if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
120
- t2 = /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" });
121
- $[5] = t2;
122
- } else t2 = $[5];
123
- const t3 = search !== "";
124
- const t4 = search === "";
125
- let t5;
126
- if ($[6] !== t3 || $[7] !== t4) {
127
- t5 = cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", {
128
- visible: t3,
129
- invisible: t4
130
- });
131
- $[6] = t3;
132
- $[7] = t4;
133
- $[8] = t5;
134
- } else t5 = $[8];
135
- let t6;
136
- if ($[9] !== setSearch) {
137
- t6 = () => setSearch("");
138
- $[9] = setSearch;
139
- $[10] = t6;
140
- } else t6 = $[10];
141
- let t7;
142
- if ($[11] !== t5 || $[12] !== t6) {
143
- t7 = /* @__PURE__ */ jsx(X, {
144
- className: t5,
145
- onClick: t6
146
- });
147
- $[11] = t5;
148
- $[12] = t6;
149
- $[13] = t7;
150
- } else t7 = $[13];
151
- let t8;
152
- if ($[14] !== t1 || $[15] !== t7) {
153
- t8 = /* @__PURE__ */ jsxs("div", {
30
+ const search = useObservabilityStore((state) => state.search);
31
+ const setSearch = useObservabilityStore((state) => state.setSearch);
32
+ const clearTraces = useObservabilityStore((state) => state.clearTraces);
33
+ return /* @__PURE__ */ jsxs("div", {
34
+ className: "flex p-2 border-b gap-2",
35
+ "data-testid": "logs-search-container",
36
+ children: [/* @__PURE__ */ jsxs("div", {
154
37
  className: "flex-1 relative",
155
38
  children: [
156
- t1,
157
- t2,
158
- t7
39
+ /* @__PURE__ */ jsx(Input, {
40
+ variant: "shade",
41
+ value: search,
42
+ onChange: (e) => setSearch(e.target.value),
43
+ className: "px-9! font-medium",
44
+ placeholder: "Search by Trace ID or Step Name"
45
+ }),
46
+ /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" }),
47
+ /* @__PURE__ */ jsx(X, {
48
+ className: cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground", {
49
+ visible: search !== "",
50
+ invisible: search === ""
51
+ }),
52
+ onClick: () => setSearch("")
53
+ })
159
54
  ]
160
- });
161
- $[14] = t1;
162
- $[15] = t7;
163
- $[16] = t8;
164
- } else t8 = $[16];
165
- let t9;
166
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
167
- t9 = /* @__PURE__ */ jsx(Trash, {});
168
- $[17] = t9;
169
- } else t9 = $[17];
170
- let t10;
171
- if ($[18] !== clearTraces) {
172
- t10 = /* @__PURE__ */ jsxs(Button, {
55
+ }), /* @__PURE__ */ jsxs(Button, {
173
56
  variant: "default",
174
57
  onClick: clearTraces,
175
58
  className: "h-[34px]",
176
- children: [t9, " Clear"]
177
- });
178
- $[18] = clearTraces;
179
- $[19] = t10;
180
- } else t10 = $[19];
181
- let t11;
182
- if ($[20] !== t10 || $[21] !== t8) {
183
- t11 = /* @__PURE__ */ jsxs("div", {
184
- className: "flex p-2 border-b gap-2",
185
- "data-testid": "logs-search-container",
186
- children: [t8, t10]
187
- });
188
- $[20] = t10;
189
- $[21] = t8;
190
- $[22] = t11;
191
- } else t11 = $[22];
192
- return t11;
59
+ children: [/* @__PURE__ */ jsx(Trash, {}), " Clear"]
60
+ })]
61
+ });
193
62
  });
194
63
  SearchBar.displayName = "SearchBar";
195
- function _temp$6(state) {
196
- return state.search;
197
- }
198
- function _temp2$2(state_0) {
199
- return state_0.setSearch;
200
- }
201
- function _temp3(state_1) {
202
- return state_1.clearTraces;
203
- }
204
64
 
205
65
  //#endregion
206
66
  //#region src/components/trace-empty-state.tsx
207
- var import_compiler_runtime$23 = require_compiler_runtime();
208
67
  const TraceEmptyState = memo(() => {
209
- const $ = (0, import_compiler_runtime$23.c)(1);
210
- if (useObservabilityStore(_temp$5)) return null;
211
- let t0;
212
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
213
- t0 = /* @__PURE__ */ jsx("div", {
214
- className: "flex items-center justify-center h-full text-muted-foreground",
215
- children: "Select a trace or trace group to view the timeline"
216
- });
217
- $[0] = t0;
218
- } else t0 = $[0];
219
- return t0;
68
+ if (useObservabilityStore((state) => state.selectedTraceGroupId)) return null;
69
+ return /* @__PURE__ */ jsx("div", {
70
+ className: "flex items-center justify-center h-full text-muted-foreground",
71
+ children: "Select a trace or trace group to view the timeline"
72
+ });
220
73
  });
221
74
  TraceEmptyState.displayName = "TraceEmptyState";
222
- function _temp$5(state) {
223
- return state.selectedTraceGroupId;
224
- }
225
75
 
226
76
  //#endregion
227
77
  //#region src/hooks/use-get-endtime.ts
228
- var import_compiler_runtime$22 = require_compiler_runtime();
229
78
  const useGetEndTime = (group) => {
230
- const $ = (0, import_compiler_runtime$22.c)(6);
231
79
  const groupEndTime = group?.endTime;
232
- let t0;
233
- if ($[0] !== groupEndTime) {
234
- t0 = () => groupEndTime || Date.now();
235
- $[0] = groupEndTime;
236
- $[1] = t0;
237
- } else t0 = $[1];
238
- const [endTime, setEndTime] = useState(t0);
239
- let t1;
240
- let t2;
241
- if ($[2] !== endTime || $[3] !== groupEndTime) {
242
- t1 = () => {
243
- let interval;
244
- if (groupEndTime) {
245
- if (groupEndTime !== endTime) setEndTime(groupEndTime);
246
- } else interval = setInterval(() => setEndTime(Date.now()), 100);
247
- return () => clearInterval(interval);
248
- };
249
- t2 = [groupEndTime, endTime];
250
- $[2] = endTime;
251
- $[3] = groupEndTime;
252
- $[4] = t1;
253
- $[5] = t2;
254
- } else {
255
- t1 = $[4];
256
- t2 = $[5];
257
- }
258
- useEffect(t1, t2);
80
+ const [endTime, setEndTime] = useState(() => groupEndTime || Date.now());
81
+ useEffect(() => {
82
+ let interval;
83
+ if (groupEndTime) {
84
+ if (groupEndTime !== endTime) setEndTime(groupEndTime);
85
+ } else interval = setInterval(() => setEndTime(Date.now()), 100);
86
+ return () => clearInterval(interval);
87
+ }, [groupEndTime, endTime]);
259
88
  return endTime;
260
89
  };
261
90
 
@@ -271,58 +100,33 @@ const formatDuration = (duration) => {
271
100
 
272
101
  //#endregion
273
102
  //#region src/components/trace-item/trace-item.tsx
274
- var import_compiler_runtime$21 = require_compiler_runtime();
275
103
  const GRADIENT_CLASSES = {
276
104
  running: "bg-[repeating-linear-gradient(140deg,#BEFE29,#BEFE29_8px,#ABE625_8px,#ABE625_16px)]",
277
105
  completed: "bg-[repeating-linear-gradient(140deg,#2862FE,#2862FE_8px,#2358E5_8px,#2358E5_16px)]",
278
106
  failed: "bg-[repeating-linear-gradient(140deg,#EA2069,#EA2069_8px,#D41E60_8px,#D41E60_16px)]"
279
107
  };
280
- const TraceItem = memo((t0) => {
281
- const $ = (0, import_compiler_runtime$21.c)(17);
282
- const { traceId, traceName, traceStatus, traceStartTime, traceEndTime, groupStartTime, groupEndTime, onExpand } = t0;
283
- let t1;
284
- if ($[0] !== onExpand || $[1] !== traceId) {
285
- t1 = () => {
286
- onExpand(traceId);
287
- };
288
- $[0] = onExpand;
289
- $[1] = traceId;
290
- $[2] = t1;
291
- } else t1 = $[2];
292
- const handleClick = t1;
293
- const t2 = GRADIENT_CLASSES[traceStatus];
294
- let t3;
295
- if ($[3] !== t2) {
296
- t3 = cn("h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200", t2);
297
- $[3] = t2;
298
- $[4] = t3;
299
- } else t3 = $[4];
300
- const barClassName = t3;
301
- const t4 = `${(traceStartTime - groupStartTime) / (groupEndTime - groupStartTime) * 100}%`;
302
- const t5 = traceEndTime ? `${(traceEndTime - traceStartTime) / (groupEndTime - groupStartTime) * 100}%` : `${(Date.now() - traceStartTime) / (groupEndTime - groupStartTime) * 100}%`;
303
- let t6;
304
- if ($[5] !== t4 || $[6] !== t5) {
305
- t6 = {
306
- marginLeft: t4,
307
- width: t5
308
- };
309
- $[5] = t4;
310
- $[6] = t5;
311
- $[7] = t6;
312
- } else t6 = $[7];
313
- const barStyle = t6;
314
- let t7;
315
- if ($[8] !== traceName) {
316
- t7 = /* @__PURE__ */ jsx("div", {
108
+ const TraceItem = memo(({ traceId, traceName, traceStatus, traceStartTime, traceEndTime, groupStartTime, groupEndTime, onExpand }) => {
109
+ const handleClick = useCallback(() => {
110
+ onExpand(traceId);
111
+ }, [onExpand, traceId]);
112
+ const barClassName = useMemo(() => cn("h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200", GRADIENT_CLASSES[traceStatus]), [traceStatus]);
113
+ const barStyle = useMemo(() => ({
114
+ marginLeft: `${(traceStartTime - groupStartTime) / (groupEndTime - groupStartTime) * 100}%`,
115
+ width: traceEndTime ? `${(traceEndTime - traceStartTime) / (groupEndTime - groupStartTime) * 100}%` : `${(Date.now() - traceStartTime) / (groupEndTime - groupStartTime) * 100}%`
116
+ }), [
117
+ traceStartTime,
118
+ traceEndTime,
119
+ groupStartTime,
120
+ groupEndTime
121
+ ]);
122
+ return /* @__PURE__ */ jsxs("div", {
123
+ className: "flex hover:bg-muted-foreground/10 relative cursor-pointer",
124
+ onClick: handleClick,
125
+ "data-testid": "trace-timeline-item",
126
+ children: [/* @__PURE__ */ jsx("div", {
317
127
  className: "flex items-center min-w-[200px] max-w-[200px] h-[32px] max-h-[32px] py-4 px-2 text-sm font-semibold text-foreground truncate sticky left-0 bg-card z-9",
318
128
  children: traceName
319
- });
320
- $[8] = traceName;
321
- $[9] = t7;
322
- } else t7 = $[9];
323
- let t8;
324
- if ($[10] !== barClassName || $[11] !== barStyle) {
325
- t8 = /* @__PURE__ */ jsx("div", {
129
+ }), /* @__PURE__ */ jsx("div", {
326
130
  className: "flex w-full flex-row items-center hover:bg-muted/50 rounded-md",
327
131
  children: /* @__PURE__ */ jsx("div", {
328
132
  className: "relative w-full h-[32px] flex items-center",
@@ -331,204 +135,64 @@ const TraceItem = memo((t0) => {
331
135
  style: barStyle
332
136
  })
333
137
  })
334
- });
335
- $[10] = barClassName;
336
- $[11] = barStyle;
337
- $[12] = t8;
338
- } else t8 = $[12];
339
- let t9;
340
- if ($[13] !== handleClick || $[14] !== t7 || $[15] !== t8) {
341
- t9 = /* @__PURE__ */ jsxs("div", {
342
- className: "flex hover:bg-muted-foreground/10 relative cursor-pointer",
343
- onClick: handleClick,
344
- "data-testid": "trace-timeline-item",
345
- children: [t7, t8]
346
- });
347
- $[13] = handleClick;
348
- $[14] = t7;
349
- $[15] = t8;
350
- $[16] = t9;
351
- } else t9 = $[16];
352
- return t9;
138
+ })]
139
+ });
353
140
  });
354
141
  TraceItem.displayName = "TraceItem";
355
142
 
356
143
  //#endregion
357
144
  //#region src/components/events/event-icon.tsx
358
- var import_compiler_runtime$20 = require_compiler_runtime();
359
- const EventIcon = (t0) => {
360
- const $ = (0, import_compiler_runtime$20.c)(4);
361
- const { event } = t0;
362
- if (event.type === "log") {
363
- let t1;
364
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
365
- t1 = /* @__PURE__ */ jsx(ScrollText, { className: "w-4 h-4 text-muted-foreground" });
366
- $[0] = t1;
367
- } else t1 = $[0];
368
- return t1;
369
- } else if (event.type === "emit") {
370
- let t1;
371
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
372
- t1 = /* @__PURE__ */ jsx(MessageCircle, { className: "w-4 h-4 text-muted-foreground" });
373
- $[1] = t1;
374
- } else t1 = $[1];
375
- return t1;
376
- } else if (event.type === "state") {
377
- let t1;
378
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
379
- t1 = /* @__PURE__ */ jsx(Package, { className: "w-4 h-4 text-muted-foreground" });
380
- $[2] = t1;
381
- } else t1 = $[2];
382
- return t1;
383
- } else if (event.type === "stream") {
384
- let t1;
385
- if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
386
- t1 = /* @__PURE__ */ jsx(Radio, { className: "w-4 h-4 text-muted-foreground" });
387
- $[3] = t1;
388
- } else t1 = $[3];
389
- return t1;
390
- }
145
+ const EventIcon = ({ event }) => {
146
+ if (event.type === "log") return /* @__PURE__ */ jsx(ScrollText, { className: "w-4 h-4 text-muted-foreground" });
147
+ else if (event.type === "emit") return /* @__PURE__ */ jsx(MessageCircle, { className: "w-4 h-4 text-muted-foreground" });
148
+ else if (event.type === "state") return /* @__PURE__ */ jsx(Package, { className: "w-4 h-4 text-muted-foreground" });
149
+ else if (event.type === "stream") return /* @__PURE__ */ jsx(Radio, { className: "w-4 h-4 text-muted-foreground" });
391
150
  };
392
151
 
393
152
  //#endregion
394
153
  //#region src/components/ui/copy-button.tsx
395
- var import_compiler_runtime$19 = require_compiler_runtime();
396
- const CopyButton = (t0) => {
397
- const $ = (0, import_compiler_runtime$19.c)(11);
398
- const { textToCopy, className, title } = t0;
154
+ const CopyButton = ({ textToCopy, className, title }) => {
399
155
  const [copied, setCopied] = useState(false);
400
- let t1;
401
- if ($[0] !== textToCopy) {
402
- t1 = async () => {
156
+ return /* @__PURE__ */ jsx(Button, {
157
+ variant: "icon",
158
+ size: "icon",
159
+ onClick: useCallback(async () => {
403
160
  try {
404
161
  await navigator.clipboard.writeText(textToCopy);
405
162
  setCopied(true);
406
163
  setTimeout(() => setCopied(false), 2e3);
407
- } catch (t2$1) {
408
- const error = t2$1;
164
+ } catch (error) {
409
165
  console.error("Failed to copy:", error);
410
166
  }
411
- };
412
- $[0] = textToCopy;
413
- $[1] = t1;
414
- } else t1 = $[1];
415
- const handleCopy = t1;
416
- let t2;
417
- if ($[2] !== className) {
418
- t2 = cn("cursor-pointer p-3 rounded-full", className);
419
- $[2] = className;
420
- $[3] = t2;
421
- } else t2 = $[3];
422
- const t3 = title ?? (copied ? "Copied!" : "Copy");
423
- let t4;
424
- if ($[4] !== copied) {
425
- t4 = copied ? /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4 text-gray-400" });
426
- $[4] = copied;
427
- $[5] = t4;
428
- } else t4 = $[5];
429
- let t5;
430
- if ($[6] !== handleCopy || $[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
431
- t5 = /* @__PURE__ */ jsx(Button, {
432
- variant: "icon",
433
- size: "icon",
434
- onClick: handleCopy,
435
- className: t2,
436
- title: t3,
437
- children: t4
438
- });
439
- $[6] = handleCopy;
440
- $[7] = t2;
441
- $[8] = t3;
442
- $[9] = t4;
443
- $[10] = t5;
444
- } else t5 = $[10];
445
- return t5;
167
+ }, [textToCopy]),
168
+ className: cn("cursor-pointer p-3 rounded-full", className),
169
+ title: title ?? (copied ? "Copied!" : "Copy"),
170
+ children: copied ? /* @__PURE__ */ jsx(Check, { className: "w-4 h-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "w-4 h-4 text-gray-400" })
171
+ });
446
172
  };
447
173
 
448
174
  //#endregion
449
175
  //#region src/components/ui/popover.tsx
450
- var import_compiler_runtime$18 = require_compiler_runtime();
451
- const Popover = (t0) => {
452
- const $ = (0, import_compiler_runtime$18.c)(4);
453
- let props;
454
- if ($[0] !== t0) {
455
- ({...props} = t0);
456
- $[0] = t0;
457
- $[1] = props;
458
- } else props = $[1];
459
- let t1;
460
- if ($[2] !== props) {
461
- t1 = /* @__PURE__ */ jsx(PopoverPrimitive.Root, {
462
- "data-slot": "popover",
463
- ...props
464
- });
465
- $[2] = props;
466
- $[3] = t1;
467
- } else t1 = $[3];
468
- return t1;
176
+ const Popover = ({ ...props }) => {
177
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Root, {
178
+ "data-slot": "popover",
179
+ ...props
180
+ });
469
181
  };
470
- const PopoverTrigger = (t0) => {
471
- const $ = (0, import_compiler_runtime$18.c)(4);
472
- let props;
473
- if ($[0] !== t0) {
474
- ({...props} = t0);
475
- $[0] = t0;
476
- $[1] = props;
477
- } else props = $[1];
478
- let t1;
479
- if ($[2] !== props) {
480
- t1 = /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, {
481
- "data-slot": "popover-trigger",
482
- ...props
483
- });
484
- $[2] = props;
485
- $[3] = t1;
486
- } else t1 = $[3];
487
- return t1;
182
+ const PopoverTrigger = ({ ...props }) => {
183
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Trigger, {
184
+ "data-slot": "popover-trigger",
185
+ ...props
186
+ });
488
187
  };
489
- const PopoverContent = (t0) => {
490
- const $ = (0, import_compiler_runtime$18.c)(12);
491
- let className;
492
- let props;
493
- let t1;
494
- let t2;
495
- if ($[0] !== t0) {
496
- ({className, align: t1, sideOffset: t2, ...props} = t0);
497
- $[0] = t0;
498
- $[1] = className;
499
- $[2] = props;
500
- $[3] = t1;
501
- $[4] = t2;
502
- } else {
503
- className = $[1];
504
- props = $[2];
505
- t1 = $[3];
506
- t2 = $[4];
507
- }
508
- const align = t1 === void 0 ? "center" : t1;
509
- const sideOffset = t2 === void 0 ? 4 : t2;
510
- let t3;
511
- if ($[5] !== className) {
512
- t3 = cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className);
513
- $[5] = className;
514
- $[6] = t3;
515
- } else t3 = $[6];
516
- let t4;
517
- if ($[7] !== align || $[8] !== props || $[9] !== sideOffset || $[10] !== t3) {
518
- t4 = /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
519
- "data-slot": "popover-content",
520
- align,
521
- sideOffset,
522
- className: t3,
523
- ...props
524
- }) });
525
- $[7] = align;
526
- $[8] = props;
527
- $[9] = sideOffset;
528
- $[10] = t3;
529
- $[11] = t4;
530
- } else t4 = $[11];
531
- return t4;
188
+ const PopoverContent = ({ className, align = "center", sideOffset = 4, ...props }) => {
189
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
190
+ "data-slot": "popover-content",
191
+ align,
192
+ sideOffset,
193
+ className: cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden", className),
194
+ ...props
195
+ }) });
532
196
  };
533
197
 
534
198
  //#endregion
@@ -541,762 +205,297 @@ const formatArgumentValue = (arg) => {
541
205
 
542
206
  //#endregion
543
207
  //#region src/components/events/code/argument.tsx
544
- var import_compiler_runtime$17 = require_compiler_runtime();
545
- const Argument = memo((t0) => {
546
- const $ = (0, import_compiler_runtime$17.c)(18);
547
- const { arg, popover: t1 } = t0;
548
- const popover = t1 === void 0 ? true : t1;
549
- const isObject = typeof arg === "object" && arg !== null;
550
- let t2;
551
- if ($[0] !== arg) {
552
- t2 = formatArgumentValue(arg);
553
- $[0] = arg;
554
- $[1] = t2;
555
- } else t2 = $[1];
556
- const value = t2;
557
- let t3;
558
- if ($[2] !== arg) {
559
- t3 = JSON.stringify(arg, null, 2);
560
- $[2] = arg;
561
- $[3] = t3;
562
- } else t3 = $[3];
563
- const textToCopy = t3;
564
- if (!popover) {
565
- let t4$1;
566
- if ($[4] !== arg || $[5] !== isObject || $[6] !== value) {
567
- t4$1 = /* @__PURE__ */ jsx(Fragment$1, { children: isObject ? /* @__PURE__ */ jsx(ReactJson, {
568
- src: arg,
569
- theme: "default",
570
- enableClipboard: false,
571
- style: { padding: 0 }
572
- }) : /* @__PURE__ */ jsx("span", {
573
- className: "font-mono text-blue-500",
574
- children: value
575
- }) });
576
- $[4] = arg;
577
- $[5] = isObject;
578
- $[6] = value;
579
- $[7] = t4$1;
580
- } else t4$1 = $[7];
581
- return t4$1;
582
- }
583
- let t4;
584
- if ($[8] !== value) {
585
- t4 = /* @__PURE__ */ jsx(PopoverTrigger, {
586
- asChild: true,
587
- children: /* @__PURE__ */ jsx("span", {
588
- className: "truncate font-mono text-blue-500 cursor-pointer inline-block",
589
- children: value
590
- })
591
- });
592
- $[8] = value;
593
- $[9] = t4;
594
- } else t4 = $[9];
595
- let t5;
596
- if ($[10] !== arg || $[11] !== isObject || $[12] !== textToCopy || $[13] !== value) {
597
- t5 = /* @__PURE__ */ jsx(PopoverContent, {
598
- className: "backdrop-blur-md w-auto max-w-2xl relative max-h-[50vh] overflow-y-auto",
599
- hideWhenDetached: true,
600
- children: isObject ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(CopyButton, {
208
+ const Argument = memo(({ arg, popover = true }) => {
209
+ const isObject = useMemo(() => typeof arg === "object" && arg !== null, [arg]);
210
+ const value = useMemo(() => formatArgumentValue(arg), [arg]);
211
+ const textToCopy = useMemo(() => JSON.stringify(arg, null, 2), [arg]);
212
+ if (!popover) return /* @__PURE__ */ jsx(Fragment$1, { children: isObject ? /* @__PURE__ */ jsx(ReactJson, {
213
+ src: arg,
214
+ theme: "default",
215
+ enableClipboard: false,
216
+ style: { padding: 0 }
217
+ }) : /* @__PURE__ */ jsx("span", {
218
+ className: "font-mono text-blue-500",
219
+ children: value
220
+ }) });
221
+ return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
222
+ asChild: true,
223
+ children: /* @__PURE__ */ jsx("span", {
224
+ className: "truncate font-mono text-blue-500 cursor-pointer inline-block",
225
+ children: value
226
+ })
227
+ }), /* @__PURE__ */ jsx(PopoverContent, {
228
+ className: "backdrop-blur-md w-auto max-w-2xl relative max-h-[50vh] overflow-y-auto",
229
+ hideWhenDetached: true,
230
+ children: isObject ? /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(CopyButton, {
231
+ textToCopy,
232
+ className: "absolute top-4 right-4",
233
+ title: "Copy JSON"
234
+ }), /* @__PURE__ */ jsx(ReactJson, {
235
+ src: arg,
236
+ theme: "default",
237
+ enableClipboard: false,
238
+ style: { padding: 0 }
239
+ })] }) : /* @__PURE__ */ jsxs("div", {
240
+ className: "flex items-center justify-between",
241
+ children: [/* @__PURE__ */ jsx("span", { children: value }), /* @__PURE__ */ jsx(CopyButton, {
601
242
  textToCopy,
602
- className: "absolute top-4 right-4",
243
+ className: "ml-2",
603
244
  title: "Copy JSON"
604
- }), /* @__PURE__ */ jsx(ReactJson, {
605
- src: arg,
606
- theme: "default",
607
- enableClipboard: false,
608
- style: { padding: 0 }
609
- })] }) : /* @__PURE__ */ jsxs("div", {
610
- className: "flex items-center justify-between",
611
- children: [/* @__PURE__ */ jsx("span", { children: value }), /* @__PURE__ */ jsx(CopyButton, {
612
- textToCopy,
613
- className: "ml-2",
614
- title: "Copy JSON"
615
- })]
616
- })
617
- });
618
- $[10] = arg;
619
- $[11] = isObject;
620
- $[12] = textToCopy;
621
- $[13] = value;
622
- $[14] = t5;
623
- } else t5 = $[14];
624
- let t6;
625
- if ($[15] !== t4 || $[16] !== t5) {
626
- t6 = /* @__PURE__ */ jsxs(Popover, { children: [t4, t5] });
627
- $[15] = t4;
628
- $[16] = t5;
629
- $[17] = t6;
630
- } else t6 = $[17];
631
- return t6;
245
+ })]
246
+ })
247
+ })] });
632
248
  });
633
249
  Argument.displayName = "Argument";
634
250
 
635
251
  //#endregion
636
252
  //#region src/components/events/code/closing-parenthesis.tsx
637
- var import_compiler_runtime$16 = require_compiler_runtime();
638
- const ClosingParenthesis = memo((t0) => {
639
- const $ = (0, import_compiler_runtime$16.c)(7);
640
- const { callsQuantity, noQuantity: t1 } = t0;
641
- const noQuantity = t1 === void 0 ? false : t1;
642
- const hasCalls = callsQuantity && callsQuantity > 1;
643
- let t2;
644
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
645
- t2 = /* @__PURE__ */ jsx("span", {
253
+ const ClosingParenthesis = memo(({ callsQuantity, noQuantity = false }) => {
254
+ return /* @__PURE__ */ jsxs("div", {
255
+ className: "flex items-center",
256
+ children: [/* @__PURE__ */ jsx("span", {
646
257
  className: "font-mono text-emerald-500",
647
258
  children: ")"
648
- });
649
- $[0] = t2;
650
- } else t2 = $[0];
651
- let t3;
652
- if ($[1] !== callsQuantity || $[2] !== hasCalls || $[3] !== noQuantity) {
653
- t3 = !noQuantity && hasCalls && /* @__PURE__ */ jsxs("span", {
259
+ }), !noQuantity && callsQuantity && callsQuantity > 1 && /* @__PURE__ */ jsxs("span", {
654
260
  className: "font-mono text-muted-foreground",
655
261
  children: [" x", callsQuantity]
656
- });
657
- $[1] = callsQuantity;
658
- $[2] = hasCalls;
659
- $[3] = noQuantity;
660
- $[4] = t3;
661
- } else t3 = $[4];
662
- let t4;
663
- if ($[5] !== t3) {
664
- t4 = /* @__PURE__ */ jsxs("div", {
665
- className: "flex items-center",
666
- children: [t2, t3]
667
- });
668
- $[5] = t3;
669
- $[6] = t4;
670
- } else t4 = $[6];
671
- return t4;
262
+ })]
263
+ });
672
264
  });
673
265
  ClosingParenthesis.displayName = "ClosingParenthesis";
674
266
 
675
267
  //#endregion
676
268
  //#region src/components/events/code/function-call-content.tsx
677
- var import_compiler_runtime$15 = require_compiler_runtime();
678
- const FunctionCallContent = forwardRef((t0, ref) => {
679
- const $ = (0, import_compiler_runtime$15.c)(22);
680
- let className;
681
- let functionName;
682
- let objectName;
683
- let props;
684
- let topLevelClassName;
685
- if ($[0] !== t0) {
686
- ({topLevelClassName, objectName, functionName, className, ...props} = t0);
687
- $[0] = t0;
688
- $[1] = className;
689
- $[2] = functionName;
690
- $[3] = objectName;
691
- $[4] = props;
692
- $[5] = topLevelClassName;
693
- } else {
694
- className = $[1];
695
- functionName = $[2];
696
- objectName = $[3];
697
- props = $[4];
698
- topLevelClassName = $[5];
699
- }
700
- let t1;
701
- if ($[6] !== className) {
702
- t1 = cn("flex items-center", className);
703
- $[6] = className;
704
- $[7] = t1;
705
- } else t1 = $[7];
706
- let t2;
707
- if ($[8] !== topLevelClassName) {
708
- t2 = topLevelClassName && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
709
- className: "font-mono text-pink-500",
710
- children: topLevelClassName
711
- }), /* @__PURE__ */ jsx("span", { children: "." })] });
712
- $[8] = topLevelClassName;
713
- $[9] = t2;
714
- } else t2 = $[9];
715
- let t3;
716
- if ($[10] !== objectName) {
717
- t3 = objectName && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
718
- className: "font-mono text-pink-500",
719
- children: objectName
720
- }), /* @__PURE__ */ jsx("span", { children: "." })] });
721
- $[10] = objectName;
722
- $[11] = t3;
723
- } else t3 = $[11];
724
- let t4;
725
- if ($[12] !== functionName) {
726
- t4 = /* @__PURE__ */ jsx("span", {
727
- className: "font-mono text-pink-500",
728
- children: functionName
729
- });
730
- $[12] = functionName;
731
- $[13] = t4;
732
- } else t4 = $[13];
733
- let t5;
734
- if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
735
- t5 = /* @__PURE__ */ jsx("span", {
736
- className: "font-mono text-emerald-500",
737
- children: "("
738
- });
739
- $[14] = t5;
740
- } else t5 = $[14];
741
- let t6;
742
- if ($[15] !== props || $[16] !== ref || $[17] !== t1 || $[18] !== t2 || $[19] !== t3 || $[20] !== t4) {
743
- t6 = /* @__PURE__ */ jsxs("div", {
744
- ref,
745
- className: t1,
746
- ...props,
747
- children: [
748
- t2,
749
- t3,
750
- t4,
751
- t5
752
- ]
753
- });
754
- $[15] = props;
755
- $[16] = ref;
756
- $[17] = t1;
757
- $[18] = t2;
758
- $[19] = t3;
759
- $[20] = t4;
760
- $[21] = t6;
761
- } else t6 = $[21];
762
- return t6;
269
+ const FunctionCallContent = forwardRef(({ topLevelClassName, objectName, functionName, className, ...props }, ref) => {
270
+ return /* @__PURE__ */ jsxs("div", {
271
+ ref,
272
+ className: cn("flex items-center", className),
273
+ ...props,
274
+ children: [
275
+ topLevelClassName && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
276
+ className: "font-mono text-pink-500",
277
+ children: topLevelClassName
278
+ }), /* @__PURE__ */ jsx("span", { children: "." })] }),
279
+ objectName && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
280
+ className: "font-mono text-pink-500",
281
+ children: objectName
282
+ }), /* @__PURE__ */ jsx("span", { children: "." })] }),
283
+ /* @__PURE__ */ jsx("span", {
284
+ className: "font-mono text-pink-500",
285
+ children: functionName
286
+ }),
287
+ /* @__PURE__ */ jsx("span", {
288
+ className: "font-mono text-emerald-500",
289
+ children: "("
290
+ })
291
+ ]
292
+ });
763
293
  });
764
294
  FunctionCallContent.displayName = "FunctionCallContent";
765
295
 
766
296
  //#endregion
767
297
  //#region src/components/events/code/function-call.tsx
768
- var import_compiler_runtime$14 = require_compiler_runtime();
769
298
  const GRID_LAYOUT_STYLE = { gridTemplateColumns: "max-content 1fr max-content" };
770
- const FunctionCall = memo((t0) => {
771
- const $ = (0, import_compiler_runtime$14.c)(48);
772
- const { topLevelClassName, objectName, functionName, args, callsQuantity } = t0;
773
- let t1;
774
- if ($[0] !== args) {
775
- t1 = args.filter(_temp$4);
776
- $[0] = args;
777
- $[1] = t1;
778
- } else t1 = $[1];
779
- const filteredArgs = t1;
780
- const t2 = `repeat(${filteredArgs.length * 2}, minmax(0, auto))`;
781
- let t3;
782
- if ($[2] !== t2) {
783
- t3 = { gridTemplateColumns: t2 };
784
- $[2] = t2;
785
- $[3] = t3;
786
- } else t3 = $[3];
787
- const argsGridStyle = t3;
788
- let t4;
789
- if ($[4] !== objectName || $[5] !== topLevelClassName) {
790
- t4 = [topLevelClassName, objectName].filter(Boolean);
791
- $[4] = objectName;
792
- $[5] = topLevelClassName;
793
- $[6] = t4;
794
- } else t4 = $[6];
795
- const prefix = t4.join(".");
796
- const fullPrefix = prefix ? `${prefix}.` : "";
797
- let t5;
798
- if ($[7] !== filteredArgs) {
799
- t5 = filteredArgs.map(_temp2$1).join(", ");
800
- $[7] = filteredArgs;
801
- $[8] = t5;
802
- } else t5 = $[8];
803
- const functionCallText = `${fullPrefix}${functionName}(${t5})`;
804
- let t6;
805
- if ($[9] !== functionName || $[10] !== objectName || $[11] !== topLevelClassName) {
806
- t6 = /* @__PURE__ */ jsx(PopoverTrigger, {
807
- asChild: true,
808
- children: /* @__PURE__ */ jsx(FunctionCallContent, {
809
- className: "cursor-pointer",
810
- functionName,
811
- topLevelClassName,
812
- objectName
813
- })
814
- });
815
- $[9] = functionName;
816
- $[10] = objectName;
817
- $[11] = topLevelClassName;
818
- $[12] = t6;
819
- } else t6 = $[12];
820
- let t7;
821
- if ($[13] !== functionName || $[14] !== objectName || $[15] !== topLevelClassName) {
822
- t7 = /* @__PURE__ */ jsx(FunctionCallContent, {
823
- functionName,
824
- topLevelClassName,
825
- objectName
826
- });
827
- $[13] = functionName;
828
- $[14] = objectName;
829
- $[15] = topLevelClassName;
830
- $[16] = t7;
831
- } else t7 = $[16];
832
- let t8;
833
- if ($[17] !== functionCallText) {
834
- t8 = /* @__PURE__ */ jsx(CopyButton, { textToCopy: functionCallText });
835
- $[17] = functionCallText;
836
- $[18] = t8;
837
- } else t8 = $[18];
838
- let t9;
839
- if ($[19] !== t7 || $[20] !== t8) {
840
- t9 = /* @__PURE__ */ jsxs("div", {
841
- className: "flex items-center justify-between gap-2",
842
- children: [t7, t8]
843
- });
844
- $[19] = t7;
845
- $[20] = t8;
846
- $[21] = t9;
847
- } else t9 = $[21];
848
- let t10;
849
- if ($[22] !== filteredArgs) {
850
- let t11$1;
851
- if ($[24] !== filteredArgs.length) {
852
- t11$1 = (arg_1, index) => /* @__PURE__ */ jsxs("div", {
853
- className: "grid grid-cols-[auto_1fr] items-center pl-4",
854
- children: [/* @__PURE__ */ jsx(Argument, {
855
- arg: arg_1,
856
- popover: false
857
- }), index < filteredArgs.length - 1 && /* @__PURE__ */ jsx("span", { children: ", " })]
858
- }, index);
859
- $[24] = filteredArgs.length;
860
- $[25] = t11$1;
861
- } else t11$1 = $[25];
862
- t10 = filteredArgs.map(t11$1);
863
- $[22] = filteredArgs;
864
- $[23] = t10;
865
- } else t10 = $[23];
866
- let t11;
867
- if ($[26] !== callsQuantity) {
868
- t11 = /* @__PURE__ */ jsx(ClosingParenthesis, {
869
- callsQuantity,
870
- noQuantity: true
871
- });
872
- $[26] = callsQuantity;
873
- $[27] = t11;
874
- } else t11 = $[27];
875
- let t12;
876
- if ($[28] !== t10 || $[29] !== t11 || $[30] !== t9) {
877
- t12 = /* @__PURE__ */ jsxs(PopoverContent, {
878
- className: "grid grid-rows-auto backdrop-blur-md w-auto max-w-2xl max-h-[50vh] overflow-y-auto",
879
- hideWhenDetached: true,
880
- children: [
881
- t9,
882
- t10,
883
- t11
884
- ]
885
- });
886
- $[28] = t10;
887
- $[29] = t11;
888
- $[30] = t9;
889
- $[31] = t12;
890
- } else t12 = $[31];
891
- let t13;
892
- if ($[32] !== t12 || $[33] !== t6) {
893
- t13 = /* @__PURE__ */ jsxs(Popover, { children: [t6, t12] });
894
- $[32] = t12;
895
- $[33] = t6;
896
- $[34] = t13;
897
- } else t13 = $[34];
898
- let t14;
899
- if ($[35] !== filteredArgs) {
900
- let t15$1;
901
- if ($[37] !== filteredArgs.length) {
902
- t15$1 = (arg_2, index_0) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Argument, { arg: arg_2 }), index_0 < filteredArgs.length - 1 && /* @__PURE__ */ jsx("span", { children: ", " })] }, index_0);
903
- $[37] = filteredArgs.length;
904
- $[38] = t15$1;
905
- } else t15$1 = $[38];
906
- t14 = filteredArgs.map(t15$1);
907
- $[35] = filteredArgs;
908
- $[36] = t14;
909
- } else t14 = $[36];
910
- let t15;
911
- if ($[39] !== argsGridStyle || $[40] !== t14) {
912
- t15 = /* @__PURE__ */ jsx("div", {
913
- className: "grid items-center min-w-0",
914
- style: argsGridStyle,
915
- children: t14
916
- });
917
- $[39] = argsGridStyle;
918
- $[40] = t14;
919
- $[41] = t15;
920
- } else t15 = $[41];
921
- let t16;
922
- if ($[42] !== callsQuantity) {
923
- t16 = /* @__PURE__ */ jsx(ClosingParenthesis, { callsQuantity });
924
- $[42] = callsQuantity;
925
- $[43] = t16;
926
- } else t16 = $[43];
927
- let t17;
928
- if ($[44] !== t13 || $[45] !== t15 || $[46] !== t16) {
929
- t17 = /* @__PURE__ */ jsxs("div", {
930
- className: "grid overflow-hidden items-center",
931
- style: GRID_LAYOUT_STYLE,
932
- children: [
933
- t13,
934
- t15,
935
- t16
936
- ]
937
- });
938
- $[44] = t13;
939
- $[45] = t15;
940
- $[46] = t16;
941
- $[47] = t17;
942
- } else t17 = $[47];
943
- return t17;
299
+ const FunctionCall = memo(({ topLevelClassName, objectName, functionName, args, callsQuantity }) => {
300
+ const filteredArgs = useMemo(() => args.filter((arg) => arg !== void 0), [args]);
301
+ const argsGridStyle = useMemo(() => ({ gridTemplateColumns: `repeat(${filteredArgs.length * 2}, minmax(0, auto))` }), [filteredArgs.length]);
302
+ const functionCallText = useMemo(() => {
303
+ const prefix = [topLevelClassName, objectName].filter(Boolean).join(".");
304
+ return `${prefix ? `${prefix}.` : ""}${functionName}(${filteredArgs.map((arg) => {
305
+ if (typeof arg === "object" && arg !== null) return JSON.stringify(arg, null, 2);
306
+ if (arg === null) return "null";
307
+ if (typeof arg === "string") return `'${arg}'`;
308
+ return String(arg);
309
+ }).join(", ")})`;
310
+ }, [
311
+ topLevelClassName,
312
+ objectName,
313
+ functionName,
314
+ filteredArgs
315
+ ]);
316
+ return /* @__PURE__ */ jsxs("div", {
317
+ className: "grid overflow-hidden items-center",
318
+ style: GRID_LAYOUT_STYLE,
319
+ children: [
320
+ /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(PopoverTrigger, {
321
+ asChild: true,
322
+ children: /* @__PURE__ */ jsx(FunctionCallContent, {
323
+ className: "cursor-pointer",
324
+ functionName,
325
+ topLevelClassName,
326
+ objectName
327
+ })
328
+ }), /* @__PURE__ */ jsxs(PopoverContent, {
329
+ className: "grid grid-rows-auto backdrop-blur-md w-auto max-w-2xl max-h-[50vh] overflow-y-auto",
330
+ hideWhenDetached: true,
331
+ children: [
332
+ /* @__PURE__ */ jsxs("div", {
333
+ className: "flex items-center justify-between gap-2",
334
+ children: [/* @__PURE__ */ jsx(FunctionCallContent, {
335
+ functionName,
336
+ topLevelClassName,
337
+ objectName
338
+ }), /* @__PURE__ */ jsx(CopyButton, { textToCopy: functionCallText })]
339
+ }),
340
+ filteredArgs.map((arg, index) => /* @__PURE__ */ jsxs("div", {
341
+ className: "grid grid-cols-[auto_1fr] items-center pl-4",
342
+ children: [/* @__PURE__ */ jsx(Argument, {
343
+ arg,
344
+ popover: false
345
+ }), index < filteredArgs.length - 1 && /* @__PURE__ */ jsx("span", { children: ", " })]
346
+ }, index)),
347
+ /* @__PURE__ */ jsx(ClosingParenthesis, {
348
+ callsQuantity,
349
+ noQuantity: true
350
+ })
351
+ ]
352
+ })] }),
353
+ /* @__PURE__ */ jsx("div", {
354
+ className: "grid items-center min-w-0",
355
+ style: argsGridStyle,
356
+ children: filteredArgs.map((arg, index) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Argument, { arg }), index < filteredArgs.length - 1 && /* @__PURE__ */ jsx("span", { children: ", " })] }, index))
357
+ }),
358
+ /* @__PURE__ */ jsx(ClosingParenthesis, { callsQuantity })
359
+ ]
360
+ });
944
361
  });
945
362
  FunctionCall.displayName = "FunctionCall";
946
- function _temp$4(arg) {
947
- return arg !== void 0;
948
- }
949
- function _temp2$1(arg_0) {
950
- if (typeof arg_0 === "object" && arg_0 !== null) return JSON.stringify(arg_0, null, 2);
951
- if (arg_0 === null) return "null";
952
- if (typeof arg_0 === "string") return `'${arg_0}'`;
953
- return String(arg_0);
954
- }
955
363
 
956
364
  //#endregion
957
365
  //#region src/components/events/trace-emit-event.tsx
958
- var import_compiler_runtime$13 = require_compiler_runtime();
959
- const TraceEmitEvent = memo((t0) => {
960
- const $ = (0, import_compiler_runtime$13.c)(5);
961
- const { event } = t0;
962
- let t1;
963
- if ($[0] !== event.data || $[1] !== event.topic) {
964
- t1 = [{
366
+ const TraceEmitEvent = memo(({ event }) => {
367
+ return /* @__PURE__ */ jsx(FunctionCall, {
368
+ functionName: "emit",
369
+ args: useMemo(() => [{
965
370
  topic: event.topic,
966
371
  data: event.data
967
- }];
968
- $[0] = event.data;
969
- $[1] = event.topic;
970
- $[2] = t1;
971
- } else t1 = $[2];
972
- const args = t1;
973
- let t2;
974
- if ($[3] !== args) {
975
- t2 = /* @__PURE__ */ jsx(FunctionCall, {
976
- functionName: "emit",
977
- args
978
- });
979
- $[3] = args;
980
- $[4] = t2;
981
- } else t2 = $[4];
982
- return t2;
372
+ }], [event])
373
+ });
983
374
  });
984
375
  TraceEmitEvent.displayName = "TraceEmitEvent";
985
376
 
986
377
  //#endregion
987
378
  //#region src/components/events/trace-log-event.tsx
988
- var import_compiler_runtime$12 = require_compiler_runtime();
989
- const TraceLogEvent = memo((t0) => {
990
- const $ = (0, import_compiler_runtime$12.c)(5);
991
- const { event } = t0;
992
- let t1;
993
- if ($[0] !== event.level) {
994
- t1 = /* @__PURE__ */ jsx(LevelDot, { level: event.level });
995
- $[0] = event.level;
996
- $[1] = t1;
997
- } else t1 = $[1];
998
- let t2;
999
- if ($[2] !== event.message || $[3] !== t1) {
1000
- t2 = /* @__PURE__ */ jsxs("div", {
1001
- className: "flex items-center gap-2",
1002
- children: [
1003
- t1,
1004
- " ",
1005
- event.message
1006
- ]
1007
- });
1008
- $[2] = event.message;
1009
- $[3] = t1;
1010
- $[4] = t2;
1011
- } else t2 = $[4];
1012
- return t2;
379
+ const TraceLogEvent = memo(({ event }) => {
380
+ return /* @__PURE__ */ jsxs("div", {
381
+ className: "flex items-center gap-2",
382
+ children: [
383
+ /* @__PURE__ */ jsx(LevelDot, { level: event.level }),
384
+ " ",
385
+ event.message
386
+ ]
387
+ });
1013
388
  });
1014
389
  TraceLogEvent.displayName = "TraceLogEvent";
1015
390
 
1016
391
  //#endregion
1017
392
  //#region src/components/events/trace-state-event.tsx
1018
- var import_compiler_runtime$11 = require_compiler_runtime();
1019
- const TraceStateEvent = memo((t0) => {
1020
- const $ = (0, import_compiler_runtime$11.c)(7);
1021
- const { event } = t0;
1022
- let t1;
1023
- if ($[0] !== event.data.key || $[1] !== event.data.traceId || $[2] !== event.data.value) {
1024
- t1 = [
1025
- event.data.traceId,
1026
- event.data.key,
1027
- event.data.value
1028
- ];
1029
- $[0] = event.data.key;
1030
- $[1] = event.data.traceId;
1031
- $[2] = event.data.value;
1032
- $[3] = t1;
1033
- } else t1 = $[3];
1034
- const args = t1;
1035
- let t2;
1036
- if ($[4] !== args || $[5] !== event.operation) {
1037
- t2 = /* @__PURE__ */ jsx(FunctionCall, {
1038
- objectName: "state",
1039
- functionName: event.operation,
1040
- args
1041
- });
1042
- $[4] = args;
1043
- $[5] = event.operation;
1044
- $[6] = t2;
1045
- } else t2 = $[6];
1046
- return t2;
393
+ const TraceStateEvent = memo(({ event }) => {
394
+ const args = useMemo(() => [
395
+ event.data.traceId,
396
+ event.data.key,
397
+ event.data.value
398
+ ], [event]);
399
+ return /* @__PURE__ */ jsx(FunctionCall, {
400
+ objectName: "state",
401
+ functionName: event.operation,
402
+ args
403
+ });
1047
404
  });
1048
405
  TraceStateEvent.displayName = "TraceStateEvent";
1049
406
 
1050
407
  //#endregion
1051
408
  //#region src/components/events/trace-stream-event.tsx
1052
- var import_compiler_runtime$10 = require_compiler_runtime();
1053
- const TraceStreamEvent = memo((t0) => {
1054
- const $ = (0, import_compiler_runtime$10.c)(9);
1055
- const { event } = t0;
1056
- const t1 = event.data.data;
1057
- let t2;
1058
- if ($[0] !== event.data.groupId || $[1] !== event.data.id || $[2] !== t1) {
1059
- t2 = [
1060
- event.data.groupId,
1061
- event.data.id,
1062
- t1
1063
- ];
1064
- $[0] = event.data.groupId;
1065
- $[1] = event.data.id;
1066
- $[2] = t1;
1067
- $[3] = t2;
1068
- } else t2 = $[3];
1069
- const args = t2;
1070
- let t3;
1071
- if ($[4] !== args || $[5] !== event.calls || $[6] !== event.operation || $[7] !== event.streamName) {
1072
- t3 = /* @__PURE__ */ jsx(FunctionCall, {
1073
- topLevelClassName: "streams",
1074
- objectName: event.streamName,
1075
- functionName: event.operation,
1076
- args,
1077
- callsQuantity: event.calls
1078
- });
1079
- $[4] = args;
1080
- $[5] = event.calls;
1081
- $[6] = event.operation;
1082
- $[7] = event.streamName;
1083
- $[8] = t3;
1084
- } else t3 = $[8];
1085
- return t3;
409
+ const TraceStreamEvent = memo(({ event }) => {
410
+ const args = useMemo(() => [
411
+ event.data.groupId,
412
+ event.data.id,
413
+ event.data.data
414
+ ], [event]);
415
+ return /* @__PURE__ */ jsx(FunctionCall, {
416
+ topLevelClassName: "streams",
417
+ objectName: event.streamName,
418
+ functionName: event.operation,
419
+ args,
420
+ callsQuantity: event.calls
421
+ });
1086
422
  });
1087
423
  TraceStreamEvent.displayName = "TraceStreamEvent";
1088
424
 
1089
425
  //#endregion
1090
426
  //#region src/components/events/trace-event.tsx
1091
- var import_compiler_runtime$9 = require_compiler_runtime();
1092
- const TraceEvent = memo((t0) => {
1093
- const $ = (0, import_compiler_runtime$9.c)(8);
1094
- const { event } = t0;
1095
- if (event.type === "log") {
1096
- let t1;
1097
- if ($[0] !== event) {
1098
- t1 = /* @__PURE__ */ jsx(TraceLogEvent, { event });
1099
- $[0] = event;
1100
- $[1] = t1;
1101
- } else t1 = $[1];
1102
- return t1;
1103
- } else if (event.type === "emit") {
1104
- let t1;
1105
- if ($[2] !== event) {
1106
- t1 = /* @__PURE__ */ jsx(TraceEmitEvent, { event });
1107
- $[2] = event;
1108
- $[3] = t1;
1109
- } else t1 = $[3];
1110
- return t1;
1111
- } else if (event.type === "state") {
1112
- let t1;
1113
- if ($[4] !== event) {
1114
- t1 = /* @__PURE__ */ jsx(TraceStateEvent, { event });
1115
- $[4] = event;
1116
- $[5] = t1;
1117
- } else t1 = $[5];
1118
- return t1;
1119
- } else if (event.type === "stream") {
1120
- let t1;
1121
- if ($[6] !== event) {
1122
- t1 = /* @__PURE__ */ jsx(TraceStreamEvent, { event });
1123
- $[6] = event;
1124
- $[7] = t1;
1125
- } else t1 = $[7];
1126
- return t1;
1127
- }
427
+ const TraceEvent = memo(({ event }) => {
428
+ if (event.type === "log") return /* @__PURE__ */ jsx(TraceLogEvent, { event });
429
+ else if (event.type === "emit") return /* @__PURE__ */ jsx(TraceEmitEvent, { event });
430
+ else if (event.type === "state") return /* @__PURE__ */ jsx(TraceStateEvent, { event });
431
+ else if (event.type === "stream") return /* @__PURE__ */ jsx(TraceStreamEvent, { event });
1128
432
  });
1129
433
  TraceEvent.displayName = "TraceEvent";
1130
434
 
1131
435
  //#endregion
1132
436
  //#region src/components/trace-item/trace-event-item.tsx
1133
- var import_compiler_runtime$8 = require_compiler_runtime();
1134
- const TraceEventItem = memo((t0) => {
1135
- const $ = (0, import_compiler_runtime$8.c)(13);
1136
- const { event, traceStartTime } = t0;
1137
- let t1;
1138
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1139
- t1 = /* @__PURE__ */ jsx("div", {
437
+ const TraceEventItem = memo(({ event, traceStartTime }) => {
438
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
439
+ /* @__PURE__ */ jsx("div", {
1140
440
  className: "grid place-items-center",
1141
441
  children: /* @__PURE__ */ jsx("div", { className: "w-1 h-1 rounded-full bg-emerald-500 outline outline-2 outline-emerald-500/50 -ml-[26px]" })
1142
- });
1143
- $[0] = t1;
1144
- } else t1 = $[0];
1145
- let t2;
1146
- if ($[1] !== event) {
1147
- t2 = /* @__PURE__ */ jsx("div", {
442
+ }),
443
+ /* @__PURE__ */ jsx("div", {
1148
444
  className: "grid place-items-center",
1149
445
  children: /* @__PURE__ */ jsx(EventIcon, { event })
1150
- });
1151
- $[1] = event;
1152
- $[2] = t2;
1153
- } else t2 = $[2];
1154
- const t3 = Math.floor(event.timestamp - traceStartTime);
1155
- let t4;
1156
- if ($[3] !== t3) {
1157
- t4 = formatDuration(t3);
1158
- $[3] = t3;
1159
- $[4] = t4;
1160
- } else t4 = $[4];
1161
- let t5;
1162
- if ($[5] !== t4) {
1163
- t5 = /* @__PURE__ */ jsx("div", {
446
+ }),
447
+ /* @__PURE__ */ jsx("div", {
1164
448
  className: "grid place-items-center",
1165
449
  children: /* @__PURE__ */ jsxs("span", {
1166
450
  className: "text-sm font-mono text-muted-foreground",
1167
- children: ["+", t4]
451
+ children: ["+", formatDuration(Math.floor(event.timestamp - traceStartTime))]
1168
452
  })
1169
- });
1170
- $[5] = t4;
1171
- $[6] = t5;
1172
- } else t5 = $[6];
1173
- let t6;
1174
- if ($[7] !== event) {
1175
- t6 = /* @__PURE__ */ jsx("div", {
453
+ }),
454
+ /* @__PURE__ */ jsx("div", {
1176
455
  className: "grid place-items-start",
1177
456
  children: /* @__PURE__ */ jsx(TraceEvent, { event })
1178
- });
1179
- $[7] = event;
1180
- $[8] = t6;
1181
- } else t6 = $[8];
1182
- let t7;
1183
- if ($[9] !== t2 || $[10] !== t5 || $[11] !== t6) {
1184
- t7 = /* @__PURE__ */ jsxs(Fragment, { children: [
1185
- t1,
1186
- t2,
1187
- t5,
1188
- t6
1189
- ] });
1190
- $[9] = t2;
1191
- $[10] = t5;
1192
- $[11] = t6;
1193
- $[12] = t7;
1194
- } else t7 = $[12];
1195
- return t7;
457
+ })
458
+ ] });
1196
459
  });
1197
460
  TraceEventItem.displayName = "TraceEventItem";
1198
461
 
1199
462
  //#endregion
1200
463
  //#region src/components/trace-item/trace-item-detail.tsx
1201
- var import_compiler_runtime$7 = require_compiler_runtime();
1202
- const TraceItemDetail = memo((t0) => {
1203
- const $ = (0, import_compiler_runtime$7.c)(32);
1204
- const { trace, onClose } = t0;
1205
- let t1;
1206
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1207
- t1 = /* @__PURE__ */ jsx(X, {});
1208
- $[0] = t1;
1209
- } else t1 = $[0];
1210
- let t2;
1211
- if ($[1] !== onClose) {
1212
- t2 = [{
1213
- icon: t1,
1214
- onClick: onClose,
1215
- label: "Close"
1216
- }];
1217
- $[1] = onClose;
1218
- $[2] = t2;
1219
- } else t2 = $[2];
1220
- const actions = t2;
1221
- const t3 = `Viewing details from step ${trace.name}`;
1222
- let t4;
1223
- if ($[3] !== trace.endTime || $[4] !== trace.startTime) {
1224
- t4 = trace.endTime && /* @__PURE__ */ jsxs("span", { children: ["Duration: ", formatDuration(trace.endTime - trace.startTime)] });
1225
- $[3] = trace.endTime;
1226
- $[4] = trace.startTime;
1227
- $[5] = t4;
1228
- } else t4 = $[5];
1229
- let t5;
1230
- if ($[6] !== trace.entryPoint.type) {
1231
- t5 = /* @__PURE__ */ jsx("div", {
1232
- className: "bg-blue-500 font-bold text-xs px-[4px] py-[2px] rounded-sm text-blue-100",
1233
- children: trace.entryPoint.type
1234
- });
1235
- $[6] = trace.entryPoint.type;
1236
- $[7] = t5;
1237
- } else t5 = $[7];
1238
- let t6;
1239
- if ($[8] !== trace.correlationId) {
1240
- t6 = trace.correlationId && /* @__PURE__ */ jsxs(Badge, {
1241
- variant: "outline",
1242
- children: ["Correlated: ", trace.correlationId]
1243
- });
1244
- $[8] = trace.correlationId;
1245
- $[9] = t6;
1246
- } else t6 = $[9];
1247
- let t7;
1248
- if ($[10] !== t4 || $[11] !== t5 || $[12] !== t6) {
1249
- t7 = /* @__PURE__ */ jsxs("div", {
1250
- className: "flex items-center gap-4 text-sm text-muted-foreground mb-4",
1251
- children: [
1252
- t4,
1253
- t5,
1254
- t6
1255
- ]
1256
- });
1257
- $[10] = t4;
1258
- $[11] = t5;
1259
- $[12] = t6;
1260
- $[13] = t7;
1261
- } else t7 = $[13];
1262
- let t8;
1263
- if ($[14] !== trace.events || $[15] !== trace.startTime) {
1264
- let t9$1;
1265
- if ($[17] !== trace.startTime) {
1266
- t9$1 = (event, index) => /* @__PURE__ */ jsx(TraceEventItem, {
1267
- event,
1268
- traceStartTime: trace.startTime
1269
- }, index);
1270
- $[17] = trace.startTime;
1271
- $[18] = t9$1;
1272
- } else t9$1 = $[18];
1273
- t8 = trace.events.map(t9$1);
1274
- $[14] = trace.events;
1275
- $[15] = trace.startTime;
1276
- $[16] = t8;
1277
- } else t8 = $[16];
1278
- let t9;
1279
- if ($[19] !== t8) {
1280
- t9 = /* @__PURE__ */ jsx("div", {
1281
- className: "grid grid-cols-[auto_auto_auto_1fr] gap-x-2 gap-y-3 font-mono text-xs border-l-1 border-gray-500/40 pl-6",
1282
- children: t8
1283
- });
1284
- $[19] = t8;
1285
- $[20] = t9;
1286
- } else t9 = $[20];
1287
- let t10;
1288
- if ($[21] !== t7 || $[22] !== t9) {
1289
- t10 = /* @__PURE__ */ jsxs("div", {
464
+ const TraceItemDetail = memo(({ trace, onClose }) => {
465
+ const actions = useMemo(() => [{
466
+ icon: /* @__PURE__ */ jsx(X, {}),
467
+ onClick: onClose,
468
+ label: "Close"
469
+ }], [onClose]);
470
+ return /* @__PURE__ */ jsxs(Sidebar, {
471
+ onClose,
472
+ initialWidth: 600,
473
+ title: "Trace Details",
474
+ subtitle: `Viewing details from step ${trace.name}`,
475
+ actions,
476
+ children: [/* @__PURE__ */ jsxs("div", {
1290
477
  className: "px-2 overflow-auto",
1291
- children: [t7, t9]
1292
- });
1293
- $[21] = t7;
1294
- $[22] = t9;
1295
- $[23] = t10;
1296
- } else t10 = $[23];
1297
- let t11;
1298
- if ($[24] !== trace.error) {
1299
- t11 = trace.error && /* @__PURE__ */ jsxs("div", {
478
+ children: [/* @__PURE__ */ jsxs("div", {
479
+ className: "flex items-center gap-4 text-sm text-muted-foreground mb-4",
480
+ children: [
481
+ trace.endTime && /* @__PURE__ */ jsxs("span", { children: ["Duration: ", formatDuration(trace.endTime - trace.startTime)] }),
482
+ /* @__PURE__ */ jsx("div", {
483
+ className: "bg-blue-500 font-bold text-xs px-[4px] py-[2px] rounded-sm text-blue-100",
484
+ children: trace.entryPoint.type
485
+ }),
486
+ trace.correlationId && /* @__PURE__ */ jsxs(Badge, {
487
+ variant: "outline",
488
+ children: ["Correlated: ", trace.correlationId]
489
+ })
490
+ ]
491
+ }), /* @__PURE__ */ jsx("div", {
492
+ className: "grid grid-cols-[auto_auto_auto_1fr] gap-x-2 gap-y-3 font-mono text-xs border-l-1 border-gray-500/40 pl-6",
493
+ children: trace.events.map((event, index) => /* @__PURE__ */ jsx(TraceEventItem, {
494
+ event,
495
+ traceStartTime: trace.startTime
496
+ }, index))
497
+ })]
498
+ }), trace.error && /* @__PURE__ */ jsxs("div", {
1300
499
  className: "p-4 bg-red-800/10",
1301
500
  children: [/* @__PURE__ */ jsx("div", {
1302
501
  className: "text-sm text-red-800 dark:text-red-400 font-semibold",
@@ -1305,45 +504,17 @@ const TraceItemDetail = memo((t0) => {
1305
504
  className: "text-sm text-red-800 dark:text-red-400 pl-4",
1306
505
  children: trace.error.stack
1307
506
  })]
1308
- });
1309
- $[24] = trace.error;
1310
- $[25] = t11;
1311
- } else t11 = $[25];
1312
- let t12;
1313
- if ($[26] !== actions || $[27] !== onClose || $[28] !== t10 || $[29] !== t11 || $[30] !== t3) {
1314
- t12 = /* @__PURE__ */ jsxs(Sidebar, {
1315
- onClose,
1316
- initialWidth: 600,
1317
- title: "Trace Details",
1318
- subtitle: t3,
1319
- actions,
1320
- children: [t10, t11]
1321
- });
1322
- $[26] = actions;
1323
- $[27] = onClose;
1324
- $[28] = t10;
1325
- $[29] = t11;
1326
- $[30] = t3;
1327
- $[31] = t12;
1328
- } else t12 = $[31];
1329
- return t12;
507
+ })]
508
+ });
1330
509
  });
1331
510
  TraceItemDetail.displayName = "TraceItemDetail";
1332
511
 
1333
512
  //#endregion
1334
513
  //#region src/components/trace-timeline.tsx
1335
- var import_compiler_runtime$6 = require_compiler_runtime();
1336
514
  const TraceTimeline = memo(() => {
1337
- const $ = (0, import_compiler_runtime$6.c)(2);
1338
- const groupId = useObservabilityStore(_temp$3);
515
+ const groupId = useObservabilityStore((state) => state.selectedTraceGroupId);
1339
516
  if (!groupId) return null;
1340
- let t0;
1341
- if ($[0] !== groupId) {
1342
- t0 = /* @__PURE__ */ jsx(TraceTimelineComponent, { groupId });
1343
- $[0] = groupId;
1344
- $[1] = t0;
1345
- } else t0 = $[1];
1346
- return t0;
517
+ return /* @__PURE__ */ jsx(TraceTimelineComponent, { groupId });
1347
518
  });
1348
519
  TraceTimeline.displayName = "TraceTimeline";
1349
520
  const TraceTimelineComponent = memo(({ groupId }) => {
@@ -1359,13 +530,13 @@ const TraceTimelineComponent = memo(({ groupId }) => {
1359
530
  const endTime = useGetEndTime(group);
1360
531
  const [zoom, setZoom] = useState(1);
1361
532
  const selectedTraceId = useObservabilityStore((state) => state.selectedTraceId);
1362
- const selectTraceId = useObservabilityStore((state_0) => state_0.selectTraceId);
533
+ const selectTraceId = useObservabilityStore((state) => state.selectTraceId);
1363
534
  const selectedTrace = useMemo(() => data?.find((trace) => trace.id === selectedTraceId), [data, selectedTraceId]);
1364
535
  const zoomMinus = useCallback(() => {
1365
536
  if (zoom > .5) setZoom((prev) => prev - .1);
1366
537
  }, []);
1367
538
  const zoomPlus = useCallback(() => {
1368
- setZoom((prev_0) => prev_0 + .1);
539
+ setZoom((prev) => prev + .1);
1369
540
  }, []);
1370
541
  if (!group) return null;
1371
542
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
@@ -1419,16 +590,16 @@ const TraceTimelineComponent = memo(({ groupId }) => {
1419
590
  })]
1420
591
  }), /* @__PURE__ */ jsx("div", {
1421
592
  className: "flex flex-col w-full h-full",
1422
- children: data?.map((trace_0) => /* @__PURE__ */ jsx(TraceItem, {
1423
- traceId: trace_0.id,
1424
- traceName: trace_0.name,
1425
- traceStatus: trace_0.status,
1426
- traceStartTime: trace_0.startTime,
1427
- traceEndTime: trace_0.endTime,
593
+ children: data?.map((trace) => /* @__PURE__ */ jsx(TraceItem, {
594
+ traceId: trace.id,
595
+ traceName: trace.name,
596
+ traceStatus: trace.status,
597
+ traceStartTime: trace.startTime,
598
+ traceEndTime: trace.endTime,
1428
599
  groupStartTime: group.startTime,
1429
600
  groupEndTime: endTime,
1430
601
  onExpand: selectTraceId
1431
- }, trace_0.id))
602
+ }, trace.id))
1432
603
  })]
1433
604
  })
1434
605
  }), selectedTrace && /* @__PURE__ */ jsx(TraceItemDetail, {
@@ -1437,367 +608,143 @@ const TraceTimelineComponent = memo(({ groupId }) => {
1437
608
  })] });
1438
609
  });
1439
610
  TraceTimelineComponent.displayName = "TraceTimelineComponent";
1440
- function _temp$3(state) {
1441
- return state.selectedTraceGroupId;
1442
- }
1443
611
 
1444
612
  //#endregion
1445
613
  //#region src/hooks/use-filtered-trace-groups.ts
1446
- var import_compiler_runtime$5 = require_compiler_runtime();
1447
614
  const useFilteredTraceGroups = () => {
1448
- const $ = (0, import_compiler_runtime$5.c)(4);
1449
- let t0;
1450
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1451
- t0 = {
1452
- streamName: "motia-trace-group",
1453
- groupId: "default"
1454
- };
1455
- $[0] = t0;
1456
- } else t0 = $[0];
1457
- const { data } = useStreamGroup(t0);
1458
- const search = useObservabilityStore(_temp$2);
1459
- let t1;
1460
- if ($[1] !== data || $[2] !== search) {
1461
- t1 = data?.filter((group) => group.name.toLowerCase().includes(search.toLowerCase()) || group.id.toLowerCase().includes(search.toLowerCase()));
1462
- $[1] = data;
1463
- $[2] = search;
1464
- $[3] = t1;
1465
- } else t1 = $[3];
1466
- return t1;
615
+ const { data } = useStreamGroup(useMemo(() => ({
616
+ streamName: "motia-trace-group",
617
+ groupId: "default"
618
+ }), []));
619
+ const search = useObservabilityStore((state) => state.search);
620
+ return useMemo(() => data?.filter((group) => group.name.toLowerCase().includes(search.toLowerCase()) || group.id.toLowerCase().includes(search.toLowerCase())), [data, search]);
1467
621
  };
1468
- function _temp$2(state) {
1469
- return state.search;
1470
- }
1471
622
 
1472
623
  //#endregion
1473
624
  //#region src/components/trace-status.tsx
1474
- var import_compiler_runtime$4 = require_compiler_runtime();
1475
625
  const variantMap = {
1476
626
  running: "info",
1477
627
  completed: "success",
1478
628
  failed: "error",
1479
629
  default: "default"
1480
630
  };
1481
- const TraceStatusBadge = memo((t0) => {
1482
- const $ = (0, import_compiler_runtime$4.c)(3);
1483
- const { status, duration } = t0;
1484
- const t1 = variantMap[status];
1485
- const t2 = duration && status !== "failed" ? duration : status;
1486
- let t3;
1487
- if ($[0] !== t1 || $[1] !== t2) {
1488
- t3 = /* @__PURE__ */ jsx(Badge, {
1489
- variant: t1,
1490
- children: t2
1491
- });
1492
- $[0] = t1;
1493
- $[1] = t2;
1494
- $[2] = t3;
1495
- } else t3 = $[2];
1496
- return t3;
1497
- });
631
+ const TraceStatusBadge = memo(({ status, duration }) => /* @__PURE__ */ jsx(Badge, {
632
+ variant: variantMap[status],
633
+ children: duration && status !== "failed" ? duration : status
634
+ }));
1498
635
  TraceStatusBadge.displayName = "TraceStatusBadge";
1499
636
 
1500
637
  //#endregion
1501
638
  //#region src/components/trace-group-item.tsx
1502
- var import_compiler_runtime$3 = require_compiler_runtime();
1503
- const TraceGroupItem = memo((t0) => {
1504
- const $ = (0, import_compiler_runtime$3.c)(42);
1505
- const { groupId, groupName, groupStatus, groupStartTime, groupEndTime, totalSteps, activeSteps, isSelected } = t0;
1506
- const selectTraceGroupId = useObservabilityStore(_temp$1);
1507
- let t1;
1508
- if ($[0] !== groupEndTime || $[1] !== groupStartTime) {
1509
- t1 = groupEndTime ? formatDuration(groupEndTime - groupStartTime) : void 0;
1510
- $[0] = groupEndTime;
1511
- $[1] = groupStartTime;
1512
- $[2] = t1;
1513
- } else t1 = $[2];
1514
- const duration = t1;
1515
- let t2;
1516
- if ($[3] !== groupId || $[4] !== selectTraceGroupId) {
1517
- t2 = () => {
1518
- selectTraceGroupId(groupId);
1519
- };
1520
- $[3] = groupId;
1521
- $[4] = selectTraceGroupId;
1522
- $[5] = t2;
1523
- } else t2 = $[5];
1524
- const onSelect = t2;
1525
- const t3 = `trace-${groupId}`;
1526
- const t4 = isSelected ? "bg-muted-foreground/10" : "hover:bg-muted/70";
1527
- let t5;
1528
- if ($[6] !== t4) {
1529
- t5 = cn("motia-trace-group cursor-pointer transition-colors w-full text-left", t4);
1530
- $[6] = t4;
1531
- $[7] = t5;
1532
- } else t5 = $[7];
1533
- let t6;
1534
- if ($[8] !== groupName) {
1535
- t6 = /* @__PURE__ */ jsx("span", {
1536
- className: "font-semibold text-lg",
1537
- children: groupName
1538
- });
1539
- $[8] = groupName;
1540
- $[9] = t6;
1541
- } else t6 = $[9];
1542
- let t7;
1543
- if ($[10] !== duration || $[11] !== groupStatus) {
1544
- t7 = /* @__PURE__ */ jsx(TraceStatusBadge, {
1545
- status: groupStatus,
1546
- duration
1547
- });
1548
- $[10] = duration;
1549
- $[11] = groupStatus;
1550
- $[12] = t7;
1551
- } else t7 = $[12];
1552
- let t8;
1553
- if ($[13] !== t6 || $[14] !== t7) {
1554
- t8 = /* @__PURE__ */ jsxs("div", {
1555
- className: "flex flex-row justify-between items-center gap-2",
1556
- children: [t6, t7]
1557
- });
1558
- $[13] = t6;
1559
- $[14] = t7;
1560
- $[15] = t8;
1561
- } else t8 = $[15];
1562
- let t9;
1563
- if ($[16] !== groupId) {
1564
- t9 = /* @__PURE__ */ jsx("div", {
1565
- "data-testid": "trace-id",
1566
- className: "text-xs text-muted-foreground font-mono tracking-[1px]",
1567
- children: groupId
1568
- });
1569
- $[16] = groupId;
1570
- $[17] = t9;
1571
- } else t9 = $[17];
1572
- let t10;
1573
- if ($[18] !== totalSteps) {
1574
- t10 = /* @__PURE__ */ jsxs("span", { children: [totalSteps, " steps"] });
1575
- $[18] = totalSteps;
1576
- $[19] = t10;
1577
- } else t10 = $[19];
1578
- let t11;
1579
- if ($[20] !== t10 || $[21] !== t9) {
1580
- t11 = /* @__PURE__ */ jsxs("div", {
1581
- className: "flex justify-between",
1582
- children: [t9, t10]
1583
- });
1584
- $[20] = t10;
1585
- $[21] = t9;
1586
- $[22] = t11;
1587
- } else t11 = $[22];
1588
- let t12;
1589
- if ($[23] !== groupStartTime) {
1590
- t12 = formatDistanceToNow(groupStartTime);
1591
- $[23] = groupStartTime;
1592
- $[24] = t12;
1593
- } else t12 = $[24];
1594
- let t13;
1595
- if ($[25] !== t12) {
1596
- t13 = /* @__PURE__ */ jsxs("div", {
1597
- className: "flex justify-between",
1598
- children: [t12, " ago"]
1599
- });
1600
- $[25] = t12;
1601
- $[26] = t13;
1602
- } else t13 = $[26];
1603
- let t14;
1604
- if ($[27] !== activeSteps) {
1605
- t14 = activeSteps > 0 && /* @__PURE__ */ jsxs("div", {
1606
- className: "text-blue-600",
1607
- children: [activeSteps, " active"]
1608
- });
1609
- $[27] = activeSteps;
1610
- $[28] = t14;
1611
- } else t14 = $[28];
1612
- let t15;
1613
- if ($[29] !== t11 || $[30] !== t13 || $[31] !== t14) {
1614
- t15 = /* @__PURE__ */ jsxs("div", {
1615
- className: "text-xs text-muted-foreground space-y-1",
1616
- children: [
1617
- t11,
1618
- t13,
1619
- t14
1620
- ]
1621
- });
1622
- $[29] = t11;
1623
- $[30] = t13;
1624
- $[31] = t14;
1625
- $[32] = t15;
1626
- } else t15 = $[32];
1627
- let t16;
1628
- if ($[33] !== t15 || $[34] !== t8) {
1629
- t16 = /* @__PURE__ */ jsxs("div", {
639
+ const TraceGroupItem = memo(({ groupId, groupName, groupStatus, groupStartTime, groupEndTime, totalSteps, activeSteps, isSelected }) => {
640
+ const selectTraceGroupId = useObservabilityStore((state) => state.selectTraceGroupId);
641
+ const duration = useMemo(() => groupEndTime ? formatDuration(groupEndTime - groupStartTime) : void 0, [groupEndTime, groupStartTime]);
642
+ const onSelect = useCallback(() => {
643
+ selectTraceGroupId(groupId);
644
+ }, [groupId, selectTraceGroupId]);
645
+ return /* @__PURE__ */ jsx("button", {
646
+ type: "button",
647
+ "data-testid": `trace-${groupId}`,
648
+ className: cn("motia-trace-group cursor-pointer transition-colors w-full text-left", isSelected ? "bg-muted-foreground/10" : "hover:bg-muted/70"),
649
+ onClick: onSelect,
650
+ children: /* @__PURE__ */ jsxs("div", {
1630
651
  className: "p-3 flex flex-col gap-1",
1631
- children: [t8, t15]
1632
- });
1633
- $[33] = t15;
1634
- $[34] = t8;
1635
- $[35] = t16;
1636
- } else t16 = $[35];
1637
- let t17;
1638
- if ($[36] !== groupId || $[37] !== onSelect || $[38] !== t16 || $[39] !== t3 || $[40] !== t5) {
1639
- t17 = /* @__PURE__ */ jsx("button", {
1640
- type: "button",
1641
- "data-testid": t3,
1642
- className: t5,
1643
- onClick: onSelect,
1644
- children: t16
1645
- }, groupId);
1646
- $[36] = groupId;
1647
- $[37] = onSelect;
1648
- $[38] = t16;
1649
- $[39] = t3;
1650
- $[40] = t5;
1651
- $[41] = t17;
1652
- } else t17 = $[41];
1653
- return t17;
652
+ children: [/* @__PURE__ */ jsxs("div", {
653
+ className: "flex flex-row justify-between items-center gap-2",
654
+ children: [/* @__PURE__ */ jsx("span", {
655
+ className: "font-semibold text-lg",
656
+ children: groupName
657
+ }), /* @__PURE__ */ jsx(TraceStatusBadge, {
658
+ status: groupStatus,
659
+ duration
660
+ })]
661
+ }), /* @__PURE__ */ jsxs("div", {
662
+ className: "text-xs text-muted-foreground space-y-1",
663
+ children: [
664
+ /* @__PURE__ */ jsxs("div", {
665
+ className: "flex justify-between",
666
+ children: [/* @__PURE__ */ jsx("div", {
667
+ "data-testid": "trace-id",
668
+ className: "text-xs text-muted-foreground font-mono tracking-[1px]",
669
+ children: groupId
670
+ }), /* @__PURE__ */ jsxs("span", { children: [totalSteps, " steps"] })]
671
+ }),
672
+ /* @__PURE__ */ jsxs("div", {
673
+ className: "flex justify-between",
674
+ children: [formatDistanceToNow(groupStartTime), " ago"]
675
+ }),
676
+ activeSteps > 0 && /* @__PURE__ */ jsxs("div", {
677
+ className: "text-blue-600",
678
+ children: [activeSteps, " active"]
679
+ })
680
+ ]
681
+ })]
682
+ })
683
+ }, groupId);
1654
684
  });
1655
685
  TraceGroupItem.displayName = "TraceGroupItem";
1656
- function _temp$1(state) {
1657
- return state.selectTraceGroupId;
1658
- }
1659
686
 
1660
687
  //#endregion
1661
688
  //#region src/components/traces-groups.tsx
1662
- var import_compiler_runtime$2 = require_compiler_runtime();
1663
689
  const TracesGroups = memo(() => {
1664
- const $ = (0, import_compiler_runtime$2.c)(17);
1665
690
  const groups = useFilteredTraceGroups();
1666
- const selectedGroupId = useObservabilityStore(_temp);
1667
- const selectTraceGroupId = useObservabilityStore(_temp2);
1668
- const groupsLength = groups?.length || 0;
1669
- let t0;
1670
- bb0: {
1671
- if (!groups || groups.length === 0) {
1672
- t0 = "";
1673
- break bb0;
1674
- }
691
+ const selectedGroupId = useObservabilityStore((state) => state.selectedTraceGroupId);
692
+ const selectTraceGroupId = useObservabilityStore((state) => state.selectTraceGroupId);
693
+ const groupsLength = useMemo(() => groups?.length || 0, [groups]);
694
+ const lastRunningGroupId = useMemo(() => {
695
+ if (!groups || groups.length === 0) return "";
1675
696
  const lastGroup = groups[groups.length - 1];
1676
- t0 = lastGroup?.status === "running" ? lastGroup.id : "";
1677
- }
1678
- const lastRunningGroupId = t0;
1679
- let t1;
1680
- if ($[0] !== groupsLength || $[1] !== lastRunningGroupId || $[2] !== selectTraceGroupId || $[3] !== selectedGroupId) {
1681
- t1 = () => {
1682
- if (lastRunningGroupId && lastRunningGroupId !== selectedGroupId) selectTraceGroupId(lastRunningGroupId);
1683
- else if (!lastRunningGroupId && !groupsLength && selectedGroupId) selectTraceGroupId("");
1684
- };
1685
- $[0] = groupsLength;
1686
- $[1] = lastRunningGroupId;
1687
- $[2] = selectTraceGroupId;
1688
- $[3] = selectedGroupId;
1689
- $[4] = t1;
1690
- } else t1 = $[4];
1691
- let t2;
1692
- if ($[5] !== groupsLength || $[6] !== lastRunningGroupId) {
1693
- t2 = [lastRunningGroupId, groupsLength];
1694
- $[5] = groupsLength;
1695
- $[6] = lastRunningGroupId;
1696
- $[7] = t2;
1697
- } else t2 = $[7];
1698
- useEffect(t1, t2);
1699
- let t3;
1700
- if ($[8] !== groups) {
1701
- t3 = [...groups].reverse();
1702
- $[8] = groups;
1703
- $[9] = t3;
1704
- } else t3 = $[9];
1705
- const reversedGroups = t3;
697
+ return lastGroup?.status === "running" ? lastGroup.id : "";
698
+ }, [groups]);
699
+ useEffect(() => {
700
+ if (lastRunningGroupId && lastRunningGroupId !== selectedGroupId) selectTraceGroupId(lastRunningGroupId);
701
+ else if (!lastRunningGroupId && !groupsLength && selectedGroupId) selectTraceGroupId("");
702
+ }, [lastRunningGroupId, groupsLength]);
703
+ const reversedGroups = useMemo(() => [...groups].reverse(), [groups]);
1706
704
  if (!groups || groups.length === 0) return null;
1707
- let t4;
1708
- if ($[10] !== reversedGroups || $[11] !== selectedGroupId) {
1709
- let t5$1;
1710
- if ($[13] !== selectedGroupId) {
1711
- t5$1 = (group) => /* @__PURE__ */ jsx(TraceGroupItem, {
1712
- groupId: group.id,
1713
- groupName: group.name,
1714
- groupStatus: group.status,
1715
- groupStartTime: group.startTime,
1716
- groupEndTime: group.endTime,
1717
- totalSteps: group.metadata.totalSteps,
1718
- activeSteps: group.metadata.activeSteps,
1719
- isSelected: selectedGroupId === group.id
1720
- }, group.id);
1721
- $[13] = selectedGroupId;
1722
- $[14] = t5$1;
1723
- } else t5$1 = $[14];
1724
- t4 = reversedGroups.map(t5$1);
1725
- $[10] = reversedGroups;
1726
- $[11] = selectedGroupId;
1727
- $[12] = t4;
1728
- } else t4 = $[12];
1729
- let t5;
1730
- if ($[15] !== t4) {
1731
- t5 = /* @__PURE__ */ jsx("div", {
1732
- className: "overflow-auto",
1733
- children: t4
1734
- });
1735
- $[15] = t4;
1736
- $[16] = t5;
1737
- } else t5 = $[16];
1738
- return t5;
705
+ return /* @__PURE__ */ jsx("div", {
706
+ className: "overflow-auto",
707
+ children: reversedGroups.map((group) => /* @__PURE__ */ jsx(TraceGroupItem, {
708
+ groupId: group.id,
709
+ groupName: group.name,
710
+ groupStatus: group.status,
711
+ groupStartTime: group.startTime,
712
+ groupEndTime: group.endTime,
713
+ totalSteps: group.metadata.totalSteps,
714
+ activeSteps: group.metadata.activeSteps,
715
+ isSelected: selectedGroupId === group.id
716
+ }, group.id))
717
+ });
1739
718
  });
1740
719
  TracesGroups.displayName = "TracesGroups";
1741
- function _temp(state) {
1742
- return state.selectedTraceGroupId;
1743
- }
1744
- function _temp2(state_0) {
1745
- return state_0.selectTraceGroupId;
1746
- }
1747
720
 
1748
721
  //#endregion
1749
722
  //#region src/components/observability-page.tsx
1750
- var import_compiler_runtime$1 = require_compiler_runtime();
1751
723
  const ObservabilityPage = memo(() => {
1752
- const $ = (0, import_compiler_runtime$1.c)(3);
1753
- let t0;
1754
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1755
- t0 = /* @__PURE__ */ jsx(SearchBar, {});
1756
- $[0] = t0;
1757
- } else t0 = $[0];
1758
- let t1;
1759
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1760
- t1 = /* @__PURE__ */ jsx("div", {
1761
- className: "w-[300px] border-r border-border overflow-auto h-full",
1762
- "data-testid": "traces-container",
1763
- children: /* @__PURE__ */ jsx(TracesGroups, {})
1764
- });
1765
- $[1] = t1;
1766
- } else t1 = $[1];
1767
- let t2;
1768
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
1769
- t2 = /* @__PURE__ */ jsxs("div", {
1770
- className: "grid grid-rows-[auto_1fr] h-full",
1771
- children: [t0, /* @__PURE__ */ jsxs("div", {
1772
- className: "grid grid-cols-[300px_1fr] overflow-hidden",
1773
- children: [t1, /* @__PURE__ */ jsxs("div", {
1774
- className: "overflow-auto",
1775
- "data-testid": "trace-details",
1776
- children: [/* @__PURE__ */ jsx(TraceTimeline, {}), /* @__PURE__ */ jsx(TraceEmptyState, {})]
1777
- })]
724
+ return /* @__PURE__ */ jsxs("div", {
725
+ className: "grid grid-rows-[auto_1fr] h-full",
726
+ children: [/* @__PURE__ */ jsx(SearchBar, {}), /* @__PURE__ */ jsxs("div", {
727
+ className: "grid grid-cols-[300px_1fr] overflow-hidden",
728
+ children: [/* @__PURE__ */ jsx("div", {
729
+ className: "w-[300px] border-r border-border overflow-auto h-full",
730
+ "data-testid": "traces-container",
731
+ children: /* @__PURE__ */ jsx(TracesGroups, {})
732
+ }), /* @__PURE__ */ jsxs("div", {
733
+ className: "overflow-auto",
734
+ "data-testid": "trace-details",
735
+ children: [/* @__PURE__ */ jsx(TraceTimeline, {}), /* @__PURE__ */ jsx(TraceEmptyState, {})]
1778
736
  })]
1779
- });
1780
- $[2] = t2;
1781
- } else t2 = $[2];
1782
- return t2;
737
+ })]
738
+ });
1783
739
  });
1784
740
  ObservabilityPage.displayName = "ObservabilityPage";
1785
741
 
1786
742
  //#endregion
1787
743
  //#region src/components/observability-tab-label.tsx
1788
- var import_compiler_runtime = require_compiler_runtime();
1789
- const ObservabilityTabLabel = memo(() => {
1790
- const $ = (0, import_compiler_runtime.c)(1);
1791
- let t0;
1792
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1793
- t0 = /* @__PURE__ */ jsxs("div", {
1794
- "data-testid": "observability-link",
1795
- children: [/* @__PURE__ */ jsx(GanttChartSquare, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: "Tracing" })]
1796
- });
1797
- $[0] = t0;
1798
- } else t0 = $[0];
1799
- return t0;
1800
- });
744
+ const ObservabilityTabLabel = memo(() => /* @__PURE__ */ jsxs("div", {
745
+ "data-testid": "observability-link",
746
+ children: [/* @__PURE__ */ jsx(GanttChartSquare, { "aria-hidden": "true" }), /* @__PURE__ */ jsx("span", { children: "Tracing" })]
747
+ }));
1801
748
  ObservabilityTabLabel.displayName = "ObservabilityTabLabel";
1802
749
 
1803
750
  //#endregion