react-semaphor 0.1.548 → 0.1.550
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/assistant-context/index.js +1 -1
- package/dist/brand-studio/index.js +1 -1
- package/dist/briefings/index.js +1 -1
- package/dist/chunks/{assistant-chat-DCcWsoGm.js → assistant-chat-ClAvjeNe.js} +1834 -1849
- package/dist/chunks/{custom-visual-inputs-BTRnwsfd.js → custom-visual-inputs-CwAcigQS.js} +1 -1
- package/dist/chunks/{dashboard-BZHL9a-z.js → dashboard-DDQgKoss.js} +1 -1
- package/dist/chunks/dashboard-briefing-launcher-CCYs8E4j.js +3844 -0
- package/dist/chunks/{dashboard-controls-BGoBTPS7.js → dashboard-controls-DfSkQBsk.js} +982 -935
- package/dist/chunks/{dashboard-json-iHPsdn3j.js → dashboard-json-BPhyn9pl.js} +2 -2
- package/dist/chunks/{document-dashboard-inputs-B2AqPfrq.js → document-dashboard-inputs-DPQ_wUGD.js} +2 -2
- package/dist/chunks/{edit-dashboard-visual-CLEFFf2T.js → edit-dashboard-visual-G7EmLuR0.js} +280 -280
- package/dist/chunks/{filter-reach-copy-ByzGadUk.js → filter-reach-copy-8vnDYToV.js} +95 -93
- package/dist/chunks/{global-date-filter-utils-CeeFJ1CP.js → global-date-filter-utils-CnumW4j2.js} +1656 -1651
- package/dist/chunks/{index-DeDHr3iz.js → index-DzsdV1o4.js} +3 -3
- package/dist/chunks/{raw-temporal-presentation-CrUM2I_o.js → raw-temporal-presentation-CBKeEPYA.js} +1 -1
- package/dist/chunks/report-preferences-dialog-D_fEDaS4.js +2261 -0
- package/dist/chunks/{resolve-dashboard-input-context-BmWF9hSl.js → resolve-dashboard-input-context-DVWF7p5C.js} +1 -1
- package/dist/chunks/{saved-dashboard-context-qtfzl9Eb.js → saved-dashboard-context-BMqMzNAo.js} +4 -4
- package/dist/chunks/{semaphor-ready-indicator-Ol6VcaR7.js → semaphor-ready-indicator-Bz5BxITW.js} +25406 -25106
- package/dist/chunks/{shelf-drop-preview-context-C2SEC3I9.js → shelf-drop-preview-context-B8kNwpWQ.js} +4 -4
- package/dist/chunks/{switch-CEBOR4n7.js → switch-wJP6O7ZT.js} +2 -2
- package/dist/chunks/{use-create-flow-overlay-state-CbGIjaVD.js → use-create-flow-overlay-state-RzJa7G8S.js} +3 -3
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +7 -7
- package/dist/index.js +187 -172
- package/dist/live-channel/index.js +124 -0
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +1 -1
- package/dist/types/components/assistant/assistant-entry-points.d.ts +4 -1
- package/dist/types/components/dashboard/favorites/dashboard-favorite-toggle.d.ts +11 -0
- package/dist/types/components/dashboard/favorites/favorite-star-button.d.ts +16 -0
- package/dist/types/components/index.d.ts +8 -0
- package/dist/types/components/sharing-and-management/hooks/use-resource-management.d.ts +16 -0
- package/dist/types/components/surfboard/dashboard-plus.d.ts +1 -1
- package/dist/types/components/surfboard/toolbar/toolbar-context.d.ts +86 -0
- package/dist/types/components/surfboard/toolbar/toolbar-overflow.d.ts +14 -0
- package/dist/types/lib/dashboard-viewer/viewer-store-state.d.ts +7 -0
- package/dist/types/lib/hooks/use-dashboard-favorite.d.ts +24 -0
- package/dist/types/lib/hooks/use-dashboard-query.d.ts +2 -0
- package/dist/types/lib/hooks/use-default-dashboard-toggle.d.ts +12 -0
- package/dist/types/lib/stores/dashboard-store.d.ts +9 -0
- package/dist/types/lib/types/common-types.d.ts +26 -1
- package/dist/types/live-channel.d.ts +2 -0
- package/dist/types/shared/assistant-protocol/parts.d.ts +11 -0
- package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +14 -44
- package/dist/types/shared/dashboard-viewer/viewer-contract.d.ts +18 -0
- package/dist/types/shared/live-channel/index.d.ts +1 -0
- package/dist/types/shared/live-channel/live-channel-contract.d.ts +126 -0
- package/package.json +5 -1
- package/dist/chunks/dashboard-briefing-launcher-DML-cAzB.js +0 -3734
- package/dist/chunks/report-preferences-dialog-CM7kXmXp.js +0 -1977
|
@@ -0,0 +1,3844 @@
|
|
|
1
|
+
import { jsx as t, jsxs as s, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import Vt, { useState as S, useEffect as xe, useCallback as Z, useMemo as te, useLayoutEffect as Dt, useRef as nt, useContext as Bt } from "react";
|
|
3
|
+
import { cE as ot, bL as Ie, bM as Te, bO as Le, cF as ta, b5 as it, b3 as Qe, cG as aa, cH as Ke, cI as lt, a7 as Ge, a4 as ce, u as w, cJ as ra, cK as na, bK as E, cL as sa, a6 as ee, bh as oa, cM as ia, cN as la, a_ as ve, cs as Pt, aR as $e, o as da, k as ca, cO as ua, cv as dt, cw as ct, cx as ut, cy as ht, cz as mt, cA as pt, cB as ft, cC as Mt, aP as gt, cP as ha, cQ as ma, cl as et, ci as Ve, cj as Be, cR as Ut, ck as Pe, c7 as G, ct as pa, co as We, cS as fa, c5 as ga, bN as bt, bP as xt, cT as ba, bJ as xa, cU as Ot, bx as vt, cV as va, by as ya, i as Ca, cW as wa, bs as Na, w as Sa, t as ka, cX as Da, cY as Aa, cZ as Fa, c_ as K, c$ as Ea, R as Rt, d0 as Ia, d1 as Ta, d2 as La, d3 as Va, aM as Ba, d4 as de, d5 as Pa, W as yt, d6 as Ma, d7 as Ua, d8 as Oa, d9 as Ra, da as za, db as _a, dc as ja, dd as zt, de as $a, df as Wa, dg as qa, dh as _t, di as Ha, dj as ze, dk as Qa, dl as Ka, dm as Ga, A as Xa, aB as Ya, aC as Za, ah as Ja, ag as er, af as tr, ae as ar, ab as rr, a9 as nr, dn as sr, dp as or, dq as ir, dr as lr, ds as dr, az as cr } from "./semaphor-ready-indicator-Bz5BxITW.js";
|
|
4
|
+
import { B as I, l as De, q as st, L as re, j as jt, c as Ct, i as ur, P as Ae, a0 as hr, b as Fe, a as qe, S as $t } from "./switch-wJP6O7ZT.js";
|
|
5
|
+
import { L as Ee } from "./layout-grid-Bgzth8vd.js";
|
|
6
|
+
import { c as fe, X as Xe, C as wt } from "./x-4f5U2XwU.js";
|
|
7
|
+
import "./index-CuHybtft.js";
|
|
8
|
+
import { o as mr } from "./validators-C-aOQlTB.js";
|
|
9
|
+
import "./matrix-operation-contract-D6vYkZK4.js";
|
|
10
|
+
import "./analytics-base-schemas-BKs3flFS.js";
|
|
11
|
+
import "zod";
|
|
12
|
+
import "../value-format-preferences/index.js";
|
|
13
|
+
import { c as J } from "./_commonjsHelpers-DimLPMtv.js";
|
|
14
|
+
import { S as pr } from "./selection-reducer-CJzkTZio.js";
|
|
15
|
+
import { s as _e } from "./normalize-dashboard-for-dirty-check-XKgH3GFX.js";
|
|
16
|
+
import { aL as fr, ay as gr, e1 as He, v as At, e2 as br, as as Nt, e3 as xr, dq as vr, dc as yr, bp as Cr, e4 as wr } from "./global-date-filter-utils-CnumW4j2.js";
|
|
17
|
+
import { f as Nr } from "./editor-draft-sync-BN5qYHPF.js";
|
|
18
|
+
import { createPortal as Sr } from "react-dom";
|
|
19
|
+
import "./pivot-result-lifecycle-pwq3b7LC.js";
|
|
20
|
+
import "./index-CtoK1Lgu.js";
|
|
21
|
+
import { I as kr } from "./table-settings-WysCBj62.js";
|
|
22
|
+
import { S as Wt } from "./save-CfJpQQ68.js";
|
|
23
|
+
import { V as Dr, L as Ar, a as Fr, u as qt, C as Ht, F as Er, b as Ir } from "./use-create-flow-overlay-state-RzJa7G8S.js";
|
|
24
|
+
import { m as Tr, k as Qt, n as Kt } from "./report-preferences-dialog-D_fEDaS4.js";
|
|
25
|
+
import { q as Ft } from "./matrix-formatter-DWEeC0_c.js";
|
|
26
|
+
import { g as Lr, f as Vr } from "./document-dashboard-inputs-DPQ_wUGD.js";
|
|
27
|
+
import { g as le, d as Br, a as Pr } from "./index-DzsdV1o4.js";
|
|
28
|
+
/**
|
|
29
|
+
* @license lucide-react v0.453.0 - ISC
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the ISC license.
|
|
32
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/
|
|
34
|
+
const Mr = fe("ArrowUpRight", [
|
|
35
|
+
["path", { d: "M7 7h10v10", key: "1tivn9" }],
|
|
36
|
+
["path", { d: "M7 17 17 7", key: "1vkiza" }]
|
|
37
|
+
]);
|
|
38
|
+
/**
|
|
39
|
+
* @license lucide-react v0.453.0 - ISC
|
|
40
|
+
*
|
|
41
|
+
* This source code is licensed under the ISC license.
|
|
42
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
43
|
+
*/
|
|
44
|
+
const Et = fe("Bell", [
|
|
45
|
+
["path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9", key: "1qo2s2" }],
|
|
46
|
+
["path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0", key: "qgo35s" }]
|
|
47
|
+
]);
|
|
48
|
+
/**
|
|
49
|
+
* @license lucide-react v0.453.0 - ISC
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the ISC license.
|
|
52
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/
|
|
54
|
+
const Ur = fe("CalendarRange", [
|
|
55
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
56
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
57
|
+
["path", { d: "M3 10h18", key: "8toen8" }],
|
|
58
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
59
|
+
["path", { d: "M17 14h-6", key: "bkmgh3" }],
|
|
60
|
+
["path", { d: "M13 18H7", key: "bb0bb7" }],
|
|
61
|
+
["path", { d: "M7 14h.01", key: "1qa3f1" }],
|
|
62
|
+
["path", { d: "M17 18h.01", key: "1bdyru" }]
|
|
63
|
+
]);
|
|
64
|
+
/**
|
|
65
|
+
* @license lucide-react v0.453.0 - ISC
|
|
66
|
+
*
|
|
67
|
+
* This source code is licensed under the ISC license.
|
|
68
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
+
*/
|
|
70
|
+
const Or = fe("CodeXml", [
|
|
71
|
+
["path", { d: "m18 16 4-4-4-4", key: "1inbqp" }],
|
|
72
|
+
["path", { d: "m6 8-4 4 4 4", key: "15zrgr" }],
|
|
73
|
+
["path", { d: "m14.5 4-5 16", key: "e7oirm" }]
|
|
74
|
+
]);
|
|
75
|
+
/**
|
|
76
|
+
* @license lucide-react v0.453.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/
|
|
81
|
+
const It = fe("MonitorSmartphone", [
|
|
82
|
+
["path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8", key: "10dyio" }],
|
|
83
|
+
["path", { d: "M10 19v-3.96 3.15", key: "1irgej" }],
|
|
84
|
+
["path", { d: "M7 19h5", key: "qswx4l" }],
|
|
85
|
+
["rect", { width: "6", height: "10", x: "16", y: "12", rx: "2", key: "1egngj" }]
|
|
86
|
+
]);
|
|
87
|
+
/**
|
|
88
|
+
* @license lucide-react v0.453.0 - ISC
|
|
89
|
+
*
|
|
90
|
+
* This source code is licensed under the ISC license.
|
|
91
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
+
*/
|
|
93
|
+
const Rr = fe("MousePointer2", [
|
|
94
|
+
[
|
|
95
|
+
"path",
|
|
96
|
+
{
|
|
97
|
+
d: "M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",
|
|
98
|
+
key: "edeuup"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
]);
|
|
102
|
+
/**
|
|
103
|
+
* @license lucide-react v0.453.0 - ISC
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the ISC license.
|
|
106
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
+
*/
|
|
108
|
+
const zr = fe("Newspaper", [
|
|
109
|
+
[
|
|
110
|
+
"path",
|
|
111
|
+
{
|
|
112
|
+
d: "M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",
|
|
113
|
+
key: "7pis2x"
|
|
114
|
+
}
|
|
115
|
+
],
|
|
116
|
+
["path", { d: "M18 14h-8", key: "sponae" }],
|
|
117
|
+
["path", { d: "M15 18h-5", key: "95g1m2" }],
|
|
118
|
+
["path", { d: "M10 6h8v4h-8V6Z", key: "smlsk5" }]
|
|
119
|
+
]);
|
|
120
|
+
function _r() {
|
|
121
|
+
return /* @__PURE__ */ t("div", { className: "space-y-1.5 py-1", children: [...Array(5)].map((e, a) => /* @__PURE__ */ s(
|
|
122
|
+
"div",
|
|
123
|
+
{
|
|
124
|
+
className: "flex animate-pulse items-start gap-3 rounded-xl border border-transparent px-2.5 py-2.5",
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ t("div", { className: "mt-0.5 h-4 w-4 flex-shrink-0 rounded bg-muted/60" }),
|
|
127
|
+
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
128
|
+
/* @__PURE__ */ t("div", { className: "h-4 w-3/5 rounded bg-muted/60" }),
|
|
129
|
+
/* @__PURE__ */ t("div", { className: "h-3 w-4/5 rounded bg-muted/40" })
|
|
130
|
+
] })
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
a
|
|
134
|
+
)) });
|
|
135
|
+
}
|
|
136
|
+
function jr({
|
|
137
|
+
open: e,
|
|
138
|
+
onOpenChange: a,
|
|
139
|
+
onSubmit: o,
|
|
140
|
+
isCreating: n
|
|
141
|
+
}) {
|
|
142
|
+
const i = ot("interactive"), [r, d] = S(""), [c, l] = S("");
|
|
143
|
+
xe(() => {
|
|
144
|
+
e || (d(""), l(""));
|
|
145
|
+
}, [e]);
|
|
146
|
+
const u = () => {
|
|
147
|
+
r.trim() && o({ title: r, description: c });
|
|
148
|
+
}, h = (m) => {
|
|
149
|
+
a(m);
|
|
150
|
+
};
|
|
151
|
+
return /* @__PURE__ */ t(Ie, { open: e, onOpenChange: h, children: /* @__PURE__ */ s(
|
|
152
|
+
Te,
|
|
153
|
+
{
|
|
154
|
+
showCloseButton: !1,
|
|
155
|
+
className: "flex max-w-lg grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
156
|
+
style: i.dialogStyle,
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
159
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
160
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
161
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
162
|
+
/* @__PURE__ */ t(Le, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "New library visual" }),
|
|
163
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Visual" })
|
|
164
|
+
] })
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ t(
|
|
167
|
+
I,
|
|
168
|
+
{
|
|
169
|
+
size: "xs",
|
|
170
|
+
variant: "ghost",
|
|
171
|
+
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
172
|
+
onClick: () => h(!1),
|
|
173
|
+
"aria-label": "Close",
|
|
174
|
+
disabled: n,
|
|
175
|
+
children: /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" })
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] }),
|
|
179
|
+
/* @__PURE__ */ s("div", { className: "space-y-3 px-4 py-3", children: [
|
|
180
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Create a saved visual that can be reused across dashboards." }),
|
|
181
|
+
/* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
|
|
182
|
+
/* @__PURE__ */ t(De, { htmlFor: "visual-title", className: "text-[12px]", children: "Name" }),
|
|
183
|
+
/* @__PURE__ */ t(
|
|
184
|
+
st,
|
|
185
|
+
{
|
|
186
|
+
id: "visual-title",
|
|
187
|
+
size: "sm",
|
|
188
|
+
placeholder: "Untitled visual",
|
|
189
|
+
value: r,
|
|
190
|
+
onChange: (m) => d(m.target.value),
|
|
191
|
+
disabled: n,
|
|
192
|
+
onKeyDown: (m) => {
|
|
193
|
+
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), u());
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }),
|
|
198
|
+
/* @__PURE__ */ s("div", { className: "space-y-1.5", children: [
|
|
199
|
+
/* @__PURE__ */ t(De, { htmlFor: "visual-description", className: "text-[12px]", children: "Description" }),
|
|
200
|
+
/* @__PURE__ */ t(
|
|
201
|
+
st,
|
|
202
|
+
{
|
|
203
|
+
id: "visual-description",
|
|
204
|
+
size: "sm",
|
|
205
|
+
placeholder: "Optional",
|
|
206
|
+
value: c,
|
|
207
|
+
onChange: (m) => l(m.target.value),
|
|
208
|
+
disabled: n
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] })
|
|
212
|
+
] }),
|
|
213
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 justify-end gap-2 border-t border-border/60 px-4 py-2.5", children: [
|
|
214
|
+
/* @__PURE__ */ t(
|
|
215
|
+
I,
|
|
216
|
+
{
|
|
217
|
+
size: "xs",
|
|
218
|
+
variant: "outline",
|
|
219
|
+
onClick: () => h(!1),
|
|
220
|
+
disabled: n,
|
|
221
|
+
children: "Cancel"
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ t(
|
|
225
|
+
I,
|
|
226
|
+
{
|
|
227
|
+
size: "xs",
|
|
228
|
+
onClick: u,
|
|
229
|
+
disabled: !r.trim() || n,
|
|
230
|
+
children: n ? /* @__PURE__ */ s(R, { children: [
|
|
231
|
+
/* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
232
|
+
"Creating..."
|
|
233
|
+
] }) : "Create library visual"
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
] })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
) });
|
|
240
|
+
}
|
|
241
|
+
function $r(e) {
|
|
242
|
+
const [a, o] = S(null), [n, i] = S(null), r = ta();
|
|
243
|
+
return xe(() => {
|
|
244
|
+
if (!e || e.trim() === "") {
|
|
245
|
+
o(null), i(null);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (!r)
|
|
249
|
+
return;
|
|
250
|
+
(async () => {
|
|
251
|
+
try {
|
|
252
|
+
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
253
|
+
throw new Error(`Invalid URL format: ${e}`);
|
|
254
|
+
try {
|
|
255
|
+
new URL(e);
|
|
256
|
+
} catch {
|
|
257
|
+
throw new Error(`Invalid URL: ${e}`);
|
|
258
|
+
}
|
|
259
|
+
const l = `${e.endsWith("/") ? e : `${e}/`}index.js`;
|
|
260
|
+
try {
|
|
261
|
+
if (!(await fetch(l, { method: "HEAD" })).ok)
|
|
262
|
+
throw new Error(`Module not found at ${l}`);
|
|
263
|
+
} catch {
|
|
264
|
+
}
|
|
265
|
+
const u = await import(
|
|
266
|
+
/* @vite-ignore */
|
|
267
|
+
/* webpackIgnore: true */
|
|
268
|
+
l
|
|
269
|
+
);
|
|
270
|
+
if (typeof u.useChartStore != "function")
|
|
271
|
+
throw new Error("useChartStore is not a function");
|
|
272
|
+
o(() => u.useChartStore), i(null);
|
|
273
|
+
} catch (c) {
|
|
274
|
+
const l = c instanceof Error ? c.message : "Unknown error";
|
|
275
|
+
console.error("Failed to load remote chart store:", l), i(l), o(null);
|
|
276
|
+
}
|
|
277
|
+
})();
|
|
278
|
+
}, [e, r]), a;
|
|
279
|
+
}
|
|
280
|
+
function Wr(e, a) {
|
|
281
|
+
if (e.length === 0)
|
|
282
|
+
return "";
|
|
283
|
+
const o = e.find(
|
|
284
|
+
(n) => {
|
|
285
|
+
var i, r;
|
|
286
|
+
return ((i = n.customCardPreferences) == null ? void 0 : i.visualType) === "multiple" || !!((r = n.customCardPreferences) != null && r.dataInputCardIds);
|
|
287
|
+
}
|
|
288
|
+
);
|
|
289
|
+
if (o)
|
|
290
|
+
return o.id;
|
|
291
|
+
if (a) {
|
|
292
|
+
const n = e.find((i) => i.id === a);
|
|
293
|
+
if (n) {
|
|
294
|
+
const i = n.tabTitle;
|
|
295
|
+
if (i == "All__Header")
|
|
296
|
+
return e[0].id;
|
|
297
|
+
if (i && i.endsWith("__Header")) {
|
|
298
|
+
const d = i.split("__")[0], c = e.find(
|
|
299
|
+
(l) => l.tabTitle === d
|
|
300
|
+
);
|
|
301
|
+
return c ? c.id : e[0].id;
|
|
302
|
+
}
|
|
303
|
+
return a;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return e[0].id;
|
|
307
|
+
}
|
|
308
|
+
async function Tt(e, a, o, n, i = "Opening library visual...") {
|
|
309
|
+
if (!a || !o)
|
|
310
|
+
throw new Error("Missing auth token or visual ID");
|
|
311
|
+
const r = ["resource-by-id", "visual", o], d = n.getQueryData(r);
|
|
312
|
+
if (d)
|
|
313
|
+
return console.log("Using cached visual data for:", o), { data: d, fromCache: !0 };
|
|
314
|
+
console.log("Fetching visual data from network for:", o);
|
|
315
|
+
const c = E.loading(i, {
|
|
316
|
+
position: "top-center"
|
|
317
|
+
});
|
|
318
|
+
try {
|
|
319
|
+
const l = await fetch(
|
|
320
|
+
`${e}/management/v1/visuals/${o}`,
|
|
321
|
+
{
|
|
322
|
+
headers: {
|
|
323
|
+
Authorization: `Bearer ${a}`
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
if (!l.ok)
|
|
328
|
+
throw new Error("Failed to load visual");
|
|
329
|
+
const u = await l.json();
|
|
330
|
+
return n.setQueryData(r, u), E.dismiss(c), { data: u, fromCache: !1 };
|
|
331
|
+
} catch (l) {
|
|
332
|
+
throw E.dismiss(c), l;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
function Gt(e) {
|
|
336
|
+
if (typeof e == "string")
|
|
337
|
+
return JSON.parse(e);
|
|
338
|
+
if (typeof e == "object")
|
|
339
|
+
return e;
|
|
340
|
+
throw new Error("Invalid frame object format");
|
|
341
|
+
}
|
|
342
|
+
function qr(e, a) {
|
|
343
|
+
var r, d;
|
|
344
|
+
const o = (e == null ? void 0 : e.frameObject) ?? ((r = e == null ? void 0 : e.visual) == null ? void 0 : r.frameObject);
|
|
345
|
+
if (!o)
|
|
346
|
+
return !1;
|
|
347
|
+
const n = Gt(o);
|
|
348
|
+
if (!(n != null && n.cards) || n.cards.length === 0)
|
|
349
|
+
return !1;
|
|
350
|
+
const i = (d = n.cards) == null ? void 0 : d.find(
|
|
351
|
+
(c) => c.id === n.activeCardId
|
|
352
|
+
);
|
|
353
|
+
return i ? (sa({
|
|
354
|
+
...a,
|
|
355
|
+
frame: n,
|
|
356
|
+
card: i,
|
|
357
|
+
visualId: (e == null ? void 0 : e.id) || n.visualId
|
|
358
|
+
}), !0) : !1;
|
|
359
|
+
}
|
|
360
|
+
function Hr() {
|
|
361
|
+
const e = ee(
|
|
362
|
+
(n) => {
|
|
363
|
+
var i;
|
|
364
|
+
return ((i = n.card.customCardPreferences) == null ? void 0 : i.url) || "";
|
|
365
|
+
}
|
|
366
|
+
), a = $r(e);
|
|
367
|
+
return { getUpdatedFrame: Z(() => {
|
|
368
|
+
var g;
|
|
369
|
+
Nr();
|
|
370
|
+
const {
|
|
371
|
+
frame: n,
|
|
372
|
+
card: i,
|
|
373
|
+
isDevMode: r,
|
|
374
|
+
selectedSchemaName: d,
|
|
375
|
+
selectedDatabaseName: c,
|
|
376
|
+
selectedTableName: l,
|
|
377
|
+
selectedConnectionId: u
|
|
378
|
+
} = ee.getState(), h = i.sql, m = (g = a == null ? void 0 : a.getState()) == null ? void 0 : g.settings, p = fr(i, {
|
|
379
|
+
isDevMode: r,
|
|
380
|
+
cardSql: h,
|
|
381
|
+
selectedSchemaName: d,
|
|
382
|
+
selectedDatabaseName: c,
|
|
383
|
+
selectedTableName: l,
|
|
384
|
+
selectedConnectionId: u,
|
|
385
|
+
remoteChartSettings: m,
|
|
386
|
+
stripConfig: gr
|
|
387
|
+
}), f = n.cards.map(
|
|
388
|
+
(v) => v.id === i.id ? p : v
|
|
389
|
+
);
|
|
390
|
+
return {
|
|
391
|
+
...n,
|
|
392
|
+
cards: f,
|
|
393
|
+
activeCardId: Wr(f, n.activeCardId)
|
|
394
|
+
};
|
|
395
|
+
}, [a]) };
|
|
396
|
+
}
|
|
397
|
+
function ye() {
|
|
398
|
+
const { authToken: e, tokenProps: a } = it(), o = Qe(), n = aa(), i = Ke(), { selectVisual: r } = lt(), {
|
|
399
|
+
setFrame: d,
|
|
400
|
+
setCard: c,
|
|
401
|
+
setIsDevMode: l,
|
|
402
|
+
initializeModeDrafts: u,
|
|
403
|
+
setActiveTabCardId: h,
|
|
404
|
+
updateDataSource: m,
|
|
405
|
+
setQueryResultColumns: p,
|
|
406
|
+
setSelectedConnectionId: f,
|
|
407
|
+
setSelectedDatabaseName: g,
|
|
408
|
+
setSelectedSchemaName: v,
|
|
409
|
+
setSelectedTableName: k,
|
|
410
|
+
setSelectedDatamodelId: V,
|
|
411
|
+
setInlineFilterValuesMap: U,
|
|
412
|
+
setApplyFilters: M,
|
|
413
|
+
clearEditorContext: A
|
|
414
|
+
} = Ge(), {
|
|
415
|
+
setIsDashboardEditing: O,
|
|
416
|
+
setIsVisualEditing: b,
|
|
417
|
+
clearSelectedFrameId: F
|
|
418
|
+
} = ce(), C = w((L) => L.selectedSheetId), D = w((L) => L.selectedFrameId), N = w((L) => L.dashboard), j = w(
|
|
419
|
+
(L) => L.inlineFilterValuesMap
|
|
420
|
+
), T = ra((i == null ? void 0 : i.id) || "", {
|
|
421
|
+
enabled: !!(i != null && i.id) && !!(e != null && e.accessToken)
|
|
422
|
+
}), z = Z(
|
|
423
|
+
async (L) => {
|
|
424
|
+
try {
|
|
425
|
+
r(L), F(), A();
|
|
426
|
+
const { data: ae, fromCache: Y } = await Tt(
|
|
427
|
+
a.apiServiceUrl,
|
|
428
|
+
(e == null ? void 0 : e.accessToken) || "",
|
|
429
|
+
L.id,
|
|
430
|
+
o,
|
|
431
|
+
"Opening library visual..."
|
|
432
|
+
);
|
|
433
|
+
if (!qr(ae, {
|
|
434
|
+
setFrame: d,
|
|
435
|
+
setCard: c,
|
|
436
|
+
setIsDevMode: l,
|
|
437
|
+
initializeModeDrafts: u,
|
|
438
|
+
setActiveTabCardId: h,
|
|
439
|
+
updateDataSource: m,
|
|
440
|
+
setQueryResultColumns: p,
|
|
441
|
+
setSelectedConnectionId: f,
|
|
442
|
+
setSelectedDatabaseName: g,
|
|
443
|
+
setSelectedSchemaName: v,
|
|
444
|
+
setSelectedTableName: k,
|
|
445
|
+
setSelectedDatamodelId: V,
|
|
446
|
+
setInlineFilterValuesMap: U,
|
|
447
|
+
setApplyFilters: M,
|
|
448
|
+
setIsDashboardEditing: O,
|
|
449
|
+
setIsVisualEditing: b,
|
|
450
|
+
dashboard: N,
|
|
451
|
+
selectedSheetId: C,
|
|
452
|
+
selectedFrameId: D,
|
|
453
|
+
inlineFilterValuesMap: j
|
|
454
|
+
}))
|
|
455
|
+
throw new Error("Failed to setup editor with visual data");
|
|
456
|
+
return { success: !0, fromCache: Y };
|
|
457
|
+
} catch (ae) {
|
|
458
|
+
return console.error("Error editing visual:", ae), { success: !1, error: "Failed to load visual for editing" };
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
[
|
|
462
|
+
e == null ? void 0 : e.accessToken,
|
|
463
|
+
a.apiServiceUrl,
|
|
464
|
+
o,
|
|
465
|
+
r,
|
|
466
|
+
d,
|
|
467
|
+
c,
|
|
468
|
+
O,
|
|
469
|
+
b,
|
|
470
|
+
l,
|
|
471
|
+
u,
|
|
472
|
+
h,
|
|
473
|
+
m,
|
|
474
|
+
p,
|
|
475
|
+
f,
|
|
476
|
+
g,
|
|
477
|
+
v,
|
|
478
|
+
k,
|
|
479
|
+
V,
|
|
480
|
+
U,
|
|
481
|
+
M,
|
|
482
|
+
A,
|
|
483
|
+
F,
|
|
484
|
+
N,
|
|
485
|
+
C,
|
|
486
|
+
D,
|
|
487
|
+
j
|
|
488
|
+
]
|
|
489
|
+
), X = Z(
|
|
490
|
+
async (L) => {
|
|
491
|
+
var Y;
|
|
492
|
+
const ae = (H) => (E.error(H), { success: !1, error: H });
|
|
493
|
+
try {
|
|
494
|
+
if (r(L), !C)
|
|
495
|
+
return ae("No sheet selected. Please select a sheet first.");
|
|
496
|
+
const { data: H, fromCache: he } = await Tt(
|
|
497
|
+
a.apiServiceUrl,
|
|
498
|
+
(e == null ? void 0 : e.accessToken) || "",
|
|
499
|
+
L.id,
|
|
500
|
+
o,
|
|
501
|
+
"Adding visual to dashboard..."
|
|
502
|
+
), ge = (H == null ? void 0 : H.frameObject) ?? ((Y = H == null ? void 0 : H.visual) == null ? void 0 : Y.frameObject);
|
|
503
|
+
if (!ge)
|
|
504
|
+
return ae("Visual has no frame data");
|
|
505
|
+
const Q = Gt(ge);
|
|
506
|
+
if (!(Q != null && Q.cards) || Q.cards.length === 0)
|
|
507
|
+
return ae("Visual frame is malformed");
|
|
508
|
+
const _ = {
|
|
509
|
+
...na(Q),
|
|
510
|
+
visualId: L.id
|
|
511
|
+
// Link this frame to the library visual
|
|
512
|
+
};
|
|
513
|
+
return await n(C, _), O(!0), { success: !0, fromCache: he };
|
|
514
|
+
} catch (H) {
|
|
515
|
+
return console.error("Error adding visual:", H), ae(
|
|
516
|
+
H instanceof Error ? H.message : "Failed to add visual to dashboard"
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
[
|
|
521
|
+
e == null ? void 0 : e.accessToken,
|
|
522
|
+
a.apiServiceUrl,
|
|
523
|
+
o,
|
|
524
|
+
r,
|
|
525
|
+
C,
|
|
526
|
+
O,
|
|
527
|
+
n
|
|
528
|
+
]
|
|
529
|
+
);
|
|
530
|
+
return {
|
|
531
|
+
visual: T.data,
|
|
532
|
+
isLoading: T.isLoading,
|
|
533
|
+
isError: T.isError,
|
|
534
|
+
error: T.error,
|
|
535
|
+
handleEditLibraryVisual: z,
|
|
536
|
+
handleAddLibraryVisual: X,
|
|
537
|
+
getUpdatedFrame: Hr().getUpdatedFrame,
|
|
538
|
+
refetch: T.refetch
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
function Xt(e) {
|
|
542
|
+
return e ? new Date(e).toLocaleDateString("en-US", {
|
|
543
|
+
month: "short",
|
|
544
|
+
day: "numeric",
|
|
545
|
+
year: "numeric"
|
|
546
|
+
}) : "Unknown";
|
|
547
|
+
}
|
|
548
|
+
function Yt(e, a) {
|
|
549
|
+
var n;
|
|
550
|
+
const o = (n = e.ownership.createdBy) == null ? void 0 : n.type;
|
|
551
|
+
return o === "tenant" || o === "organization" && a;
|
|
552
|
+
}
|
|
553
|
+
function St(e, a) {
|
|
554
|
+
var o, n;
|
|
555
|
+
return Yt(e, a) ? ((o = e.ownership.createdBy) == null ? void 0 : o.name) || ((n = e.createdByTenantUserRel) == null ? void 0 : n.name) || e.lastModifiedBy || "Unknown" : "Organization";
|
|
556
|
+
}
|
|
557
|
+
function Qr(e, a) {
|
|
558
|
+
return St(e, a).split(/\s+/).filter(Boolean).slice(0, 2).map((n) => n.charAt(0).toUpperCase()).join("") || "?";
|
|
559
|
+
}
|
|
560
|
+
function Kr(e) {
|
|
561
|
+
const a = (e || "").toLowerCase();
|
|
562
|
+
return a.includes("table") ? jt : a.includes("pie") || a.includes("donut") ? ha : a.includes("line") ? ma : a.includes("bar") ? ur : Ee;
|
|
563
|
+
}
|
|
564
|
+
function Gr({ visual: e }) {
|
|
565
|
+
const a = e.ownership.status === "public" ? "Public" : e.ownership.status === "shared" || e.ownership.sharedCount > 0 ? "Shared" : "Private";
|
|
566
|
+
return /* @__PURE__ */ t("span", { className: "inline-flex items-center rounded-[4px] border border-border/60 px-1.5 py-px text-[11px] text-muted-foreground", children: a });
|
|
567
|
+
}
|
|
568
|
+
function hs({
|
|
569
|
+
open: e,
|
|
570
|
+
onOpenChange: a
|
|
571
|
+
}) {
|
|
572
|
+
const o = ot("interactive"), [n, i] = S(""), [r, d] = S(/* @__PURE__ */ new Set()), [c, l] = S(!1), [u, h] = S(
|
|
573
|
+
null
|
|
574
|
+
), [m, p] = S(
|
|
575
|
+
null
|
|
576
|
+
), [f, g] = S(!1), [v, k] = S(null), [V, U] = S(null), M = () => {
|
|
577
|
+
d(/* @__PURE__ */ new Set()), h(null), p(null), g(!1), k(null);
|
|
578
|
+
}, A = () => {
|
|
579
|
+
a(!1), M();
|
|
580
|
+
}, { selectVisual: O } = lt(), { handleAddLibraryVisual: b, handleEditLibraryVisual: F } = ye(), { isConsoleMode: C } = oa(), {
|
|
581
|
+
resources: D,
|
|
582
|
+
isLoading: N,
|
|
583
|
+
isError: j,
|
|
584
|
+
createResource: T,
|
|
585
|
+
updateResource: z,
|
|
586
|
+
deleteResourceAsync: X,
|
|
587
|
+
duplicateResource: L,
|
|
588
|
+
isCreating: ae,
|
|
589
|
+
isDeleting: Y
|
|
590
|
+
} = ia(
|
|
591
|
+
void 0,
|
|
592
|
+
(x) => {
|
|
593
|
+
l(!1), x && (O(x), F(x), A());
|
|
594
|
+
}
|
|
595
|
+
), {
|
|
596
|
+
startUpdating: H,
|
|
597
|
+
stopUpdating: he,
|
|
598
|
+
isUpdating: ge
|
|
599
|
+
} = la(), Q = D, _ = te(() => {
|
|
600
|
+
const x = n.trim().toLowerCase();
|
|
601
|
+
return x ? Q.filter(
|
|
602
|
+
(B) => {
|
|
603
|
+
var q, ie, ue;
|
|
604
|
+
return ((q = B.title) == null ? void 0 : q.toLowerCase().includes(x)) || ((ie = B.description) == null ? void 0 : ie.toLowerCase().includes(x)) || ((ue = B.kind) == null ? void 0 : ue.toLowerCase().includes(x));
|
|
605
|
+
}
|
|
606
|
+
) : Q;
|
|
607
|
+
}, [n, Q]), oe = te(
|
|
608
|
+
() => Q.filter(
|
|
609
|
+
(x) => r.has(x.id)
|
|
610
|
+
),
|
|
611
|
+
[r, Q]
|
|
612
|
+
), me = oe.filter(
|
|
613
|
+
(x) => x.permissions.canDelete
|
|
614
|
+
), pe = oe.filter(
|
|
615
|
+
(x) => x.permissions.canShare
|
|
616
|
+
), Ce = _.length > 0 && _.every(
|
|
617
|
+
(x) => r.has(x.id)
|
|
618
|
+
), Me = _.some(
|
|
619
|
+
(x) => r.has(x.id)
|
|
620
|
+
), Ye = (x) => {
|
|
621
|
+
const B = new Set(r);
|
|
622
|
+
x(B), d(B);
|
|
623
|
+
}, $ = (x) => {
|
|
624
|
+
Ye((B) => {
|
|
625
|
+
B.has(x) ? B.delete(x) : B.add(x);
|
|
626
|
+
});
|
|
627
|
+
}, W = () => {
|
|
628
|
+
d((x) => {
|
|
629
|
+
const B = new Set(x);
|
|
630
|
+
return Ce ? _.forEach(
|
|
631
|
+
(q) => B.delete(q.id)
|
|
632
|
+
) : _.forEach(
|
|
633
|
+
(q) => B.add(q.id)
|
|
634
|
+
), B;
|
|
635
|
+
});
|
|
636
|
+
}, ne = async (x) => {
|
|
637
|
+
(await b(x)).success && A();
|
|
638
|
+
}, we = async () => {
|
|
639
|
+
const x = oe;
|
|
640
|
+
if (x.length === 0) return;
|
|
641
|
+
let B = !1;
|
|
642
|
+
for (const q of x)
|
|
643
|
+
if (!(await b(q)).success) {
|
|
644
|
+
B = !0;
|
|
645
|
+
break;
|
|
646
|
+
}
|
|
647
|
+
B || A();
|
|
648
|
+
}, Ze = (x) => {
|
|
649
|
+
F(x), A();
|
|
650
|
+
}, be = (x) => {
|
|
651
|
+
U(x), L(x, {
|
|
652
|
+
onSettled: () => U(null)
|
|
653
|
+
});
|
|
654
|
+
}, Ue = () => {
|
|
655
|
+
if (me.length === 0) {
|
|
656
|
+
E.error("Select a visual you can delete");
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
k(null), g(!0);
|
|
660
|
+
}, Je = async () => {
|
|
661
|
+
const x = v ? [v] : me;
|
|
662
|
+
try {
|
|
663
|
+
for (const B of x)
|
|
664
|
+
await X(B.id);
|
|
665
|
+
d((B) => {
|
|
666
|
+
const q = new Set(B);
|
|
667
|
+
return x.forEach(
|
|
668
|
+
(ie) => q.delete(ie.id)
|
|
669
|
+
), q;
|
|
670
|
+
}), g(!1), k(null);
|
|
671
|
+
} catch {
|
|
672
|
+
}
|
|
673
|
+
}, Ne = () => {
|
|
674
|
+
if (oe.length !== 1) {
|
|
675
|
+
E.error("Select one visual to share");
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const [x] = oe;
|
|
679
|
+
if (!x.permissions.canShare) {
|
|
680
|
+
E.error("You do not have permission to share this visual");
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
h(x);
|
|
684
|
+
}, Se = ({
|
|
685
|
+
title: x,
|
|
686
|
+
description: B
|
|
687
|
+
}) => {
|
|
688
|
+
if (!m) return;
|
|
689
|
+
const q = {};
|
|
690
|
+
if (x !== m.title && (q.title = x), (m.description || "") !== B && (q.description = B), Object.keys(q).length === 0) {
|
|
691
|
+
p(null);
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const ie = Object.keys(q), ue = ie.length === 1 ? ie[0] : void 0;
|
|
695
|
+
H(m.id, ue), z(
|
|
696
|
+
{
|
|
697
|
+
resourceId: m.id,
|
|
698
|
+
data: q
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
onSuccess: () => {
|
|
702
|
+
he(m.id, ue), p(null);
|
|
703
|
+
},
|
|
704
|
+
onError: () => {
|
|
705
|
+
he(m.id, ue);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
);
|
|
709
|
+
}, se = (x) => {
|
|
710
|
+
a(x), x || M();
|
|
711
|
+
}, ke = v ? 1 : me.length;
|
|
712
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
713
|
+
/* @__PURE__ */ t(Ie, { open: e, onOpenChange: se, children: /* @__PURE__ */ s(
|
|
714
|
+
Te,
|
|
715
|
+
{
|
|
716
|
+
showCloseButton: !1,
|
|
717
|
+
className: "flex max-h-[80vh] w-[min(72rem,calc(100vw-2rem))] max-w-none grid-cols-none flex-col gap-0 overflow-hidden rounded-card border-border/60 p-0 shadow-lg sm:rounded-card",
|
|
718
|
+
style: o.dialogStyle,
|
|
719
|
+
children: [
|
|
720
|
+
/* @__PURE__ */ s("div", { className: "flex h-10 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3", children: [
|
|
721
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
722
|
+
/* @__PURE__ */ t(jt, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
723
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
724
|
+
/* @__PURE__ */ t(Le, { className: "truncate text-[13px] font-medium leading-none tracking-normal", children: "Visuals library" }),
|
|
725
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-[10px] font-medium uppercase leading-none tracking-[0.08em] text-muted-foreground", children: "Add to dashboard" })
|
|
726
|
+
] })
|
|
727
|
+
] }),
|
|
728
|
+
/* @__PURE__ */ t(
|
|
729
|
+
I,
|
|
730
|
+
{
|
|
731
|
+
size: "xs",
|
|
732
|
+
variant: "ghost",
|
|
733
|
+
className: "w-7 px-0 text-muted-foreground hover:text-foreground",
|
|
734
|
+
onClick: () => se(!1),
|
|
735
|
+
"aria-label": "Close visuals library",
|
|
736
|
+
children: "×"
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
] }),
|
|
740
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-2 border-b border-border/60 px-3 py-2", children: [
|
|
741
|
+
/* @__PURE__ */ s("div", { className: "relative min-w-[12rem] flex-1 md:max-w-md", children: [
|
|
742
|
+
/* @__PURE__ */ t(pr, { className: "pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
743
|
+
/* @__PURE__ */ t(
|
|
744
|
+
"input",
|
|
745
|
+
{
|
|
746
|
+
autoFocus: !0,
|
|
747
|
+
value: n,
|
|
748
|
+
onChange: (x) => i(x.target.value),
|
|
749
|
+
placeholder: "Search visuals...",
|
|
750
|
+
className: "h-7 w-full rounded-control border border-input bg-background pl-7 pr-2 text-[12px] text-foreground placeholder:text-muted-foreground focus:border-ring focus:outline-none",
|
|
751
|
+
"aria-label": "Search visuals"
|
|
752
|
+
}
|
|
753
|
+
)
|
|
754
|
+
] }),
|
|
755
|
+
/* @__PURE__ */ s(
|
|
756
|
+
I,
|
|
757
|
+
{
|
|
758
|
+
size: "xs",
|
|
759
|
+
variant: "outline",
|
|
760
|
+
className: "ml-auto",
|
|
761
|
+
onClick: () => l(!0),
|
|
762
|
+
children: [
|
|
763
|
+
/* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
|
|
764
|
+
"New library visual"
|
|
765
|
+
]
|
|
766
|
+
}
|
|
767
|
+
)
|
|
768
|
+
] }),
|
|
769
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: N ? /* @__PURE__ */ t("div", { className: "p-3", children: /* @__PURE__ */ t(_r, {}) }) : j ? /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: /* @__PURE__ */ t("p", { className: "text-[13px] text-destructive", children: "Failed to load visuals" }) }) : _.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 px-4 py-12 text-center", children: [
|
|
770
|
+
/* @__PURE__ */ t(Ee, { className: "h-5 w-5 text-muted-foreground/60" }),
|
|
771
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: n ? "No visuals found" : "No visuals yet" }),
|
|
772
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: n ? "Try a different search." : "Create a saved visual to add it here." })
|
|
773
|
+
] }) : /* @__PURE__ */ t(
|
|
774
|
+
Xr,
|
|
775
|
+
{
|
|
776
|
+
visuals: _,
|
|
777
|
+
selectedIds: r,
|
|
778
|
+
allFilteredSelected: Ce,
|
|
779
|
+
someFilteredSelected: Me,
|
|
780
|
+
onSelectAll: W,
|
|
781
|
+
onToggleSelection: $,
|
|
782
|
+
onAddVisual: ne,
|
|
783
|
+
onOpenVisual: Ze,
|
|
784
|
+
onEditDetails: p,
|
|
785
|
+
onShareVisual: h,
|
|
786
|
+
onDeleteVisual: (x) => {
|
|
787
|
+
k(x), g(!0);
|
|
788
|
+
},
|
|
789
|
+
onDuplicateVisual: be,
|
|
790
|
+
duplicatingId: V,
|
|
791
|
+
isDeleting: Y,
|
|
792
|
+
isConsoleMode: C
|
|
793
|
+
}
|
|
794
|
+
) }),
|
|
795
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border/60 px-3 py-2", children: [
|
|
796
|
+
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5", children: r.size > 0 && /* @__PURE__ */ s(R, { children: [
|
|
797
|
+
/* @__PURE__ */ s("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
798
|
+
/* @__PURE__ */ t("span", { className: "font-medium tabular-nums text-foreground", children: r.size }),
|
|
799
|
+
" ",
|
|
800
|
+
"selected"
|
|
801
|
+
] }),
|
|
802
|
+
/* @__PURE__ */ t(
|
|
803
|
+
I,
|
|
804
|
+
{
|
|
805
|
+
size: "xs",
|
|
806
|
+
variant: "ghost",
|
|
807
|
+
onClick: () => d(/* @__PURE__ */ new Set()),
|
|
808
|
+
children: "Clear"
|
|
809
|
+
}
|
|
810
|
+
),
|
|
811
|
+
/* @__PURE__ */ s(
|
|
812
|
+
I,
|
|
813
|
+
{
|
|
814
|
+
size: "xs",
|
|
815
|
+
variant: "outline",
|
|
816
|
+
onClick: Ne,
|
|
817
|
+
disabled: oe.length !== 1 || pe.length !== 1,
|
|
818
|
+
children: [
|
|
819
|
+
/* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5" }),
|
|
820
|
+
"Share"
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ s(
|
|
825
|
+
I,
|
|
826
|
+
{
|
|
827
|
+
size: "xs",
|
|
828
|
+
variant: "outline",
|
|
829
|
+
className: "text-destructive hover:text-destructive",
|
|
830
|
+
onClick: Ue,
|
|
831
|
+
disabled: me.length === 0,
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }),
|
|
834
|
+
"Delete ",
|
|
835
|
+
me.length || r.size
|
|
836
|
+
]
|
|
837
|
+
}
|
|
838
|
+
)
|
|
839
|
+
] }) }),
|
|
840
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
841
|
+
/* @__PURE__ */ t(
|
|
842
|
+
I,
|
|
843
|
+
{
|
|
844
|
+
size: "xs",
|
|
845
|
+
variant: "outline",
|
|
846
|
+
onClick: () => se(!1),
|
|
847
|
+
children: "Close"
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
/* @__PURE__ */ s(
|
|
851
|
+
I,
|
|
852
|
+
{
|
|
853
|
+
size: "xs",
|
|
854
|
+
onClick: we,
|
|
855
|
+
disabled: r.size === 0,
|
|
856
|
+
children: [
|
|
857
|
+
/* @__PURE__ */ t(Ct, { className: "h-3.5 w-3.5" }),
|
|
858
|
+
r.size === 0 ? "Add to dashboard" : `Add ${r.size} visual${r.size === 1 ? "" : "s"}`
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] })
|
|
863
|
+
] })
|
|
864
|
+
]
|
|
865
|
+
}
|
|
866
|
+
) }),
|
|
867
|
+
/* @__PURE__ */ t(
|
|
868
|
+
jr,
|
|
869
|
+
{
|
|
870
|
+
open: c,
|
|
871
|
+
onOpenChange: l,
|
|
872
|
+
onSubmit: T,
|
|
873
|
+
isCreating: ae
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
u && /* @__PURE__ */ t(
|
|
877
|
+
da,
|
|
878
|
+
{
|
|
879
|
+
resource: u,
|
|
880
|
+
resourceType: ca.VISUAL,
|
|
881
|
+
onClose: () => h(null)
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
m && /* @__PURE__ */ t(
|
|
885
|
+
ua,
|
|
886
|
+
{
|
|
887
|
+
open: !!m,
|
|
888
|
+
resourceLabel: "Visual",
|
|
889
|
+
initialTitle: m.title || "",
|
|
890
|
+
initialDescription: m.description || "",
|
|
891
|
+
onClose: () => p(null),
|
|
892
|
+
onSave: Se,
|
|
893
|
+
isSaving: ge(m.id)
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
/* @__PURE__ */ t(
|
|
897
|
+
dt,
|
|
898
|
+
{
|
|
899
|
+
open: f,
|
|
900
|
+
onOpenChange: (x) => {
|
|
901
|
+
!x && Y || (g(x), x || k(null));
|
|
902
|
+
},
|
|
903
|
+
children: /* @__PURE__ */ s(ct, { children: [
|
|
904
|
+
/* @__PURE__ */ s(ut, { children: [
|
|
905
|
+
/* @__PURE__ */ s(ht, { children: [
|
|
906
|
+
"Delete ",
|
|
907
|
+
ke,
|
|
908
|
+
" visual",
|
|
909
|
+
ke === 1 ? "" : "s",
|
|
910
|
+
"?"
|
|
911
|
+
] }),
|
|
912
|
+
/* @__PURE__ */ t(mt, { children: "This cannot be undone. Visuals already added to dashboards may need to be removed from those dashboards separately." })
|
|
913
|
+
] }),
|
|
914
|
+
/* @__PURE__ */ s(pt, { children: [
|
|
915
|
+
/* @__PURE__ */ t(ft, { disabled: Y, children: "Cancel" }),
|
|
916
|
+
/* @__PURE__ */ s(
|
|
917
|
+
Mt,
|
|
918
|
+
{
|
|
919
|
+
onClick: (x) => {
|
|
920
|
+
x.preventDefault(), Je();
|
|
921
|
+
},
|
|
922
|
+
disabled: Y || ke === 0,
|
|
923
|
+
children: [
|
|
924
|
+
Y ? /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }),
|
|
925
|
+
Y ? "Deleting..." : "Delete"
|
|
926
|
+
]
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
] })
|
|
930
|
+
] })
|
|
931
|
+
}
|
|
932
|
+
)
|
|
933
|
+
] });
|
|
934
|
+
}
|
|
935
|
+
function Xr({
|
|
936
|
+
visuals: e,
|
|
937
|
+
selectedIds: a,
|
|
938
|
+
allFilteredSelected: o,
|
|
939
|
+
someFilteredSelected: n,
|
|
940
|
+
onSelectAll: i,
|
|
941
|
+
onToggleSelection: r,
|
|
942
|
+
onAddVisual: d,
|
|
943
|
+
onOpenVisual: c,
|
|
944
|
+
onEditDetails: l,
|
|
945
|
+
onShareVisual: u,
|
|
946
|
+
onDeleteVisual: h,
|
|
947
|
+
onDuplicateVisual: m,
|
|
948
|
+
duplicatingId: p,
|
|
949
|
+
isDeleting: f,
|
|
950
|
+
isConsoleMode: g
|
|
951
|
+
}) {
|
|
952
|
+
return /* @__PURE__ */ s("div", { className: "min-w-[48rem]", children: [
|
|
953
|
+
/* @__PURE__ */ s("div", { className: "grid h-9 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/60 px-3 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: [
|
|
954
|
+
/* @__PURE__ */ t(
|
|
955
|
+
gt,
|
|
956
|
+
{
|
|
957
|
+
checked: o ? !0 : n ? "indeterminate" : !1,
|
|
958
|
+
onCheckedChange: i,
|
|
959
|
+
"aria-label": "Select all visuals"
|
|
960
|
+
}
|
|
961
|
+
),
|
|
962
|
+
/* @__PURE__ */ t("span", { children: "Name" }),
|
|
963
|
+
/* @__PURE__ */ t("span", { children: "Created by" }),
|
|
964
|
+
/* @__PURE__ */ t("span", { children: "Updated" }),
|
|
965
|
+
/* @__PURE__ */ t("span", { children: "Visibility" }),
|
|
966
|
+
/* @__PURE__ */ t("span", { className: "text-right", children: "Shared" }),
|
|
967
|
+
/* @__PURE__ */ t("span", { className: "text-right", children: "Actions" })
|
|
968
|
+
] }),
|
|
969
|
+
e.map((v) => /* @__PURE__ */ t(
|
|
970
|
+
Yr,
|
|
971
|
+
{
|
|
972
|
+
visual: v,
|
|
973
|
+
selected: a.has(v.id),
|
|
974
|
+
onToggleSelection: r,
|
|
975
|
+
onAddVisual: d,
|
|
976
|
+
onOpenVisual: c,
|
|
977
|
+
onEditDetails: l,
|
|
978
|
+
onShareVisual: u,
|
|
979
|
+
onDeleteVisual: h,
|
|
980
|
+
onDuplicateVisual: m,
|
|
981
|
+
duplicatingId: p,
|
|
982
|
+
isDeleting: f,
|
|
983
|
+
isConsoleMode: g
|
|
984
|
+
},
|
|
985
|
+
v.id
|
|
986
|
+
))
|
|
987
|
+
] });
|
|
988
|
+
}
|
|
989
|
+
function Yr({
|
|
990
|
+
visual: e,
|
|
991
|
+
selected: a,
|
|
992
|
+
onToggleSelection: o,
|
|
993
|
+
onAddVisual: n,
|
|
994
|
+
onOpenVisual: i,
|
|
995
|
+
onEditDetails: r,
|
|
996
|
+
onShareVisual: d,
|
|
997
|
+
onDeleteVisual: c,
|
|
998
|
+
onDuplicateVisual: l,
|
|
999
|
+
duplicatingId: u,
|
|
1000
|
+
isDeleting: h,
|
|
1001
|
+
isConsoleMode: m
|
|
1002
|
+
}) {
|
|
1003
|
+
var g;
|
|
1004
|
+
const p = Kr(e.kind), f = () => {
|
|
1005
|
+
n(e);
|
|
1006
|
+
};
|
|
1007
|
+
return /* @__PURE__ */ s(
|
|
1008
|
+
"div",
|
|
1009
|
+
{
|
|
1010
|
+
className: J(
|
|
1011
|
+
"group grid min-h-12 grid-cols-[2.5rem_minmax(14rem,1.8fr)_minmax(10rem,1fr)_8rem_7rem_5rem_5.5rem] items-center border-b border-border/50 px-3 text-[13px] hover:bg-muted/50",
|
|
1012
|
+
a && "bg-muted/70"
|
|
1013
|
+
),
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
1016
|
+
gt,
|
|
1017
|
+
{
|
|
1018
|
+
checked: a,
|
|
1019
|
+
onCheckedChange: () => o(e.id),
|
|
1020
|
+
"aria-label": `Select ${e.title || "visual"}`
|
|
1021
|
+
}
|
|
1022
|
+
) }),
|
|
1023
|
+
/* @__PURE__ */ s(
|
|
1024
|
+
"button",
|
|
1025
|
+
{
|
|
1026
|
+
type: "button",
|
|
1027
|
+
className: "flex min-w-0 items-center gap-2 rounded-[4px] text-left outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1028
|
+
onClick: f,
|
|
1029
|
+
"aria-label": `Add ${e.title || "visual"} to dashboard`,
|
|
1030
|
+
children: [
|
|
1031
|
+
/* @__PURE__ */ t(p, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
1032
|
+
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
1033
|
+
/* @__PURE__ */ t(
|
|
1034
|
+
"div",
|
|
1035
|
+
{
|
|
1036
|
+
className: "truncate font-medium text-foreground",
|
|
1037
|
+
title: e.title || "Untitled Visual",
|
|
1038
|
+
children: e.title || "Untitled Visual"
|
|
1039
|
+
}
|
|
1040
|
+
),
|
|
1041
|
+
((g = e.description) == null ? void 0 : g.trim()) && /* @__PURE__ */ t(
|
|
1042
|
+
"div",
|
|
1043
|
+
{
|
|
1044
|
+
className: "truncate text-[11px] text-muted-foreground",
|
|
1045
|
+
title: e.description,
|
|
1046
|
+
children: e.description
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
] })
|
|
1050
|
+
]
|
|
1051
|
+
}
|
|
1052
|
+
),
|
|
1053
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
1054
|
+
/* @__PURE__ */ t("div", { className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[9px] font-medium text-muted-foreground", children: Qr(e, m) }),
|
|
1055
|
+
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: St(e, m) })
|
|
1056
|
+
] }),
|
|
1057
|
+
/* @__PURE__ */ t("span", { className: "text-muted-foreground", children: Xt(e.updatedAt) }),
|
|
1058
|
+
/* @__PURE__ */ t(Gr, { visual: e }),
|
|
1059
|
+
/* @__PURE__ */ t("span", { className: "text-right tabular-nums text-muted-foreground", children: e.ownership.sharedCount > 0 ? e.ownership.sharedCount : "—" }),
|
|
1060
|
+
/* @__PURE__ */ t(
|
|
1061
|
+
Zr,
|
|
1062
|
+
{
|
|
1063
|
+
visual: e,
|
|
1064
|
+
onOpenVisual: i,
|
|
1065
|
+
onEditDetails: r,
|
|
1066
|
+
onShareVisual: d,
|
|
1067
|
+
onDeleteVisual: c,
|
|
1068
|
+
onDuplicateVisual: l,
|
|
1069
|
+
duplicatingId: u,
|
|
1070
|
+
isDeleting: h,
|
|
1071
|
+
isConsoleMode: m
|
|
1072
|
+
}
|
|
1073
|
+
)
|
|
1074
|
+
]
|
|
1075
|
+
}
|
|
1076
|
+
);
|
|
1077
|
+
}
|
|
1078
|
+
function Zr({
|
|
1079
|
+
visual: e,
|
|
1080
|
+
onOpenVisual: a,
|
|
1081
|
+
onEditDetails: o,
|
|
1082
|
+
onShareVisual: n,
|
|
1083
|
+
onDeleteVisual: i,
|
|
1084
|
+
onDuplicateVisual: r,
|
|
1085
|
+
duplicatingId: d,
|
|
1086
|
+
isDeleting: c,
|
|
1087
|
+
isConsoleMode: l
|
|
1088
|
+
}) {
|
|
1089
|
+
return /* @__PURE__ */ s(
|
|
1090
|
+
"div",
|
|
1091
|
+
{
|
|
1092
|
+
className: "flex items-center justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1093
|
+
onClick: (u) => u.stopPropagation(),
|
|
1094
|
+
children: [
|
|
1095
|
+
/* @__PURE__ */ t(
|
|
1096
|
+
I,
|
|
1097
|
+
{
|
|
1098
|
+
size: "xs",
|
|
1099
|
+
variant: "ghost",
|
|
1100
|
+
className: "w-7 px-0",
|
|
1101
|
+
onClick: () => a(e),
|
|
1102
|
+
"aria-label": "Edit visual",
|
|
1103
|
+
children: /* @__PURE__ */ t(et, { className: "h-3.5 w-3.5" })
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
/* @__PURE__ */ s(Ve, { modal: !1, children: [
|
|
1107
|
+
/* @__PURE__ */ t(Be, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1108
|
+
I,
|
|
1109
|
+
{
|
|
1110
|
+
size: "xs",
|
|
1111
|
+
variant: "ghost",
|
|
1112
|
+
className: "w-7 px-0",
|
|
1113
|
+
"aria-label": "More actions",
|
|
1114
|
+
children: /* @__PURE__ */ t(Ut, { className: "h-3.5 w-3.5" })
|
|
1115
|
+
}
|
|
1116
|
+
) }),
|
|
1117
|
+
/* @__PURE__ */ s(
|
|
1118
|
+
Pe,
|
|
1119
|
+
{
|
|
1120
|
+
align: "end",
|
|
1121
|
+
className: "z-[60] w-44 rounded-[6px] border-border/60 p-1 shadow-sm",
|
|
1122
|
+
children: [
|
|
1123
|
+
/* @__PURE__ */ s(G, { onClick: () => a(e), children: [
|
|
1124
|
+
/* @__PURE__ */ t(et, { className: "h-3.5 w-3.5" }),
|
|
1125
|
+
"Edit visual"
|
|
1126
|
+
] }),
|
|
1127
|
+
/* @__PURE__ */ s(
|
|
1128
|
+
G,
|
|
1129
|
+
{
|
|
1130
|
+
onClick: () => r(e.id),
|
|
1131
|
+
disabled: d === e.id,
|
|
1132
|
+
children: [
|
|
1133
|
+
d === e.id ? /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ t(pa, { className: "h-3.5 w-3.5" }),
|
|
1134
|
+
d === e.id ? "Duplicating..." : "Duplicate"
|
|
1135
|
+
]
|
|
1136
|
+
}
|
|
1137
|
+
),
|
|
1138
|
+
e.permissions.canEdit && /* @__PURE__ */ s(G, { onClick: () => o(e), children: [
|
|
1139
|
+
/* @__PURE__ */ t(et, { className: "h-3.5 w-3.5" }),
|
|
1140
|
+
"Edit details"
|
|
1141
|
+
] }),
|
|
1142
|
+
e.permissions.canShare && /* @__PURE__ */ s(G, { onClick: () => n(e), children: [
|
|
1143
|
+
/* @__PURE__ */ t(Pt, { className: "h-3.5 w-3.5" }),
|
|
1144
|
+
"Share"
|
|
1145
|
+
] }),
|
|
1146
|
+
e.permissions.canDelete && /* @__PURE__ */ s(R, { children: [
|
|
1147
|
+
/* @__PURE__ */ t(We, {}),
|
|
1148
|
+
/* @__PURE__ */ s(
|
|
1149
|
+
G,
|
|
1150
|
+
{
|
|
1151
|
+
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
1152
|
+
onClick: () => i(e),
|
|
1153
|
+
disabled: c,
|
|
1154
|
+
children: [
|
|
1155
|
+
/* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }),
|
|
1156
|
+
c ? "Deleting..." : "Delete"
|
|
1157
|
+
]
|
|
1158
|
+
}
|
|
1159
|
+
)
|
|
1160
|
+
] }),
|
|
1161
|
+
/* @__PURE__ */ t(We, {}),
|
|
1162
|
+
/* @__PURE__ */ s("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
|
|
1163
|
+
Yt(e, l) && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
1164
|
+
/* @__PURE__ */ t(fa, { className: "h-3 w-3" }),
|
|
1165
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: St(e, l) })
|
|
1166
|
+
] }),
|
|
1167
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
1168
|
+
/* @__PURE__ */ t(ga, { className: "h-3 w-3" }),
|
|
1169
|
+
/* @__PURE__ */ t("span", { children: Xt(e.updatedAt) })
|
|
1170
|
+
] })
|
|
1171
|
+
] })
|
|
1172
|
+
]
|
|
1173
|
+
}
|
|
1174
|
+
)
|
|
1175
|
+
] })
|
|
1176
|
+
]
|
|
1177
|
+
}
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
function ms(e, a, o = !1) {
|
|
1181
|
+
const n = w((u) => u.dashboard), i = w(
|
|
1182
|
+
(u) => u.isDashboardEditing
|
|
1183
|
+
), r = w(
|
|
1184
|
+
(u) => u.onDashboardLifecycleEvent
|
|
1185
|
+
), d = Z(() => {
|
|
1186
|
+
const u = w.getState().dashboard;
|
|
1187
|
+
return a || !e || !u || u.id !== e.id ? !1 : _e(u) !== _e(e);
|
|
1188
|
+
}, [e, a]);
|
|
1189
|
+
Dt(() => (w.setState({ checkUnsavedDashboardChanges: d }), () => {
|
|
1190
|
+
w.getState().checkUnsavedDashboardChanges === d && w.setState({ checkUnsavedDashboardChanges: null });
|
|
1191
|
+
}), [d]);
|
|
1192
|
+
const c = te(() => !o || a || !n || i && (!e || n.id !== e.id) ? null : {
|
|
1193
|
+
dashboardId: n.id,
|
|
1194
|
+
dirty: i && e ? _e(n) !== _e(e) : !1
|
|
1195
|
+
}, [
|
|
1196
|
+
i,
|
|
1197
|
+
a,
|
|
1198
|
+
o,
|
|
1199
|
+
e,
|
|
1200
|
+
n
|
|
1201
|
+
]), l = nt(null);
|
|
1202
|
+
return Dt(() => {
|
|
1203
|
+
if (!r || !c) {
|
|
1204
|
+
l.current = null;
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
const u = l.current;
|
|
1208
|
+
(u == null ? void 0 : u.callback) === r && u.dashboardId === c.dashboardId && u.dirty === c.dirty || (l.current = {
|
|
1209
|
+
callback: r,
|
|
1210
|
+
dashboardId: c.dashboardId,
|
|
1211
|
+
dirty: c.dirty
|
|
1212
|
+
}, r({
|
|
1213
|
+
type: "dashboard:dirty-state",
|
|
1214
|
+
dashboardId: c.dashboardId,
|
|
1215
|
+
payload: { dirty: c.dirty }
|
|
1216
|
+
}));
|
|
1217
|
+
}, [c, r]), d;
|
|
1218
|
+
}
|
|
1219
|
+
function Jr({
|
|
1220
|
+
open: e,
|
|
1221
|
+
onOpenChange: a,
|
|
1222
|
+
isLibraryVisual: o,
|
|
1223
|
+
currentVisualName: n,
|
|
1224
|
+
isSaving: i = !1,
|
|
1225
|
+
destinationMode: r = "both",
|
|
1226
|
+
onConfirm: d
|
|
1227
|
+
}) {
|
|
1228
|
+
const [c, l] = S(
|
|
1229
|
+
o && n ? `Copy of ${n}` : n || ""
|
|
1230
|
+
), [u, h] = S("");
|
|
1231
|
+
Vt.useEffect(() => {
|
|
1232
|
+
e && (l(
|
|
1233
|
+
o && n ? `Copy of ${n}` : n || ""
|
|
1234
|
+
), h(""));
|
|
1235
|
+
}, [e, o, n]);
|
|
1236
|
+
const m = !!c.trim(), p = r === "local" ? {
|
|
1237
|
+
saveToLibrary: !1,
|
|
1238
|
+
saveToCurrentDashboard: !0,
|
|
1239
|
+
badgeType: "local",
|
|
1240
|
+
description: "Creates a local copy on the current dashboard.",
|
|
1241
|
+
actionLabel: "Add to Dashboard (Local)"
|
|
1242
|
+
} : r === "library" ? {
|
|
1243
|
+
saveToLibrary: !0,
|
|
1244
|
+
saveToCurrentDashboard: !1,
|
|
1245
|
+
badgeType: "library",
|
|
1246
|
+
description: "Creates a reusable visual in Visual Library.",
|
|
1247
|
+
actionLabel: "Save as Library Visual"
|
|
1248
|
+
} : {
|
|
1249
|
+
saveToLibrary: !0,
|
|
1250
|
+
saveToCurrentDashboard: !0,
|
|
1251
|
+
badgeType: "linked",
|
|
1252
|
+
description: "Creates a new library visual and adds a linked copy to this dashboard.",
|
|
1253
|
+
actionLabel: "Save Copy as Linked Visual"
|
|
1254
|
+
}, f = () => {
|
|
1255
|
+
!m || i || d({
|
|
1256
|
+
name: c.trim(),
|
|
1257
|
+
description: u.trim() || void 0,
|
|
1258
|
+
saveToLibrary: p.saveToLibrary,
|
|
1259
|
+
saveToCurrentDashboard: p.saveToCurrentDashboard
|
|
1260
|
+
});
|
|
1261
|
+
};
|
|
1262
|
+
return /* @__PURE__ */ t(Ie, { open: e, onOpenChange: a, children: /* @__PURE__ */ s(Te, { className: "sm:max-w-[500px]", children: [
|
|
1263
|
+
/* @__PURE__ */ s(bt, { children: [
|
|
1264
|
+
/* @__PURE__ */ s(Le, { className: "flex items-center gap-2", children: [
|
|
1265
|
+
/* @__PURE__ */ t("span", { children: "Save Visual As" }),
|
|
1266
|
+
p.badgeType !== "local" && /* @__PURE__ */ t(
|
|
1267
|
+
Dr,
|
|
1268
|
+
{
|
|
1269
|
+
type: p.badgeType,
|
|
1270
|
+
showLabel: !0,
|
|
1271
|
+
className: "px-2 py-0.5"
|
|
1272
|
+
}
|
|
1273
|
+
)
|
|
1274
|
+
] }),
|
|
1275
|
+
/* @__PURE__ */ t(xt, { children: p.description })
|
|
1276
|
+
] }),
|
|
1277
|
+
/* @__PURE__ */ s("div", { className: "grid gap-4 py-4", children: [
|
|
1278
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
1279
|
+
/* @__PURE__ */ t(De, { htmlFor: "name", children: "Name" }),
|
|
1280
|
+
/* @__PURE__ */ t(
|
|
1281
|
+
st,
|
|
1282
|
+
{
|
|
1283
|
+
id: "name",
|
|
1284
|
+
value: c,
|
|
1285
|
+
onChange: (g) => l(g.target.value),
|
|
1286
|
+
placeholder: "Enter visual name",
|
|
1287
|
+
disabled: i
|
|
1288
|
+
}
|
|
1289
|
+
)
|
|
1290
|
+
] }),
|
|
1291
|
+
/* @__PURE__ */ s("div", { className: "grid gap-2", children: [
|
|
1292
|
+
/* @__PURE__ */ t(De, { htmlFor: "description", children: "Description (optional)" }),
|
|
1293
|
+
/* @__PURE__ */ t(
|
|
1294
|
+
ba,
|
|
1295
|
+
{
|
|
1296
|
+
id: "description",
|
|
1297
|
+
value: u,
|
|
1298
|
+
onChange: (g) => h(g.target.value),
|
|
1299
|
+
placeholder: "Enter visual description",
|
|
1300
|
+
rows: 3,
|
|
1301
|
+
disabled: i
|
|
1302
|
+
}
|
|
1303
|
+
)
|
|
1304
|
+
] })
|
|
1305
|
+
] }),
|
|
1306
|
+
/* @__PURE__ */ s(xa, { children: [
|
|
1307
|
+
/* @__PURE__ */ t(
|
|
1308
|
+
I,
|
|
1309
|
+
{
|
|
1310
|
+
variant: "outline",
|
|
1311
|
+
onClick: () => a(!1),
|
|
1312
|
+
disabled: i,
|
|
1313
|
+
children: "Cancel"
|
|
1314
|
+
}
|
|
1315
|
+
),
|
|
1316
|
+
/* @__PURE__ */ s(I, { onClick: f, disabled: !m || i, children: [
|
|
1317
|
+
i && /* @__PURE__ */ t(re, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
1318
|
+
p.actionLabel
|
|
1319
|
+
] })
|
|
1320
|
+
] })
|
|
1321
|
+
] }) });
|
|
1322
|
+
}
|
|
1323
|
+
function kt(e) {
|
|
1324
|
+
var a;
|
|
1325
|
+
for (const o of e.cards)
|
|
1326
|
+
if (o.type === "matrixTable" && !mr.safeParse((a = o.config) == null ? void 0 : a.matrix).success)
|
|
1327
|
+
return E.error("Matrix requires at least one row field, one metric, and valid settings."), !1;
|
|
1328
|
+
return !0;
|
|
1329
|
+
}
|
|
1330
|
+
function tt({
|
|
1331
|
+
className: e,
|
|
1332
|
+
variant: a = "outline"
|
|
1333
|
+
}) {
|
|
1334
|
+
const o = ee((r) => r.onSave), { getUpdatedFrame: n } = ye();
|
|
1335
|
+
function i() {
|
|
1336
|
+
const r = n();
|
|
1337
|
+
kt(r) && (o == null || o(r));
|
|
1338
|
+
}
|
|
1339
|
+
return /* @__PURE__ */ s(
|
|
1340
|
+
I,
|
|
1341
|
+
{
|
|
1342
|
+
onClick: i,
|
|
1343
|
+
className: e,
|
|
1344
|
+
size: "xs",
|
|
1345
|
+
variant: a,
|
|
1346
|
+
children: [
|
|
1347
|
+
/* @__PURE__ */ t(Ct, { className: "h-3.5 w-3.5" }),
|
|
1348
|
+
"Done"
|
|
1349
|
+
]
|
|
1350
|
+
}
|
|
1351
|
+
);
|
|
1352
|
+
}
|
|
1353
|
+
function en({
|
|
1354
|
+
className: e,
|
|
1355
|
+
variant: a = "default"
|
|
1356
|
+
}) {
|
|
1357
|
+
const o = Qe(), [n, i] = S(!1), { setIsVisualEditing: r } = ce(), { getUpdatedFrame: d } = ye(), c = Ke(), l = ee((m) => m.frame), u = Ot();
|
|
1358
|
+
return /* @__PURE__ */ t(
|
|
1359
|
+
I,
|
|
1360
|
+
{
|
|
1361
|
+
onClick: () => {
|
|
1362
|
+
const m = d();
|
|
1363
|
+
if (!kt(m))
|
|
1364
|
+
return;
|
|
1365
|
+
const p = (l == null ? void 0 : l.visualId) || (c == null ? void 0 : c.id);
|
|
1366
|
+
if (!p) {
|
|
1367
|
+
E.error("No visual to save");
|
|
1368
|
+
return;
|
|
1369
|
+
}
|
|
1370
|
+
i(!0), u.mutate(
|
|
1371
|
+
{
|
|
1372
|
+
visualId: p,
|
|
1373
|
+
data: {
|
|
1374
|
+
frameObject: m
|
|
1375
|
+
}
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
onSuccess: () => {
|
|
1379
|
+
i(!1), E.success("Visual updated successfully"), o.invalidateQueries({
|
|
1380
|
+
queryKey: ["resource-by-id", "visual", p],
|
|
1381
|
+
exact: !0
|
|
1382
|
+
});
|
|
1383
|
+
},
|
|
1384
|
+
onError: () => {
|
|
1385
|
+
i(!1), E.error("Failed to update visual");
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1389
|
+
},
|
|
1390
|
+
className: e,
|
|
1391
|
+
size: "xs",
|
|
1392
|
+
variant: a,
|
|
1393
|
+
children: n ? /* @__PURE__ */ s(R, { children: [
|
|
1394
|
+
/* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1395
|
+
"Saving"
|
|
1396
|
+
] }) : /* @__PURE__ */ s(R, { children: [
|
|
1397
|
+
/* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" }),
|
|
1398
|
+
"Save to Library"
|
|
1399
|
+
] })
|
|
1400
|
+
}
|
|
1401
|
+
);
|
|
1402
|
+
}
|
|
1403
|
+
function tn({
|
|
1404
|
+
className: e
|
|
1405
|
+
}) {
|
|
1406
|
+
const a = Qe(), [o, n] = S(!1), i = Ke(), r = ee((g) => g.frame), d = w((g) => g.selectedSheetId), c = w((g) => g.dashboard), { updateFrame: l, setIsVisualEditing: u } = ce(), { getUpdatedFrame: h } = ye(), m = Ot(), p = vt();
|
|
1407
|
+
return /* @__PURE__ */ t(
|
|
1408
|
+
I,
|
|
1409
|
+
{
|
|
1410
|
+
onClick: async () => {
|
|
1411
|
+
if (!d) {
|
|
1412
|
+
E.error("No sheet selected");
|
|
1413
|
+
return;
|
|
1414
|
+
}
|
|
1415
|
+
const g = (r == null ? void 0 : r.visualId) || (i == null ? void 0 : i.id);
|
|
1416
|
+
if (!g) {
|
|
1417
|
+
E.error("No visual to update");
|
|
1418
|
+
return;
|
|
1419
|
+
}
|
|
1420
|
+
n(!0);
|
|
1421
|
+
try {
|
|
1422
|
+
const v = h();
|
|
1423
|
+
if (!kt(v)) {
|
|
1424
|
+
n(!1);
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
const k = {
|
|
1428
|
+
...v,
|
|
1429
|
+
visualId: g
|
|
1430
|
+
// Keep the link to library visual
|
|
1431
|
+
}, V = He(c, k.id), U = await p(k, {
|
|
1432
|
+
previousFrame: V
|
|
1433
|
+
});
|
|
1434
|
+
await m.mutateAsync({
|
|
1435
|
+
visualId: g,
|
|
1436
|
+
data: {
|
|
1437
|
+
frameObject: v
|
|
1438
|
+
}
|
|
1439
|
+
}), l(d, k, {
|
|
1440
|
+
semanticExecutionPayload: U
|
|
1441
|
+
}), a.invalidateQueries({ queryKey: ["visuals"] }), a.invalidateQueries({ queryKey: ["visual", g] }), E.success("Saved to library and applied locally"), setTimeout(() => {
|
|
1442
|
+
u(!1);
|
|
1443
|
+
}, 300);
|
|
1444
|
+
} catch (v) {
|
|
1445
|
+
console.error("Failed to save and apply:", v), E.error(
|
|
1446
|
+
v instanceof Error ? v.message : "Failed to save and apply changes"
|
|
1447
|
+
);
|
|
1448
|
+
} finally {
|
|
1449
|
+
n(!1);
|
|
1450
|
+
}
|
|
1451
|
+
},
|
|
1452
|
+
className: e,
|
|
1453
|
+
size: "xs",
|
|
1454
|
+
variant: "default",
|
|
1455
|
+
disabled: o,
|
|
1456
|
+
children: o ? /* @__PURE__ */ s(R, { children: [
|
|
1457
|
+
/* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1458
|
+
"Saving..."
|
|
1459
|
+
] }) : /* @__PURE__ */ s(R, { children: [
|
|
1460
|
+
/* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" }),
|
|
1461
|
+
"Save & Apply"
|
|
1462
|
+
] })
|
|
1463
|
+
}
|
|
1464
|
+
);
|
|
1465
|
+
}
|
|
1466
|
+
function at({ className: e }) {
|
|
1467
|
+
const { setTempQueryData: a, setSqlGen: o } = Ge(), n = Qe(), i = ee((c) => c.tempQueryData), r = ee((c) => c.onClose);
|
|
1468
|
+
function d() {
|
|
1469
|
+
if (i) {
|
|
1470
|
+
const { queryKey: c, queryData: l } = i;
|
|
1471
|
+
c && l && n.setQueryData(c, l);
|
|
1472
|
+
}
|
|
1473
|
+
o({}), r == null || r();
|
|
1474
|
+
}
|
|
1475
|
+
return /* @__PURE__ */ s(
|
|
1476
|
+
I,
|
|
1477
|
+
{
|
|
1478
|
+
onClick: d,
|
|
1479
|
+
className: e,
|
|
1480
|
+
size: "xs",
|
|
1481
|
+
variant: "outline",
|
|
1482
|
+
children: [
|
|
1483
|
+
/* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" }),
|
|
1484
|
+
"Close"
|
|
1485
|
+
]
|
|
1486
|
+
}
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
function an() {
|
|
1490
|
+
const [e, a] = S(!1), [o, n] = S(!1), [i, r] = S(null), [d, c] = S(null), l = ee((b) => b.frame), u = ee((b) => b.card), h = Ke(), m = w((b) => b.selectedSheetId), p = w((b) => b.dashboard), { getUpdatedFrame: f } = ye(), { selectVisual: g } = lt(), { addFrame: v, setIsVisualEditing: k } = ce(), V = vt(), U = !!(l != null && l.visualId), M = (() => {
|
|
1491
|
+
var b, F;
|
|
1492
|
+
return ((b = l == null ? void 0 : l.cards) == null ? void 0 : b.length) === 1 && ((F = l.cards[0]) != null && F.title) ? l.cards[0].title : h != null && h.title ? h.title : (u == null ? void 0 : u.title) || "Untitled Visual";
|
|
1493
|
+
})(), A = va((b) => {
|
|
1494
|
+
b != null && b.id && (g(b), o && i && d && m && (async () => {
|
|
1495
|
+
try {
|
|
1496
|
+
const F = {
|
|
1497
|
+
...i,
|
|
1498
|
+
id: At(),
|
|
1499
|
+
visualId: b.id
|
|
1500
|
+
// Link to the newly created library visual
|
|
1501
|
+
};
|
|
1502
|
+
v(m, F, {
|
|
1503
|
+
semanticExecutionPayload: d
|
|
1504
|
+
}), n(!1), r(null), c(null), k(!1);
|
|
1505
|
+
} catch (F) {
|
|
1506
|
+
console.error(
|
|
1507
|
+
"Failed to promote semantic metadata for saved visual:",
|
|
1508
|
+
F
|
|
1509
|
+
), E.error(
|
|
1510
|
+
F instanceof Error ? F.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
})(), a(!1));
|
|
1514
|
+
});
|
|
1515
|
+
return {
|
|
1516
|
+
saveAsDialogOpen: e,
|
|
1517
|
+
setSaveAsDialogOpen: a,
|
|
1518
|
+
handleSaveAs: async (b) => {
|
|
1519
|
+
if (!m) {
|
|
1520
|
+
E.error("No sheet selected");
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
const F = f(), D = F.cards.length === 1 ? {
|
|
1524
|
+
...F,
|
|
1525
|
+
cards: F.cards.map((N) => ({
|
|
1526
|
+
...N,
|
|
1527
|
+
title: b.name
|
|
1528
|
+
// Use visual name as card title
|
|
1529
|
+
}))
|
|
1530
|
+
} : F;
|
|
1531
|
+
if (b.saveToLibrary) {
|
|
1532
|
+
let N = null;
|
|
1533
|
+
if (b.saveToCurrentDashboard)
|
|
1534
|
+
try {
|
|
1535
|
+
N = await V(D, {
|
|
1536
|
+
previousFrame: He(p, D.id)
|
|
1537
|
+
});
|
|
1538
|
+
} catch (T) {
|
|
1539
|
+
console.error(
|
|
1540
|
+
"Failed to prepare semantic metadata before saving visual:",
|
|
1541
|
+
T
|
|
1542
|
+
), E.error(
|
|
1543
|
+
T instanceof Error ? T.message : "Failed to prepare semantic metadata for the saved visual"
|
|
1544
|
+
);
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
n(b.saveToCurrentDashboard), r(D), c(N);
|
|
1548
|
+
const j = {
|
|
1549
|
+
title: b.name,
|
|
1550
|
+
description: b.description,
|
|
1551
|
+
frameObject: D,
|
|
1552
|
+
// Card title synced for single-card frames
|
|
1553
|
+
isPrivate: !1
|
|
1554
|
+
};
|
|
1555
|
+
A.mutate(j);
|
|
1556
|
+
} else if (b.saveToCurrentDashboard) {
|
|
1557
|
+
const N = {
|
|
1558
|
+
...D,
|
|
1559
|
+
// Card title already synced
|
|
1560
|
+
id: At(),
|
|
1561
|
+
visualId: void 0
|
|
1562
|
+
// Explicitly no visualId for local visuals
|
|
1563
|
+
};
|
|
1564
|
+
try {
|
|
1565
|
+
const j = await V(D, {
|
|
1566
|
+
previousFrame: He(p, D.id)
|
|
1567
|
+
});
|
|
1568
|
+
v(m, N, {
|
|
1569
|
+
semanticExecutionPayload: j
|
|
1570
|
+
}), E.success("Visual saved to dashboard"), a(!1), k(!1);
|
|
1571
|
+
} catch (j) {
|
|
1572
|
+
console.error("Failed to save visual to dashboard:", j), E.error(
|
|
1573
|
+
j instanceof Error ? j.message : "Failed to prepare semantic metadata for the visual"
|
|
1574
|
+
);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
isLibraryVisual: U,
|
|
1579
|
+
currentVisualName: M,
|
|
1580
|
+
isSaving: A.isPending
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
function ps(e = {}) {
|
|
1584
|
+
const { isInspectionMode: a } = ya(), o = ee((T) => T.frame), n = ee((T) => T.editorContext), i = Ca((T) => T.selectedVisual), r = w((T) => T.selectedFrameId), d = w((T) => T.selectedSheetId), c = w((T) => T.dashboard), { setIsVisualEditing: l, updateFrame: u } = ce(), [h, m] = S(!1), [p, f] = S("both"), g = vt(), v = (n == null ? void 0 : n.type) === "documentSection", k = !!(o != null && o.visualId || i != null && i.id), V = !!(o != null && o.visualId && r), U = k && !V, {
|
|
1585
|
+
saveAsDialogOpen: M,
|
|
1586
|
+
setSaveAsDialogOpen: A,
|
|
1587
|
+
handleSaveAs: O,
|
|
1588
|
+
isLibraryVisual: b,
|
|
1589
|
+
currentVisualName: F,
|
|
1590
|
+
isSaving: C
|
|
1591
|
+
} = an(), { getUpdatedFrame: D } = ye();
|
|
1592
|
+
if (a)
|
|
1593
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
1594
|
+
/* @__PURE__ */ t(
|
|
1595
|
+
tt,
|
|
1596
|
+
{
|
|
1597
|
+
className: "rounded-control",
|
|
1598
|
+
variant: "default"
|
|
1599
|
+
}
|
|
1600
|
+
),
|
|
1601
|
+
/* @__PURE__ */ t(at, {})
|
|
1602
|
+
] });
|
|
1603
|
+
if (v)
|
|
1604
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
1605
|
+
/* @__PURE__ */ t(tt, { className: "rounded-control", variant: "default" }),
|
|
1606
|
+
/* @__PURE__ */ t(at, {})
|
|
1607
|
+
] });
|
|
1608
|
+
const N = async () => {
|
|
1609
|
+
if (!d) {
|
|
1610
|
+
E.error("No sheet selected");
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
if (h) return;
|
|
1614
|
+
m(!0);
|
|
1615
|
+
const z = {
|
|
1616
|
+
...D(),
|
|
1617
|
+
visualId: void 0
|
|
1618
|
+
}, X = He(c, z.id);
|
|
1619
|
+
try {
|
|
1620
|
+
const L = await g(z, {
|
|
1621
|
+
previousFrame: X
|
|
1622
|
+
});
|
|
1623
|
+
u(d, z, {
|
|
1624
|
+
semanticExecutionPayload: L
|
|
1625
|
+
});
|
|
1626
|
+
} catch (L) {
|
|
1627
|
+
console.error("Failed to apply local semantic metadata:", L), m(!1), E.error(
|
|
1628
|
+
L instanceof Error ? L.message : "Failed to prepare semantic metadata for this visual"
|
|
1629
|
+
);
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
setTimeout(() => {
|
|
1633
|
+
m(!1), E.success("Changes applied. Visual is now local to this dashboard"), l(!1);
|
|
1634
|
+
}, 300);
|
|
1635
|
+
}, j = (T) => {
|
|
1636
|
+
f(T), A(!0);
|
|
1637
|
+
};
|
|
1638
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
1639
|
+
/* @__PURE__ */ s("div", { className: "inline-flex items-center overflow-hidden rounded-control", children: [
|
|
1640
|
+
!k && /* @__PURE__ */ t(tt, { className: "!rounded-none", variant: "default" }),
|
|
1641
|
+
k && U && /* @__PURE__ */ t(en, { className: "!rounded-none", variant: "default" }),
|
|
1642
|
+
k && V && /* @__PURE__ */ t(tn, { className: "!rounded-none" }),
|
|
1643
|
+
/* @__PURE__ */ s(Ve, { modal: !1, children: [
|
|
1644
|
+
/* @__PURE__ */ t(Be, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1645
|
+
I,
|
|
1646
|
+
{
|
|
1647
|
+
variant: "default",
|
|
1648
|
+
size: "xs",
|
|
1649
|
+
className: "w-7 !rounded-none border-l border-primary-foreground/20 px-0",
|
|
1650
|
+
"aria-label": "Open visual save options",
|
|
1651
|
+
disabled: C || h,
|
|
1652
|
+
children: /* @__PURE__ */ t(wt, { className: "h-3.5 w-3.5" })
|
|
1653
|
+
}
|
|
1654
|
+
) }),
|
|
1655
|
+
/* @__PURE__ */ s(
|
|
1656
|
+
Pe,
|
|
1657
|
+
{
|
|
1658
|
+
align: "end",
|
|
1659
|
+
className: "min-w-[220px] rounded-control border border-border/60 p-1 shadow-sm",
|
|
1660
|
+
children: [
|
|
1661
|
+
V && /* @__PURE__ */ s(R, { children: [
|
|
1662
|
+
/* @__PURE__ */ s(
|
|
1663
|
+
G,
|
|
1664
|
+
{
|
|
1665
|
+
onClick: N,
|
|
1666
|
+
disabled: h,
|
|
1667
|
+
children: [
|
|
1668
|
+
/* @__PURE__ */ t(Ct, { className: "h-3.5 w-3.5" }),
|
|
1669
|
+
h ? "Applying..." : "Apply Locally"
|
|
1670
|
+
]
|
|
1671
|
+
}
|
|
1672
|
+
),
|
|
1673
|
+
/* @__PURE__ */ t(We, {})
|
|
1674
|
+
] }),
|
|
1675
|
+
/* @__PURE__ */ s(
|
|
1676
|
+
G,
|
|
1677
|
+
{
|
|
1678
|
+
onClick: () => j("local"),
|
|
1679
|
+
disabled: C,
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ t(ve, { className: "h-3.5 w-3.5" }),
|
|
1682
|
+
"Add to Dashboard (Local)"
|
|
1683
|
+
]
|
|
1684
|
+
}
|
|
1685
|
+
),
|
|
1686
|
+
/* @__PURE__ */ s(
|
|
1687
|
+
G,
|
|
1688
|
+
{
|
|
1689
|
+
onClick: () => j("library"),
|
|
1690
|
+
disabled: C,
|
|
1691
|
+
children: [
|
|
1692
|
+
/* @__PURE__ */ t(Ar, { className: "h-3.5 w-3.5" }),
|
|
1693
|
+
"Save as Library Visual"
|
|
1694
|
+
]
|
|
1695
|
+
}
|
|
1696
|
+
),
|
|
1697
|
+
/* @__PURE__ */ s(
|
|
1698
|
+
G,
|
|
1699
|
+
{
|
|
1700
|
+
onClick: () => j("both"),
|
|
1701
|
+
disabled: C,
|
|
1702
|
+
children: [
|
|
1703
|
+
/* @__PURE__ */ t(Fr, { className: "h-3.5 w-3.5" }),
|
|
1704
|
+
"Save Copy as Linked Visual"
|
|
1705
|
+
]
|
|
1706
|
+
}
|
|
1707
|
+
)
|
|
1708
|
+
]
|
|
1709
|
+
}
|
|
1710
|
+
)
|
|
1711
|
+
] })
|
|
1712
|
+
] }),
|
|
1713
|
+
/* @__PURE__ */ t(at, {}),
|
|
1714
|
+
/* @__PURE__ */ t(
|
|
1715
|
+
Jr,
|
|
1716
|
+
{
|
|
1717
|
+
open: M,
|
|
1718
|
+
onOpenChange: (T) => {
|
|
1719
|
+
C || A(T);
|
|
1720
|
+
},
|
|
1721
|
+
isLibraryVisual: b,
|
|
1722
|
+
currentVisualName: F,
|
|
1723
|
+
isSaving: C,
|
|
1724
|
+
destinationMode: p,
|
|
1725
|
+
onConfirm: O
|
|
1726
|
+
}
|
|
1727
|
+
)
|
|
1728
|
+
] });
|
|
1729
|
+
}
|
|
1730
|
+
function fs({ className: e }) {
|
|
1731
|
+
const a = ee((h) => h.isDevMode), o = ee((h) => h.card.type), n = w((h) => h.isVisualEditing), { setIsDevMode: i } = Ge(), { config: r } = Bt(wa).tokenProps, d = (r == null ? void 0 : r.showAdvancedMode) !== !1;
|
|
1732
|
+
if (!n || !d || !br(o))
|
|
1733
|
+
return null;
|
|
1734
|
+
const c = a ? Rr : Or, l = a ? "Visual editor" : "SQL editor", u = a ? "Switch to visual editor" : "Switch to SQL editor";
|
|
1735
|
+
return /* @__PURE__ */ s(
|
|
1736
|
+
"button",
|
|
1737
|
+
{
|
|
1738
|
+
type: "button",
|
|
1739
|
+
"aria-label": u,
|
|
1740
|
+
title: u,
|
|
1741
|
+
onClick: () => i(!a),
|
|
1742
|
+
className: J(
|
|
1743
|
+
"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",
|
|
1744
|
+
e
|
|
1745
|
+
),
|
|
1746
|
+
children: [
|
|
1747
|
+
/* @__PURE__ */ t(c, { className: "h-3 w-3 text-muted-foreground" }),
|
|
1748
|
+
l
|
|
1749
|
+
]
|
|
1750
|
+
}
|
|
1751
|
+
);
|
|
1752
|
+
}
|
|
1753
|
+
function gs() {
|
|
1754
|
+
const e = Tr() === "sm", a = w((l) => l.isDashboardEditing), o = w((l) => l.isVisualEditing), n = w((l) => {
|
|
1755
|
+
var h;
|
|
1756
|
+
const u = ((h = l.dashboard) == null ? void 0 : h.sheets) ?? [];
|
|
1757
|
+
return u.find((m) => m.id === l.selectedSheetId) ?? u[0];
|
|
1758
|
+
}), i = w((l) => l.actions.arrangeSheet), r = w((l) => l.actions.undoArrange);
|
|
1759
|
+
if (!a || o || !n || Nt(n)) return null;
|
|
1760
|
+
const d = !(n.frames ?? []).length, c = (l) => {
|
|
1761
|
+
const u = i(n.id, { keepOrder: l });
|
|
1762
|
+
if (!u.ok) {
|
|
1763
|
+
E.error(u.reason === "not_a_grid" ? "This sheet has no grid to arrange." : "The dashboard can't be arranged right now.");
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
E("Arranged", {
|
|
1767
|
+
// Long enough to reach Undo after looking at the result; the default 4 seconds isn't.
|
|
1768
|
+
duration: 1e4,
|
|
1769
|
+
description: l ? "Sizes and gaps fixed on every screen size, in your order." : "KPIs on top, charts in pairs, tables full width, on every screen size.",
|
|
1770
|
+
action: {
|
|
1771
|
+
label: "Undo",
|
|
1772
|
+
onClick: () => {
|
|
1773
|
+
const h = r();
|
|
1774
|
+
!h.ok && h.reason === "changed_since" && E.info("The dashboard changed after Arrange, so it can't be undone from here.");
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
};
|
|
1779
|
+
return /* @__PURE__ */ s("div", { className: "inline-flex h-7 items-stretch overflow-hidden rounded-control border border-input bg-background", children: [
|
|
1780
|
+
/* @__PURE__ */ s(
|
|
1781
|
+
I,
|
|
1782
|
+
{
|
|
1783
|
+
variant: "ghost",
|
|
1784
|
+
size: "xs",
|
|
1785
|
+
disabled: d,
|
|
1786
|
+
title: d ? "This sheet has no cards to arrange" : "Lay out the cards by kind on every screen size",
|
|
1787
|
+
onClick: () => c(!1),
|
|
1788
|
+
"aria-label": e ? "Arrange" : void 0,
|
|
1789
|
+
className: `h-full rounded-none border-0 shadow-none hover:bg-accent${e ? " w-7 px-0" : ""}`,
|
|
1790
|
+
children: [
|
|
1791
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
|
|
1792
|
+
!e && "Arrange"
|
|
1793
|
+
]
|
|
1794
|
+
}
|
|
1795
|
+
),
|
|
1796
|
+
/* @__PURE__ */ s(Ve, { modal: !1, children: [
|
|
1797
|
+
/* @__PURE__ */ t(Be, { asChild: !0, children: /* @__PURE__ */ t(
|
|
1798
|
+
I,
|
|
1799
|
+
{
|
|
1800
|
+
variant: "ghost",
|
|
1801
|
+
size: "xs",
|
|
1802
|
+
disabled: d,
|
|
1803
|
+
className: "h-full w-7 rounded-none border-0 border-l border-border/60 px-0 shadow-none hover:bg-accent",
|
|
1804
|
+
"aria-label": "Open arrange options",
|
|
1805
|
+
children: /* @__PURE__ */ t(wt, { className: "h-3.5 w-3.5" })
|
|
1806
|
+
}
|
|
1807
|
+
) }),
|
|
1808
|
+
/* @__PURE__ */ t(Pe, { align: "end", className: "z-[60] w-48 rounded-[6px] border-border/60 p-1 shadow-sm", children: /* @__PURE__ */ s(G, { onClick: () => c(!0), children: [
|
|
1809
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
|
|
1810
|
+
"Keep my order"
|
|
1811
|
+
] }) })
|
|
1812
|
+
] })
|
|
1813
|
+
] });
|
|
1814
|
+
}
|
|
1815
|
+
function bs() {
|
|
1816
|
+
const e = w((i) => i.screenSizesOpen), a = w((i) => {
|
|
1817
|
+
var c, l;
|
|
1818
|
+
const r = ((c = i.dashboard) == null ? void 0 : c.sheets) ?? [], d = r.find((u) => u.id === i.selectedSheetId) ?? r[0];
|
|
1819
|
+
return !!d && !Nt(d) && !!((l = d.frames) != null && l.length);
|
|
1820
|
+
}), o = w((i) => i.actions.setScreenSizesOpen), n = Qt(
|
|
1821
|
+
"screen-sizes",
|
|
1822
|
+
"lg",
|
|
1823
|
+
a ? {
|
|
1824
|
+
label: "Screen sizes",
|
|
1825
|
+
icon: /* @__PURE__ */ t(It, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
1826
|
+
checked: e,
|
|
1827
|
+
order: 40,
|
|
1828
|
+
onSelect: () => o(!e)
|
|
1829
|
+
} : void 0
|
|
1830
|
+
);
|
|
1831
|
+
return !a || n.collapsed ? null : /* @__PURE__ */ t(
|
|
1832
|
+
I,
|
|
1833
|
+
{
|
|
1834
|
+
type: "button",
|
|
1835
|
+
size: "xs",
|
|
1836
|
+
variant: e ? "secondary" : "ghost",
|
|
1837
|
+
"aria-pressed": e,
|
|
1838
|
+
"aria-label": "Screen sizes",
|
|
1839
|
+
title: "Screen sizes",
|
|
1840
|
+
onClick: () => o(!e),
|
|
1841
|
+
className: "w-7 px-0",
|
|
1842
|
+
children: /* @__PURE__ */ t(It, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
1843
|
+
}
|
|
1844
|
+
);
|
|
1845
|
+
}
|
|
1846
|
+
function xs({ dashboardId: e }) {
|
|
1847
|
+
const { openDashboardId: a, access: o, printMode: n, serverIsFavorite: i, fetchedAt: r } = w(
|
|
1848
|
+
Na((l) => {
|
|
1849
|
+
var u;
|
|
1850
|
+
return {
|
|
1851
|
+
openDashboardId: (u = l.dashboard) == null ? void 0 : u.id,
|
|
1852
|
+
access: l.viewer.access,
|
|
1853
|
+
printMode: l.viewer.printMode,
|
|
1854
|
+
serverIsFavorite: l.viewer.isFavorite,
|
|
1855
|
+
fetchedAt: l.viewer.fetchedAt
|
|
1856
|
+
};
|
|
1857
|
+
})
|
|
1858
|
+
), d = Sa(), c = d.isFavorite(e, i, r);
|
|
1859
|
+
return a !== e || n || o === "session-only" ? null : /* @__PURE__ */ t(
|
|
1860
|
+
ka,
|
|
1861
|
+
{
|
|
1862
|
+
variant: "toolbar",
|
|
1863
|
+
isFavorite: c,
|
|
1864
|
+
readOnly: o === "read-only",
|
|
1865
|
+
pending: d.isPending(e),
|
|
1866
|
+
onToggle: () => void d.setFavorite({ dashboardId: e, isFavorite: !c })
|
|
1867
|
+
}
|
|
1868
|
+
);
|
|
1869
|
+
}
|
|
1870
|
+
function vs({
|
|
1871
|
+
width: e,
|
|
1872
|
+
hasOverflowMenu: a = !0,
|
|
1873
|
+
children: o
|
|
1874
|
+
}) {
|
|
1875
|
+
const [n, i] = S(
|
|
1876
|
+
() => /* @__PURE__ */ new Map()
|
|
1877
|
+
), [r, d] = S(null), [c, l] = S(null), u = Z((m) => (i((p) => new Map(p).set(m.id, m)), () => i((p) => {
|
|
1878
|
+
if (p.get(m.id) !== m) return p;
|
|
1879
|
+
const f = new Map(p);
|
|
1880
|
+
return f.delete(m.id), f;
|
|
1881
|
+
})), []), h = te(
|
|
1882
|
+
() => ({
|
|
1883
|
+
width: e,
|
|
1884
|
+
hasOverflowMenu: a,
|
|
1885
|
+
overflowItems: [...n.values()].sort((m, p) => m.order - p.order),
|
|
1886
|
+
register: u,
|
|
1887
|
+
openOverflowId: r,
|
|
1888
|
+
setOpenOverflowId: d,
|
|
1889
|
+
anchorSlot: c,
|
|
1890
|
+
setAnchorSlot: l
|
|
1891
|
+
}),
|
|
1892
|
+
[c, a, n, r, u, e]
|
|
1893
|
+
);
|
|
1894
|
+
return /* @__PURE__ */ t(Kt.Provider, { value: h, children: o });
|
|
1895
|
+
}
|
|
1896
|
+
function ys() {
|
|
1897
|
+
const { setAnchorSlot: e } = Bt(Kt);
|
|
1898
|
+
return /* @__PURE__ */ t("span", { ref: e, "aria-hidden": !0, className: "relative -mr-1.5 block h-7 w-0" });
|
|
1899
|
+
}
|
|
1900
|
+
function Cs(e) {
|
|
1901
|
+
var l;
|
|
1902
|
+
const { authToken: a, tokenProps: o } = it(), { data: n } = Da(), { mutate: i, isPending: r } = Aa(), d = !!e && ((l = n == null ? void 0 : n.preference) == null ? void 0 : l.defaultDashboardId) === e, c = !n || r;
|
|
1903
|
+
return {
|
|
1904
|
+
available: !!e && !!(a != null && a.accessToken) && !!(o != null && o.apiServiceUrl),
|
|
1905
|
+
isDefault: d,
|
|
1906
|
+
disabled: c,
|
|
1907
|
+
toggle: () => {
|
|
1908
|
+
!e || c || i({ dashboardId: d ? null : e });
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
}
|
|
1912
|
+
function ws({
|
|
1913
|
+
open: e,
|
|
1914
|
+
onOpenChange: a,
|
|
1915
|
+
onSave: o,
|
|
1916
|
+
onDiscard: n,
|
|
1917
|
+
isSaving: i,
|
|
1918
|
+
title: r = "Unsaved changes",
|
|
1919
|
+
description: d = "You have unsaved changes to this dashboard. What would you like to do?",
|
|
1920
|
+
cancelLabel: c = "Cancel",
|
|
1921
|
+
discardLabel: l = "Discard changes",
|
|
1922
|
+
saveLabel: u = "Save"
|
|
1923
|
+
}) {
|
|
1924
|
+
return /* @__PURE__ */ t(dt, { open: e, onOpenChange: (m) => {
|
|
1925
|
+
!m && i || a(m);
|
|
1926
|
+
}, children: /* @__PURE__ */ s(ct, { children: [
|
|
1927
|
+
/* @__PURE__ */ s(ut, { children: [
|
|
1928
|
+
/* @__PURE__ */ t(ht, { children: r }),
|
|
1929
|
+
/* @__PURE__ */ t(mt, { children: d })
|
|
1930
|
+
] }),
|
|
1931
|
+
/* @__PURE__ */ s(pt, { children: [
|
|
1932
|
+
/* @__PURE__ */ t(
|
|
1933
|
+
I,
|
|
1934
|
+
{
|
|
1935
|
+
type: "button",
|
|
1936
|
+
size: "xs",
|
|
1937
|
+
onClick: n,
|
|
1938
|
+
disabled: i,
|
|
1939
|
+
variant: "outline",
|
|
1940
|
+
className: "mr-auto text-destructive hover:border-destructive/40 hover:bg-destructive/10 hover:text-destructive focus-visible:bg-destructive/10 focus-visible:text-destructive",
|
|
1941
|
+
children: l
|
|
1942
|
+
}
|
|
1943
|
+
),
|
|
1944
|
+
/* @__PURE__ */ t(ft, { disabled: i, children: c }),
|
|
1945
|
+
/* @__PURE__ */ t(I, { type: "button", size: "xs", onClick: o, disabled: i, children: i ? /* @__PURE__ */ s(R, { children: [
|
|
1946
|
+
/* @__PURE__ */ t(re, { className: "mr-2 h-3.5 w-3.5 animate-spin" }),
|
|
1947
|
+
"Saving..."
|
|
1948
|
+
] }) : u })
|
|
1949
|
+
] })
|
|
1950
|
+
] }) });
|
|
1951
|
+
}
|
|
1952
|
+
async function Ns(e) {
|
|
1953
|
+
var r, d;
|
|
1954
|
+
const a = (d = (r = w.getState()) == null ? void 0 : r.authToken) == null ? void 0 : d.accessToken;
|
|
1955
|
+
if (!a)
|
|
1956
|
+
return;
|
|
1957
|
+
const o = `${e}/v1/invalidate-token`, n = await fetch(o, {
|
|
1958
|
+
method: "POST",
|
|
1959
|
+
headers: {
|
|
1960
|
+
Authorization: `Bearer ${a}`
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
if (!n.ok)
|
|
1964
|
+
throw new Error("Failed to invalidate token");
|
|
1965
|
+
const i = await n.json();
|
|
1966
|
+
return console.log("invalidateToken", i), i;
|
|
1967
|
+
}
|
|
1968
|
+
function rn(e) {
|
|
1969
|
+
switch (e == null ? void 0 : e.kind) {
|
|
1970
|
+
case "queued":
|
|
1971
|
+
return { text: K.queued };
|
|
1972
|
+
case "preparing":
|
|
1973
|
+
return { text: K.preparing };
|
|
1974
|
+
case "fetching":
|
|
1975
|
+
return { text: K.fetchingRows(e.rowsProcessed) };
|
|
1976
|
+
case "finalizing":
|
|
1977
|
+
return { text: K.finalizing };
|
|
1978
|
+
case "processing":
|
|
1979
|
+
return e.percent === null ? { text: K.processing } : { text: K.processing, detail: K.percentComplete(e.percent), bar: e.percent };
|
|
1980
|
+
default:
|
|
1981
|
+
return { text: K.inProgress };
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
function nn(e) {
|
|
1985
|
+
var o;
|
|
1986
|
+
const a = e.item;
|
|
1987
|
+
return a.kind === "export" ? {
|
|
1988
|
+
title: a.title,
|
|
1989
|
+
status: a.status,
|
|
1990
|
+
startedAt: a.startedAt,
|
|
1991
|
+
finishedAt: a.finishedAt,
|
|
1992
|
+
running: rn(a.stage),
|
|
1993
|
+
finishedDetail: [
|
|
1994
|
+
a.totalRows !== null ? `${a.totalRows.toLocaleString("en-US")} rows` : null,
|
|
1995
|
+
a.fileSize ? Ba(a.fileSize) : null
|
|
1996
|
+
].filter((n) => !!n),
|
|
1997
|
+
failure: ((o = a.failure) == null ? void 0 : o.kind) === "export" ? a.failure.message : a.status === "failed" ? K.failedFallback : null,
|
|
1998
|
+
note: null
|
|
1999
|
+
} : {
|
|
2000
|
+
title: a.title,
|
|
2001
|
+
status: a.status,
|
|
2002
|
+
startedAt: a.startedAt,
|
|
2003
|
+
finishedAt: a.finishedAt,
|
|
2004
|
+
running: { text: a.stageLabel ?? K.inProgress },
|
|
2005
|
+
finishedDetail: [],
|
|
2006
|
+
failure: null,
|
|
2007
|
+
note: a.omittedAttachmentCount > 0 ? de.attachmentsLeftOut(a.omittedAttachmentCount) : null
|
|
2008
|
+
};
|
|
2009
|
+
}
|
|
2010
|
+
function sn({ row: e, now: a, api: o }) {
|
|
2011
|
+
const [n, i] = S("idle"), r = nn(e), d = Fa(e, o), c = async () => {
|
|
2012
|
+
if (!d) return;
|
|
2013
|
+
i("working");
|
|
2014
|
+
const g = await Pa(o, e, d);
|
|
2015
|
+
i(g === "done" ? "idle" : g);
|
|
2016
|
+
}, l = r.status === "ready" ? "bg-emerald-500" : r.status === "failed" ? "bg-destructive" : r.status === "cancelled" ? "bg-muted-foreground/40" : "animate-pulse bg-muted-foreground/60", u = r.status === "ready" ? K.ready : r.status === "failed" ? K.failed : r.status === "cancelled" ? K.cancelled : K.inProgress, h = Date.parse(r.startedAt), m = Ft(Date.parse(r.finishedAt ?? r.startedAt), a, { addSuffix: !0 }), p = r.status === "running" && e.item.kind === "export" && a - h >= Ea, f = /* @__PURE__ */ t("span", { className: "text-muted-foreground/50", children: "·" });
|
|
2017
|
+
return /* @__PURE__ */ s("div", { className: "group flex items-start gap-2.5 px-3 py-2 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
2018
|
+
/* @__PURE__ */ t("span", { className: "flex h-5 shrink-0 items-center", "aria-hidden": "true", children: /* @__PURE__ */ t("span", { className: `h-1.5 w-1.5 rounded-full ${l}` }) }),
|
|
2019
|
+
/* @__PURE__ */ t("span", { className: "sr-only", children: u }),
|
|
2020
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
2021
|
+
/* @__PURE__ */ s("div", { className: "flex h-5 items-center gap-2", children: [
|
|
2022
|
+
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[13px] font-medium leading-5", children: r.title }),
|
|
2023
|
+
d && n === "working" && /* @__PURE__ */ t("span", { role: "status", className: "inline-flex shrink-0 items-center gap-1.5 text-[12px] text-muted-foreground", children: /* @__PURE__ */ t(Rt, { className: "h-3 w-3 animate-spin", strokeWidth: 1.75 }) }),
|
|
2024
|
+
d && n !== "working" && /* @__PURE__ */ t(
|
|
2025
|
+
"button",
|
|
2026
|
+
{
|
|
2027
|
+
type: "button",
|
|
2028
|
+
onClick: () => void c(),
|
|
2029
|
+
className: "shrink-0 text-[12px] font-medium text-foreground/80 underline-offset-2 hover:text-foreground hover:underline focus-visible:underline focus-visible:outline-none",
|
|
2030
|
+
children: Ia[d]
|
|
2031
|
+
}
|
|
2032
|
+
)
|
|
2033
|
+
] }),
|
|
2034
|
+
r.status === "running" && r.running && /* @__PURE__ */ s("div", { className: "text-[12px] leading-4 text-muted-foreground", children: [
|
|
2035
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums", children: r.running.text }),
|
|
2036
|
+
r.running.detail && /* @__PURE__ */ s(R, { children: [
|
|
2037
|
+
" ",
|
|
2038
|
+
f,
|
|
2039
|
+
" ",
|
|
2040
|
+
/* @__PURE__ */ t("span", { className: "tabular-nums", children: r.running.detail })
|
|
2041
|
+
] }),
|
|
2042
|
+
" ",
|
|
2043
|
+
f,
|
|
2044
|
+
" ",
|
|
2045
|
+
/* @__PURE__ */ t("span", { children: K.started(Ft(h, a)) }),
|
|
2046
|
+
r.running.bar !== void 0 && /* @__PURE__ */ t(Ta, { value: r.running.bar, className: "mt-1.5 h-1" }),
|
|
2047
|
+
p && /* @__PURE__ */ t("div", { className: "mt-1", children: K.longRunning })
|
|
2048
|
+
] }),
|
|
2049
|
+
r.status !== "running" && /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5 text-[12px] leading-4 text-muted-foreground", children: [
|
|
2050
|
+
r.status === "ready" && r.finishedDetail.length > 0 ? (
|
|
2051
|
+
// Disclosed on hover or focus only; the time is what a reader scans.
|
|
2052
|
+
/* @__PURE__ */ s("span", { className: "hidden group-hover:contents group-focus-within:contents", children: [
|
|
2053
|
+
r.finishedDetail.map((g, v) => /* @__PURE__ */ s(Vt.Fragment, { children: [
|
|
2054
|
+
v > 0 && f,
|
|
2055
|
+
/* @__PURE__ */ t("span", { children: g })
|
|
2056
|
+
] }, v)),
|
|
2057
|
+
f
|
|
2058
|
+
] })
|
|
2059
|
+
) : r.status !== "ready" ? /* @__PURE__ */ s(R, { children: [
|
|
2060
|
+
/* @__PURE__ */ t("span", { children: u }),
|
|
2061
|
+
f
|
|
2062
|
+
] }) : null,
|
|
2063
|
+
/* @__PURE__ */ t("span", { children: m })
|
|
2064
|
+
] }),
|
|
2065
|
+
r.note && /* @__PURE__ */ t("div", { className: "text-[12px] leading-4 text-muted-foreground", children: r.note }),
|
|
2066
|
+
r.status === "failed" && r.failure && /* @__PURE__ */ t("div", { className: "mt-1 whitespace-pre-wrap break-words text-[12px] leading-4 text-destructive", children: r.failure }),
|
|
2067
|
+
(n === "denied" || n === "blocked") && /* @__PURE__ */ s("div", { role: "alert", className: "mt-1 flex items-start gap-1.5 text-[12px] leading-4 text-foreground", children: [
|
|
2068
|
+
/* @__PURE__ */ t(La, { className: "mt-0.5 h-3 w-3 shrink-0 text-destructive", strokeWidth: 1.75 }),
|
|
2069
|
+
/* @__PURE__ */ t("span", { children: Va(n) })
|
|
2070
|
+
] })
|
|
2071
|
+
] })
|
|
2072
|
+
] });
|
|
2073
|
+
}
|
|
2074
|
+
function Ss({ variant: e }) {
|
|
2075
|
+
const { snapshot: a, markSeen: o } = yt(), n = a.runningCount > 0 ? a.runningCount > 9 ? "9+" : String(a.runningCount) : a.hasUnseenFinished ? "" : null, i = Qt("activity", "md", {
|
|
2076
|
+
label: de.title,
|
|
2077
|
+
icon: /* @__PURE__ */ t(Et, { className: "h-3.5 w-3.5" }),
|
|
2078
|
+
hint: n || (n === "" ? "New" : void 0),
|
|
2079
|
+
order: 30,
|
|
2080
|
+
onOpen: o
|
|
2081
|
+
});
|
|
2082
|
+
return i.collapsed ? /* @__PURE__ */ s(
|
|
2083
|
+
Ae,
|
|
2084
|
+
{
|
|
2085
|
+
open: i.popoverOpen,
|
|
2086
|
+
onOpenChange: (r) => {
|
|
2087
|
+
i.setPopoverOpen(r), r && o();
|
|
2088
|
+
},
|
|
2089
|
+
children: [
|
|
2090
|
+
i.anchorSlot && Sr(
|
|
2091
|
+
/* @__PURE__ */ t(hr, { asChild: !0, children: /* @__PURE__ */ t("span", { className: "absolute right-0 top-0 h-7 w-px" }) }),
|
|
2092
|
+
i.anchorSlot
|
|
2093
|
+
),
|
|
2094
|
+
/* @__PURE__ */ t(
|
|
2095
|
+
Fe,
|
|
2096
|
+
{
|
|
2097
|
+
className: "w-80 p-0",
|
|
2098
|
+
align: "end",
|
|
2099
|
+
sideOffset: 8,
|
|
2100
|
+
onFocusOutside: (r) => r.preventDefault(),
|
|
2101
|
+
children: /* @__PURE__ */ t(Lt, {})
|
|
2102
|
+
}
|
|
2103
|
+
)
|
|
2104
|
+
]
|
|
2105
|
+
}
|
|
2106
|
+
) : /* @__PURE__ */ s(Ae, { onOpenChange: (r) => {
|
|
2107
|
+
r && o();
|
|
2108
|
+
}, children: [
|
|
2109
|
+
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2110
|
+
I,
|
|
2111
|
+
{
|
|
2112
|
+
variant: e ?? "ghost",
|
|
2113
|
+
size: "xs",
|
|
2114
|
+
className: "relative w-7 px-0",
|
|
2115
|
+
"aria-label": de.title,
|
|
2116
|
+
title: de.title,
|
|
2117
|
+
children: [
|
|
2118
|
+
/* @__PURE__ */ t(Et, { className: "h-3.5 w-3.5" }),
|
|
2119
|
+
n !== null && /* @__PURE__ */ t(
|
|
2120
|
+
"span",
|
|
2121
|
+
{
|
|
2122
|
+
className: `absolute flex items-center justify-center rounded-full bg-primary text-primary-foreground ${n ? "-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"}`,
|
|
2123
|
+
children: n
|
|
2124
|
+
}
|
|
2125
|
+
)
|
|
2126
|
+
]
|
|
2127
|
+
}
|
|
2128
|
+
) }),
|
|
2129
|
+
/* @__PURE__ */ t(Fe, { className: "w-80 p-0", align: "end", sideOffset: 8, children: /* @__PURE__ */ t(Lt, {}) })
|
|
2130
|
+
] });
|
|
2131
|
+
}
|
|
2132
|
+
function Lt() {
|
|
2133
|
+
const e = yt(), a = Ma(), { rows: o, activeTruncated: n } = e.snapshot, i = o.some((r) => Ua(r.item.status));
|
|
2134
|
+
return o.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-1.5 px-6 py-8 text-center", children: [
|
|
2135
|
+
/* @__PURE__ */ t("span", { className: "flex h-8 w-8 items-center justify-center rounded-[6px] border border-border text-muted-foreground", children: /* @__PURE__ */ t(Oa, { className: "h-3.5 w-3.5", strokeWidth: 1.75 }) }),
|
|
2136
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] font-medium", children: de.title }),
|
|
2137
|
+
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: de.empty })
|
|
2138
|
+
] }) : /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
|
|
2139
|
+
/* @__PURE__ */ s("div", { className: "flex h-8 items-center gap-2 border-b border-border px-3", children: [
|
|
2140
|
+
/* @__PURE__ */ t("span", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: de.title }),
|
|
2141
|
+
/* @__PURE__ */ t("span", { className: "text-[10px] tabular-nums text-muted-foreground/70", children: o.length }),
|
|
2142
|
+
/* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-0.5", children: [
|
|
2143
|
+
i && /* @__PURE__ */ t(
|
|
2144
|
+
I,
|
|
2145
|
+
{
|
|
2146
|
+
variant: "ghost",
|
|
2147
|
+
size: "xs",
|
|
2148
|
+
className: "h-6 px-1.5 text-[12px] text-muted-foreground hover:text-foreground",
|
|
2149
|
+
onClick: e.clearFinished,
|
|
2150
|
+
children: de.clear
|
|
2151
|
+
}
|
|
2152
|
+
),
|
|
2153
|
+
/* @__PURE__ */ t(
|
|
2154
|
+
I,
|
|
2155
|
+
{
|
|
2156
|
+
variant: "ghost",
|
|
2157
|
+
size: "xs",
|
|
2158
|
+
className: "h-6 w-6 px-0 text-muted-foreground hover:text-foreground",
|
|
2159
|
+
onClick: e.refresh,
|
|
2160
|
+
title: "Refresh status",
|
|
2161
|
+
"aria-label": "Refresh status",
|
|
2162
|
+
children: /* @__PURE__ */ t(Rt, { strokeWidth: 1.75, className: "h-3.5 w-3.5" })
|
|
2163
|
+
}
|
|
2164
|
+
)
|
|
2165
|
+
] })
|
|
2166
|
+
] }),
|
|
2167
|
+
n && /* @__PURE__ */ t("p", { className: "border-b border-border px-3 py-2 text-[12px] leading-4 text-muted-foreground", children: de.truncated }),
|
|
2168
|
+
/* @__PURE__ */ t("div", { className: "max-h-[320px] overflow-y-auto", children: /* @__PURE__ */ t("div", { className: "divide-y divide-border/70", children: o.map((r) => /* @__PURE__ */ t(sn, { row: r, now: a, api: e }, Ra(r))) }) })
|
|
2169
|
+
] });
|
|
2170
|
+
}
|
|
2171
|
+
function on(e) {
|
|
2172
|
+
if (e)
|
|
2173
|
+
return {
|
|
2174
|
+
renamed: e.type === "rename" ? { oldId: e.oldId, newId: e.newId } : void 0,
|
|
2175
|
+
removedControlId: e.type === "remove" ? e.controlId : void 0,
|
|
2176
|
+
cardBindingsById: e.type === "add" || e.type === "update" ? e.cardBindingsById : void 0,
|
|
2177
|
+
affectedBindingControlIds: e.type === "add" || e.type === "update" ? e.affectedBindingControlIds : void 0
|
|
2178
|
+
};
|
|
2179
|
+
}
|
|
2180
|
+
function ln({
|
|
2181
|
+
open: e,
|
|
2182
|
+
onOpenChange: a,
|
|
2183
|
+
trigger: o,
|
|
2184
|
+
showTrigger: n = !0,
|
|
2185
|
+
initialMode: i = "manage"
|
|
2186
|
+
}) {
|
|
2187
|
+
const r = i === "create", {
|
|
2188
|
+
forceClose: d,
|
|
2189
|
+
handleOpenChange: c,
|
|
2190
|
+
isCreateFlowActive: l,
|
|
2191
|
+
preventPassiveDismissDuringCreate: u,
|
|
2192
|
+
resolvedOpen: h,
|
|
2193
|
+
setIsCreateFlowActive: m
|
|
2194
|
+
} = qt({
|
|
2195
|
+
open: e,
|
|
2196
|
+
onOpenChange: a,
|
|
2197
|
+
initialCreateFlowActive: i === "create",
|
|
2198
|
+
// Dialog mode renders a built-in X close button — allow explicit
|
|
2199
|
+
// closes through `handleOpenChange`. Popover mode has no X; its
|
|
2200
|
+
// only close-via-trigger path is a re-click that would silently
|
|
2201
|
+
// wipe the in-progress create flow, so block everything during
|
|
2202
|
+
// create and make consumers use `forceClose()` from a dedicated
|
|
2203
|
+
// button.
|
|
2204
|
+
dismissMode: n ? "passive" : "explicit-only"
|
|
2205
|
+
}), p = w((C) => C.dashboard), { setDashboardControlsModel: f } = ce(), { participants: g } = za(kr(p)), v = Array.from(
|
|
2206
|
+
new Map(
|
|
2207
|
+
g.flatMap(
|
|
2208
|
+
(C) => C.fieldChoices.map((D) => {
|
|
2209
|
+
var N;
|
|
2210
|
+
return [
|
|
2211
|
+
D.value,
|
|
2212
|
+
{
|
|
2213
|
+
option: D,
|
|
2214
|
+
target: (N = C.fieldTargetMap) == null ? void 0 : N[D.value]
|
|
2215
|
+
}
|
|
2216
|
+
];
|
|
2217
|
+
})
|
|
2218
|
+
)
|
|
2219
|
+
).values()
|
|
2220
|
+
), k = Array.from(
|
|
2221
|
+
new Map(
|
|
2222
|
+
g.flatMap(
|
|
2223
|
+
(C) => C.metricChoices.map((D) => {
|
|
2224
|
+
var N;
|
|
2225
|
+
return [
|
|
2226
|
+
D.value,
|
|
2227
|
+
{
|
|
2228
|
+
option: D,
|
|
2229
|
+
target: (N = C.metricTargetMap) == null ? void 0 : N[D.value]
|
|
2230
|
+
}
|
|
2231
|
+
];
|
|
2232
|
+
})
|
|
2233
|
+
)
|
|
2234
|
+
).values()
|
|
2235
|
+
), V = xr({
|
|
2236
|
+
...p || {},
|
|
2237
|
+
controls: []
|
|
2238
|
+
}), U = _a(p), M = (C, D, N) => {
|
|
2239
|
+
f(
|
|
2240
|
+
C,
|
|
2241
|
+
D,
|
|
2242
|
+
on(N)
|
|
2243
|
+
);
|
|
2244
|
+
}, A = Z(() => {
|
|
2245
|
+
if (r) {
|
|
2246
|
+
d();
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
m(!1);
|
|
2250
|
+
}, [r, d, m]), O = /* @__PURE__ */ t(
|
|
2251
|
+
Ht,
|
|
2252
|
+
{
|
|
2253
|
+
scope: "dashboard",
|
|
2254
|
+
controls: p.controls || [],
|
|
2255
|
+
reservedControlIds: V,
|
|
2256
|
+
defaultValues: p.defaultControlValues || {},
|
|
2257
|
+
usageByControlId: ja(p),
|
|
2258
|
+
availableFieldChoices: v,
|
|
2259
|
+
availableMetricChoices: k,
|
|
2260
|
+
structuralParticipants: g,
|
|
2261
|
+
structuralParticipantIdsByControlId: U,
|
|
2262
|
+
initialCreateFlow: i === "create",
|
|
2263
|
+
onCreateFlowActiveChange: m,
|
|
2264
|
+
onCreateFlowComplete: A,
|
|
2265
|
+
onChange: M,
|
|
2266
|
+
emptyMessage: "No dashboard controls yet."
|
|
2267
|
+
}
|
|
2268
|
+
), b = l ? "Add dashboard control" : "Dashboard Controls", F = /* @__PURE__ */ s(R, { children: [
|
|
2269
|
+
/* @__PURE__ */ s("div", { className: "space-y-1", children: [
|
|
2270
|
+
/* @__PURE__ */ t("h4", { className: "text-sm font-medium", children: "Dashboard Controls" }),
|
|
2271
|
+
/* @__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." })
|
|
2272
|
+
] }),
|
|
2273
|
+
O
|
|
2274
|
+
] });
|
|
2275
|
+
return n ? /* @__PURE__ */ s(Ae, { open: h, onOpenChange: c, children: [
|
|
2276
|
+
/* @__PURE__ */ t(qe, { asChild: !0, children: o || /* @__PURE__ */ s(I, { variant: "outline", className: "h-7 px-2", size: "sm", children: [
|
|
2277
|
+
/* @__PURE__ */ t($t, { className: "mr-2 h-4 w-4" }),
|
|
2278
|
+
"Controls"
|
|
2279
|
+
] }) }),
|
|
2280
|
+
/* @__PURE__ */ t(
|
|
2281
|
+
Fe,
|
|
2282
|
+
{
|
|
2283
|
+
className: "w-[620px] max-w-[95vw] space-y-4",
|
|
2284
|
+
align: "end",
|
|
2285
|
+
onEscapeKeyDown: u,
|
|
2286
|
+
onPointerDownOutside: u,
|
|
2287
|
+
children: F
|
|
2288
|
+
}
|
|
2289
|
+
)
|
|
2290
|
+
] }) : /* @__PURE__ */ t(Ie, { open: h, onOpenChange: c, children: /* @__PURE__ */ s(
|
|
2291
|
+
Te,
|
|
2292
|
+
{
|
|
2293
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2294
|
+
onEscapeKeyDown: u,
|
|
2295
|
+
onPointerDownOutside: u,
|
|
2296
|
+
children: [
|
|
2297
|
+
/* @__PURE__ */ s(
|
|
2298
|
+
bt,
|
|
2299
|
+
{
|
|
2300
|
+
className: l ? "space-y-0" : void 0,
|
|
2301
|
+
children: [
|
|
2302
|
+
/* @__PURE__ */ t(Le, { className: "text-[15px]", children: b }),
|
|
2303
|
+
/* @__PURE__ */ t(
|
|
2304
|
+
xt,
|
|
2305
|
+
{
|
|
2306
|
+
className: l ? "sr-only" : "text-[13px]",
|
|
2307
|
+
children: l ? "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."
|
|
2308
|
+
}
|
|
2309
|
+
)
|
|
2310
|
+
]
|
|
2311
|
+
}
|
|
2312
|
+
),
|
|
2313
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: O })
|
|
2314
|
+
]
|
|
2315
|
+
}
|
|
2316
|
+
) });
|
|
2317
|
+
}
|
|
2318
|
+
const dn = [
|
|
2319
|
+
"enum",
|
|
2320
|
+
"multi_enum",
|
|
2321
|
+
"text",
|
|
2322
|
+
"number",
|
|
2323
|
+
"boolean",
|
|
2324
|
+
"date"
|
|
2325
|
+
];
|
|
2326
|
+
function cn({
|
|
2327
|
+
open: e,
|
|
2328
|
+
onOpenChange: a,
|
|
2329
|
+
initialMode: o = "manage"
|
|
2330
|
+
}) {
|
|
2331
|
+
var F;
|
|
2332
|
+
const n = o === "create", {
|
|
2333
|
+
forceClose: i,
|
|
2334
|
+
handleOpenChange: r,
|
|
2335
|
+
isCreateFlowActive: d,
|
|
2336
|
+
preventPassiveDismissDuringCreate: c,
|
|
2337
|
+
resolvedOpen: l,
|
|
2338
|
+
setIsCreateFlowActive: u
|
|
2339
|
+
} = qt({
|
|
2340
|
+
open: e,
|
|
2341
|
+
onOpenChange: a,
|
|
2342
|
+
initialCreateFlowActive: o === "create",
|
|
2343
|
+
dismissMode: "explicit-only"
|
|
2344
|
+
}), h = w((C) => C.dashboard), m = w((C) => C.selectedSheetId), { setDashboardInputs: p } = ce(), f = (F = h.sheets) == null ? void 0 : F.find(
|
|
2345
|
+
(C) => C.id === m
|
|
2346
|
+
), g = (f == null ? void 0 : f.kind) === "document" && !!f.document, v = te(
|
|
2347
|
+
() => g && (f != null && f.document) ? Lr(h, f.id) : [],
|
|
2348
|
+
[h, g, f == null ? void 0 : f.document, f == null ? void 0 : f.id]
|
|
2349
|
+
), k = te(
|
|
2350
|
+
() => v.filter(
|
|
2351
|
+
(C) => C.kind === "control"
|
|
2352
|
+
),
|
|
2353
|
+
[v]
|
|
2354
|
+
), V = te(
|
|
2355
|
+
() => k.map((C) => C.control),
|
|
2356
|
+
[k]
|
|
2357
|
+
), U = te(
|
|
2358
|
+
() => hn(V),
|
|
2359
|
+
[V]
|
|
2360
|
+
), M = te(
|
|
2361
|
+
() => un(h),
|
|
2362
|
+
[h]
|
|
2363
|
+
), A = Z(() => {
|
|
2364
|
+
if (n) {
|
|
2365
|
+
i();
|
|
2366
|
+
return;
|
|
2367
|
+
}
|
|
2368
|
+
u(!1);
|
|
2369
|
+
}, [n, i, u]), O = Z(
|
|
2370
|
+
(C, D, N) => {
|
|
2371
|
+
!g || !(f != null && f.document) || p(
|
|
2372
|
+
pn({
|
|
2373
|
+
allInputs: h.inputs || [],
|
|
2374
|
+
documentSheetId: f.id,
|
|
2375
|
+
currentDocumentInputs: v,
|
|
2376
|
+
nextControls: C,
|
|
2377
|
+
nextDefaultValues: D,
|
|
2378
|
+
change: N
|
|
2379
|
+
})
|
|
2380
|
+
);
|
|
2381
|
+
},
|
|
2382
|
+
[
|
|
2383
|
+
h.inputs,
|
|
2384
|
+
v,
|
|
2385
|
+
g,
|
|
2386
|
+
f,
|
|
2387
|
+
p
|
|
2388
|
+
]
|
|
2389
|
+
);
|
|
2390
|
+
return !g || !(f != null && f.document) ? null : /* @__PURE__ */ t(Ie, { open: l, onOpenChange: r, children: /* @__PURE__ */ s(
|
|
2391
|
+
Te,
|
|
2392
|
+
{
|
|
2393
|
+
className: "flex max-h-[88vh] flex-col overflow-hidden sm:max-w-[600px]",
|
|
2394
|
+
onEscapeKeyDown: c,
|
|
2395
|
+
onPointerDownOutside: c,
|
|
2396
|
+
children: [
|
|
2397
|
+
/* @__PURE__ */ s(bt, { className: d ? "space-y-0" : void 0, children: [
|
|
2398
|
+
/* @__PURE__ */ t(Le, { className: "text-[15px]", children: d ? "Add document control" : "Document Controls" }),
|
|
2399
|
+
/* @__PURE__ */ t(
|
|
2400
|
+
xt,
|
|
2401
|
+
{
|
|
2402
|
+
className: d ? "sr-only" : "text-[13px]",
|
|
2403
|
+
children: d ? "Configure and add a document-local control input." : "Add document-local control inputs. They are stored on this document sheet and are not dashboard controls."
|
|
2404
|
+
}
|
|
2405
|
+
)
|
|
2406
|
+
] }),
|
|
2407
|
+
/* @__PURE__ */ t("div", { className: "min-h-0 overflow-y-auto pr-1", children: /* @__PURE__ */ t(
|
|
2408
|
+
Ht,
|
|
2409
|
+
{
|
|
2410
|
+
scope: "dashboard",
|
|
2411
|
+
controls: V,
|
|
2412
|
+
reservedControlIds: M,
|
|
2413
|
+
defaultValues: U,
|
|
2414
|
+
usageByControlId: {},
|
|
2415
|
+
availableFieldChoices: [],
|
|
2416
|
+
availableMetricChoices: [],
|
|
2417
|
+
structuralParticipants: [],
|
|
2418
|
+
structuralParticipantIdsByControlId: {},
|
|
2419
|
+
allowedControlTypes: dn,
|
|
2420
|
+
initialCreateFlow: o === "create",
|
|
2421
|
+
onCreateFlowActiveChange: u,
|
|
2422
|
+
onCreateFlowComplete: A,
|
|
2423
|
+
onChange: O,
|
|
2424
|
+
emptyMessage: "No document controls yet."
|
|
2425
|
+
}
|
|
2426
|
+
) })
|
|
2427
|
+
]
|
|
2428
|
+
}
|
|
2429
|
+
) });
|
|
2430
|
+
}
|
|
2431
|
+
function un(e) {
|
|
2432
|
+
return (e.controls || []).map((a) => a.id);
|
|
2433
|
+
}
|
|
2434
|
+
function hn(e) {
|
|
2435
|
+
const a = {};
|
|
2436
|
+
for (const o of e)
|
|
2437
|
+
o.defaultValue !== void 0 && (a[o.id] = o.defaultValue);
|
|
2438
|
+
return a;
|
|
2439
|
+
}
|
|
2440
|
+
function mn(e, a) {
|
|
2441
|
+
return a ? Object.prototype.hasOwnProperty.call(a, e.id) ? {
|
|
2442
|
+
...e,
|
|
2443
|
+
defaultValue: a[e.id]
|
|
2444
|
+
} : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 } : e.defaultValue === void 0 ? e : { ...e, defaultValue: void 0 };
|
|
2445
|
+
}
|
|
2446
|
+
function pn({
|
|
2447
|
+
allInputs: e,
|
|
2448
|
+
documentSheetId: a,
|
|
2449
|
+
currentDocumentInputs: o,
|
|
2450
|
+
nextControls: n,
|
|
2451
|
+
nextDefaultValues: i,
|
|
2452
|
+
change: r
|
|
2453
|
+
}) {
|
|
2454
|
+
const d = new Map(
|
|
2455
|
+
n.map((p) => [
|
|
2456
|
+
p.id,
|
|
2457
|
+
mn(p, i)
|
|
2458
|
+
])
|
|
2459
|
+
), c = (r == null ? void 0 : r.type) === "rename" ? { oldId: r.oldId, newId: r.newId } : null, l = /* @__PURE__ */ new Set(), u = [];
|
|
2460
|
+
for (const p of o) {
|
|
2461
|
+
if (p.kind !== "control") {
|
|
2462
|
+
u.push(p);
|
|
2463
|
+
continue;
|
|
2464
|
+
}
|
|
2465
|
+
const f = d.get(p.control.id) || ((c == null ? void 0 : c.oldId) === p.control.id ? d.get(c.newId) : void 0);
|
|
2466
|
+
if (!f)
|
|
2467
|
+
continue;
|
|
2468
|
+
l.add(f.id);
|
|
2469
|
+
const g = vr(
|
|
2470
|
+
f.id,
|
|
2471
|
+
[...e, ...u].filter(
|
|
2472
|
+
(k) => k.id !== p.id
|
|
2473
|
+
)
|
|
2474
|
+
), v = f.id === g ? f : { ...f, id: g };
|
|
2475
|
+
u.push({
|
|
2476
|
+
...p,
|
|
2477
|
+
label: v.label,
|
|
2478
|
+
variableName: g,
|
|
2479
|
+
requiredAtExecution: v.requiredAtExecution,
|
|
2480
|
+
control: v
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
for (const p of d.values())
|
|
2484
|
+
l.has(p.id) || u.push(
|
|
2485
|
+
Vr({
|
|
2486
|
+
control: p,
|
|
2487
|
+
existingInputs: [...e, ...u],
|
|
2488
|
+
sheetId: a
|
|
2489
|
+
})
|
|
2490
|
+
);
|
|
2491
|
+
const h = new Set(
|
|
2492
|
+
o.map((p) => p.id)
|
|
2493
|
+
);
|
|
2494
|
+
return [...e.filter(
|
|
2495
|
+
(p) => !h.has(p.id)
|
|
2496
|
+
), ...u];
|
|
2497
|
+
}
|
|
2498
|
+
function fn({
|
|
2499
|
+
showFilters: e,
|
|
2500
|
+
onShowFiltersChange: a,
|
|
2501
|
+
pickerContent: o,
|
|
2502
|
+
settingsContent: n,
|
|
2503
|
+
size: i = "default",
|
|
2504
|
+
className: r,
|
|
2505
|
+
primaryButtonClassName: d,
|
|
2506
|
+
secondaryButtonClassName: c,
|
|
2507
|
+
pickerContentClassName: l,
|
|
2508
|
+
settingsContentClassName: u
|
|
2509
|
+
}) {
|
|
2510
|
+
const h = i === "toolbar", [m, p] = S(!1), f = ot("interactive");
|
|
2511
|
+
return /* @__PURE__ */ s(
|
|
2512
|
+
"div",
|
|
2513
|
+
{
|
|
2514
|
+
className: J(
|
|
2515
|
+
// Height lives on the shell so the outer border is part of the
|
|
2516
|
+
// h-7 box (matches regular `size="xs"` buttons). Inner triggers
|
|
2517
|
+
// stretch to fill via `h-full`.
|
|
2518
|
+
"relative inline-flex items-stretch overflow-hidden rounded-control border border-input bg-background",
|
|
2519
|
+
h ? "h-8" : "h-7",
|
|
2520
|
+
r
|
|
2521
|
+
),
|
|
2522
|
+
children: [
|
|
2523
|
+
/* @__PURE__ */ s(Ae, { open: e, onOpenChange: a, children: [
|
|
2524
|
+
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ s(
|
|
2525
|
+
I,
|
|
2526
|
+
{
|
|
2527
|
+
variant: "ghost",
|
|
2528
|
+
size: "xs",
|
|
2529
|
+
className: J(
|
|
2530
|
+
"h-full rounded-none border-0 bg-transparent pl-2.5 pr-2 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2531
|
+
d
|
|
2532
|
+
),
|
|
2533
|
+
children: [
|
|
2534
|
+
e ? /* @__PURE__ */ t(Er, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(zt, { className: "h-3.5 w-3.5" }),
|
|
2535
|
+
"Filter"
|
|
2536
|
+
]
|
|
2537
|
+
}
|
|
2538
|
+
) }),
|
|
2539
|
+
/* @__PURE__ */ t(
|
|
2540
|
+
Fe,
|
|
2541
|
+
{
|
|
2542
|
+
align: "end",
|
|
2543
|
+
sideOffset: 6,
|
|
2544
|
+
className: J(
|
|
2545
|
+
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2546
|
+
l
|
|
2547
|
+
),
|
|
2548
|
+
style: f.contentStyle,
|
|
2549
|
+
children: o
|
|
2550
|
+
}
|
|
2551
|
+
)
|
|
2552
|
+
] }),
|
|
2553
|
+
/* @__PURE__ */ s(Ae, { open: m, onOpenChange: p, children: [
|
|
2554
|
+
/* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2555
|
+
I,
|
|
2556
|
+
{
|
|
2557
|
+
variant: "ghost",
|
|
2558
|
+
size: "xs",
|
|
2559
|
+
className: J(
|
|
2560
|
+
"h-full w-7 rounded-none border-0 border-l border-border/60 bg-transparent px-0 shadow-none hover:bg-accent/50 data-[state=open]:bg-accent/60",
|
|
2561
|
+
c
|
|
2562
|
+
),
|
|
2563
|
+
"aria-label": "Filter and control actions",
|
|
2564
|
+
children: /* @__PURE__ */ t(wt, { className: "h-3.5 w-3.5" })
|
|
2565
|
+
}
|
|
2566
|
+
) }),
|
|
2567
|
+
/* @__PURE__ */ t(
|
|
2568
|
+
Fe,
|
|
2569
|
+
{
|
|
2570
|
+
align: "end",
|
|
2571
|
+
sideOffset: 6,
|
|
2572
|
+
className: J(
|
|
2573
|
+
"w-auto rounded-card border border-border/60 p-0 shadow-[0_10px_28px_rgba(0,0,0,0.14)] dark:shadow-[0_10px_28px_rgba(0,0,0,0.5)]",
|
|
2574
|
+
u
|
|
2575
|
+
),
|
|
2576
|
+
style: f.contentStyle,
|
|
2577
|
+
children: n(() => p(!1))
|
|
2578
|
+
}
|
|
2579
|
+
)
|
|
2580
|
+
] })
|
|
2581
|
+
]
|
|
2582
|
+
}
|
|
2583
|
+
);
|
|
2584
|
+
}
|
|
2585
|
+
function gn() {
|
|
2586
|
+
Ir();
|
|
2587
|
+
const e = w((l) => l.selectedSheetId), a = w((l) => l.selectedFrameId), o = w((l) => l.dashboard), n = w((l) => l.actions.getSelectedFrame), { setSelectedFrameId: i } = ce(), { setCard: r } = Ge(), d = ee((l) => l.card.dataSource);
|
|
2588
|
+
return xe(() => {
|
|
2589
|
+
var u, h;
|
|
2590
|
+
let l = n();
|
|
2591
|
+
if (!l) {
|
|
2592
|
+
const m = (u = o == null ? void 0 : o.sheets) == null ? void 0 : u.find((f) => f.id === e), p = (h = m == null ? void 0 : m.frames) == null ? void 0 : h[0];
|
|
2593
|
+
p && (i(p.id), l = p);
|
|
2594
|
+
}
|
|
2595
|
+
if (l) {
|
|
2596
|
+
const m = l.cards.find((p) => p.id === l.activeCardId);
|
|
2597
|
+
m && r(m);
|
|
2598
|
+
}
|
|
2599
|
+
}, [n, e, a, o, i, r]), {
|
|
2600
|
+
hasEntities: !!(d != null && d.selectedEntities && d.selectedEntities.length > 0)
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2603
|
+
function bn() {
|
|
2604
|
+
const e = w((l) => l.dashboard), a = w(
|
|
2605
|
+
(l) => l.semanticExecutionPayload
|
|
2606
|
+
), o = w(
|
|
2607
|
+
(l) => l.actions.addFilterInput
|
|
2608
|
+
), { hasEntities: n } = gn(), { isLoading: i } = $a(), r = te(
|
|
2609
|
+
() => yr(e, a),
|
|
2610
|
+
[e, a]
|
|
2611
|
+
), c = !Cr(e) && r.hasEligibleCards && !i;
|
|
2612
|
+
return /* @__PURE__ */ s("div", { className: "flex h-[520px] w-[400px] flex-col", children: [
|
|
2613
|
+
c && /* @__PURE__ */ t("div", { className: "border-b border-border/60 p-2", children: /* @__PURE__ */ s(
|
|
2614
|
+
"button",
|
|
2615
|
+
{
|
|
2616
|
+
type: "button",
|
|
2617
|
+
onClick: () => o(wr(), {
|
|
2618
|
+
kind: "allSheets",
|
|
2619
|
+
sheetKinds: ["dashboard"]
|
|
2620
|
+
}),
|
|
2621
|
+
title: `Applies to ${r.eligibleCardCount} of ${r.totalCardCount} date-aware cards`,
|
|
2622
|
+
className: "flex w-full items-start gap-2 rounded-control px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-border",
|
|
2623
|
+
children: [
|
|
2624
|
+
/* @__PURE__ */ t(Ur, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
2625
|
+
/* @__PURE__ */ s("span", { className: "flex min-w-0 flex-col", children: [
|
|
2626
|
+
/* @__PURE__ */ t("span", { className: "text-[12px] font-medium text-foreground", children: "Add global date filter" }),
|
|
2627
|
+
/* @__PURE__ */ t("span", { className: "text-[11px] leading-[1.4] text-muted-foreground", children: "One date range across all date-aware cards." })
|
|
2628
|
+
] })
|
|
2629
|
+
]
|
|
2630
|
+
}
|
|
2631
|
+
) }),
|
|
2632
|
+
!n && /* @__PURE__ */ s("div", { className: "flex flex-1 flex-col items-center justify-center px-6 py-8 text-center", children: [
|
|
2633
|
+
/* @__PURE__ */ t(Wa, { className: "mb-3 h-10 w-10 text-muted-foreground/50" }),
|
|
2634
|
+
/* @__PURE__ */ t("h3", { className: "mb-1 text-[13px] font-medium text-foreground", children: "No fields configured" }),
|
|
2635
|
+
/* @__PURE__ */ t("p", { className: "text-[11px] text-muted-foreground", children: "Configure a data source for this card to enable filtering." })
|
|
2636
|
+
] }),
|
|
2637
|
+
n && /* @__PURE__ */ t("div", { className: "flex flex-1 overflow-hidden", children: /* @__PURE__ */ t(qa, { context: "filter" }) })
|
|
2638
|
+
] });
|
|
2639
|
+
}
|
|
2640
|
+
function xn({
|
|
2641
|
+
onAddFilter: e,
|
|
2642
|
+
onAddControl: a,
|
|
2643
|
+
onManageControls: o,
|
|
2644
|
+
onDismiss: n
|
|
2645
|
+
}) {
|
|
2646
|
+
const i = w(
|
|
2647
|
+
(c) => c.dashboard.filterLayout
|
|
2648
|
+
), { setFilterLayout: r } = ce(), d = (i == null ? void 0 : i.toolbarWrap) ?? !1;
|
|
2649
|
+
return /* @__PURE__ */ s("div", { className: "w-[300px]", children: [
|
|
2650
|
+
/* @__PURE__ */ s("div", { className: "p-1", children: [
|
|
2651
|
+
/* @__PURE__ */ t(
|
|
2652
|
+
rt,
|
|
2653
|
+
{
|
|
2654
|
+
icon: zt,
|
|
2655
|
+
label: "Add filter",
|
|
2656
|
+
onClick: () => {
|
|
2657
|
+
e(), n();
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
),
|
|
2661
|
+
/* @__PURE__ */ t(
|
|
2662
|
+
rt,
|
|
2663
|
+
{
|
|
2664
|
+
icon: $t,
|
|
2665
|
+
label: "Add control",
|
|
2666
|
+
onClick: () => {
|
|
2667
|
+
a(), n();
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
),
|
|
2671
|
+
/* @__PURE__ */ t(
|
|
2672
|
+
rt,
|
|
2673
|
+
{
|
|
2674
|
+
icon: _t,
|
|
2675
|
+
label: "Manage controls",
|
|
2676
|
+
onClick: () => {
|
|
2677
|
+
o(), n();
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
)
|
|
2681
|
+
] }),
|
|
2682
|
+
/* @__PURE__ */ t("div", { className: "border-t border-border/60" }),
|
|
2683
|
+
/* @__PURE__ */ s("div", { className: "space-y-1 p-2", children: [
|
|
2684
|
+
/* @__PURE__ */ t("p", { className: "px-1 text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display" }),
|
|
2685
|
+
/* @__PURE__ */ t(
|
|
2686
|
+
vn,
|
|
2687
|
+
{
|
|
2688
|
+
id: "filter-display-wrap",
|
|
2689
|
+
label: "Wrap to multiple lines",
|
|
2690
|
+
checked: d,
|
|
2691
|
+
onCheckedChange: (c) => r({ toolbarWrap: c === !0 })
|
|
2692
|
+
}
|
|
2693
|
+
)
|
|
2694
|
+
] })
|
|
2695
|
+
] });
|
|
2696
|
+
}
|
|
2697
|
+
function rt({
|
|
2698
|
+
icon: e,
|
|
2699
|
+
label: a,
|
|
2700
|
+
onClick: o
|
|
2701
|
+
}) {
|
|
2702
|
+
return /* @__PURE__ */ s(
|
|
2703
|
+
"button",
|
|
2704
|
+
{
|
|
2705
|
+
type: "button",
|
|
2706
|
+
onClick: o,
|
|
2707
|
+
className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-[13px] text-foreground outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40",
|
|
2708
|
+
children: [
|
|
2709
|
+
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
2710
|
+
a
|
|
2711
|
+
]
|
|
2712
|
+
}
|
|
2713
|
+
);
|
|
2714
|
+
}
|
|
2715
|
+
function vn({
|
|
2716
|
+
id: e,
|
|
2717
|
+
label: a,
|
|
2718
|
+
checked: o,
|
|
2719
|
+
onCheckedChange: n
|
|
2720
|
+
}) {
|
|
2721
|
+
return /* @__PURE__ */ s("div", { className: "flex items-center gap-2 rounded-control px-1 py-1 transition-colors hover:bg-muted/40 focus-within:bg-muted/40", children: [
|
|
2722
|
+
/* @__PURE__ */ t(gt, { id: e, checked: o, onCheckedChange: n }),
|
|
2723
|
+
/* @__PURE__ */ t(
|
|
2724
|
+
De,
|
|
2725
|
+
{
|
|
2726
|
+
htmlFor: e,
|
|
2727
|
+
className: "cursor-pointer text-[12px] font-normal leading-[1.3]",
|
|
2728
|
+
children: a
|
|
2729
|
+
}
|
|
2730
|
+
)
|
|
2731
|
+
] });
|
|
2732
|
+
}
|
|
2733
|
+
function ks({
|
|
2734
|
+
size: e,
|
|
2735
|
+
className: a,
|
|
2736
|
+
primaryButtonClassName: o,
|
|
2737
|
+
secondaryButtonClassName: n,
|
|
2738
|
+
pickerContentClassName: i,
|
|
2739
|
+
settingsContentClassName: r
|
|
2740
|
+
}) {
|
|
2741
|
+
var O;
|
|
2742
|
+
const [d, c] = S(null), l = w((b) => b.dashboard), u = w((b) => b.selectedSheetId), h = w((b) => b.showFilters), m = w((b) => b.actions), { setDocumentPanelTarget: p, setShowFilters: f } = m, g = (O = l.sheets) == null ? void 0 : O.find(
|
|
2743
|
+
(b) => b.id === u
|
|
2744
|
+
), v = Nt(g), k = Z((b) => {
|
|
2745
|
+
window.setTimeout(() => {
|
|
2746
|
+
c(b);
|
|
2747
|
+
}, 0);
|
|
2748
|
+
}, []), V = Z(
|
|
2749
|
+
(b) => {
|
|
2750
|
+
if (v && u) {
|
|
2751
|
+
b && p(u, {
|
|
2752
|
+
kind: "document",
|
|
2753
|
+
group: "inputs"
|
|
2754
|
+
});
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
f(b);
|
|
2758
|
+
},
|
|
2759
|
+
[
|
|
2760
|
+
v,
|
|
2761
|
+
u,
|
|
2762
|
+
p,
|
|
2763
|
+
f
|
|
2764
|
+
]
|
|
2765
|
+
), U = Z(() => {
|
|
2766
|
+
V(!0);
|
|
2767
|
+
}, [V]), M = Z(() => {
|
|
2768
|
+
k("create");
|
|
2769
|
+
}, [k]), A = Z(() => {
|
|
2770
|
+
k("manage");
|
|
2771
|
+
}, [k]);
|
|
2772
|
+
return /* @__PURE__ */ s(R, { children: [
|
|
2773
|
+
/* @__PURE__ */ t(
|
|
2774
|
+
fn,
|
|
2775
|
+
{
|
|
2776
|
+
showFilters: v ? !1 : h,
|
|
2777
|
+
onShowFiltersChange: V,
|
|
2778
|
+
pickerContent: /* @__PURE__ */ t(bn, {}),
|
|
2779
|
+
settingsContent: (b) => /* @__PURE__ */ t(
|
|
2780
|
+
xn,
|
|
2781
|
+
{
|
|
2782
|
+
onAddFilter: U,
|
|
2783
|
+
onAddControl: M,
|
|
2784
|
+
onManageControls: A,
|
|
2785
|
+
onDismiss: b
|
|
2786
|
+
}
|
|
2787
|
+
),
|
|
2788
|
+
size: e,
|
|
2789
|
+
className: a,
|
|
2790
|
+
primaryButtonClassName: o,
|
|
2791
|
+
secondaryButtonClassName: n,
|
|
2792
|
+
pickerContentClassName: i,
|
|
2793
|
+
settingsContentClassName: r
|
|
2794
|
+
}
|
|
2795
|
+
),
|
|
2796
|
+
d ? v ? /* @__PURE__ */ t(
|
|
2797
|
+
cn,
|
|
2798
|
+
{
|
|
2799
|
+
open: !0,
|
|
2800
|
+
onOpenChange: (b) => {
|
|
2801
|
+
b || c(null);
|
|
2802
|
+
},
|
|
2803
|
+
initialMode: d
|
|
2804
|
+
}
|
|
2805
|
+
) : /* @__PURE__ */ t(
|
|
2806
|
+
ln,
|
|
2807
|
+
{
|
|
2808
|
+
open: !0,
|
|
2809
|
+
onOpenChange: (b) => {
|
|
2810
|
+
b || c(null);
|
|
2811
|
+
},
|
|
2812
|
+
showTrigger: !1,
|
|
2813
|
+
initialMode: d
|
|
2814
|
+
}
|
|
2815
|
+
) : null
|
|
2816
|
+
] });
|
|
2817
|
+
}
|
|
2818
|
+
function yn({
|
|
2819
|
+
disabled: e,
|
|
2820
|
+
briefingCount: a,
|
|
2821
|
+
className: o,
|
|
2822
|
+
onClick: n
|
|
2823
|
+
}) {
|
|
2824
|
+
const i = typeof a == "number" && a > 0;
|
|
2825
|
+
return /* @__PURE__ */ s(
|
|
2826
|
+
I,
|
|
2827
|
+
{
|
|
2828
|
+
type: "button",
|
|
2829
|
+
size: "xs",
|
|
2830
|
+
variant: "outline",
|
|
2831
|
+
disabled: e,
|
|
2832
|
+
className: J("gap-1.5", o),
|
|
2833
|
+
onClick: n,
|
|
2834
|
+
"aria-label": "Reports & briefings",
|
|
2835
|
+
children: [
|
|
2836
|
+
/* @__PURE__ */ t(zr, { className: "h-3.5 w-3.5" }),
|
|
2837
|
+
"Reports & briefings",
|
|
2838
|
+
i ? /* @__PURE__ */ t("span", { className: "ml-0.5 rounded-control bg-muted px-1 text-[10px] tabular-nums text-foreground/70", children: a }) : null
|
|
2839
|
+
]
|
|
2840
|
+
}
|
|
2841
|
+
);
|
|
2842
|
+
}
|
|
2843
|
+
const Cn = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", Zt = "inline-flex h-7 items-center gap-1.5 rounded-control px-2 text-[12px] text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50", je = "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-3 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-50";
|
|
2844
|
+
function wn(e) {
|
|
2845
|
+
return e === "dashboard" ? "This dashboard" : "Project";
|
|
2846
|
+
}
|
|
2847
|
+
function Nn(e) {
|
|
2848
|
+
if (!e) return "Never";
|
|
2849
|
+
const a = new Date(e);
|
|
2850
|
+
if (Number.isNaN(a.getTime())) return "Unknown";
|
|
2851
|
+
const o = Date.now() - a.getTime(), n = Math.round(o / 6e4);
|
|
2852
|
+
if (n < 1) return "now";
|
|
2853
|
+
if (n < 60) return `${n}m ago`;
|
|
2854
|
+
const i = Math.round(n / 60);
|
|
2855
|
+
if (i < 24) return `${i}h ago`;
|
|
2856
|
+
const r = Math.round(i / 24);
|
|
2857
|
+
if (r < 7) return `${r}d ago`;
|
|
2858
|
+
const d = Math.round(r / 7);
|
|
2859
|
+
return d < 5 ? `${d}w ago` : `${Math.round(r / 30)}mo ago`;
|
|
2860
|
+
}
|
|
2861
|
+
function Sn(e) {
|
|
2862
|
+
return e.scheduleExpr ? Br(
|
|
2863
|
+
e.scheduleExpr,
|
|
2864
|
+
e.timezone || "UTC"
|
|
2865
|
+
) ?? "Invalid schedule" : "On demand";
|
|
2866
|
+
}
|
|
2867
|
+
function kn(e) {
|
|
2868
|
+
if (e.lastRunStatus) {
|
|
2869
|
+
const a = e.lastRunStatus.toString().toUpperCase();
|
|
2870
|
+
return a === "SUCCESS" ? "Last run completed." : a === "FAILED" ? "Last run failed." : `Last run ${e.lastRunStatus.toString().toLowerCase()}`;
|
|
2871
|
+
}
|
|
2872
|
+
return null;
|
|
2873
|
+
}
|
|
2874
|
+
function Jt(e) {
|
|
2875
|
+
return e.hasActiveRun ? "Running" : e.lastRunStatus ? `Last run ${e.lastRunStatus.toString().toLowerCase()}` : "Idle";
|
|
2876
|
+
}
|
|
2877
|
+
function Dn(e) {
|
|
2878
|
+
return e.source.type === "dashboard" ? "This dashboard" : "Project";
|
|
2879
|
+
}
|
|
2880
|
+
function An({
|
|
2881
|
+
activeView: e,
|
|
2882
|
+
onChange: a
|
|
2883
|
+
}) {
|
|
2884
|
+
return /* @__PURE__ */ t(
|
|
2885
|
+
"div",
|
|
2886
|
+
{
|
|
2887
|
+
className: "flex shrink-0 items-center gap-1 rounded-control bg-muted p-0.5",
|
|
2888
|
+
role: "tablist",
|
|
2889
|
+
"aria-label": "Briefing source view",
|
|
2890
|
+
children: ["dashboard", "project"].map((o) => {
|
|
2891
|
+
const n = e === o;
|
|
2892
|
+
return /* @__PURE__ */ t(
|
|
2893
|
+
"button",
|
|
2894
|
+
{
|
|
2895
|
+
type: "button",
|
|
2896
|
+
role: "tab",
|
|
2897
|
+
"aria-selected": n,
|
|
2898
|
+
onClick: () => a(o),
|
|
2899
|
+
className: J(
|
|
2900
|
+
"h-6 rounded-[3px] px-2 text-[11px] transition-colors",
|
|
2901
|
+
n ? "bg-background font-medium text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
|
|
2902
|
+
),
|
|
2903
|
+
children: wn(o)
|
|
2904
|
+
},
|
|
2905
|
+
o
|
|
2906
|
+
);
|
|
2907
|
+
})
|
|
2908
|
+
}
|
|
2909
|
+
);
|
|
2910
|
+
}
|
|
2911
|
+
function Fn({
|
|
2912
|
+
briefings: e,
|
|
2913
|
+
dashboardLabel: a,
|
|
2914
|
+
sourceView: o,
|
|
2915
|
+
error: n,
|
|
2916
|
+
loading: i,
|
|
2917
|
+
onSourceViewChange: r,
|
|
2918
|
+
onClose: d,
|
|
2919
|
+
onEdit: c,
|
|
2920
|
+
onNew: l,
|
|
2921
|
+
canCreate: u,
|
|
2922
|
+
canCreateScheduledReport: h,
|
|
2923
|
+
analyticalBriefingsEnabled: m,
|
|
2924
|
+
onRunNow: p,
|
|
2925
|
+
onTogglePause: f,
|
|
2926
|
+
onDelete: g,
|
|
2927
|
+
selectingId: v,
|
|
2928
|
+
busyId: k,
|
|
2929
|
+
manageBriefingsHref: V,
|
|
2930
|
+
contentKind: U,
|
|
2931
|
+
hideHeader: M = !1
|
|
2932
|
+
}) {
|
|
2933
|
+
const A = e.length, O = e.filter((N) => N.status === "ACTIVE").length, b = U === "reports" ? A === 1 ? "report" : "reports" : U === "briefings" ? A === 1 ? "briefing" : "briefings" : A === 1 ? "item" : "items", F = e.find((N) => N.hasActiveRun) ?? null, C = U ?? "reports & briefings", D = o === "dashboard" ? a : `Project ${C}`;
|
|
2934
|
+
return /* @__PURE__ */ s(
|
|
2935
|
+
"section",
|
|
2936
|
+
{
|
|
2937
|
+
"aria-label": `Dashboard ${C.replace("&", "and")}`,
|
|
2938
|
+
className: "flex h-full min-h-0 flex-col bg-background text-foreground",
|
|
2939
|
+
children: [
|
|
2940
|
+
M ? null : /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
2941
|
+
/* @__PURE__ */ s("div", { className: "min-w-0", children: [
|
|
2942
|
+
/* @__PURE__ */ t("div", { className: Cn, children: C }),
|
|
2943
|
+
/* @__PURE__ */ t("h2", { className: "mt-0.5 truncate text-[14px] font-semibold leading-5", children: D })
|
|
2944
|
+
] }),
|
|
2945
|
+
/* @__PURE__ */ t(
|
|
2946
|
+
"button",
|
|
2947
|
+
{
|
|
2948
|
+
type: "button",
|
|
2949
|
+
onClick: d,
|
|
2950
|
+
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
2951
|
+
"aria-label": `Close ${C.replace("&", "and")} panel`,
|
|
2952
|
+
children: /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" })
|
|
2953
|
+
}
|
|
2954
|
+
)
|
|
2955
|
+
] }),
|
|
2956
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between gap-3 border-b border-border px-4 py-2", children: [
|
|
2957
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
2958
|
+
/* @__PURE__ */ t(
|
|
2959
|
+
An,
|
|
2960
|
+
{
|
|
2961
|
+
activeView: o,
|
|
2962
|
+
onChange: r
|
|
2963
|
+
}
|
|
2964
|
+
),
|
|
2965
|
+
/* @__PURE__ */ t("div", { className: "flex min-w-0 items-center gap-1.5 text-[11px] text-muted-foreground", children: i && A === 0 ? /* @__PURE__ */ s("span", { children: [
|
|
2966
|
+
"Loading ",
|
|
2967
|
+
C,
|
|
2968
|
+
"…"
|
|
2969
|
+
] }) : A === 0 ? /* @__PURE__ */ s("span", { children: [
|
|
2970
|
+
"No ",
|
|
2971
|
+
C,
|
|
2972
|
+
" yet"
|
|
2973
|
+
] }) : /* @__PURE__ */ s(R, { children: [
|
|
2974
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-foreground/80", children: [
|
|
2975
|
+
A,
|
|
2976
|
+
" ",
|
|
2977
|
+
b
|
|
2978
|
+
] }),
|
|
2979
|
+
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
2980
|
+
/* @__PURE__ */ s("span", { children: [
|
|
2981
|
+
O,
|
|
2982
|
+
" active"
|
|
2983
|
+
] })
|
|
2984
|
+
] }) })
|
|
2985
|
+
] }),
|
|
2986
|
+
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
2987
|
+
i ? (
|
|
2988
|
+
// Auto-refresh on open; surface a quiet spinner near the count
|
|
2989
|
+
// when a manual reload is in flight, but don't show a separate
|
|
2990
|
+
// refresh button — close+reopen handles the rare "stale list"
|
|
2991
|
+
// case without crowding the toolbar.
|
|
2992
|
+
/* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground" })
|
|
2993
|
+
) : null,
|
|
2994
|
+
A > 0 && u ? m && h ? /* @__PURE__ */ s(Ve, { children: [
|
|
2995
|
+
/* @__PURE__ */ t(Be, { asChild: !0, children: /* @__PURE__ */ s("button", { className: je, children: [
|
|
2996
|
+
/* @__PURE__ */ t(ve, { className: "h-3 w-3" }),
|
|
2997
|
+
" New"
|
|
2998
|
+
] }) }),
|
|
2999
|
+
/* @__PURE__ */ s(Pe, { align: "end", children: [
|
|
3000
|
+
/* @__PURE__ */ t(G, { onClick: () => l("scheduled_report"), children: "Schedule a report" }),
|
|
3001
|
+
/* @__PURE__ */ t(
|
|
3002
|
+
G,
|
|
3003
|
+
{
|
|
3004
|
+
onClick: () => l("analytical_briefing"),
|
|
3005
|
+
children: "Create analytical briefing"
|
|
3006
|
+
}
|
|
3007
|
+
)
|
|
3008
|
+
] })
|
|
3009
|
+
] }) : h ? /* @__PURE__ */ s(
|
|
3010
|
+
"button",
|
|
3011
|
+
{
|
|
3012
|
+
onClick: () => l("scheduled_report"),
|
|
3013
|
+
className: je,
|
|
3014
|
+
children: [
|
|
3015
|
+
/* @__PURE__ */ t(ve, { className: "h-3 w-3" }),
|
|
3016
|
+
" Schedule report"
|
|
3017
|
+
]
|
|
3018
|
+
}
|
|
3019
|
+
) : m ? /* @__PURE__ */ s(
|
|
3020
|
+
"button",
|
|
3021
|
+
{
|
|
3022
|
+
onClick: () => l("analytical_briefing"),
|
|
3023
|
+
className: je,
|
|
3024
|
+
children: [
|
|
3025
|
+
/* @__PURE__ */ t(ve, { className: "h-3 w-3" }),
|
|
3026
|
+
" New briefing"
|
|
3027
|
+
]
|
|
3028
|
+
}
|
|
3029
|
+
) : null : null
|
|
3030
|
+
] })
|
|
3031
|
+
] }),
|
|
3032
|
+
F ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 border-b border-border bg-muted/60 px-4 py-2 text-[12px]", children: [
|
|
3033
|
+
/* @__PURE__ */ t(re, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground" }),
|
|
3034
|
+
/* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: F.name }),
|
|
3035
|
+
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3036
|
+
/* @__PURE__ */ t("span", { className: "truncate text-muted-foreground", children: Jt(F) })
|
|
3037
|
+
] }) : null,
|
|
3038
|
+
/* @__PURE__ */ s("div", { className: "flex-1 overflow-y-auto", children: [
|
|
3039
|
+
n ? /* @__PURE__ */ t("div", { className: "m-4 rounded-card border border-destructive/30 bg-destructive/10 px-3 py-2 text-[12px] text-destructive", children: n }) : null,
|
|
3040
|
+
!i && e.length === 0 && !n ? /* @__PURE__ */ t(
|
|
3041
|
+
En,
|
|
3042
|
+
{
|
|
3043
|
+
onNew: l,
|
|
3044
|
+
canCreate: u,
|
|
3045
|
+
canCreateScheduledReport: h,
|
|
3046
|
+
analyticalBriefingsEnabled: m,
|
|
3047
|
+
contentKind: U
|
|
3048
|
+
}
|
|
3049
|
+
) : null,
|
|
3050
|
+
e.map((N) => /* @__PURE__ */ t(
|
|
3051
|
+
Tn,
|
|
3052
|
+
{
|
|
3053
|
+
briefing: N,
|
|
3054
|
+
isOpening: v === N.id,
|
|
3055
|
+
isBusy: k === N.id,
|
|
3056
|
+
onOpen: () => c(N.id),
|
|
3057
|
+
onRunNow: () => p(N),
|
|
3058
|
+
onTogglePause: () => f(N),
|
|
3059
|
+
onDelete: () => g(N)
|
|
3060
|
+
},
|
|
3061
|
+
N.id
|
|
3062
|
+
))
|
|
3063
|
+
] }),
|
|
3064
|
+
V ? /* @__PURE__ */ t("div", { className: "border-t border-border px-4 py-2.5", children: /* @__PURE__ */ s(
|
|
3065
|
+
"a",
|
|
3066
|
+
{
|
|
3067
|
+
href: V,
|
|
3068
|
+
className: J(Zt, "h-6 px-1 text-[11px]"),
|
|
3069
|
+
children: [
|
|
3070
|
+
"Manage all reports & briefings",
|
|
3071
|
+
/* @__PURE__ */ t(Mr, { className: "h-3 w-3" })
|
|
3072
|
+
]
|
|
3073
|
+
}
|
|
3074
|
+
) }) : null
|
|
3075
|
+
]
|
|
3076
|
+
}
|
|
3077
|
+
);
|
|
3078
|
+
}
|
|
3079
|
+
function En({
|
|
3080
|
+
onNew: e,
|
|
3081
|
+
canCreate: a,
|
|
3082
|
+
canCreateScheduledReport: o,
|
|
3083
|
+
analyticalBriefingsEnabled: n,
|
|
3084
|
+
contentKind: i
|
|
3085
|
+
}) {
|
|
3086
|
+
const r = i === "reports" ? {
|
|
3087
|
+
title: "No reports yet",
|
|
3088
|
+
description: "Schedule an emailed dashboard or visual report to see it here."
|
|
3089
|
+
} : i === "briefings" ? {
|
|
3090
|
+
title: "No briefings yet",
|
|
3091
|
+
description: "Create an analytical briefing to monitor this dashboard and brief your team."
|
|
3092
|
+
} : null;
|
|
3093
|
+
return /* @__PURE__ */ s("div", { className: "flex h-full flex-col items-center justify-center px-8 py-12 text-center", children: [
|
|
3094
|
+
/* @__PURE__ */ t(In, { className: "mb-5 h-[88px] w-[112px] text-border" }),
|
|
3095
|
+
/* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: (r == null ? void 0 : r.title) ?? "Have an analyst brief your team" }),
|
|
3096
|
+
/* @__PURE__ */ t("p", { className: "mt-1.5 max-w-[320px] text-[12px] leading-5 text-muted-foreground", children: (r == null ? void 0 : r.description) ?? "Describe what to watch. An analyst digs into this dashboard and the data behind it, then briefs your team on the cadence you choose." }),
|
|
3097
|
+
a ? /* @__PURE__ */ s("div", { className: "mt-4 flex flex-wrap justify-center gap-2", children: [
|
|
3098
|
+
o ? /* @__PURE__ */ s(
|
|
3099
|
+
"button",
|
|
3100
|
+
{
|
|
3101
|
+
onClick: () => e("scheduled_report"),
|
|
3102
|
+
className: je,
|
|
3103
|
+
children: [
|
|
3104
|
+
/* @__PURE__ */ t(ve, { className: "h-3 w-3" }),
|
|
3105
|
+
" Schedule a report"
|
|
3106
|
+
]
|
|
3107
|
+
}
|
|
3108
|
+
) : null,
|
|
3109
|
+
n ? /* @__PURE__ */ t(
|
|
3110
|
+
"button",
|
|
3111
|
+
{
|
|
3112
|
+
onClick: () => e("analytical_briefing"),
|
|
3113
|
+
className: Zt,
|
|
3114
|
+
children: "Create analytical briefing"
|
|
3115
|
+
}
|
|
3116
|
+
) : null
|
|
3117
|
+
] }) : null
|
|
3118
|
+
] });
|
|
3119
|
+
}
|
|
3120
|
+
function In({ className: e }) {
|
|
3121
|
+
return /* @__PURE__ */ s(
|
|
3122
|
+
"svg",
|
|
3123
|
+
{
|
|
3124
|
+
viewBox: "0 0 112 88",
|
|
3125
|
+
fill: "none",
|
|
3126
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3127
|
+
role: "presentation",
|
|
3128
|
+
"aria-hidden": "true",
|
|
3129
|
+
className: e,
|
|
3130
|
+
children: [
|
|
3131
|
+
/* @__PURE__ */ t(
|
|
3132
|
+
"rect",
|
|
3133
|
+
{
|
|
3134
|
+
x: "22",
|
|
3135
|
+
y: "6",
|
|
3136
|
+
width: "60",
|
|
3137
|
+
height: "72",
|
|
3138
|
+
rx: "3",
|
|
3139
|
+
stroke: "currentColor",
|
|
3140
|
+
strokeWidth: "1.25"
|
|
3141
|
+
}
|
|
3142
|
+
),
|
|
3143
|
+
/* @__PURE__ */ t(
|
|
3144
|
+
"line",
|
|
3145
|
+
{
|
|
3146
|
+
x1: "30",
|
|
3147
|
+
y1: "16",
|
|
3148
|
+
x2: "64",
|
|
3149
|
+
y2: "16",
|
|
3150
|
+
stroke: "currentColor",
|
|
3151
|
+
strokeWidth: "1.5",
|
|
3152
|
+
strokeLinecap: "round"
|
|
3153
|
+
}
|
|
3154
|
+
),
|
|
3155
|
+
/* @__PURE__ */ t(
|
|
3156
|
+
"line",
|
|
3157
|
+
{
|
|
3158
|
+
x1: "30",
|
|
3159
|
+
y1: "21",
|
|
3160
|
+
x2: "52",
|
|
3161
|
+
y2: "21",
|
|
3162
|
+
stroke: "currentColor",
|
|
3163
|
+
strokeWidth: "1",
|
|
3164
|
+
strokeLinecap: "round",
|
|
3165
|
+
opacity: "0.5"
|
|
3166
|
+
}
|
|
3167
|
+
),
|
|
3168
|
+
/* @__PURE__ */ t("circle", { cx: "31", cy: "32", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3169
|
+
/* @__PURE__ */ t(
|
|
3170
|
+
"line",
|
|
3171
|
+
{
|
|
3172
|
+
x1: "35",
|
|
3173
|
+
y1: "32",
|
|
3174
|
+
x2: "72",
|
|
3175
|
+
y2: "32",
|
|
3176
|
+
stroke: "currentColor",
|
|
3177
|
+
strokeWidth: "1",
|
|
3178
|
+
opacity: "0.4",
|
|
3179
|
+
strokeLinecap: "round"
|
|
3180
|
+
}
|
|
3181
|
+
),
|
|
3182
|
+
/* @__PURE__ */ t("circle", { cx: "31", cy: "38", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3183
|
+
/* @__PURE__ */ t(
|
|
3184
|
+
"line",
|
|
3185
|
+
{
|
|
3186
|
+
x1: "35",
|
|
3187
|
+
y1: "38",
|
|
3188
|
+
x2: "68",
|
|
3189
|
+
y2: "38",
|
|
3190
|
+
stroke: "currentColor",
|
|
3191
|
+
strokeWidth: "1",
|
|
3192
|
+
opacity: "0.4",
|
|
3193
|
+
strokeLinecap: "round"
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
/* @__PURE__ */ t("circle", { cx: "31", cy: "44", r: "1", fill: "currentColor", opacity: "0.6" }),
|
|
3197
|
+
/* @__PURE__ */ t(
|
|
3198
|
+
"line",
|
|
3199
|
+
{
|
|
3200
|
+
x1: "35",
|
|
3201
|
+
y1: "44",
|
|
3202
|
+
x2: "74",
|
|
3203
|
+
y2: "44",
|
|
3204
|
+
stroke: "currentColor",
|
|
3205
|
+
strokeWidth: "1",
|
|
3206
|
+
opacity: "0.4",
|
|
3207
|
+
strokeLinecap: "round"
|
|
3208
|
+
}
|
|
3209
|
+
),
|
|
3210
|
+
/* @__PURE__ */ t(
|
|
3211
|
+
"rect",
|
|
3212
|
+
{
|
|
3213
|
+
x: "30",
|
|
3214
|
+
y: "64",
|
|
3215
|
+
width: "5",
|
|
3216
|
+
height: "8",
|
|
3217
|
+
rx: "0.5",
|
|
3218
|
+
fill: "currentColor",
|
|
3219
|
+
opacity: "0.55"
|
|
3220
|
+
}
|
|
3221
|
+
),
|
|
3222
|
+
/* @__PURE__ */ t(
|
|
3223
|
+
"rect",
|
|
3224
|
+
{
|
|
3225
|
+
x: "38",
|
|
3226
|
+
y: "60",
|
|
3227
|
+
width: "5",
|
|
3228
|
+
height: "12",
|
|
3229
|
+
rx: "0.5",
|
|
3230
|
+
fill: "currentColor",
|
|
3231
|
+
opacity: "0.7"
|
|
3232
|
+
}
|
|
3233
|
+
),
|
|
3234
|
+
/* @__PURE__ */ t(
|
|
3235
|
+
"rect",
|
|
3236
|
+
{
|
|
3237
|
+
x: "46",
|
|
3238
|
+
y: "56",
|
|
3239
|
+
width: "5",
|
|
3240
|
+
height: "16",
|
|
3241
|
+
rx: "0.5",
|
|
3242
|
+
fill: "currentColor",
|
|
3243
|
+
opacity: "0.85"
|
|
3244
|
+
}
|
|
3245
|
+
),
|
|
3246
|
+
/* @__PURE__ */ t(
|
|
3247
|
+
"rect",
|
|
3248
|
+
{
|
|
3249
|
+
x: "54",
|
|
3250
|
+
y: "62",
|
|
3251
|
+
width: "5",
|
|
3252
|
+
height: "10",
|
|
3253
|
+
rx: "0.5",
|
|
3254
|
+
fill: "currentColor",
|
|
3255
|
+
opacity: "0.6"
|
|
3256
|
+
}
|
|
3257
|
+
),
|
|
3258
|
+
/* @__PURE__ */ t(
|
|
3259
|
+
"rect",
|
|
3260
|
+
{
|
|
3261
|
+
x: "62",
|
|
3262
|
+
y: "58",
|
|
3263
|
+
width: "5",
|
|
3264
|
+
height: "14",
|
|
3265
|
+
rx: "0.5",
|
|
3266
|
+
fill: "currentColor",
|
|
3267
|
+
opacity: "0.75"
|
|
3268
|
+
}
|
|
3269
|
+
),
|
|
3270
|
+
/* @__PURE__ */ t(
|
|
3271
|
+
"circle",
|
|
3272
|
+
{
|
|
3273
|
+
cx: "86",
|
|
3274
|
+
cy: "62",
|
|
3275
|
+
r: "10",
|
|
3276
|
+
fill: "var(--background, white)",
|
|
3277
|
+
stroke: "currentColor",
|
|
3278
|
+
strokeWidth: "1.25"
|
|
3279
|
+
}
|
|
3280
|
+
),
|
|
3281
|
+
/* @__PURE__ */ t(
|
|
3282
|
+
"line",
|
|
3283
|
+
{
|
|
3284
|
+
x1: "93.5",
|
|
3285
|
+
y1: "69.5",
|
|
3286
|
+
x2: "100",
|
|
3287
|
+
y2: "76",
|
|
3288
|
+
stroke: "currentColor",
|
|
3289
|
+
strokeWidth: "1.5",
|
|
3290
|
+
strokeLinecap: "round"
|
|
3291
|
+
}
|
|
3292
|
+
)
|
|
3293
|
+
]
|
|
3294
|
+
}
|
|
3295
|
+
);
|
|
3296
|
+
}
|
|
3297
|
+
function Tn({
|
|
3298
|
+
briefing: e,
|
|
3299
|
+
isOpening: a,
|
|
3300
|
+
isBusy: o,
|
|
3301
|
+
onOpen: n,
|
|
3302
|
+
onRunNow: i,
|
|
3303
|
+
onTogglePause: r,
|
|
3304
|
+
onDelete: d
|
|
3305
|
+
}) {
|
|
3306
|
+
const c = e.status === "PAUSED", l = e.hasActiveRun, u = kn(e), h = Nn(e.lastRunAt), m = e.lastRunStatus, p = le(e), f = m === "SUCCESS" ? ze.success.dot : m === "FAILED" ? ze.danger.dot : m ? ze.warning.dot : ze.neutral.dot;
|
|
3307
|
+
return /* @__PURE__ */ s(
|
|
3308
|
+
"div",
|
|
3309
|
+
{
|
|
3310
|
+
className: J(
|
|
3311
|
+
"group relative border-b border-border/60 px-4 py-3 transition-colors hover:bg-muted/60",
|
|
3312
|
+
c && "opacity-70"
|
|
3313
|
+
),
|
|
3314
|
+
children: [
|
|
3315
|
+
/* @__PURE__ */ s(
|
|
3316
|
+
"div",
|
|
3317
|
+
{
|
|
3318
|
+
role: "button",
|
|
3319
|
+
tabIndex: 0,
|
|
3320
|
+
onClick: n,
|
|
3321
|
+
onKeyDown: (g) => {
|
|
3322
|
+
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), n());
|
|
3323
|
+
},
|
|
3324
|
+
className: "cursor-pointer pr-8",
|
|
3325
|
+
children: [
|
|
3326
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3327
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.name }),
|
|
3328
|
+
c ? /* @__PURE__ */ t("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: "· Paused" }) : null
|
|
3329
|
+
] }),
|
|
3330
|
+
/* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-x-1.5 text-[11px] text-muted-foreground", children: [
|
|
3331
|
+
/* @__PURE__ */ t("span", { children: p.typeLabel }),
|
|
3332
|
+
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3333
|
+
/* @__PURE__ */ t("span", { children: Dn(e) }),
|
|
3334
|
+
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3335
|
+
/* @__PURE__ */ t(Ha, { className: "h-3 w-3" }),
|
|
3336
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: Sn(e) }),
|
|
3337
|
+
e.lastRunAt ? /* @__PURE__ */ s(R, { children: [
|
|
3338
|
+
/* @__PURE__ */ t("span", { className: "text-border", children: "·" }),
|
|
3339
|
+
/* @__PURE__ */ s("span", { children: [
|
|
3340
|
+
"Last run ",
|
|
3341
|
+
h
|
|
3342
|
+
] })
|
|
3343
|
+
] }) : null
|
|
3344
|
+
] }),
|
|
3345
|
+
u || l ? /* @__PURE__ */ s("div", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] leading-[1.5] text-foreground/80", children: [
|
|
3346
|
+
l ? /* @__PURE__ */ t(re, { className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ t(
|
|
3347
|
+
"span",
|
|
3348
|
+
{
|
|
3349
|
+
className: J(
|
|
3350
|
+
"inline-block h-1.5 w-1.5 shrink-0 rounded-full",
|
|
3351
|
+
f
|
|
3352
|
+
)
|
|
3353
|
+
}
|
|
3354
|
+
),
|
|
3355
|
+
/* @__PURE__ */ t("span", { className: "truncate", children: l ? Jt(e) : u })
|
|
3356
|
+
] }) : null
|
|
3357
|
+
]
|
|
3358
|
+
}
|
|
3359
|
+
),
|
|
3360
|
+
/* @__PURE__ */ t("div", { className: "absolute right-3 top-3", children: o ? /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : a ? /* @__PURE__ */ t(re, { className: "h-3.5 w-3.5 animate-spin text-muted-foreground/70" }) : /* @__PURE__ */ s(Ve, { children: [
|
|
3361
|
+
/* @__PURE__ */ t(Be, { asChild: !0, children: /* @__PURE__ */ t(
|
|
3362
|
+
"button",
|
|
3363
|
+
{
|
|
3364
|
+
type: "button",
|
|
3365
|
+
onClick: (g) => g.stopPropagation(),
|
|
3366
|
+
className: "inline-flex h-6 w-6 items-center justify-center rounded-control text-muted-foreground/70 opacity-60 hover:bg-muted hover:text-foreground/80 focus-visible:opacity-100 group-hover:opacity-100",
|
|
3367
|
+
"aria-label": `${p.noun === "report" ? "Report" : "Briefing"} actions`,
|
|
3368
|
+
children: /* @__PURE__ */ t(Ut, { className: "h-3.5 w-3.5" })
|
|
3369
|
+
}
|
|
3370
|
+
) }),
|
|
3371
|
+
/* @__PURE__ */ s(Pe, { align: "end", className: "w-44", children: [
|
|
3372
|
+
/* @__PURE__ */ s(G, { onClick: n, children: [
|
|
3373
|
+
/* @__PURE__ */ t(_t, { className: "h-3.5 w-3.5" }),
|
|
3374
|
+
"Edit ",
|
|
3375
|
+
p.noun
|
|
3376
|
+
] }),
|
|
3377
|
+
/* @__PURE__ */ s(
|
|
3378
|
+
G,
|
|
3379
|
+
{
|
|
3380
|
+
onClick: (g) => {
|
|
3381
|
+
g.preventDefault(), i();
|
|
3382
|
+
},
|
|
3383
|
+
children: [
|
|
3384
|
+
/* @__PURE__ */ t(Qa, { className: "h-3.5 w-3.5" }),
|
|
3385
|
+
"Run now"
|
|
3386
|
+
]
|
|
3387
|
+
}
|
|
3388
|
+
),
|
|
3389
|
+
e.scheduleExpr ? /* @__PURE__ */ t(
|
|
3390
|
+
G,
|
|
3391
|
+
{
|
|
3392
|
+
onClick: (g) => {
|
|
3393
|
+
g.preventDefault(), r();
|
|
3394
|
+
},
|
|
3395
|
+
children: c ? /* @__PURE__ */ s(R, { children: [
|
|
3396
|
+
/* @__PURE__ */ t(Ka, { className: "h-3.5 w-3.5" }),
|
|
3397
|
+
"Resume"
|
|
3398
|
+
] }) : /* @__PURE__ */ s(R, { children: [
|
|
3399
|
+
/* @__PURE__ */ t(Ga, { className: "h-3.5 w-3.5" }),
|
|
3400
|
+
"Pause"
|
|
3401
|
+
] })
|
|
3402
|
+
}
|
|
3403
|
+
) : null,
|
|
3404
|
+
/* @__PURE__ */ t(We, {}),
|
|
3405
|
+
/* @__PURE__ */ s(
|
|
3406
|
+
G,
|
|
3407
|
+
{
|
|
3408
|
+
onClick: (g) => {
|
|
3409
|
+
g.preventDefault(), d();
|
|
3410
|
+
},
|
|
3411
|
+
className: "text-destructive focus:bg-destructive/10 focus:text-destructive",
|
|
3412
|
+
children: [
|
|
3413
|
+
/* @__PURE__ */ t($e, { className: "h-3.5 w-3.5" }),
|
|
3414
|
+
"Delete ",
|
|
3415
|
+
p.noun
|
|
3416
|
+
]
|
|
3417
|
+
}
|
|
3418
|
+
)
|
|
3419
|
+
] })
|
|
3420
|
+
] }) })
|
|
3421
|
+
]
|
|
3422
|
+
}
|
|
3423
|
+
);
|
|
3424
|
+
}
|
|
3425
|
+
function Ln(e) {
|
|
3426
|
+
return (e == null ? void 0 : e.trim()) || "This dashboard";
|
|
3427
|
+
}
|
|
3428
|
+
function Vn(e) {
|
|
3429
|
+
return e === "This dashboard" ? "Watch this dashboard" : `Watch ${e}`;
|
|
3430
|
+
}
|
|
3431
|
+
function Bn(e, a, o) {
|
|
3432
|
+
return a !== "dashboard" ? e : e.filter(
|
|
3433
|
+
(n) => n.source.type === "dashboard" && n.source.dashboardId === o
|
|
3434
|
+
);
|
|
3435
|
+
}
|
|
3436
|
+
async function Pn(e) {
|
|
3437
|
+
const o = [];
|
|
3438
|
+
let n = 1, i = 0, r = Number.POSITIVE_INFINITY;
|
|
3439
|
+
for (; i < r; ) {
|
|
3440
|
+
const d = await e.apiClient.listBriefings(
|
|
3441
|
+
e.apiServiceUrl,
|
|
3442
|
+
e.token,
|
|
3443
|
+
{ scope: "organization", page: n, pageSize: 100 }
|
|
3444
|
+
);
|
|
3445
|
+
if (o.push(...d.briefings), i += d.briefings.length, r = d.total, d.briefings.length === 0 || i >= r) break;
|
|
3446
|
+
n += 1;
|
|
3447
|
+
}
|
|
3448
|
+
return o;
|
|
3449
|
+
}
|
|
3450
|
+
const Mn = {
|
|
3451
|
+
listBriefings: nr,
|
|
3452
|
+
getBriefing: rr,
|
|
3453
|
+
pauseBriefing: ar,
|
|
3454
|
+
resumeBriefing: tr,
|
|
3455
|
+
deleteBriefing: er,
|
|
3456
|
+
runBriefingNow: Ja
|
|
3457
|
+
};
|
|
3458
|
+
function Ds(e) {
|
|
3459
|
+
return /* @__PURE__ */ t(Xa, { authToken: e.token ? { accessToken: e.token } : void 0, children: /* @__PURE__ */ t(Ya, { children: /* @__PURE__ */ t(Un, { ...e }) }) });
|
|
3460
|
+
}
|
|
3461
|
+
function Un({
|
|
3462
|
+
dashboardId: e,
|
|
3463
|
+
dashboardTitle: a,
|
|
3464
|
+
apiServiceUrl: o,
|
|
3465
|
+
token: n,
|
|
3466
|
+
disabled: i,
|
|
3467
|
+
className: r,
|
|
3468
|
+
manageBriefingsHref: d,
|
|
3469
|
+
open: c,
|
|
3470
|
+
onOpenChange: l,
|
|
3471
|
+
hideTrigger: u = !1,
|
|
3472
|
+
workflowIntent: h,
|
|
3473
|
+
openRun: m,
|
|
3474
|
+
client: p
|
|
3475
|
+
}) {
|
|
3476
|
+
const { authToken: f, tokenProps: g } = it(), v = Za(), k = !h || v.canCreate && (h === "scheduled_report" || v.analyticalBriefingsEnabled), [V, U] = S(!1), M = c ?? V, A = (y) => {
|
|
3477
|
+
c === void 0 && U(y), l == null || l(y);
|
|
3478
|
+
}, [O, b] = S(
|
|
3479
|
+
h ? "author" : "list"
|
|
3480
|
+
), [F, C] = S(
|
|
3481
|
+
h ?? "analytical_briefing"
|
|
3482
|
+
), [D, N] = S("dashboard"), [j, T] = S(
|
|
3483
|
+
[]
|
|
3484
|
+
), [z, X] = S(null), L = h && !k && !z ? "list" : O, [ae, Y] = S(!1), [H, he] = S(null), [ge, Q] = S(null), [_, oe] = S(
|
|
3485
|
+
null
|
|
3486
|
+
), [me, pe] = S(null), Ce = nt(null), Me = nt(M);
|
|
3487
|
+
xe(() => {
|
|
3488
|
+
const y = M && !Me.current;
|
|
3489
|
+
Me.current = M, !(!y || !h) && (X(null), N("dashboard"), C(h), b("author"), pe(null));
|
|
3490
|
+
}, [M, h]);
|
|
3491
|
+
const Ye = yt(), $ = o ?? (g == null ? void 0 : g.apiServiceUrl), W = n ?? (f == null ? void 0 : f.accessToken), ne = te(() => ({ ...Mn, ...p }), [p]), [we, Ze] = S(null);
|
|
3492
|
+
xe(() => {
|
|
3493
|
+
if (!m || !$ || !W) return;
|
|
3494
|
+
let y = !0;
|
|
3495
|
+
return ne.getBriefing($, W, m.briefingId).then(({ briefing: P }) => {
|
|
3496
|
+
y && (X(P), Ze(m), b("author"));
|
|
3497
|
+
}, (P) => {
|
|
3498
|
+
y && E.error(P instanceof Error ? P.message : "Could not open the run.");
|
|
3499
|
+
}), () => {
|
|
3500
|
+
y = !1;
|
|
3501
|
+
};
|
|
3502
|
+
}, [m, $, W, ne]);
|
|
3503
|
+
const be = Ln(a), Ue = te(() => {
|
|
3504
|
+
const y = Bn(
|
|
3505
|
+
j,
|
|
3506
|
+
D,
|
|
3507
|
+
e
|
|
3508
|
+
);
|
|
3509
|
+
if (!h)
|
|
3510
|
+
return y;
|
|
3511
|
+
const P = h === "scheduled_report" ? "report" : "briefing";
|
|
3512
|
+
return y.filter(
|
|
3513
|
+
(Oe) => le(Oe).noun === P
|
|
3514
|
+
);
|
|
3515
|
+
}, [e, j, D, h]), Je = te(() => D === "dashboard" ? {
|
|
3516
|
+
source: { type: "dashboard", dashboardId: e },
|
|
3517
|
+
label: be,
|
|
3518
|
+
detail: Vn(be)
|
|
3519
|
+
} : {
|
|
3520
|
+
source: { type: "project" },
|
|
3521
|
+
label: "This project",
|
|
3522
|
+
detail: "Use any data in this project."
|
|
3523
|
+
}, [e, be, D]), Ne = !!($ && W), Se = Pr({
|
|
3524
|
+
canCreate: v.canCreate,
|
|
3525
|
+
analyticalBriefingsEnabled: v.analyticalBriefingsEnabled,
|
|
3526
|
+
scheduledReportAvailable: D === "dashboard"
|
|
3527
|
+
}), se = Z(async () => {
|
|
3528
|
+
if (!(!$ || !W)) {
|
|
3529
|
+
Y(!0), pe(null);
|
|
3530
|
+
try {
|
|
3531
|
+
T(
|
|
3532
|
+
await Pn({
|
|
3533
|
+
apiClient: ne,
|
|
3534
|
+
apiServiceUrl: $,
|
|
3535
|
+
token: W
|
|
3536
|
+
})
|
|
3537
|
+
);
|
|
3538
|
+
} catch (y) {
|
|
3539
|
+
pe(
|
|
3540
|
+
y instanceof Error ? y.message : "Could not load briefings."
|
|
3541
|
+
);
|
|
3542
|
+
} finally {
|
|
3543
|
+
Y(!1);
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
}, [ne, $, W]);
|
|
3547
|
+
xe(() => {
|
|
3548
|
+
!M || L !== "list" || !Ne || se();
|
|
3549
|
+
}, [Ne, L, se, M]);
|
|
3550
|
+
const ke = () => {
|
|
3551
|
+
X(null), N("dashboard"), b("list"), A(!0);
|
|
3552
|
+
}, x = (y) => {
|
|
3553
|
+
X(null), C(y), b("author");
|
|
3554
|
+
}, B = async (y) => {
|
|
3555
|
+
if (!(!$ || !W)) {
|
|
3556
|
+
he(y), pe(null);
|
|
3557
|
+
try {
|
|
3558
|
+
const P = await ne.getBriefing(
|
|
3559
|
+
$,
|
|
3560
|
+
W,
|
|
3561
|
+
y
|
|
3562
|
+
);
|
|
3563
|
+
X(P.briefing), b("author");
|
|
3564
|
+
} catch (P) {
|
|
3565
|
+
pe(
|
|
3566
|
+
P instanceof Error ? P.message : "Could not open briefing."
|
|
3567
|
+
);
|
|
3568
|
+
} finally {
|
|
3569
|
+
he(null);
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
}, q = async (y) => {
|
|
3573
|
+
if (!(!$ || !W)) {
|
|
3574
|
+
Q(y.id);
|
|
3575
|
+
try {
|
|
3576
|
+
const P = await ne.runBriefingNow(
|
|
3577
|
+
$,
|
|
3578
|
+
W,
|
|
3579
|
+
y.id,
|
|
3580
|
+
{ requestId: On() }
|
|
3581
|
+
);
|
|
3582
|
+
Ye.track({ kind: "briefing", id: P.run.id, title: y.name, briefingId: y.id }), se();
|
|
3583
|
+
} catch (P) {
|
|
3584
|
+
E.error(
|
|
3585
|
+
P instanceof Error ? P.message : "Could not start the run."
|
|
3586
|
+
);
|
|
3587
|
+
} finally {
|
|
3588
|
+
Q(null);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
}, ie = async (y) => {
|
|
3592
|
+
if (!$ || !W) return;
|
|
3593
|
+
const { noun: P } = le(y), Oe = P === "report" ? "Report" : "Briefing";
|
|
3594
|
+
Q(y.id);
|
|
3595
|
+
try {
|
|
3596
|
+
const Re = y.status === "PAUSED" ? await ne.resumeBriefing(
|
|
3597
|
+
$,
|
|
3598
|
+
W,
|
|
3599
|
+
y.id
|
|
3600
|
+
) : await ne.pauseBriefing(
|
|
3601
|
+
$,
|
|
3602
|
+
W,
|
|
3603
|
+
y.id
|
|
3604
|
+
);
|
|
3605
|
+
E.success(
|
|
3606
|
+
Re.briefing.status === "PAUSED" ? `${Oe} paused` : `${Oe} resumed`
|
|
3607
|
+
), se();
|
|
3608
|
+
} catch (Re) {
|
|
3609
|
+
E.error(
|
|
3610
|
+
Re instanceof Error ? Re.message : `Could not update the ${P} status.`
|
|
3611
|
+
);
|
|
3612
|
+
} finally {
|
|
3613
|
+
Q(null);
|
|
3614
|
+
}
|
|
3615
|
+
}, ue = async () => {
|
|
3616
|
+
if (!_ || !$ || !W) return;
|
|
3617
|
+
const y = _;
|
|
3618
|
+
Q(y.id);
|
|
3619
|
+
try {
|
|
3620
|
+
await ne.deleteBriefing(
|
|
3621
|
+
$,
|
|
3622
|
+
W,
|
|
3623
|
+
y.id
|
|
3624
|
+
);
|
|
3625
|
+
const { noun: P } = le(y);
|
|
3626
|
+
E.success(`${P === "report" ? "Report" : "Briefing"} deleted`), oe(null), se();
|
|
3627
|
+
} catch (P) {
|
|
3628
|
+
E.error(
|
|
3629
|
+
P instanceof Error ? P.message : "Could not delete the briefing."
|
|
3630
|
+
);
|
|
3631
|
+
} finally {
|
|
3632
|
+
Q(null);
|
|
3633
|
+
}
|
|
3634
|
+
}, ea = Ue.length;
|
|
3635
|
+
return v.surfaceVisible ? /* @__PURE__ */ s(sr, { open: M, onOpenChange: A, children: [
|
|
3636
|
+
u ? null : /* @__PURE__ */ t(
|
|
3637
|
+
yn,
|
|
3638
|
+
{
|
|
3639
|
+
disabled: i || !Ne,
|
|
3640
|
+
briefingCount: ea,
|
|
3641
|
+
className: r,
|
|
3642
|
+
onClick: ke
|
|
3643
|
+
}
|
|
3644
|
+
),
|
|
3645
|
+
/* @__PURE__ */ s(
|
|
3646
|
+
or,
|
|
3647
|
+
{
|
|
3648
|
+
ref: Ce,
|
|
3649
|
+
side: "right",
|
|
3650
|
+
hideClose: !0,
|
|
3651
|
+
className: "flex h-full w-full flex-col overflow-hidden p-0 outline-none sm:max-w-[560px]",
|
|
3652
|
+
onOpenAutoFocus: (y) => {
|
|
3653
|
+
var P;
|
|
3654
|
+
y.preventDefault(), (P = Ce.current) == null || P.focus({ preventScroll: !0 });
|
|
3655
|
+
},
|
|
3656
|
+
children: [
|
|
3657
|
+
/* @__PURE__ */ s(ir, { className: "sr-only", children: [
|
|
3658
|
+
/* @__PURE__ */ t(lr, { children: "Reports & briefings" }),
|
|
3659
|
+
/* @__PURE__ */ t(dr, { children: "Manage reports and briefings for this dashboard." })
|
|
3660
|
+
] }),
|
|
3661
|
+
h ? /* @__PURE__ */ s("div", { className: "flex shrink-0 items-start justify-between gap-3 border-b border-border pl-4 pr-3 pt-2", children: [
|
|
3662
|
+
/* @__PURE__ */ s(
|
|
3663
|
+
"div",
|
|
3664
|
+
{
|
|
3665
|
+
className: "flex items-center gap-5",
|
|
3666
|
+
role: "tablist",
|
|
3667
|
+
"aria-label": h === "scheduled_report" ? "Email report workflow" : "Analytical briefing workflow",
|
|
3668
|
+
children: [
|
|
3669
|
+
/* @__PURE__ */ t(
|
|
3670
|
+
"button",
|
|
3671
|
+
{
|
|
3672
|
+
type: "button",
|
|
3673
|
+
role: "tab",
|
|
3674
|
+
"aria-selected": L === "author",
|
|
3675
|
+
disabled: !k,
|
|
3676
|
+
className: J(
|
|
3677
|
+
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3678
|
+
L === "author" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground",
|
|
3679
|
+
!k && "cursor-not-allowed opacity-50"
|
|
3680
|
+
),
|
|
3681
|
+
onClick: () => {
|
|
3682
|
+
k && (X(null), C(h), N("dashboard"), b("author"));
|
|
3683
|
+
},
|
|
3684
|
+
children: z ? `Edit ${le(z).noun}` : h === "scheduled_report" ? "Schedule report" : "Create briefing"
|
|
3685
|
+
}
|
|
3686
|
+
),
|
|
3687
|
+
/* @__PURE__ */ t(
|
|
3688
|
+
"button",
|
|
3689
|
+
{
|
|
3690
|
+
type: "button",
|
|
3691
|
+
role: "tab",
|
|
3692
|
+
"aria-selected": L === "list",
|
|
3693
|
+
className: J(
|
|
3694
|
+
"-mb-px border-b-2 px-0.5 pb-2 text-[12px] transition-colors",
|
|
3695
|
+
L === "list" ? "border-foreground font-medium text-foreground" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
3696
|
+
),
|
|
3697
|
+
onClick: () => b("list"),
|
|
3698
|
+
children: h === "scheduled_report" ? "Manage reports" : "Manage briefings"
|
|
3699
|
+
}
|
|
3700
|
+
)
|
|
3701
|
+
]
|
|
3702
|
+
}
|
|
3703
|
+
),
|
|
3704
|
+
/* @__PURE__ */ t(
|
|
3705
|
+
"button",
|
|
3706
|
+
{
|
|
3707
|
+
type: "button",
|
|
3708
|
+
onClick: () => A(!1),
|
|
3709
|
+
className: "rounded-control p-1 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3710
|
+
"aria-label": h === "scheduled_report" ? "Close email report workflow" : "Close analytical briefing workflow",
|
|
3711
|
+
children: /* @__PURE__ */ t(Xe, { className: "h-3.5 w-3.5" })
|
|
3712
|
+
}
|
|
3713
|
+
)
|
|
3714
|
+
] }) : null,
|
|
3715
|
+
L === "list" ? /* @__PURE__ */ t(
|
|
3716
|
+
Fn,
|
|
3717
|
+
{
|
|
3718
|
+
briefings: Ue,
|
|
3719
|
+
dashboardLabel: be,
|
|
3720
|
+
sourceView: D,
|
|
3721
|
+
error: me,
|
|
3722
|
+
loading: ae,
|
|
3723
|
+
onSourceViewChange: N,
|
|
3724
|
+
onClose: () => A(!1),
|
|
3725
|
+
onEdit: (y) => {
|
|
3726
|
+
B(y);
|
|
3727
|
+
},
|
|
3728
|
+
onNew: x,
|
|
3729
|
+
canCreate: !h && Se.length > 0,
|
|
3730
|
+
canCreateScheduledReport: Se.includes(
|
|
3731
|
+
"scheduled_report"
|
|
3732
|
+
),
|
|
3733
|
+
analyticalBriefingsEnabled: Se.includes(
|
|
3734
|
+
"analytical_briefing"
|
|
3735
|
+
),
|
|
3736
|
+
onRunNow: (y) => {
|
|
3737
|
+
q(y);
|
|
3738
|
+
},
|
|
3739
|
+
onTogglePause: (y) => {
|
|
3740
|
+
ie(y);
|
|
3741
|
+
},
|
|
3742
|
+
onDelete: (y) => oe(y),
|
|
3743
|
+
selectingId: H,
|
|
3744
|
+
busyId: ge,
|
|
3745
|
+
manageBriefingsHref: d,
|
|
3746
|
+
contentKind: h === "scheduled_report" ? "reports" : h === "analytical_briefing" ? "briefings" : void 0,
|
|
3747
|
+
hideHeader: !!h
|
|
3748
|
+
}
|
|
3749
|
+
) : /* @__PURE__ */ t(
|
|
3750
|
+
cr,
|
|
3751
|
+
{
|
|
3752
|
+
apiServiceUrl: $,
|
|
3753
|
+
token: W,
|
|
3754
|
+
briefing: z,
|
|
3755
|
+
initialRunId: we && (z == null ? void 0 : z.id) === we.briefingId ? we.runId : void 0,
|
|
3756
|
+
intent: F,
|
|
3757
|
+
sourceContext: z ? void 0 : Je,
|
|
3758
|
+
title: z ? `Edit ${le(z).noun}` : F === "scheduled_report" ? "Schedule report" : "Create analytical briefing",
|
|
3759
|
+
hideHeader: !!h,
|
|
3760
|
+
className: "h-full min-h-0 max-w-none border-0 shadow-none",
|
|
3761
|
+
onBack: h ? void 0 : () => b("list"),
|
|
3762
|
+
onCancel: () => A(!1),
|
|
3763
|
+
onDeleted: () => {
|
|
3764
|
+
const y = z ? le(z).noun : "briefing";
|
|
3765
|
+
E.success(`${y === "report" ? "Report" : "Briefing"} deleted`), X(null), b("list"), se();
|
|
3766
|
+
},
|
|
3767
|
+
onRunStarted: () => {
|
|
3768
|
+
},
|
|
3769
|
+
onSaved: (y) => {
|
|
3770
|
+
X(y), se();
|
|
3771
|
+
},
|
|
3772
|
+
onMinimizeRun: () => {
|
|
3773
|
+
A(!1);
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
)
|
|
3777
|
+
]
|
|
3778
|
+
}
|
|
3779
|
+
),
|
|
3780
|
+
/* @__PURE__ */ t(
|
|
3781
|
+
dt,
|
|
3782
|
+
{
|
|
3783
|
+
open: !!_,
|
|
3784
|
+
onOpenChange: (y) => {
|
|
3785
|
+
y || oe(null);
|
|
3786
|
+
},
|
|
3787
|
+
children: /* @__PURE__ */ s(ct, { children: [
|
|
3788
|
+
/* @__PURE__ */ s(ut, { children: [
|
|
3789
|
+
/* @__PURE__ */ s(ht, { children: [
|
|
3790
|
+
"Delete",
|
|
3791
|
+
" ",
|
|
3792
|
+
_ ? le(_).noun : "briefing",
|
|
3793
|
+
"?"
|
|
3794
|
+
] }),
|
|
3795
|
+
/* @__PURE__ */ s(mt, { children: [
|
|
3796
|
+
"This permanently deletes ",
|
|
3797
|
+
/* @__PURE__ */ t("strong", { children: _ == null ? void 0 : _.name }),
|
|
3798
|
+
". Recipients will stop receiving it."
|
|
3799
|
+
] })
|
|
3800
|
+
] }),
|
|
3801
|
+
/* @__PURE__ */ s(pt, { children: [
|
|
3802
|
+
/* @__PURE__ */ t(ft, { children: "Cancel" }),
|
|
3803
|
+
/* @__PURE__ */ s(
|
|
3804
|
+
Mt,
|
|
3805
|
+
{
|
|
3806
|
+
className: "bg-destructive/90 hover:bg-destructive",
|
|
3807
|
+
onClick: ue,
|
|
3808
|
+
children: [
|
|
3809
|
+
"Delete",
|
|
3810
|
+
" ",
|
|
3811
|
+
_ ? le(_).noun : "briefing"
|
|
3812
|
+
]
|
|
3813
|
+
}
|
|
3814
|
+
)
|
|
3815
|
+
] })
|
|
3816
|
+
] })
|
|
3817
|
+
}
|
|
3818
|
+
)
|
|
3819
|
+
] }) : null;
|
|
3820
|
+
}
|
|
3821
|
+
function On() {
|
|
3822
|
+
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : `briefing-run-now-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3823
|
+
}
|
|
3824
|
+
export {
|
|
3825
|
+
fs as A,
|
|
3826
|
+
xs as D,
|
|
3827
|
+
bs as S,
|
|
3828
|
+
ys as T,
|
|
3829
|
+
ws as U,
|
|
3830
|
+
hs as V,
|
|
3831
|
+
yn as W,
|
|
3832
|
+
ps as a,
|
|
3833
|
+
gs as b,
|
|
3834
|
+
vs as c,
|
|
3835
|
+
Cs as d,
|
|
3836
|
+
Ss as e,
|
|
3837
|
+
ln as f,
|
|
3838
|
+
cn as g,
|
|
3839
|
+
fn as h,
|
|
3840
|
+
Ns as i,
|
|
3841
|
+
ks as j,
|
|
3842
|
+
Ds as k,
|
|
3843
|
+
ms as u
|
|
3844
|
+
};
|