@nivaro/react 0.3.139 → 0.3.140

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 (87) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +36 -2
  4. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  5. package/dist/shared/components/BroadcastView.js +213 -211
  6. package/dist/shared/components/CollectionBrowserView.js +2677 -2658
  7. package/dist/shared/components/ConfigHistory.js +45 -45
  8. package/dist/shared/components/ConformanceView.js +110 -110
  9. package/dist/shared/components/DataTable.js +51 -51
  10. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  11. package/dist/shared/components/ItemEditForm.js +3038 -3027
  12. package/dist/shared/components/LiveCount.js +27 -23
  13. package/dist/shared/components/LiveTraceView.js +62 -61
  14. package/dist/shared/components/PageRenderer.js +422 -410
  15. package/dist/shared/components/ProfileView.js +199 -199
  16. package/dist/shared/components/QualityRulesView.js +70 -70
  17. package/dist/shared/components/QueryTable.js +131 -130
  18. package/dist/shared/components/RecordGraph.js +98 -98
  19. package/dist/shared/components/RecordReadView.js +287 -288
  20. package/dist/shared/components/ReportView.js +1279 -1259
  21. package/dist/shared/components/SlaRulesView.js +73 -74
  22. package/dist/shared/components/WidgetSlot.js +73 -73
  23. package/dist/shared/components/ai/AiChart.js +36 -32
  24. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  25. package/dist/shared/components/ai/TaskDo.js +87 -87
  26. package/dist/shared/components/ai/answer-formats.js +37 -30
  27. package/dist/shared/components/ai/call-log/format.js +17 -16
  28. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  29. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  31. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  32. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  33. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  34. package/dist/shared/components/cbv/column-totals.js +53 -51
  35. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  37. package/dist/shared/components/command-center/announce.js +7 -6
  38. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  39. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  40. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  41. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  42. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  43. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  44. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  45. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  46. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  47. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  48. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  49. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  50. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  51. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  52. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  53. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  54. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  55. package/dist/shared/components/item-edit/InlineTableField.js +1167 -1153
  56. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  57. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  58. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  59. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  60. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  61. package/dist/shared/components/ops-report/format.js +37 -36
  62. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  63. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  64. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  65. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  66. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  67. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  68. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  69. package/dist/shared/components/profile/DelegationCard.js +13 -12
  70. package/dist/shared/components/profile/PersonActivity.js +48 -48
  71. package/dist/shared/components/profile/PersonExtras.js +107 -107
  72. package/dist/shared/components/profile/PersonWeek.js +9 -9
  73. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  74. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  75. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  76. package/dist/shared/components/queue/QueueWorklist.js +671 -670
  77. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  78. package/dist/shared/components/support/RequestList.js +121 -121
  79. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  80. package/dist/shared/lib/activity-sentence.js +251 -229
  81. package/dist/shared/lib/format-value.js +5 -4
  82. package/dist/shared/lib/number-format.js +87 -0
  83. package/dist/shared/lib/number-kind.js +133 -0
  84. package/dist/shared/lib/utils.js +24 -20
  85. package/dist/shared/lib/watch-list.js +1 -1
  86. package/dist/shared/lib/widget-value-format.js +26 -12
  87. package/package.json +1 -1
@@ -1,29 +1,30 @@
1
1
  import { jsx as t, jsxs as h, Fragment as H } from "react/jsx-runtime";
2
- import { useQueryClient as De, useQuery as Y } from "@tanstack/react-query";
3
- import { useMemo as he, useState as T, useEffect as te, createContext as tt, useRef as ee, useCallback as rt, useContext as nt, useDeferredValue as at } from "react";
4
- import { createPortal as lt } from "react-dom";
5
- import { useNivaroClient as re, useItemEditAuth as st, useDrilldown as Ie, useOverlayState as ot, DrilldownContext as it, useItemNavigation as dt } from "../context.js";
6
- import { useDebounced as ct } from "../hooks/useDebounced.js";
2
+ import { useQueryClient as Ie, useQuery as Y } from "@tanstack/react-query";
3
+ import { useMemo as he, useState as j, useEffect as te, createContext as at, useRef as ee, useCallback as lt, useContext as st, useDeferredValue as ot } from "react";
4
+ import { createPortal as it } from "react-dom";
5
+ import { useNivaroClient as re, useItemEditAuth as dt, useDrilldown as ze, useOverlayState as ct, DrilldownContext as ut, useItemNavigation as mt } from "../context.js";
6
+ import { useDebounced as pt } from "../hooks/useDebounced.js";
7
7
  import { get as xe, post as se } from "../lib/commands.js";
8
- import { describeError as ut } from "../lib/error-message.js";
9
- import { liveQueryMeta as mt } from "../lib/live-queries.js";
10
- import { useLiveFade as pt } from "../lib/live-screen.js";
11
- import { visiblePageWidgets as ht } from "../lib/page-widget-access.js";
12
- import { explicitAllUrlParams as xt, initialFilterSelection as ft, filterSelectionToSearch as bt } from "../lib/query-filter-seed.js";
13
- import { userErrorMessage as ze } from "../lib/safe-error.js";
14
- import { safeLinkKind as gt } from "../lib/safe-href.js";
15
- import { resolveSheetDef as yt } from "../lib/sheet-def.js";
16
- import { uniqueByValue as vt } from "../lib/unique-options.js";
17
- import { useMyScopes as kt, matchScopeDimension as Oe, effectiveScopeSeedIds as wt, translateScopeValues as Nt } from "../lib/use-my-scopes.js";
18
- import { titleCase as Q, formatRelative as St, formatNumber as $t } from "../lib/utils.js";
19
- import { LiveCacheStamp as _t } from "./CacheStamp.js";
20
- import { RelationCombobox as Ct } from "./item-edit/RelationCombobox.js";
21
- import { MatrixEditor as fe } from "./MatrixEditor.js";
22
- import { QueryStatStrip as qt } from "./QueryStatStrip.js";
23
- import { QueryTable as jt } from "./QueryTable.js";
24
- import { RecordDrilldownSheet as Tt } from "./RecordDrilldownSheet.js";
25
- import { RecordGridEditor as Ae } from "./RecordGridEditor.js";
26
- import { SheetHeaderBody as Mt } from "./SheetHeaderBody.js";
8
+ import { describeError as ht } from "../lib/error-message.js";
9
+ import { liveQueryMeta as xt } from "../lib/live-queries.js";
10
+ import { useLiveFade as ft } from "../lib/live-screen.js";
11
+ import { formatFieldNumber as fe, formatNumberAs as bt, toFiniteNumber as gt } from "../lib/number-format.js";
12
+ import { visiblePageWidgets as yt } from "../lib/page-widget-access.js";
13
+ import { explicitAllUrlParams as vt, initialFilterSelection as kt, filterSelectionToSearch as wt } from "../lib/query-filter-seed.js";
14
+ import { userErrorMessage as Ke } from "../lib/safe-error.js";
15
+ import { safeLinkKind as Nt } from "../lib/safe-href.js";
16
+ import { resolveSheetDef as St } from "../lib/sheet-def.js";
17
+ import { uniqueByValue as $t } from "../lib/unique-options.js";
18
+ import { useMyScopes as _t, matchScopeDimension as Ae, effectiveScopeSeedIds as Ct, translateScopeValues as qt } from "../lib/use-my-scopes.js";
19
+ import { titleCase as Q, formatRelative as Tt, formatNumber as Qe } from "../lib/utils.js";
20
+ import { LiveCacheStamp as jt } from "./CacheStamp.js";
21
+ import { RelationCombobox as Mt } from "./item-edit/RelationCombobox.js";
22
+ import { MatrixEditor as be } from "./MatrixEditor.js";
23
+ import { QueryStatStrip as Rt } from "./QueryStatStrip.js";
24
+ import { QueryTable as Wt } from "./QueryTable.js";
25
+ import { RecordDrilldownSheet as Pt } from "./RecordDrilldownSheet.js";
26
+ import { RecordGridEditor as Fe } from "./RecordGridEditor.js";
27
+ import { SheetHeaderBody as Lt } from "./SheetHeaderBody.js";
27
28
  const me = 76;
28
29
  function oe() {
29
30
  return /* @__PURE__ */ t("div", { className: "space-y-1.5 p-3", children: [1, 2, 3].map((e) => /* @__PURE__ */ t(
@@ -35,102 +36,110 @@ function oe() {
35
36
  )) });
36
37
  }
37
38
  function ie({ error: e, unresolved: r }) {
38
- const n = zt(e, r) ?? ze(e, "Failed to load widget data");
39
+ const n = Vt(e, r) ?? Ke(e, "Failed to load widget data");
39
40
  return /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center p-3 text-[12px] text-amber-600 dark:text-amber-500", children: n });
40
41
  }
41
- function Rt(e) {
42
+ function Ot(e, r, n) {
42
43
  if (e == null) return "—";
43
44
  if (typeof e == "boolean") return e ? "true" : "false";
44
- const r = String(e);
45
- return r.length > 80 ? `${r.slice(0, 80)}…` : r;
45
+ const a = gt(e);
46
+ if (a != null && n) return Ve(a, n);
47
+ if (typeof e == "number") return fe(e, { field: r }) || String(e);
48
+ const l = String(e);
49
+ return l.length > 80 ? `${l.slice(0, 80)}…` : l;
46
50
  }
47
51
  function pe(e, r) {
48
- const n = [], l = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
49
- return e.split(l).forEach((s, m) => {
50
- const u = `${r}-${m}`;
51
- if (s)
52
- if (s.startsWith("**") && s.endsWith("**"))
53
- n.push(/* @__PURE__ */ t("strong", { children: s.slice(2, -2) }, u));
54
- else if (s.startsWith("*") && s.endsWith("*") && s.length > 2)
55
- n.push(/* @__PURE__ */ t("em", { children: s.slice(1, -1) }, u));
56
- else if (s.startsWith("`") && s.endsWith("`"))
52
+ const n = [], a = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|\[[^\]]+\]\([^)]+\))/g;
53
+ return e.split(a).forEach((l, c) => {
54
+ const m = `${r}-${c}`;
55
+ if (l)
56
+ if (l.startsWith("**") && l.endsWith("**"))
57
+ n.push(/* @__PURE__ */ t("strong", { children: l.slice(2, -2) }, m));
58
+ else if (l.startsWith("*") && l.endsWith("*") && l.length > 2)
59
+ n.push(/* @__PURE__ */ t("em", { children: l.slice(1, -1) }, m));
60
+ else if (l.startsWith("`") && l.endsWith("`"))
57
61
  n.push(
58
62
  /* @__PURE__ */ t(
59
63
  "code",
60
64
  {
61
65
  className: "rounded bg-slate-100 px-1 py-0.5 font-mono text-[0.9em] dark:bg-muted",
62
- children: s.slice(1, -1)
66
+ children: l.slice(1, -1)
63
67
  },
64
- u
68
+ m
65
69
  )
66
70
  );
67
71
  else {
68
- const d = s.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
69
- d && gt(d[2]) !== null ? n.push(
70
- /* @__PURE__ */ t("a", { href: d[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: d[1] }, u)
71
- ) : n.push(s);
72
+ const d = l.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
73
+ d && Nt(d[2]) !== null ? n.push(
74
+ /* @__PURE__ */ t("a", { href: d[2], className: "text-nvr-cyan underline-offset-2 hover:underline", children: d[1] }, m)
75
+ ) : n.push(l);
72
76
  }
73
77
  }), n;
74
78
  }
75
- function Wt({ content: e }) {
79
+ function At({ content: e }) {
76
80
  const r = [];
77
- let n = [], l = [], s = !1;
78
- const m = (d) => {
81
+ let n = [], a = [], l = !1;
82
+ const c = (d) => {
79
83
  n.length && (r.push(
80
84
  /* @__PURE__ */ t("p", { className: "leading-relaxed", children: pe(n.join(" "), d) }, d)
81
85
  ), n = []);
82
- }, u = (d) => {
83
- if (!l.length) return;
84
- const o = l.map((c, x) => /* @__PURE__ */ t("li", { children: pe(c, `${d}-${x}`) }, `${d}-${x}`));
86
+ }, m = (d) => {
87
+ if (!a.length) return;
88
+ const o = a.map((u, x) => /* @__PURE__ */ t("li", { children: pe(u, `${d}-${x}`) }, `${d}-${x}`));
85
89
  r.push(
86
- s ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: o }, d) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: o }, d)
87
- ), l = [];
90
+ l ? /* @__PURE__ */ t("ol", { className: "list-decimal space-y-0.5 pl-5", children: o }, d) : /* @__PURE__ */ t("ul", { className: "list-disc space-y-0.5 pl-5", children: o }, d)
91
+ ), a = [];
88
92
  };
89
93
  return e.split(`
90
94
  `).forEach((d, o) => {
91
- const c = `md-${o}`, x = d.match(/^(#{1,3})\s+(.*)$/), N = d.match(/^[-*]\s+(.*)$/), C = d.match(/^\d+\.\s+(.*)$/);
95
+ const u = `md-${o}`, x = d.match(/^(#{1,3})\s+(.*)$/), S = d.match(/^[-*]\s+(.*)$/), C = d.match(/^\d+\.\s+(.*)$/);
92
96
  if (x) {
93
- u(`${c}-fl`), m(`${c}-fp`);
94
- const S = x[1].length, q = S === 1 ? "text-[17px] font-semibold" : S === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
97
+ m(`${u}-fl`), c(`${u}-fp`);
98
+ const w = x[1].length, q = w === 1 ? "text-[17px] font-semibold" : w === 2 ? "text-[15px] font-semibold" : "text-[13.5px] font-semibold";
95
99
  r.push(
96
- /* @__PURE__ */ t("div", { className: `${q} text-slate-900 dark:text-slate-100`, children: pe(x[2], `${c}-h`) }, c)
100
+ /* @__PURE__ */ t("div", { className: `${q} text-slate-900 dark:text-slate-100`, children: pe(x[2], `${u}-h`) }, u)
97
101
  );
98
- } else if (N || C) {
99
- m(`${c}-fp`);
100
- const S = !!C;
101
- l.length && s !== S && u(`${c}-fl`), s = S, l.push((N == null ? void 0 : N[1]) ?? (C == null ? void 0 : C[1]));
102
- } else d.trim() === "" ? (u(`${c}-fl`), m(`${c}-fp`)) : (u(`${c}-fl`), n.push(d.trim()));
103
- }), u("md-end-l"), m("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
102
+ } else if (S || C) {
103
+ c(`${u}-fp`);
104
+ const w = !!C;
105
+ a.length && l !== w && m(`${u}-fl`), l = w, a.push((S == null ? void 0 : S[1]) ?? (C == null ? void 0 : C[1]));
106
+ } else d.trim() === "" ? (m(`${u}-fl`), c(`${u}-fp`)) : (m(`${u}-fl`), n.push(d.trim()));
107
+ }), m("md-end-l"), c("md-end-p"), /* @__PURE__ */ t("div", { className: "space-y-2 p-4 text-[13px] text-slate-700 dark:text-slate-300", children: r });
104
108
  }
105
- const Ke = tt(null);
106
- function be() {
107
- const e = nt(Ke);
108
- return e ? mt(e) : void 0;
109
+ const Ue = at(null);
110
+ function ge() {
111
+ const e = st(Ue);
112
+ return e ? xt(e) : void 0;
109
113
  }
110
- const Pt = /* @__PURE__ */ new Set(["page-renderer-query", "page-renderer-widget-data"]);
111
- function ge(e, r, n) {
112
- const l = re();
114
+ const Ft = /* @__PURE__ */ new Set(["page-renderer-query", "page-renderer-widget-data"]);
115
+ function Ve(e, r) {
116
+ return bt(e, r.kind, {
117
+ options: { currency: r.currency, precision: r.decimals, unit: r.unit }
118
+ });
119
+ }
120
+ function ye(e, r, n) {
121
+ const a = re();
113
122
  return Y({
114
123
  queryKey: ["page-renderer-widget-data", e, r.id],
115
- queryFn: () => l.request(se(`/pages/${e}/widget-data`, { widget_id: r.id })).then((s) => s.data),
124
+ queryFn: () => a.request(se(`/pages/${e}/widget-data`, { widget_id: r.id })).then((l) => l.data),
116
125
  enabled: n,
117
126
  retry: !1,
118
127
  staleTime: 3e4,
119
- meta: be()
128
+ meta: ge()
120
129
  });
121
130
  }
122
- function Lt({ slug: e, widget: r }) {
123
- var c;
124
- const n = r.config ?? {}, { data: l, isLoading: s, error: m } = ge(e, r, !!n.collection), u = dt();
131
+ function Et({ slug: e, widget: r }) {
132
+ var u;
133
+ const n = r.config ?? {}, { data: a, isLoading: l, error: c } = ye(e, r, !!n.collection), m = mt();
125
134
  if (!n.collection)
126
135
  return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
127
- if (s) return /* @__PURE__ */ t(oe, {});
128
- if (m) return /* @__PURE__ */ t(ie, { error: m });
129
- const d = (l == null ? void 0 : l.rows) ?? [];
136
+ if (l) return /* @__PURE__ */ t(oe, {});
137
+ if (c) return /* @__PURE__ */ t(ie, { error: c });
138
+ const d = (a == null ? void 0 : a.rows) ?? [];
130
139
  if (!d.length) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No records" });
131
- const o = (c = n.columns) != null && c.length ? n.columns : Object.keys(d[0]).filter((x) => {
132
- const N = d[0][x];
133
- return N === null || ["string", "number", "boolean"].includes(typeof N);
140
+ const o = (u = n.columns) != null && u.length ? n.columns : Object.keys(d[0]).filter((x) => {
141
+ const S = d[0][x];
142
+ return S === null || ["string", "number", "boolean"].includes(typeof S);
134
143
  }).slice(0, 5);
135
144
  return /* @__PURE__ */ t("div", { className: "h-full overflow-auto", children: /* @__PURE__ */ h("table", { className: "w-full text-[12px]", children: [
136
145
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100 dark:border-border", children: o.map((x) => /* @__PURE__ */ t(
@@ -141,53 +150,56 @@ function Lt({ slug: e, widget: r }) {
141
150
  },
142
151
  x
143
152
  )) }) }),
144
- /* @__PURE__ */ t("tbody", { children: d.map((x, N) => /* @__PURE__ */ t(
153
+ /* @__PURE__ */ t("tbody", { children: d.map((x, S) => /* @__PURE__ */ t(
145
154
  "tr",
146
155
  {
147
- onClick: x.id != null ? () => u.open({ collection: n.collection, itemId: String(x.id) }) : void 0,
156
+ onClick: x.id != null ? () => m.open({ collection: n.collection, itemId: String(x.id) }) : void 0,
148
157
  className: `border-b border-slate-50 last:border-0 dark:border-border/50 ${x.id != null ? "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/40" : ""}`,
149
- children: o.map((C) => /* @__PURE__ */ t(
150
- "td",
151
- {
152
- className: "whitespace-nowrap px-3 py-1.5 text-slate-700 dark:text-slate-300",
153
- children: Rt(x[C])
154
- },
155
- C
156
- ))
158
+ children: o.map((C) => {
159
+ var w;
160
+ return /* @__PURE__ */ t(
161
+ "td",
162
+ {
163
+ className: "whitespace-nowrap px-3 py-1.5 text-slate-700 dark:text-slate-300",
164
+ children: Ot(x[C], C, (w = a == null ? void 0 : a.numbers) == null ? void 0 : w[C])
165
+ },
166
+ C
167
+ );
168
+ })
157
169
  },
158
- x.id != null ? `${x.id}-${N}` : N
170
+ x.id != null ? `${x.id}-${S}` : S
159
171
  )) })
160
172
  ] }) });
161
173
  }
162
- function Ot({ slug: e, widget: r }) {
163
- const n = r.config ?? {}, { data: l, isLoading: s, error: m } = ge(e, r, !!n.collection);
164
- return n.collection ? m ? /* @__PURE__ */ t(ie, { error: m }) : /* @__PURE__ */ h("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
165
- s ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (l == null ? void 0 : l.value) != null ? $t(Number(l.value)) : "—" }),
174
+ function Bt({ slug: e, widget: r }) {
175
+ const n = r.config ?? {}, { data: a, isLoading: l, error: c } = ye(e, r, !!n.collection);
176
+ return n.collection ? c ? /* @__PURE__ */ t(ie, { error: c }) : /* @__PURE__ */ h("div", { className: "flex h-full flex-col items-start justify-center px-4", children: [
177
+ l ? /* @__PURE__ */ t("div", { className: "h-9 w-24 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("span", { className: "text-[32px] font-semibold leading-none tracking-tight text-slate-900 dark:text-slate-100", children: (a == null ? void 0 : a.value) != null ? a.number ? Ve(Number(a.value), a.number) : Qe(Number(a.value)) : "—" }),
166
178
  /* @__PURE__ */ t("span", { className: "mt-1.5 text-[12px] text-slate-400", children: n.label || `${n.aggregate ?? "count"} of ${n.collection}` })
167
179
  ] }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Select a collection" });
168
180
  }
169
- function At({ slug: e, widget: r }) {
170
- const { data: n, isLoading: l, error: s } = ge(e, r, !0);
171
- if (l) return /* @__PURE__ */ t(oe, {});
172
- if (s) return /* @__PURE__ */ t(ie, { error: s });
173
- const m = (n == null ? void 0 : n.rows) ?? [];
174
- return m.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: m.map((u) => /* @__PURE__ */ h(
181
+ function Dt({ slug: e, widget: r }) {
182
+ const { data: n, isLoading: a, error: l } = ye(e, r, !0);
183
+ if (a) return /* @__PURE__ */ t(oe, {});
184
+ if (l) return /* @__PURE__ */ t(ie, { error: l });
185
+ const c = (n == null ? void 0 : n.rows) ?? [];
186
+ return c.length ? /* @__PURE__ */ t("div", { className: "h-full overflow-auto px-3 py-1.5", children: c.map((m) => /* @__PURE__ */ h(
175
187
  "div",
176
188
  {
177
189
  className: "flex items-center gap-2 border-b border-slate-50 py-1.5 text-[12px] last:border-0 dark:border-border/50",
178
190
  children: [
179
- /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: u.action }),
180
- u.collection && /* @__PURE__ */ h("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
181
- u.collection,
182
- u.item ? ` · ${u.item}` : ""
191
+ /* @__PURE__ */ t("span", { className: "font-medium text-slate-700 dark:text-slate-300", children: m.action }),
192
+ m.collection && /* @__PURE__ */ h("span", { className: "truncate font-mono text-[11px] text-slate-400", children: [
193
+ m.collection,
194
+ m.item ? ` · ${m.item}` : ""
183
195
  ] }),
184
- /* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: St(u.timestamp) })
196
+ /* @__PURE__ */ t("span", { className: "ml-auto shrink-0 text-[11px] text-slate-400", children: Tt(m.timestamp) })
185
197
  ]
186
198
  },
187
- u.id
199
+ m.id
188
200
  )) }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "No activity" });
189
201
  }
190
- function Ft({ widget: e }) {
202
+ function It({ widget: e }) {
191
203
  var n;
192
204
  const r = String(((n = e.config) == null ? void 0 : n.url) ?? "");
193
205
  return r ? /^https?:\/\//i.test(r) ? /* @__PURE__ */ t(
@@ -200,123 +212,123 @@ function Ft({ widget: e }) {
200
212
  }
201
213
  ) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-amber-600", children: "URL must start with http(s)://" }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set an iframe URL" });
202
214
  }
203
- function Qe({
215
+ function Ge({
204
216
  config: e,
205
217
  initialScope: r,
206
218
  width: n,
207
- title: l,
208
- onClose: s
219
+ title: a,
220
+ onClose: l
209
221
  }) {
210
- const m = typeof n == "number" ? `${n}px` : n ?? "85%";
211
- return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: s, children: /* @__PURE__ */ h(
222
+ const c = typeof n == "number" ? `${n}px` : n ?? "85%";
223
+ return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */ h(
212
224
  "div",
213
225
  {
214
226
  "data-page-drawer": !0,
215
227
  className: "flex h-full flex-col border-l border-slate-200 max-sm:!w-full max-sm:!max-w-full max-sm:border-l-0 bg-white shadow-2xl dark:border-border dark:bg-background",
216
- style: { width: m, maxWidth: "96%" },
217
- onClick: (u) => u.stopPropagation(),
228
+ style: { width: c, maxWidth: "96%" },
229
+ onClick: (m) => m.stopPropagation(),
218
230
  children: [
219
231
  /* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
220
- /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: l ?? e.title ?? "Manage" }),
232
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: a ?? e.title ?? "Manage" }),
221
233
  /* @__PURE__ */ t(
222
234
  "button",
223
235
  {
224
236
  type: "button",
225
- onClick: s,
237
+ onClick: l,
226
238
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
227
239
  children: "Close"
228
240
  }
229
241
  )
230
242
  ] }),
231
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(fe, { config: e, initialScope: r }) })
243
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(be, { config: e, initialScope: r }) })
232
244
  ]
233
245
  }
234
246
  ) });
235
247
  }
236
- function Et({ widget: e }) {
237
- const r = e.config ?? {}, [n, l] = T(!1);
248
+ function zt({ widget: e }) {
249
+ const r = e.config ?? {}, [n, a] = j(!1);
238
250
  return !r.target_collection || !r.option_collection || !r.key_field || !r.value_field ? /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Matrix editor not configured" }) : r.display === "drawer" ? /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
239
251
  /* @__PURE__ */ t(
240
252
  "button",
241
253
  {
242
254
  type: "button",
243
- onClick: () => l(!0),
255
+ onClick: () => a(!0),
244
256
  className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
245
257
  children: r.button_label ?? r.title ?? "Manage"
246
258
  }
247
259
  ),
248
260
  n && /* @__PURE__ */ t(
249
- Qe,
261
+ Ge,
250
262
  {
251
263
  config: r,
252
264
  width: r.sheet_width,
253
- onClose: () => l(!1)
265
+ onClose: () => a(!1)
254
266
  }
255
267
  )
256
- ] }) : /* @__PURE__ */ t(fe, { config: r });
268
+ ] }) : /* @__PURE__ */ t(be, { config: r });
257
269
  }
258
- function Bt(e) {
259
- return ft(
270
+ function Kt(e) {
271
+ return kt(
260
272
  e,
261
273
  typeof window > "u" ? "" : window.location.search
262
274
  );
263
275
  }
264
- function Fe(e, r) {
265
- const n = [...new Set(e.map((l) => l[r]).filter((l) => l != null && l !== ""))];
276
+ function Ee(e, r) {
277
+ const n = [...new Set(e.map((a) => a[r]).filter((a) => a != null && a !== ""))];
266
278
  return n.length ? n.map(String).join(",") : void 0;
267
279
  }
268
- function Ue(e, r, n, l, s, m, u) {
280
+ function Je(e, r, n, a, l, c, m) {
269
281
  if (typeof e != "string") return e;
270
282
  if (e.startsWith("$row.")) {
271
283
  const d = e.slice(5);
272
- return !r && u ? Fe(u, d) : r == null ? void 0 : r[d];
284
+ return !r && m ? Ee(m, d) : r == null ? void 0 : r[d];
273
285
  }
274
- if (e.startsWith("$rows.")) return Fe(n, e.slice(6));
275
- if (e.startsWith("$param.")) return l[e.slice(7)];
286
+ if (e.startsWith("$rows.")) return Ee(n, e.slice(6));
287
+ if (e.startsWith("$param.")) return a[e.slice(7)];
276
288
  if (e.startsWith("$filters.")) {
277
- const d = e.slice(9), o = m == null ? void 0 : m.find((x) => x.param === d), c = s[d] ?? [];
278
- return c.length ? c.map((x) => String(x[(o == null ? void 0 : o.value_field) ?? "id"] ?? "")).join(",") : void 0;
289
+ const d = e.slice(9), o = c == null ? void 0 : c.find((x) => x.param === d), u = l[d] ?? [];
290
+ return u.length ? u.map((x) => String(x[(o == null ? void 0 : o.value_field) ?? "id"] ?? "")).join(",") : void 0;
279
291
  }
280
292
  return e;
281
293
  }
282
- function Dt(e, r, n, l, s, m, u) {
294
+ function Qt(e, r, n, a, l, c, m) {
283
295
  const d = {}, o = [];
284
- for (const [c, x] of Object.entries(e.params ?? {})) {
285
- const N = Ue(x, r, n, l, s, m, u);
286
- N !== void 0 ? d[c] = N : typeof x == "string" && (x.startsWith("$row.") || x.startsWith("$rows.")) && o.push(c);
296
+ for (const [u, x] of Object.entries(e.params ?? {})) {
297
+ const S = Je(x, r, n, a, l, c, m);
298
+ S !== void 0 ? d[u] = S : typeof x == "string" && (x.startsWith("$row.") || x.startsWith("$rows.")) && o.push(u);
287
299
  }
288
300
  return { ...e, params: d, ...o.length ? { unresolved_params: o } : {} };
289
301
  }
290
- function It(e, r) {
291
- var s, m;
292
- let n = (s = e.row_noun) == null ? void 0 : s.trim();
302
+ function Ut(e, r) {
303
+ var l, c;
304
+ let n = (l = e.row_noun) == null ? void 0 : l.trim();
293
305
  if (!n) {
294
- const u = (m = /\{\{\s*([a-z]+)_[\w.]*\s*\}\}/i.exec(e.title ?? "")) == null ? void 0 : m[1];
295
- n = u ? `${u.toLowerCase()}s` : "rows";
306
+ const m = (c = /\{\{\s*([a-z]+)_[\w.]*\s*\}\}/i.exec(e.title ?? "")) == null ? void 0 : c[1];
307
+ n = m ? `${m.toLowerCase()}s` : "rows";
296
308
  }
297
- const l = r === 1 && n.endsWith("s") ? n.slice(0, -1) : n;
298
- return `Total of ${r.toLocaleString("en-US")} ${l}`;
309
+ const a = r === 1 && n.endsWith("s") ? n.slice(0, -1) : n;
310
+ return `Total of ${r.toLocaleString("en-US")} ${a}`;
299
311
  }
300
- function zt(e, r) {
301
- const n = ut(e), l = [n.title, n.technical ?? ""].join(" "), s = /Missing required parameter:\s*([\w]+)/i.exec(l);
302
- if (!s) return null;
303
- const m = Q(s[1]).toLowerCase();
304
- return r != null && r.includes(s[1]) ? `Nothing to show: the row you opened has no ${m}.` : `Choose ${m} to see this view.`;
312
+ function Vt(e, r) {
313
+ const n = ht(e), a = [n.title, n.technical ?? ""].join(" "), l = /Missing required parameter:\s*([\w]+)/i.exec(a);
314
+ if (!l) return null;
315
+ const c = Q(l[1]).toLowerCase();
316
+ return r != null && r.includes(l[1]) ? `Nothing to show: the row you opened has no ${c}.` : `Choose ${c} to see this view.`;
305
317
  }
306
- function Kt({
318
+ function Gt({
307
319
  config: e,
308
320
  stats: r,
309
321
  asOf: n,
310
- note: l
322
+ note: a
311
323
  }) {
312
- const s = re(), m = be(), u = e.params ?? {}, { data: d, isPending: o, isError: c } = Y({
313
- queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(u)],
314
- queryFn: () => s.request(
315
- se(`/custom-queries/${e.query_slug}/execute`, { params: u })
324
+ const l = re(), c = ge(), m = e.params ?? {}, { data: d, isPending: o, isError: u } = Y({
325
+ queryKey: ["page-renderer-query", e.query_slug, JSON.stringify(m)],
326
+ queryFn: () => l.request(
327
+ se(`/custom-queries/${e.query_slug}/execute`, { params: m })
316
328
  ),
317
329
  enabled: !!e.query_slug,
318
330
  staleTime: 6e4,
319
- meta: m
331
+ meta: c
320
332
  });
321
333
  return /* @__PURE__ */ t(
322
334
  "div",
@@ -324,64 +336,64 @@ function Kt({
324
336
  className: "shrink-0 border-b border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card",
325
337
  "data-sheet-header": !0,
326
338
  children: /* @__PURE__ */ t(
327
- Mt,
339
+ Lt,
328
340
  {
329
341
  stats: r,
330
342
  rows: (d == null ? void 0 : d.data) ?? [],
331
- params: u,
332
- loading: o && !c,
333
- error: c,
343
+ params: m,
344
+ loading: o && !u,
345
+ error: u,
334
346
  asOf: n,
335
- note: l
347
+ note: a
336
348
  }
337
349
  )
338
350
  }
339
351
  );
340
352
  }
341
- function Qt({
353
+ function Jt({
342
354
  def: e,
343
355
  row: r,
344
356
  totalCount: n,
345
- onClose: l
357
+ onClose: a
346
358
  }) {
347
- const [s, m] = T(e.initialTab ?? 0), u = !r && n != null ? It(e, n) : e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (c, x) => {
348
- const N = r == null ? void 0 : r[x];
349
- return N == null ? "" : String(N);
350
- }) : "Details", d = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", o = e.resolvedTabs[s];
351
- return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: l, children: /* @__PURE__ */ h(
359
+ const [l, c] = j(e.initialTab ?? 0), m = !r && n != null ? Ut(e, n) : e.title ? e.title.replace(/\{\{\s*([\w.]+)\s*\}\}/g, (u, x) => {
360
+ const S = r == null ? void 0 : r[x];
361
+ return S == null ? "" : String(S);
362
+ }) : "Details", d = typeof e.width == "number" ? `${e.width}px` : e.width ?? "90%", o = e.resolvedTabs[l];
363
+ return /* @__PURE__ */ t("div", { className: "fixed inset-0 z-50 flex justify-end bg-black/30", onClick: a, children: /* @__PURE__ */ h(
352
364
  "div",
353
365
  {
354
366
  "data-page-drawer": !0,
355
367
  className: "flex h-full flex-col border-l border-slate-200 max-sm:!w-full max-sm:!max-w-full max-sm:border-l-0 bg-slate-50 shadow-2xl dark:border-border dark:bg-background",
356
368
  style: { width: d, maxWidth: "96%" },
357
- onClick: (c) => c.stopPropagation(),
369
+ onClick: (u) => u.stopPropagation(),
358
370
  children: [
359
371
  /* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
360
372
  /* @__PURE__ */ h("div", { className: "flex items-center gap-3", children: [
361
- /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: u }),
362
- e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((c, x) => /* @__PURE__ */ t(
373
+ /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: m }),
374
+ e.resolvedTabs.length > 1 && /* @__PURE__ */ t("div", { className: "flex gap-1", children: e.resolvedTabs.map((u, x) => /* @__PURE__ */ t(
363
375
  "button",
364
376
  {
365
377
  type: "button",
366
- onClick: () => m(x),
367
- className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${x === s ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
368
- children: c.label
378
+ onClick: () => c(x),
379
+ className: `rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors ${x === l ? "bg-nvr-cyan/10 text-slate-800 dark:text-slate-100" : "text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"}`,
380
+ children: u.label
369
381
  },
370
- c.label
382
+ u.label
371
383
  )) })
372
384
  ] }),
373
385
  /* @__PURE__ */ t(
374
386
  "button",
375
387
  {
376
388
  type: "button",
377
- onClick: l,
389
+ onClick: a,
378
390
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
379
391
  children: "Close"
380
392
  }
381
393
  )
382
394
  ] }),
383
395
  e.header && /* @__PURE__ */ t(
384
- Kt,
396
+ Gt,
385
397
  {
386
398
  config: e.header.config,
387
399
  stats: e.header.stats,
@@ -390,13 +402,13 @@ function Qt({
390
402
  }
391
403
  ),
392
404
  /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: o != null && o.matrix ? /* @__PURE__ */ t(
393
- fe,
405
+ be,
394
406
  {
395
407
  config: o.matrix.config,
396
408
  initialScope: o.matrix.initialScope,
397
409
  lockScope: !0
398
410
  },
399
- s
411
+ l
400
412
  ) : o != null && o.config ? /* @__PURE__ */ h(H, { children: [
401
413
  o.note && /* @__PURE__ */ t(
402
414
  "p",
@@ -406,72 +418,72 @@ function Qt({
406
418
  children: o.note
407
419
  }
408
420
  ),
409
- /* @__PURE__ */ t(Ve, { config: o.config }, s)
421
+ /* @__PURE__ */ t(He, { config: o.config }, l)
410
422
  ] }) : /* @__PURE__ */ t("p", { className: "p-4 text-[12px] text-slate-400", children: "Sheet not configured" }) })
411
423
  ]
412
424
  }
413
425
  ) });
414
426
  }
415
- function Ut(e, r, n, l) {
427
+ function Ht(e, r, n, a) {
416
428
  if (!e) return;
417
- const s = (o) => {
418
- const c = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(o);
419
- if (!c) return;
420
- const x = l == null ? void 0 : l.find((S) => S.param === c[1]), N = (n == null ? void 0 : n[c[1]]) ?? [];
421
- if (N.length === 0) return;
422
- const C = c[2] ?? (x == null ? void 0 : x.value_field) ?? "id";
423
- return N.map((S) => S[C]);
424
- }, m = (o) => typeof o == "string" && o.startsWith("$row.") ? r[o.slice(5)] : typeof o == "string" && o.startsWith("$filters.") ? s(o) : Array.isArray(o) ? o.map(m) : o && typeof o == "object" ? Object.fromEntries(
425
- Object.entries(o).map(([c, x]) => [c, m(x)])
426
- ) : o, u = (o) => o === void 0 ? !0 : Array.isArray(o) ? o.some(u) : o && typeof o == "object" ? Object.values(o).some(u) : !1, d = m(e);
427
- return Array.isArray(d._and) && (d._and = d._and.filter((o) => !u(o))), u(d) ? void 0 : d;
429
+ const l = (o) => {
430
+ const u = /^\$filters\.(\w+)(?:\.(\w+))?$/.exec(o);
431
+ if (!u) return;
432
+ const x = a == null ? void 0 : a.find((w) => w.param === u[1]), S = (n == null ? void 0 : n[u[1]]) ?? [];
433
+ if (S.length === 0) return;
434
+ const C = u[2] ?? (x == null ? void 0 : x.value_field) ?? "id";
435
+ return S.map((w) => w[C]);
436
+ }, c = (o) => typeof o == "string" && o.startsWith("$row.") ? r[o.slice(5)] : typeof o == "string" && o.startsWith("$filters.") ? l(o) : Array.isArray(o) ? o.map(c) : o && typeof o == "object" ? Object.fromEntries(
437
+ Object.entries(o).map(([u, x]) => [u, c(x)])
438
+ ) : o, m = (o) => o === void 0 ? !0 : Array.isArray(o) ? o.some(m) : o && typeof o == "object" ? Object.values(o).some(m) : !1, d = c(e);
439
+ return Array.isArray(d._and) && (d._and = d._and.filter((o) => !m(o))), m(d) ? void 0 : d;
428
440
  }
429
- const Vt = 400, Gt = 2500;
430
- function Ee(e, r) {
441
+ const Yt = 400, Xt = 2500;
442
+ function Be(e, r) {
431
443
  return e.map((n) => String(n[r] ?? "")).sort().join("\0");
432
444
  }
433
- function Jt({
445
+ function Zt({
434
446
  filter: e,
435
447
  selected: r,
436
448
  onChange: n,
437
- allowedIds: l,
438
- scopeDefault: s,
439
- onOpenChange: m
449
+ allowedIds: a,
450
+ scopeDefault: l,
451
+ onOpenChange: c
440
452
  }) {
441
- const u = re(), [d, o] = T(!1), c = ee(m);
442
- c.current = m, te(() => {
453
+ const m = re(), [d, o] = j(!1), u = ee(c);
454
+ u.current = c, te(() => {
443
455
  var f;
444
- (f = c.current) == null || f.call(c, d);
456
+ (f = u.current) == null || f.call(u, d);
445
457
  }, [d]);
446
- const [x, N] = T(""), C = ee(null), S = e.value_field ?? "id", q = e.label_field ?? S, v = e.secondary_field, j = [.../* @__PURE__ */ new Set(["id", S, q, v ?? ""])].filter(Boolean).join(","), { data: W } = Y({
458
+ const [x, S] = j(""), C = ee(null), w = e.value_field ?? "id", q = e.label_field ?? w, v = e.secondary_field, T = [.../* @__PURE__ */ new Set(["id", w, q, v ?? ""])].filter(Boolean).join(","), { data: W } = Y({
447
459
  queryKey: [
448
460
  "page-renderer-filter",
449
461
  e.collection,
450
- S,
462
+ w,
451
463
  q,
452
464
  v ?? "",
453
465
  e.sort
454
466
  ],
455
- queryFn: () => u.request(
467
+ queryFn: () => m.request(
456
468
  xe(`/items/${e.collection}`, {
457
- fields: j,
469
+ fields: T,
458
470
  limit: e.limit ?? 500,
459
471
  ...e.sort ? { sort: e.sort } : {}
460
472
  })
461
473
  ).then((f) => {
462
- const a = f.data ?? [], g = typeof f.total == "number" && f.total > a.length || a.length >= (e.limit ?? 500);
463
- return { rows: a, more: g };
474
+ const s = f.data ?? [], g = typeof f.total == "number" && f.total > s.length || s.length >= (e.limit ?? 500);
475
+ return { rows: s, more: g };
464
476
  }),
465
477
  staleTime: 6e4
466
- }), U = (W == null ? void 0 : W.rows) ?? [], L = (W == null ? void 0 : W.more) === !0, $ = x.trim(), R = at($), { data: I = [] } = Y({
467
- queryKey: ["page-renderer-filter-search", e.collection, j, R],
478
+ }), U = (W == null ? void 0 : W.rows) ?? [], L = (W == null ? void 0 : W.more) === !0, $ = x.trim(), R = ot($), { data: I = [] } = Y({
479
+ queryKey: ["page-renderer-filter-search", e.collection, T, R],
468
480
  enabled: L && R.length > 0,
469
- queryFn: () => u.request(
481
+ queryFn: () => m.request(
470
482
  xe(`/items/${e.collection}`, {
471
- fields: j,
483
+ fields: T,
472
484
  limit: 100,
473
485
  search: R,
474
- search_fields: [.../* @__PURE__ */ new Set([S, q, v ?? ""])].filter(Boolean).join(","),
486
+ search_fields: [.../* @__PURE__ */ new Set([w, q, v ?? ""])].filter(Boolean).join(","),
475
487
  ...e.sort ? { sort: e.sort } : {}
476
488
  })
477
489
  ).then((f) => f.data ?? []),
@@ -479,21 +491,21 @@ function Jt({
479
491
  });
480
492
  te(() => {
481
493
  if (!d) return;
482
- const f = (a) => {
483
- C.current && !C.current.contains(a.target) && o(!1);
494
+ const f = (s) => {
495
+ C.current && !C.current.contains(s.target) && o(!1);
484
496
  };
485
497
  return window.addEventListener("mousedown", f), () => window.removeEventListener("mousedown", f);
486
498
  }, [d]);
487
- const K = e.label ?? Q(e.param), z = L && $ ? [...r, ...I] : U, E = vt(
488
- l != null && l.length ? z.filter((f) => l.some((a) => String(a) === String(f.id))) : z,
489
- (f) => String(f[S] ?? "")
490
- ), O = (f) => [f[S], f[q], v ? f[v] : null].filter((a) => a != null && a !== "").join(" ").toLowerCase(), V = E.filter(
499
+ const K = e.label ?? Q(e.param), z = L && $ ? [...r, ...I] : U, E = $t(
500
+ a != null && a.length ? z.filter((f) => a.some((s) => String(s) === String(f.id))) : z,
501
+ (f) => String(f[w] ?? "")
502
+ ), O = (f) => [f[w], f[q], v ? f[v] : null].filter((s) => s != null && s !== "").join(" ").toLowerCase(), V = E.filter(
491
503
  (f) => $ ? O(f).includes($.toLowerCase()) : !0
492
- ), G = L && $.length > 0 && R !== $, B = l != null && l.length ? {
504
+ ), G = L && $.length > 0 && R !== $, B = a != null && a.length ? {
493
505
  label: "restricted",
494
506
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
495
- title: `Options limited to your restricted ${K} scope${s ? "; selection seeded from your defaults" : ""}`
496
- } : s && r.length > 0 ? {
507
+ title: `Options limited to your restricted ${K} scope${l ? "; selection seeded from your defaults" : ""}`
508
+ } : l && r.length > 0 ? {
497
509
  label: "your default",
498
510
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
499
511
  title: `Pre-selected from your default ${K} scope — adjust freely`
@@ -515,7 +527,7 @@ function Jt({
515
527
  children: B.label
516
528
  }
517
529
  ),
518
- /* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][q] ?? r[0][S] ?? "") : `${r.length} selected` }),
530
+ /* @__PURE__ */ t("span", { className: "text-slate-400", children: r.length === 0 ? "All" : r.length === 1 ? String(r[0][q] ?? r[0][w] ?? "") : `${r.length} selected` }),
519
531
  /* @__PURE__ */ t("span", { className: "text-slate-400", children: "⌃" })
520
532
  ]
521
533
  }
@@ -525,7 +537,7 @@ function Jt({
525
537
  "input",
526
538
  {
527
539
  value: x,
528
- onChange: (f) => N(f.target.value),
540
+ onChange: (f) => S(f.target.value),
529
541
  placeholder: "Search…",
530
542
  className: "mb-1 h-7 w-full rounded border border-slate-200 bg-white px-2 text-[12px] outline-none dark:border-border dark:bg-background"
531
543
  }
@@ -541,7 +553,7 @@ function Jt({
541
553
  }
542
554
  ),
543
555
  V.map((f) => {
544
- const a = String(f[S] ?? ""), g = r.some((P) => String(P[S] ?? "") === a);
556
+ const s = String(f[w] ?? ""), g = r.some((P) => String(P[w] ?? "") === s);
545
557
  return /* @__PURE__ */ h(
546
558
  "button",
547
559
  {
@@ -552,17 +564,17 @@ function Jt({
552
564
  return;
553
565
  }
554
566
  n(
555
- g ? r.filter((P) => String(P[S] ?? "") !== a) : [...r, f]
567
+ g ? r.filter((P) => String(P[w] ?? "") !== s) : [...r, f]
556
568
  );
557
569
  },
558
570
  className: "flex w-full items-center gap-2 rounded px-2 py-1 text-left text-[12px] text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-muted",
559
571
  children: [
560
572
  /* @__PURE__ */ t("span", { className: `w-3.5 shrink-0 text-nvr-cyan ${g ? "" : "invisible"}`, children: "✓" }),
561
- /* @__PURE__ */ t("span", { className: "truncate", children: String(f[q] ?? a) }),
573
+ /* @__PURE__ */ t("span", { className: "truncate", children: String(f[q] ?? s) }),
562
574
  v && f[v] != null && f[v] !== "" && /* @__PURE__ */ t("span", { className: "min-w-0 truncate text-[11px] text-slate-400", children: String(f[v]) })
563
575
  ]
564
576
  },
565
- a
577
+ s
566
578
  );
567
579
  }),
568
580
  V.length === 0 && /* @__PURE__ */ t("p", { className: "px-2 py-1.5 text-[12px] text-slate-400", "aria-live": "polite", children: G ? "Searching…" : $ ? `No matches for “${$}”` : "No options" }),
@@ -575,17 +587,17 @@ function Jt({
575
587
  ] })
576
588
  ] });
577
589
  }
578
- function Ht({ widget: e }) {
579
- return /* @__PURE__ */ t(Ve, { config: e.config ?? {} });
590
+ function er({ widget: e }) {
591
+ return /* @__PURE__ */ t(He, { config: e.config ?? {} });
580
592
  }
581
- function Yt({ widget: e }) {
582
- const r = e.config ?? {}, [n, l] = T(!1);
593
+ function tr({ widget: e }) {
594
+ const r = e.config ?? {}, [n, a] = j(!1);
583
595
  return r.collection ? r.display === "drawer" ? /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
584
596
  /* @__PURE__ */ t(
585
597
  "button",
586
598
  {
587
599
  type: "button",
588
- onClick: () => l(!0),
600
+ onClick: () => a(!0),
589
601
  className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-md border border-slate-200 bg-white px-3 text-[12.5px] font-medium text-slate-700 shadow-sm transition-colors hover:border-nvr-cyan hover:text-nvr-navy dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
590
602
  children: r.button_label ?? r.title ?? "Manage"
591
603
  }
@@ -594,7 +606,7 @@ function Yt({ widget: e }) {
594
606
  "div",
595
607
  {
596
608
  className: "fixed inset-0 z-50 flex justify-end bg-black/30",
597
- onClick: () => l(!1),
609
+ onClick: () => a(!1),
598
610
  children: /* @__PURE__ */ h(
599
611
  "div",
600
612
  {
@@ -604,7 +616,7 @@ function Yt({ widget: e }) {
604
616
  width: typeof r.sheet_width == "number" ? `${r.sheet_width}px` : r.sheet_width ?? "92%",
605
617
  maxWidth: "96%"
606
618
  },
607
- onClick: (s) => s.stopPropagation(),
619
+ onClick: (l) => l.stopPropagation(),
608
620
  children: [
609
621
  /* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
610
622
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: r.button_label ?? r.title ?? "Manage" }),
@@ -612,25 +624,25 @@ function Yt({ widget: e }) {
612
624
  "button",
613
625
  {
614
626
  type: "button",
615
- onClick: () => l(!1),
627
+ onClick: () => a(!1),
616
628
  className: "rounded px-2 py-1 text-[12px] text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
617
629
  children: "Close"
618
630
  }
619
631
  )
620
632
  ] }),
621
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ae, { config: r }) })
633
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Fe, { config: r }) })
622
634
  ]
623
635
  }
624
636
  )
625
637
  }
626
638
  )
627
- ] }) : /* @__PURE__ */ t(Ae, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
639
+ ] }) : /* @__PURE__ */ t(Fe, { config: r }) : /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Configure the record grid (collection)" });
628
640
  }
629
- function Xt({
641
+ function rr({
630
642
  cfg: e
631
643
  }) {
632
- const [r, n] = T(!1), l = { ...e };
633
- return delete l.display, /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
644
+ const [r, n] = j(!1), a = { ...e };
645
+ return delete a.display, /* @__PURE__ */ h("div", { className: "flex h-full items-center", children: [
634
646
  /* @__PURE__ */ t(
635
647
  "button",
636
648
  {
@@ -654,7 +666,7 @@ function Xt({
654
666
  width: typeof e.sheet_width == "number" ? `${e.sheet_width}px` : e.sheet_width ?? "90%",
655
667
  maxWidth: "96%"
656
668
  },
657
- onClick: (s) => s.stopPropagation(),
669
+ onClick: (l) => l.stopPropagation(),
658
670
  children: [
659
671
  /* @__PURE__ */ h("div", { className: "flex shrink-0 items-center justify-between border-b border-slate-200 bg-white px-4 py-2.5 dark:border-border dark:bg-card", children: [
660
672
  /* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: e.button_label ?? e.label ?? "View" }),
@@ -668,7 +680,7 @@ function Xt({
668
680
  }
669
681
  )
670
682
  ] }),
671
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ge, { config: l }) })
683
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ t(Ye, { config: a }) })
672
684
  ]
673
685
  }
674
686
  )
@@ -676,40 +688,40 @@ function Xt({
676
688
  )
677
689
  ] });
678
690
  }
679
- function Ve({ config: e }) {
680
- return e.display === "drawer" ? /* @__PURE__ */ t(Xt, { cfg: e }) : /* @__PURE__ */ t(Ge, { config: e });
691
+ function He({ config: e }) {
692
+ return e.display === "drawer" ? /* @__PURE__ */ t(rr, { cfg: e }) : /* @__PURE__ */ t(Ye, { config: e });
681
693
  }
682
- function Ge({ config: e }) {
683
- var _e, Ce, qe, je, Te, Me, Re, We, Pe, Le;
684
- const r = re(), n = Ie(), [l, s] = T(null), [m, u] = T(null), [d, o] = T(null), [c, x] = T(
685
- () => Bt(e.filters)
686
- ), [N] = T(
687
- () => xt(e.filters, typeof window > "u" ? "" : window.location.search)
694
+ function Ye({ config: e }) {
695
+ var Ce, qe, Te, je, Me, Re, We, Pe, Le, Oe;
696
+ const r = re(), n = ze(), [a, l] = j(null), [c, m] = j(null), [d, o] = j(null), [u, x] = j(
697
+ () => Kt(e.filters)
698
+ ), [S] = j(
699
+ () => vt(e.filters, typeof window > "u" ? "" : window.location.search)
688
700
  ), C = (i, p) => {
689
- const b = { ...c, [i]: p };
701
+ const b = { ...u, [i]: p };
690
702
  if (x(b), typeof window > "u" || !(e.filters ?? []).some((k) => k.url_param)) return;
691
- const y = bt(e.filters, b, window.location.search);
703
+ const y = wt(e.filters, b, window.location.search);
692
704
  y !== window.location.search && window.history.replaceState(
693
705
  window.history.state,
694
706
  "",
695
707
  `${window.location.pathname}${y}${window.location.hash}`
696
708
  );
697
- }, [S, q] = T(null), [v, j] = T(null), W = (v == null ? void 0 : v.phase) === "running", U = De(), L = be();
709
+ }, [w, q] = j(null), [v, T] = j(null), W = (v == null ? void 0 : v.phase) === "running", U = Ie(), L = ge();
698
710
  te(() => {
699
711
  if ((v == null ? void 0 : v.phase) !== "running") return;
700
712
  const i = window.setInterval(() => {
701
- j(
713
+ T(
702
714
  (p) => (p == null ? void 0 : p.phase) === "running" ? { ...p, elapsedMs: Date.now() - p.startedAt } : p
703
715
  );
704
716
  }, 250);
705
717
  return () => window.clearInterval(i);
706
718
  }, [v == null ? void 0 : v.phase]);
707
- const { scopes: $, ready: R } = kt(), I = ee(!1), [K, z] = T(!1), [E, O] = T(/* @__PURE__ */ new Map());
719
+ const { scopes: $, ready: R } = _t(), I = ee(!1), [K, z] = j(!1), [E, O] = j(/* @__PURE__ */ new Map());
708
720
  te(() => {
709
721
  if (I.current || !R) return;
710
722
  I.current = !0;
711
723
  const i = (e.filters ?? []).filter(
712
- (p) => !(c[p.param] ?? []).length && !N.has(p.param)
724
+ (p) => !(u[p.param] ?? []).length && !S.has(p.param)
713
725
  );
714
726
  if (!$ || !i.length) {
715
727
  z(!0);
@@ -719,11 +731,11 @@ function Ge({ config: e }) {
719
731
  try {
720
732
  const p = {};
721
733
  for (const b of i) {
722
- const y = Oe($, { key: b.param, collection: b.collection });
734
+ const y = Ae($, { key: b.param, collection: b.collection });
723
735
  if (!y) continue;
724
- const k = wt($, y.name);
736
+ const k = Ct($, y.name);
725
737
  if (!k.length) continue;
726
- const _ = b.value_field ?? "id", F = await Nt(
738
+ const _ = b.value_field ?? "id", F = await qt(
727
739
  r,
728
740
  y,
729
741
  k,
@@ -744,7 +756,7 @@ function Ge({ config: e }) {
744
756
  Object.entries(p).map(([b, y]) => {
745
757
  var _;
746
758
  const k = ((_ = (e.filters ?? []).find((F) => F.param === b)) == null ? void 0 : _.value_field) ?? "id";
747
- return [b, Ee(y, k)];
759
+ return [b, Be(y, k)];
748
760
  })
749
761
  )
750
762
  ));
@@ -752,27 +764,27 @@ function Ge({ config: e }) {
752
764
  z(!0);
753
765
  }
754
766
  })();
755
- }, [R, $, e.filters, c, r, N]);
767
+ }, [R, $, e.filters, u, r, S]);
756
768
  const V = he(() => {
757
769
  const i = { ...e.params ?? {} };
758
770
  for (const p of e.filters ?? []) {
759
- const b = c[p.param] ?? [];
771
+ const b = u[p.param] ?? [];
760
772
  b.length > 0 && (i[p.param] = b.map((y) => String(y[p.value_field ?? "id"] ?? "")).join(","));
761
773
  }
762
774
  return i;
763
- }, [e.params, e.filters, c]), [G, B] = T(/* @__PURE__ */ new Set()), f = ee(!1), a = JSON.stringify(V), g = ct(
764
- a,
765
- f.current ? G.size > 0 ? Gt : Vt : 0
766
- ), P = f.current ? g : a, D = he(
775
+ }, [e.params, e.filters, u]), [G, B] = j(/* @__PURE__ */ new Set()), f = ee(!1), s = JSON.stringify(V), g = pt(
776
+ s,
777
+ f.current ? G.size > 0 ? Xt : Yt : 0
778
+ ), P = f.current ? g : s, D = he(
767
779
  () => JSON.parse(P),
768
780
  [P]
769
781
  ), J = ee(!1), {
770
782
  data: A,
771
783
  isPending: X,
772
- error: ye,
773
- refetch: ve,
774
- isFetching: ke,
775
- isPlaceholderData: Je
784
+ error: ve,
785
+ refetch: ke,
786
+ isFetching: we,
787
+ isPlaceholderData: Xe
776
788
  } = Y({
777
789
  queryKey: ["page-renderer-query", e.query_slug, P],
778
790
  queryFn: () => {
@@ -792,15 +804,15 @@ function Ge({ config: e }) {
792
804
  // reset its view state — "Hide empty rows" switched itself off (L13).
793
805
  // Only the same query's answer stands in; another slug starts fresh.
794
806
  placeholderData: (i, p) => (p == null ? void 0 : p.queryKey[1]) === e.query_slug ? i : void 0
795
- }), Z = A == null ? void 0 : A.data, ne = Je && ke, He = rt(() => {
796
- J.current = !0, ve();
797
- }, [ve]), we = X;
807
+ }), Z = A == null ? void 0 : A.data, ne = Xe && we, Ze = lt(() => {
808
+ J.current = !0, ke();
809
+ }, [ke]), Ne = X;
798
810
  if (!e.query_slug) return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Set a query slug" });
799
- const Ye = (i) => {
811
+ const et = (i) => {
800
812
  var k;
801
813
  const p = {};
802
814
  for (const [_, F] of Object.entries(i.params ?? {})) {
803
- const M = Ue(F, null, Z ?? [], D, c, e.filters);
815
+ const M = Je(F, null, Z ?? [], D, u, e.filters);
804
816
  if (M === void 0) {
805
817
  q(`Select a value for "${_}" first`);
806
818
  return;
@@ -815,15 +827,15 @@ function Ge({ config: e }) {
815
827
  startedAt: Date.now(),
816
828
  elapsedMs: 0
817
829
  };
818
- j(y), b || Ne(y);
819
- }, Ne = async (i) => {
830
+ T(y), b || Se(y);
831
+ }, Se = async (i) => {
820
832
  const p = Date.now();
821
- j({ ...i, phase: "running", startedAt: p, elapsedMs: 0 });
833
+ T({ ...i, phase: "running", startedAt: p, elapsedMs: 0 });
822
834
  try {
823
835
  const b = await r.request(
824
836
  se(`/custom-queries/${i.action.query_slug}/execute`, { params: i.params })
825
837
  ), y = Array.isArray(b == null ? void 0 : b.data) ? b.data : [];
826
- j(
838
+ T(
827
839
  (k) => k && k.action === i.action ? {
828
840
  ...k,
829
841
  phase: "done",
@@ -835,30 +847,30 @@ function Ge({ config: e }) {
835
847
  `${i.action.success_message ?? `${i.action.label} completed`} · ${le(Date.now() - p)}`
836
848
  ), U.invalidateQueries({ queryKey: ["page-renderer-query", e.query_slug] });
837
849
  } catch (b) {
838
- const y = ze(b, "unknown error");
839
- j(
850
+ const y = Ke(b, "unknown error");
851
+ T(
840
852
  (k) => k && k.action === i.action ? { ...k, phase: "error", elapsedMs: Date.now() - p, error: y } : k
841
853
  ), q(`${i.action.label} failed: ${y}`);
842
854
  }
843
- }, Xe = /* @__PURE__ */ t(
844
- _t,
855
+ }, tt = /* @__PURE__ */ t(
856
+ jt,
845
857
  {
846
858
  scope: `query:${e.query_slug}`,
847
859
  envelope: A,
848
- onRefresh: He,
849
- refreshing: ke && !X,
860
+ onRefresh: Ze,
861
+ refreshing: we && !X,
850
862
  className: "ml-auto"
851
863
  }
852
- ), de = e.filters && e.filters.length > 0 || (_e = e.actions) != null && _e.length || A != null && A.cache_ttl ? /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
864
+ ), de = e.filters && e.filters.length > 0 || (Ce = e.actions) != null && Ce.length || A != null && A.cache_ttl ? /* @__PURE__ */ h("div", { className: "flex flex-wrap items-center gap-2 pb-2", children: [
853
865
  (e.filters ?? []).map((i) => {
854
- const p = Oe($, { key: i.param, collection: i.collection }), b = p ? ($ == null ? void 0 : $.restricted[p.name]) ?? [] : [];
866
+ const p = Ae($, { key: i.param, collection: i.collection }), b = p ? ($ == null ? void 0 : $.restricted[p.name]) ?? [] : [];
855
867
  return /* @__PURE__ */ t(
856
- Jt,
868
+ Zt,
857
869
  {
858
870
  filter: i,
859
- selected: c[i.param] ?? [],
871
+ selected: u[i.param] ?? [],
860
872
  allowedIds: b.length > 0 ? b : void 0,
861
- scopeDefault: E.has(i.param) && E.get(i.param) === Ee(c[i.param] ?? [], i.value_field ?? "id"),
873
+ scopeDefault: E.has(i.param) && E.get(i.param) === Be(u[i.param] ?? [], i.value_field ?? "id"),
862
874
  onChange: (y) => {
863
875
  f.current = !0, C(i.param, y);
864
876
  },
@@ -876,42 +888,42 @@ function Ge({ config: e }) {
876
888
  {
877
889
  type: "button",
878
890
  disabled: W,
879
- onClick: () => void Ye(i),
891
+ onClick: () => void et(i),
880
892
  className: "ml-auto inline-flex h-8 items-center rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:opacity-90 disabled:opacity-50",
881
893
  children: W ? "Running…" : i.label
882
894
  },
883
895
  i.label
884
896
  )),
885
- S && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: S }),
886
- Xe
887
- ] }) : null, Se = (Ce = e.stats) != null && Ce.length ? /* @__PURE__ */ t(
888
- qt,
897
+ w && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: w }),
898
+ tt
899
+ ] }) : null, $e = (qe = e.stats) != null && qe.length ? /* @__PURE__ */ t(
900
+ Rt,
889
901
  {
890
902
  stats: e.stats,
891
903
  rows: Z ?? [],
892
904
  effectiveParams: D,
893
- loading: we || ne,
894
- zeroDash: !!((qe = e.table) != null && qe.zero_dash)
905
+ loading: Ne || ne,
906
+ zeroDash: !!((Te = e.table) != null && Te.zero_dash)
895
907
  }
896
908
  ) : null;
897
- if (we)
909
+ if (Ne)
898
910
  return /* @__PURE__ */ h("div", { className: "p-3", children: [
899
911
  de,
900
- Se,
912
+ $e,
901
913
  /* @__PURE__ */ t(oe, {})
902
914
  ] });
903
- if (ye)
915
+ if (ve)
904
916
  return /* @__PURE__ */ h("div", { className: "p-3", children: [
905
917
  de,
906
- /* @__PURE__ */ t(ie, { error: ye, unresolved: e.unresolved_params })
918
+ /* @__PURE__ */ t(ie, { error: ve, unresolved: e.unresolved_params })
907
919
  ] });
908
- const w = e.row_click, $e = (i, p, b) => {
909
- const y = p ? null : b ?? Z ?? [], _ = yt(i, (M) => Dt(
920
+ const N = e.row_click, _e = (i, p, b) => {
921
+ const y = p ? null : b ?? Z ?? [], _ = St(i, (M) => Qt(
910
922
  M,
911
923
  p,
912
924
  Z ?? [],
913
925
  D,
914
- c,
926
+ u,
915
927
  e.filters,
916
928
  y
917
929
  )), F = _.resolvedTabs.map((M) => {
@@ -941,28 +953,28 @@ function Ge({ config: e }) {
941
953
  row: p,
942
954
  totalCount: y ? y.length : null
943
955
  });
944
- }, Ze = w ? (i) => {
945
- w.picker ? s(i) : w.sheet ? $e(w.sheet, i) : w.matrix && i.id != null ? u(i.id) : w.drill && i.id != null && (n == null || n.open({
946
- collection: w.drill.collection ?? "",
956
+ }, rt = N ? (i) => {
957
+ N.picker ? l(i) : N.sheet ? _e(N.sheet, i) : N.matrix && i.id != null ? m(i.id) : N.drill && i.id != null && (n == null || n.open({
958
+ collection: N.drill.collection ?? "",
947
959
  itemId: String(i.id),
948
- layoutId: w.drill.layout_id,
949
- width: w.drill.width
960
+ layoutId: N.drill.layout_id,
961
+ width: N.drill.width
950
962
  }));
951
- } : void 0, et = (je = e.row_actions) != null && je.length ? e.row_actions.map((i) => ({
963
+ } : void 0, nt = (je = e.row_actions) != null && je.length ? e.row_actions.map((i) => ({
952
964
  label: i.label,
953
- onClick: (p, b) => $e(i.sheet, p, b)
965
+ onClick: (p, b) => _e(i.sheet, p, b)
954
966
  })) : void 0;
955
967
  return /* @__PURE__ */ h(
956
968
  "div",
957
969
  {
958
- className: (Te = e.table) != null && Te.sticky ? (
970
+ className: (Me = e.table) != null && Me.sticky ? (
959
971
  // Sticky grids own their scroll: filters/stats stay pinned above a
960
972
  // scrolling table region (header/first-column/totals pin inside it).
961
973
  "flex h-full min-h-0 flex-col overflow-hidden p-3"
962
974
  ) : "h-full overflow-auto p-3",
963
975
  children: [
964
976
  de,
965
- ((Me = e.note) == null ? void 0 : Me.trim()) && /* @__PURE__ */ t(
977
+ ((Re = e.note) == null ? void 0 : Re.trim()) && /* @__PURE__ */ t(
966
978
  "p",
967
979
  {
968
980
  "data-query-note": !0,
@@ -970,65 +982,65 @@ function Ge({ config: e }) {
970
982
  children: e.note
971
983
  }
972
984
  ),
973
- Se,
985
+ $e,
974
986
  /* @__PURE__ */ t(
975
987
  "div",
976
988
  {
977
989
  "data-qt-refetching": ne ? "" : void 0,
978
990
  "aria-busy": ne || void 0,
979
- className: `transition-opacity ${ne ? "opacity-60" : ""} ${(Re = e.table) != null && Re.sticky ? "flex min-h-0 flex-1 flex-col" : ""}`.trim(),
991
+ className: `transition-opacity ${ne ? "opacity-60" : ""} ${(We = e.table) != null && We.sticky ? "flex min-h-0 flex-1 flex-col" : ""}`.trim(),
980
992
  children: /* @__PURE__ */ t(
981
- jt,
993
+ Wt,
982
994
  {
983
995
  rows: Z ?? [],
984
996
  config: (
985
997
  // Current-month highlight only applies when the selected year param
986
998
  // IS the current year — otherwise strip it.
987
- (We = e.table) != null && We.highlight_group && e.table.highlight_year_param ? Number(
999
+ (Pe = e.table) != null && Pe.highlight_group && e.table.highlight_year_param ? Number(
988
1000
  String(D[e.table.highlight_year_param] ?? "").split(",")[0]
989
1001
  ) === (/* @__PURE__ */ new Date()).getFullYear() ? e.table : { ...e.table, highlight_group: void 0 } : e.table
990
1002
  ),
991
- onRowClick: Ze,
992
- rowActions: et,
1003
+ onRowClick: rt,
1004
+ rowActions: nt,
993
1005
  emptyText: e.empty_label,
994
- pivotYear: (Le = (Pe = e.table) == null ? void 0 : Pe.pivot) != null && Le.year_param && Number(String(D[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
1006
+ pivotYear: (Oe = (Le = e.table) == null ? void 0 : Le.pivot) != null && Oe.year_param && Number(String(D[e.table.pivot.year_param] ?? "").split(",")[0]) || void 0
995
1007
  }
996
1008
  )
997
1009
  }
998
1010
  ),
999
- (w == null ? void 0 : w.picker) && l && /* @__PURE__ */ t(
1011
+ (N == null ? void 0 : N.picker) && a && /* @__PURE__ */ t(
1000
1012
  "div",
1001
1013
  {
1002
1014
  className: "fixed inset-0 z-50 flex items-start justify-center bg-black/30 pt-32",
1003
- onClick: () => s(null),
1015
+ onClick: () => l(null),
1004
1016
  children: /* @__PURE__ */ h(
1005
1017
  "div",
1006
1018
  {
1007
1019
  className: "w-[420px] rounded-lg border border-slate-200 bg-white p-4 shadow-xl dark:border-border dark:bg-background",
1008
1020
  onClick: (i) => i.stopPropagation(),
1009
1021
  children: [
1010
- /* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: w.picker.title ?? "Choose a record" }),
1022
+ /* @__PURE__ */ t("p", { className: "mb-2 text-[13px] font-semibold text-slate-700 dark:text-slate-200", children: N.picker.title ?? "Choose a record" }),
1011
1023
  /* @__PURE__ */ t(
1012
- Ct,
1024
+ Mt,
1013
1025
  {
1014
- collection: w.picker.collection,
1026
+ collection: N.picker.collection,
1015
1027
  value: null,
1016
1028
  onChange: (i) => {
1017
1029
  var p, b, y, k;
1018
- if (s(null), i != null) {
1019
- if (w.matrix) {
1020
- u(i);
1030
+ if (l(null), i != null) {
1031
+ if (N.matrix) {
1032
+ m(i);
1021
1033
  return;
1022
1034
  }
1023
1035
  n == null || n.open({
1024
- collection: ((p = w.drill) == null ? void 0 : p.collection) ?? ((b = w.picker) == null ? void 0 : b.collection) ?? "",
1036
+ collection: ((p = N.drill) == null ? void 0 : p.collection) ?? ((b = N.picker) == null ? void 0 : b.collection) ?? "",
1025
1037
  itemId: String(i),
1026
- layoutId: (y = w.drill) == null ? void 0 : y.layout_id,
1027
- width: (k = w.drill) == null ? void 0 : k.width
1038
+ layoutId: (y = N.drill) == null ? void 0 : y.layout_id,
1039
+ width: (k = N.drill) == null ? void 0 : k.width
1028
1040
  });
1029
1041
  }
1030
1042
  },
1031
- extraFilter: Ut(w.picker.filter, l, c, e.filters),
1043
+ extraFilter: Ht(N.picker.filter, a, u, e.filters),
1032
1044
  placeholder: "Search…"
1033
1045
  }
1034
1046
  ),
@@ -1036,7 +1048,7 @@ function Ge({ config: e }) {
1036
1048
  "button",
1037
1049
  {
1038
1050
  type: "button",
1039
- onClick: () => s(null),
1051
+ onClick: () => l(null),
1040
1052
  className: "mt-3 h-7 rounded px-2 text-[12px] text-slate-500 hover:text-slate-700",
1041
1053
  children: "Cancel"
1042
1054
  }
@@ -1046,18 +1058,18 @@ function Ge({ config: e }) {
1046
1058
  )
1047
1059
  }
1048
1060
  ),
1049
- (w == null ? void 0 : w.matrix) && m != null && /* @__PURE__ */ t(
1050
- Qe,
1061
+ (N == null ? void 0 : N.matrix) && c != null && /* @__PURE__ */ t(
1062
+ Ge,
1051
1063
  {
1052
- config: w.matrix.config,
1053
- initialScope: { [w.matrix.scope_field]: m },
1054
- width: w.matrix.width,
1055
- title: w.matrix.title,
1056
- onClose: () => u(null)
1064
+ config: N.matrix.config,
1065
+ initialScope: { [N.matrix.scope_field]: c },
1066
+ width: N.matrix.width,
1067
+ title: N.matrix.title,
1068
+ onClose: () => m(null)
1057
1069
  }
1058
1070
  ),
1059
1071
  d && /* @__PURE__ */ t(
1060
- Qt,
1072
+ Jt,
1061
1073
  {
1062
1074
  def: d.def,
1063
1075
  row: d.row,
@@ -1066,12 +1078,12 @@ function Ge({ config: e }) {
1066
1078
  }
1067
1079
  ),
1068
1080
  v && /* @__PURE__ */ t(
1069
- Zt,
1081
+ nr,
1070
1082
  {
1071
1083
  run: v,
1072
- onConfirm: () => void Ne(v),
1084
+ onConfirm: () => void Se(v),
1073
1085
  onClose: () => {
1074
- j(null);
1086
+ T(null);
1075
1087
  }
1076
1088
  }
1077
1089
  )
@@ -1080,13 +1092,13 @@ function Ge({ config: e }) {
1080
1092
  );
1081
1093
  }
1082
1094
  const le = (e) => e < 6e4 ? `${(e / 1e3).toFixed(e < 1e4 ? 1 : 0)}s` : `${Math.floor(e / 6e4)}m ${Math.round(e % 6e4 / 1e3)}s`;
1083
- function Zt({
1095
+ function nr({
1084
1096
  run: e,
1085
1097
  onConfirm: r,
1086
1098
  onClose: n
1087
1099
  }) {
1088
- const l = Object.entries(e.params);
1089
- return lt(
1100
+ const a = Object.entries(e.params);
1101
+ return it(
1090
1102
  /* @__PURE__ */ h(H, { children: [
1091
1103
  /* @__PURE__ */ t(
1092
1104
  "div",
@@ -1105,10 +1117,10 @@ function Zt({
1105
1117
  className: "fixed left-1/2 top-[24vh] z-50 w-[min(400px,92vw)] -translate-x-1/2 rounded-xl border border-slate-200 bg-white p-4 shadow-2xl dark:border-border dark:bg-card",
1106
1118
  children: [
1107
1119
  /* @__PURE__ */ t("p", { className: "text-[13.5px] font-semibold text-slate-900 dark:text-foreground", children: e.action.label }),
1108
- l.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: l.map(([s, m]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1109
- /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(s) }),
1110
- /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m) })
1111
- ] }, s)) }),
1120
+ a.length > 0 && /* @__PURE__ */ t("dl", { className: "mt-2 space-y-0.5 rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: a.map(([l, c]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1121
+ /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(l) }),
1122
+ /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: typeof c == "number" && fe(c, { field: l }) || String(c) })
1123
+ ] }, l)) }),
1112
1124
  e.phase === "confirm" && /* @__PURE__ */ h(H, { children: [
1113
1125
  /* @__PURE__ */ t("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: e.confirmText }),
1114
1126
  /* @__PURE__ */ h("div", { className: "mt-3 flex gap-2", children: [
@@ -1144,13 +1156,13 @@ function Zt({
1144
1156
  le(e.elapsedMs)
1145
1157
  ] }),
1146
1158
  e.resultRows != null && e.resultRows > 0 && e.resultSample && /* @__PURE__ */ h("dl", { className: "mt-2 max-h-40 space-y-0.5 overflow-y-auto rounded-lg bg-slate-50 px-2.5 py-1.5 text-[11.5px] dark:bg-muted", children: [
1147
- Object.entries(e.resultSample).slice(0, 8).map(([s, m]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1148
- /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(s) }),
1149
- /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(m ?? "—") })
1150
- ] }, s)),
1159
+ Object.entries(e.resultSample).slice(0, 8).map(([l, c]) => /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1160
+ /* @__PURE__ */ t("dt", { className: "text-slate-500 dark:text-slate-400", children: Q(l) }),
1161
+ /* @__PURE__ */ t("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: typeof c == "number" ? fe(c, { field: l }) || String(c) : String(c ?? "—") })
1162
+ ] }, l)),
1151
1163
  e.resultRows > 1 && /* @__PURE__ */ h("p", { className: "pt-0.5 text-slate-400", children: [
1152
1164
  "…",
1153
- e.resultRows,
1165
+ Qe(e.resultRows),
1154
1166
  " result rows"
1155
1167
  ] })
1156
1168
  ] }),
@@ -1199,69 +1211,69 @@ function Zt({
1199
1211
  document.body
1200
1212
  );
1201
1213
  }
1202
- function Be({ slug: e, widget: r }) {
1214
+ function De({ slug: e, widget: r }) {
1203
1215
  var n;
1204
1216
  switch (r.type) {
1205
1217
  case "table":
1206
- return /* @__PURE__ */ t(Lt, { slug: e, widget: r });
1218
+ return /* @__PURE__ */ t(Et, { slug: e, widget: r });
1207
1219
  case "kpi":
1208
- return /* @__PURE__ */ t(Ot, { slug: e, widget: r });
1220
+ return /* @__PURE__ */ t(Bt, { slug: e, widget: r });
1209
1221
  case "markdown":
1210
- return /* @__PURE__ */ t(Wt, { content: String(((n = r.config) == null ? void 0 : n.content) ?? "") });
1222
+ return /* @__PURE__ */ t(At, { content: String(((n = r.config) == null ? void 0 : n.content) ?? "") });
1211
1223
  case "iframe":
1212
- return /* @__PURE__ */ t(Ft, { widget: r });
1224
+ return /* @__PURE__ */ t(It, { widget: r });
1213
1225
  case "query":
1214
- return /* @__PURE__ */ t(Ht, { widget: r });
1226
+ return /* @__PURE__ */ t(er, { widget: r });
1215
1227
  case "matrix":
1216
- return /* @__PURE__ */ t(Et, { widget: r });
1228
+ return /* @__PURE__ */ t(zt, { widget: r });
1217
1229
  case "record-grid":
1218
- return /* @__PURE__ */ t(Yt, { widget: r });
1230
+ return /* @__PURE__ */ t(tr, { widget: r });
1219
1231
  case "recent-activity":
1220
- return /* @__PURE__ */ t(At, { slug: e, widget: r });
1232
+ return /* @__PURE__ */ t(Dt, { slug: e, widget: r });
1221
1233
  default:
1222
1234
  return /* @__PURE__ */ t("div", { className: "p-3 text-[12px] text-slate-400", children: "Unknown widget" });
1223
1235
  }
1224
1236
  }
1225
- function _r({
1237
+ function Mr({
1226
1238
  slug: e,
1227
1239
  hideHeader: r,
1228
1240
  className: n,
1229
- liveReads: l,
1230
- liveGapMs: s
1241
+ liveReads: a,
1242
+ liveGapMs: l
1231
1243
  }) {
1232
1244
  var B, f;
1233
- const m = re(), u = De(), d = (l ?? []).filter(Boolean).join(","), o = he(
1245
+ const c = re(), m = Ie(), d = (a ?? []).filter(Boolean).join(","), o = he(
1234
1246
  () => d ? {
1235
1247
  reads: d.split(","),
1236
- minGapMs: s ?? 15e3,
1248
+ minGapMs: l ?? 15e3,
1237
1249
  // Server-cached figures are dropped a moment after the write (a few seconds'
1238
1250
  // window): read after that, and spread the viewers out.
1239
1251
  delayMs: 3500,
1240
1252
  jitterMs: 3e3
1241
1253
  } : null,
1242
- [d, s]
1243
- ), [c, x] = T(0);
1254
+ [d, l]
1255
+ ), [u, x] = j(0);
1244
1256
  te(() => {
1245
1257
  if (o)
1246
- return u.getQueryCache().subscribe((a) => {
1247
- if (a.type !== "updated" || a.action.type !== "success") return;
1248
- const g = a.query;
1249
- !Pt.has(String(g.queryKey[0])) || g.state.dataUpdateCount < 2 || x(Date.now());
1258
+ return m.getQueryCache().subscribe((s) => {
1259
+ if (s.type !== "updated" || s.action.type !== "success") return;
1260
+ const g = s.query;
1261
+ !Ft.has(String(g.queryKey[0])) || g.state.dataUpdateCount < 2 || x(Date.now());
1250
1262
  });
1251
- }, [u, o]);
1252
- const N = pt(c, { enabled: !!o }), { isAdmin: C } = st(), S = Ie(), q = ot("drill.page"), v = q.value, {
1253
- data: j,
1263
+ }, [m, o]);
1264
+ const S = ft(u, { enabled: !!o }), { isAdmin: C } = dt(), w = ze(), q = ct("drill.page"), v = q.value, {
1265
+ data: T,
1254
1266
  isLoading: W,
1255
1267
  error: U
1256
1268
  } = Y({
1257
1269
  queryKey: ["page-renderer", e],
1258
- queryFn: () => m.request(xe(`/pages/${e}`)).then((a) => a.data),
1270
+ queryFn: () => c.request(xe(`/pages/${e}`)).then((s) => s.data),
1259
1271
  enabled: !!e,
1260
1272
  retry: !1
1261
1273
  });
1262
1274
  if (W)
1263
1275
  return /* @__PURE__ */ t("div", { className: n ?? "p-6", children: /* @__PURE__ */ t(oe, {}) });
1264
- if (U || !j)
1276
+ if (U || !T)
1265
1277
  return /* @__PURE__ */ h(
1266
1278
  "div",
1267
1279
  {
@@ -1272,19 +1284,19 @@ function _r({
1272
1284
  ]
1273
1285
  }
1274
1286
  );
1275
- const L = ((B = j.layout) == null ? void 0 : B.columns) ?? 12, $ = ht(((f = j.layout) == null ? void 0 : f.widgets) ?? [], C), R = (a) => {
1287
+ const L = ((B = T.layout) == null ? void 0 : B.columns) ?? 12, $ = yt(((f = T.layout) == null ? void 0 : f.widgets) ?? [], C), R = (s) => {
1276
1288
  var g;
1277
- return (a.type === "matrix" || a.type === "query" || a.type === "record-grid") && ((g = a.config) == null ? void 0 : g.display) === "drawer";
1278
- }, I = [...new Set($.filter(R).map((a) => a.y))].filter((a) => $.every((g) => R(g) || a < g.y || a >= g.y + Math.max(g.h, 1))).sort((a, g) => a - g), K = I.map((a) => ({
1279
- y: a,
1280
- items: $.filter((g) => g.y === a && R(g)).sort((g, P) => g.x - P.x)
1281
- })), z = $.filter((a) => !(R(a) && I.includes(a.y))), E = (a) => a - I.filter((g) => g < a).length, O = z.find((a) => {
1289
+ return (s.type === "matrix" || s.type === "query" || s.type === "record-grid") && ((g = s.config) == null ? void 0 : g.display) === "drawer";
1290
+ }, I = [...new Set($.filter(R).map((s) => s.y))].filter((s) => $.every((g) => R(g) || s < g.y || s >= g.y + Math.max(g.h, 1))).sort((s, g) => s - g), K = I.map((s) => ({
1291
+ y: s,
1292
+ items: $.filter((g) => g.y === s && R(g)).sort((g, P) => g.x - P.x)
1293
+ })), z = $.filter((s) => !(R(s) && I.includes(s.y))), E = (s) => s - I.filter((g) => g < s).length, O = z.find((s) => {
1282
1294
  var g;
1283
- return (g = a.config) == null ? void 0 : g.full_height;
1284
- }), V = /* @__PURE__ */ h("div", { ref: N, className: `flex h-full min-h-0 flex-col ${n ?? ""}`, children: [
1285
- !r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: j.name }) }),
1295
+ return (g = s.config) == null ? void 0 : g.full_height;
1296
+ }), V = /* @__PURE__ */ h("div", { ref: S, className: `flex h-full min-h-0 flex-col ${n ?? ""}`, children: [
1297
+ !r && /* @__PURE__ */ t("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ t("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: T.name }) }),
1286
1298
  /* @__PURE__ */ t("div", { className: `min-h-0 flex-1 overflow-y-auto ${O ? "flex flex-col" : ""}`, children: $.length === 0 ? /* @__PURE__ */ t("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ h(H, { children: [
1287
- K.map((a) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: a.items.map((g) => /* @__PURE__ */ t(Be, { slug: j.slug, widget: g }, g.id)) }, a.y)),
1299
+ K.map((s) => /* @__PURE__ */ t("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: s.items.map((g) => /* @__PURE__ */ t(De, { slug: T.slug, widget: g }, g.id)) }, s.y)),
1288
1300
  /* @__PURE__ */ t(
1289
1301
  "div",
1290
1302
  {
@@ -1299,32 +1311,32 @@ function _r({
1299
1311
  } : {},
1300
1312
  gridAutoRows: `${me}px`
1301
1313
  },
1302
- children: z.map((a) => {
1314
+ children: z.map((s) => {
1303
1315
  var D, J, A, X;
1304
- const g = (a.type === "matrix" || a.type === "query" || a.type === "record-grid") && ((D = a.config) == null ? void 0 : D.display) === "drawer", P = a === O;
1316
+ const g = (s.type === "matrix" || s.type === "query" || s.type === "record-grid") && ((D = s.config) == null ? void 0 : D.display) === "drawer", P = s === O;
1305
1317
  return /* @__PURE__ */ h(
1306
1318
  "div",
1307
1319
  {
1308
1320
  className: g ? "flex min-h-0 flex-col" : "flex min-h-0 flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm dark:border-border dark:bg-card",
1309
1321
  style: {
1310
- gridColumn: `${Math.min(a.x, L - 1) + 1} / span ${Math.min(a.w, L)}`,
1311
- gridRow: P ? `${E(a.y) + 1} / -1` : `${E(a.y) + 1} / span ${Math.max(a.h, 1)}`
1322
+ gridColumn: `${Math.min(s.x, L - 1) + 1} / span ${Math.min(s.w, L)}`,
1323
+ gridRow: P ? `${E(s.y) + 1} / -1` : `${E(s.y) + 1} / span ${Math.max(s.h, 1)}`
1312
1324
  },
1313
1325
  children: [
1314
- !g && a.type !== "kpi" && a.type !== "markdown" && ((J = a.config) == null ? void 0 : J.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((A = a.config) == null ? void 0 : A.label) ?? "") || (typeof ((X = a.config) == null ? void 0 : X.collection) == "string" ? Q(String(a.config.collection)) : Q(a.type)) }),
1315
- /* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(Be, { slug: j.slug, widget: a }) })
1326
+ !g && s.type !== "kpi" && s.type !== "markdown" && ((J = s.config) == null ? void 0 : J.hide_label) !== !0 && /* @__PURE__ */ t("div", { className: "shrink-0 border-b border-slate-100 px-3 py-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: String(((A = s.config) == null ? void 0 : A.label) ?? "") || (typeof ((X = s.config) == null ? void 0 : X.collection) == "string" ? Q(String(s.config.collection)) : Q(s.type)) }),
1327
+ /* @__PURE__ */ t("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ t(De, { slug: T.slug, widget: s }) })
1316
1328
  ]
1317
1329
  },
1318
- a.id
1330
+ s.id
1319
1331
  );
1320
1332
  })
1321
1333
  }
1322
1334
  )
1323
1335
  ] }) })
1324
- ] }), G = /* @__PURE__ */ t(Ke.Provider, { value: o, children: V });
1325
- return S ? G : /* @__PURE__ */ h(it.Provider, { value: { open: (a) => q.push([a]) }, children: [
1336
+ ] }), G = /* @__PURE__ */ t(Ue.Provider, { value: o, children: V });
1337
+ return w ? G : /* @__PURE__ */ h(ut.Provider, { value: { open: (s) => q.push([s]) }, children: [
1326
1338
  v != null && v.length ? /* @__PURE__ */ t(
1327
- Tt,
1339
+ Pt,
1328
1340
  {
1329
1341
  collection: v[0].collection,
1330
1342
  itemId: v[0].itemId,
@@ -1332,7 +1344,7 @@ function _r({
1332
1344
  width: v[0].width,
1333
1345
  title: v[0].title,
1334
1346
  stack: v,
1335
- onPush: (a) => q.push([...v, a]),
1347
+ onPush: (s) => q.push([...v, s]),
1336
1348
  onPop: () => q.back(),
1337
1349
  onClose: () => q.back(v.length)
1338
1350
  }
@@ -1341,12 +1353,12 @@ function _r({
1341
1353
  ] });
1342
1354
  }
1343
1355
  export {
1344
- _r as PageRenderer,
1345
- Ve as QueryWidgetView,
1346
- Yt as RecordGridWidgetBody,
1347
- zt as missingRowParamMessage,
1348
- Dt as resolveSheetConfig,
1349
- Ue as resolveSheetValue,
1350
- Ee as selectionSignature,
1351
- It as totalSheetTitle
1356
+ Mr as PageRenderer,
1357
+ He as QueryWidgetView,
1358
+ tr as RecordGridWidgetBody,
1359
+ Vt as missingRowParamMessage,
1360
+ Qt as resolveSheetConfig,
1361
+ Je as resolveSheetValue,
1362
+ Be as selectionSignature,
1363
+ Ut as totalSheetTitle
1352
1364
  };