react-semaphor 0.1.563 → 0.1.565

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