react-semaphor 0.1.313 → 0.1.315

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 (37) hide show
  1. package/dist/brand-studio/index.js +4 -4
  2. package/dist/chunks/{braces-raPCNcS4.js → braces-CWi8x9ww.js} +1 -1
  3. package/dist/chunks/calendar-preferences-dialog-B3JYKgek.js +456 -0
  4. package/dist/chunks/calendar-preferences-dialog-aODuCeYE.js +1 -0
  5. package/dist/chunks/{chevrons-up-down-BYzO4q5w.js → chevrons-up-down-B2viXO2I.js} +1 -1
  6. package/dist/chunks/dashboard-controls-CSunAZVx.js +57 -0
  7. package/dist/chunks/{dashboard-controls-DMsmUQkB.js → dashboard-controls-jvJF-AJC.js} +501 -523
  8. package/dist/chunks/{dashboard-filter-controls-launcher-DBmNn4EY.js → dashboard-filter-controls-launcher-B0i9xSZZ.js} +1 -1
  9. package/dist/chunks/{dashboard-filter-controls-launcher-CqXgWEa1.js → dashboard-filter-controls-launcher-DG6yRPmx.js} +39 -39
  10. package/dist/chunks/{dashboard-json-DMFZLkws.js → dashboard-json-Duea3KSa.js} +1 -1
  11. package/dist/chunks/{dashboard-json-CHoCrAp0.js → dashboard-json-zKDTezgS.js} +2 -2
  12. package/dist/chunks/{edit-dashboard-visual-B0Ae_O25.js → edit-dashboard-visual-MZCJaPiq.js} +419 -419
  13. package/dist/chunks/{edit-dashboard-visual-CIP9G-Bu.js → edit-dashboard-visual-QjRIAadP.js} +1 -1
  14. package/dist/chunks/{index-DjZqoaV5.js → index-B7C8qBWC.js} +193 -193
  15. package/dist/chunks/{index-D7e2Eyp_.js → index-CjRLHvSp.js} +17676 -17583
  16. package/dist/chunks/{palette-7yJYVEvk.js → palette-CIuwlEiG.js} +1 -1
  17. package/dist/chunks/{resource-management-panel-B1mhnY97.js → resource-management-panel-CM3Zsk9H.js} +1 -1
  18. package/dist/chunks/{resource-management-panel-CSkNW3es.js → resource-management-panel-S0LXyguo.js} +18 -18
  19. package/dist/chunks/{save-DDX_vrED.js → save-_ALpoMy6.js} +1 -1
  20. package/dist/chunks/{switch-DEPWsRhf.js → switch-B6fh8nb-.js} +25 -25
  21. package/dist/chunks/{use-create-flow-overlay-state-BHQjJwik.js → use-create-flow-overlay-state-Cp7PYD-t.js} +4 -4
  22. package/dist/chunks/{use-create-flow-overlay-state-7LiC_vaL.js → use-create-flow-overlay-state-CqTBDwBF.js} +1 -1
  23. package/dist/chunks/{use-visual-utils-Dw-uLgop.js → use-visual-utils-D9DsvP1v.js} +12 -12
  24. package/dist/chunks/{use-visual-utils-Bz7kjSrk.js → use-visual-utils-DDd0pAJ_.js} +1 -1
  25. package/dist/dashboard/index.cjs +1 -1
  26. package/dist/dashboard/index.js +1 -1
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.js +69 -70
  29. package/dist/style.css +1 -1
  30. package/dist/surfboard/index.cjs +1 -1
  31. package/dist/surfboard/index.js +7 -8
  32. package/dist/types/main.d.ts +0 -11
  33. package/dist/types/surfboard.d.ts +0 -10
  34. package/package.json +1 -1
  35. package/dist/chunks/dashboard-controls-wPVXTTiH.js +0 -57
  36. package/dist/chunks/dashboard-summary-settings-dialog-CZkn4rtm.js +0 -545
  37. package/dist/chunks/dashboard-summary-settings-dialog-DoxcpXjk.js +0 -1
@@ -1,4 +1,4 @@
1
- import { c } from "./switch-DEPWsRhf.js";
1
+ import { c } from "./switch-B6fh8nb-.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./switch-DPaKnsb8.js"),x=require("react"),t=require("./index-DjZqoaV5.js"),oe=require("./use-visual-utils-Bz7kjSrk.js");/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("./switch-DPaKnsb8.js"),x=require("react"),t=require("./index-B7C8qBWC.js"),oe=require("./use-visual-utils-DDd0pAJ_.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,15 +1,15 @@
1
1
  import { jsx as e, jsxs as n, Fragment as le } from "react/jsx-runtime";
2
- import { c as Fe, u as ne, n as je, a as W, B as I, f as se, s as be, w as ze, L as fe, I as ge, X as Be, z as He, A as Ke, D as _e, F as Ge, ay as Xe } from "./switch-DEPWsRhf.js";
2
+ import { c as je, u as ne, i as Fe, a as W, B as I, f as se, m as be, p as ze, L as fe, x as ge, X as Be, s as He, t as Ke, v as _e, w as Ge, ay as Xe } from "./switch-B6fh8nb-.js";
3
3
  import $e, { useState as b, useEffect as ae, useRef as qe } from "react";
4
- import { t as de, bo as Je, bp as Qe, bl as ie, bq as We, br as Ye, bs as Ze, bt as ke, bu as Q, bv as et, bw as tt, bx as nt, by as xe, bc as ce, bz as at, bA as st, bB as we, bC as Ne, bD as ot, $ as ye, X as Ce, bE as ve, bF as Se, bG as Ee, bH as Ve, bI as Le, bJ as Ae, bK as Oe, bL as Re, bM as Te, bN as rt, bO as ue, bP as it, V as te, u as lt, bQ as Ue, b as dt, c as ct, d as ut, e as ht, f as pt, n as mt, bR as ft, bS as De, bT as gt, bU as xt } from "./index-D7e2Eyp_.js";
5
- import { u as Ie } from "./use-visual-utils-Dw-uLgop.js";
4
+ import { t as de, bo as Je, bp as Qe, bl as ie, bq as We, br as Ye, bs as Ze, bt as ke, bu as Q, bv as et, bw as tt, bx as nt, by as xe, bc as ce, bz as at, bA as st, bB as we, bC as Ne, bD as ot, $ as ye, X as Ce, bE as ve, bF as Se, bG as Ee, bH as Ve, bI as Le, bJ as Ae, bK as Oe, bL as Re, bM as Te, bN as rt, bO as ue, bP as it, V as te, u as lt, bQ as Ue, b as dt, c as ct, d as ut, e as ht, f as pt, n as mt, bR as ft, bS as De, bT as gt, bU as xt } from "./index-CjRLHvSp.js";
5
+ import { u as Ie } from "./use-visual-utils-D9DsvP1v.js";
6
6
  /**
7
7
  * @license lucide-react v0.453.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
11
  */
12
- const Dt = Fe("FolderOpen", [
12
+ const Dt = je("FolderOpen", [
13
13
  [
14
14
  "path",
15
15
  {
@@ -35,7 +35,7 @@ function Me() {
35
35
  )) });
36
36
  }
37
37
  const bt = (t) => {
38
- const m = ne((i) => i.isVisualEditing), p = ne((i) => i.selectedFrameId), l = je((i) => i.frame);
38
+ const m = ne((i) => i.isVisualEditing), p = ne((i) => i.selectedFrameId), l = Fe((i) => i.frame);
39
39
  return !!(m && p && (l == null ? void 0 : l.visualId) === t);
40
40
  };
41
41
  function wt({
@@ -50,7 +50,7 @@ function wt({
50
50
  onShareVisual: N,
51
51
  formatDate: y
52
52
  }) {
53
- var M, U, F, j;
53
+ var M, U, j, F;
54
54
  const { selectVisual: f } = de(), d = Je(t.id), u = bt(t.id), A = ne((r) => r.isVisualEditing), { isConsoleMode: T } = Qe(), x = $e.useRef(null), [S, E] = b(!1), [V, O] = b(!1);
55
55
  ae(() => {
56
56
  p ? (E(!0), O(!0)) : V && (E(!1), O(!1));
@@ -232,9 +232,9 @@ function wt({
232
232
  ] }),
233
233
  /* @__PURE__ */ e(xe, {}),
234
234
  /* @__PURE__ */ n("div", { className: "space-y-1 px-2 py-1.5 text-[11px] text-muted-foreground", children: [
235
- (((U = t.ownership.createdBy) == null ? void 0 : U.type) === "tenant" || ((F = t.ownership.createdBy) == null ? void 0 : F.type) === "organization" && T) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
235
+ (((U = t.ownership.createdBy) == null ? void 0 : U.type) === "tenant" || ((j = t.ownership.createdBy) == null ? void 0 : j.type) === "organization" && T) && /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
236
236
  /* @__PURE__ */ e(at, { className: "h-3 w-3" }),
237
- /* @__PURE__ */ e("span", { children: ((j = t.ownership.createdBy) == null ? void 0 : j.name) || "Unknown" })
237
+ /* @__PURE__ */ e("span", { children: ((F = t.ownership.createdBy) == null ? void 0 : F.name) || "Unknown" })
238
238
  ] }),
239
239
  /* @__PURE__ */ n("div", { className: "flex items-center gap-1.5", children: [
240
240
  /* @__PURE__ */ e(st, { className: "h-3 w-3" }),
@@ -278,9 +278,9 @@ function Nt({ searchQuery: t }) {
278
278
  month: "short",
279
279
  day: "numeric",
280
280
  year: "numeric"
281
- }), F = (s) => {
281
+ }), j = (s) => {
282
282
  N(s), w(!0);
283
- }, j = () => {
283
+ }, F = () => {
284
284
  o && O(o.id);
285
285
  }, {
286
286
  startUpdating: r,
@@ -362,7 +362,7 @@ function Nt({ searchQuery: t }) {
362
362
  onAddVisual: q,
363
363
  onOpenVisual: H,
364
364
  onEditDetails: Y,
365
- onDeleteClick: F,
365
+ onDeleteClick: j,
366
366
  onDuplicateVisual: $,
367
367
  onShareVisual: J,
368
368
  isDeleting: v,
@@ -415,7 +415,7 @@ function Nt({ searchQuery: t }) {
415
415
  Te,
416
416
  {
417
417
  onClick: (s) => {
418
- s.preventDefault(), s.stopPropagation(), j();
418
+ s.preventDefault(), s.stopPropagation(), F();
419
419
  },
420
420
  disabled: v,
421
421
  children: [
@@ -531,8 +531,8 @@ function vt(t) {
531
531
  (a) => a.actions.clearSelectedDashboard
532
532
  ), { tokenProps: v, id: M } = lt(), {
533
533
  resources: U,
534
- isLoading: F,
535
- isError: j,
534
+ isLoading: j,
535
+ isError: F,
536
536
  updateResource: r,
537
537
  deleteResource: X,
538
538
  duplicateResource: B,
@@ -609,7 +609,7 @@ function vt(t) {
609
609
  }
610
610
  });
611
611
  };
612
- return F ? /* @__PURE__ */ e(Me, {}) : j ? /* @__PURE__ */ e(Ct, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
612
+ return j ? /* @__PURE__ */ e(Me, {}) : F ? /* @__PURE__ */ e(Ct, { onRetry: () => window.location.reload() }) : /* @__PURE__ */ n("div", { className: "flex h-full flex-1 flex-col", children: [
613
613
  /* @__PURE__ */ e("div", { className: "flex flex-1 basis-0 flex-col gap-0.5 overflow-y-auto", children: q.length === 0 ? /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-1.5 px-4 py-10 text-center", children: [
614
614
  /* @__PURE__ */ e(ze, { className: "h-5 w-5 text-muted-foreground/60" }),
615
615
  /* @__PURE__ */ e("h3", { className: "text-[13px] font-medium text-foreground", children: m ? "No dashboards found" : "No dashboards yet" }),
@@ -798,7 +798,7 @@ function Tt({
798
798
  (D) => {
799
799
  o(!1), D && (S(D), E(D));
800
800
  }
801
- ), U = i === "overlay", F = h ? "New Visual" : "New", j = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...", X = h ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(), H = B && B.toLowerCase() !== "undefined" ? B : L || "Current user", q = ((z = H.charAt(0)) == null ? void 0 : z.toUpperCase()) || "?", J = L && L.toLowerCase() !== "undefined" ? L : "", Y = St(m, {
801
+ ), U = i === "overlay", j = h ? "New Visual" : "New", F = h ? "New Visual" : "New Dashboard", r = h ? "Search visuals..." : "Search dashboards...", X = h ? "Collapse visuals panel" : "Collapse dashboard panel", B = ((u == null ? void 0 : u.name) ?? "").trim(), L = ((u == null ? void 0 : u.email) ?? "").trim(), H = B && B.toLowerCase() !== "undefined" ? B : L || "Current user", q = ((z = H.charAt(0)) == null ? void 0 : z.toUpperCase()) || "?", J = L && L.toLowerCase() !== "undefined" ? L : "", Y = St(m, {
802
802
  enabled: t && U
803
803
  }), Z = W(
804
804
  "flex h-full flex-col border-r border-border/60 bg-background",
@@ -867,10 +867,10 @@ function Tt({
867
867
  size: "xs",
868
868
  variant: "outline",
869
869
  onClick: () => o(!0),
870
- "aria-label": j,
870
+ "aria-label": F,
871
871
  children: [
872
872
  /* @__PURE__ */ e(ie, { className: "h-3.5 w-3.5" }),
873
- F
873
+ j
874
874
  ]
875
875
  }
876
876
  ),
@@ -1,4 +1,4 @@
1
- import { c as a } from "./switch-DEPWsRhf.js";
1
+ import { c as a } from "./switch-B6fh8nb-.js";
2
2
  /**
3
3
  * @license lucide-react v0.453.0 - ISC
4
4
  *
@@ -20472,15 +20472,15 @@ const dS = at(
20472
20472
  fS.displayName = Vu.displayName;
20473
20473
  export {
20474
20474
  zS as $,
20475
- Xx as A,
20475
+ aI as A,
20476
20476
  $g as B,
20477
20477
  sI as C,
20478
- Zx as D,
20479
- Bx as E,
20480
- aC as F,
20478
+ S0 as D,
20479
+ x0 as E,
20480
+ fS as F,
20481
20481
  Zl as G,
20482
20482
  xS as H,
20483
- jg as I,
20483
+ Bx as I,
20484
20484
  IS as J,
20485
20485
  Nx as K,
20486
20486
  uC as L,
@@ -20490,7 +20490,7 @@ export {
20490
20490
  eI as P,
20491
20491
  Js as Q,
20492
20492
  Ux as R,
20493
- fS as S,
20493
+ jx as S,
20494
20494
  nI as T,
20495
20495
  Hx as U,
20496
20496
  el as V,
@@ -20794,24 +20794,24 @@ export {
20794
20794
  ES as ew,
20795
20795
  Jo as ex,
20796
20796
  $x as f,
20797
- oI as g,
20798
- C0 as h,
20799
- aI as i,
20800
- S0 as j,
20801
- x0 as k,
20802
- ww as l,
20803
- vx as m,
20804
- Pn as n,
20805
- fw as o,
20806
- jx as p,
20807
- kC as q,
20808
- LC as r,
20809
- q0 as s,
20810
- VC as t,
20797
+ ww as g,
20798
+ vx as h,
20799
+ Pn as i,
20800
+ fw as j,
20801
+ kC as k,
20802
+ LC as l,
20803
+ q0 as m,
20804
+ VC as n,
20805
+ qx as o,
20806
+ Vx as p,
20807
+ zx as q,
20808
+ D0 as r,
20809
+ Kx as s,
20810
+ Xx as t,
20811
20811
  Ye as u,
20812
- qx as v,
20813
- Vx as w,
20814
- zx as x,
20815
- D0 as y,
20816
- Kx as z
20812
+ Zx as v,
20813
+ aC as w,
20814
+ jg as x,
20815
+ oI as y,
20816
+ C0 as z
20817
20817
  };
@@ -1,9 +1,9 @@
1
- import { c as De, n as L, l as le, u as ne, z as ft, A as ht, D as bt, a as oe, F as gt, a8 as yt, B as V, e as xt, X as Ke, m as Ye, f as Ge, a9 as vt, aa as Ct, ab as re, ac as Ae, ad as ze, ae as be, af as ge, ag as kt, ah as Oe, ai as Nt, aj as St, ak as se, al as Dt, am as Me, G as Be, an as Xe, ao as He, ap as Je, L as Y, I as We, g as ye, h as xe, i as ve, j as Ce, k as ke, aq as Ze, ar as wt, as as It, at as Qe, au as Tt, av as je, aw as Et, ax as Ne } from "./switch-DEPWsRhf.js";
1
+ import { c as De, i as L, g as le, u as ne, s as ft, t as ht, v as bt, a as oe, w as gt, a8 as yt, B as V, e as xt, X as Ke, h as Ye, f as Ge, a9 as vt, aa as Ct, ab as re, ac as Ae, ad as ze, ae as be, af as ge, ag as kt, ah as Oe, ai as Nt, aj as St, ak as se, al as Dt, am as Me, G as Be, an as Xe, ao as He, ap as Je, L as Y, x as We, y as ye, z as xe, A as ve, D as Ce, E as ke, aq as Ze, ar as wt, as as It, at as Qe, au as Tt, av as je, aw as Et, ax as Ne } from "./switch-B6fh8nb-.js";
2
2
  import { useEffect as ie, useMemo as z, useState as j, useRef as Se, useCallback as M, Fragment as Vt } from "react";
3
- import { a$ as qt, b0 as et, b1 as _t, b2 as Ft, b3 as Lt, b4 as At, b5 as zt, V as Ot, P as Mt, q as ce, b6 as tt, s as at, b7 as rt, b8 as Bt, o as Q, b9 as Qt, ba as jt, bb as Re, bc as Rt, bd as Ut, be as st, bf as lt, bg as Pt, bh as $t, bi as Kt, bj as Yt, bk as Gt, bl as Xt, bm as Ht, bn as Jt } from "./index-D7e2Eyp_.js";
3
+ import { a$ as qt, b0 as et, b1 as _t, b2 as Ft, b3 as Lt, b4 as At, b5 as zt, V as Ot, P as Mt, q as ce, b6 as tt, s as at, b7 as rt, b8 as Bt, o as Q, b9 as Qt, ba as jt, bb as Re, bc as Rt, bd as Ut, be as st, bf as lt, bg as Pt, bh as $t, bi as Kt, bj as Yt, bk as Gt, bl as Xt, bm as Ht, bn as Jt } from "./index-CjRLHvSp.js";
4
4
  import { jsx as t, jsxs as d, Fragment as $ } from "react/jsx-runtime";
5
- import { u as we } from "./use-visual-utils-Dw-uLgop.js";
6
- import { S as nt } from "./save-DDX_vrED.js";
5
+ import { u as we } from "./use-visual-utils-D9DsvP1v.js";
6
+ import { S as nt } from "./save-_ALpoMy6.js";
7
7
  /**
8
8
  * @license lucide-react v0.453.0 - ISC
9
9
  *
@@ -1,4 +1,4 @@
1
- "use strict";const s=require("./switch-DPaKnsb8.js"),v=require("react"),p=require("./index-DjZqoaV5.js"),e=require("react/jsx-runtime"),re=require("./use-visual-utils-Bz7kjSrk.js"),he=require("./save-B8x5Vi0W.js");/**
1
+ "use strict";const s=require("./switch-DPaKnsb8.js"),v=require("react"),p=require("./index-B7C8qBWC.js"),e=require("react/jsx-runtime"),re=require("./use-visual-utils-DDd0pAJ_.js"),he=require("./save-B8x5Vi0W.js");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,5 +1,5 @@
1
- import { p as X, u as Y, q as Z, r as ee, s as te, t as re, v as se, w as ae, o as V, x as oe } from "./index-D7e2Eyp_.js";
2
- import { l as ne, m as ie, u as b, n as z, o as ce } from "./switch-DEPWsRhf.js";
1
+ import { p as X, u as Y, q as Z, r as ee, s as te, t as re, v as se, w as ae, o as V, x as oe } from "./index-CjRLHvSp.js";
2
+ import { g as ne, h as ie, u as b, i as z, j as ce } from "./switch-B6fh8nb-.js";
3
3
  import { useState as H, useEffect as de, useCallback as A } from "react";
4
4
  function le(e) {
5
5
  const [a, s] = H(null), [r, t] = H(null), o = X();
@@ -193,12 +193,12 @@ function be() {
193
193
  setSelectedTableName: p,
194
194
  setSelectedDatamodelId: g,
195
195
  setFilterValues: P,
196
- setInlineFilterValuesMap: D,
197
- setApplyFilters: L,
198
- clearEditorContext: T
196
+ setInlineFilterValuesMap: j,
197
+ setApplyFilters: D,
198
+ clearEditorContext: L
199
199
  } = ne(), {
200
200
  setIsDashboardEditing: v,
201
- setIsVisualEditing: j,
201
+ setIsVisualEditing: T,
202
202
  setSelectedFrameId: k,
203
203
  clearSelectedFrameId: N,
204
204
  setIsDashboardPanelOpen: W
@@ -209,7 +209,7 @@ function be() {
209
209
  }), G = A(
210
210
  async (c) => {
211
211
  try {
212
- o(c), N(), T();
212
+ o(c), N(), L();
213
213
  const { data: u, fromCache: U } = await Q(
214
214
  a.apiServiceUrl,
215
215
  (e == null ? void 0 : e.accessToken) || "",
@@ -230,10 +230,10 @@ function be() {
230
230
  setSelectedTableName: p,
231
231
  setSelectedDatamodelId: g,
232
232
  setFilterValues: P,
233
- setInlineFilterValuesMap: D,
234
- setApplyFilters: L,
233
+ setInlineFilterValuesMap: j,
234
+ setApplyFilters: D,
235
235
  setIsDashboardEditing: v,
236
- setIsVisualEditing: j,
236
+ setIsVisualEditing: T,
237
237
  dashboard: x,
238
238
  selectedSheetId: S,
239
239
  selectedFrameId: $,
@@ -254,7 +254,7 @@ function be() {
254
254
  l,
255
255
  n,
256
256
  v,
257
- j,
257
+ T,
258
258
  i,
259
259
  f,
260
260
  h,
@@ -266,9 +266,9 @@ function be() {
266
266
  p,
267
267
  g,
268
268
  P,
269
+ j,
269
270
  D,
270
271
  L,
271
- T,
272
272
  N,
273
273
  x,
274
274
  S,
@@ -1 +1 @@
1
- "use strict";const u=require("./index-DjZqoaV5.js"),f=require("./switch-DPaKnsb8.js"),S=require("react");function K(e){const[a,s]=S.useState(null),[r,t]=S.useState(null),o=u.useEnsureReactGlobals();return S.useEffect(()=>{if(!e||e.trim()===""){s(null),t(null);return}if(!o)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const i=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(i,{method:"HEAD"})).ok)throw new Error(`Module not found at ${i}`)}catch{}const m=await import(i);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>m.useChartStore),t(null)}catch(n){const i=n instanceof Error?n.message:"Unknown error";console.error("Failed to load remote chart store:",i),t(i),s(null)}})()},[e,o]),a}function X(e,a){if(e.length===0)return"";const s=e.find(r=>{var t,o;return((t=r.customCardPreferences)==null?void 0:t.visualType)==="multiple"||!!((o=r.customCardPreferences)!=null&&o.dataInputCardIds)});if(s)return s.id;if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const l=t.split("__")[0],n=e.find(i=>i.tabTitle===l);return n?n.id:e[0].id}return a}}return e[0].id}const A=new Set;function Y(e){return A.add(e),()=>{A.delete(e)}}function z(){A.forEach(e=>{e()})}const Z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:a,...s}=e;return s};async function B(e,a,s,r){if(!a||!s)throw new Error("Missing auth token or visual ID");const t=["resource-by-id","visual",s],o=r.getQueryData(t);if(o)return console.log("Using cached visual data for:",s),{data:o,fromCache:!0};console.log("Fetching visual data from network for:",s);const l=u.ue.loading("Loading visual...",{position:"top-center"});try{const n=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${a}`}});if(!n.ok)throw new Error("Failed to load visual");const i=await n.json();return r.setQueryData(t,i),u.ue.dismiss(l),{data:i,fromCache:!1}}catch(n){throw u.ue.dismiss(l),n}}function H(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function ee(e,a){var o,l;const s=(e==null?void 0:e.frameObject)??((o=e==null?void 0:e.visual)==null?void 0:o.frameObject);if(!s)return!1;const r=H(s);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const t=(l=r.cards)==null?void 0:l.find(n=>n.id===r.activeCardId);return t?(u.setupEditorWithCard({...a,frame:r,card:t,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function te(){const e=f.useEditorStore(r=>{var t;return((t=r.card.customCardPreferences)==null?void 0:t.url)||""}),a=K(e);return{getUpdatedFrame:S.useCallback(()=>{var b;z();const{frame:r,card:t,isDevMode:o,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y}=f.useEditorStore.getState(),I=t.sql,U=(b=a==null?void 0:a.getState())==null?void 0:b.settings,V=f.buildSavedEditorCard(t,{isDevMode:o,cardSql:I,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y,remoteChartSettings:U,stripConfig:Z}),g=r.cards.map(E=>E.id===t.id?V:E);return{...r,cards:g,activeCardId:X(g,r.activeCardId)}},[a])}}function re(){const{authToken:e,tokenProps:a}=u.useSemaphorContext(),s=u.useQueryClient(),r=u.useAddFrameWithFreshSemanticExecutionPayload(),t=u.useSelectedVisual(),{selectVisual:o}=u.useManagementActions(),{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,clearEditorContext:L}=f.useEditorActions(),{setIsDashboardEditing:v,setIsVisualEditing:T,setSelectedFrameId:j,clearSelectedFrameId:N,setIsDashboardPanelOpen:R}=f.useDashboardActions(),w=f.useDashboardStore(c=>c.selectedSheetId),W=f.useDashboardStore(c=>c.selectedFrameId),$=f.useDashboardStore(c=>c.dashboard),_=f.useDashboardStore(c=>c.filterValues),x=f.useDashboardStore(c=>c.inlineFilterValuesMap),F=u.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),Q=S.useCallback(async c=>{try{o(c),N(),L();const{data:h,fromCache:D}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s);if(!ee(h,{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,setIsDashboardEditing:v,setIsVisualEditing:T,dashboard:$,selectedSheetId:w,selectedFrameId:W,filterValues:_,inlineFilterValuesMap:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:D}}catch(h){return console.error("Error editing visual:",h),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,l,n,v,T,i,m,p,y,I,U,V,g,b,E,P,M,k,L,N,$,w,W,_,x]),G=S.useCallback(async c=>{var D;const h=d=>(u.ue.error(d),{success:!1,error:d});try{if(o(c),!w)return h("No sheet selected. Please select a sheet first.");const{data:d,fromCache:J}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s),O=(d==null?void 0:d.frameObject)??((D=d==null?void 0:d.visual)==null?void 0:D.frameObject);if(!O)return h("Visual has no frame data");const C=H(O);if(!(C!=null&&C.cards)||C.cards.length===0)return h("Visual frame is malformed");const q={...u.cloneLinkedFrameWithSourceMapping(C),visualId:c.id};return await r(w,q,"end"),v(!0),j(q.id),R(!1),{success:!0,fromCache:J}}catch(d){return console.error("Error adding visual:",d),h(d instanceof Error?d.message:"Failed to add visual to dashboard")}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,w,v,j,R,r]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:Q,handleAddLibraryVisual:G,getUpdatedFrame:te().getUpdatedFrame,refetch:F.refetch}}exports.flushPendingEditorDrafts=z;exports.registerPendingEditorDraftFlusher=Y;exports.useVisualUtils=re;
1
+ "use strict";const u=require("./index-B7C8qBWC.js"),f=require("./switch-DPaKnsb8.js"),S=require("react");function K(e){const[a,s]=S.useState(null),[r,t]=S.useState(null),o=u.useEnsureReactGlobals();return S.useEffect(()=>{if(!e||e.trim()===""){s(null),t(null);return}if(!o)return;(async()=>{try{if(!e.startsWith("http://")&&!e.startsWith("https://"))throw new Error(`Invalid URL format: ${e}`);try{new URL(e)}catch{throw new Error(`Invalid URL: ${e}`)}const i=`${e.endsWith("/")?e:`${e}/`}index.js`;try{if(!(await fetch(i,{method:"HEAD"})).ok)throw new Error(`Module not found at ${i}`)}catch{}const m=await import(i);if(typeof m.useChartStore!="function")throw new Error("useChartStore is not a function");s(()=>m.useChartStore),t(null)}catch(n){const i=n instanceof Error?n.message:"Unknown error";console.error("Failed to load remote chart store:",i),t(i),s(null)}})()},[e,o]),a}function X(e,a){if(e.length===0)return"";const s=e.find(r=>{var t,o;return((t=r.customCardPreferences)==null?void 0:t.visualType)==="multiple"||!!((o=r.customCardPreferences)!=null&&o.dataInputCardIds)});if(s)return s.id;if(a){const r=e.find(t=>t.id===a);if(r){const t=r.tabTitle;if(t=="All__Header")return e[0].id;if(t&&t.endsWith("__Header")){const l=t.split("__")[0],n=e.find(i=>i.tabTitle===l);return n?n.id:e[0].id}return a}}return e[0].id}const A=new Set;function Y(e){return A.add(e),()=>{A.delete(e)}}function z(){A.forEach(e=>{e()})}const Z=e=>{if(!e||!("detailTableBackup"in e))return e;const{detailTableBackup:a,...s}=e;return s};async function B(e,a,s,r){if(!a||!s)throw new Error("Missing auth token or visual ID");const t=["resource-by-id","visual",s],o=r.getQueryData(t);if(o)return console.log("Using cached visual data for:",s),{data:o,fromCache:!0};console.log("Fetching visual data from network for:",s);const l=u.ue.loading("Loading visual...",{position:"top-center"});try{const n=await fetch(`${e}/management/v1/visuals/${s}`,{headers:{Authorization:`Bearer ${a}`}});if(!n.ok)throw new Error("Failed to load visual");const i=await n.json();return r.setQueryData(t,i),u.ue.dismiss(l),{data:i,fromCache:!1}}catch(n){throw u.ue.dismiss(l),n}}function H(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw new Error("Invalid frame object format")}function ee(e,a){var o,l;const s=(e==null?void 0:e.frameObject)??((o=e==null?void 0:e.visual)==null?void 0:o.frameObject);if(!s)return!1;const r=H(s);if(!(r!=null&&r.cards)||r.cards.length===0)return!1;const t=(l=r.cards)==null?void 0:l.find(n=>n.id===r.activeCardId);return t?(u.setupEditorWithCard({...a,frame:r,card:t,visualId:(e==null?void 0:e.id)||r.visualId}),!0):!1}function te(){const e=f.useEditorStore(r=>{var t;return((t=r.card.customCardPreferences)==null?void 0:t.url)||""}),a=K(e);return{getUpdatedFrame:S.useCallback(()=>{var b;z();const{frame:r,card:t,isDevMode:o,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y}=f.useEditorStore.getState(),I=t.sql,U=(b=a==null?void 0:a.getState())==null?void 0:b.settings,V=f.buildSavedEditorCard(t,{isDevMode:o,cardSql:I,isShowingVisual:l,selectedSchemaName:n,selectedDatamodelId:i,selectedDatabaseName:m,selectedTableName:p,selectedConnectionId:y,remoteChartSettings:U,stripConfig:Z}),g=r.cards.map(E=>E.id===t.id?V:E);return{...r,cards:g,activeCardId:X(g,r.activeCardId)}},[a])}}function re(){const{authToken:e,tokenProps:a}=u.useSemaphorContext(),s=u.useQueryClient(),r=u.useAddFrameWithFreshSemanticExecutionPayload(),t=u.useSelectedVisual(),{selectVisual:o}=u.useManagementActions(),{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,clearEditorContext:L}=f.useEditorActions(),{setIsDashboardEditing:v,setIsVisualEditing:T,setSelectedFrameId:j,clearSelectedFrameId:N,setIsDashboardPanelOpen:R}=f.useDashboardActions(),w=f.useDashboardStore(c=>c.selectedSheetId),W=f.useDashboardStore(c=>c.selectedFrameId),$=f.useDashboardStore(c=>c.dashboard),_=f.useDashboardStore(c=>c.filterValues),x=f.useDashboardStore(c=>c.inlineFilterValuesMap),F=u.useVisualById((t==null?void 0:t.id)||"",{enabled:!!(t!=null&&t.id)&&!!(e!=null&&e.accessToken)}),Q=S.useCallback(async c=>{try{o(c),N(),L();const{data:h,fromCache:D}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s);if(!ee(h,{setFrame:l,setCard:n,setIsDevMode:i,initializeModeDrafts:m,setActiveTabCardId:p,updateDataSource:y,setQueryResultColumns:I,setSelectedConnectionId:U,setSelectedDatabaseName:V,setSelectedSchemaName:g,setSelectedTableName:b,setSelectedDatamodelId:E,setFilterValues:P,setInlineFilterValuesMap:M,setApplyFilters:k,setIsDashboardEditing:v,setIsVisualEditing:T,dashboard:$,selectedSheetId:w,selectedFrameId:W,filterValues:_,inlineFilterValuesMap:x}))throw new Error("Failed to setup editor with visual data");return{success:!0,fromCache:D}}catch(h){return console.error("Error editing visual:",h),{success:!1,error:"Failed to load visual for editing"}}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,l,n,v,T,i,m,p,y,I,U,V,g,b,E,P,M,k,L,N,$,w,W,_,x]),G=S.useCallback(async c=>{var D;const h=d=>(u.ue.error(d),{success:!1,error:d});try{if(o(c),!w)return h("No sheet selected. Please select a sheet first.");const{data:d,fromCache:J}=await B(a.apiServiceUrl,(e==null?void 0:e.accessToken)||"",c.id,s),O=(d==null?void 0:d.frameObject)??((D=d==null?void 0:d.visual)==null?void 0:D.frameObject);if(!O)return h("Visual has no frame data");const C=H(O);if(!(C!=null&&C.cards)||C.cards.length===0)return h("Visual frame is malformed");const q={...u.cloneLinkedFrameWithSourceMapping(C),visualId:c.id};return await r(w,q,"end"),v(!0),j(q.id),R(!1),{success:!0,fromCache:J}}catch(d){return console.error("Error adding visual:",d),h(d instanceof Error?d.message:"Failed to add visual to dashboard")}},[e==null?void 0:e.accessToken,a.apiServiceUrl,s,o,w,v,j,R,r]);return{visual:F.data,isLoading:F.isLoading,isError:F.isError,error:F.error,handleEditLibraryVisual:Q,handleAddLibraryVisual:G,getUpdatedFrame:te().getUpdatedFrame,refetch:F.refetch}}exports.flushPendingEditorDrafts=z;exports.registerPendingEditorDraftFlusher=Y;exports.useVisualUtils=re;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-DjZqoaV5.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../chunks/index-B7C8qBWC.js"),e=require("../chunks/common-types-C73-Ud1-.js");exports.Dashboard=o.Dashboard;exports.CONTROL_CARD_DEFAULT_VALUE=e.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=e.EMPTY_SELECTION;
@@ -1,4 +1,4 @@
1
- import { D as o } from "../chunks/index-D7e2Eyp_.js";
1
+ import { D as o } from "../chunks/index-CjRLHvSp.js";
2
2
  import { C as s, E as C } from "../chunks/common-types-4bjoIgvm.js";
3
3
  export {
4
4
  s as CONTROL_CARD_DEFAULT_VALUE,
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-DjZqoaV5.js"),y=require("./chunks/common-types-C73-Ud1-.js"),L=require("./chunks/dashboard-summary-settings-dialog-DoxcpXjk.js"),t=require("react/jsx-runtime"),r=require("./chunks/switch-DPaKnsb8.js"),m=require("react"),z=require("./chunks/resource-management-panel-B1mhnY97.js"),B=require("./types/index.cjs"),q=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const A=require("./chunks/dashboard-filter-controls-launcher-DBmNn4EY.js"),O=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");function Q(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(a,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}return a.default=s,Object.freeze(a)}const P=Q(m);function V(s){const{displayPreferences:a,cardId:o,...l}=s,i={...l,id:s.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:s.cardId}),t.jsx(e.UXProvider,{appearance:s.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",cardId:o,...i,children:t.jsx(W,{cardId:o})})})})]})})}function W({cardId:s}){const a=r.useDashboardStore(i=>{var u;return(u=i.dashboard)==null?void 0:u.sheets}),{card:o,frame:l}=m.useMemo(()=>{const i=a==null?void 0:a.flatMap(d=>d.frames),u=i==null?void 0:i.flatMap(d=>d==null?void 0:d.cards),h=u==null?void 0:u.find(d=>(d==null?void 0:d.id)===s),n=i==null?void 0:i.find(d=>{var x;return(x=d==null?void 0:d.cards)==null?void 0:x.find(C=>(C==null?void 0:C.id)===s)});return{card:h,frame:n}},[a,s]);return!o||!l?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${s}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:i,resetErrorBoundary:u})=>t.jsx(e.FallbackVisual,{error:i,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:o,frame:l})})})}function H(s,a,o,l){m.useEffect(()=>{s&&!o&&a&&l(e.cloneDeep(a))},[s,o,a,l])}function $({name:s,items:a,value:o,onChange:l,isLoading:i,isError:u,refetch:h,className:n,icon:d,showNone:x=!1}){const C=P.useRef(null),[j,D]=P.useState(!1),[N,v]=P.useState("100%"),S=x?[...a||[],{id:"none",name:"None"}]:a;P.useLayoutEffect(()=>{C.current&&v(C.current.offsetWidth)},[]);function _(){var p;return i?"Loading...":u?"Error":o?(p=a==null?void 0:a.find(b=>b.id===o))==null?void 0:p.name:`Select ${s}`}function R(p,b){l(b),D(!1)}return t.jsxs(r.Popover,{open:j,onOpenChange:D,children:[t.jsx(r.PopoverTrigger,{asChild:!0,children:t.jsxs(r.Button,{ref:C,variant:"outline",role:"combobox","aria-expanded":j,className:r.cn("flex h-9 w-full justify-between",n),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[d&&t.jsx("div",{className:"mr-2",children:d}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:_()})]}),t.jsx(r.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:N},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:h,children:t.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",i&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",s==null?void 0:s.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:S==null?void 0:S.map(p=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:p.name,onSelect:b=>R(b,p.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(r.Check,{className:r.cn("size-4",o===p.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:p.name,children:p.name})]})},p.id))})]})]})})]})}function G({triggerButtonClassName:s,variant:a="ghost"}){const[o,l]=m.useState(!1),i=r.useDashboardStore(h=>{var n;return(n=h.dashboard)==null?void 0:n.id}),u=r.useDashboardStore(h=>{var n;return(n=h.dashboard)==null?void 0:n.title});return i?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:r.cn("h-7 p-2",s),buttonProps:{variant:a},onClick:()=>l(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:o,onOpenChange:l,dashboardId:i,dashboardName:u})]}):null}function K(s){const{authToken:a,tokenProps:o}=e.useSemaphorContext();return e.useMutation({mutationFn:async l=>e.backtestAlert(o.apiServiceUrl,a.accessToken,s,l)})}function Y(s,a){m.useEffect(()=>(s&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{s&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[s,a])}function I(s){if(!s)return"--";const a=new Date(s);return Number.isNaN(a.getTime())?"--":a.toLocaleString()}function X(s){var a;return((a=s.alertState)==null?void 0:a.currentState)==="FIRING"?"Signal surfaced":s.status==="ACTIVE"?"Watching":s.status==="PAUSED"?"Paused":s.status}function J({alertId:s,onBack:a}){var p,b,w,k;const{authToken:o,tokenProps:l}=e.useSemaphorContext(),{data:i,isLoading:u,refetch:h}=e.useAlertDetail(s),n=(i==null?void 0:i.alert)??null,[d,x]=m.useState([]),[C,j]=m.useState([]),[D,N]=m.useState(null),v=m.useCallback(async()=>{var f;const c=l==null?void 0:l.apiServiceUrl,g=o==null?void 0:o.accessToken;if(!c||!g||!s)return null;try{const T=await fetch(`${c}/v1/alerts/${s}/runs?limit=20`,{headers:{Authorization:`Bearer ${g}`}});if(T.ok){const F=await T.json(),E=Array.isArray(F.runs)?F.runs:[],M=D&&E.some(U=>U.id===D)?D:((f=E[0])==null?void 0:f.id)??null;return j(E),N(M),M}j([]),N(null)}catch{return j([]),N(null),null}return null},[s,o,D,l]),S=m.useCallback(async c=>{const g=l==null?void 0:l.apiServiceUrl,f=o==null?void 0:o.accessToken,T=c??D;if(!g||!f||!s||!T){x([]);return}try{const F=await fetch(`${g}/v1/alerts/${s}/runs/${T}/deliveries`,{headers:{Authorization:`Bearer ${f}`}});if(F.ok){const E=await F.json();x(Array.isArray(E.attempts)?E.attempts:[])}else x([])}catch{x([])}},[s,o,D,l]),_=m.useCallback(async()=>{await h();const c=await v();await S(c)},[S,v,h]);m.useEffect(()=>{v().catch(()=>{})},[v]),m.useEffect(()=>{S().catch(()=>{})},[S]);const R=m.useMemo(()=>{const c={};for(const g of d)c[g.channel]||(c[g.channel]=[]),c[g.channel].push(g);return c},[d]);return u?t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading signal detail..."}):n?t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[a&&t.jsx(r.Button,{variant:"outline",size:"sm",onClick:a,children:"Back"}),t.jsx("h2",{className:"text-lg font-semibold",children:n.name}),t.jsx(e.Badge,{variant:n.status==="ACTIVE"?"default":"secondary",children:X(n)}),((p=n.alertState)==null?void 0:p.currentState)&&t.jsx(e.Badge,{variant:n.alertState.currentState==="FIRING"?"destructive":"outline",children:n.alertState.currentState==="FIRING"?"Signal surfaced":"Stable"})]}),t.jsx(r.Button,{variant:"outline",size:"sm",onClick:()=>void _(),children:"Refresh"})]}),n.description&&t.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),t.jsxs("div",{className:"rounded-md border bg-muted/30 p-4 text-sm",children:[t.jsx("p",{className:"font-medium",children:"What changed"}),t.jsx("p",{className:"mt-1 text-muted-foreground",children:"Review the latest signal activity, then investigate the underlying dashboard context if you need more detail."})]}),t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Signal Watch"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Watching for:"})," ",e.formatSignalCondition(n.jobConfig.operator,n.jobConfig.threshold)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Severity:"})," ",n.jobConfig.severity]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Evaluated:"})," ",I((b=n.alertState)==null?void 0:b.lastEvaluatedAt)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Surfaced:"})," ",I((w=n.alertState)==null?void 0:w.lastTriggeredAt)]})]})]}),((k=n.deliveryConfig)==null?void 0:k.channels)&&n.deliveryConfig.channels.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Where It Surfaces"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:n.deliveryConfig.channels.map(c=>t.jsx(e.Badge,{variant:"outline",children:c},c))})]}),C.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Recent Delivery Activity"}),C.length>1&&t.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(c=>t.jsx(r.Button,{variant:c.id===D?"default":"outline",size:"sm",onClick:()=>N(c.id),children:I(c.scheduledFor)},c.id))}),Object.keys(R).length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No delivery attempts were recorded for this run."}):Object.entries(R).map(([c,g])=>t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(e.Badge,{variant:"secondary",className:"text-xs",children:c})}),t.jsx("div",{className:"overflow-hidden rounded border",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Recipient"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Time"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Error"})]})}),t.jsx("tbody",{children:g.map(f=>t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-2 py-1",children:f.recipient}),t.jsx("td",{className:"px-2 py-1",children:t.jsx(e.Badge,{variant:f.status==="SENT"?"default":"destructive",className:"text-[10px]",children:f.status})}),t.jsx("td",{className:"px-2 py-1",children:I(f.createdAt)}),t.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:f.error||"--"})]},f.id))})]})})]},c))]})]}):t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Signal not found."})}function Z(){var u,h;const{quotasQuery:s,usageQuery:a}=e.useAlertQuotas(),o=((u=s.data)==null?void 0:u.quotas)||[],l=((h=a.data)==null?void 0:h.usage)||[],i=new Map(l.map(n=>[n.tenantId||"org",n]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(r.Button,{variant:"outline",size:"sm",onClick:()=>{s.refetch(),a.refetch()},children:"Refresh"})]}),s.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:o.map(n=>{const d=n.tenantId||"org",x=i.get(d);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:d}),t.jsx("td",{className:"px-3 py-2",children:(x==null?void 0:x.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:n.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[n.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:n.policy.maxContextSources})]},d)})})]})})]})}exports.AlertManagementPage=e.AlertManagementPage;exports.AlertWizardDialog=e.AlertWizardDialog;exports.AlertsApiError=e.AlertsApiError;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.EmailScheduleDialog=e.EmailScheduleDialog;exports.ExportError=e.ExportError;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createExport=e.createExport;exports.deleteAlert=e.deleteAlert;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlertWizard=e.useAlertWizard;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=y.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=y.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=y.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=y.EMPTY_SELECTION;exports.PivotMarkerEnum=y.PivotMarkerEnum;exports.getFieldRuntimeColumnName=y.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=y.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=y.hasCalculatedFormulaInputs;exports.isCalculatedDimension=y.isCalculatedDimension;exports.isCalculatedField=y.isCalculatedField;exports.isCalculatedMetric=y.isCalculatedMetric;exports.CalendarPreferencesDialog=L.CalendarPreferencesDialog;exports.DashboardSummarySettingsDialog=L.DashboardSummarySettingsDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.ResourceManagementPanel=z.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=B.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=B.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=q.useDebouncedDirtyCheck;exports.AdvancedModeToggle=A.AdvancedModeToggle;exports.DashboardControlsSettings=A.DashboardControlsSettings;exports.DashboardFilterControlsButton=A.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=A.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=A.DocumentControlsSettings;exports.ExportNotificationItem=A.ExportNotificationItem;exports.ExportNotificationList=A.ExportNotificationList;exports.NotificationBell=A.NotificationBell;exports.UnsavedChangesAlert=A.UnsavedChangesAlert;exports.VisualEditingControls=A.VisualEditingControls;exports.useExportPolling=A.useExportPolling;exports.useExportRecovery=A.useExportRecovery;exports.normalizeDashboardForDirtyCheck=O.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=O.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=J;exports.Combobox=$;exports.ScheduleDashboard=G;exports.TenantQuotaPage=Z;exports.Visual=V;exports.useAlertBacktest=K;exports.useExposePrintState=Y;exports.usePristineSnapshotInitializer=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./chunks/index-B7C8qBWC.js"),y=require("./chunks/common-types-C73-Ud1-.js"),U=require("./chunks/calendar-preferences-dialog-aODuCeYE.js"),t=require("react/jsx-runtime"),r=require("./chunks/switch-DPaKnsb8.js"),m=require("react"),z=require("./chunks/resource-management-panel-CM3Zsk9H.js"),L=require("./types/index.cjs"),q=require("./chunks/use-debounced-dirty-check-XHSwAefL.js");require("react-dom");require("./chunks/index-DRlMUglg.js");const A=require("./chunks/dashboard-filter-controls-launcher-B0i9xSZZ.js"),B=require("./chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js");function Q(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(a,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}return a.default=s,Object.freeze(a)}const P=Q(m);function V(s){const{displayPreferences:a,cardId:o,...l}=s,i={...l,id:s.dashboardId};return t.jsx(e.ErrorBoundary,{FallbackComponent:e.Fallback,children:t.jsxs(e.SemaphorContextProvider,{dashboardProps:i,children:[t.jsx(e.SemaphorReadyIndicator,{componentType:"visual",componentId:s.cardId}),t.jsx(e.UXProvider,{appearance:s.appearance,children:t.jsx(e.DisplayPreferencesProvider,{displayPreferences:a,children:t.jsx(e.Container,{type:"visual",cardId:o,...i,children:t.jsx(W,{cardId:o})})})})]})})}function W({cardId:s}){const a=r.useDashboardStore(i=>{var u;return(u=i.dashboard)==null?void 0:u.sheets}),{card:o,frame:l}=m.useMemo(()=>{const i=a==null?void 0:a.flatMap(d=>d.frames),u=i==null?void 0:i.flatMap(d=>d==null?void 0:d.cards),h=u==null?void 0:u.find(d=>(d==null?void 0:d.id)===s),n=i==null?void 0:i.find(d=>{var x;return(x=d==null?void 0:d.cards)==null?void 0:x.find(C=>(C==null?void 0:C.id)===s)});return{card:h,frame:n}},[a,s]);return!o||!l?t.jsx(e.FallbackVisual,{error:new Error("Card not found"),resetErrorBoundary:()=>{},customerFacingMessage:`Card not found with ID: ${s}`}):t.jsx("main",{className:"flex h-full grow flex-col",children:t.jsx(e.ErrorBoundary,{FallbackComponent:({error:i,resetErrorBoundary:u})=>t.jsx(e.FallbackVisual,{error:i,resetErrorBoundary:u,customerFacingMessage:"Error creating visual. Please try again."}),children:t.jsx(e.DashboardCard,{card:o,frame:l})})})}function H(s,a,o,l){m.useEffect(()=>{s&&!o&&a&&l(e.cloneDeep(a))},[s,o,a,l])}function $({name:s,items:a,value:o,onChange:l,isLoading:i,isError:u,refetch:h,className:n,icon:d,showNone:x=!1}){const C=P.useRef(null),[b,D]=P.useState(!1),[N,v]=P.useState("100%"),S=x?[...a||[],{id:"none",name:"None"}]:a;P.useLayoutEffect(()=>{C.current&&v(C.current.offsetWidth)},[]);function _(){var p;return i?"Loading...":u?"Error":o?(p=a==null?void 0:a.find(j=>j.id===o))==null?void 0:p.name:`Select ${s}`}function R(p,j){l(j),D(!1)}return t.jsxs(r.Popover,{open:b,onOpenChange:D,children:[t.jsx(r.PopoverTrigger,{asChild:!0,children:t.jsxs(r.Button,{ref:C,variant:"outline",role:"combobox","aria-expanded":b,className:r.cn("flex h-9 w-full justify-between",n),children:[t.jsxs("div",{className:"flex items-center gap-2",children:[d&&t.jsx("div",{className:"mr-2",children:d}),t.jsx("span",{className:"max-w-[150px] overflow-hidden truncate text-ellipsis whitespace-nowrap",children:_()})]}),t.jsx(r.ChevronDown,{className:"size-4 opacity-50"})]})}),t.jsx(r.PopoverContent,{className:"w-full p-0",style:{minWidth:N},children:t.jsxs(e.Command,{children:[t.jsxs("div",{className:"flex h-9 items-center justify-between border-b pr-1",children:[t.jsx(e.CommandInput,{className:"h-9",placeholder:"Search..."}),t.jsx(e.IconButton,{className:"h-7",onClick:h,children:t.jsx(e.RefreshCw,{className:r.cn("size-3.5 opacity-50",i&&"animate-spin")})})]}),t.jsxs(e.CommandList,{children:[t.jsxs(e.CommandEmpty,{children:["No ",s==null?void 0:s.toLowerCase()," found."]}),t.jsx(e.CommandGroup,{children:S==null?void 0:S.map(p=>t.jsx(e.CommandItem,{className:"overflow-x-auto",value:p.name,onSelect:j=>R(j,p.id),children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(r.Check,{className:r.cn("size-4",o===p.id?"opacity-100":"opacity-0")}),t.jsx("div",{title:p.name,children:p.name})]})},p.id))})]})]})})]})}function G({triggerButtonClassName:s,variant:a="ghost"}){const[o,l]=m.useState(!1),i=r.useDashboardStore(h=>{var n;return(n=h.dashboard)==null?void 0:n.id}),u=r.useDashboardStore(h=>{var n;return(n=h.dashboard)==null?void 0:n.title});return i?t.jsxs(t.Fragment,{children:[t.jsx(e.IconButton,{tooltip:"Schedule Dashboard",className:r.cn("h-7 p-2",s),buttonProps:{variant:a},onClick:()=>l(!0),children:t.jsx(e.Clock,{className:"size-4"})}),t.jsx(e.EmailScheduleDialog,{open:o,onOpenChange:l,dashboardId:i,dashboardName:u})]}):null}function K(s){const{authToken:a,tokenProps:o}=e.useSemaphorContext();return e.useMutation({mutationFn:async l=>e.backtestAlert(o.apiServiceUrl,a.accessToken,s,l)})}function Y(s,a){m.useEffect(()=>(s&&a&&(window.__SEMAPHOR_PRINT_STATE__={...a}),()=>{s&&window.__SEMAPHOR_PRINT_STATE__&&delete window.__SEMAPHOR_PRINT_STATE__}),[s,a])}function I(s){if(!s)return"--";const a=new Date(s);return Number.isNaN(a.getTime())?"--":a.toLocaleString()}function X(s){var a;return((a=s.alertState)==null?void 0:a.currentState)==="FIRING"?"Signal surfaced":s.status==="ACTIVE"?"Watching":s.status==="PAUSED"?"Paused":s.status}function J({alertId:s,onBack:a}){var p,j,w,k;const{authToken:o,tokenProps:l}=e.useSemaphorContext(),{data:i,isLoading:u,refetch:h}=e.useAlertDetail(s),n=(i==null?void 0:i.alert)??null,[d,x]=m.useState([]),[C,b]=m.useState([]),[D,N]=m.useState(null),v=m.useCallback(async()=>{var g;const c=l==null?void 0:l.apiServiceUrl,f=o==null?void 0:o.accessToken;if(!c||!f||!s)return null;try{const T=await fetch(`${c}/v1/alerts/${s}/runs?limit=20`,{headers:{Authorization:`Bearer ${f}`}});if(T.ok){const F=await T.json(),E=Array.isArray(F.runs)?F.runs:[],M=D&&E.some(O=>O.id===D)?D:((g=E[0])==null?void 0:g.id)??null;return b(E),N(M),M}b([]),N(null)}catch{return b([]),N(null),null}return null},[s,o,D,l]),S=m.useCallback(async c=>{const f=l==null?void 0:l.apiServiceUrl,g=o==null?void 0:o.accessToken,T=c??D;if(!f||!g||!s||!T){x([]);return}try{const F=await fetch(`${f}/v1/alerts/${s}/runs/${T}/deliveries`,{headers:{Authorization:`Bearer ${g}`}});if(F.ok){const E=await F.json();x(Array.isArray(E.attempts)?E.attempts:[])}else x([])}catch{x([])}},[s,o,D,l]),_=m.useCallback(async()=>{await h();const c=await v();await S(c)},[S,v,h]);m.useEffect(()=>{v().catch(()=>{})},[v]),m.useEffect(()=>{S().catch(()=>{})},[S]);const R=m.useMemo(()=>{const c={};for(const f of d)c[f.channel]||(c[f.channel]=[]),c[f.channel].push(f);return c},[d]);return u?t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading signal detail..."}):n?t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[a&&t.jsx(r.Button,{variant:"outline",size:"sm",onClick:a,children:"Back"}),t.jsx("h2",{className:"text-lg font-semibold",children:n.name}),t.jsx(e.Badge,{variant:n.status==="ACTIVE"?"default":"secondary",children:X(n)}),((p=n.alertState)==null?void 0:p.currentState)&&t.jsx(e.Badge,{variant:n.alertState.currentState==="FIRING"?"destructive":"outline",children:n.alertState.currentState==="FIRING"?"Signal surfaced":"Stable"})]}),t.jsx(r.Button,{variant:"outline",size:"sm",onClick:()=>void _(),children:"Refresh"})]}),n.description&&t.jsx("p",{className:"text-sm text-muted-foreground",children:n.description}),t.jsxs("div",{className:"rounded-md border bg-muted/30 p-4 text-sm",children:[t.jsx("p",{className:"font-medium",children:"What changed"}),t.jsx("p",{className:"mt-1 text-muted-foreground",children:"Review the latest signal activity, then investigate the underlying dashboard context if you need more detail."})]}),t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Signal Watch"}),t.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Watching for:"})," ",e.formatSignalCondition(n.jobConfig.operator,n.jobConfig.threshold)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Severity:"})," ",n.jobConfig.severity]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Evaluated:"})," ",I((j=n.alertState)==null?void 0:j.lastEvaluatedAt)]}),t.jsxs("div",{children:[t.jsx("span",{className:"text-muted-foreground",children:"Last Surfaced:"})," ",I((w=n.alertState)==null?void 0:w.lastTriggeredAt)]})]})]}),((k=n.deliveryConfig)==null?void 0:k.channels)&&n.deliveryConfig.channels.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-2",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Where It Surfaces"}),t.jsx("div",{className:"flex flex-wrap gap-2",children:n.deliveryConfig.channels.map(c=>t.jsx(e.Badge,{variant:"outline",children:c},c))})]}),C.length>0&&t.jsxs("div",{className:"rounded-md border bg-background p-4 space-y-3",children:[t.jsx("h3",{className:"text-sm font-semibold",children:"Recent Delivery Activity"}),C.length>1&&t.jsx("div",{className:"flex flex-wrap gap-2",children:C.map(c=>t.jsx(r.Button,{variant:c.id===D?"default":"outline",size:"sm",onClick:()=>N(c.id),children:I(c.scheduledFor)},c.id))}),Object.keys(R).length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No delivery attempts were recorded for this run."}):Object.entries(R).map(([c,f])=>t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(e.Badge,{variant:"secondary",className:"text-xs",children:c})}),t.jsx("div",{className:"overflow-hidden rounded border",children:t.jsxs("table",{className:"w-full text-xs",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Recipient"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Status"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Time"}),t.jsx("th",{className:"px-2 py-1 text-left font-medium",children:"Error"})]})}),t.jsx("tbody",{children:f.map(g=>t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-2 py-1",children:g.recipient}),t.jsx("td",{className:"px-2 py-1",children:t.jsx(e.Badge,{variant:g.status==="SENT"?"default":"destructive",className:"text-[10px]",children:g.status})}),t.jsx("td",{className:"px-2 py-1",children:I(g.createdAt)}),t.jsx("td",{className:"px-2 py-1 text-muted-foreground",children:g.error||"--"})]},g.id))})]})})]},c))]})]}):t.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Signal not found."})}function Z(){var u,h;const{quotasQuery:s,usageQuery:a}=e.useAlertQuotas(),o=((u=s.data)==null?void 0:u.quotas)||[],l=((h=a.data)==null?void 0:h.usage)||[],i=new Map(l.map(n=>[n.tenantId||"org",n]));return t.jsxs("div",{className:"space-y-4 p-4",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("h2",{className:"text-xl font-semibold",children:"Alert Quotas"}),t.jsx(r.Button,{variant:"outline",size:"sm",onClick:()=>{s.refetch(),a.refetch()},children:"Refresh"})]}),s.isLoading||a.isLoading?t.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading quota usage..."}):null,t.jsx("div",{className:"overflow-hidden rounded-lg border",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{className:"bg-muted/40",children:t.jsxs("tr",{children:[t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Tenant"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Active Alerts"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Active"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Min Cadence"}),t.jsx("th",{className:"px-3 py-2 text-left font-medium",children:"Max Context Sources"})]})}),t.jsx("tbody",{children:o.map(n=>{const d=n.tenantId||"org",x=i.get(d);return t.jsxs("tr",{className:"border-t",children:[t.jsx("td",{className:"px-3 py-2",children:d}),t.jsx("td",{className:"px-3 py-2",children:(x==null?void 0:x.activeAlerts)??0}),t.jsx("td",{className:"px-3 py-2",children:n.policy.maxActiveAlerts}),t.jsxs("td",{className:"px-3 py-2",children:[n.policy.minCadenceMinutes," min"]}),t.jsx("td",{className:"px-3 py-2",children:n.policy.maxContextSources})]},d)})})]})})]})}exports.AlertManagementPage=e.AlertManagementPage;exports.AlertWizardDialog=e.AlertWizardDialog;exports.AlertsApiError=e.AlertsApiError;exports.CardAlertIndicator=e.CardAlertIndicator;exports.CardSummary=e.CardSummary;exports.Dashboard=e.Dashboard;exports.DashboardExportDialog=e.DashboardExportDialog;exports.DashboardWC=e.DashboardWC;exports.EmailScheduleDialog=e.EmailScheduleDialog;exports.ExportError=e.ExportError;exports.ResourceType=e.ResourceType;exports.SemaphorContextProvider=e.SemaphorContextProvider;exports.SemaphorDataProvider=e.SemaphorQueryClient;exports.SemaphorQueryClient=e.SemaphorQueryClient;exports.ShareDialog=e.ShareDialog;exports.SummaryCard=e.SummaryCard;exports.Surfboard=e.DashboardPlus;exports.backtestAlert=e.backtestAlert;exports.cancelExport=e.cancelExport;exports.cloneDeep=e.cloneDeep;exports.createAlert=e.createAlert;exports.createExport=e.createExport;exports.deleteAlert=e.deleteAlert;exports.downloadDocumentPdf=e.downloadDocumentPdf;exports.downloadPdf=e.downloadPdf;exports.formatFileSize=e.formatFileSize;exports.getAlert=e.getAlert;exports.getAlertContextSources=e.getAlertContextSources;exports.getAlertHistory=e.getAlertHistory;exports.getAlertQuotaUsage=e.getAlertQuotaUsage;exports.getAlertRunDeliveries=e.getAlertRunDeliveries;exports.getAlertRunSteps=e.getAlertRunSteps;exports.getAlertRuns=e.getAlertRuns;exports.getAlertState=e.getAlertState;exports.getDownloadUrl=e.getDownloadUrl;exports.getExportStatus=e.getExportStatus;exports.getExports=e.getExports;exports.isExportComplete=e.isExportComplete;exports.isExportInProgress=e.isExportInProgress;exports.listAlertQuotas=e.listAlertQuotas;exports.listAlerts=e.listAlerts;exports.previewAlertDeliverable=e.previewAlertDeliverable;exports.triggerAlertNow=e.triggerAlertNow;exports.updateAlert=e.updateAlert;exports.updateAlertContextSources=e.updateAlertContextSources;exports.updateAlertQuota=e.updateAlertQuota;exports.useActiveExports=e.useActiveExports;exports.useAddNewFrame=e.useAddNewFrame;exports.useAlertActions=e.useAlertActions;exports.useAlertDeliveries=e.useAlertDeliveries;exports.useAlertDetail=e.useAlertDetail;exports.useAlertDraft=e.useAlertDraft;exports.useAlertFilters=e.useAlertFilters;exports.useAlertHistory=e.useAlertHistory;exports.useAlertQuotas=e.useAlertQuotas;exports.useAlertRuns=e.useAlertRuns;exports.useAlertState=e.useAlertState;exports.useAlertStore=e.useAlertStore;exports.useAlertWizard=e.useAlertWizard;exports.useAlerts=e.useAlerts;exports.useAlertsBootstrap=e.useAlertsBootstrap;exports.useAlertsById=e.useAlertsById;exports.useAlertsForCard=e.useAlertsForCard;exports.useCard=e.useCard;exports.useCardAlertMap=e.useCardAlertMap;exports.useCardSummary=e.useCardSummary;exports.useDashboardById=e.useDashboardById;exports.useDashboardQuery=e.useDashboardQuery;exports.useDashboardSummary=e.useDashboardSummary;exports.useDataColumns=e.useDataColumns;exports.useDateFilterHook=e.useDateFilterHook;exports.useEditorAside=e.useEditorAside;exports.useExportActions=e.useExportActions;exports.useExportStore=e.useExportStore;exports.useInProgressExportsCount=e.useInProgressExportsCount;exports.useManagementStore=e.useManagementStore;exports.useResourceManagement=e.useResourceManagement;exports.useSelectedAlertId=e.useSelectedAlertId;exports.useTextFilterHook=e.useTextFilterHook;exports.CALCULATED_FIELD_ENTITY_MARKER=y.CALCULATED_FIELD_ENTITY_MARKER;exports.CONTROL_CARD_DEFAULT_VALUE=y.CONTROL_CARD_DEFAULT_VALUE;exports.DATE_FORMAT_VALUES=y.DATE_FORMAT_VALUES;exports.EMPTY_SELECTION=y.EMPTY_SELECTION;exports.PivotMarkerEnum=y.PivotMarkerEnum;exports.getFieldRuntimeColumnName=y.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=y.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=y.hasCalculatedFormulaInputs;exports.isCalculatedDimension=y.isCalculatedDimension;exports.isCalculatedField=y.isCalculatedField;exports.isCalculatedMetric=y.isCalculatedMetric;exports.CalendarPreferencesDialog=U.CalendarPreferencesDialog;exports.createEmptyKpiConfig=r.createEmptyKpiConfig;exports.createSqlGenConfig=r.createSqlGenConfig;exports.emitDashboardLoad=r.emitDashboardLoad;exports.emitDashboardUnload=r.emitDashboardUnload;exports.fmt=r.fmt;exports.getColumnDataType=r.getColumnDataType;exports.getFilterValueType=r.getFilterValueType;exports.getFormattedTableNameForQuery=r.getFormattedTableNameForQuery;exports.getQualifiedTableName=r.getQualifiedTableName;exports.getSql=r.getSql;exports.invalidateToken=r.invalidateToken;exports.isBooleanDataType=r.isBooleanDataType;exports.isColumnInSqlGen=r.isColumnInSqlGen;exports.isDateDataType=r.isDateDataType;exports.isNumberDataType=r.isNumberDataType;exports.isTextDataType=r.isTextDataType;exports.resolveDataType=r.resolveDataType;exports.resolveDatamodelName=r.resolveDatamodelName;exports.useCurrentActiveCard=r.useCurrentActiveCard;exports.useCurrentCardConfig=r.useCurrentCardConfig;exports.useCurrentSheetActiveCards=r.useCurrentSheetActiveCards;exports.useDashboardActions=r.useDashboardActions;exports.useDashboardStore=r.useDashboardStore;exports.useEditorActions=r.useEditorActions;exports.useEditorStore=r.useEditorStore;exports.ResourceManagementPanel=z.ResourceManagementPanel;exports.DEFAULT_CALENDAR_CONTEXT=L.DEFAULT_CALENDAR_CONTEXT;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=L.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.useDebouncedDirtyCheck=q.useDebouncedDirtyCheck;exports.AdvancedModeToggle=A.AdvancedModeToggle;exports.DashboardControlsSettings=A.DashboardControlsSettings;exports.DashboardFilterControlsButton=A.DashboardFilterControlsButton;exports.DashboardFilterControlsLauncher=A.DashboardFilterControlsLauncher;exports.DocumentControlsSettings=A.DocumentControlsSettings;exports.ExportNotificationItem=A.ExportNotificationItem;exports.ExportNotificationList=A.ExportNotificationList;exports.NotificationBell=A.NotificationBell;exports.UnsavedChangesAlert=A.UnsavedChangesAlert;exports.VisualEditingControls=A.VisualEditingControls;exports.useExportPolling=A.useExportPolling;exports.useExportRecovery=A.useExportRecovery;exports.normalizeDashboardForDirtyCheck=B.normalizeDashboardForDirtyCheck;exports.serializeDashboardForDirtyCheck=B.serializeDashboardForDirtyCheck;exports.AlertDetailPageEmbedded=J;exports.Combobox=$;exports.ScheduleDashboard=G;exports.TenantQuotaPage=Z;exports.Visual=V;exports.useAlertBacktest=K;exports.useExposePrintState=Y;exports.usePristineSnapshotInitializer=H;