@motiadev/plugin-bullmq 0.14.0-beta.165-602289 → 0.14.0-beta.165-917560

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
@@ -0,0 +1,3018 @@
1
+ import { c } from "react/compiler-runtime";
2
+ import { memo, useCallback, useEffect, useState } from "react";
3
+ import { useStreamGroup } from "@motiadev/stream-client-react";
4
+ import { create } from "zustand";
5
+ import { QueryClient, QueryClientProvider, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Button, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, Input, Sidebar, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, TabsList, TabsTrigger, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn } from "@motiadev/ui";
8
+ import { formatDistanceToNow } from "date-fns";
9
+ import { AlertTriangle, ArrowUpRight, Layers, MoreVertical, Pause, Play, RefreshCw, Search, Skull, Trash, X } from "lucide-react";
10
+ import JsonView from "react18-json-view";
11
+ import "react18-json-view/src/style.css";
12
+
13
+ //#region src/stores/use-bullmq-store.ts
14
+ const initialState = {
15
+ queues: [],
16
+ selectedQueue: null,
17
+ selectedJob: null,
18
+ selectedStatus: "waiting",
19
+ error: null,
20
+ searchQuery: "",
21
+ jobDetailOpen: false
22
+ };
23
+ const useBullMQStore = create((set) => ({
24
+ ...initialState,
25
+ setQueues: (queues) => set({ queues }),
26
+ setSelectedQueue: (queue) => set({
27
+ selectedQueue: queue,
28
+ selectedJob: null
29
+ }),
30
+ updateSelectedQueueStats: (queue) => set({ selectedQueue: queue }),
31
+ setSelectedJob: (job) => set({ selectedJob: job }),
32
+ setSelectedStatus: (status) => set({ selectedStatus: status }),
33
+ setError: (error) => set({ error }),
34
+ setSearchQuery: (query) => set({ searchQuery: query }),
35
+ setJobDetailOpen: (open) => set({ jobDetailOpen: open }),
36
+ reset: () => set(initialState)
37
+ }));
38
+
39
+ //#endregion
40
+ //#region src/hooks/use-queues.ts
41
+ const STREAM_NAME = "__motia.bullmq-queues";
42
+ const useQueues = () => {
43
+ const { queues, setQueues, setError, error, selectedQueue, setSelectedQueue } = useBullMQStore();
44
+ const { data: streamQueues } = useStreamGroup({
45
+ streamName: STREAM_NAME,
46
+ groupId: "default"
47
+ });
48
+ useEffect(() => {
49
+ if (streamQueues.length > 0) {
50
+ setQueues(streamQueues);
51
+ if (selectedQueue) {
52
+ const updatedQueue = streamQueues.find((q) => q.name === selectedQueue.name);
53
+ if (updatedQueue) {
54
+ const currentStats = JSON.stringify(selectedQueue.stats);
55
+ const newStats = JSON.stringify(updatedQueue.stats);
56
+ const pausedChanged = selectedQueue.isPaused !== updatedQueue.isPaused;
57
+ if (currentStats !== newStats || pausedChanged) setSelectedQueue(updatedQueue);
58
+ }
59
+ }
60
+ }
61
+ }, [
62
+ streamQueues,
63
+ setQueues,
64
+ selectedQueue,
65
+ setSelectedQueue
66
+ ]);
67
+ return {
68
+ queues,
69
+ error,
70
+ refreshQueue: useCallback(async (name) => {
71
+ try {
72
+ const response = await fetch(`/__motia/bullmq/queues/${encodeURIComponent(name)}`);
73
+ if (!response.ok) throw new Error("Failed to fetch queue");
74
+ return await response.json();
75
+ } catch {
76
+ return null;
77
+ }
78
+ }, []),
79
+ pauseQueue: useCallback(async (name_0) => {
80
+ try {
81
+ await fetch(`/__motia/bullmq/queues/${encodeURIComponent(name_0)}/pause`, { method: "POST" });
82
+ } catch (err) {
83
+ setError(err instanceof Error ? err.message : "Failed to pause queue");
84
+ }
85
+ }, [setError]),
86
+ resumeQueue: useCallback(async (name_1) => {
87
+ try {
88
+ await fetch(`/__motia/bullmq/queues/${encodeURIComponent(name_1)}/resume`, { method: "POST" });
89
+ } catch (err_0) {
90
+ setError(err_0 instanceof Error ? err_0.message : "Failed to resume queue");
91
+ }
92
+ }, [setError]),
93
+ cleanQueue: useCallback(async (name_2, status, grace = 0, limit = 1e3) => {
94
+ try {
95
+ await fetch(`/__motia/bullmq/queues/${encodeURIComponent(name_2)}/clean`, {
96
+ method: "POST",
97
+ headers: { "Content-Type": "application/json" },
98
+ body: JSON.stringify({
99
+ status,
100
+ grace,
101
+ limit
102
+ })
103
+ });
104
+ } catch (err_1) {
105
+ setError(err_1 instanceof Error ? err_1.message : "Failed to clean queue");
106
+ }
107
+ }, [setError]),
108
+ drainQueue: useCallback(async (name_3) => {
109
+ try {
110
+ await fetch(`/__motia/bullmq/queues/${encodeURIComponent(name_3)}/drain`, { method: "POST" });
111
+ } catch (err_2) {
112
+ setError(err_2 instanceof Error ? err_2.message : "Failed to drain queue");
113
+ }
114
+ }, [setError])
115
+ };
116
+ };
117
+
118
+ //#endregion
119
+ //#region src/providers/query-provider.tsx
120
+ const queryClient = new QueryClient({ defaultOptions: { queries: {
121
+ staleTime: 5e3,
122
+ refetchOnWindowFocus: false,
123
+ retry: 1
124
+ } } });
125
+ const QueryProvider = (t0) => {
126
+ const $ = c(3);
127
+ if ($[0] !== "72268343e8809a517b650d94aea39cf9f299784a2a89cdc3b8e9a0d84a7244b8") {
128
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
129
+ $[0] = "72268343e8809a517b650d94aea39cf9f299784a2a89cdc3b8e9a0d84a7244b8";
130
+ }
131
+ const { children } = t0;
132
+ let t1;
133
+ if ($[1] !== children) {
134
+ t1 = /* @__PURE__ */ jsx(QueryClientProvider, {
135
+ client: queryClient,
136
+ children
137
+ });
138
+ $[1] = children;
139
+ $[2] = t1;
140
+ } else t1 = $[2];
141
+ return t1;
142
+ };
143
+
144
+ //#endregion
145
+ //#region src/hooks/use-jobs-mutations.ts
146
+ const retryJobFn = async ({ queueName, jobId }) => {
147
+ if (!(await fetch(`/__motia/bullmq/queues/${encodeURIComponent(queueName)}/jobs/${encodeURIComponent(jobId)}/retry`, { method: "POST" })).ok) throw new Error("Failed to retry job");
148
+ };
149
+ const removeJobFn = async ({ queueName, jobId }) => {
150
+ if (!(await fetch(`/__motia/bullmq/queues/${encodeURIComponent(queueName)}/jobs/${encodeURIComponent(jobId)}/remove`, { method: "POST" })).ok) throw new Error("Failed to remove job");
151
+ };
152
+ const promoteJobFn = async ({ queueName, jobId }) => {
153
+ if (!(await fetch(`/__motia/bullmq/queues/${encodeURIComponent(queueName)}/jobs/${encodeURIComponent(jobId)}/promote`, { method: "POST" })).ok) throw new Error("Failed to promote job");
154
+ };
155
+ const retryFromDLQFn = async ({ queueName, jobId }) => {
156
+ if (!(await fetch(`/__motia/bullmq/dlq/${encodeURIComponent(queueName)}/retry/${encodeURIComponent(jobId)}`, { method: "POST" })).ok) throw new Error("Failed to retry from DLQ");
157
+ };
158
+ const retryAllFromDLQFn = async ({ queueName }) => {
159
+ if (!(await fetch(`/__motia/bullmq/dlq/${encodeURIComponent(queueName)}/retry-all`, { method: "POST" })).ok) throw new Error("Failed to retry all from DLQ");
160
+ };
161
+ const clearDLQFn = async ({ queueName }) => {
162
+ if (!(await fetch(`/__motia/bullmq/dlq/${encodeURIComponent(queueName)}/clear`, { method: "POST" })).ok) throw new Error("Failed to clear DLQ");
163
+ };
164
+ const useRetryJob = () => {
165
+ const $ = c(8);
166
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
167
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
168
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
169
+ }
170
+ const queryClient$1 = useQueryClient();
171
+ const setError = useBullMQStore(_temp$7);
172
+ let t0;
173
+ if ($[1] !== queryClient$1) {
174
+ t0 = (_, t1$1) => {
175
+ const { queueName } = t1$1;
176
+ queryClient$1.invalidateQueries({ queryKey: ["jobs", queueName] });
177
+ };
178
+ $[1] = queryClient$1;
179
+ $[2] = t0;
180
+ } else t0 = $[2];
181
+ let t1;
182
+ if ($[3] !== setError) {
183
+ t1 = (error) => {
184
+ setError(error instanceof Error ? error.message : "Failed to retry job");
185
+ };
186
+ $[3] = setError;
187
+ $[4] = t1;
188
+ } else t1 = $[4];
189
+ let t2;
190
+ if ($[5] !== t0 || $[6] !== t1) {
191
+ t2 = {
192
+ mutationFn: retryJobFn,
193
+ onSuccess: t0,
194
+ onError: t1
195
+ };
196
+ $[5] = t0;
197
+ $[6] = t1;
198
+ $[7] = t2;
199
+ } else t2 = $[7];
200
+ return useMutation(t2);
201
+ };
202
+ const useRemoveJob = () => {
203
+ const $ = c(8);
204
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
205
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
206
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
207
+ }
208
+ const queryClient$1 = useQueryClient();
209
+ const setError = useBullMQStore(_temp2$7);
210
+ let t0;
211
+ if ($[1] !== queryClient$1) {
212
+ t0 = (_, t1$1) => {
213
+ const { queueName } = t1$1;
214
+ queryClient$1.invalidateQueries({ queryKey: ["jobs", queueName] });
215
+ };
216
+ $[1] = queryClient$1;
217
+ $[2] = t0;
218
+ } else t0 = $[2];
219
+ let t1;
220
+ if ($[3] !== setError) {
221
+ t1 = (error) => {
222
+ setError(error instanceof Error ? error.message : "Failed to remove job");
223
+ };
224
+ $[3] = setError;
225
+ $[4] = t1;
226
+ } else t1 = $[4];
227
+ let t2;
228
+ if ($[5] !== t0 || $[6] !== t1) {
229
+ t2 = {
230
+ mutationFn: removeJobFn,
231
+ onSuccess: t0,
232
+ onError: t1
233
+ };
234
+ $[5] = t0;
235
+ $[6] = t1;
236
+ $[7] = t2;
237
+ } else t2 = $[7];
238
+ return useMutation(t2);
239
+ };
240
+ const usePromoteJob = () => {
241
+ const $ = c(8);
242
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
243
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
244
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
245
+ }
246
+ const queryClient$1 = useQueryClient();
247
+ const setError = useBullMQStore(_temp3$4);
248
+ let t0;
249
+ if ($[1] !== queryClient$1) {
250
+ t0 = (_, t1$1) => {
251
+ const { queueName } = t1$1;
252
+ queryClient$1.invalidateQueries({ queryKey: ["jobs", queueName] });
253
+ };
254
+ $[1] = queryClient$1;
255
+ $[2] = t0;
256
+ } else t0 = $[2];
257
+ let t1;
258
+ if ($[3] !== setError) {
259
+ t1 = (error) => {
260
+ setError(error instanceof Error ? error.message : "Failed to promote job");
261
+ };
262
+ $[3] = setError;
263
+ $[4] = t1;
264
+ } else t1 = $[4];
265
+ let t2;
266
+ if ($[5] !== t0 || $[6] !== t1) {
267
+ t2 = {
268
+ mutationFn: promoteJobFn,
269
+ onSuccess: t0,
270
+ onError: t1
271
+ };
272
+ $[5] = t0;
273
+ $[6] = t1;
274
+ $[7] = t2;
275
+ } else t2 = $[7];
276
+ return useMutation(t2);
277
+ };
278
+ const useRetryFromDLQ = () => {
279
+ const $ = c(8);
280
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
281
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
282
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
283
+ }
284
+ const queryClient$1 = useQueryClient();
285
+ const setError = useBullMQStore(_temp4$3);
286
+ let t0;
287
+ if ($[1] !== queryClient$1) {
288
+ t0 = (_, t1$1) => {
289
+ const { queueName } = t1$1;
290
+ queryClient$1.invalidateQueries({ queryKey: ["dlq-jobs", queueName] });
291
+ };
292
+ $[1] = queryClient$1;
293
+ $[2] = t0;
294
+ } else t0 = $[2];
295
+ let t1;
296
+ if ($[3] !== setError) {
297
+ t1 = (error) => {
298
+ setError(error instanceof Error ? error.message : "Failed to retry from DLQ");
299
+ };
300
+ $[3] = setError;
301
+ $[4] = t1;
302
+ } else t1 = $[4];
303
+ let t2;
304
+ if ($[5] !== t0 || $[6] !== t1) {
305
+ t2 = {
306
+ mutationFn: retryFromDLQFn,
307
+ onSuccess: t0,
308
+ onError: t1
309
+ };
310
+ $[5] = t0;
311
+ $[6] = t1;
312
+ $[7] = t2;
313
+ } else t2 = $[7];
314
+ return useMutation(t2);
315
+ };
316
+ const useRetryAllFromDLQ = () => {
317
+ const $ = c(8);
318
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
319
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
320
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
321
+ }
322
+ const queryClient$1 = useQueryClient();
323
+ const setError = useBullMQStore(_temp5$3);
324
+ let t0;
325
+ if ($[1] !== queryClient$1) {
326
+ t0 = (_, t1$1) => {
327
+ const { queueName } = t1$1;
328
+ queryClient$1.invalidateQueries({ queryKey: ["dlq-jobs", queueName] });
329
+ };
330
+ $[1] = queryClient$1;
331
+ $[2] = t0;
332
+ } else t0 = $[2];
333
+ let t1;
334
+ if ($[3] !== setError) {
335
+ t1 = (error) => {
336
+ setError(error instanceof Error ? error.message : "Failed to retry all from DLQ");
337
+ };
338
+ $[3] = setError;
339
+ $[4] = t1;
340
+ } else t1 = $[4];
341
+ let t2;
342
+ if ($[5] !== t0 || $[6] !== t1) {
343
+ t2 = {
344
+ mutationFn: retryAllFromDLQFn,
345
+ onSuccess: t0,
346
+ onError: t1
347
+ };
348
+ $[5] = t0;
349
+ $[6] = t1;
350
+ $[7] = t2;
351
+ } else t2 = $[7];
352
+ return useMutation(t2);
353
+ };
354
+ const useClearDLQ = () => {
355
+ const $ = c(8);
356
+ if ($[0] !== "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177") {
357
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
358
+ $[0] = "dda4e584b854b7387aa6e222ff1915ce152f6bfdf2fc4ff1beda4b29692e9177";
359
+ }
360
+ const queryClient$1 = useQueryClient();
361
+ const setError = useBullMQStore(_temp6$1);
362
+ let t0;
363
+ if ($[1] !== queryClient$1) {
364
+ t0 = (_, t1$1) => {
365
+ const { queueName } = t1$1;
366
+ queryClient$1.invalidateQueries({ queryKey: ["dlq-jobs", queueName] });
367
+ };
368
+ $[1] = queryClient$1;
369
+ $[2] = t0;
370
+ } else t0 = $[2];
371
+ let t1;
372
+ if ($[3] !== setError) {
373
+ t1 = (error) => {
374
+ setError(error instanceof Error ? error.message : "Failed to clear DLQ");
375
+ };
376
+ $[3] = setError;
377
+ $[4] = t1;
378
+ } else t1 = $[4];
379
+ let t2;
380
+ if ($[5] !== t0 || $[6] !== t1) {
381
+ t2 = {
382
+ mutationFn: clearDLQFn,
383
+ onSuccess: t0,
384
+ onError: t1
385
+ };
386
+ $[5] = t0;
387
+ $[6] = t1;
388
+ $[7] = t2;
389
+ } else t2 = $[7];
390
+ return useMutation(t2);
391
+ };
392
+ function _temp$7(state) {
393
+ return state.setError;
394
+ }
395
+ function _temp2$7(state) {
396
+ return state.setError;
397
+ }
398
+ function _temp3$4(state) {
399
+ return state.setError;
400
+ }
401
+ function _temp4$3(state) {
402
+ return state.setError;
403
+ }
404
+ function _temp5$3(state) {
405
+ return state.setError;
406
+ }
407
+ function _temp6$1(state) {
408
+ return state.setError;
409
+ }
410
+
411
+ //#endregion
412
+ //#region src/hooks/use-jobs-query.ts
413
+ const fetchJobs = async (queueName, status, start = 0, end = 100) => {
414
+ const params = new URLSearchParams({
415
+ status,
416
+ start: String(start),
417
+ end: String(end)
418
+ });
419
+ const response = await fetch(`/__motia/bullmq/queues/${encodeURIComponent(queueName)}/jobs?${params}`);
420
+ if (!response.ok) throw new Error("Failed to fetch jobs");
421
+ return (await response.json()).jobs;
422
+ };
423
+ const fetchDLQJobs = async (queueName, start = 0, end = 100) => {
424
+ const params = new URLSearchParams({
425
+ start: String(start),
426
+ end: String(end)
427
+ });
428
+ const response = await fetch(`/__motia/bullmq/dlq/${encodeURIComponent(queueName)}/jobs?${params}`);
429
+ if (!response.ok) return [];
430
+ return (await response.json()).jobs;
431
+ };
432
+ const useJobsQuery = () => {
433
+ const $ = c(14);
434
+ if ($[0] !== "62345f058f3013b9a25310d4c1435bcda4709648cddbee0fee4472c79e98da42") {
435
+ for (let $i = 0; $i < 14; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
436
+ $[0] = "62345f058f3013b9a25310d4c1435bcda4709648cddbee0fee4472c79e98da42";
437
+ }
438
+ const selectedQueue = useBullMQStore(_temp$6);
439
+ const selectedStatus = useBullMQStore(_temp2$6);
440
+ const queueName = selectedQueue?.name;
441
+ let t0;
442
+ if ($[1] !== selectedQueue) {
443
+ t0 = selectedQueue ? JSON.stringify(selectedQueue.stats) : null;
444
+ $[1] = selectedQueue;
445
+ $[2] = t0;
446
+ } else t0 = $[2];
447
+ const statsKey = t0;
448
+ let t1;
449
+ if ($[3] !== queueName || $[4] !== selectedStatus || $[5] !== statsKey) {
450
+ t1 = [
451
+ "jobs",
452
+ queueName,
453
+ selectedStatus,
454
+ statsKey
455
+ ];
456
+ $[3] = queueName;
457
+ $[4] = selectedStatus;
458
+ $[5] = statsKey;
459
+ $[6] = t1;
460
+ } else t1 = $[6];
461
+ let t2;
462
+ if ($[7] !== queueName || $[8] !== selectedStatus) {
463
+ t2 = () => fetchJobs(queueName, selectedStatus);
464
+ $[7] = queueName;
465
+ $[8] = selectedStatus;
466
+ $[9] = t2;
467
+ } else t2 = $[9];
468
+ const t3 = !!queueName;
469
+ let t4;
470
+ if ($[10] !== t1 || $[11] !== t2 || $[12] !== t3) {
471
+ t4 = {
472
+ queryKey: t1,
473
+ queryFn: t2,
474
+ enabled: t3,
475
+ staleTime: 5e3
476
+ };
477
+ $[10] = t1;
478
+ $[11] = t2;
479
+ $[12] = t3;
480
+ $[13] = t4;
481
+ } else t4 = $[13];
482
+ return useQuery(t4);
483
+ };
484
+ const useDLQJobsQuery = (queueName) => {
485
+ const $ = c(8);
486
+ if ($[0] !== "62345f058f3013b9a25310d4c1435bcda4709648cddbee0fee4472c79e98da42") {
487
+ for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
488
+ $[0] = "62345f058f3013b9a25310d4c1435bcda4709648cddbee0fee4472c79e98da42";
489
+ }
490
+ let t0;
491
+ let t1;
492
+ if ($[1] !== queueName) {
493
+ t0 = ["dlq-jobs", queueName];
494
+ t1 = () => fetchDLQJobs(queueName);
495
+ $[1] = queueName;
496
+ $[2] = t0;
497
+ $[3] = t1;
498
+ } else {
499
+ t0 = $[2];
500
+ t1 = $[3];
501
+ }
502
+ const t2 = !!queueName;
503
+ let t3;
504
+ if ($[4] !== t0 || $[5] !== t1 || $[6] !== t2) {
505
+ t3 = {
506
+ queryKey: t0,
507
+ queryFn: t1,
508
+ enabled: t2
509
+ };
510
+ $[4] = t0;
511
+ $[5] = t1;
512
+ $[6] = t2;
513
+ $[7] = t3;
514
+ } else t3 = $[7];
515
+ return useQuery(t3);
516
+ };
517
+ function _temp$6(state) {
518
+ return state.selectedQueue;
519
+ }
520
+ function _temp2$6(state_0) {
521
+ return state_0.selectedStatus;
522
+ }
523
+
524
+ //#endregion
525
+ //#region src/components/dlq-panel.tsx
526
+ const DLQJobDetailContent = memo((t0) => {
527
+ const $ = c(30);
528
+ if ($[0] !== "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a") {
529
+ for (let $i = 0; $i < 30; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
530
+ $[0] = "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a";
531
+ }
532
+ const { job, onRetry } = t0;
533
+ let t1;
534
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
535
+ t1 = /* @__PURE__ */ jsx(RefreshCw, { className: "mr-2 h-4 w-4" });
536
+ $[1] = t1;
537
+ } else t1 = $[1];
538
+ let t2;
539
+ if ($[2] !== onRetry) {
540
+ t2 = /* @__PURE__ */ jsx("div", {
541
+ className: "flex gap-2",
542
+ children: /* @__PURE__ */ jsxs(Button, {
543
+ variant: "outline",
544
+ size: "sm",
545
+ onClick: onRetry,
546
+ children: [t1, "Retry"]
547
+ })
548
+ });
549
+ $[2] = onRetry;
550
+ $[3] = t2;
551
+ } else t2 = $[3];
552
+ let t3;
553
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
554
+ t3 = /* @__PURE__ */ jsx("span", {
555
+ className: "text-muted-foreground",
556
+ children: "Job ID"
557
+ });
558
+ $[4] = t3;
559
+ } else t3 = $[4];
560
+ let t4;
561
+ if ($[5] !== job.id) {
562
+ t4 = /* @__PURE__ */ jsxs("div", { children: [t3, /* @__PURE__ */ jsx("div", {
563
+ className: "font-mono text-xs",
564
+ children: job.id
565
+ })] });
566
+ $[5] = job.id;
567
+ $[6] = t4;
568
+ } else t4 = $[6];
569
+ let t5;
570
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
571
+ t5 = /* @__PURE__ */ jsx("span", {
572
+ className: "text-muted-foreground",
573
+ children: "Original Job ID"
574
+ });
575
+ $[7] = t5;
576
+ } else t5 = $[7];
577
+ const t6 = job.originalJobId || "-";
578
+ let t7;
579
+ if ($[8] !== t6) {
580
+ t7 = /* @__PURE__ */ jsxs("div", { children: [t5, /* @__PURE__ */ jsx("div", {
581
+ className: "font-mono text-xs",
582
+ children: t6
583
+ })] });
584
+ $[8] = t6;
585
+ $[9] = t7;
586
+ } else t7 = $[9];
587
+ let t8;
588
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
589
+ t8 = /* @__PURE__ */ jsx("span", {
590
+ className: "text-muted-foreground",
591
+ children: "Attempts Made"
592
+ });
593
+ $[10] = t8;
594
+ } else t8 = $[10];
595
+ let t9;
596
+ if ($[11] !== job.attemptsMade) {
597
+ t9 = /* @__PURE__ */ jsxs("div", { children: [t8, /* @__PURE__ */ jsx("div", {
598
+ className: "font-semibold",
599
+ children: job.attemptsMade
600
+ })] });
601
+ $[11] = job.attemptsMade;
602
+ $[12] = t9;
603
+ } else t9 = $[12];
604
+ let t10;
605
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
606
+ t10 = /* @__PURE__ */ jsx("span", {
607
+ className: "text-muted-foreground",
608
+ children: "Failed At"
609
+ });
610
+ $[13] = t10;
611
+ } else t10 = $[13];
612
+ let t11;
613
+ if ($[14] !== job.failureTimestamp) {
614
+ t11 = formatDistanceToNow(job.failureTimestamp, { addSuffix: true });
615
+ $[14] = job.failureTimestamp;
616
+ $[15] = t11;
617
+ } else t11 = $[15];
618
+ let t12;
619
+ if ($[16] !== t11) {
620
+ t12 = /* @__PURE__ */ jsxs("div", { children: [t10, /* @__PURE__ */ jsx("div", { children: t11 })] });
621
+ $[16] = t11;
622
+ $[17] = t12;
623
+ } else t12 = $[17];
624
+ let t13;
625
+ if ($[18] !== t12 || $[19] !== t4 || $[20] !== t7 || $[21] !== t9) {
626
+ t13 = /* @__PURE__ */ jsxs("div", {
627
+ className: "grid grid-cols-2 gap-4 text-sm",
628
+ children: [
629
+ t4,
630
+ t7,
631
+ t9,
632
+ t12
633
+ ]
634
+ });
635
+ $[18] = t12;
636
+ $[19] = t4;
637
+ $[20] = t7;
638
+ $[21] = t9;
639
+ $[22] = t13;
640
+ } else t13 = $[22];
641
+ let t14;
642
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
643
+ t14 = /* @__PURE__ */ jsx("div", {
644
+ className: "text-sm font-semibold text-destructive mb-2",
645
+ children: "Failure Reason"
646
+ });
647
+ $[23] = t14;
648
+ } else t14 = $[23];
649
+ let t15;
650
+ if ($[24] !== job.failureReason) {
651
+ t15 = /* @__PURE__ */ jsxs("div", { children: [t14, /* @__PURE__ */ jsx("div", {
652
+ className: "font-mono text-sm bg-destructive/10 p-3 rounded text-destructive",
653
+ children: job.failureReason
654
+ })] });
655
+ $[24] = job.failureReason;
656
+ $[25] = t15;
657
+ } else t15 = $[25];
658
+ let t16;
659
+ if ($[26] !== t13 || $[27] !== t15 || $[28] !== t2) {
660
+ t16 = /* @__PURE__ */ jsxs("div", {
661
+ className: "space-y-4",
662
+ children: [
663
+ t2,
664
+ t13,
665
+ t15
666
+ ]
667
+ });
668
+ $[26] = t13;
669
+ $[27] = t15;
670
+ $[28] = t2;
671
+ $[29] = t16;
672
+ } else t16 = $[29];
673
+ return t16;
674
+ });
675
+ DLQJobDetailContent.displayName = "DLQJobDetailContent";
676
+ const DLQJobDataTab = memo((t0) => {
677
+ const $ = c(3);
678
+ if ($[0] !== "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a") {
679
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
680
+ $[0] = "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a";
681
+ }
682
+ const { data } = t0;
683
+ const t1 = data;
684
+ let t2;
685
+ if ($[1] !== t1) {
686
+ t2 = /* @__PURE__ */ jsx("div", {
687
+ className: "bg-muted/30 p-4 rounded overflow-auto max-h-[400px]",
688
+ children: /* @__PURE__ */ jsx(JsonView, {
689
+ src: t1,
690
+ theme: "atom",
691
+ collapsed: 2
692
+ })
693
+ });
694
+ $[1] = t1;
695
+ $[2] = t2;
696
+ } else t2 = $[2];
697
+ return t2;
698
+ });
699
+ DLQJobDataTab.displayName = "DLQJobDataTab";
700
+ const DLQPanel = memo(() => {
701
+ const $ = c(66);
702
+ if ($[0] !== "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a") {
703
+ for (let $i = 0; $i < 66; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
704
+ $[0] = "9c642c700580e607dc6114475cae1bdbb21b1057857ec3c5d1e46ac6c107027a";
705
+ }
706
+ const selectedQueue = useBullMQStore(_temp$5);
707
+ const { data: t0, isLoading, refetch } = useDLQJobsQuery(selectedQueue?.isDLQ ? selectedQueue.name : void 0);
708
+ let t1;
709
+ if ($[1] !== t0) {
710
+ t1 = t0 === void 0 ? [] : t0;
711
+ $[1] = t0;
712
+ $[2] = t1;
713
+ } else t1 = $[2];
714
+ const dlqJobs = t1;
715
+ const retryFromDLQMutation = useRetryFromDLQ();
716
+ const retryAllFromDLQMutation = useRetryAllFromDLQ();
717
+ const clearDLQMutation = useClearDLQ();
718
+ const [selectedDlqJob, setSelectedDlqJob] = useState(null);
719
+ let t2;
720
+ if ($[3] !== retryFromDLQMutation || $[4] !== selectedQueue) {
721
+ t2 = (jobId) => {
722
+ if (!selectedQueue) return;
723
+ retryFromDLQMutation.mutate({
724
+ queueName: selectedQueue.name,
725
+ jobId
726
+ });
727
+ };
728
+ $[3] = retryFromDLQMutation;
729
+ $[4] = selectedQueue;
730
+ $[5] = t2;
731
+ } else t2 = $[5];
732
+ const handleRetry = t2;
733
+ let t3;
734
+ if ($[6] !== retryAllFromDLQMutation || $[7] !== selectedQueue) {
735
+ t3 = () => {
736
+ if (!selectedQueue) return;
737
+ retryAllFromDLQMutation.mutate({ queueName: selectedQueue.name });
738
+ };
739
+ $[6] = retryAllFromDLQMutation;
740
+ $[7] = selectedQueue;
741
+ $[8] = t3;
742
+ } else t3 = $[8];
743
+ const handleRetryAll = t3;
744
+ let t4;
745
+ if ($[9] !== clearDLQMutation || $[10] !== selectedQueue) {
746
+ t4 = () => {
747
+ if (!selectedQueue) return;
748
+ clearDLQMutation.mutate({ queueName: selectedQueue.name });
749
+ };
750
+ $[9] = clearDLQMutation;
751
+ $[10] = selectedQueue;
752
+ $[11] = t4;
753
+ } else t4 = $[11];
754
+ const handleClear = t4;
755
+ let t5;
756
+ if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
757
+ t5 = () => {
758
+ setSelectedDlqJob(null);
759
+ };
760
+ $[12] = t5;
761
+ } else t5 = $[12];
762
+ const handleCloseSidePanel = t5;
763
+ let t6;
764
+ if ($[13] !== handleRetry || $[14] !== selectedDlqJob) {
765
+ t6 = () => {
766
+ if (selectedDlqJob) {
767
+ handleRetry(selectedDlqJob.id);
768
+ setSelectedDlqJob(null);
769
+ }
770
+ };
771
+ $[13] = handleRetry;
772
+ $[14] = selectedDlqJob;
773
+ $[15] = t6;
774
+ } else t6 = $[15];
775
+ const handleRetryAndClose = t6;
776
+ if (!selectedQueue?.isDLQ) return null;
777
+ let t7;
778
+ if ($[16] !== selectedQueue.displayName) {
779
+ t7 = /* @__PURE__ */ jsx("h2", {
780
+ className: "font-semibold text-lg",
781
+ children: selectedQueue.displayName
782
+ });
783
+ $[16] = selectedQueue.displayName;
784
+ $[17] = t7;
785
+ } else t7 = $[17];
786
+ const t8 = dlqJobs.length !== 1 ? "s" : "";
787
+ let t9;
788
+ if ($[18] !== dlqJobs.length || $[19] !== t8) {
789
+ t9 = /* @__PURE__ */ jsxs("p", {
790
+ className: "text-sm text-muted-foreground",
791
+ children: [
792
+ dlqJobs.length,
793
+ " failed job",
794
+ t8,
795
+ " in dead letter queue"
796
+ ]
797
+ });
798
+ $[18] = dlqJobs.length;
799
+ $[19] = t8;
800
+ $[20] = t9;
801
+ } else t9 = $[20];
802
+ let t10;
803
+ if ($[21] !== t7 || $[22] !== t9) {
804
+ t10 = /* @__PURE__ */ jsxs("div", { children: [t7, t9] });
805
+ $[21] = t7;
806
+ $[22] = t9;
807
+ $[23] = t10;
808
+ } else t10 = $[23];
809
+ let t11;
810
+ if ($[24] !== refetch) {
811
+ t11 = () => refetch();
812
+ $[24] = refetch;
813
+ $[25] = t11;
814
+ } else t11 = $[25];
815
+ const t12 = `h-4 w-4 ${isLoading ? "animate-spin" : ""}`;
816
+ let t13;
817
+ if ($[26] !== t12) {
818
+ t13 = /* @__PURE__ */ jsx(RefreshCw, { className: t12 });
819
+ $[26] = t12;
820
+ $[27] = t13;
821
+ } else t13 = $[27];
822
+ let t14;
823
+ if ($[28] !== isLoading || $[29] !== t11 || $[30] !== t13) {
824
+ t14 = /* @__PURE__ */ jsx(TooltipTrigger, {
825
+ asChild: true,
826
+ children: /* @__PURE__ */ jsx(Button, {
827
+ variant: "ghost",
828
+ size: "icon",
829
+ onClick: t11,
830
+ disabled: isLoading,
831
+ children: t13
832
+ })
833
+ });
834
+ $[28] = isLoading;
835
+ $[29] = t11;
836
+ $[30] = t13;
837
+ $[31] = t14;
838
+ } else t14 = $[31];
839
+ let t15;
840
+ if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
841
+ t15 = /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Refresh DLQ jobs list" }) });
842
+ $[32] = t15;
843
+ } else t15 = $[32];
844
+ let t16;
845
+ if ($[33] !== t14) {
846
+ t16 = /* @__PURE__ */ jsxs(Tooltip, { children: [t14, t15] });
847
+ $[33] = t14;
848
+ $[34] = t16;
849
+ } else t16 = $[34];
850
+ const t17 = dlqJobs.length === 0;
851
+ let t18;
852
+ if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
853
+ t18 = /* @__PURE__ */ jsx(RefreshCw, { className: "mr-2 h-4 w-4" });
854
+ $[35] = t18;
855
+ } else t18 = $[35];
856
+ let t19;
857
+ if ($[36] !== handleRetryAll || $[37] !== t17) {
858
+ t19 = /* @__PURE__ */ jsx(TooltipTrigger, {
859
+ asChild: true,
860
+ children: /* @__PURE__ */ jsxs(Button, {
861
+ variant: "outline",
862
+ size: "sm",
863
+ onClick: handleRetryAll,
864
+ disabled: t17,
865
+ children: [t18, "Retry All"]
866
+ })
867
+ });
868
+ $[36] = handleRetryAll;
869
+ $[37] = t17;
870
+ $[38] = t19;
871
+ } else t19 = $[38];
872
+ let t20;
873
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
874
+ t20 = /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Re-queue all failed jobs to the original queue" }) });
875
+ $[39] = t20;
876
+ } else t20 = $[39];
877
+ let t21;
878
+ if ($[40] !== t19) {
879
+ t21 = /* @__PURE__ */ jsxs(Tooltip, { children: [t19, t20] });
880
+ $[40] = t19;
881
+ $[41] = t21;
882
+ } else t21 = $[41];
883
+ const t22 = dlqJobs.length === 0;
884
+ let t23;
885
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
886
+ t23 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
887
+ $[42] = t23;
888
+ } else t23 = $[42];
889
+ let t24;
890
+ if ($[43] !== handleClear || $[44] !== t22) {
891
+ t24 = /* @__PURE__ */ jsx(TooltipTrigger, {
892
+ asChild: true,
893
+ children: /* @__PURE__ */ jsxs(Button, {
894
+ variant: "outline",
895
+ size: "sm",
896
+ onClick: handleClear,
897
+ disabled: t22,
898
+ className: "text-destructive",
899
+ children: [t23, "Clear All"]
900
+ })
901
+ });
902
+ $[43] = handleClear;
903
+ $[44] = t22;
904
+ $[45] = t24;
905
+ } else t24 = $[45];
906
+ let t25;
907
+ if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
908
+ t25 = /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Permanently delete all jobs from DLQ" }) });
909
+ $[46] = t25;
910
+ } else t25 = $[46];
911
+ let t26;
912
+ if ($[47] !== t24) {
913
+ t26 = /* @__PURE__ */ jsxs(Tooltip, { children: [t24, t25] });
914
+ $[47] = t24;
915
+ $[48] = t26;
916
+ } else t26 = $[48];
917
+ let t27;
918
+ if ($[49] !== t16 || $[50] !== t21 || $[51] !== t26) {
919
+ t27 = /* @__PURE__ */ jsxs("div", {
920
+ className: "flex items-center gap-2",
921
+ children: [
922
+ t16,
923
+ t21,
924
+ t26
925
+ ]
926
+ });
927
+ $[49] = t16;
928
+ $[50] = t21;
929
+ $[51] = t26;
930
+ $[52] = t27;
931
+ } else t27 = $[52];
932
+ let t28;
933
+ if ($[53] !== t10 || $[54] !== t27) {
934
+ t28 = /* @__PURE__ */ jsxs("div", {
935
+ className: "flex items-center justify-between p-3 border-b border-border",
936
+ children: [t10, t27]
937
+ });
938
+ $[53] = t10;
939
+ $[54] = t27;
940
+ $[55] = t28;
941
+ } else t28 = $[55];
942
+ let t29;
943
+ if ($[56] !== dlqJobs || $[57] !== handleRetry) {
944
+ t29 = dlqJobs.length === 0 ? /* @__PURE__ */ jsx("div", {
945
+ className: "flex items-center justify-center flex-1 text-muted-foreground",
946
+ children: "No jobs in dead letter queue"
947
+ }) : /* @__PURE__ */ jsx("div", {
948
+ className: "flex-1 overflow-auto",
949
+ children: /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(TableHeader, {
950
+ className: "sticky top-0 bg-background/95 backdrop-blur-sm",
951
+ children: /* @__PURE__ */ jsxs(TableRow, { children: [
952
+ /* @__PURE__ */ jsx(TableHead, {
953
+ className: "w-[180px]",
954
+ children: "Job ID"
955
+ }),
956
+ /* @__PURE__ */ jsx(TableHead, {
957
+ className: "w-[180px]",
958
+ children: "Original Job"
959
+ }),
960
+ /* @__PURE__ */ jsx(TableHead, { children: "Failure Reason" }),
961
+ /* @__PURE__ */ jsx(TableHead, {
962
+ className: "w-[100px]",
963
+ children: "Attempts"
964
+ }),
965
+ /* @__PURE__ */ jsx(TableHead, {
966
+ className: "w-[150px]",
967
+ children: "Failed At"
968
+ }),
969
+ /* @__PURE__ */ jsx(TableHead, {
970
+ className: "w-[100px]",
971
+ children: "Actions"
972
+ })
973
+ ] })
974
+ }), /* @__PURE__ */ jsx(TableBody, { children: dlqJobs.map((job) => /* @__PURE__ */ jsxs(TableRow, {
975
+ className: "cursor-pointer hover:bg-muted-foreground/10",
976
+ onClick: () => setSelectedDlqJob(job),
977
+ children: [
978
+ /* @__PURE__ */ jsx(TableCell, {
979
+ className: "font-mono text-xs",
980
+ children: job.id
981
+ }),
982
+ /* @__PURE__ */ jsx(TableCell, {
983
+ className: "font-mono text-xs text-muted-foreground",
984
+ children: job.originalJobId || "-"
985
+ }),
986
+ /* @__PURE__ */ jsx(TableCell, {
987
+ className: "text-destructive text-sm truncate max-w-[300px]",
988
+ children: job.failureReason
989
+ }),
990
+ /* @__PURE__ */ jsx(TableCell, { children: job.attemptsMade }),
991
+ /* @__PURE__ */ jsx(TableCell, {
992
+ className: "text-xs text-muted-foreground",
993
+ children: formatDistanceToNow(job.failureTimestamp, { addSuffix: true })
994
+ }),
995
+ /* @__PURE__ */ jsx(TableCell, {
996
+ onClick: _temp2$5,
997
+ children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
998
+ asChild: true,
999
+ children: /* @__PURE__ */ jsx(Button, {
1000
+ variant: "ghost",
1001
+ size: "sm",
1002
+ onClick: () => handleRetry(job.id),
1003
+ children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" })
1004
+ })
1005
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Retry this job" }) })] })
1006
+ })
1007
+ ]
1008
+ }, job.id)) })] })
1009
+ });
1010
+ $[56] = dlqJobs;
1011
+ $[57] = handleRetry;
1012
+ $[58] = t29;
1013
+ } else t29 = $[58];
1014
+ let t30;
1015
+ if ($[59] !== handleRetryAndClose || $[60] !== selectedDlqJob) {
1016
+ t30 = selectedDlqJob && /* @__PURE__ */ jsx(Sidebar, {
1017
+ onClose: handleCloseSidePanel,
1018
+ title: "Dead Letter Job",
1019
+ initialWidth: 600,
1020
+ tabs: [{
1021
+ label: "Details",
1022
+ content: /* @__PURE__ */ jsx(DLQJobDetailContent, {
1023
+ job: selectedDlqJob,
1024
+ onRetry: handleRetryAndClose
1025
+ })
1026
+ }, {
1027
+ label: "Event Data",
1028
+ content: /* @__PURE__ */ jsx(DLQJobDataTab, { data: selectedDlqJob.originalEvent })
1029
+ }],
1030
+ actions: [{
1031
+ icon: /* @__PURE__ */ jsx(X, {}),
1032
+ onClick: handleCloseSidePanel,
1033
+ label: "Close"
1034
+ }]
1035
+ });
1036
+ $[59] = handleRetryAndClose;
1037
+ $[60] = selectedDlqJob;
1038
+ $[61] = t30;
1039
+ } else t30 = $[61];
1040
+ let t31;
1041
+ if ($[62] !== t28 || $[63] !== t29 || $[64] !== t30) {
1042
+ t31 = /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs("div", {
1043
+ className: "flex flex-col h-full",
1044
+ children: [
1045
+ t28,
1046
+ t29,
1047
+ t30
1048
+ ]
1049
+ }) });
1050
+ $[62] = t28;
1051
+ $[63] = t29;
1052
+ $[64] = t30;
1053
+ $[65] = t31;
1054
+ } else t31 = $[65];
1055
+ return t31;
1056
+ });
1057
+ DLQPanel.displayName = "DLQPanel";
1058
+ function _temp$5(state) {
1059
+ return state.selectedQueue;
1060
+ }
1061
+ function _temp2$5(e) {
1062
+ return e.stopPropagation();
1063
+ }
1064
+
1065
+ //#endregion
1066
+ //#region src/components/job-detail.tsx
1067
+ const JobDataTab = memo((t0) => {
1068
+ const $ = c(3);
1069
+ if ($[0] !== "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd") {
1070
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1071
+ $[0] = "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd";
1072
+ }
1073
+ const { data } = t0;
1074
+ const t1 = data;
1075
+ let t2;
1076
+ if ($[1] !== t1) {
1077
+ t2 = /* @__PURE__ */ jsx("div", {
1078
+ className: "bg-muted/30 p-4 rounded",
1079
+ children: /* @__PURE__ */ jsx(JsonView, {
1080
+ src: t1,
1081
+ theme: "atom",
1082
+ collapsed: 2
1083
+ })
1084
+ });
1085
+ $[1] = t1;
1086
+ $[2] = t2;
1087
+ } else t2 = $[2];
1088
+ return t2;
1089
+ });
1090
+ JobDataTab.displayName = "JobDataTab";
1091
+ const JobOptionsTab = memo((t0) => {
1092
+ const $ = c(3);
1093
+ if ($[0] !== "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd") {
1094
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1095
+ $[0] = "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd";
1096
+ }
1097
+ const { opts } = t0;
1098
+ let t1;
1099
+ if ($[1] !== opts) {
1100
+ t1 = /* @__PURE__ */ jsx("div", {
1101
+ className: "bg-muted/30 p-4 rounded",
1102
+ children: /* @__PURE__ */ jsx(JsonView, {
1103
+ src: opts,
1104
+ theme: "atom",
1105
+ collapsed: 2
1106
+ })
1107
+ });
1108
+ $[1] = opts;
1109
+ $[2] = t1;
1110
+ } else t1 = $[2];
1111
+ return t1;
1112
+ });
1113
+ JobOptionsTab.displayName = "JobOptionsTab";
1114
+ const JobResultTab = memo((t0) => {
1115
+ const $ = c(3);
1116
+ if ($[0] !== "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd") {
1117
+ for (let $i = 0; $i < 3; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1118
+ $[0] = "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd";
1119
+ }
1120
+ const { returnvalue } = t0;
1121
+ const t1 = returnvalue;
1122
+ let t2;
1123
+ if ($[1] !== t1) {
1124
+ t2 = /* @__PURE__ */ jsx("div", {
1125
+ className: "bg-muted/30 p-4 rounded",
1126
+ children: /* @__PURE__ */ jsx(JsonView, {
1127
+ src: t1,
1128
+ theme: "atom",
1129
+ collapsed: 2
1130
+ })
1131
+ });
1132
+ $[1] = t1;
1133
+ $[2] = t2;
1134
+ } else t2 = $[2];
1135
+ return t2;
1136
+ });
1137
+ JobResultTab.displayName = "JobResultTab";
1138
+ const JobErrorTab = memo((t0) => {
1139
+ const $ = c(9);
1140
+ if ($[0] !== "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd") {
1141
+ for (let $i = 0; $i < 9; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1142
+ $[0] = "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd";
1143
+ }
1144
+ const { failedReason, stacktrace } = t0;
1145
+ let t1;
1146
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
1147
+ t1 = /* @__PURE__ */ jsx("div", {
1148
+ className: "text-sm font-semibold text-destructive mb-1",
1149
+ children: "Error Message"
1150
+ });
1151
+ $[1] = t1;
1152
+ } else t1 = $[1];
1153
+ let t2;
1154
+ if ($[2] !== failedReason) {
1155
+ t2 = /* @__PURE__ */ jsxs("div", { children: [t1, /* @__PURE__ */ jsx("div", {
1156
+ className: "font-mono text-sm bg-destructive/10 p-3 rounded text-destructive",
1157
+ children: failedReason
1158
+ })] });
1159
+ $[2] = failedReason;
1160
+ $[3] = t2;
1161
+ } else t2 = $[3];
1162
+ let t3;
1163
+ if ($[4] !== stacktrace) {
1164
+ t3 = stacktrace && stacktrace.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
1165
+ className: "text-sm font-semibold text-muted-foreground mb-1",
1166
+ children: "Stack Trace"
1167
+ }), /* @__PURE__ */ jsx("pre", {
1168
+ className: "font-mono text-xs bg-muted p-3 rounded overflow-auto max-h-[300px]",
1169
+ children: stacktrace.join("\n")
1170
+ })] });
1171
+ $[4] = stacktrace;
1172
+ $[5] = t3;
1173
+ } else t3 = $[5];
1174
+ let t4;
1175
+ if ($[6] !== t2 || $[7] !== t3) {
1176
+ t4 = /* @__PURE__ */ jsxs("div", {
1177
+ className: "space-y-4",
1178
+ children: [t2, t3]
1179
+ });
1180
+ $[6] = t2;
1181
+ $[7] = t3;
1182
+ $[8] = t4;
1183
+ } else t4 = $[8];
1184
+ return t4;
1185
+ });
1186
+ JobErrorTab.displayName = "JobErrorTab";
1187
+ const JobDetail = memo(() => {
1188
+ const $ = c(92);
1189
+ if ($[0] !== "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd") {
1190
+ for (let $i = 0; $i < 92; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1191
+ $[0] = "3b06a00e91af27c8dc4dbe23232bee1ad67432d0e4c5ed3ab9b136e6d2a7a3cd";
1192
+ }
1193
+ const selectedJob = useBullMQStore(_temp$4);
1194
+ const selectedQueue = useBullMQStore(_temp2$4);
1195
+ const jobDetailOpen = useBullMQStore(_temp3$3);
1196
+ const setJobDetailOpen = useBullMQStore(_temp4$2);
1197
+ const setSelectedJob = useBullMQStore(_temp5$2);
1198
+ const retryJobMutation = useRetryJob();
1199
+ const removeJobMutation = useRemoveJob();
1200
+ const promoteJobMutation = usePromoteJob();
1201
+ let t0;
1202
+ if ($[1] !== setJobDetailOpen || $[2] !== setSelectedJob) {
1203
+ t0 = () => {
1204
+ setJobDetailOpen(false);
1205
+ setSelectedJob(null);
1206
+ };
1207
+ $[1] = setJobDetailOpen;
1208
+ $[2] = setSelectedJob;
1209
+ $[3] = t0;
1210
+ } else t0 = $[3];
1211
+ const handleClose = t0;
1212
+ let t1;
1213
+ if ($[4] !== handleClose || $[5] !== retryJobMutation || $[6] !== selectedJob || $[7] !== selectedQueue) {
1214
+ t1 = () => {
1215
+ if (!selectedQueue || !selectedJob) return;
1216
+ retryJobMutation.mutate({
1217
+ queueName: selectedQueue.name,
1218
+ jobId: selectedJob.id
1219
+ });
1220
+ handleClose();
1221
+ };
1222
+ $[4] = handleClose;
1223
+ $[5] = retryJobMutation;
1224
+ $[6] = selectedJob;
1225
+ $[7] = selectedQueue;
1226
+ $[8] = t1;
1227
+ } else t1 = $[8];
1228
+ const handleRetry = t1;
1229
+ let t2;
1230
+ if ($[9] !== handleClose || $[10] !== removeJobMutation || $[11] !== selectedJob || $[12] !== selectedQueue) {
1231
+ t2 = () => {
1232
+ if (!selectedQueue || !selectedJob) return;
1233
+ removeJobMutation.mutate({
1234
+ queueName: selectedQueue.name,
1235
+ jobId: selectedJob.id
1236
+ });
1237
+ handleClose();
1238
+ };
1239
+ $[9] = handleClose;
1240
+ $[10] = removeJobMutation;
1241
+ $[11] = selectedJob;
1242
+ $[12] = selectedQueue;
1243
+ $[13] = t2;
1244
+ } else t2 = $[13];
1245
+ const handleRemove = t2;
1246
+ let t3;
1247
+ if ($[14] !== handleClose || $[15] !== promoteJobMutation || $[16] !== selectedJob || $[17] !== selectedQueue) {
1248
+ t3 = () => {
1249
+ if (!selectedQueue || !selectedJob) return;
1250
+ promoteJobMutation.mutate({
1251
+ queueName: selectedQueue.name,
1252
+ jobId: selectedJob.id
1253
+ });
1254
+ handleClose();
1255
+ };
1256
+ $[14] = handleClose;
1257
+ $[15] = promoteJobMutation;
1258
+ $[16] = selectedJob;
1259
+ $[17] = selectedQueue;
1260
+ $[18] = t3;
1261
+ } else t3 = $[18];
1262
+ const handlePromote = t3;
1263
+ if (!jobDetailOpen || !selectedJob || !selectedQueue) return null;
1264
+ const hasError = !!selectedJob.failedReason;
1265
+ const isDelayed = selectedJob.delay && selectedJob.delay > 0;
1266
+ const hasReturnValue = selectedJob.returnvalue !== void 0 && selectedJob.returnvalue !== null;
1267
+ let t4;
1268
+ if ($[19] !== selectedJob.data) {
1269
+ t4 = {
1270
+ label: "Data",
1271
+ content: /* @__PURE__ */ jsx(JobDataTab, { data: selectedJob.data })
1272
+ };
1273
+ $[19] = selectedJob.data;
1274
+ $[20] = t4;
1275
+ } else t4 = $[20];
1276
+ let t5;
1277
+ if ($[21] !== selectedJob.opts) {
1278
+ t5 = {
1279
+ label: "Options",
1280
+ content: /* @__PURE__ */ jsx(JobOptionsTab, { opts: selectedJob.opts })
1281
+ };
1282
+ $[21] = selectedJob.opts;
1283
+ $[22] = t5;
1284
+ } else t5 = $[22];
1285
+ let t6;
1286
+ if ($[23] !== hasReturnValue || $[24] !== selectedJob.returnvalue) {
1287
+ t6 = hasReturnValue ? [{
1288
+ label: "Result",
1289
+ content: /* @__PURE__ */ jsx(JobResultTab, { returnvalue: selectedJob.returnvalue })
1290
+ }] : [];
1291
+ $[23] = hasReturnValue;
1292
+ $[24] = selectedJob.returnvalue;
1293
+ $[25] = t6;
1294
+ } else t6 = $[25];
1295
+ let t7;
1296
+ if ($[26] !== hasError || $[27] !== selectedJob.failedReason || $[28] !== selectedJob.stacktrace) {
1297
+ t7 = hasError ? [{
1298
+ label: "Error",
1299
+ content: /* @__PURE__ */ jsx(JobErrorTab, {
1300
+ failedReason: selectedJob.failedReason,
1301
+ stacktrace: selectedJob.stacktrace
1302
+ })
1303
+ }] : [];
1304
+ $[26] = hasError;
1305
+ $[27] = selectedJob.failedReason;
1306
+ $[28] = selectedJob.stacktrace;
1307
+ $[29] = t7;
1308
+ } else t7 = $[29];
1309
+ let t8;
1310
+ if ($[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7) {
1311
+ t8 = [
1312
+ t4,
1313
+ t5,
1314
+ ...t6,
1315
+ ...t7
1316
+ ];
1317
+ $[30] = t4;
1318
+ $[31] = t5;
1319
+ $[32] = t6;
1320
+ $[33] = t7;
1321
+ $[34] = t8;
1322
+ } else t8 = $[34];
1323
+ const tabs = t8;
1324
+ let t9;
1325
+ if ($[35] !== hasError || $[36] !== isDelayed || $[37] !== selectedJob.finishedOn || $[38] !== selectedJob.processedOn) {
1326
+ t9 = hasError ? /* @__PURE__ */ jsx("span", {
1327
+ className: "text-destructive",
1328
+ children: "Failed"
1329
+ }) : selectedJob.finishedOn ? /* @__PURE__ */ jsx("span", {
1330
+ className: "text-green-500",
1331
+ children: "Completed"
1332
+ }) : selectedJob.processedOn ? /* @__PURE__ */ jsx("span", {
1333
+ className: "text-yellow-500",
1334
+ children: "Processing"
1335
+ }) : isDelayed ? /* @__PURE__ */ jsx("span", {
1336
+ className: "text-purple-500",
1337
+ children: "Delayed"
1338
+ }) : /* @__PURE__ */ jsx("span", {
1339
+ className: "text-blue-500",
1340
+ children: "Waiting"
1341
+ });
1342
+ $[35] = hasError;
1343
+ $[36] = isDelayed;
1344
+ $[37] = selectedJob.finishedOn;
1345
+ $[38] = selectedJob.processedOn;
1346
+ $[39] = t9;
1347
+ } else t9 = $[39];
1348
+ const statusElement = t9;
1349
+ const t10 = selectedJob.name;
1350
+ let t11;
1351
+ if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
1352
+ t11 = /* @__PURE__ */ jsx(X, {});
1353
+ $[40] = t11;
1354
+ } else t11 = $[40];
1355
+ let t12;
1356
+ if ($[41] !== handleClose) {
1357
+ t12 = [{
1358
+ icon: t11,
1359
+ onClick: handleClose,
1360
+ label: "Close"
1361
+ }];
1362
+ $[41] = handleClose;
1363
+ $[42] = t12;
1364
+ } else t12 = $[42];
1365
+ let t13;
1366
+ if ($[43] !== handleRetry || $[44] !== hasError) {
1367
+ t13 = hasError && /* @__PURE__ */ jsxs(Button, {
1368
+ variant: "outline",
1369
+ size: "sm",
1370
+ onClick: handleRetry,
1371
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: "mr-2 h-4 w-4" }), "Retry"]
1372
+ });
1373
+ $[43] = handleRetry;
1374
+ $[44] = hasError;
1375
+ $[45] = t13;
1376
+ } else t13 = $[45];
1377
+ let t14;
1378
+ if ($[46] !== handlePromote || $[47] !== isDelayed) {
1379
+ t14 = isDelayed && /* @__PURE__ */ jsxs(Button, {
1380
+ variant: "outline",
1381
+ size: "sm",
1382
+ onClick: handlePromote,
1383
+ children: [/* @__PURE__ */ jsx(ArrowUpRight, { className: "mr-2 h-4 w-4" }), "Promote"]
1384
+ });
1385
+ $[46] = handlePromote;
1386
+ $[47] = isDelayed;
1387
+ $[48] = t14;
1388
+ } else t14 = $[48];
1389
+ let t15;
1390
+ if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
1391
+ t15 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
1392
+ $[49] = t15;
1393
+ } else t15 = $[49];
1394
+ let t16;
1395
+ if ($[50] !== handleRemove) {
1396
+ t16 = /* @__PURE__ */ jsxs(Button, {
1397
+ variant: "outline",
1398
+ size: "sm",
1399
+ onClick: handleRemove,
1400
+ className: "text-destructive",
1401
+ children: [t15, "Remove"]
1402
+ });
1403
+ $[50] = handleRemove;
1404
+ $[51] = t16;
1405
+ } else t16 = $[51];
1406
+ let t17;
1407
+ if ($[52] !== t13 || $[53] !== t14 || $[54] !== t16) {
1408
+ t17 = /* @__PURE__ */ jsxs("div", {
1409
+ className: "flex gap-2",
1410
+ children: [
1411
+ t13,
1412
+ t14,
1413
+ t16
1414
+ ]
1415
+ });
1416
+ $[52] = t13;
1417
+ $[53] = t14;
1418
+ $[54] = t16;
1419
+ $[55] = t17;
1420
+ } else t17 = $[55];
1421
+ let t18;
1422
+ if ($[56] === Symbol.for("react.memo_cache_sentinel")) {
1423
+ t18 = /* @__PURE__ */ jsx("span", {
1424
+ className: "text-muted-foreground",
1425
+ children: "Job ID"
1426
+ });
1427
+ $[56] = t18;
1428
+ } else t18 = $[56];
1429
+ let t19;
1430
+ if ($[57] !== selectedJob.id) {
1431
+ t19 = /* @__PURE__ */ jsxs("div", { children: [t18, /* @__PURE__ */ jsx("div", {
1432
+ className: "font-mono text-xs",
1433
+ children: selectedJob.id
1434
+ })] });
1435
+ $[57] = selectedJob.id;
1436
+ $[58] = t19;
1437
+ } else t19 = $[58];
1438
+ let t20;
1439
+ if ($[59] === Symbol.for("react.memo_cache_sentinel")) {
1440
+ t20 = /* @__PURE__ */ jsx("span", {
1441
+ className: "text-muted-foreground",
1442
+ children: "Status"
1443
+ });
1444
+ $[59] = t20;
1445
+ } else t20 = $[59];
1446
+ let t21;
1447
+ if ($[60] !== statusElement) {
1448
+ t21 = /* @__PURE__ */ jsxs("div", { children: [t20, /* @__PURE__ */ jsx("div", {
1449
+ className: "font-semibold",
1450
+ children: statusElement
1451
+ })] });
1452
+ $[60] = statusElement;
1453
+ $[61] = t21;
1454
+ } else t21 = $[61];
1455
+ let t22;
1456
+ if ($[62] === Symbol.for("react.memo_cache_sentinel")) {
1457
+ t22 = /* @__PURE__ */ jsx("span", {
1458
+ className: "text-muted-foreground",
1459
+ children: "Created"
1460
+ });
1461
+ $[62] = t22;
1462
+ } else t22 = $[62];
1463
+ let t23;
1464
+ if ($[63] !== selectedJob.timestamp) {
1465
+ t23 = formatDistanceToNow(selectedJob.timestamp, { addSuffix: true });
1466
+ $[63] = selectedJob.timestamp;
1467
+ $[64] = t23;
1468
+ } else t23 = $[64];
1469
+ let t24;
1470
+ if ($[65] !== t23) {
1471
+ t24 = /* @__PURE__ */ jsxs("div", { children: [t22, /* @__PURE__ */ jsx("div", { children: t23 })] });
1472
+ $[65] = t23;
1473
+ $[66] = t24;
1474
+ } else t24 = $[66];
1475
+ let t25;
1476
+ if ($[67] === Symbol.for("react.memo_cache_sentinel")) {
1477
+ t25 = /* @__PURE__ */ jsx("span", {
1478
+ className: "text-muted-foreground",
1479
+ children: "Attempts"
1480
+ });
1481
+ $[67] = t25;
1482
+ } else t25 = $[67];
1483
+ let t26;
1484
+ if ($[68] !== selectedJob.attemptsMade) {
1485
+ t26 = /* @__PURE__ */ jsxs("div", { children: [t25, /* @__PURE__ */ jsx("div", {
1486
+ className: "font-semibold",
1487
+ children: selectedJob.attemptsMade
1488
+ })] });
1489
+ $[68] = selectedJob.attemptsMade;
1490
+ $[69] = t26;
1491
+ } else t26 = $[69];
1492
+ let t27;
1493
+ if ($[70] === Symbol.for("react.memo_cache_sentinel")) {
1494
+ t27 = /* @__PURE__ */ jsx("span", {
1495
+ className: "text-muted-foreground",
1496
+ children: "Progress"
1497
+ });
1498
+ $[70] = t27;
1499
+ } else t27 = $[70];
1500
+ const t28 = typeof selectedJob.progress === "number" ? `${selectedJob.progress}%` : "-";
1501
+ let t29;
1502
+ if ($[71] !== t28) {
1503
+ t29 = /* @__PURE__ */ jsxs("div", { children: [t27, /* @__PURE__ */ jsx("div", {
1504
+ className: "font-semibold",
1505
+ children: t28
1506
+ })] });
1507
+ $[71] = t28;
1508
+ $[72] = t29;
1509
+ } else t29 = $[72];
1510
+ let t30;
1511
+ if ($[73] === Symbol.for("react.memo_cache_sentinel")) {
1512
+ t30 = /* @__PURE__ */ jsx("span", {
1513
+ className: "text-muted-foreground",
1514
+ children: "Delay"
1515
+ });
1516
+ $[73] = t30;
1517
+ } else t30 = $[73];
1518
+ const t31 = selectedJob.delay ? `${selectedJob.delay}ms` : "-";
1519
+ let t32;
1520
+ if ($[74] !== t31) {
1521
+ t32 = /* @__PURE__ */ jsxs("div", { children: [t30, /* @__PURE__ */ jsx("div", {
1522
+ className: "font-semibold",
1523
+ children: t31
1524
+ })] });
1525
+ $[74] = t31;
1526
+ $[75] = t32;
1527
+ } else t32 = $[75];
1528
+ let t33;
1529
+ if ($[76] !== t19 || $[77] !== t21 || $[78] !== t24 || $[79] !== t26 || $[80] !== t29 || $[81] !== t32) {
1530
+ t33 = /* @__PURE__ */ jsxs("div", {
1531
+ className: "grid grid-cols-2 gap-4 text-sm",
1532
+ children: [
1533
+ t19,
1534
+ t21,
1535
+ t24,
1536
+ t26,
1537
+ t29,
1538
+ t32
1539
+ ]
1540
+ });
1541
+ $[76] = t19;
1542
+ $[77] = t21;
1543
+ $[78] = t24;
1544
+ $[79] = t26;
1545
+ $[80] = t29;
1546
+ $[81] = t32;
1547
+ $[82] = t33;
1548
+ } else t33 = $[82];
1549
+ let t34;
1550
+ if ($[83] !== t17 || $[84] !== t33) {
1551
+ t34 = /* @__PURE__ */ jsxs("div", {
1552
+ className: "space-y-4",
1553
+ children: [t17, t33]
1554
+ });
1555
+ $[83] = t17;
1556
+ $[84] = t33;
1557
+ $[85] = t34;
1558
+ } else t34 = $[85];
1559
+ let t35;
1560
+ if ($[86] !== handleClose || $[87] !== selectedJob.name || $[88] !== t12 || $[89] !== t34 || $[90] !== tabs) {
1561
+ t35 = /* @__PURE__ */ jsx(Sidebar, {
1562
+ onClose: handleClose,
1563
+ title: t10,
1564
+ initialWidth: 600,
1565
+ tabs,
1566
+ actions: t12,
1567
+ children: t34
1568
+ });
1569
+ $[86] = handleClose;
1570
+ $[87] = selectedJob.name;
1571
+ $[88] = t12;
1572
+ $[89] = t34;
1573
+ $[90] = tabs;
1574
+ $[91] = t35;
1575
+ } else t35 = $[91];
1576
+ return t35;
1577
+ });
1578
+ JobDetail.displayName = "JobDetail";
1579
+ function _temp$4(state) {
1580
+ return state.selectedJob;
1581
+ }
1582
+ function _temp2$4(state_0) {
1583
+ return state_0.selectedQueue;
1584
+ }
1585
+ function _temp3$3(state_1) {
1586
+ return state_1.jobDetailOpen;
1587
+ }
1588
+ function _temp4$2(state_2) {
1589
+ return state_2.setJobDetailOpen;
1590
+ }
1591
+ function _temp5$2(state_3) {
1592
+ return state_3.setSelectedJob;
1593
+ }
1594
+
1595
+ //#endregion
1596
+ //#region src/components/jobs-table.tsx
1597
+ const JobRow = memo((t0) => {
1598
+ const $ = c(50);
1599
+ if ($[0] !== "35e57f18a759ee630724f8001ffcc43b791357fe1eb5c9a6692b76ef0e6628e1") {
1600
+ for (let $i = 0; $i < 50; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1601
+ $[0] = "35e57f18a759ee630724f8001ffcc43b791357fe1eb5c9a6692b76ef0e6628e1";
1602
+ }
1603
+ const { job, queueName, onSelect, isSelected } = t0;
1604
+ const retryJobMutation = useRetryJob();
1605
+ const removeJobMutation = useRemoveJob();
1606
+ const promoteJobMutation = usePromoteJob();
1607
+ let t1;
1608
+ if ($[1] !== job.id || $[2] !== queueName || $[3] !== retryJobMutation) {
1609
+ t1 = (e) => {
1610
+ e.stopPropagation();
1611
+ retryJobMutation.mutate({
1612
+ queueName,
1613
+ jobId: job.id
1614
+ });
1615
+ };
1616
+ $[1] = job.id;
1617
+ $[2] = queueName;
1618
+ $[3] = retryJobMutation;
1619
+ $[4] = t1;
1620
+ } else t1 = $[4];
1621
+ const handleRetry = t1;
1622
+ let t2;
1623
+ if ($[5] !== job.id || $[6] !== queueName || $[7] !== removeJobMutation) {
1624
+ t2 = (e_0) => {
1625
+ e_0.stopPropagation();
1626
+ removeJobMutation.mutate({
1627
+ queueName,
1628
+ jobId: job.id
1629
+ });
1630
+ };
1631
+ $[5] = job.id;
1632
+ $[6] = queueName;
1633
+ $[7] = removeJobMutation;
1634
+ $[8] = t2;
1635
+ } else t2 = $[8];
1636
+ const handleRemove = t2;
1637
+ let t3;
1638
+ if ($[9] !== job.id || $[10] !== promoteJobMutation || $[11] !== queueName) {
1639
+ t3 = (e_1) => {
1640
+ e_1.stopPropagation();
1641
+ promoteJobMutation.mutate({
1642
+ queueName,
1643
+ jobId: job.id
1644
+ });
1645
+ };
1646
+ $[9] = job.id;
1647
+ $[10] = promoteJobMutation;
1648
+ $[11] = queueName;
1649
+ $[12] = t3;
1650
+ } else t3 = $[12];
1651
+ const handlePromote = t3;
1652
+ const t4 = isSelected ? "bg-muted-foreground/10 hover:bg-muted-foreground/20" : "hover:bg-muted-foreground/10";
1653
+ let t5;
1654
+ if ($[13] !== t4) {
1655
+ t5 = cn("cursor-pointer border-0", t4);
1656
+ $[13] = t4;
1657
+ $[14] = t5;
1658
+ } else t5 = $[14];
1659
+ let t6;
1660
+ if ($[15] !== job.id) {
1661
+ t6 = /* @__PURE__ */ jsx(TableCell, {
1662
+ className: "font-mono text-xs",
1663
+ children: job.id
1664
+ });
1665
+ $[15] = job.id;
1666
+ $[16] = t6;
1667
+ } else t6 = $[16];
1668
+ let t7;
1669
+ if ($[17] !== job.name) {
1670
+ t7 = /* @__PURE__ */ jsx(TableCell, {
1671
+ className: "font-medium",
1672
+ children: job.name
1673
+ });
1674
+ $[17] = job.name;
1675
+ $[18] = t7;
1676
+ } else t7 = $[18];
1677
+ let t8;
1678
+ if ($[19] !== job.timestamp) {
1679
+ t8 = formatDistanceToNow(job.timestamp, { addSuffix: true });
1680
+ $[19] = job.timestamp;
1681
+ $[20] = t8;
1682
+ } else t8 = $[20];
1683
+ let t9;
1684
+ if ($[21] !== t8) {
1685
+ t9 = /* @__PURE__ */ jsx(TableCell, {
1686
+ className: "text-xs text-muted-foreground",
1687
+ children: t8
1688
+ });
1689
+ $[21] = t8;
1690
+ $[22] = t9;
1691
+ } else t9 = $[22];
1692
+ let t10;
1693
+ if ($[23] !== job.attemptsMade) {
1694
+ t10 = /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("span", {
1695
+ className: "text-xs",
1696
+ children: job.attemptsMade
1697
+ }) });
1698
+ $[23] = job.attemptsMade;
1699
+ $[24] = t10;
1700
+ } else t10 = $[24];
1701
+ let t11;
1702
+ if ($[25] !== job.progress) {
1703
+ t11 = /* @__PURE__ */ jsx(TableCell, { children: typeof job.progress === "number" ? /* @__PURE__ */ jsxs("div", {
1704
+ className: "flex items-center gap-2",
1705
+ children: [/* @__PURE__ */ jsx("div", {
1706
+ className: "w-16 h-1.5 bg-muted rounded-full overflow-hidden",
1707
+ children: /* @__PURE__ */ jsx("div", {
1708
+ className: "h-full bg-primary transition-all",
1709
+ style: { width: `${Math.min(100, job.progress)}%` }
1710
+ })
1711
+ }), /* @__PURE__ */ jsxs("span", {
1712
+ className: "text-xs text-muted-foreground",
1713
+ children: [job.progress, "%"]
1714
+ })]
1715
+ }) : /* @__PURE__ */ jsx("span", {
1716
+ className: "text-xs text-muted-foreground",
1717
+ children: "-"
1718
+ }) });
1719
+ $[25] = job.progress;
1720
+ $[26] = t11;
1721
+ } else t11 = $[26];
1722
+ let t12;
1723
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
1724
+ t12 = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
1725
+ asChild: true,
1726
+ children: /* @__PURE__ */ jsx(Button, {
1727
+ variant: "ghost",
1728
+ size: "icon",
1729
+ className: "h-8 w-8",
1730
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-4 w-4" })
1731
+ })
1732
+ });
1733
+ $[27] = t12;
1734
+ } else t12 = $[27];
1735
+ let t13;
1736
+ if ($[28] !== handleRetry || $[29] !== job.failedReason) {
1737
+ t13 = job.failedReason && /* @__PURE__ */ jsxs(DropdownMenuItem, {
1738
+ onClick: handleRetry,
1739
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: "mr-2 h-4 w-4" }), "Retry"]
1740
+ });
1741
+ $[28] = handleRetry;
1742
+ $[29] = job.failedReason;
1743
+ $[30] = t13;
1744
+ } else t13 = $[30];
1745
+ let t14;
1746
+ if ($[31] !== handlePromote || $[32] !== job.delay) {
1747
+ t14 = job.delay && job.delay > 0 && /* @__PURE__ */ jsxs(DropdownMenuItem, {
1748
+ onClick: handlePromote,
1749
+ children: [/* @__PURE__ */ jsx(ArrowUpRight, { className: "mr-2 h-4 w-4" }), "Promote"]
1750
+ });
1751
+ $[31] = handlePromote;
1752
+ $[32] = job.delay;
1753
+ $[33] = t14;
1754
+ } else t14 = $[33];
1755
+ let t15;
1756
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
1757
+ t15 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
1758
+ $[34] = t15;
1759
+ } else t15 = $[34];
1760
+ let t16;
1761
+ if ($[35] !== handleRemove) {
1762
+ t16 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
1763
+ onClick: handleRemove,
1764
+ className: "text-destructive",
1765
+ children: [t15, "Remove"]
1766
+ });
1767
+ $[35] = handleRemove;
1768
+ $[36] = t16;
1769
+ } else t16 = $[36];
1770
+ let t17;
1771
+ if ($[37] !== t13 || $[38] !== t14 || $[39] !== t16) {
1772
+ t17 = /* @__PURE__ */ jsx(TableCell, {
1773
+ onClick: _temp$3,
1774
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [t12, /* @__PURE__ */ jsxs(DropdownMenuContent, {
1775
+ align: "end",
1776
+ className: "bg-background text-foreground",
1777
+ children: [
1778
+ t13,
1779
+ t14,
1780
+ t16
1781
+ ]
1782
+ })] })
1783
+ });
1784
+ $[37] = t13;
1785
+ $[38] = t14;
1786
+ $[39] = t16;
1787
+ $[40] = t17;
1788
+ } else t17 = $[40];
1789
+ let t18;
1790
+ if ($[41] !== onSelect || $[42] !== t10 || $[43] !== t11 || $[44] !== t17 || $[45] !== t5 || $[46] !== t6 || $[47] !== t7 || $[48] !== t9) {
1791
+ t18 = /* @__PURE__ */ jsxs(TableRow, {
1792
+ onClick: onSelect,
1793
+ className: t5,
1794
+ children: [
1795
+ t6,
1796
+ t7,
1797
+ t9,
1798
+ t10,
1799
+ t11,
1800
+ t17
1801
+ ]
1802
+ });
1803
+ $[41] = onSelect;
1804
+ $[42] = t10;
1805
+ $[43] = t11;
1806
+ $[44] = t17;
1807
+ $[45] = t5;
1808
+ $[46] = t6;
1809
+ $[47] = t7;
1810
+ $[48] = t9;
1811
+ $[49] = t18;
1812
+ } else t18 = $[49];
1813
+ return t18;
1814
+ });
1815
+ JobRow.displayName = "JobRow";
1816
+ const JobsTable = memo(() => {
1817
+ const $ = c(21);
1818
+ if ($[0] !== "35e57f18a759ee630724f8001ffcc43b791357fe1eb5c9a6692b76ef0e6628e1") {
1819
+ for (let $i = 0; $i < 21; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1820
+ $[0] = "35e57f18a759ee630724f8001ffcc43b791357fe1eb5c9a6692b76ef0e6628e1";
1821
+ }
1822
+ const { data: t0, isLoading } = useJobsQuery();
1823
+ let t1;
1824
+ if ($[1] !== t0) {
1825
+ t1 = t0 === void 0 ? [] : t0;
1826
+ $[1] = t0;
1827
+ $[2] = t1;
1828
+ } else t1 = $[2];
1829
+ const jobs = t1;
1830
+ const selectedQueue = useBullMQStore(_temp2$3);
1831
+ const selectedJob = useBullMQStore(_temp3$2);
1832
+ const setSelectedJob = useBullMQStore(_temp4$1);
1833
+ const setJobDetailOpen = useBullMQStore(_temp5$1);
1834
+ let t2;
1835
+ if ($[3] !== setJobDetailOpen || $[4] !== setSelectedJob) {
1836
+ t2 = (job) => {
1837
+ setSelectedJob(job);
1838
+ setJobDetailOpen(true);
1839
+ };
1840
+ $[3] = setJobDetailOpen;
1841
+ $[4] = setSelectedJob;
1842
+ $[5] = t2;
1843
+ } else t2 = $[5];
1844
+ const handleSelectJob = t2;
1845
+ if (!selectedQueue) {
1846
+ let t3$1;
1847
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
1848
+ t3$1 = /* @__PURE__ */ jsx("div", {
1849
+ className: "flex items-center justify-center h-full text-muted-foreground",
1850
+ children: "Select a queue to view jobs"
1851
+ });
1852
+ $[6] = t3$1;
1853
+ } else t3$1 = $[6];
1854
+ return t3$1;
1855
+ }
1856
+ if (isLoading) {
1857
+ let t3$1;
1858
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
1859
+ t3$1 = /* @__PURE__ */ jsx("div", {
1860
+ className: "flex items-center justify-center h-full text-muted-foreground",
1861
+ children: "Loading jobs..."
1862
+ });
1863
+ $[7] = t3$1;
1864
+ } else t3$1 = $[7];
1865
+ return t3$1;
1866
+ }
1867
+ if (jobs.length === 0) {
1868
+ let t3$1;
1869
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
1870
+ t3$1 = /* @__PURE__ */ jsx("div", {
1871
+ className: "flex items-center justify-center h-full text-muted-foreground",
1872
+ children: "No jobs in this status"
1873
+ });
1874
+ $[8] = t3$1;
1875
+ } else t3$1 = $[8];
1876
+ return t3$1;
1877
+ }
1878
+ let t3;
1879
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
1880
+ t3 = /* @__PURE__ */ jsx(TableHeader, {
1881
+ className: "sticky top-0 bg-background/95 backdrop-blur-sm",
1882
+ children: /* @__PURE__ */ jsxs(TableRow, { children: [
1883
+ /* @__PURE__ */ jsx(TableHead, {
1884
+ className: "w-[200px]",
1885
+ children: "Job ID"
1886
+ }),
1887
+ /* @__PURE__ */ jsx(TableHead, { children: "Name" }),
1888
+ /* @__PURE__ */ jsx(TableHead, {
1889
+ className: "w-[150px]",
1890
+ children: "Created"
1891
+ }),
1892
+ /* @__PURE__ */ jsx(TableHead, {
1893
+ className: "w-[80px]",
1894
+ children: "Attempts"
1895
+ }),
1896
+ /* @__PURE__ */ jsx(TableHead, {
1897
+ className: "w-[140px]",
1898
+ children: "Progress"
1899
+ }),
1900
+ /* @__PURE__ */ jsx(TableHead, {
1901
+ className: "w-[60px]",
1902
+ children: "Actions"
1903
+ })
1904
+ ] })
1905
+ });
1906
+ $[9] = t3;
1907
+ } else t3 = $[9];
1908
+ let t4;
1909
+ if ($[10] !== handleSelectJob || $[11] !== jobs || $[12] !== selectedJob?.id || $[13] !== selectedQueue) {
1910
+ let t5$1;
1911
+ if ($[15] !== handleSelectJob || $[16] !== selectedJob?.id || $[17] !== selectedQueue) {
1912
+ t5$1 = (job_0) => /* @__PURE__ */ jsx(JobRow, {
1913
+ job: job_0,
1914
+ queueName: selectedQueue.name,
1915
+ onSelect: () => handleSelectJob(job_0),
1916
+ isSelected: selectedJob?.id === job_0.id
1917
+ }, job_0.id);
1918
+ $[15] = handleSelectJob;
1919
+ $[16] = selectedJob?.id;
1920
+ $[17] = selectedQueue;
1921
+ $[18] = t5$1;
1922
+ } else t5$1 = $[18];
1923
+ t4 = jobs.map(t5$1);
1924
+ $[10] = handleSelectJob;
1925
+ $[11] = jobs;
1926
+ $[12] = selectedJob?.id;
1927
+ $[13] = selectedQueue;
1928
+ $[14] = t4;
1929
+ } else t4 = $[14];
1930
+ let t5;
1931
+ if ($[19] !== t4) {
1932
+ t5 = /* @__PURE__ */ jsxs(Table, { children: [t3, /* @__PURE__ */ jsx(TableBody, { children: t4 })] });
1933
+ $[19] = t4;
1934
+ $[20] = t5;
1935
+ } else t5 = $[20];
1936
+ return t5;
1937
+ });
1938
+ JobsTable.displayName = "JobsTable";
1939
+ function _temp$3(e_2) {
1940
+ return e_2.stopPropagation();
1941
+ }
1942
+ function _temp2$3(state) {
1943
+ return state.selectedQueue;
1944
+ }
1945
+ function _temp3$2(state_0) {
1946
+ return state_0.selectedJob;
1947
+ }
1948
+ function _temp4$1(state_1) {
1949
+ return state_1.setSelectedJob;
1950
+ }
1951
+ function _temp5$1(state_2) {
1952
+ return state_2.setJobDetailOpen;
1953
+ }
1954
+
1955
+ //#endregion
1956
+ //#region src/components/queue-detail.tsx
1957
+ const STATUS_TABS = [
1958
+ {
1959
+ value: "waiting",
1960
+ label: "Waiting"
1961
+ },
1962
+ {
1963
+ value: "active",
1964
+ label: "Active"
1965
+ },
1966
+ {
1967
+ value: "completed",
1968
+ label: "Completed"
1969
+ },
1970
+ {
1971
+ value: "failed",
1972
+ label: "Failed"
1973
+ },
1974
+ {
1975
+ value: "delayed",
1976
+ label: "Delayed"
1977
+ }
1978
+ ];
1979
+ const QueueDetail = memo(() => {
1980
+ const $ = c(115);
1981
+ if ($[0] !== "ec763ba5d94c93fbec6c5d401f02a104160374351538eec66a12a09486a09276") {
1982
+ for (let $i = 0; $i < 115; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
1983
+ $[0] = "ec763ba5d94c93fbec6c5d401f02a104160374351538eec66a12a09486a09276";
1984
+ }
1985
+ const queryClient$1 = useQueryClient();
1986
+ const selectedQueue = useBullMQStore(_temp$2);
1987
+ const selectedStatus = useBullMQStore(_temp2$2);
1988
+ const setSelectedStatus = useBullMQStore(_temp3$1);
1989
+ const { pauseQueue, resumeQueue, cleanQueue, drainQueue } = useQueues();
1990
+ let t0;
1991
+ if ($[1] !== pauseQueue || $[2] !== selectedQueue) {
1992
+ t0 = async () => {
1993
+ if (!selectedQueue) return;
1994
+ await pauseQueue(selectedQueue.name);
1995
+ };
1996
+ $[1] = pauseQueue;
1997
+ $[2] = selectedQueue;
1998
+ $[3] = t0;
1999
+ } else t0 = $[3];
2000
+ const handlePause = t0;
2001
+ let t1;
2002
+ if ($[4] !== resumeQueue || $[5] !== selectedQueue) {
2003
+ t1 = async () => {
2004
+ if (!selectedQueue) return;
2005
+ await resumeQueue(selectedQueue.name);
2006
+ };
2007
+ $[4] = resumeQueue;
2008
+ $[5] = selectedQueue;
2009
+ $[6] = t1;
2010
+ } else t1 = $[6];
2011
+ const handleResume = t1;
2012
+ let t2;
2013
+ if ($[7] !== cleanQueue || $[8] !== selectedQueue) {
2014
+ t2 = async () => {
2015
+ if (!selectedQueue) return;
2016
+ await cleanQueue(selectedQueue.name, "completed", 0, 1e3);
2017
+ };
2018
+ $[7] = cleanQueue;
2019
+ $[8] = selectedQueue;
2020
+ $[9] = t2;
2021
+ } else t2 = $[9];
2022
+ const handleCleanCompleted = t2;
2023
+ let t3;
2024
+ if ($[10] !== cleanQueue || $[11] !== selectedQueue) {
2025
+ t3 = async () => {
2026
+ if (!selectedQueue) return;
2027
+ await cleanQueue(selectedQueue.name, "failed", 0, 1e3);
2028
+ };
2029
+ $[10] = cleanQueue;
2030
+ $[11] = selectedQueue;
2031
+ $[12] = t3;
2032
+ } else t3 = $[12];
2033
+ const handleCleanFailed = t3;
2034
+ let t4;
2035
+ if ($[13] !== drainQueue || $[14] !== selectedQueue) {
2036
+ t4 = async () => {
2037
+ if (!selectedQueue) return;
2038
+ await drainQueue(selectedQueue.name);
2039
+ };
2040
+ $[13] = drainQueue;
2041
+ $[14] = selectedQueue;
2042
+ $[15] = t4;
2043
+ } else t4 = $[15];
2044
+ const handleDrain = t4;
2045
+ let t5;
2046
+ if ($[16] !== queryClient$1 || $[17] !== selectedQueue) {
2047
+ t5 = () => {
2048
+ if (!selectedQueue) return;
2049
+ queryClient$1.invalidateQueries({ queryKey: ["jobs", selectedQueue.name] });
2050
+ };
2051
+ $[16] = queryClient$1;
2052
+ $[17] = selectedQueue;
2053
+ $[18] = t5;
2054
+ } else t5 = $[18];
2055
+ const handleRefresh = t5;
2056
+ if (!selectedQueue) {
2057
+ let t6$1;
2058
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
2059
+ t6$1 = /* @__PURE__ */ jsx("div", {
2060
+ className: "flex items-center justify-center h-full text-muted-foreground",
2061
+ children: "Select a queue from the list to view details"
2062
+ });
2063
+ $[19] = t6$1;
2064
+ } else t6$1 = $[19];
2065
+ return t6$1;
2066
+ }
2067
+ let t6;
2068
+ if ($[20] !== selectedQueue.displayName) {
2069
+ t6 = /* @__PURE__ */ jsx("h2", {
2070
+ className: "font-semibold text-lg",
2071
+ children: selectedQueue.displayName
2072
+ });
2073
+ $[20] = selectedQueue.displayName;
2074
+ $[21] = t6;
2075
+ } else t6 = $[21];
2076
+ let t7;
2077
+ if ($[22] !== selectedQueue.isPaused) {
2078
+ t7 = selectedQueue.isPaused && /* @__PURE__ */ jsx("span", {
2079
+ className: "px-2 py-0.5 text-xs rounded bg-yellow-500/20 text-yellow-600",
2080
+ children: "Paused"
2081
+ });
2082
+ $[22] = selectedQueue.isPaused;
2083
+ $[23] = t7;
2084
+ } else t7 = $[23];
2085
+ let t8;
2086
+ if ($[24] !== t6 || $[25] !== t7) {
2087
+ t8 = /* @__PURE__ */ jsxs("div", {
2088
+ className: "flex items-center gap-3",
2089
+ children: [t6, t7]
2090
+ });
2091
+ $[24] = t6;
2092
+ $[25] = t7;
2093
+ $[26] = t8;
2094
+ } else t8 = $[26];
2095
+ let t9;
2096
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
2097
+ t9 = /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" });
2098
+ $[27] = t9;
2099
+ } else t9 = $[27];
2100
+ let t10;
2101
+ if ($[28] !== handleRefresh) {
2102
+ t10 = /* @__PURE__ */ jsx(TooltipTrigger, {
2103
+ asChild: true,
2104
+ children: /* @__PURE__ */ jsx(Button, {
2105
+ variant: "ghost",
2106
+ size: "icon",
2107
+ onClick: handleRefresh,
2108
+ children: t9
2109
+ })
2110
+ });
2111
+ $[28] = handleRefresh;
2112
+ $[29] = t10;
2113
+ } else t10 = $[29];
2114
+ let t11;
2115
+ if ($[30] === Symbol.for("react.memo_cache_sentinel")) {
2116
+ t11 = /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Refresh queue stats and jobs list" }) });
2117
+ $[30] = t11;
2118
+ } else t11 = $[30];
2119
+ let t12;
2120
+ if ($[31] !== t10) {
2121
+ t12 = /* @__PURE__ */ jsxs(Tooltip, { children: [t10, t11] });
2122
+ $[31] = t10;
2123
+ $[32] = t12;
2124
+ } else t12 = $[32];
2125
+ let t13;
2126
+ if ($[33] !== handlePause || $[34] !== handleResume || $[35] !== selectedQueue.isPaused) {
2127
+ t13 = selectedQueue.isPaused ? /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
2128
+ asChild: true,
2129
+ children: /* @__PURE__ */ jsxs(Button, {
2130
+ variant: "ghost",
2131
+ size: "sm",
2132
+ onClick: handleResume,
2133
+ children: [/* @__PURE__ */ jsx(Play, { className: "mr-2 h-4 w-4" }), "Resume"]
2134
+ })
2135
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Resume processing jobs in this queue" }) })] }) : /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
2136
+ asChild: true,
2137
+ children: /* @__PURE__ */ jsxs(Button, {
2138
+ variant: "ghost",
2139
+ size: "sm",
2140
+ onClick: handlePause,
2141
+ children: [/* @__PURE__ */ jsx(Pause, { className: "mr-2 h-4 w-4" }), "Pause"]
2142
+ })
2143
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "Stop workers from picking up new jobs" }) })] });
2144
+ $[33] = handlePause;
2145
+ $[34] = handleResume;
2146
+ $[35] = selectedQueue.isPaused;
2147
+ $[36] = t13;
2148
+ } else t13 = $[36];
2149
+ let t14;
2150
+ if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
2151
+ t14 = /* @__PURE__ */ jsx(DropdownMenuTrigger, {
2152
+ asChild: true,
2153
+ children: /* @__PURE__ */ jsx(Button, {
2154
+ variant: "ghost",
2155
+ size: "icon",
2156
+ children: /* @__PURE__ */ jsx(MoreVertical, { className: "h-4 w-4" })
2157
+ })
2158
+ });
2159
+ $[37] = t14;
2160
+ } else t14 = $[37];
2161
+ let t15;
2162
+ if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
2163
+ t15 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
2164
+ $[38] = t15;
2165
+ } else t15 = $[38];
2166
+ let t16;
2167
+ if ($[39] !== handleCleanCompleted) {
2168
+ t16 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
2169
+ onClick: handleCleanCompleted,
2170
+ children: [t15, "Clean Completed"]
2171
+ });
2172
+ $[39] = handleCleanCompleted;
2173
+ $[40] = t16;
2174
+ } else t16 = $[40];
2175
+ let t17;
2176
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
2177
+ t17 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
2178
+ $[41] = t17;
2179
+ } else t17 = $[41];
2180
+ let t18;
2181
+ if ($[42] !== handleCleanFailed) {
2182
+ t18 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
2183
+ onClick: handleCleanFailed,
2184
+ children: [t17, "Clean Failed"]
2185
+ });
2186
+ $[42] = handleCleanFailed;
2187
+ $[43] = t18;
2188
+ } else t18 = $[43];
2189
+ let t19;
2190
+ if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
2191
+ t19 = /* @__PURE__ */ jsx(DropdownMenuSeparator, {});
2192
+ $[44] = t19;
2193
+ } else t19 = $[44];
2194
+ let t20;
2195
+ if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
2196
+ t20 = /* @__PURE__ */ jsx(Trash, { className: "mr-2 h-4 w-4" });
2197
+ $[45] = t20;
2198
+ } else t20 = $[45];
2199
+ let t21;
2200
+ if ($[46] !== handleDrain) {
2201
+ t21 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
2202
+ onClick: handleDrain,
2203
+ className: "text-destructive",
2204
+ children: [t20, "Drain Queue"]
2205
+ });
2206
+ $[46] = handleDrain;
2207
+ $[47] = t21;
2208
+ } else t21 = $[47];
2209
+ let t22;
2210
+ if ($[48] !== t16 || $[49] !== t18 || $[50] !== t21) {
2211
+ t22 = /* @__PURE__ */ jsx(TooltipTrigger, {
2212
+ asChild: true,
2213
+ children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [t14, /* @__PURE__ */ jsxs(DropdownMenuContent, {
2214
+ align: "end",
2215
+ className: "bg-background text-foreground",
2216
+ children: [
2217
+ t16,
2218
+ t18,
2219
+ t19,
2220
+ t21
2221
+ ]
2222
+ })] })
2223
+ });
2224
+ $[48] = t16;
2225
+ $[49] = t18;
2226
+ $[50] = t21;
2227
+ $[51] = t22;
2228
+ } else t22 = $[51];
2229
+ let t23;
2230
+ if ($[52] === Symbol.for("react.memo_cache_sentinel")) {
2231
+ t23 = /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: "More actions" }) });
2232
+ $[52] = t23;
2233
+ } else t23 = $[52];
2234
+ let t24;
2235
+ if ($[53] !== t22) {
2236
+ t24 = /* @__PURE__ */ jsxs(Tooltip, { children: [t22, t23] });
2237
+ $[53] = t22;
2238
+ $[54] = t24;
2239
+ } else t24 = $[54];
2240
+ let t25;
2241
+ if ($[55] !== t12 || $[56] !== t13 || $[57] !== t24) {
2242
+ t25 = /* @__PURE__ */ jsxs("div", {
2243
+ className: "flex items-center gap-2",
2244
+ children: [
2245
+ t12,
2246
+ t13,
2247
+ t24
2248
+ ]
2249
+ });
2250
+ $[55] = t12;
2251
+ $[56] = t13;
2252
+ $[57] = t24;
2253
+ $[58] = t25;
2254
+ } else t25 = $[58];
2255
+ let t26;
2256
+ if ($[59] !== t25 || $[60] !== t8) {
2257
+ t26 = /* @__PURE__ */ jsxs("div", {
2258
+ className: "flex items-center justify-between p-3 border-b border-border",
2259
+ children: [t8, t25]
2260
+ });
2261
+ $[59] = t25;
2262
+ $[60] = t8;
2263
+ $[61] = t26;
2264
+ } else t26 = $[61];
2265
+ let t27;
2266
+ if ($[62] !== selectedQueue.stats.waiting) {
2267
+ t27 = /* @__PURE__ */ jsx("div", {
2268
+ className: "text-2xl font-bold text-blue-500",
2269
+ children: selectedQueue.stats.waiting
2270
+ });
2271
+ $[62] = selectedQueue.stats.waiting;
2272
+ $[63] = t27;
2273
+ } else t27 = $[63];
2274
+ let t28;
2275
+ if ($[64] === Symbol.for("react.memo_cache_sentinel")) {
2276
+ t28 = /* @__PURE__ */ jsx("div", {
2277
+ className: "text-xs text-muted-foreground",
2278
+ children: "Waiting"
2279
+ });
2280
+ $[64] = t28;
2281
+ } else t28 = $[64];
2282
+ let t29;
2283
+ if ($[65] !== t27) {
2284
+ t29 = /* @__PURE__ */ jsxs("div", { children: [t27, t28] });
2285
+ $[65] = t27;
2286
+ $[66] = t29;
2287
+ } else t29 = $[66];
2288
+ let t30;
2289
+ if ($[67] !== selectedQueue.stats.active) {
2290
+ t30 = /* @__PURE__ */ jsx("div", {
2291
+ className: "text-2xl font-bold text-yellow-500",
2292
+ children: selectedQueue.stats.active
2293
+ });
2294
+ $[67] = selectedQueue.stats.active;
2295
+ $[68] = t30;
2296
+ } else t30 = $[68];
2297
+ let t31;
2298
+ if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
2299
+ t31 = /* @__PURE__ */ jsx("div", {
2300
+ className: "text-xs text-muted-foreground",
2301
+ children: "Active"
2302
+ });
2303
+ $[69] = t31;
2304
+ } else t31 = $[69];
2305
+ let t32;
2306
+ if ($[70] !== t30) {
2307
+ t32 = /* @__PURE__ */ jsxs("div", { children: [t30, t31] });
2308
+ $[70] = t30;
2309
+ $[71] = t32;
2310
+ } else t32 = $[71];
2311
+ let t33;
2312
+ if ($[72] !== selectedQueue.stats.completed) {
2313
+ t33 = /* @__PURE__ */ jsx("div", {
2314
+ className: "text-2xl font-bold text-green-500",
2315
+ children: selectedQueue.stats.completed
2316
+ });
2317
+ $[72] = selectedQueue.stats.completed;
2318
+ $[73] = t33;
2319
+ } else t33 = $[73];
2320
+ let t34;
2321
+ if ($[74] === Symbol.for("react.memo_cache_sentinel")) {
2322
+ t34 = /* @__PURE__ */ jsx("div", {
2323
+ className: "text-xs text-muted-foreground",
2324
+ children: "Completed"
2325
+ });
2326
+ $[74] = t34;
2327
+ } else t34 = $[74];
2328
+ let t35;
2329
+ if ($[75] !== t33) {
2330
+ t35 = /* @__PURE__ */ jsxs("div", { children: [t33, t34] });
2331
+ $[75] = t33;
2332
+ $[76] = t35;
2333
+ } else t35 = $[76];
2334
+ let t36;
2335
+ if ($[77] !== selectedQueue.stats.failed) {
2336
+ t36 = /* @__PURE__ */ jsx("div", {
2337
+ className: "text-2xl font-bold text-destructive",
2338
+ children: selectedQueue.stats.failed
2339
+ });
2340
+ $[77] = selectedQueue.stats.failed;
2341
+ $[78] = t36;
2342
+ } else t36 = $[78];
2343
+ let t37;
2344
+ if ($[79] === Symbol.for("react.memo_cache_sentinel")) {
2345
+ t37 = /* @__PURE__ */ jsx("div", {
2346
+ className: "text-xs text-muted-foreground",
2347
+ children: "Failed"
2348
+ });
2349
+ $[79] = t37;
2350
+ } else t37 = $[79];
2351
+ let t38;
2352
+ if ($[80] !== t36) {
2353
+ t38 = /* @__PURE__ */ jsxs("div", { children: [t36, t37] });
2354
+ $[80] = t36;
2355
+ $[81] = t38;
2356
+ } else t38 = $[81];
2357
+ let t39;
2358
+ if ($[82] !== selectedQueue.stats.delayed) {
2359
+ t39 = /* @__PURE__ */ jsx("div", {
2360
+ className: "text-2xl font-bold text-purple-500",
2361
+ children: selectedQueue.stats.delayed
2362
+ });
2363
+ $[82] = selectedQueue.stats.delayed;
2364
+ $[83] = t39;
2365
+ } else t39 = $[83];
2366
+ let t40;
2367
+ if ($[84] === Symbol.for("react.memo_cache_sentinel")) {
2368
+ t40 = /* @__PURE__ */ jsx("div", {
2369
+ className: "text-xs text-muted-foreground",
2370
+ children: "Delayed"
2371
+ });
2372
+ $[84] = t40;
2373
+ } else t40 = $[84];
2374
+ let t41;
2375
+ if ($[85] !== t39) {
2376
+ t41 = /* @__PURE__ */ jsxs("div", { children: [t39, t40] });
2377
+ $[85] = t39;
2378
+ $[86] = t41;
2379
+ } else t41 = $[86];
2380
+ let t42;
2381
+ if ($[87] !== selectedQueue.stats.paused) {
2382
+ t42 = /* @__PURE__ */ jsx("div", {
2383
+ className: "text-2xl font-bold text-muted-foreground",
2384
+ children: selectedQueue.stats.paused
2385
+ });
2386
+ $[87] = selectedQueue.stats.paused;
2387
+ $[88] = t42;
2388
+ } else t42 = $[88];
2389
+ let t43;
2390
+ if ($[89] === Symbol.for("react.memo_cache_sentinel")) {
2391
+ t43 = /* @__PURE__ */ jsx("div", {
2392
+ className: "text-xs text-muted-foreground",
2393
+ children: "Paused"
2394
+ });
2395
+ $[89] = t43;
2396
+ } else t43 = $[89];
2397
+ let t44;
2398
+ if ($[90] !== t42) {
2399
+ t44 = /* @__PURE__ */ jsxs("div", { children: [t42, t43] });
2400
+ $[90] = t42;
2401
+ $[91] = t44;
2402
+ } else t44 = $[91];
2403
+ let t45;
2404
+ if ($[92] !== t29 || $[93] !== t32 || $[94] !== t35 || $[95] !== t38 || $[96] !== t41 || $[97] !== t44) {
2405
+ t45 = /* @__PURE__ */ jsx("div", {
2406
+ className: "p-3 border-b border-border",
2407
+ children: /* @__PURE__ */ jsxs("div", {
2408
+ className: "grid grid-cols-6 gap-4 text-center",
2409
+ children: [
2410
+ t29,
2411
+ t32,
2412
+ t35,
2413
+ t38,
2414
+ t41,
2415
+ t44
2416
+ ]
2417
+ })
2418
+ });
2419
+ $[92] = t29;
2420
+ $[93] = t32;
2421
+ $[94] = t35;
2422
+ $[95] = t38;
2423
+ $[96] = t41;
2424
+ $[97] = t44;
2425
+ $[98] = t45;
2426
+ } else t45 = $[98];
2427
+ let t46;
2428
+ if ($[99] !== setSelectedStatus) {
2429
+ t46 = (v) => setSelectedStatus(v);
2430
+ $[99] = setSelectedStatus;
2431
+ $[100] = t46;
2432
+ } else t46 = $[100];
2433
+ let t47;
2434
+ if ($[101] !== selectedQueue.stats || $[102] !== selectedStatus) {
2435
+ t47 = STATUS_TABS.map((tab) => /* @__PURE__ */ jsxs(TabsTrigger, {
2436
+ value: tab.value,
2437
+ className: cn("relative", selectedStatus === tab.value && "after:absolute after:bottom-0 after:left-0 after:right-0 after:h-0.5 after:bg-primary"),
2438
+ children: [tab.label, selectedQueue.stats[tab.value] > 0 && /* @__PURE__ */ jsx("span", {
2439
+ className: "ml-1.5 px-1.5 py-0.5 text-[10px] rounded-full bg-muted",
2440
+ children: selectedQueue.stats[tab.value]
2441
+ })]
2442
+ }, tab.value));
2443
+ $[101] = selectedQueue.stats;
2444
+ $[102] = selectedStatus;
2445
+ $[103] = t47;
2446
+ } else t47 = $[103];
2447
+ let t48;
2448
+ if ($[104] !== t47) {
2449
+ t48 = /* @__PURE__ */ jsx("div", {
2450
+ className: "px-3 pt-2 border-b border-border",
2451
+ children: /* @__PURE__ */ jsx(TabsList, { children: t47 })
2452
+ });
2453
+ $[104] = t47;
2454
+ $[105] = t48;
2455
+ } else t48 = $[105];
2456
+ let t49;
2457
+ if ($[106] === Symbol.for("react.memo_cache_sentinel")) {
2458
+ t49 = /* @__PURE__ */ jsx("div", {
2459
+ className: "flex-1 overflow-auto",
2460
+ children: /* @__PURE__ */ jsx(JobsTable, {})
2461
+ });
2462
+ $[106] = t49;
2463
+ } else t49 = $[106];
2464
+ let t50;
2465
+ if ($[107] !== selectedStatus || $[108] !== t46 || $[109] !== t48) {
2466
+ t50 = /* @__PURE__ */ jsxs(Tabs, {
2467
+ value: selectedStatus,
2468
+ onValueChange: t46,
2469
+ className: "flex-1 flex flex-col",
2470
+ children: [t48, t49]
2471
+ });
2472
+ $[107] = selectedStatus;
2473
+ $[108] = t46;
2474
+ $[109] = t48;
2475
+ $[110] = t50;
2476
+ } else t50 = $[110];
2477
+ let t51;
2478
+ if ($[111] !== t26 || $[112] !== t45 || $[113] !== t50) {
2479
+ t51 = /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs("div", {
2480
+ className: "flex flex-col h-full",
2481
+ children: [
2482
+ t26,
2483
+ t45,
2484
+ t50
2485
+ ]
2486
+ }) });
2487
+ $[111] = t26;
2488
+ $[112] = t45;
2489
+ $[113] = t50;
2490
+ $[114] = t51;
2491
+ } else t51 = $[114];
2492
+ return t51;
2493
+ });
2494
+ QueueDetail.displayName = "QueueDetail";
2495
+ function _temp$2(state) {
2496
+ return state.selectedQueue;
2497
+ }
2498
+ function _temp2$2(state_0) {
2499
+ return state_0.selectedStatus;
2500
+ }
2501
+ function _temp3$1(state_1) {
2502
+ return state_1.setSelectedStatus;
2503
+ }
2504
+
2505
+ //#endregion
2506
+ //#region src/components/queue-list.tsx
2507
+ const QueueItem = memo((t0) => {
2508
+ const $ = c(54);
2509
+ if ($[0] !== "44e6229799ef8371f1e191c6f3e3ef70ea83c9489840337cf1d87e846b1bcc7c") {
2510
+ for (let $i = 0; $i < 54; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2511
+ $[0] = "44e6229799ef8371f1e191c6f3e3ef70ea83c9489840337cf1d87e846b1bcc7c";
2512
+ }
2513
+ const { queue, isSelected, onClick } = t0;
2514
+ const totalJobs = queue.stats.waiting + queue.stats.active + queue.stats.delayed + queue.stats.prioritized;
2515
+ const hasFailedJobs = queue.stats.failed > 0;
2516
+ const t1 = isSelected ? "bg-muted-foreground/10" : "hover:bg-muted/70";
2517
+ let t2;
2518
+ if ($[1] !== t1) {
2519
+ t2 = cn("w-full text-left p-3 transition-colors border-b border-border", t1);
2520
+ $[1] = t1;
2521
+ $[2] = t2;
2522
+ } else t2 = $[2];
2523
+ let t3;
2524
+ if ($[3] !== queue.isDLQ) {
2525
+ t3 = queue.isDLQ ? /* @__PURE__ */ jsx(Skull, { className: "w-4 h-4 text-destructive" }) : /* @__PURE__ */ jsx(Layers, { className: "w-4 h-4 text-muted-foreground" });
2526
+ $[3] = queue.isDLQ;
2527
+ $[4] = t3;
2528
+ } else t3 = $[4];
2529
+ let t4;
2530
+ if ($[5] !== queue.displayName) {
2531
+ t4 = /* @__PURE__ */ jsx("span", {
2532
+ className: "font-semibold text-sm truncate flex-1",
2533
+ children: queue.displayName
2534
+ });
2535
+ $[5] = queue.displayName;
2536
+ $[6] = t4;
2537
+ } else t4 = $[6];
2538
+ let t5;
2539
+ if ($[7] !== queue.isPaused) {
2540
+ t5 = queue.isPaused && /* @__PURE__ */ jsx(Pause, { className: "w-3 h-3 text-yellow-500" });
2541
+ $[7] = queue.isPaused;
2542
+ $[8] = t5;
2543
+ } else t5 = $[8];
2544
+ let t6;
2545
+ if ($[9] !== hasFailedJobs) {
2546
+ t6 = hasFailedJobs && /* @__PURE__ */ jsx(AlertTriangle, { className: "w-3 h-3 text-destructive" });
2547
+ $[9] = hasFailedJobs;
2548
+ $[10] = t6;
2549
+ } else t6 = $[10];
2550
+ let t7;
2551
+ if ($[11] !== t3 || $[12] !== t4 || $[13] !== t5 || $[14] !== t6) {
2552
+ t7 = /* @__PURE__ */ jsxs("div", {
2553
+ className: "flex items-center gap-2 mb-1",
2554
+ children: [
2555
+ t3,
2556
+ t4,
2557
+ t5,
2558
+ t6
2559
+ ]
2560
+ });
2561
+ $[11] = t3;
2562
+ $[12] = t4;
2563
+ $[13] = t5;
2564
+ $[14] = t6;
2565
+ $[15] = t7;
2566
+ } else t7 = $[15];
2567
+ let t8;
2568
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
2569
+ t8 = /* @__PURE__ */ jsx("span", {
2570
+ className: "text-muted-foreground",
2571
+ children: "Wait"
2572
+ });
2573
+ $[16] = t8;
2574
+ } else t8 = $[16];
2575
+ const t9 = queue.stats.waiting > 0 && "text-blue-500";
2576
+ let t10;
2577
+ if ($[17] !== t9) {
2578
+ t10 = cn("font-mono", t9);
2579
+ $[17] = t9;
2580
+ $[18] = t10;
2581
+ } else t10 = $[18];
2582
+ let t11;
2583
+ if ($[19] !== queue.stats.waiting || $[20] !== t10) {
2584
+ t11 = /* @__PURE__ */ jsxs("div", {
2585
+ className: "flex flex-col",
2586
+ children: [t8, /* @__PURE__ */ jsx("span", {
2587
+ className: t10,
2588
+ children: queue.stats.waiting
2589
+ })]
2590
+ });
2591
+ $[19] = queue.stats.waiting;
2592
+ $[20] = t10;
2593
+ $[21] = t11;
2594
+ } else t11 = $[21];
2595
+ let t12;
2596
+ if ($[22] === Symbol.for("react.memo_cache_sentinel")) {
2597
+ t12 = /* @__PURE__ */ jsx("span", {
2598
+ className: "text-muted-foreground",
2599
+ children: "Active"
2600
+ });
2601
+ $[22] = t12;
2602
+ } else t12 = $[22];
2603
+ const t13 = queue.stats.active > 0 && "text-yellow-500";
2604
+ let t14;
2605
+ if ($[23] !== t13) {
2606
+ t14 = cn("font-mono", t13);
2607
+ $[23] = t13;
2608
+ $[24] = t14;
2609
+ } else t14 = $[24];
2610
+ let t15;
2611
+ if ($[25] !== queue.stats.active || $[26] !== t14) {
2612
+ t15 = /* @__PURE__ */ jsxs("div", {
2613
+ className: "flex flex-col",
2614
+ children: [t12, /* @__PURE__ */ jsx("span", {
2615
+ className: t14,
2616
+ children: queue.stats.active
2617
+ })]
2618
+ });
2619
+ $[25] = queue.stats.active;
2620
+ $[26] = t14;
2621
+ $[27] = t15;
2622
+ } else t15 = $[27];
2623
+ let t16;
2624
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
2625
+ t16 = /* @__PURE__ */ jsx("span", {
2626
+ className: "text-muted-foreground",
2627
+ children: "Done"
2628
+ });
2629
+ $[28] = t16;
2630
+ } else t16 = $[28];
2631
+ const t17 = queue.stats.completed > 0 && "text-green-500";
2632
+ let t18;
2633
+ if ($[29] !== t17) {
2634
+ t18 = cn("font-mono", t17);
2635
+ $[29] = t17;
2636
+ $[30] = t18;
2637
+ } else t18 = $[30];
2638
+ let t19;
2639
+ if ($[31] !== queue.stats.completed || $[32] !== t18) {
2640
+ t19 = /* @__PURE__ */ jsxs("div", {
2641
+ className: "flex flex-col",
2642
+ children: [t16, /* @__PURE__ */ jsx("span", {
2643
+ className: t18,
2644
+ children: queue.stats.completed
2645
+ })]
2646
+ });
2647
+ $[31] = queue.stats.completed;
2648
+ $[32] = t18;
2649
+ $[33] = t19;
2650
+ } else t19 = $[33];
2651
+ let t20;
2652
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
2653
+ t20 = /* @__PURE__ */ jsx("span", {
2654
+ className: "text-muted-foreground",
2655
+ children: "Failed"
2656
+ });
2657
+ $[34] = t20;
2658
+ } else t20 = $[34];
2659
+ const t21 = queue.stats.failed > 0 && "text-destructive";
2660
+ let t22;
2661
+ if ($[35] !== t21) {
2662
+ t22 = cn("font-mono", t21);
2663
+ $[35] = t21;
2664
+ $[36] = t22;
2665
+ } else t22 = $[36];
2666
+ let t23;
2667
+ if ($[37] !== queue.stats.failed || $[38] !== t22) {
2668
+ t23 = /* @__PURE__ */ jsxs("div", {
2669
+ className: "flex flex-col",
2670
+ children: [t20, /* @__PURE__ */ jsx("span", {
2671
+ className: t22,
2672
+ children: queue.stats.failed
2673
+ })]
2674
+ });
2675
+ $[37] = queue.stats.failed;
2676
+ $[38] = t22;
2677
+ $[39] = t23;
2678
+ } else t23 = $[39];
2679
+ let t24;
2680
+ if ($[40] !== t11 || $[41] !== t15 || $[42] !== t19 || $[43] !== t23) {
2681
+ t24 = /* @__PURE__ */ jsxs("div", {
2682
+ className: "grid grid-cols-4 gap-1 text-xs",
2683
+ children: [
2684
+ t11,
2685
+ t15,
2686
+ t19,
2687
+ t23
2688
+ ]
2689
+ });
2690
+ $[40] = t11;
2691
+ $[41] = t15;
2692
+ $[42] = t19;
2693
+ $[43] = t23;
2694
+ $[44] = t24;
2695
+ } else t24 = $[44];
2696
+ let t25;
2697
+ if ($[45] !== queue.stats.delayed || $[46] !== totalJobs) {
2698
+ t25 = (queue.stats.delayed > 0 || totalJobs > 0) && /* @__PURE__ */ jsxs("div", {
2699
+ className: "flex gap-2 mt-1 text-xs text-muted-foreground",
2700
+ children: [queue.stats.delayed > 0 && /* @__PURE__ */ jsxs("span", { children: [queue.stats.delayed, " delayed"] }), totalJobs > 0 && /* @__PURE__ */ jsxs("span", {
2701
+ className: "ml-auto",
2702
+ children: [totalJobs, " pending"]
2703
+ })]
2704
+ });
2705
+ $[45] = queue.stats.delayed;
2706
+ $[46] = totalJobs;
2707
+ $[47] = t25;
2708
+ } else t25 = $[47];
2709
+ let t26;
2710
+ if ($[48] !== onClick || $[49] !== t2 || $[50] !== t24 || $[51] !== t25 || $[52] !== t7) {
2711
+ t26 = /* @__PURE__ */ jsxs("button", {
2712
+ type: "button",
2713
+ onClick,
2714
+ className: t2,
2715
+ children: [
2716
+ t7,
2717
+ t24,
2718
+ t25
2719
+ ]
2720
+ });
2721
+ $[48] = onClick;
2722
+ $[49] = t2;
2723
+ $[50] = t24;
2724
+ $[51] = t25;
2725
+ $[52] = t7;
2726
+ $[53] = t26;
2727
+ } else t26 = $[53];
2728
+ return t26;
2729
+ });
2730
+ QueueItem.displayName = "QueueItem";
2731
+ const QueueList = memo(() => {
2732
+ const $ = c(38);
2733
+ if ($[0] !== "44e6229799ef8371f1e191c6f3e3ef70ea83c9489840337cf1d87e846b1bcc7c") {
2734
+ for (let $i = 0; $i < 38; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2735
+ $[0] = "44e6229799ef8371f1e191c6f3e3ef70ea83c9489840337cf1d87e846b1bcc7c";
2736
+ }
2737
+ const queues = useBullMQStore(_temp$1);
2738
+ const selectedQueue = useBullMQStore(_temp2$1);
2739
+ const setSelectedQueue = useBullMQStore(_temp3);
2740
+ const searchQuery = useBullMQStore(_temp4);
2741
+ const setSearchQuery = useBullMQStore(_temp5);
2742
+ let t0;
2743
+ bb0: {
2744
+ if (!searchQuery) {
2745
+ t0 = queues;
2746
+ break bb0;
2747
+ }
2748
+ let t1$1;
2749
+ if ($[1] !== queues || $[2] !== searchQuery) {
2750
+ const query = searchQuery.toLowerCase();
2751
+ t1$1 = queues.filter((q) => q.name.toLowerCase().includes(query) || q.displayName.toLowerCase().includes(query));
2752
+ $[1] = queues;
2753
+ $[2] = searchQuery;
2754
+ $[3] = t1$1;
2755
+ } else t1$1 = $[3];
2756
+ t0 = t1$1;
2757
+ }
2758
+ const filteredQueues = t0;
2759
+ let t1;
2760
+ if ($[4] !== filteredQueues) {
2761
+ t1 = filteredQueues.filter(_temp6);
2762
+ $[4] = filteredQueues;
2763
+ $[5] = t1;
2764
+ } else t1 = $[5];
2765
+ const regularQueues = t1;
2766
+ let t2;
2767
+ if ($[6] !== filteredQueues) {
2768
+ t2 = filteredQueues.filter(_temp7);
2769
+ $[6] = filteredQueues;
2770
+ $[7] = t2;
2771
+ } else t2 = $[7];
2772
+ const dlqQueues = t2;
2773
+ let t3;
2774
+ if ($[8] !== setSearchQuery) {
2775
+ t3 = (e) => setSearchQuery(e.target.value);
2776
+ $[8] = setSearchQuery;
2777
+ $[9] = t3;
2778
+ } else t3 = $[9];
2779
+ let t4;
2780
+ if ($[10] !== searchQuery || $[11] !== t3) {
2781
+ t4 = /* @__PURE__ */ jsx(Input, {
2782
+ variant: "shade",
2783
+ value: searchQuery,
2784
+ onChange: t3,
2785
+ className: "px-9! font-medium text-sm",
2786
+ placeholder: "Search queues..."
2787
+ });
2788
+ $[10] = searchQuery;
2789
+ $[11] = t3;
2790
+ $[12] = t4;
2791
+ } else t4 = $[12];
2792
+ let t5;
2793
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
2794
+ t5 = /* @__PURE__ */ jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" });
2795
+ $[13] = t5;
2796
+ } else t5 = $[13];
2797
+ let t6;
2798
+ if ($[14] !== searchQuery || $[15] !== setSearchQuery) {
2799
+ t6 = searchQuery && /* @__PURE__ */ jsx(X, {
2800
+ className: "cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",
2801
+ onClick: () => setSearchQuery("")
2802
+ });
2803
+ $[14] = searchQuery;
2804
+ $[15] = setSearchQuery;
2805
+ $[16] = t6;
2806
+ } else t6 = $[16];
2807
+ let t7;
2808
+ if ($[17] !== t4 || $[18] !== t6) {
2809
+ t7 = /* @__PURE__ */ jsx("div", {
2810
+ className: "p-2 border-b border-border",
2811
+ children: /* @__PURE__ */ jsxs("div", {
2812
+ className: "relative",
2813
+ children: [
2814
+ t4,
2815
+ t5,
2816
+ t6
2817
+ ]
2818
+ })
2819
+ });
2820
+ $[17] = t4;
2821
+ $[18] = t6;
2822
+ $[19] = t7;
2823
+ } else t7 = $[19];
2824
+ let t8;
2825
+ if ($[20] !== regularQueues || $[21] !== selectedQueue?.name || $[22] !== setSelectedQueue) {
2826
+ t8 = regularQueues.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
2827
+ className: "px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-muted/30",
2828
+ children: [
2829
+ "Queues (",
2830
+ regularQueues.length,
2831
+ ")"
2832
+ ]
2833
+ }), regularQueues.map((queue) => /* @__PURE__ */ jsx(QueueItem, {
2834
+ queue,
2835
+ isSelected: selectedQueue?.name === queue.name,
2836
+ onClick: () => setSelectedQueue(queue)
2837
+ }, queue.name))] });
2838
+ $[20] = regularQueues;
2839
+ $[21] = selectedQueue?.name;
2840
+ $[22] = setSelectedQueue;
2841
+ $[23] = t8;
2842
+ } else t8 = $[23];
2843
+ let t9;
2844
+ if ($[24] !== dlqQueues || $[25] !== selectedQueue?.name || $[26] !== setSelectedQueue) {
2845
+ t9 = dlqQueues.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
2846
+ className: "px-3 py-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider bg-destructive/10",
2847
+ children: [
2848
+ "Dead Letter Queues (",
2849
+ dlqQueues.length,
2850
+ ")"
2851
+ ]
2852
+ }), dlqQueues.map((queue_0) => /* @__PURE__ */ jsx(QueueItem, {
2853
+ queue: queue_0,
2854
+ isSelected: selectedQueue?.name === queue_0.name,
2855
+ onClick: () => setSelectedQueue(queue_0)
2856
+ }, queue_0.name))] });
2857
+ $[24] = dlqQueues;
2858
+ $[25] = selectedQueue?.name;
2859
+ $[26] = setSelectedQueue;
2860
+ $[27] = t9;
2861
+ } else t9 = $[27];
2862
+ let t10;
2863
+ if ($[28] !== filteredQueues.length || $[29] !== searchQuery) {
2864
+ t10 = filteredQueues.length === 0 && /* @__PURE__ */ jsx("div", {
2865
+ className: "p-4 text-center text-muted-foreground text-sm",
2866
+ children: searchQuery ? "No queues match your search" : "No queues found"
2867
+ });
2868
+ $[28] = filteredQueues.length;
2869
+ $[29] = searchQuery;
2870
+ $[30] = t10;
2871
+ } else t10 = $[30];
2872
+ let t11;
2873
+ if ($[31] !== t10 || $[32] !== t8 || $[33] !== t9) {
2874
+ t11 = /* @__PURE__ */ jsxs("div", {
2875
+ className: "flex-1 overflow-auto",
2876
+ children: [
2877
+ t8,
2878
+ t9,
2879
+ t10
2880
+ ]
2881
+ });
2882
+ $[31] = t10;
2883
+ $[32] = t8;
2884
+ $[33] = t9;
2885
+ $[34] = t11;
2886
+ } else t11 = $[34];
2887
+ let t12;
2888
+ if ($[35] !== t11 || $[36] !== t7) {
2889
+ t12 = /* @__PURE__ */ jsxs("div", {
2890
+ className: "flex flex-col h-full",
2891
+ children: [t7, t11]
2892
+ });
2893
+ $[35] = t11;
2894
+ $[36] = t7;
2895
+ $[37] = t12;
2896
+ } else t12 = $[37];
2897
+ return t12;
2898
+ });
2899
+ QueueList.displayName = "QueueList";
2900
+ function _temp$1(state) {
2901
+ return state.queues;
2902
+ }
2903
+ function _temp2$1(state_0) {
2904
+ return state_0.selectedQueue;
2905
+ }
2906
+ function _temp3(state_1) {
2907
+ return state_1.setSelectedQueue;
2908
+ }
2909
+ function _temp4(state_2) {
2910
+ return state_2.searchQuery;
2911
+ }
2912
+ function _temp5(state_3) {
2913
+ return state_3.setSearchQuery;
2914
+ }
2915
+ function _temp6(q_0) {
2916
+ return !q_0.isDLQ;
2917
+ }
2918
+ function _temp7(q_1) {
2919
+ return q_1.isDLQ;
2920
+ }
2921
+
2922
+ //#endregion
2923
+ //#region src/components/queues-page.tsx
2924
+ const QueuesPageContent = memo(() => {
2925
+ const $ = c(12);
2926
+ if ($[0] !== "d90f8688a2f661493c4a0312f1c954fe541dc3821309a6ba650a56e59fcac492") {
2927
+ for (let $i = 0; $i < 12; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2928
+ $[0] = "d90f8688a2f661493c4a0312f1c954fe541dc3821309a6ba650a56e59fcac492";
2929
+ }
2930
+ const selectedQueue = useBullMQStore(_temp);
2931
+ const updateSelectedQueueStats = useBullMQStore(_temp2);
2932
+ const { queues } = useQueues();
2933
+ let t0;
2934
+ let t1;
2935
+ if ($[1] !== queues || $[2] !== selectedQueue || $[3] !== updateSelectedQueueStats) {
2936
+ t0 = () => {
2937
+ if (selectedQueue) {
2938
+ const updatedQueue = queues.find((q) => q.name === selectedQueue.name);
2939
+ if (updatedQueue) updateSelectedQueueStats(updatedQueue);
2940
+ }
2941
+ };
2942
+ t1 = [
2943
+ queues,
2944
+ selectedQueue,
2945
+ updateSelectedQueueStats
2946
+ ];
2947
+ $[1] = queues;
2948
+ $[2] = selectedQueue;
2949
+ $[3] = updateSelectedQueueStats;
2950
+ $[4] = t0;
2951
+ $[5] = t1;
2952
+ } else {
2953
+ t0 = $[4];
2954
+ t1 = $[5];
2955
+ }
2956
+ useEffect(t0, t1);
2957
+ let t2;
2958
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
2959
+ t2 = /* @__PURE__ */ jsx("div", {
2960
+ className: "border-r border-border overflow-hidden",
2961
+ children: /* @__PURE__ */ jsx(QueueList, {})
2962
+ });
2963
+ $[6] = t2;
2964
+ } else t2 = $[6];
2965
+ let t3;
2966
+ if ($[7] !== selectedQueue?.isDLQ) {
2967
+ t3 = /* @__PURE__ */ jsx("div", {
2968
+ className: "overflow-hidden",
2969
+ children: selectedQueue?.isDLQ ? /* @__PURE__ */ jsx(DLQPanel, {}) : /* @__PURE__ */ jsx(QueueDetail, {})
2970
+ });
2971
+ $[7] = selectedQueue?.isDLQ;
2972
+ $[8] = t3;
2973
+ } else t3 = $[8];
2974
+ let t4;
2975
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
2976
+ t4 = /* @__PURE__ */ jsx(JobDetail, {});
2977
+ $[9] = t4;
2978
+ } else t4 = $[9];
2979
+ let t5;
2980
+ if ($[10] !== t3) {
2981
+ t5 = /* @__PURE__ */ jsxs("div", {
2982
+ className: "grid grid-cols-[300px_1fr] h-full overflow-hidden",
2983
+ children: [
2984
+ t2,
2985
+ t3,
2986
+ t4
2987
+ ]
2988
+ });
2989
+ $[10] = t3;
2990
+ $[11] = t5;
2991
+ } else t5 = $[11];
2992
+ return t5;
2993
+ });
2994
+ QueuesPageContent.displayName = "QueuesPageContent";
2995
+ const QueuesPage = memo(() => {
2996
+ const $ = c(2);
2997
+ if ($[0] !== "d90f8688a2f661493c4a0312f1c954fe541dc3821309a6ba650a56e59fcac492") {
2998
+ for (let $i = 0; $i < 2; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
2999
+ $[0] = "d90f8688a2f661493c4a0312f1c954fe541dc3821309a6ba650a56e59fcac492";
3000
+ }
3001
+ let t0;
3002
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
3003
+ t0 = /* @__PURE__ */ jsx(QueryProvider, { children: /* @__PURE__ */ jsx(QueuesPageContent, {}) });
3004
+ $[1] = t0;
3005
+ } else t0 = $[1];
3006
+ return t0;
3007
+ });
3008
+ QueuesPage.displayName = "QueuesPage";
3009
+ function _temp(state) {
3010
+ return state.selectedQueue;
3011
+ }
3012
+ function _temp2(state_0) {
3013
+ return state_0.updateSelectedQueueStats;
3014
+ }
3015
+
3016
+ //#endregion
3017
+ export { QueuesPage };
3018
+ //# sourceMappingURL=index.js.map