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