react-semaphor 0.1.284 → 0.1.286
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-4pDdG3me.js → dashboard-controls-ItYogy_p.js} +4 -4
- package/dist/chunks/{dashboard-controls-Dhry2k8x.js → dashboard-controls-L0PZjJCt.js} +318 -341
- package/dist/chunks/dashboard-filter-controls-button-BBM66Kjx.js +1107 -0
- package/dist/chunks/dashboard-filter-controls-button-C0aCuD2T.js +11 -0
- package/dist/chunks/{dashboard-json-CYnf5rdp.js → dashboard-json-BQ-vAiN1.js} +1 -1
- package/dist/chunks/{dashboard-json-D-KsLEGl.js → dashboard-json-DVGKEKGc.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-B4jsBFro.js → dashboard-summary-settings-dialog-DlXqW4ur.js} +1 -1
- package/dist/chunks/{dashboard-summary-settings-dialog-Cn4-fB2h.js → dashboard-summary-settings-dialog-jRhWndnZ.js} +1 -1
- package/dist/chunks/{edit-dashboard-visual-BQnApBvr.js → edit-dashboard-visual-BFIX635s.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-BDIt_S2F.js → edit-dashboard-visual-DOyPqIRy.js} +4 -4
- package/dist/chunks/{index-DBuN9Zf6.js → index-5fuOmhsI.js} +170 -170
- package/dist/chunks/{index-y1uW2fuZ.js → index-BJLFSwZr.js} +10190 -10214
- package/dist/chunks/resource-management-panel-DMIhpLZ1.js +933 -0
- package/dist/chunks/resource-management-panel-DPJ6MzLA.js +6 -0
- package/dist/chunks/{use-create-flow-overlay-state-Cr9AFdXx.js → use-create-flow-overlay-state-BU00QaON.js} +142 -145
- package/dist/chunks/use-create-flow-overlay-state-CvuLpw1f.js +21 -0
- package/dist/chunks/{use-visual-utils-DNp8XO6G.js → use-visual-utils-DUV4E_sx.js} +1 -1
- package/dist/chunks/{use-visual-utils-Ccmzx7-m.js → use-visual-utils-DlwYqcbg.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/dist/types/main.d.ts +18 -2
- package/package.json +1 -1
- package/dist/chunks/dashboard-filter-controls-button-BZXrmJP2.js +0 -1072
- package/dist/chunks/dashboard-filter-controls-button-DEUvxIWD.js +0 -11
- package/dist/chunks/resource-management-panel-BC-cvjI9.js +0 -920
- package/dist/chunks/resource-management-panel-PSvKnmq5.js +0 -6
- package/dist/chunks/use-create-flow-overlay-state-COe7Ekru.js +0 -21
|
@@ -0,0 +1,1107 @@
|
|
|
1
|
+
import ge, { useState as L, useRef as O, useCallback as M, useEffect as F, useContext as be } from "react";
|
|
2
|
+
import { bM as ee, b as _, aC as k, bJ as $, bF as te, bG as j, aD as ae, bE as xe, d as se, e as re, f as oe, g as ne, h as ie, L as K, I as Ce, d8 as we, v as ye, B as S, w as H, U as R, J as Ne, u as z, K as De, N as X, d9 as Ae, da as W, x as P, b_ as le, af as Se, cC as de, cD as ce, a6 as ue, cF as he, cG as U, s as Ee, cK as Ie, ct as Le, M as Fe, db as Te, c as V, dc as G, dd as ke, cS as Ue, cT as Ve, cU as Me, cV as Pe, cW as ze, cX as Be, cY as Oe, as as Re, bL as _e, X as $e, de as je, df as He, cz as Xe, bH as q, a8 as Ge, aF as Ke, P as me, j as pe, dg as We, l as fe, dh as qe, di as Je, dj as Qe, dk as Ye, dl as Ze, dm as J, dn as et } from "./index-BJLFSwZr.js";
|
|
3
|
+
import { jsx as t, jsxs as s, Fragment as B } from "react/jsx-runtime";
|
|
4
|
+
import { V as tt, E as at, a as st, b as rt, L as ot, c as nt, d as it, C as lt, u as dt, e as ct } from "./use-create-flow-overlay-state-BU00QaON.js";
|
|
5
|
+
import { u as ve } from "./use-visual-utils-DlwYqcbg.js";
|
|
6
|
+
import { k as Q } from "./date-formatter-vkCj9Ct-.js";
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.453.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
const Y = ee("FileDown", [
|
|
14
|
+
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
15
|
+
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
16
|
+
["path", { d: "M12 18v-6", key: "17g6i2" }],
|
|
17
|
+
["path", { d: "m9 15 3 3 3-3", key: "1npd3o" }]
|
|
18
|
+
]);
|
|
19
|
+
/**
|
|
20
|
+
* @license lucide-react v0.453.0 - ISC
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the ISC license.
|
|
23
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
24
|
+
*/
|
|
25
|
+
const ut = ee("FilterX", [
|
|
26
|
+
["path", { d: "M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055", key: "1fi1da" }],
|
|
27
|
+
["path", { d: "m22 3-5 5", key: "12jva0" }],
|
|
28
|
+
["path", { d: "m17 3 5 5", key: "k36vhe" }]
|
|
29
|
+
]), ht = 1e4, mt = 15e3, pt = 3e4, ft = 3e4, vt = 12e4, Z = 2 * 60 * 60 * 1e3;
|
|
30
|
+
function gt(e) {
|
|
31
|
+
const a = Date.now() - e.getTime();
|
|
32
|
+
return a < ft ? ht : a < vt ? mt : pt;
|
|
33
|
+
}
|
|
34
|
+
function Ft() {
|
|
35
|
+
const { authToken: e, tokenProps: a } = _(), p = k((m) => m.activeExports), [d, l] = L(
|
|
36
|
+
typeof document < "u" ? !document.hidden : !0
|
|
37
|
+
), h = O(null), o = O(!1), c = O(void 0), u = a == null ? void 0 : a.apiServiceUrl, n = e == null ? void 0 : e.accessToken, v = M(() => {
|
|
38
|
+
const m = k.getState().activeExports;
|
|
39
|
+
return Array.from(m.values()).filter(
|
|
40
|
+
(x) => $(x.status)
|
|
41
|
+
);
|
|
42
|
+
}, []);
|
|
43
|
+
F(() => {
|
|
44
|
+
if (typeof document > "u") return;
|
|
45
|
+
const m = () => {
|
|
46
|
+
l(!document.hidden);
|
|
47
|
+
};
|
|
48
|
+
return document.addEventListener("visibilitychange", m), () => {
|
|
49
|
+
document.removeEventListener("visibilitychange", m);
|
|
50
|
+
};
|
|
51
|
+
}, []);
|
|
52
|
+
const b = M(async () => {
|
|
53
|
+
if (!u || !n) {
|
|
54
|
+
o.current = !1;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const m = v();
|
|
58
|
+
if (m.length === 0) {
|
|
59
|
+
o.current = !1;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const x = Date.now(), N = m.filter(
|
|
63
|
+
(r) => x - r.startedAt.getTime() > Z
|
|
64
|
+
);
|
|
65
|
+
if (N.length > 0) {
|
|
66
|
+
const { updateExport: r } = k.getState().actions;
|
|
67
|
+
for (const i of N)
|
|
68
|
+
r(i.id, {
|
|
69
|
+
status: "failed",
|
|
70
|
+
error: "Export timed out. Please try again or contact support.",
|
|
71
|
+
lastUpdatedAt: /* @__PURE__ */ new Date()
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const f = m.filter(
|
|
75
|
+
(r) => x - r.startedAt.getTime() <= Z
|
|
76
|
+
);
|
|
77
|
+
if (f.length === 0) {
|
|
78
|
+
o.current = !1;
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const w = await Promise.allSettled(
|
|
82
|
+
f.map(async (r) => {
|
|
83
|
+
try {
|
|
84
|
+
const i = await te(u, n, r.id);
|
|
85
|
+
let g;
|
|
86
|
+
if (i.status === "completed")
|
|
87
|
+
try {
|
|
88
|
+
g = await j(u, n, r.id);
|
|
89
|
+
} catch (I) {
|
|
90
|
+
console.error(
|
|
91
|
+
`[useExportPolling] Failed to get download URL for ${r.id}:`,
|
|
92
|
+
I
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
id: r.id,
|
|
97
|
+
status: i.status,
|
|
98
|
+
progress: i.progress,
|
|
99
|
+
completedChunks: i.completedChunks,
|
|
100
|
+
completedAt: i.completedAt ? new Date(i.completedAt) : void 0,
|
|
101
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
102
|
+
fileSize: i.fileSize,
|
|
103
|
+
error: i.error,
|
|
104
|
+
downloadUrl: g
|
|
105
|
+
};
|
|
106
|
+
} catch (i) {
|
|
107
|
+
return console.error(
|
|
108
|
+
`[useExportPolling] Failed to poll export ${r.id}:`,
|
|
109
|
+
i
|
|
110
|
+
), null;
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
), { updateExport: E } = k.getState().actions;
|
|
114
|
+
for (const r of w)
|
|
115
|
+
r.status === "fulfilled" && r.value && E(r.value.id, r.value);
|
|
116
|
+
const C = v();
|
|
117
|
+
if (C.length > 0 && !document.hidden) {
|
|
118
|
+
const r = C.reduce(
|
|
119
|
+
(g, I) => I.startedAt < g ? I.startedAt : g,
|
|
120
|
+
C[0].startedAt
|
|
121
|
+
), i = gt(r);
|
|
122
|
+
h.current && clearTimeout(h.current), h.current = setTimeout(() => {
|
|
123
|
+
var g;
|
|
124
|
+
(g = c.current) == null || g.call(c);
|
|
125
|
+
}, i);
|
|
126
|
+
} else
|
|
127
|
+
o.current = !1;
|
|
128
|
+
}, [u, n, v]);
|
|
129
|
+
return F(() => {
|
|
130
|
+
c.current = b;
|
|
131
|
+
}, [b]), F(() => {
|
|
132
|
+
var x;
|
|
133
|
+
v().length > 0 && d && !o.current && (o.current = !0, (x = c.current) == null || x.call(c));
|
|
134
|
+
}, [p, d, v]), F(() => {
|
|
135
|
+
var x;
|
|
136
|
+
const m = v();
|
|
137
|
+
d && m.length > 0 && !o.current && (o.current = !0, (x = c.current) == null || x.call(c));
|
|
138
|
+
}, [d, v]), F(() => {
|
|
139
|
+
!d && h.current && (clearTimeout(h.current), h.current = null, o.current = !1);
|
|
140
|
+
}, [d]), F(() => () => {
|
|
141
|
+
h.current && (clearTimeout(h.current), h.current = null);
|
|
142
|
+
}, []), {
|
|
143
|
+
isPolling: o.current,
|
|
144
|
+
isTabVisible: d,
|
|
145
|
+
inProgressCount: v().length
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function Tt() {
|
|
149
|
+
const { authToken: e, tokenProps: a } = _(), p = k((c) => c.activeExports), { addExport: d } = ae(), l = O(!1), h = a == null ? void 0 : a.apiServiceUrl, o = e == null ? void 0 : e.accessToken;
|
|
150
|
+
F(() => {
|
|
151
|
+
if (l.current || !h || !o) return;
|
|
152
|
+
(async () => {
|
|
153
|
+
try {
|
|
154
|
+
const { exports: u } = await xe(h, o, {
|
|
155
|
+
status: ["pending", "processing", "chunking", "compacting", "completed", "failed"],
|
|
156
|
+
limit: 20
|
|
157
|
+
// Limit to recent exports
|
|
158
|
+
});
|
|
159
|
+
for (const n of u) {
|
|
160
|
+
if (p.has(n.id)) continue;
|
|
161
|
+
const v = n.totalChunks ? Math.round(n.completedChunks / n.totalChunks * 100) : 0;
|
|
162
|
+
let b;
|
|
163
|
+
if (n.status === "completed")
|
|
164
|
+
try {
|
|
165
|
+
b = await j(h, o, n.id);
|
|
166
|
+
} catch (x) {
|
|
167
|
+
console.error(
|
|
168
|
+
`[useExportRecovery] Failed to get download URL for ${n.id}:`,
|
|
169
|
+
x
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const m = {
|
|
173
|
+
id: n.id,
|
|
174
|
+
status: n.status,
|
|
175
|
+
progress: v,
|
|
176
|
+
title: bt(n),
|
|
177
|
+
totalRows: n.totalRows,
|
|
178
|
+
totalChunks: n.totalChunks,
|
|
179
|
+
completedChunks: n.completedChunks,
|
|
180
|
+
startedAt: new Date(n.createdAt),
|
|
181
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
182
|
+
completedAt: n.completedAt ? new Date(n.completedAt) : void 0,
|
|
183
|
+
fileSize: n.fileSize,
|
|
184
|
+
error: n.error,
|
|
185
|
+
expiresAt: new Date(n.expiresAt),
|
|
186
|
+
downloadUrl: b
|
|
187
|
+
};
|
|
188
|
+
d(m);
|
|
189
|
+
}
|
|
190
|
+
l.current = !0;
|
|
191
|
+
} catch (u) {
|
|
192
|
+
console.error("[useExportRecovery] Failed to recover exports:", u), l.current = !0;
|
|
193
|
+
}
|
|
194
|
+
})();
|
|
195
|
+
}, [h, o, d, p]);
|
|
196
|
+
}
|
|
197
|
+
function bt(e) {
|
|
198
|
+
return e.title ? e.title : $(
|
|
199
|
+
e.status
|
|
200
|
+
) ? "Export in progress..." : e.status === "completed" ? "Export completed" : e.status === "failed" ? "Export failed" : "Export";
|
|
201
|
+
}
|
|
202
|
+
function xt({
|
|
203
|
+
open: e,
|
|
204
|
+
onOpenChange: a,
|
|
205
|
+
isLibraryVisual: p,
|
|
206
|
+
currentVisualName: d,
|
|
207
|
+
isSaving: l = !1,
|
|
208
|
+
destinationMode: h = "both",
|
|
209
|
+
onConfirm: o
|
|
210
|
+
}) {
|
|
211
|
+
const [c, u] = L(
|
|
212
|
+
p && d ? `Copy of ${d}` : d || ""
|
|
213
|
+
), [n, v] = L("");
|
|
214
|
+
ge.useEffect(() => {
|
|
215
|
+
e && (u(
|
|
216
|
+
p && d ? `Copy of ${d}` : d || ""
|
|
217
|
+
), v(""));
|
|
218
|
+
}, [e, p, d]);
|
|
219
|
+
const b = !!c.trim(), m = h === "local" ? {
|
|
220
|
+
saveToLibrary: !1,
|
|
221
|
+
saveToCurrentDashboard: !0,
|
|
222
|
+
badgeType: "local",
|
|
223
|
+
description: "Creates a local copy on the current dashboard.",
|
|
224
|
+
actionLabel: "Add to Dashboard (Local)"
|
|
225
|
+
} : h === "library" ? {
|
|
226
|
+
saveToLibrary: !0,
|
|
227
|
+
saveToCurrentDashboard: !1,
|
|
228
|
+
badgeType: "library",
|
|
229
|
+
description: "Creates a reusable visual in Visual Library.",
|
|
230
|
+
actionLabel: "Save as Library Visual"
|
|
231
|
+
} : {
|
|
232
|
+
saveToLibrary: !0,
|
|
233
|
+
saveToCurrentDashboard: !0,
|
|
234
|
+
badgeType: "linked",
|
|
235
|
+
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
236
|
+
actionLabel: "Save Copy as Linked Visual"
|
|
237
|
+
}, x = () => {
|
|
238
|
+
!b || l || o({
|
|
239
|
+
name: c.trim(),
|
|
240
|
+
description: n.trim() || void 0,
|
|
241
|
+
saveToLibrary: m.saveToLibrary,
|
|
242
|
+
saveToCurrentDashboard: m.saveToCurrentDashboard
|
|
243
|
+
});
|
|
244
|
+
};
|
|
245
|
+
return /* @__PURE__ */ t(se, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(re, { className: "sm:max-w-[500px]", children: [
|
|
246
|
+
/* @__PURE__ */ s(oe, { children: [
|
|
247
|
+
/* @__PURE__ */ s(ne, { className: "flex items-center gap-2", children: [
|
|
248
|
+
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
249
|
+
m.badgeType !== "local" && /* @__PURE__ */ t(
|
|
250
|
+
tt,
|
|
251
|
+
{
|
|
252
|
+
type: m.badgeType,
|
|
253
|
+
showLabel: !0,
|
|
254
|
+
className: "px-2 py-0.5"
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ t(ie, { children: m.description })
|
|
259
|
+
] }),
|
|
260
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 py-4", children: [
|
|
261
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
262
|
+
/* @__PURE__ */ t(K, { htmlFor: "name", children: "Name" }),
|
|
263
|
+
/* @__PURE__ */ t(
|
|
264
|
+
Ce,
|
|
265
|
+
{
|
|
266
|
+
id: "name",
|
|
267
|
+
value: c,
|
|
268
|
+
onChange: (N) => u(N.target.value),
|
|
269
|
+
placeholder: "Enter visual name",
|
|
270
|
+
disabled: l
|
|
271
|
+
}
|
|
272
|
+
)
|
|
273
|
+
] }),
|
|
274
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
275
|
+
/* @__PURE__ */ t(K, { htmlFor: "description", children: "Description (optional)" }),
|
|
276
|
+
/* @__PURE__ */ t(
|
|
277
|
+
we,
|
|
278
|
+
{
|
|
279
|
+
id: "description",
|
|
280
|
+
value: n,
|
|
281
|
+
onChange: (N) => v(N.target.value),
|
|
282
|
+
placeholder: "Enter visual description",
|
|
283
|
+
rows: 3,
|
|
284
|
+
disabled: l
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
] })
|
|
288
|
+
] }),
|
|
289
|
+
/* @__PURE__ */ s(ye, { children: [
|
|
290
|
+
/* @__PURE__ */ t(
|
|
291
|
+
S,
|
|
292
|
+
{
|
|
293
|
+
variant: "outline",
|
|
294
|
+
onClick: () => a(!1),
|
|
295
|
+
disabled: l,
|
|
296
|
+
children: "Cancel"
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ s(S, { onClick: x, disabled: !b || l, children: [
|
|
300
|
+
l && /* @__PURE__ */ t(H, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
301
|
+
m.actionLabel
|
|
302
|
+
] })
|
|
303
|
+
] })
|
|
304
|
+
] }) });
|
|
305
|
+
}
|
|
306
|
+
function Ct() {
|
|
307
|
+
const [e, a] = L(!1), [p, d] = L(!1), [l, h] = L(null), o = R((i) => i.frame), c = R((i) => i.card), u = Ne(), n = z((i) => i.selectedSheetId), v = z(
|
|
308
|
+
(i) => i.actions.setIsDashboardPanelOpen
|
|
309
|
+
), { getUpdatedFrame: b } = ve(), { selectVisual: m } = De(), { addFrame: x, setSelectedFrameId: N, setIsVisualEditing: f } = X(), w = !!(o != null && o.visualId), E = (() => {
|
|
310
|
+
var i, g;
|
|
311
|
+
return ((i = o == null ? void 0 : o.cards) == null ? void 0 : i.length) === 1 && ((g = o.cards[0]) != null && g.title) ? o.cards[0].title : u != null && u.title ? u.title : (c == null ? void 0 : c.title) || "Untitled Visual";
|
|
312
|
+
})(), C = Ae((i) => {
|
|
313
|
+
if (i != null && i.id) {
|
|
314
|
+
if (m(i), p && l && n) {
|
|
315
|
+
const g = {
|
|
316
|
+
...l,
|
|
317
|
+
id: W(),
|
|
318
|
+
visualId: i.id
|
|
319
|
+
// Link to the newly created library visual
|
|
320
|
+
};
|
|
321
|
+
x(n, g, "end"), N(g.id), d(!1), h(null), f(!1);
|
|
322
|
+
}
|
|
323
|
+
v(!0), a(!1);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
return {
|
|
327
|
+
saveAsDialogOpen: e,
|
|
328
|
+
setSaveAsDialogOpen: a,
|
|
329
|
+
handleSaveAs: async (i) => {
|
|
330
|
+
if (!n) {
|
|
331
|
+
P.error("No sheet selected");
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const g = b(), I = le(g);
|
|
335
|
+
if (I) {
|
|
336
|
+
P.error(I);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
const A = g.cards.length === 1 ? {
|
|
340
|
+
...g,
|
|
341
|
+
cards: g.cards.map((y) => ({
|
|
342
|
+
...y,
|
|
343
|
+
title: i.name
|
|
344
|
+
// Use visual name as card title
|
|
345
|
+
}))
|
|
346
|
+
} : g;
|
|
347
|
+
if (i.saveToLibrary) {
|
|
348
|
+
d(i.saveToCurrentDashboard), h(A);
|
|
349
|
+
const y = {
|
|
350
|
+
title: i.name,
|
|
351
|
+
description: i.description,
|
|
352
|
+
frameObject: A,
|
|
353
|
+
// Card title synced for single-card frames
|
|
354
|
+
isPrivate: !1
|
|
355
|
+
};
|
|
356
|
+
C.mutate(y);
|
|
357
|
+
} else if (i.saveToCurrentDashboard) {
|
|
358
|
+
const y = {
|
|
359
|
+
...A,
|
|
360
|
+
// Card title already synced
|
|
361
|
+
id: W(),
|
|
362
|
+
visualId: void 0
|
|
363
|
+
// Explicitly no visualId for local visuals
|
|
364
|
+
};
|
|
365
|
+
x(n, y, "end"), N(y.id), P.success("Visual saved to dashboard"), a(!1), f(!1);
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
isLibraryVisual: w,
|
|
369
|
+
currentVisualName: E,
|
|
370
|
+
isSaving: C.isPending
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
function kt(e = {}) {
|
|
374
|
+
const a = R((D) => D.frame), p = Se((D) => D.selectedVisual), d = z((D) => D.selectedFrameId), l = z((D) => D.selectedSheetId), { setIsVisualEditing: h, updateFrame: o } = X(), [c, u] = L(!1), [n, v] = L("both"), b = !!(a != null && a.visualId || p != null && p.id), m = !!(a != null && a.visualId && d), x = b && !m, {
|
|
375
|
+
saveAsDialogOpen: N,
|
|
376
|
+
setSaveAsDialogOpen: f,
|
|
377
|
+
handleSaveAs: w,
|
|
378
|
+
isLibraryVisual: E,
|
|
379
|
+
currentVisualName: C,
|
|
380
|
+
isSaving: r
|
|
381
|
+
} = Ct(), { getUpdatedFrame: i } = ve(), g = () => {
|
|
382
|
+
if (!l) {
|
|
383
|
+
P.error("No sheet selected");
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (c) return;
|
|
387
|
+
u(!0);
|
|
388
|
+
const D = i(), A = le(D);
|
|
389
|
+
if (A) {
|
|
390
|
+
u(!1), P.error(A);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const y = {
|
|
394
|
+
...D,
|
|
395
|
+
visualId: void 0
|
|
396
|
+
};
|
|
397
|
+
o(l, y), setTimeout(() => {
|
|
398
|
+
u(!1), P.success("Changes applied. Visual is now local to this dashboard"), h(!1);
|
|
399
|
+
}, 300);
|
|
400
|
+
}, I = (D) => {
|
|
401
|
+
v(D), f(!0);
|
|
402
|
+
};
|
|
403
|
+
return /* @__PURE__ */ s(B, { children: [
|
|
404
|
+
/* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-[5px]", children: [
|
|
405
|
+
!b && /* @__PURE__ */ t(
|
|
406
|
+
at,
|
|
407
|
+
{
|
|
408
|
+
className: "rounded-none",
|
|
409
|
+
variant: "default"
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
b && x && /* @__PURE__ */ t(
|
|
413
|
+
st,
|
|
414
|
+
{
|
|
415
|
+
className: "rounded-none",
|
|
416
|
+
variant: "default"
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
b && m && /* @__PURE__ */ t(rt, { className: "rounded-none" }),
|
|
420
|
+
/* @__PURE__ */ s(de, { modal: !1, children: [
|
|
421
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ t(
|
|
422
|
+
S,
|
|
423
|
+
{
|
|
424
|
+
variant: "default",
|
|
425
|
+
size: "xs",
|
|
426
|
+
className: "w-7 rounded-none border-l border-primary-foreground/20 px-0",
|
|
427
|
+
"aria-label": "Open visual save options",
|
|
428
|
+
disabled: r || c,
|
|
429
|
+
children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
|
|
430
|
+
}
|
|
431
|
+
) }),
|
|
432
|
+
/* @__PURE__ */ s(
|
|
433
|
+
he,
|
|
434
|
+
{
|
|
435
|
+
align: "end",
|
|
436
|
+
className: "min-w-[220px] rounded-[6px] border border-border/60 p-1 shadow-sm",
|
|
437
|
+
children: [
|
|
438
|
+
m && /* @__PURE__ */ s(B, { children: [
|
|
439
|
+
/* @__PURE__ */ s(
|
|
440
|
+
U,
|
|
441
|
+
{
|
|
442
|
+
onClick: g,
|
|
443
|
+
disabled: c,
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
|
|
446
|
+
c ? "Applying..." : "Apply Locally"
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ t(Ie, {})
|
|
451
|
+
] }),
|
|
452
|
+
/* @__PURE__ */ s(
|
|
453
|
+
U,
|
|
454
|
+
{
|
|
455
|
+
onClick: () => I("local"),
|
|
456
|
+
disabled: r,
|
|
457
|
+
children: [
|
|
458
|
+
/* @__PURE__ */ t(Le, { className: "h-3.5 w-3.5" }),
|
|
459
|
+
"Add to Dashboard (Local)"
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
/* @__PURE__ */ s(
|
|
464
|
+
U,
|
|
465
|
+
{
|
|
466
|
+
onClick: () => I("library"),
|
|
467
|
+
disabled: r,
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ t(ot, { className: "h-3.5 w-3.5" }),
|
|
470
|
+
"Save as Library Visual"
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
),
|
|
474
|
+
/* @__PURE__ */ s(
|
|
475
|
+
U,
|
|
476
|
+
{
|
|
477
|
+
onClick: () => I("both"),
|
|
478
|
+
disabled: r,
|
|
479
|
+
children: [
|
|
480
|
+
/* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
|
|
481
|
+
"Save Copy as Linked Visual"
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
] })
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ t(it, {}),
|
|
491
|
+
/* @__PURE__ */ t(
|
|
492
|
+
xt,
|
|
493
|
+
{
|
|
494
|
+
open: N,
|
|
495
|
+
onOpenChange: (D) => {
|
|
496
|
+
r || f(D);
|
|
497
|
+
},
|
|
498
|
+
isLibraryVisual: E,
|
|
499
|
+
currentVisualName: C,
|
|
500
|
+
isSaving: r,
|
|
501
|
+
destinationMode: n,
|
|
502
|
+
onConfirm: w
|
|
503
|
+
}
|
|
504
|
+
)
|
|
505
|
+
] });
|
|
506
|
+
}
|
|
507
|
+
function Ut({ className: e }) {
|
|
508
|
+
const a = R((u) => u.isDevMode), p = z((u) => u.isVisualEditing), { setIsDevMode: d } = Fe(), { config: l } = be(Te).tokenProps, h = (l == null ? void 0 : l.showAdvancedMode) !== !1;
|
|
509
|
+
if (!p || !h)
|
|
510
|
+
return null;
|
|
511
|
+
const o = "h-7 rounded-none border-0 bg-transparent px-2.5 shadow-none text-muted-foreground hover:bg-accent/50 hover:text-foreground", c = "bg-muted text-foreground hover:bg-muted";
|
|
512
|
+
return /* @__PURE__ */ s(
|
|
513
|
+
"div",
|
|
514
|
+
{
|
|
515
|
+
role: "radiogroup",
|
|
516
|
+
"aria-label": "Editor mode",
|
|
517
|
+
className: V(
|
|
518
|
+
"inline-flex items-stretch overflow-hidden rounded-[5px] border border-input bg-background",
|
|
519
|
+
e
|
|
520
|
+
),
|
|
521
|
+
children: [
|
|
522
|
+
/* @__PURE__ */ s(
|
|
523
|
+
S,
|
|
524
|
+
{
|
|
525
|
+
type: "button",
|
|
526
|
+
variant: "ghost",
|
|
527
|
+
size: "xs",
|
|
528
|
+
role: "radio",
|
|
529
|
+
"aria-checked": !a,
|
|
530
|
+
className: V(o, !a && c),
|
|
531
|
+
onClick: () => d(!1),
|
|
532
|
+
children: [
|
|
533
|
+
/* @__PURE__ */ t(G, { className: "h-3.5 w-3.5" }),
|
|
534
|
+
"Drag & drop"
|
|
535
|
+
]
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
/* @__PURE__ */ s(
|
|
539
|
+
S,
|
|
540
|
+
{
|
|
541
|
+
type: "button",
|
|
542
|
+
variant: "ghost",
|
|
543
|
+
size: "xs",
|
|
544
|
+
role: "radio",
|
|
545
|
+
"aria-checked": a,
|
|
546
|
+
className: V(
|
|
547
|
+
o,
|
|
548
|
+
"border-l border-border/60",
|
|
549
|
+
a && c
|
|
550
|
+
),
|
|
551
|
+
onClick: () => d(!0),
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ t(ke, { className: "h-3.5 w-3.5" }),
|
|
554
|
+
"SQL"
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
]
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
function Vt({
|
|
563
|
+
open: e,
|
|
564
|
+
onOpenChange: a,
|
|
565
|
+
onSave: p,
|
|
566
|
+
onDiscard: d,
|
|
567
|
+
isSaving: l,
|
|
568
|
+
title: h = "Unsaved changes",
|
|
569
|
+
description: o = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
570
|
+
cancelLabel: c = "Cancel",
|
|
571
|
+
discardLabel: u = "Discard",
|
|
572
|
+
saveLabel: n = "Save"
|
|
573
|
+
}) {
|
|
574
|
+
return /* @__PURE__ */ t(Ue, { open: e, onOpenChange: (b) => {
|
|
575
|
+
!b && l || a(b);
|
|
576
|
+
}, children: /* @__PURE__ */ s(Ve, { children: [
|
|
577
|
+
/* @__PURE__ */ s(Me, { children: [
|
|
578
|
+
/* @__PURE__ */ t(Pe, { children: h }),
|
|
579
|
+
/* @__PURE__ */ t(ze, { children: o })
|
|
580
|
+
] }),
|
|
581
|
+
/* @__PURE__ */ s(Be, { children: [
|
|
582
|
+
/* @__PURE__ */ t(
|
|
583
|
+
S,
|
|
584
|
+
{
|
|
585
|
+
type: "button",
|
|
586
|
+
size: "xs",
|
|
587
|
+
onClick: d,
|
|
588
|
+
disabled: l,
|
|
589
|
+
variant: "ghost",
|
|
590
|
+
className: "mr-auto text-muted-foreground hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
|
|
591
|
+
children: u
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ t(Oe, { disabled: l, children: c }),
|
|
595
|
+
/* @__PURE__ */ t(S, { type: "button", size: "xs", onClick: p, disabled: l, children: l ? /* @__PURE__ */ s(B, { children: [
|
|
596
|
+
/* @__PURE__ */ t(H, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
597
|
+
"Saving..."
|
|
598
|
+
] }) : n })
|
|
599
|
+
] })
|
|
600
|
+
] }) });
|
|
601
|
+
}
|
|
602
|
+
function Mt(e, a, p, d) {
|
|
603
|
+
F(() => {
|
|
604
|
+
e && !p && a && d(Re(a));
|
|
605
|
+
}, [e, p, a, d]);
|
|
606
|
+
}
|
|
607
|
+
function wt({
|
|
608
|
+
export: e,
|
|
609
|
+
onRemove: a
|
|
610
|
+
}) {
|
|
611
|
+
const p = () => {
|
|
612
|
+
e.downloadUrl && window.open(e.downloadUrl, "_blank");
|
|
613
|
+
}, d = (c) => {
|
|
614
|
+
c.stopPropagation(), a == null || a(e.id);
|
|
615
|
+
}, l = () => {
|
|
616
|
+
switch (e.status) {
|
|
617
|
+
case "completed":
|
|
618
|
+
return /* @__PURE__ */ t(Xe, { className: "mt-0.5 h-5 w-5 shrink-0 text-green-600" });
|
|
619
|
+
case "failed":
|
|
620
|
+
return /* @__PURE__ */ t(lt, { className: "mt-0.5 h-5 w-5 shrink-0 text-destructive" });
|
|
621
|
+
default:
|
|
622
|
+
return /* @__PURE__ */ t(H, { className: "text-foreground-muted mt-0.5 h-5 w-5 shrink-0 animate-spin" });
|
|
623
|
+
}
|
|
624
|
+
}, h = $(e.status), o = (() => {
|
|
625
|
+
switch (e.status) {
|
|
626
|
+
case "pending":
|
|
627
|
+
return "Queued...";
|
|
628
|
+
case "processing":
|
|
629
|
+
return "Processing...";
|
|
630
|
+
case "chunking":
|
|
631
|
+
return "Processing...";
|
|
632
|
+
case "compacting":
|
|
633
|
+
return "Finalizing...";
|
|
634
|
+
default:
|
|
635
|
+
return "Processing...";
|
|
636
|
+
}
|
|
637
|
+
})();
|
|
638
|
+
return /* @__PURE__ */ s("div", { className: "group p-4 transition-colors hover:bg-muted/50", children: [
|
|
639
|
+
/* @__PURE__ */ s("div", { className: "mb-2 flex items-start justify-between gap-3", children: [
|
|
640
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
|
|
641
|
+
l(),
|
|
642
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
643
|
+
/* @__PURE__ */ t("h4", { className: "mb-1 truncate text-sm font-medium", children: e.title }),
|
|
644
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
645
|
+
/* @__PURE__ */ s("span", { children: [
|
|
646
|
+
e.totalRows.toLocaleString(),
|
|
647
|
+
" rows"
|
|
648
|
+
] }),
|
|
649
|
+
e.fileSize && /* @__PURE__ */ s(B, { children: [
|
|
650
|
+
/* @__PURE__ */ t("span", { children: "•" }),
|
|
651
|
+
/* @__PURE__ */ t("span", { children: _e(e.fileSize) })
|
|
652
|
+
] })
|
|
653
|
+
] }),
|
|
654
|
+
h && /* @__PURE__ */ t("div", { className: "text-xs text-muted-foreground", children: o }),
|
|
655
|
+
e.status === "failed" && /* @__PURE__ */ t("div", { className: "line-clamp-2 text-xs text-destructive", children: e.error || "Export failed" })
|
|
656
|
+
] })
|
|
657
|
+
] }),
|
|
658
|
+
/* @__PURE__ */ t(
|
|
659
|
+
S,
|
|
660
|
+
{
|
|
661
|
+
variant: "ghost",
|
|
662
|
+
size: "icon",
|
|
663
|
+
className: "h-6 w-6 shrink-0 opacity-0 transition-opacity group-hover:opacity-100",
|
|
664
|
+
onClick: d,
|
|
665
|
+
"aria-label": "Remove notification",
|
|
666
|
+
children: /* @__PURE__ */ t($e, { className: "h-4 w-4" })
|
|
667
|
+
}
|
|
668
|
+
)
|
|
669
|
+
] }),
|
|
670
|
+
/* @__PURE__ */ s("div", { className: "ml-8", children: [
|
|
671
|
+
e.status === "completed" && /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
672
|
+
/* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: Q(e.startedAt, { addSuffix: !0 }) }),
|
|
673
|
+
e.downloadUrl && /* @__PURE__ */ s(
|
|
674
|
+
S,
|
|
675
|
+
{
|
|
676
|
+
size: "sm",
|
|
677
|
+
variant: "outline",
|
|
678
|
+
className: "h-8 bg-transparent",
|
|
679
|
+
onClick: p,
|
|
680
|
+
children: [
|
|
681
|
+
/* @__PURE__ */ t(je, { className: "mr-1.5 h-3.5 w-3.5" }),
|
|
682
|
+
"Download"
|
|
683
|
+
]
|
|
684
|
+
}
|
|
685
|
+
)
|
|
686
|
+
] }),
|
|
687
|
+
h && /* @__PURE__ */ s("div", { children: [
|
|
688
|
+
/* @__PURE__ */ t(He, { value: e.progress, className: "h-1.5" }),
|
|
689
|
+
/* @__PURE__ */ s("span", { className: "mt-1 block text-xs text-muted-foreground", children: [
|
|
690
|
+
e.progress,
|
|
691
|
+
"% complete"
|
|
692
|
+
] })
|
|
693
|
+
] }),
|
|
694
|
+
e.status === "failed" && /* @__PURE__ */ t("span", { className: "text-xs text-muted-foreground", children: Q(e.startedAt, { addSuffix: !0 }) })
|
|
695
|
+
] })
|
|
696
|
+
] });
|
|
697
|
+
}
|
|
698
|
+
function yt() {
|
|
699
|
+
const { authToken: e, tokenProps: a } = _(), p = k((f) => f.activeExports), { clearCompleted: d, removeExport: l, updateExport: h } = ae(), [o, c] = L(!1), [u, n] = L(!1), v = Array.from(p.values()).sort(
|
|
700
|
+
(f, w) => w.startedAt.getTime() - f.startedAt.getTime()
|
|
701
|
+
), b = v.some(
|
|
702
|
+
(f) => f.status === "completed" || f.status === "failed"
|
|
703
|
+
), m = M(async () => {
|
|
704
|
+
const f = a == null ? void 0 : a.apiServiceUrl, w = e == null ? void 0 : e.accessToken;
|
|
705
|
+
if (!(!f || !w)) {
|
|
706
|
+
c(!0);
|
|
707
|
+
try {
|
|
708
|
+
const E = Array.from(p.values());
|
|
709
|
+
await Promise.all(
|
|
710
|
+
E.map(async (C) => {
|
|
711
|
+
try {
|
|
712
|
+
const r = await te(f, w, C.id);
|
|
713
|
+
let i;
|
|
714
|
+
if (r.status === "completed")
|
|
715
|
+
try {
|
|
716
|
+
i = await j(
|
|
717
|
+
f,
|
|
718
|
+
w,
|
|
719
|
+
C.id
|
|
720
|
+
);
|
|
721
|
+
} catch (g) {
|
|
722
|
+
console.error(`Failed to get download URL for ${C.id}:`, g);
|
|
723
|
+
}
|
|
724
|
+
h(C.id, {
|
|
725
|
+
status: r.status,
|
|
726
|
+
progress: r.progress,
|
|
727
|
+
completedChunks: r.completedChunks,
|
|
728
|
+
completedAt: r.completedAt ? new Date(r.completedAt) : void 0,
|
|
729
|
+
lastUpdatedAt: /* @__PURE__ */ new Date(),
|
|
730
|
+
fileSize: r.fileSize,
|
|
731
|
+
error: r.error,
|
|
732
|
+
downloadUrl: i
|
|
733
|
+
});
|
|
734
|
+
} catch (r) {
|
|
735
|
+
console.error(`Failed to refresh export ${C.id}:`, r);
|
|
736
|
+
}
|
|
737
|
+
})
|
|
738
|
+
);
|
|
739
|
+
} finally {
|
|
740
|
+
c(!1);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}, [
|
|
744
|
+
p,
|
|
745
|
+
e == null ? void 0 : e.accessToken,
|
|
746
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
747
|
+
h
|
|
748
|
+
]), x = M(async () => {
|
|
749
|
+
const f = a == null ? void 0 : a.apiServiceUrl, w = e == null ? void 0 : e.accessToken;
|
|
750
|
+
if (!f || !w) {
|
|
751
|
+
d();
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
n(!0);
|
|
755
|
+
try {
|
|
756
|
+
const E = v.filter(
|
|
757
|
+
(r) => r.status === "completed" || r.status === "failed"
|
|
758
|
+
), C = await Promise.allSettled(
|
|
759
|
+
E.map(async (r) => (await q(f, w, r.id), r.id))
|
|
760
|
+
);
|
|
761
|
+
for (const r of C)
|
|
762
|
+
r.status === "fulfilled" ? l(r.value) : console.error("Failed to delete export:", r.reason);
|
|
763
|
+
} finally {
|
|
764
|
+
n(!1);
|
|
765
|
+
}
|
|
766
|
+
}, [
|
|
767
|
+
v,
|
|
768
|
+
a == null ? void 0 : a.apiServiceUrl,
|
|
769
|
+
e == null ? void 0 : e.accessToken,
|
|
770
|
+
d,
|
|
771
|
+
l
|
|
772
|
+
]), N = M(
|
|
773
|
+
async (f) => {
|
|
774
|
+
const w = a == null ? void 0 : a.apiServiceUrl, E = e == null ? void 0 : e.accessToken;
|
|
775
|
+
if (w && E)
|
|
776
|
+
try {
|
|
777
|
+
await q(w, E, f), l(f);
|
|
778
|
+
return;
|
|
779
|
+
} catch (C) {
|
|
780
|
+
console.error(`Failed to cancel export ${f}:`, C);
|
|
781
|
+
}
|
|
782
|
+
l(f);
|
|
783
|
+
},
|
|
784
|
+
[a == null ? void 0 : a.apiServiceUrl, e == null ? void 0 : e.accessToken, l]
|
|
785
|
+
);
|
|
786
|
+
return v.length === 0 ? /* @__PURE__ */ s("div", { className: "p-6 text-center", children: [
|
|
787
|
+
/* @__PURE__ */ t(Y, { className: "mx-auto mb-2 h-8 w-8 text-muted-foreground" }),
|
|
788
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: "No active exports" }),
|
|
789
|
+
/* @__PURE__ */ t("p", { className: "mt-1 text-xs text-muted-foreground", children: "Large exports will appear here" })
|
|
790
|
+
] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
|
|
791
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b px-4 py-3", children: [
|
|
792
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
793
|
+
/* @__PURE__ */ t(Y, { className: "h-5 w-5 text-muted-foreground" }),
|
|
794
|
+
/* @__PURE__ */ t("h4", { className: "font-semibold", children: "Exports" })
|
|
795
|
+
] }),
|
|
796
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1", children: [
|
|
797
|
+
/* @__PURE__ */ t(
|
|
798
|
+
S,
|
|
799
|
+
{
|
|
800
|
+
variant: "ghost",
|
|
801
|
+
size: "sm",
|
|
802
|
+
className: "h-7 w-7 p-0",
|
|
803
|
+
onClick: m,
|
|
804
|
+
disabled: o,
|
|
805
|
+
title: "Refresh status",
|
|
806
|
+
children: /* @__PURE__ */ t(
|
|
807
|
+
Ge,
|
|
808
|
+
{
|
|
809
|
+
className: `h-4 w-4 ${o ? "animate-spin" : ""}`
|
|
810
|
+
}
|
|
811
|
+
)
|
|
812
|
+
}
|
|
813
|
+
),
|
|
814
|
+
b && /* @__PURE__ */ t(
|
|
815
|
+
S,
|
|
816
|
+
{
|
|
817
|
+
variant: "ghost",
|
|
818
|
+
size: "sm",
|
|
819
|
+
className: "h-7 px-2 text-sm",
|
|
820
|
+
onClick: x,
|
|
821
|
+
disabled: u,
|
|
822
|
+
children: u ? "Clearing..." : "Clear all"
|
|
823
|
+
}
|
|
824
|
+
)
|
|
825
|
+
] })
|
|
826
|
+
] }),
|
|
827
|
+
/* @__PURE__ */ t("div", { className: "max-h-[350px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y", children: v.map((f) => /* @__PURE__ */ t(
|
|
828
|
+
wt,
|
|
829
|
+
{
|
|
830
|
+
export: f,
|
|
831
|
+
onRemove: N
|
|
832
|
+
},
|
|
833
|
+
f.id
|
|
834
|
+
)) }) })
|
|
835
|
+
] });
|
|
836
|
+
}
|
|
837
|
+
function Pt({
|
|
838
|
+
variant: e
|
|
839
|
+
}) {
|
|
840
|
+
const a = k((u) => u.activeExports), p = Ke(), d = a.size > 0, l = Array.from(a.values()).some(
|
|
841
|
+
(u) => u.status === "completed" || u.status === "failed"
|
|
842
|
+
), o = p > 0 ? p > 9 ? "9+" : String(p) : null;
|
|
843
|
+
return /* @__PURE__ */ s(me, { children: [
|
|
844
|
+
/* @__PURE__ */ t(pe, { asChild: !0, children: /* @__PURE__ */ s(
|
|
845
|
+
S,
|
|
846
|
+
{
|
|
847
|
+
variant: e ?? "ghost",
|
|
848
|
+
size: "xs",
|
|
849
|
+
className: "relative w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
850
|
+
"aria-label": "Export notifications",
|
|
851
|
+
children: [
|
|
852
|
+
/* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" }),
|
|
853
|
+
d && /* @__PURE__ */ t(
|
|
854
|
+
"span",
|
|
855
|
+
{
|
|
856
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${o ? "-right-0.5 -top-0.5 h-3.5 min-w-3.5 px-0.5 text-[9px] font-semibold" : "right-1 top-1 h-1.5 w-1.5"}`,
|
|
857
|
+
children: o
|
|
858
|
+
}
|
|
859
|
+
)
|
|
860
|
+
]
|
|
861
|
+
}
|
|
862
|
+
) }),
|
|
863
|
+
/* @__PURE__ */ t(fe, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(yt, {}) })
|
|
864
|
+
] });
|
|
865
|
+
}
|
|
866
|
+
function Nt(e) {
|
|
867
|
+
if (e)
|
|
868
|
+
return {
|
|
869
|
+
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
870
|
+
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
871
|
+
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
872
|
+
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
function zt({
|
|
876
|
+
open: e,
|
|
877
|
+
onOpenChange: a,
|
|
878
|
+
trigger: p,
|
|
879
|
+
showTrigger: d = !0,
|
|
880
|
+
initialMode: l = "manage"
|
|
881
|
+
}) {
|
|
882
|
+
const h = l === "create", {
|
|
883
|
+
forceClose: o,
|
|
884
|
+
handleOpenChange: c,
|
|
885
|
+
isCreateFlowActive: u,
|
|
886
|
+
preventPassiveDismissDuringCreate: n,
|
|
887
|
+
resolvedOpen: v,
|
|
888
|
+
setIsCreateFlowActive: b
|
|
889
|
+
} = dt({
|
|
890
|
+
open: e,
|
|
891
|
+
onOpenChange: a,
|
|
892
|
+
initialCreateFlowActive: l === "create",
|
|
893
|
+
// Dialog mode renders a built-in X close button — allow explicit
|
|
894
|
+
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
895
|
+
// only close-via-trigger path is a re-click that would silently
|
|
896
|
+
// wipe the in-progress create flow, so block everything during
|
|
897
|
+
// create and make consumers use `forceClose()` from a dedicated
|
|
898
|
+
// button.
|
|
899
|
+
dismissMode: d ? "passive" : "explicit-only"
|
|
900
|
+
}), m = z((A) => A.dashboard), { setDashboardControlsModel: x } = X(), { participants: N } = qe(Je(m)), f = Array.from(
|
|
901
|
+
new Map(
|
|
902
|
+
N.flatMap(
|
|
903
|
+
(A) => A.fieldChoices.map((y) => {
|
|
904
|
+
var T;
|
|
905
|
+
return [
|
|
906
|
+
y.value,
|
|
907
|
+
{
|
|
908
|
+
option: y,
|
|
909
|
+
target: (T = A.fieldTargetMap) == null ? void 0 : T[y.value]
|
|
910
|
+
}
|
|
911
|
+
];
|
|
912
|
+
})
|
|
913
|
+
)
|
|
914
|
+
).values()
|
|
915
|
+
), w = Array.from(
|
|
916
|
+
new Map(
|
|
917
|
+
N.flatMap(
|
|
918
|
+
(A) => A.metricChoices.map((y) => {
|
|
919
|
+
var T;
|
|
920
|
+
return [
|
|
921
|
+
y.value,
|
|
922
|
+
{
|
|
923
|
+
option: y,
|
|
924
|
+
target: (T = A.metricTargetMap) == null ? void 0 : T[y.value]
|
|
925
|
+
}
|
|
926
|
+
];
|
|
927
|
+
})
|
|
928
|
+
)
|
|
929
|
+
).values()
|
|
930
|
+
), E = Qe({
|
|
931
|
+
...m || {},
|
|
932
|
+
controls: []
|
|
933
|
+
}), C = Ye(m), r = (A, y, T) => {
|
|
934
|
+
x(
|
|
935
|
+
A,
|
|
936
|
+
y,
|
|
937
|
+
Nt(T)
|
|
938
|
+
);
|
|
939
|
+
}, i = M(() => {
|
|
940
|
+
if (h) {
|
|
941
|
+
o();
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
b(!1);
|
|
945
|
+
}, [h, o, b]), g = /* @__PURE__ */ t(
|
|
946
|
+
ct,
|
|
947
|
+
{
|
|
948
|
+
scope: "dashboard",
|
|
949
|
+
controls: m.controls || [],
|
|
950
|
+
reservedControlIds: E,
|
|
951
|
+
defaultValues: m.defaultControlValues || {},
|
|
952
|
+
usageByControlId: Ze(m),
|
|
953
|
+
availableFieldChoices: f,
|
|
954
|
+
availableMetricChoices: w,
|
|
955
|
+
structuralParticipants: N,
|
|
956
|
+
structuralParticipantIdsByControlId: C,
|
|
957
|
+
initialCreateFlow: l === "create",
|
|
958
|
+
onCreateFlowActiveChange: b,
|
|
959
|
+
onCreateFlowComplete: i,
|
|
960
|
+
onChange: r,
|
|
961
|
+
emptyMessage: "No dashboard controls yet."
|
|
962
|
+
}
|
|
963
|
+
), I = u ? "Add dashboard control" : "Dashboard Controls", D = /* @__PURE__ */ s(B, { children: [
|
|
964
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
965
|
+
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
966
|
+
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control." })
|
|
967
|
+
] }),
|
|
968
|
+
g
|
|
969
|
+
] });
|
|
970
|
+
return d ? /* @__PURE__ */ s(me, { open: v, onOpenChange: c, children: [
|
|
971
|
+
/* @__PURE__ */ t(pe, { asChild: !0, children: p || /* @__PURE__ */ s(S, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
972
|
+
/* @__PURE__ */ t(G, { className: "mr-2 h-4 w-4" }),
|
|
973
|
+
"Controls"
|
|
974
|
+
] }) }),
|
|
975
|
+
/* @__PURE__ */ t(
|
|
976
|
+
fe,
|
|
977
|
+
{
|
|
978
|
+
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
979
|
+
align: "end",
|
|
980
|
+
onEscapeKeyDown: n,
|
|
981
|
+
onPointerDownOutside: n,
|
|
982
|
+
children: D
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
] }) : /* @__PURE__ */ t(se, { open: v, onOpenChange: c, children: /* @__PURE__ */ s(
|
|
986
|
+
re,
|
|
987
|
+
{
|
|
988
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
989
|
+
onEscapeKeyDown: n,
|
|
990
|
+
onPointerDownOutside: n,
|
|
991
|
+
children: [
|
|
992
|
+
/* @__PURE__ */ s(
|
|
993
|
+
oe,
|
|
994
|
+
{
|
|
995
|
+
className: u ? "space-y-0" : void 0,
|
|
996
|
+
children: [
|
|
997
|
+
/* @__PURE__ */ t(ne, { className: "text-[15px]", children: I }),
|
|
998
|
+
/* @__PURE__ */ t(
|
|
999
|
+
ie,
|
|
1000
|
+
{
|
|
1001
|
+
className: u ? "sr-only" : "text-[13px]",
|
|
1002
|
+
children: u ? "Configure and add a shared dashboard control." : "Add shared controls viewers can use across the dashboard. Each card can decide how to respond to the same control."
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
1005
|
+
]
|
|
1006
|
+
}
|
|
1007
|
+
),
|
|
1008
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: g })
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
) });
|
|
1012
|
+
}
|
|
1013
|
+
function Bt({
|
|
1014
|
+
showFilters: e,
|
|
1015
|
+
onToggleFilters: a,
|
|
1016
|
+
onAddFilter: p,
|
|
1017
|
+
onAddControl: d,
|
|
1018
|
+
onManageControls: l,
|
|
1019
|
+
size: h = "default",
|
|
1020
|
+
className: o,
|
|
1021
|
+
primaryButtonClassName: c,
|
|
1022
|
+
secondaryButtonClassName: u,
|
|
1023
|
+
dropdownContentClassName: n
|
|
1024
|
+
}) {
|
|
1025
|
+
const v = h === "toolbar";
|
|
1026
|
+
return /* @__PURE__ */ s(
|
|
1027
|
+
"div",
|
|
1028
|
+
{
|
|
1029
|
+
className: V(
|
|
1030
|
+
"relative inline-flex items-stretch overflow-hidden rounded-[5px] border border-input bg-background",
|
|
1031
|
+
o
|
|
1032
|
+
),
|
|
1033
|
+
children: [
|
|
1034
|
+
/* @__PURE__ */ s(
|
|
1035
|
+
S,
|
|
1036
|
+
{
|
|
1037
|
+
variant: "ghost",
|
|
1038
|
+
size: "xs",
|
|
1039
|
+
className: V(
|
|
1040
|
+
v ? "h-8" : "h-7",
|
|
1041
|
+
"rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50",
|
|
1042
|
+
c
|
|
1043
|
+
),
|
|
1044
|
+
onClick: a,
|
|
1045
|
+
children: [
|
|
1046
|
+
e ? /* @__PURE__ */ t(ut, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(J, { className: "h-3.5 w-3.5" }),
|
|
1047
|
+
"Filter"
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ s(de, { children: [
|
|
1052
|
+
/* @__PURE__ */ t(ce, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1053
|
+
S,
|
|
1054
|
+
{
|
|
1055
|
+
variant: "ghost",
|
|
1056
|
+
size: "xs",
|
|
1057
|
+
className: V(
|
|
1058
|
+
v ? "h-8 w-7" : "h-7 w-7",
|
|
1059
|
+
"rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50",
|
|
1060
|
+
u
|
|
1061
|
+
),
|
|
1062
|
+
"aria-label": "Filter and control actions",
|
|
1063
|
+
children: /* @__PURE__ */ t(ue, { className: "h-3.5 w-3.5" })
|
|
1064
|
+
}
|
|
1065
|
+
) }),
|
|
1066
|
+
/* @__PURE__ */ s(
|
|
1067
|
+
he,
|
|
1068
|
+
{
|
|
1069
|
+
align: "start",
|
|
1070
|
+
className: V(
|
|
1071
|
+
"min-w-[180px] rounded-[6px] border border-border/60 p-1 shadow-sm",
|
|
1072
|
+
n
|
|
1073
|
+
),
|
|
1074
|
+
children: [
|
|
1075
|
+
/* @__PURE__ */ s(U, { onSelect: p, children: [
|
|
1076
|
+
/* @__PURE__ */ t(J, { className: "h-3.5 w-3.5" }),
|
|
1077
|
+
"Add filter"
|
|
1078
|
+
] }),
|
|
1079
|
+
/* @__PURE__ */ s(U, { onSelect: d, children: [
|
|
1080
|
+
/* @__PURE__ */ t(G, { className: "h-3.5 w-3.5" }),
|
|
1081
|
+
"Add control"
|
|
1082
|
+
] }),
|
|
1083
|
+
/* @__PURE__ */ s(U, { onSelect: l, children: [
|
|
1084
|
+
/* @__PURE__ */ t(et, { className: "h-3.5 w-3.5" }),
|
|
1085
|
+
"Manage controls"
|
|
1086
|
+
] })
|
|
1087
|
+
]
|
|
1088
|
+
}
|
|
1089
|
+
)
|
|
1090
|
+
] })
|
|
1091
|
+
]
|
|
1092
|
+
}
|
|
1093
|
+
);
|
|
1094
|
+
}
|
|
1095
|
+
export {
|
|
1096
|
+
Ut as A,
|
|
1097
|
+
zt as D,
|
|
1098
|
+
yt as E,
|
|
1099
|
+
Pt as N,
|
|
1100
|
+
Vt as U,
|
|
1101
|
+
kt as V,
|
|
1102
|
+
wt as a,
|
|
1103
|
+
Tt as b,
|
|
1104
|
+
Bt as c,
|
|
1105
|
+
Mt as d,
|
|
1106
|
+
Ft as u
|
|
1107
|
+
};
|