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