react-semaphor 0.1.219 → 0.1.221
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/chunks/{dashboard-controls-fhZIf1Z0.js → dashboard-controls-D4TgRVta.js} +138 -138
- package/dist/chunks/{dashboard-controls-DfbaI6XZ.js → dashboard-controls-DqH7I5tb.js} +3 -3
- package/dist/chunks/{dashboard-json-DooCuhHo.js → dashboard-json-BvfBCrZp.js} +1 -1
- package/dist/chunks/{dashboard-json-Bt-kpD9y.js → dashboard-json-CbrkiALU.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-B3eWK66q.js → dashboard-summary-settings-dialog-Bhw7wO4D.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-CWmq1rnL.js → dashboard-summary-settings-dialog-CYdhHdYZ.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-C7sag6Jo.js → edit-dashboard-visual-DlPHT7nF.js} +4498 -4339
- package/dist/chunks/edit-dashboard-visual-DqXYRuqI.js +164 -0
- package/dist/chunks/editor-action-buttons-BMYQu_sk.js +405 -0
- package/dist/chunks/editor-action-buttons-VdYqRxoT.js +21 -0
- package/dist/chunks/{index-BMkn4K4E.js → index-C-8cXK5u.js} +16180 -16181
- package/dist/chunks/{index-C_RTjAMW.js → index-CaMze_Fv.js} +187 -187
- package/dist/chunks/{notification-bell-DHK6s4Om.js → notification-bell-DPnoYeUV.js} +85 -85
- package/dist/chunks/{notification-bell-DSShVmWj.js → notification-bell-RPOLOaxy.js} +2 -2
- package/dist/chunks/{resource-management-panel-QdAeim78.js → resource-management-panel-BA9mZ15S.js} +1 -1
- package/dist/chunks/{resource-management-panel-LBCXiHZk.js → resource-management-panel-DvAjwK0C.js} +3 -3
- package/dist/chunks/{use-role-aware-display-preferences-Db1iLmPN.js → use-role-aware-display-preferences-CdXcQxZk.js} +1 -1
- package/dist/chunks/{use-role-aware-display-preferences-CqF1BR5w.js → use-role-aware-display-preferences-DwKQjD_K.js} +1 -1
- package/dist/chunks/{use-visual-utils-AXuCdndV.js → use-visual-utils-BGLcxXJt.js} +1 -1
- package/dist/chunks/{use-visual-utils-CKt4UblS.js → use-visual-utils-RZ4Nj11p.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/edit-dashboard-visual-Blkn0D44.js +0 -164
- package/dist/chunks/editor-action-buttons-yJEX8W7R.js +0 -21
- package/dist/chunks/editor-action-buttons-z7gf6nE6.js +0 -404
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import J, { useState as D, useRef as M, useCallback as k, useEffect as L, useContext as ee } from "react";
|
|
2
|
-
import { bS as te, l as z, aE as T, bP as B, bL as K, bM as $, aF as Q, bK as ae, m as se, n as re, o as
|
|
3
|
-
import { jsx as t, jsxs as
|
|
4
|
-
import { V as Xe, E as We, a as Ke, b as Qe, L as Ye, c as Ze, d as Je, C as et } from "./editor-action-buttons-
|
|
5
|
-
import { a as Z } from "./use-visual-utils-
|
|
2
|
+
import { bS as te, l as z, aE as T, bP as B, bL as K, bM as $, aF as Q, bK as ae, m as se, n as re, o as ne, p as oe, q as ie, L as _, cB as le, cH as ce, G as de, B as I, H, a1 as P, V as ue, u as F, W as me, Z as Y, cI as he, cJ as j, I as R, ah as pe, c as U, c8 as fe, c9 as ge, ab as ve, cb as be, cc as V, E as xe, cg as we, c7 as ye, Y as Ce, cK as Ne, cL as Ae, cM as De, cp as Ee, cq as Se, cr as Le, cN as Ie, cs as Te, ct as Ue, cu as ke, cv as Fe, cw as Ve, au as Me, bR as Pe, X as Re, cO as Oe, cP as ze, cQ as Be, bN as q, ad as $e, aH as He, P as _e, s as je, cR as qe, t as Ge } from "./index-C-8cXK5u.js";
|
|
3
|
+
import { jsx as t, jsxs as n, Fragment as O } from "react/jsx-runtime";
|
|
4
|
+
import { V as Xe, E as We, a as Ke, b as Qe, L as Ye, c as Ze, d as Je, C as et } from "./editor-action-buttons-BMYQu_sk.js";
|
|
5
|
+
import { a as Z } from "./use-visual-utils-RZ4Nj11p.js";
|
|
6
6
|
import { c as G } from "./date-formatter-Y8Za1ib3.js";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.453.0 - ISC
|
|
@@ -15,15 +15,15 @@ const X = te("FileDown", [
|
|
|
15
15
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
16
16
|
["path", { d: "M12 18v-6", key: "17g6i2" }],
|
|
17
17
|
["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
|
|
18
|
-
]), tt = 1e4, at = 15e3, st = 3e4, rt = 3e4,
|
|
19
|
-
function
|
|
18
|
+
]), tt = 1e4, at = 15e3, st = 3e4, rt = 3e4, nt = 12e4, W = 2 * 60 * 60 * 1e3;
|
|
19
|
+
function ot(e) {
|
|
20
20
|
const a = Date.now() - e.getTime();
|
|
21
|
-
return a < rt ? tt : a <
|
|
21
|
+
return a < rt ? tt : a < nt ? at : st;
|
|
22
22
|
}
|
|
23
23
|
function bt() {
|
|
24
24
|
const { authToken: e, tokenProps: a } = z(), m = T((h) => h.activeExports), [c, d] = D(
|
|
25
25
|
typeof document < "u" ? !document.hidden : !0
|
|
26
|
-
), u = M(null),
|
|
26
|
+
), u = M(null), o = M(!1), l = M(void 0), f = a == null ? void 0 : a.apiServiceUrl, i = e == null ? void 0 : e.accessToken, g = k(() => {
|
|
27
27
|
const h = T.getState().activeExports;
|
|
28
28
|
return Array.from(h.values()).filter(
|
|
29
29
|
(b) => B(b.status)
|
|
@@ -40,12 +40,12 @@ function bt() {
|
|
|
40
40
|
}, []);
|
|
41
41
|
const x = k(async () => {
|
|
42
42
|
if (!f || !i) {
|
|
43
|
-
|
|
43
|
+
o.current = !1;
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
46
|
const h = g();
|
|
47
47
|
if (h.length === 0) {
|
|
48
|
-
|
|
48
|
+
o.current = !1;
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
const b = Date.now(), N = h.filter(
|
|
@@ -64,7 +64,7 @@ function bt() {
|
|
|
64
64
|
(s) => b - s.startedAt.getTime() <= W
|
|
65
65
|
);
|
|
66
66
|
if (p.length === 0) {
|
|
67
|
-
|
|
67
|
+
o.current = !1;
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
const y = await Promise.allSettled(
|
|
@@ -107,40 +107,40 @@ function bt() {
|
|
|
107
107
|
const s = w.reduce(
|
|
108
108
|
(v, E) => E.startedAt < v ? E.startedAt : v,
|
|
109
109
|
w[0].startedAt
|
|
110
|
-
), r =
|
|
110
|
+
), r = ot(s);
|
|
111
111
|
u.current && clearTimeout(u.current), u.current = setTimeout(() => {
|
|
112
112
|
var v;
|
|
113
113
|
(v = l.current) == null || v.call(l);
|
|
114
114
|
}, r);
|
|
115
115
|
} else
|
|
116
|
-
|
|
116
|
+
o.current = !1;
|
|
117
117
|
}, [f, i, g]);
|
|
118
118
|
return L(() => {
|
|
119
119
|
l.current = x;
|
|
120
120
|
}, [x]), L(() => {
|
|
121
121
|
var b;
|
|
122
|
-
g().length > 0 && c && !
|
|
122
|
+
g().length > 0 && c && !o.current && (o.current = !0, (b = l.current) == null || b.call(l));
|
|
123
123
|
}, [m, c, g]), L(() => {
|
|
124
124
|
var b;
|
|
125
125
|
const h = g();
|
|
126
|
-
c && h.length > 0 && !
|
|
126
|
+
c && h.length > 0 && !o.current && (o.current = !0, (b = l.current) == null || b.call(l));
|
|
127
127
|
}, [c, g]), L(() => {
|
|
128
|
-
!c && u.current && (clearTimeout(u.current), u.current = null,
|
|
128
|
+
!c && u.current && (clearTimeout(u.current), u.current = null, o.current = !1);
|
|
129
129
|
}, [c]), L(() => () => {
|
|
130
130
|
u.current && (clearTimeout(u.current), u.current = null);
|
|
131
131
|
}, []), {
|
|
132
|
-
isPolling:
|
|
132
|
+
isPolling: o.current,
|
|
133
133
|
isTabVisible: c,
|
|
134
134
|
inProgressCount: g().length
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
function xt() {
|
|
138
|
-
const { authToken: e, tokenProps: a } = z(), m = T((l) => l.activeExports), { addExport: c } = Q(), d = M(!1), u = a == null ? void 0 : a.apiServiceUrl,
|
|
138
|
+
const { authToken: e, tokenProps: a } = z(), m = T((l) => l.activeExports), { addExport: c } = Q(), d = M(!1), u = a == null ? void 0 : a.apiServiceUrl, o = e == null ? void 0 : e.accessToken;
|
|
139
139
|
L(() => {
|
|
140
|
-
if (d.current || !u || !
|
|
140
|
+
if (d.current || !u || !o) return;
|
|
141
141
|
(async () => {
|
|
142
142
|
try {
|
|
143
|
-
const { exports: f } = await ae(u,
|
|
143
|
+
const { exports: f } = await ae(u, o, {
|
|
144
144
|
status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
|
|
145
145
|
limit: 20
|
|
146
146
|
// Limit to recent exports
|
|
@@ -151,7 +151,7 @@ function xt() {
|
|
|
151
151
|
let x;
|
|
152
152
|
if (i.status === "completed")
|
|
153
153
|
try {
|
|
154
|
-
x = await $(u,
|
|
154
|
+
x = await $(u, o, i.id);
|
|
155
155
|
} catch (b) {
|
|
156
156
|
console.error(
|
|
157
157
|
`[useExportRecovery] Failed to get download URL for ${i.id}:`,
|
|
@@ -181,7 +181,7 @@ function xt() {
|
|
|
181
181
|
console.error("[useExportRecovery] Failed to recover exports:", f), d.current = !0;
|
|
182
182
|
}
|
|
183
183
|
})();
|
|
184
|
-
}, [u,
|
|
184
|
+
}, [u, o, c, m]);
|
|
185
185
|
}
|
|
186
186
|
function it(e) {
|
|
187
187
|
return e.title ? e.title : B(
|
|
@@ -195,7 +195,7 @@ function lt({
|
|
|
195
195
|
currentVisualName: c,
|
|
196
196
|
isSaving: d = !1,
|
|
197
197
|
destinationMode: u = "both",
|
|
198
|
-
onConfirm:
|
|
198
|
+
onConfirm: o
|
|
199
199
|
}) {
|
|
200
200
|
const [l, f] = D(
|
|
201
201
|
m && c ? `Copy of ${c}` : c || ""
|
|
@@ -224,16 +224,16 @@ function lt({
|
|
|
224
224
|
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
225
225
|
actionLabel: "Save Copy as Linked Visual"
|
|
226
226
|
}, b = () => {
|
|
227
|
-
!x || d ||
|
|
227
|
+
!x || d || o({
|
|
228
228
|
name: l.trim(),
|
|
229
229
|
description: i.trim() || void 0,
|
|
230
230
|
saveToLibrary: h.saveToLibrary,
|
|
231
231
|
saveToCurrentDashboard: h.saveToCurrentDashboard
|
|
232
232
|
});
|
|
233
233
|
};
|
|
234
|
-
return /* @__PURE__ */ t(se, { open: e, onOpenChange: a, children: /* @__PURE__ */
|
|
235
|
-
/* @__PURE__ */
|
|
236
|
-
/* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ t(se, { open: e, onOpenChange: a, children: /* @__PURE__ */ n(re, { className: "sm:max-w-[500px]", children: [
|
|
235
|
+
/* @__PURE__ */ n(ne, { children: [
|
|
236
|
+
/* @__PURE__ */ n(oe, { className: "flex items-center gap-2", children: [
|
|
237
237
|
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
238
238
|
h.badgeType !== "local" && /* @__PURE__ */ t(
|
|
239
239
|
Xe,
|
|
@@ -246,8 +246,8 @@ function lt({
|
|
|
246
246
|
] }),
|
|
247
247
|
/* @__PURE__ */ t(ie, { children: h.description })
|
|
248
248
|
] }),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ n("div", { className: "grid gap-4 py-4", children: [
|
|
250
|
+
/* @__PURE__ */ n("div", { className: "grid gap-2", children: [
|
|
251
251
|
/* @__PURE__ */ t(_, { htmlFor: "name", children: "Name" }),
|
|
252
252
|
/* @__PURE__ */ t(
|
|
253
253
|
le,
|
|
@@ -260,7 +260,7 @@ function lt({
|
|
|
260
260
|
}
|
|
261
261
|
)
|
|
262
262
|
] }),
|
|
263
|
-
/* @__PURE__ */
|
|
263
|
+
/* @__PURE__ */ n("div", { className: "grid gap-2", children: [
|
|
264
264
|
/* @__PURE__ */ t(_, { htmlFor: "description", children: "Description (optional)" }),
|
|
265
265
|
/* @__PURE__ */ t(
|
|
266
266
|
ce,
|
|
@@ -275,7 +275,7 @@ function lt({
|
|
|
275
275
|
)
|
|
276
276
|
] })
|
|
277
277
|
] }),
|
|
278
|
-
/* @__PURE__ */
|
|
278
|
+
/* @__PURE__ */ n(de, { children: [
|
|
279
279
|
/* @__PURE__ */ t(
|
|
280
280
|
I,
|
|
281
281
|
{
|
|
@@ -285,7 +285,7 @@ function lt({
|
|
|
285
285
|
children: "Cancel"
|
|
286
286
|
}
|
|
287
287
|
),
|
|
288
|
-
/* @__PURE__ */
|
|
288
|
+
/* @__PURE__ */ n(I, { onClick: b, disabled: !x || d, children: [
|
|
289
289
|
d && /* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
290
290
|
h.actionLabel
|
|
291
291
|
] })
|
|
@@ -293,11 +293,11 @@ function lt({
|
|
|
293
293
|
] }) });
|
|
294
294
|
}
|
|
295
295
|
function ct() {
|
|
296
|
-
const [e, a] = D(!1), [m, c] = D(!1), [d, u] = D(null),
|
|
296
|
+
const [e, a] = D(!1), [m, c] = D(!1), [d, u] = D(null), o = P((r) => r.frame), l = P((r) => r.card), f = ue(), i = F((r) => r.selectedSheetId), g = F(
|
|
297
297
|
(r) => r.actions.setIsDashboardPanelOpen
|
|
298
|
-
), { getUpdatedFrame: x } = Z(), { selectVisual: h } = me(), { addFrame: b, setSelectedFrameId: N, setIsVisualEditing: p } = Y(), y = !!(
|
|
298
|
+
), { getUpdatedFrame: x } = Z(), { selectVisual: h } = me(), { addFrame: b, setSelectedFrameId: N, setIsVisualEditing: p } = Y(), y = !!(o != null && o.visualId), A = (() => {
|
|
299
299
|
var r, v;
|
|
300
|
-
return ((r =
|
|
300
|
+
return ((r = o == null ? void 0 : o.cards) == null ? void 0 : r.length) === 1 && ((v = o.cards[0]) != null && v.title) ? o.cards[0].title : f != null && f.title ? f.title : (l == null ? void 0 : l.title) || "Untitled Visual";
|
|
301
301
|
})(), w = he((r) => {
|
|
302
302
|
if (r != null && r.id) {
|
|
303
303
|
if (h(r), m && d && i) {
|
|
@@ -357,7 +357,7 @@ function ct() {
|
|
|
357
357
|
function wt({
|
|
358
358
|
className: e
|
|
359
359
|
}) {
|
|
360
|
-
const a = P((C) => C.frame), m = pe((C) => C.selectedVisual), c = F((C) => C.selectedFrameId), d = F((C) => C.selectedSheetId), { setIsVisualEditing: u, updateFrame:
|
|
360
|
+
const a = P((C) => C.frame), m = pe((C) => C.selectedVisual), c = F((C) => C.selectedFrameId), d = F((C) => C.selectedSheetId), { setIsVisualEditing: u, updateFrame: o } = Y(), [l, f] = D(!1), [i, g] = D("both"), x = !!(a != null && a.visualId || m != null && m.id), h = !!(a != null && a.visualId && c), b = x && !h, {
|
|
361
361
|
saveAsDialogOpen: N,
|
|
362
362
|
setSaveAsDialogOpen: p,
|
|
363
363
|
handleSaveAs: y,
|
|
@@ -375,14 +375,14 @@ function wt({
|
|
|
375
375
|
...r(),
|
|
376
376
|
visualId: void 0
|
|
377
377
|
};
|
|
378
|
-
|
|
378
|
+
o(d, S), setTimeout(() => {
|
|
379
379
|
f(!1), R.success("Changes applied. Visual is now local to this dashboard"), u(!1);
|
|
380
380
|
}, 300);
|
|
381
381
|
}, E = (C) => {
|
|
382
382
|
g(C), p(!0);
|
|
383
383
|
};
|
|
384
|
-
return /* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
384
|
+
return /* @__PURE__ */ n(O, { children: [
|
|
385
|
+
/* @__PURE__ */ n("div", { className: "inline-flex items-center overflow-hidden rounded-md border border-input", children: [
|
|
386
386
|
!x && /* @__PURE__ */ t(
|
|
387
387
|
We,
|
|
388
388
|
{
|
|
@@ -403,7 +403,7 @@ function wt({
|
|
|
403
403
|
className: U(e, "rounded-none border-0")
|
|
404
404
|
}
|
|
405
405
|
),
|
|
406
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ n(fe, { modal: !1, children: [
|
|
407
407
|
/* @__PURE__ */ t(ge, { className: "h-8", asChild: !0, children: /* @__PURE__ */ t(
|
|
408
408
|
I,
|
|
409
409
|
{
|
|
@@ -418,9 +418,9 @@ function wt({
|
|
|
418
418
|
children: /* @__PURE__ */ t(ve, { className: "h-4 w-4" })
|
|
419
419
|
}
|
|
420
420
|
) }),
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
h && /* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ n(be, { align: "end", children: [
|
|
422
|
+
h && /* @__PURE__ */ n(O, { children: [
|
|
423
|
+
/* @__PURE__ */ n(
|
|
424
424
|
V,
|
|
425
425
|
{
|
|
426
426
|
onClick: v,
|
|
@@ -433,7 +433,7 @@ function wt({
|
|
|
433
433
|
),
|
|
434
434
|
/* @__PURE__ */ t(we, {})
|
|
435
435
|
] }),
|
|
436
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ n(
|
|
437
437
|
V,
|
|
438
438
|
{
|
|
439
439
|
onClick: () => E("local"),
|
|
@@ -444,7 +444,7 @@ function wt({
|
|
|
444
444
|
]
|
|
445
445
|
}
|
|
446
446
|
),
|
|
447
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ n(
|
|
448
448
|
V,
|
|
449
449
|
{
|
|
450
450
|
onClick: () => E("library"),
|
|
@@ -455,7 +455,7 @@ function wt({
|
|
|
455
455
|
]
|
|
456
456
|
}
|
|
457
457
|
),
|
|
458
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ n(
|
|
459
459
|
V,
|
|
460
460
|
{
|
|
461
461
|
onClick: () => E("both"),
|
|
@@ -491,8 +491,8 @@ function yt({
|
|
|
491
491
|
//labelClassName,
|
|
492
492
|
switchClassName: a
|
|
493
493
|
}) {
|
|
494
|
-
const m = P((l) => l.isDevMode), c = F((l) => l.isVisualEditing), { setIsDevMode: d } = Ce(), { config: u } = ee(Ne).tokenProps,
|
|
495
|
-
return !c || !
|
|
494
|
+
const m = P((l) => l.isDevMode), c = F((l) => l.isVisualEditing), { setIsDevMode: d } = Ce(), { config: u } = ee(Ne).tokenProps, o = (u == null ? void 0 : u.showAdvancedMode) !== !1;
|
|
495
|
+
return !c || !o ? null : /* @__PURE__ */ n("div", { className: U("flex items-center space-x-2", e), children: [
|
|
496
496
|
/* @__PURE__ */ t(
|
|
497
497
|
Ae,
|
|
498
498
|
{
|
|
@@ -514,27 +514,27 @@ function Ct({
|
|
|
514
514
|
onDiscard: c,
|
|
515
515
|
isSaving: d,
|
|
516
516
|
title: u = "Unsaved Changes",
|
|
517
|
-
description:
|
|
517
|
+
description: o = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
518
518
|
cancelLabel: l = "Cancel",
|
|
519
519
|
discardLabel: f = "Discard",
|
|
520
520
|
saveLabel: i = "Save & Close"
|
|
521
521
|
}) {
|
|
522
522
|
return /* @__PURE__ */ t(Ee, { open: e, onOpenChange: (x) => {
|
|
523
523
|
!x && d || a(x);
|
|
524
|
-
}, children: /* @__PURE__ */
|
|
525
|
-
/* @__PURE__ */
|
|
526
|
-
/* @__PURE__ */
|
|
524
|
+
}, children: /* @__PURE__ */ n(Se, { className: "max-w-[520px] border-border/70 p-6", children: [
|
|
525
|
+
/* @__PURE__ */ n(Le, { className: "space-y-3", children: [
|
|
526
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-3", children: [
|
|
527
527
|
/* @__PURE__ */ t("div", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-amber-50 ring-1 ring-amber-200/70", children: /* @__PURE__ */ t(Ie, { className: "h-[18px] w-[18px] text-amber-600" }) }),
|
|
528
528
|
/* @__PURE__ */ t(Te, { className: "text-lg font-semibold tracking-tight", children: u })
|
|
529
529
|
] }),
|
|
530
|
-
/* @__PURE__ */ t(Ue, { className: "text-sm leading-6 text-muted-foreground", children:
|
|
530
|
+
/* @__PURE__ */ t(Ue, { className: "text-sm leading-6 text-muted-foreground", children: o })
|
|
531
531
|
] }),
|
|
532
|
-
/* @__PURE__ */
|
|
532
|
+
/* @__PURE__ */ n(ke, { className: "mt-2 flex-col gap-1.5 sm:flex-row sm:justify-end", children: [
|
|
533
533
|
/* @__PURE__ */ t(
|
|
534
534
|
Fe,
|
|
535
535
|
{
|
|
536
536
|
disabled: d,
|
|
537
|
-
className: "order-1 m-0 h-9 border-border/60 px-4 sm:order-1",
|
|
537
|
+
className: "order-1 m-0 h-auto min-h-9 whitespace-normal border-border/60 px-4 py-2 text-center leading-5 sm:order-1",
|
|
538
538
|
children: l
|
|
539
539
|
}
|
|
540
540
|
),
|
|
@@ -543,7 +543,7 @@ function Ct({
|
|
|
543
543
|
{
|
|
544
544
|
onClick: c,
|
|
545
545
|
disabled: d,
|
|
546
|
-
className: "order-2 h-9 rounded-md border border-destructive/30 bg-destructive/10 px-4 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",
|
|
546
|
+
className: "order-2 h-auto min-h-9 whitespace-normal rounded-md border border-destructive/30 bg-destructive/10 px-4 py-2 text-center text-sm font-medium leading-5 text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",
|
|
547
547
|
children: f
|
|
548
548
|
}
|
|
549
549
|
),
|
|
@@ -552,8 +552,8 @@ function Ct({
|
|
|
552
552
|
{
|
|
553
553
|
onClick: m,
|
|
554
554
|
disabled: d,
|
|
555
|
-
className: "order-3 m-0 h-9 px-4 sm:order-3",
|
|
556
|
-
children: d ? /* @__PURE__ */
|
|
555
|
+
className: "order-3 m-0 h-auto min-h-9 whitespace-normal px-4 py-2 text-center leading-5 sm:order-3",
|
|
556
|
+
children: d ? /* @__PURE__ */ n(O, { children: [
|
|
557
557
|
/* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
558
558
|
"Saving..."
|
|
559
559
|
] }) : i
|
|
@@ -584,7 +584,7 @@ function dt({
|
|
|
584
584
|
default:
|
|
585
585
|
return /* @__PURE__ */ t(H, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
|
|
586
586
|
}
|
|
587
|
-
}, u = B(e.status),
|
|
587
|
+
}, u = B(e.status), o = (() => {
|
|
588
588
|
switch (e.status) {
|
|
589
589
|
case "pending":
|
|
590
590
|
return "Queued...";
|
|
@@ -598,23 +598,23 @@ function dt({
|
|
|
598
598
|
return "Processing...";
|
|
599
599
|
}
|
|
600
600
|
})();
|
|
601
|
-
return /* @__PURE__ */
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */
|
|
601
|
+
return /* @__PURE__ */ n("div", { className: "group p-4 transition-colors hover:bg-muted/50", children: [
|
|
602
|
+
/* @__PURE__ */ n("div", { className: "mb-2 flex items-start justify-between gap-3", children: [
|
|
603
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
|
|
604
604
|
d(),
|
|
605
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
|
|
606
606
|
/* @__PURE__ */ t("h4", { className: "mb-1 truncate text-sm font-medium", children: e.title }),
|
|
607
|
-
e.status === "completed" && /* @__PURE__ */
|
|
608
|
-
/* @__PURE__ */
|
|
607
|
+
e.status === "completed" && /* @__PURE__ */ n("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
608
|
+
/* @__PURE__ */ n("span", { children: [
|
|
609
609
|
e.totalRows.toLocaleString(),
|
|
610
610
|
" rows"
|
|
611
611
|
] }),
|
|
612
|
-
e.fileSize && /* @__PURE__ */
|
|
612
|
+
e.fileSize && /* @__PURE__ */ n(O, { children: [
|
|
613
613
|
/* @__PURE__ */ t("span", { children: "•" }),
|
|
614
614
|
/* @__PURE__ */ t("span", { children: Pe(e.fileSize) })
|
|
615
615
|
] })
|
|
616
616
|
] }),
|
|
617
|
-
u && /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children:
|
|
617
|
+
u && /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: o }),
|
|
618
618
|
e.status === "failed" && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-xs text-destructive", children: e.error || "Export failed" })
|
|
619
619
|
] })
|
|
620
620
|
] }),
|
|
@@ -630,10 +630,10 @@ function dt({
|
|
|
630
630
|
}
|
|
631
631
|
)
|
|
632
632
|
] }),
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
e.status === "completed" && /* @__PURE__ */
|
|
633
|
+
/* @__PURE__ */ n("div", { className: "ml-8", children: [
|
|
634
|
+
e.status === "completed" && /* @__PURE__ */ n("div", { className: "flex items-center justify-between", children: [
|
|
635
635
|
/* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: G(e.startedAt, { addSuffix: !0 }) }),
|
|
636
|
-
e.downloadUrl && /* @__PURE__ */
|
|
636
|
+
e.downloadUrl && /* @__PURE__ */ n(
|
|
637
637
|
I,
|
|
638
638
|
{
|
|
639
639
|
size: "sm",
|
|
@@ -647,9 +647,9 @@ function dt({
|
|
|
647
647
|
}
|
|
648
648
|
)
|
|
649
649
|
] }),
|
|
650
|
-
u && /* @__PURE__ */
|
|
650
|
+
u && /* @__PURE__ */ n("div", { children: [
|
|
651
651
|
/* @__PURE__ */ t(ze, { value: e.progress, className: "h-1.5" }),
|
|
652
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ n("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
|
|
653
653
|
e.progress,
|
|
654
654
|
"% complete"
|
|
655
655
|
] })
|
|
@@ -659,7 +659,7 @@ function dt({
|
|
|
659
659
|
] });
|
|
660
660
|
}
|
|
661
661
|
function ut() {
|
|
662
|
-
const { authToken: e, tokenProps: a } = z(), m = T((p) => p.activeExports), { clearCompleted: c, removeExport: d, updateExport: u } = Q(), [
|
|
662
|
+
const { authToken: e, tokenProps: a } = z(), m = T((p) => p.activeExports), { clearCompleted: c, removeExport: d, updateExport: u } = Q(), [o, l] = D(!1), [f, i] = D(!1), g = Array.from(m.values()).sort(
|
|
663
663
|
(p, y) => y.startedAt.getTime() - p.startedAt.getTime()
|
|
664
664
|
), x = g.some(
|
|
665
665
|
(p) => p.status === "completed" || p.status === "failed"
|
|
@@ -746,17 +746,17 @@ function ut() {
|
|
|
746
746
|
},
|
|
747
747
|
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, d]
|
|
748
748
|
);
|
|
749
|
-
return g.length === 0 ? /* @__PURE__ */
|
|
749
|
+
return g.length === 0 ? /* @__PURE__ */ n("div", { className: "p-6 text-center", children: [
|
|
750
750
|
/* @__PURE__ */ t(X, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
|
|
751
751
|
/* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No active exports" }),
|
|
752
752
|
/* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Large exports will appear here" })
|
|
753
|
-
] }) : /* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
753
|
+
] }) : /* @__PURE__ */ n("div", { className: "flex flex-col", children: [
|
|
754
|
+
/* @__PURE__ */ n("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
|
|
755
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
|
|
756
756
|
/* @__PURE__ */ t(X, { className: "h-5 w-5 text-muted-foreground" }),
|
|
757
757
|
/* @__PURE__ */ t("h4", { className: "font-semibold", children: "Exports" })
|
|
758
758
|
] }),
|
|
759
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1", children: [
|
|
760
760
|
/* @__PURE__ */ t(
|
|
761
761
|
I,
|
|
762
762
|
{
|
|
@@ -764,12 +764,12 @@ function ut() {
|
|
|
764
764
|
size: "sm",
|
|
765
765
|
className: "h-7 w-7 p-0",
|
|
766
766
|
onClick: h,
|
|
767
|
-
disabled:
|
|
767
|
+
disabled: o,
|
|
768
768
|
title: "Refresh status",
|
|
769
769
|
children: /* @__PURE__ */ t(
|
|
770
770
|
$e,
|
|
771
771
|
{
|
|
772
|
-
className: `h-4 w-4 ${
|
|
772
|
+
className: `h-4 w-4 ${o ? "animate-spin" : ""}`
|
|
773
773
|
}
|
|
774
774
|
)
|
|
775
775
|
}
|
|
@@ -802,9 +802,9 @@ function At({
|
|
|
802
802
|
}) {
|
|
803
803
|
const a = T((f) => f.activeExports), m = He(), c = a.size > 0, d = Array.from(a.values()).some(
|
|
804
804
|
(f) => f.status === "completed" || f.status === "failed"
|
|
805
|
-
),
|
|
806
|
-
return /* @__PURE__ */
|
|
807
|
-
/* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */
|
|
805
|
+
), o = m > 0 ? m > 9 ? "9+" : String(m) : null;
|
|
806
|
+
return /* @__PURE__ */ n(_e, { children: [
|
|
807
|
+
/* @__PURE__ */ t(je, { asChild: !0, children: /* @__PURE__ */ n(
|
|
808
808
|
I,
|
|
809
809
|
{
|
|
810
810
|
variant: e ?? "ghost",
|
|
@@ -816,8 +816,8 @@ function At({
|
|
|
816
816
|
c && /* @__PURE__ */ t(
|
|
817
817
|
"span",
|
|
818
818
|
{
|
|
819
|
-
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${
|
|
820
|
-
children:
|
|
819
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${o ? "-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold" : "right-0.5 top-0.5 h-2 w-2"}`,
|
|
820
|
+
children: o
|
|
821
821
|
}
|
|
822
822
|
)
|
|
823
823
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";const f=require("react"),t=require("./index-
|
|
1
|
+
"use strict";const f=require("react"),t=require("./index-CaMze_Fv.js"),e=require("react/jsx-runtime"),A=require("./editor-action-buttons-VdYqRxoT.js"),U=require("./use-visual-utils-BGLcxXJt.js"),I=require("./date-formatter-Sz6QDaM8.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const L=t.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]),V=1e4,M=15e3,P=3e4,R=3e4,B=12e4,T=2*60*60*1e3;function z(s){const r=Date.now()-s.getTime();return r<R?V:r<B?M:P}function O(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(p=>p.activeExports),[c,d]=f.useState(typeof document<"u"?!document.hidden:!0),u=f.useRef(null),n=f.useRef(!1),i=f.useRef(void 0),x=r==null?void 0:r.apiServiceUrl,l=s==null?void 0:s.accessToken,g=f.useCallback(()=>{const p=t.useExportStore.getState().activeExports;return Array.from(p.values()).filter(b=>t.isExportInProgress(b.status))},[]);f.useEffect(()=>{if(typeof document>"u")return;const p=()=>{d(!document.hidden)};return document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}},[]);const j=f.useCallback(async()=>{if(!x||!l){n.current=!1;return}const p=g();if(p.length===0){n.current=!1;return}const b=Date.now(),E=p.filter(a=>b-a.startedAt.getTime()>T);if(E.length>0){const{updateExport:a}=t.useExportStore.getState().actions;for(const o of E)a(o.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const h=p.filter(a=>b-a.startedAt.getTime()<=T);if(h.length===0){n.current=!1;return}const C=await Promise.allSettled(h.map(async a=>{try{const o=await t.getExportStatus(x,l,a.id);let v;if(o.status==="completed")try{v=await t.getDownloadUrl(x,l,a.id)}catch(N){console.error(`[useExportPolling] Failed to get download URL for ${a.id}:`,N)}return{id:a.id,status:o.status,progress:o.progress,completedChunks:o.completedChunks,completedAt:o.completedAt?new Date(o.completedAt):void 0,lastUpdatedAt:new Date,fileSize:o.fileSize,error:o.error,downloadUrl:v}}catch(o){return console.error(`[useExportPolling] Failed to poll export ${a.id}:`,o),null}})),{updateExport:S}=t.useExportStore.getState().actions;for(const a of C)a.status==="fulfilled"&&a.value&&S(a.value.id,a.value);const w=g();if(w.length>0&&!document.hidden){const a=w.reduce((v,N)=>N.startedAt<v?N.startedAt:v,w[0].startedAt),o=z(a);u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{var v;(v=i.current)==null||v.call(i)},o)}else n.current=!1},[x,l,g]);return f.useEffect(()=>{i.current=j},[j]),f.useEffect(()=>{var b;g().length>0&&c&&!n.current&&(n.current=!0,(b=i.current)==null||b.call(i))},[m,c,g]),f.useEffect(()=>{var b;const p=g();c&&p.length>0&&!n.current&&(n.current=!0,(b=i.current)==null||b.call(i))},[c,g]),f.useEffect(()=>{!c&&u.current&&(clearTimeout(u.current),u.current=null,n.current=!1)},[c]),f.useEffect(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]),{isPolling:n.current,isTabVisible:c,inProgressCount:g().length}}function $(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(i=>i.activeExports),{addExport:c}=t.useExportActions(),d=f.useRef(!1),u=r==null?void 0:r.apiServiceUrl,n=s==null?void 0:s.accessToken;f.useEffect(()=>{if(d.current||!u||!n)return;(async()=>{try{const{exports:x}=await t.getExports(u,n,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const l of x){if(m.has(l.id))continue;const g=l.totalChunks?Math.round(l.completedChunks/l.totalChunks*100):0;let j;if(l.status==="completed")try{j=await t.getDownloadUrl(u,n,l.id)}catch(b){console.error(`[useExportRecovery] Failed to get download URL for ${l.id}:`,b)}const p={id:l.id,status:l.status,progress:g,title:q(l),totalRows:l.totalRows,totalChunks:l.totalChunks,completedChunks:l.completedChunks,startedAt:new Date(l.createdAt),lastUpdatedAt:new Date,completedAt:l.completedAt?new Date(l.completedAt):void 0,fileSize:l.fileSize,error:l.error,expiresAt:new Date(l.expiresAt),downloadUrl:j};c(p)}d.current=!0}catch(x){console.error("[useExportRecovery] Failed to recover exports:",x),d.current=!0}})()},[u,n,c,m])}function q(s){return s.title?s.title:t.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function _({open:s,onOpenChange:r,isLibraryVisual:m,currentVisualName:c,isSaving:d=!1,destinationMode:u="both",onConfirm:n}){const[i,x]=f.useState(m&&c?`Copy of ${c}`:c||""),[l,g]=f.useState("");f.useEffect(()=>{s&&(x(m&&c?`Copy of ${c}`:c||""),g(""))},[s,m,c]);const j=!!i.trim(),p=u==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:u==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},b=()=>{!j||d||n({name:i.trim(),description:l.trim()||void 0,saveToLibrary:p.saveToLibrary,saveToCurrentDashboard:p.saveToCurrentDashboard})};return e.jsx(t.Dialog,{open:s,onOpenChange:r,children:e.jsxs(t.DialogContent,{className:"sm:max-w-[500px]",children:[e.jsxs(t.DialogHeader,{children:[e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx("span",{children:"Save Visual As"}),p.badgeType!=="local"&&e.jsx(A.VisualBadge,{type:p.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),e.jsx(t.DialogDescription,{children:p.description})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"name",children:"Name"}),e.jsx(t.Input$1,{id:"name",value:i,onChange:E=>x(E.target.value),placeholder:"Enter visual name",disabled:d})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Textarea,{id:"description",value:l,onChange:E=>g(E.target.value),placeholder:"Enter visual description",rows:3,disabled:d})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>r(!1),disabled:d,children:"Cancel"}),e.jsxs(t.Button,{onClick:b,disabled:!j||d,children:[d&&e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),p.actionLabel]})]})]})})}function H(){const[s,r]=f.useState(!1),[m,c]=f.useState(!1),[d,u]=f.useState(null),n=t.useEditorStore(o=>o.frame),i=t.useEditorStore(o=>o.card),x=t.useSelectedVisual(),l=t.useDashboardStore(o=>o.selectedSheetId),g=t.useDashboardStore(o=>o.actions.setIsDashboardPanelOpen),{getUpdatedFrame:j}=U.useVisualUtils(),{selectVisual:p}=t.useManagementActions(),{addFrame:b,setSelectedFrameId:E,setIsVisualEditing:h}=t.useDashboardActions(),C=!!(n!=null&&n.visualId),S=(()=>{var o,v;return((o=n==null?void 0:n.cards)==null?void 0:o.length)===1&&((v=n.cards[0])!=null&&v.title)?n.cards[0].title:x!=null&&x.title?x.title:(i==null?void 0:i.title)||"Untitled Visual"})(),w=t.useCreateVisualWithFrame(o=>{if(o!=null&&o.id){if(p(o),m&&d&&l){const v={...d,id:t.v4(),visualId:o.id};b(l,v,"end"),E(v.id),c(!1),u(null),h(!1)}g(!0),r(!1)}});return{saveAsDialogOpen:s,setSaveAsDialogOpen:r,handleSaveAs:async o=>{if(!l){t.ue.error("No sheet selected");return}const v=j(),y=v.cards.length===1?{...v,cards:v.cards.map(D=>({...D,title:o.name}))}:v;if(o.saveToLibrary){c(o.saveToCurrentDashboard),u(y);const D={title:o.name,description:o.description,frameObject:y,isPrivate:!1};w.mutate(D)}else if(o.saveToCurrentDashboard){const D={...y,id:t.v4(),visualId:void 0};b(l,D,"end"),E(D.id),t.ue.success("Visual saved to dashboard"),r(!1),h(!1)}},isLibraryVisual:C,currentVisualName:S,isSaving:w.isPending}}function X({className:s}){const r=t.useEditorStore(y=>y.frame),m=t.useManagementStore(y=>y.selectedVisual),c=t.useDashboardStore(y=>y.selectedFrameId),d=t.useDashboardStore(y=>y.selectedSheetId),{setIsVisualEditing:u,updateFrame:n}=t.useDashboardActions(),[i,x]=f.useState(!1),[l,g]=f.useState("both"),j=!!(r!=null&&r.visualId||m!=null&&m.id),p=!!(r!=null&&r.visualId&&c),b=j&&!p,{saveAsDialogOpen:E,setSaveAsDialogOpen:h,handleSaveAs:C,isLibraryVisual:S,currentVisualName:w,isSaving:a}=H(),{getUpdatedFrame:o}=U.useVisualUtils(),v=()=>{if(!d){t.ue.error("No sheet selected");return}if(i)return;x(!0);const D={...o(),visualId:void 0};n(d,D),setTimeout(()=>{x(!1),t.ue.success("Changes applied. Visual is now local to this dashboard"),u(!1)},300)},N=y=>{g(y),h(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-md border border-input",children:[!j&&e.jsx(A.EditorAcceptButton,{className:t.cn(s,"rounded-none border-0"),variant:"default"}),j&&b&&e.jsx(A.VisualSaveButton,{className:t.cn(s,"rounded-none border-0"),variant:"default"}),j&&p&&e.jsx(A.VisualSaveAndApplyButton,{className:t.cn(s,"rounded-none border-0")}),e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{className:"h-8",asChild:!0,children:e.jsx(t.Button,{variant:"default",size:"sm",className:t.cn(s,"w-8 rounded-none border-0 border-l border-primary-foreground/30 px-2"),"aria-label":"Open visual save options",disabled:a||i,children:e.jsx(t.ChevronDown,{className:"h-4 w-4"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",children:[p&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:v,disabled:i,children:[e.jsx(t.Check,{className:"mr-2 h-4 w-4"}),i?"Applying...":"Apply Locally"]}),e.jsx(t.DropdownMenuSeparator,{})]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("local"),disabled:a,children:[e.jsx(t.Plus,{className:"mr-2 h-4 w-4"}),"Add to Dashboard (Local)"]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("library"),disabled:a,children:[e.jsx(A.Library,{className:"mr-2 h-4 w-4"}),"Save as Library Visual"]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("both"),disabled:a,children:[e.jsx(A.Link2,{className:"mr-2 h-4 w-4"}),"Save Copy as Linked Visual"]})]})]})]}),e.jsx(A.EditorCancelButton,{className:s}),e.jsx(_,{open:E,onOpenChange:y=>{a||h(y)},isLibraryVisual:S,currentVisualName:w,isSaving:a,destinationMode:l,onConfirm:C})]})}function G({className:s,switchClassName:r}){const m=t.useEditorStore(i=>i.isDevMode),c=t.useDashboardStore(i=>i.isVisualEditing),{setIsDevMode:d}=t.useEditorActions(),{config:u}=f.useContext(t.SemaphorContext).tokenProps,n=(u==null?void 0:u.showAdvancedMode)!==!1;return!c||!n?null:e.jsxs("div",{className:t.cn("flex items-center space-x-2",s),children:[e.jsx(t.DevModeSwitch,{className:t.cn("",r),checked:m,onCheckedChange:()=>d(!m),id:"advanced-mode",icon:e.jsx(t.CodeXml,{className:"h-4 w-4"}),tooltip:"Advanced Mode"}),e.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function W({open:s,onOpenChange:r,onSave:m,onDiscard:c,isSaving:d,title:u="Unsaved Changes",description:n="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:i="Cancel",discardLabel:x="Discard",saveLabel:l="Save & Close"}){const g=j=>{!j&&d||r(j)};return e.jsx(t.AlertDialog,{open:s,onOpenChange:g,children:e.jsxs(t.AlertDialogContent,{className:"max-w-[520px] border-border/70 p-6",children:[e.jsxs(t.AlertDialogHeader,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-50 ring-1 ring-amber-200/70",children:e.jsx(t.TriangleAlert,{className:"h-[18px] w-[18px] text-amber-600"})}),e.jsx(t.AlertDialogTitle,{className:"text-lg font-semibold tracking-tight",children:u})]}),e.jsx(t.AlertDialogDescription,{className:"text-sm leading-6 text-muted-foreground",children:n})]}),e.jsxs(t.AlertDialogFooter,{className:"mt-2 flex-col gap-1.5 sm:flex-row sm:justify-end",children:[e.jsx(t.AlertDialogCancel,{disabled:d,className:"order-1 m-0 h-9 border-border/60 px-4 sm:order-1",children:i}),e.jsx("button",{onClick:c,disabled:d,className:"order-2 h-9 rounded-md border border-destructive/30 bg-destructive/10 px-4 text-sm font-medium text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",children:x}),e.jsx(t.AlertDialogAction,{onClick:m,disabled:d,className:"order-3 m-0 h-9 px-4 sm:order-3",children:d?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):l})]})]})})}function Q(s,r,m,c){f.useEffect(()=>{s&&!m&&r&&c(t.cloneDeep(r))},[s,m,r,c])}function k({export:s,onRemove:r}){const m=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},c=i=>{i.stopPropagation(),r==null||r(s.id)},d=()=>{switch(s.status){case"completed":return e.jsx(t.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx(A.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(t.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},u=t.isExportInProgress(s.status),n=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[d(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t.formatFileSize(s.fileSize)})]})]}),u&&e.jsx("div",{className:"text-xs text-muted-foreground",children:n}),s.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),e.jsx(t.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:c,"aria-label":"Remove notification",children:e.jsx(t.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&e.jsxs(t.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:m,children:[e.jsx(t.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),u&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:s.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function F(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(h=>h.activeExports),{clearCompleted:c,removeExport:d,updateExport:u}=t.useExportActions(),[n,i]=f.useState(!1),[x,l]=f.useState(!1),g=Array.from(m.values()).sort((h,C)=>C.startedAt.getTime()-h.startedAt.getTime()),j=g.some(h=>h.status==="completed"||h.status==="failed"),p=f.useCallback(async()=>{const h=r==null?void 0:r.apiServiceUrl,C=s==null?void 0:s.accessToken;if(!(!h||!C)){i(!0);try{const S=Array.from(m.values());await Promise.all(S.map(async w=>{try{const a=await t.getExportStatus(h,C,w.id);let o;if(a.status==="completed")try{o=await t.getDownloadUrl(h,C,w.id)}catch(v){console.error(`Failed to get download URL for ${w.id}:`,v)}u(w.id,{status:a.status,progress:a.progress,completedChunks:a.completedChunks,completedAt:a.completedAt?new Date(a.completedAt):void 0,lastUpdatedAt:new Date,fileSize:a.fileSize,error:a.error,downloadUrl:o})}catch(a){console.error(`Failed to refresh export ${w.id}:`,a)}}))}finally{i(!1)}}},[m,s==null?void 0:s.accessToken,r==null?void 0:r.apiServiceUrl,u]),b=f.useCallback(async()=>{const h=r==null?void 0:r.apiServiceUrl,C=s==null?void 0:s.accessToken;if(!h||!C){c();return}l(!0);try{const S=g.filter(a=>a.status==="completed"||a.status==="failed"),w=await Promise.allSettled(S.map(async a=>(await t.cancelExport(h,C,a.id),a.id)));for(const a of w)a.status==="fulfilled"?d(a.value):console.error("Failed to delete export:",a.reason)}finally{l(!1)}},[g,r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,c,d]),E=f.useCallback(async h=>{const C=r==null?void 0:r.apiServiceUrl,S=s==null?void 0:s.accessToken;if(C&&S)try{await t.cancelExport(C,S,h),d(h);return}catch(w){console.error(`Failed to cancel export ${h}:`,w)}d(h)},[r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,d]);return g.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(L,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:p,disabled:n,title:"Refresh status",children:e.jsx(t.RefreshCw,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),j&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:b,disabled:x,children:x?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:g.map(h=>e.jsx(k,{export:h,onRemove:E},h.id))})})]})}function Y({variant:s}){const r=t.useExportStore(x=>x.activeExports),m=t.useInProgressExportsCount(),c=r.size>0,d=Array.from(r.values()).some(x=>x.status==="completed"||x.status==="failed"),n=m>0?m>9?"9+":String(m):null,i=c;return e.jsxs(t.Popover,{children:[e.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxs(t.Button,{variant:s??"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Export notifications",children:[e.jsx(t.Bell,{className:"h-4 w-4"}),i&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${n?"-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold":"right-0.5 top-0.5 h-2 w-2"}`,children:n})]})}),e.jsx(t.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(F,{})})]})}exports.AdvancedModeToggle=G;exports.ExportNotificationItem=k;exports.ExportNotificationList=F;exports.NotificationBell=Y;exports.UnsavedChangesAlert=W;exports.VisualEditingControls=X;exports.useExportPolling=O;exports.useExportRecovery=$;exports.usePristineSnapshotInitializer=Q;
|
|
6
|
+
*/const L=t.createLucideIcon("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]),V=1e4,M=15e3,P=3e4,R=3e4,B=12e4,T=2*60*60*1e3;function z(s){const r=Date.now()-s.getTime();return r<R?V:r<B?M:P}function O(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(p=>p.activeExports),[c,d]=f.useState(typeof document<"u"?!document.hidden:!0),u=f.useRef(null),n=f.useRef(!1),i=f.useRef(void 0),x=r==null?void 0:r.apiServiceUrl,l=s==null?void 0:s.accessToken,g=f.useCallback(()=>{const p=t.useExportStore.getState().activeExports;return Array.from(p.values()).filter(b=>t.isExportInProgress(b.status))},[]);f.useEffect(()=>{if(typeof document>"u")return;const p=()=>{d(!document.hidden)};return document.addEventListener("visibilitychange",p),()=>{document.removeEventListener("visibilitychange",p)}},[]);const j=f.useCallback(async()=>{if(!x||!l){n.current=!1;return}const p=g();if(p.length===0){n.current=!1;return}const b=Date.now(),E=p.filter(a=>b-a.startedAt.getTime()>T);if(E.length>0){const{updateExport:a}=t.useExportStore.getState().actions;for(const o of E)a(o.id,{status:"failed",error:"Export timed out. Please try again or contact support.",lastUpdatedAt:new Date})}const h=p.filter(a=>b-a.startedAt.getTime()<=T);if(h.length===0){n.current=!1;return}const C=await Promise.allSettled(h.map(async a=>{try{const o=await t.getExportStatus(x,l,a.id);let v;if(o.status==="completed")try{v=await t.getDownloadUrl(x,l,a.id)}catch(N){console.error(`[useExportPolling] Failed to get download URL for ${a.id}:`,N)}return{id:a.id,status:o.status,progress:o.progress,completedChunks:o.completedChunks,completedAt:o.completedAt?new Date(o.completedAt):void 0,lastUpdatedAt:new Date,fileSize:o.fileSize,error:o.error,downloadUrl:v}}catch(o){return console.error(`[useExportPolling] Failed to poll export ${a.id}:`,o),null}})),{updateExport:S}=t.useExportStore.getState().actions;for(const a of C)a.status==="fulfilled"&&a.value&&S(a.value.id,a.value);const w=g();if(w.length>0&&!document.hidden){const a=w.reduce((v,N)=>N.startedAt<v?N.startedAt:v,w[0].startedAt),o=z(a);u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{var v;(v=i.current)==null||v.call(i)},o)}else n.current=!1},[x,l,g]);return f.useEffect(()=>{i.current=j},[j]),f.useEffect(()=>{var b;g().length>0&&c&&!n.current&&(n.current=!0,(b=i.current)==null||b.call(i))},[m,c,g]),f.useEffect(()=>{var b;const p=g();c&&p.length>0&&!n.current&&(n.current=!0,(b=i.current)==null||b.call(i))},[c,g]),f.useEffect(()=>{!c&&u.current&&(clearTimeout(u.current),u.current=null,n.current=!1)},[c]),f.useEffect(()=>()=>{u.current&&(clearTimeout(u.current),u.current=null)},[]),{isPolling:n.current,isTabVisible:c,inProgressCount:g().length}}function $(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(i=>i.activeExports),{addExport:c}=t.useExportActions(),d=f.useRef(!1),u=r==null?void 0:r.apiServiceUrl,n=s==null?void 0:s.accessToken;f.useEffect(()=>{if(d.current||!u||!n)return;(async()=>{try{const{exports:x}=await t.getExports(u,n,{status:["pending","processing","chunking","compacting","completed","failed"],limit:20});for(const l of x){if(m.has(l.id))continue;const g=l.totalChunks?Math.round(l.completedChunks/l.totalChunks*100):0;let j;if(l.status==="completed")try{j=await t.getDownloadUrl(u,n,l.id)}catch(b){console.error(`[useExportRecovery] Failed to get download URL for ${l.id}:`,b)}const p={id:l.id,status:l.status,progress:g,title:q(l),totalRows:l.totalRows,totalChunks:l.totalChunks,completedChunks:l.completedChunks,startedAt:new Date(l.createdAt),lastUpdatedAt:new Date,completedAt:l.completedAt?new Date(l.completedAt):void 0,fileSize:l.fileSize,error:l.error,expiresAt:new Date(l.expiresAt),downloadUrl:j};c(p)}d.current=!0}catch(x){console.error("[useExportRecovery] Failed to recover exports:",x),d.current=!0}})()},[u,n,c,m])}function q(s){return s.title?s.title:t.isExportInProgress(s.status)?"Export in progress...":s.status==="completed"?"Export completed":s.status==="failed"?"Export failed":"Export"}function _({open:s,onOpenChange:r,isLibraryVisual:m,currentVisualName:c,isSaving:d=!1,destinationMode:u="both",onConfirm:n}){const[i,x]=f.useState(m&&c?`Copy of ${c}`:c||""),[l,g]=f.useState("");f.useEffect(()=>{s&&(x(m&&c?`Copy of ${c}`:c||""),g(""))},[s,m,c]);const j=!!i.trim(),p=u==="local"?{saveToLibrary:!1,saveToCurrentDashboard:!0,badgeType:"local",description:"Creates a local copy on the current dashboard.",actionLabel:"Add to Dashboard (Local)"}:u==="library"?{saveToLibrary:!0,saveToCurrentDashboard:!1,badgeType:"library",description:"Creates a reusable visual in Visual Library.",actionLabel:"Save as Library Visual"}:{saveToLibrary:!0,saveToCurrentDashboard:!0,badgeType:"linked",description:"Creates a new library visual and adds a linked copy to this dashboard.",actionLabel:"Save Copy as Linked Visual"},b=()=>{!j||d||n({name:i.trim(),description:l.trim()||void 0,saveToLibrary:p.saveToLibrary,saveToCurrentDashboard:p.saveToCurrentDashboard})};return e.jsx(t.Dialog,{open:s,onOpenChange:r,children:e.jsxs(t.DialogContent,{className:"sm:max-w-[500px]",children:[e.jsxs(t.DialogHeader,{children:[e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx("span",{children:"Save Visual As"}),p.badgeType!=="local"&&e.jsx(A.VisualBadge,{type:p.badgeType,showLabel:!0,className:"px-2 py-0.5"})]}),e.jsx(t.DialogDescription,{children:p.description})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"name",children:"Name"}),e.jsx(t.Input$1,{id:"name",value:i,onChange:E=>x(E.target.value),placeholder:"Enter visual name",disabled:d})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(t.Label,{htmlFor:"description",children:"Description (optional)"}),e.jsx(t.Textarea,{id:"description",value:l,onChange:E=>g(E.target.value),placeholder:"Enter visual description",rows:3,disabled:d})]})]}),e.jsxs(t.DialogFooter,{children:[e.jsx(t.Button,{variant:"outline",onClick:()=>r(!1),disabled:d,children:"Cancel"}),e.jsxs(t.Button,{onClick:b,disabled:!j||d,children:[d&&e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),p.actionLabel]})]})]})})}function H(){const[s,r]=f.useState(!1),[m,c]=f.useState(!1),[d,u]=f.useState(null),n=t.useEditorStore(o=>o.frame),i=t.useEditorStore(o=>o.card),x=t.useSelectedVisual(),l=t.useDashboardStore(o=>o.selectedSheetId),g=t.useDashboardStore(o=>o.actions.setIsDashboardPanelOpen),{getUpdatedFrame:j}=U.useVisualUtils(),{selectVisual:p}=t.useManagementActions(),{addFrame:b,setSelectedFrameId:E,setIsVisualEditing:h}=t.useDashboardActions(),C=!!(n!=null&&n.visualId),S=(()=>{var o,v;return((o=n==null?void 0:n.cards)==null?void 0:o.length)===1&&((v=n.cards[0])!=null&&v.title)?n.cards[0].title:x!=null&&x.title?x.title:(i==null?void 0:i.title)||"Untitled Visual"})(),w=t.useCreateVisualWithFrame(o=>{if(o!=null&&o.id){if(p(o),m&&d&&l){const v={...d,id:t.v4(),visualId:o.id};b(l,v,"end"),E(v.id),c(!1),u(null),h(!1)}g(!0),r(!1)}});return{saveAsDialogOpen:s,setSaveAsDialogOpen:r,handleSaveAs:async o=>{if(!l){t.ue.error("No sheet selected");return}const v=j(),y=v.cards.length===1?{...v,cards:v.cards.map(D=>({...D,title:o.name}))}:v;if(o.saveToLibrary){c(o.saveToCurrentDashboard),u(y);const D={title:o.name,description:o.description,frameObject:y,isPrivate:!1};w.mutate(D)}else if(o.saveToCurrentDashboard){const D={...y,id:t.v4(),visualId:void 0};b(l,D,"end"),E(D.id),t.ue.success("Visual saved to dashboard"),r(!1),h(!1)}},isLibraryVisual:C,currentVisualName:S,isSaving:w.isPending}}function X({className:s}){const r=t.useEditorStore(y=>y.frame),m=t.useManagementStore(y=>y.selectedVisual),c=t.useDashboardStore(y=>y.selectedFrameId),d=t.useDashboardStore(y=>y.selectedSheetId),{setIsVisualEditing:u,updateFrame:n}=t.useDashboardActions(),[i,x]=f.useState(!1),[l,g]=f.useState("both"),j=!!(r!=null&&r.visualId||m!=null&&m.id),p=!!(r!=null&&r.visualId&&c),b=j&&!p,{saveAsDialogOpen:E,setSaveAsDialogOpen:h,handleSaveAs:C,isLibraryVisual:S,currentVisualName:w,isSaving:a}=H(),{getUpdatedFrame:o}=U.useVisualUtils(),v=()=>{if(!d){t.ue.error("No sheet selected");return}if(i)return;x(!0);const D={...o(),visualId:void 0};n(d,D),setTimeout(()=>{x(!1),t.ue.success("Changes applied. Visual is now local to this dashboard"),u(!1)},300)},N=y=>{g(y),h(!0)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"inline-flex items-center overflow-hidden rounded-md border border-input",children:[!j&&e.jsx(A.EditorAcceptButton,{className:t.cn(s,"rounded-none border-0"),variant:"default"}),j&&b&&e.jsx(A.VisualSaveButton,{className:t.cn(s,"rounded-none border-0"),variant:"default"}),j&&p&&e.jsx(A.VisualSaveAndApplyButton,{className:t.cn(s,"rounded-none border-0")}),e.jsxs(t.DropdownMenu,{modal:!1,children:[e.jsx(t.DropdownMenuTrigger,{className:"h-8",asChild:!0,children:e.jsx(t.Button,{variant:"default",size:"sm",className:t.cn(s,"w-8 rounded-none border-0 border-l border-primary-foreground/30 px-2"),"aria-label":"Open visual save options",disabled:a||i,children:e.jsx(t.ChevronDown,{className:"h-4 w-4"})})}),e.jsxs(t.DropdownMenuContent,{align:"end",children:[p&&e.jsxs(e.Fragment,{children:[e.jsxs(t.DropdownMenuItem,{onClick:v,disabled:i,children:[e.jsx(t.Check,{className:"mr-2 h-4 w-4"}),i?"Applying...":"Apply Locally"]}),e.jsx(t.DropdownMenuSeparator,{})]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("local"),disabled:a,children:[e.jsx(t.Plus,{className:"mr-2 h-4 w-4"}),"Add to Dashboard (Local)"]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("library"),disabled:a,children:[e.jsx(A.Library,{className:"mr-2 h-4 w-4"}),"Save as Library Visual"]}),e.jsxs(t.DropdownMenuItem,{onClick:()=>N("both"),disabled:a,children:[e.jsx(A.Link2,{className:"mr-2 h-4 w-4"}),"Save Copy as Linked Visual"]})]})]})]}),e.jsx(A.EditorCancelButton,{className:s}),e.jsx(_,{open:E,onOpenChange:y=>{a||h(y)},isLibraryVisual:S,currentVisualName:w,isSaving:a,destinationMode:l,onConfirm:C})]})}function G({className:s,switchClassName:r}){const m=t.useEditorStore(i=>i.isDevMode),c=t.useDashboardStore(i=>i.isVisualEditing),{setIsDevMode:d}=t.useEditorActions(),{config:u}=f.useContext(t.SemaphorContext).tokenProps,n=(u==null?void 0:u.showAdvancedMode)!==!1;return!c||!n?null:e.jsxs("div",{className:t.cn("flex items-center space-x-2",s),children:[e.jsx(t.DevModeSwitch,{className:t.cn("",r),checked:m,onCheckedChange:()=>d(!m),id:"advanced-mode",icon:e.jsx(t.CodeXml,{className:"h-4 w-4"}),tooltip:"Advanced Mode"}),e.jsx("label",{htmlFor:"advanced-mode",className:"sr-only",children:"Advanced Mode"})]})}function W({open:s,onOpenChange:r,onSave:m,onDiscard:c,isSaving:d,title:u="Unsaved Changes",description:n="You have unsaved changes to this dashboard. What would you like to do?",cancelLabel:i="Cancel",discardLabel:x="Discard",saveLabel:l="Save & Close"}){const g=j=>{!j&&d||r(j)};return e.jsx(t.AlertDialog,{open:s,onOpenChange:g,children:e.jsxs(t.AlertDialogContent,{className:"max-w-[520px] border-border/70 p-6",children:[e.jsxs(t.AlertDialogHeader,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-amber-50 ring-1 ring-amber-200/70",children:e.jsx(t.TriangleAlert,{className:"h-[18px] w-[18px] text-amber-600"})}),e.jsx(t.AlertDialogTitle,{className:"text-lg font-semibold tracking-tight",children:u})]}),e.jsx(t.AlertDialogDescription,{className:"text-sm leading-6 text-muted-foreground",children:n})]}),e.jsxs(t.AlertDialogFooter,{className:"mt-2 flex-col gap-1.5 sm:flex-row sm:justify-end",children:[e.jsx(t.AlertDialogCancel,{disabled:d,className:"order-1 m-0 h-auto min-h-9 whitespace-normal border-border/60 px-4 py-2 text-center leading-5 sm:order-1",children:i}),e.jsx("button",{onClick:c,disabled:d,className:"order-2 h-auto min-h-9 whitespace-normal rounded-md border border-destructive/30 bg-destructive/10 px-4 py-2 text-center text-sm font-medium leading-5 text-destructive transition-colors hover:bg-destructive/20 disabled:pointer-events-none disabled:opacity-50 sm:order-2",children:x}),e.jsx(t.AlertDialogAction,{onClick:m,disabled:d,className:"order-3 m-0 h-auto min-h-9 whitespace-normal px-4 py-2 text-center leading-5 sm:order-3",children:d?e.jsxs(e.Fragment,{children:[e.jsx(t.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):l})]})]})})}function Q(s,r,m,c){f.useEffect(()=>{s&&!m&&r&&c(t.cloneDeep(r))},[s,m,r,c])}function k({export:s,onRemove:r}){const m=()=>{s.downloadUrl&&window.open(s.downloadUrl,"_blank")},c=i=>{i.stopPropagation(),r==null||r(s.id)},d=()=>{switch(s.status){case"completed":return e.jsx(t.CircleCheck,{className:"mt-0.5 h-5 w-5 shrink-0 text-green-600"});case"failed":return e.jsx(A.CircleX,{className:"mt-0.5 h-5 w-5 shrink-0 text-destructive"});default:return e.jsx(t.LoaderCircle,{className:"text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin"})}},u=t.isExportInProgress(s.status),n=(()=>{switch(s.status){case"pending":return"Queued...";case"processing":return"Processing...";case"chunking":return"Processing...";case"compacting":return"Finalizing...";default:return"Processing..."}})();return e.jsxs("div",{className:"group p-4 transition-colors hover:bg-muted/50",children:[e.jsxs("div",{className:"mb-2 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[d(),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"mb-1 truncate text-sm font-medium",children:s.title}),s.status==="completed"&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[s.totalRows.toLocaleString()," rows"]}),s.fileSize&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"•"}),e.jsx("span",{children:t.formatFileSize(s.fileSize)})]})]}),u&&e.jsx("div",{className:"text-xs text-muted-foreground",children:n}),s.status==="failed"&&e.jsx("div",{className:"line-clamp-2 text-xs text-destructive",children:s.error||"Export failed"})]})]}),e.jsx(t.Button,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",onClick:c,"aria-label":"Remove notification",children:e.jsx(t.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"ml-8",children:[s.status==="completed"&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})}),s.downloadUrl&&e.jsxs(t.Button,{size:"sm",variant:"outline",className:"h-8 bg-transparent",onClick:m,children:[e.jsx(t.Download,{className:"mr-1.5 h-3.5 w-3.5"}),"Download"]})]}),u&&e.jsxs("div",{children:[e.jsx(t.Progress,{value:s.progress,className:"h-1.5"}),e.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[s.progress,"% complete"]})]}),s.status==="failed"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:I.formatDistanceToNow(s.startedAt,{addSuffix:!0})})]})]})}function F(){const{authToken:s,tokenProps:r}=t.useSemaphorContext(),m=t.useExportStore(h=>h.activeExports),{clearCompleted:c,removeExport:d,updateExport:u}=t.useExportActions(),[n,i]=f.useState(!1),[x,l]=f.useState(!1),g=Array.from(m.values()).sort((h,C)=>C.startedAt.getTime()-h.startedAt.getTime()),j=g.some(h=>h.status==="completed"||h.status==="failed"),p=f.useCallback(async()=>{const h=r==null?void 0:r.apiServiceUrl,C=s==null?void 0:s.accessToken;if(!(!h||!C)){i(!0);try{const S=Array.from(m.values());await Promise.all(S.map(async w=>{try{const a=await t.getExportStatus(h,C,w.id);let o;if(a.status==="completed")try{o=await t.getDownloadUrl(h,C,w.id)}catch(v){console.error(`Failed to get download URL for ${w.id}:`,v)}u(w.id,{status:a.status,progress:a.progress,completedChunks:a.completedChunks,completedAt:a.completedAt?new Date(a.completedAt):void 0,lastUpdatedAt:new Date,fileSize:a.fileSize,error:a.error,downloadUrl:o})}catch(a){console.error(`Failed to refresh export ${w.id}:`,a)}}))}finally{i(!1)}}},[m,s==null?void 0:s.accessToken,r==null?void 0:r.apiServiceUrl,u]),b=f.useCallback(async()=>{const h=r==null?void 0:r.apiServiceUrl,C=s==null?void 0:s.accessToken;if(!h||!C){c();return}l(!0);try{const S=g.filter(a=>a.status==="completed"||a.status==="failed"),w=await Promise.allSettled(S.map(async a=>(await t.cancelExport(h,C,a.id),a.id)));for(const a of w)a.status==="fulfilled"?d(a.value):console.error("Failed to delete export:",a.reason)}finally{l(!1)}},[g,r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,c,d]),E=f.useCallback(async h=>{const C=r==null?void 0:r.apiServiceUrl,S=s==null?void 0:s.accessToken;if(C&&S)try{await t.cancelExport(C,S,h),d(h);return}catch(w){console.error(`Failed to cancel export ${h}:`,w)}d(h)},[r==null?void 0:r.apiServiceUrl,s==null?void 0:s.accessToken,d]);return g.length===0?e.jsxs("div",{className:"p-6 text-center",children:[e.jsx(L,{className:"mx-auto mb-2 h-8 w-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No active exports"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Large exports will appear here"})]}):e.jsxs("div",{className:"flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{className:"h-5 w-5 text-muted-foreground"}),e.jsx("h4",{className:"font-semibold",children:"Exports"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:p,disabled:n,title:"Refresh status",children:e.jsx(t.RefreshCw,{className:`h-4 w-4 ${n?"animate-spin":""}`})}),j&&e.jsx(t.Button,{variant:"ghost",size:"sm",className:"h-7 px-2 text-sm",onClick:b,disabled:x,children:x?"Clearing...":"Clear all"})]})]}),e.jsx("div",{className:"max-h-[350px] overflow-y-auto",children:e.jsx("div",{className:"divide-y",children:g.map(h=>e.jsx(k,{export:h,onRemove:E},h.id))})})]})}function Y({variant:s}){const r=t.useExportStore(x=>x.activeExports),m=t.useInProgressExportsCount(),c=r.size>0,d=Array.from(r.values()).some(x=>x.status==="completed"||x.status==="failed"),n=m>0?m>9?"9+":String(m):null,i=c;return e.jsxs(t.Popover,{children:[e.jsx(t.PopoverTrigger,{asChild:!0,children:e.jsxs(t.Button,{variant:s??"ghost",size:"icon",className:"relative h-8 w-8","aria-label":"Export notifications",children:[e.jsx(t.Bell,{className:"h-4 w-4"}),i&&e.jsx("span",{className:`absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${n?"-right-0.5 -top-0.5 h-4 min-w-4 px-0.5 text-[10px] font-semibold":"right-0.5 top-0.5 h-2 w-2"}`,children:n})]})}),e.jsx(t.PopoverContent,{className:"w-80 p-0",align:"end",sideOffset:8,children:e.jsx(F,{})})]})}exports.AdvancedModeToggle=G;exports.ExportNotificationItem=k;exports.ExportNotificationList=F;exports.NotificationBell=Y;exports.UnsavedChangesAlert=W;exports.VisualEditingControls=X;exports.useExportPolling=O;exports.useExportRecovery=$;exports.usePristineSnapshotInitializer=Q;
|
package/dist/chunks/{resource-management-panel-QdAeim78.js → resource-management-panel-BA9mZ15S.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CaMze_Fv.js"),c=require("react"),le=require("./use-visual-utils-BGLcxXJt.js"),he=require("./use-role-aware-display-preferences-DwKQjD_K.js");/**
|
|
2
2
|
* @license lucide-react v0.453.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
package/dist/chunks/{resource-management-panel-LBCXiHZk.js → resource-management-panel-DvAjwK0C.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
-
import { bS as _e, u as ie, a1 as Ge, W as le, c5 as qe, c6 as Ke, c as re, B as U, c7 as pe, c8 as We, c9 as Ye, ca as Ze, cb as $e, cc as Z, H as de, cd as Je, ce as Qe, cf as Xe, cg as ve, ch as De, ci as ke, cj as et, ck as ye, e as ce, cl as be, cm as Se, cn as tt, an as Ee, aj as Ve, co as Le, cp as Ae, cq as Oe, cr as Te, cs as Re, ct as Pe, cu as Ue, cv as je, cw as Fe, cx as st, cy as nt, ah as ae, l as at, cz as Ie, cA as it, m as rt, n as ot, o as lt, p as dt, q as ct, L as Ce, cB as fe, G as ut, cC as ht, cD as mt, cE as pt, bZ as ft, b_ as gt, b$ as Dt, c1 as xt, cF as Nt, cG as wt } from "./index-
|
|
2
|
+
import { bS as _e, u as ie, a1 as Ge, W as le, c5 as qe, c6 as Ke, c as re, B as U, c7 as pe, c8 as We, c9 as Ye, ca as Ze, cb as $e, cc as Z, H as de, cd as Je, ce as Qe, cf as Xe, cg as ve, ch as De, ci as ke, cj as et, ck as ye, e as ce, cl as be, cm as Se, cn as tt, an as Ee, aj as Ve, co as Le, cp as Ae, cq as Oe, cr as Te, cs as Re, ct as Pe, cu as Ue, cv as je, cw as Fe, cx as st, cy as nt, ah as ae, l as at, cz as Ie, cA as it, m as rt, n as ot, o as lt, p as dt, q as ct, L as Ce, cB as fe, G as ut, cC as ht, cD as mt, cE as pt, bZ as ft, b_ as gt, b$ as Dt, c1 as xt, cF as Nt, cG as wt } from "./index-C-8cXK5u.js";
|
|
3
3
|
import vt, { useRef as Ct, useEffect as oe, useState as N } from "react";
|
|
4
|
-
import { a as Me } from "./use-visual-utils-
|
|
5
|
-
import { u as yt } from "./use-role-aware-display-preferences-
|
|
4
|
+
import { a as Me } from "./use-visual-utils-RZ4Nj11p.js";
|
|
5
|
+
import { u as yt } from "./use-role-aware-display-preferences-CdXcQxZk.js";
|
|
6
6
|
/**
|
|
7
7
|
* @license lucide-react v0.453.0 - ISC
|
|
8
8
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-
|
|
1
|
+
import { b as m, e as t, g as D, f as U, h as b, i as u, j as E, k as g } from "./index-C-8cXK5u.js";
|
|
2
2
|
import { useMemo as i } from "react";
|
|
3
3
|
function S() {
|
|
4
4
|
const { displayPreferences: n, shouldShowElement: c } = m(), { currentUser: a, userContext: s } = t(), r = i(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=require("./index-
|
|
1
|
+
"use strict";const a=require("./index-CaMze_Fv.js"),n=require("react");function f(){const{displayPreferences:c,shouldShowElement:o}=a.useDisplayPreferences(),{currentUser:e,userContext:s}=a.useCurrentUserInfo(),i=n.useMemo(()=>a.getRoleBasedDisplayOverrides(e),[e]),t=n.useMemo(()=>r=>i&&i[r]!==void 0&&i[r]===!1?!1:o(r),[i,o,c]),p=n.useMemo(()=>{var r,d,l,u,h;return{canEdit:((r=s==null?void 0:s.permissions)==null?void 0:r.canEdit)??a.canUserEdit(e),canUseFilters:((d=s==null?void 0:s.permissions)==null?void 0:d.canEdit)??a.canUserUseFilters(e),canManageDashboards:((l=s==null?void 0:s.permissions)==null?void 0:l.canCreateDashboard)??a.canUserManageDashboards(e),canCreateDashboards:((u=s==null?void 0:s.permissions)==null?void 0:u.canCreateDashboard)??a.canUserCreateDashboards(e),canAccessVisuals:((h=s==null?void 0:s.permissions)==null?void 0:h.canEdit)??a.canUserAccessVisuals(e)}},[e,s]);return{displayPreferences:c,shouldShowElement:t,permissions:p,currentUser:e}}exports.useRoleAwareDisplayPreferences=f;
|