@nivaro/react 0.2.56 → 0.3.1

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 (80) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +414 -1
  5. package/dist/index.js +767 -716
  6. package/dist/shared/components/ClientChaosToolbar.js +410 -0
  7. package/dist/shared/components/ItemEditForm.js +666 -658
  8. package/dist/shared/components/LoadErrorNote.js +49 -0
  9. package/dist/shared/components/MyWorkView.js +47 -37
  10. package/dist/shared/components/PretendDown.js +258 -0
  11. package/dist/shared/components/ProfileView.js +208 -184
  12. package/dist/shared/components/QueryErrorState.js +16 -0
  13. package/dist/shared/components/ReportView.js +1351 -1338
  14. package/dist/shared/components/WidgetSlot.js +438 -418
  15. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  16. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  17. package/dist/shared/components/ai/TaskDo.js +1022 -0
  18. package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
  19. package/dist/shared/components/chaos/DrillBanner.js +119 -0
  20. package/dist/shared/components/chaos/DrillTag.js +62 -0
  21. package/dist/shared/components/chaos/GameDayStrip.js +61 -0
  22. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  23. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  24. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  25. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  26. package/dist/shared/components/chat/chat-core.js +273 -264
  27. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  28. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  29. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  30. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  31. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  32. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  33. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  34. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  35. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  36. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  37. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  38. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  39. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  40. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  41. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  42. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  43. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  44. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  45. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  46. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  47. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  48. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  49. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  50. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  51. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  52. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  53. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  54. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  55. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  56. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  57. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  58. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  59. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  60. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  61. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  62. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  63. package/dist/shared/components/client-chaos-gate.js +51 -0
  64. package/dist/shared/components/integrations/console/SignalCard.js +172 -167
  65. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  66. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  67. package/dist/shared/components/item-edit/UserChip.js +145 -142
  68. package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
  69. package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
  70. package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
  71. package/dist/shared/components/panels/TaskPanel.js +51 -49
  72. package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
  73. package/dist/shared/components/pipeline/TeamsView.js +184 -169
  74. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  75. package/dist/shared/lib/client-chaos.js +359 -0
  76. package/dist/shared/lib/load-error.js +26 -0
  77. package/dist/shared/lib/notification-sound.js +25 -16
  78. package/dist/shared/lib/socket-realtime.js +31 -30
  79. package/dist/shared/lib/worker-socket.js +108 -89
  80. package/package.json +2 -1
@@ -1,101 +1,104 @@
1
- import { jsx as t, jsxs as y, Fragment as ye } from "react/jsx-runtime";
2
- import { useQueryClient as Be, useQuery as He } from "@tanstack/react-query";
3
- import { RefreshCw as Ae, MoreVertical as Fe, MoreHorizontal as Ve, Clipboard as Je, Copy as ze, Clock as Ke, Calendar as Qe, Paperclip as Ge, Folder as Xe, File as Ye, FileText as Ze, Bell as et, Phone as tt, MessageSquare as rt, Mail as nt, UserCheck as lt, UserPlus as at, Users as it, User as st, Activity as ot, Zap as ct, Power as dt, Search as ut, Filter as pt, Sliders as ft, Settings as mt, RotateCcw as ht, Pause as gt, Play as yt, HelpCircle as xt, Info as wt, AlertTriangle as bt, AlertCircle as vt, Flag as _t, Bookmark as Nt, Heart as kt, Star as St, Unlock as Rt, Lock as Lt, EyeOff as $t, Eye as Ct, Send as Et, Upload as jt, Download as Tt, Save as It, Trash2 as Ot, Edit2 as qt, Edit as Dt, Minus as Ut, Plus as At, XCircle as Pt, X as Wt, CheckCircle as Mt, Check as Bt, Share2 as Ht, Link as Ft, ExternalLink as Vt, ArrowUpRight as Jt, ArrowDown as zt, ArrowUp as Kt, ArrowLeft as Qt, ArrowRight as Gt } from "lucide-react";
4
- import { useState as P, useRef as le, useCallback as Xt, useEffect as re, useMemo as je } from "react";
5
- import { useApiFetchConfig as xe, useDrilldown as Yt, useOptionalNivaroClient as Zt } from "../context.js";
6
- import { useDebounced as er } from "../hooks/useDebounced.js";
7
- import { get as tr, post as rr } from "../lib/commands.js";
8
- import { HEADER_CELL_DENSE as nr, HEADER_CELL_LIST as lr, HEADER_LABEL as ar, HEADER_VALUE_LINE as ir, HEADER_VALUE_HERO as sr, HEADER_VALUE as or } from "../lib/header-strip.js";
1
+ import { jsx as t, jsxs as b, Fragment as be } from "react/jsx-runtime";
2
+ import { useQueryClient as Qe, useQuery as Ge } from "@tanstack/react-query";
3
+ import { AlertTriangle as Ve, RefreshCw as Fe, MoreVertical as Xe, MoreHorizontal as Ye, Clipboard as Ze, Copy as et, Clock as tt, Calendar as rt, Paperclip as nt, Folder as lt, File as at, FileText as it, Bell as st, Phone as ot, MessageSquare as ct, Mail as dt, UserCheck as ut, UserPlus as pt, Users as ft, User as mt, Activity as ht, Zap as gt, Power as yt, Search as bt, Filter as wt, Sliders as xt, Settings as vt, RotateCcw as _t, Pause as Nt, Play as kt, HelpCircle as St, Info as Rt, AlertCircle as Lt, Flag as $t, Bookmark as Ct, Heart as Et, Star as jt, Unlock as Tt, Lock as Ot, EyeOff as It, Eye as Dt, Send as qt, Upload as Ut, Download as At, Save as Pt, Trash2 as Wt, Edit2 as Mt, Edit as Bt, Minus as Ht, Plus as Vt, XCircle as Ft, X as Jt, CheckCircle as zt, Check as Kt, Share2 as Qt, Link as Gt, ExternalLink as Xt, ArrowUpRight as Yt, ArrowDown as Zt, ArrowUp as er, ArrowLeft as tr, ArrowRight as rr } from "lucide-react";
4
+ import { useState as P, useRef as le, useCallback as Oe, useEffect as Y, useMemo as Ie } from "react";
5
+ import { useApiFetchConfig as we, useDrilldown as nr, useOptionalNivaroClient as lr } from "../context.js";
6
+ import { useDebounced as ar } from "../hooks/useDebounced.js";
7
+ import { PRETEND_DOWN_EVENT as De } from "../lib/client-chaos.js";
8
+ import { get as ir, post as sr } from "../lib/commands.js";
9
+ import { HEADER_CELL_DENSE as or, HEADER_CELL_LIST as cr, HEADER_LABEL as dr, HEADER_VALUE_LINE as ur, HEADER_VALUE_HERO as pr, HEADER_VALUE as fr } from "../lib/header-strip.js";
10
+ import { loadErrorText as qe } from "../lib/load-error.js";
9
11
  import { affixesFor as ae, formatWidgetValue as ie } from "../lib/widget-value-format.js";
10
- import { BackgroundRunOffer as cr } from "./BackgroundRunOffer.js";
11
- import { cacheStampTip as dr, CacheStamp as ur } from "./CacheStamp.js";
12
- import { useStagedRelations as pr } from "./item-edit/O2MStagingContext.js";
13
- import { QueryTable as fr } from "./QueryTable.js";
12
+ import { BackgroundRunOffer as mr } from "./BackgroundRunOffer.js";
13
+ import { cacheStampTip as hr, CacheStamp as gr } from "./CacheStamp.js";
14
+ import { useStagedRelations as yr } from "./item-edit/O2MStagingContext.js";
15
+ import { LoadErrorNote as Ue } from "./LoadErrorNote.js";
16
+ import { QueryTable as br } from "./QueryTable.js";
14
17
  import { Button as ne } from "./ui/button.js";
15
- import { DropdownMenu as Te, DropdownMenuTrigger as Ie, DropdownMenuContent as Oe, DropdownMenuItem as qe } from "./ui/dropdown-menu.js";
16
- import { reportSlotScalar as mr, ReportSlotWidget as hr } from "./widgets/ReportSlotWidget.js";
17
- import { ReviewListWidget as gr } from "./widgets/ReviewListWidget.js";
18
- import { RollupWidget as yr } from "./widgets/RollupWidget.js";
18
+ import { DropdownMenu as Ae, DropdownMenuTrigger as Pe, DropdownMenuContent as We, DropdownMenuItem as Me } from "./ui/dropdown-menu.js";
19
+ import { reportSlotScalar as wr, ReportSlotWidget as xr } from "./widgets/ReportSlotWidget.js";
20
+ import { ReviewListWidget as vr } from "./widgets/ReviewListWidget.js";
21
+ import { RollupWidget as _r } from "./widgets/RollupWidget.js";
19
22
  const Q = {
20
- ArrowRight: Gt,
21
- ArrowLeft: Qt,
22
- ArrowUp: Kt,
23
- ArrowDown: zt,
24
- ArrowUpRight: Jt,
25
- ExternalLink: Vt,
26
- Link: Ft,
27
- Share2: Ht,
28
- Check: Bt,
29
- CheckCircle: Mt,
30
- X: Wt,
31
- XCircle: Pt,
32
- Plus: At,
33
- Minus: Ut,
34
- Edit: Dt,
35
- Edit2: qt,
36
- Trash2: Ot,
37
- Save: It,
38
- Download: Tt,
39
- Upload: jt,
40
- Send: Et,
41
- Eye: Ct,
42
- EyeOff: $t,
43
- Lock: Lt,
44
- Unlock: Rt,
45
- Star: St,
46
- Heart: kt,
47
- Bookmark: Nt,
48
- Flag: _t,
49
- AlertCircle: vt,
50
- AlertTriangle: bt,
51
- Info: wt,
52
- HelpCircle: xt,
53
- Play: yt,
54
- Pause: gt,
55
- RefreshCw: Ae,
56
- RotateCcw: ht,
57
- Settings: mt,
58
- Sliders: ft,
59
- Filter: pt,
60
- Search: ut,
61
- Power: dt,
62
- Zap: ct,
63
- Activity: ot,
64
- User: st,
65
- Users: it,
66
- UserPlus: at,
67
- UserCheck: lt,
68
- Mail: nt,
69
- MessageSquare: rt,
70
- Phone: tt,
71
- Bell: et,
72
- FileText: Ze,
73
- File: Ye,
74
- Folder: Xe,
75
- Paperclip: Ge,
76
- Calendar: Qe,
77
- Clock: Ke,
78
- Copy: ze,
79
- Clipboard: Je,
80
- MoreHorizontal: Ve,
81
- MoreVertical: Fe
23
+ ArrowRight: rr,
24
+ ArrowLeft: tr,
25
+ ArrowUp: er,
26
+ ArrowDown: Zt,
27
+ ArrowUpRight: Yt,
28
+ ExternalLink: Xt,
29
+ Link: Gt,
30
+ Share2: Qt,
31
+ Check: Kt,
32
+ CheckCircle: zt,
33
+ X: Jt,
34
+ XCircle: Ft,
35
+ Plus: Vt,
36
+ Minus: Ht,
37
+ Edit: Bt,
38
+ Edit2: Mt,
39
+ Trash2: Wt,
40
+ Save: Pt,
41
+ Download: At,
42
+ Upload: Ut,
43
+ Send: qt,
44
+ Eye: Dt,
45
+ EyeOff: It,
46
+ Lock: Ot,
47
+ Unlock: Tt,
48
+ Star: jt,
49
+ Heart: Et,
50
+ Bookmark: Ct,
51
+ Flag: $t,
52
+ AlertCircle: Lt,
53
+ AlertTriangle: Ve,
54
+ Info: Rt,
55
+ HelpCircle: St,
56
+ Play: kt,
57
+ Pause: Nt,
58
+ RefreshCw: Fe,
59
+ RotateCcw: _t,
60
+ Settings: vt,
61
+ Sliders: xt,
62
+ Filter: wt,
63
+ Search: bt,
64
+ Power: yt,
65
+ Zap: gt,
66
+ Activity: ht,
67
+ User: mt,
68
+ Users: ft,
69
+ UserPlus: pt,
70
+ UserCheck: ut,
71
+ Mail: dt,
72
+ MessageSquare: ct,
73
+ Phone: ot,
74
+ Bell: st,
75
+ FileText: it,
76
+ File: at,
77
+ Folder: lt,
78
+ Paperclip: nt,
79
+ Calendar: rt,
80
+ Clock: tt,
81
+ Copy: et,
82
+ Clipboard: Ze,
83
+ MoreHorizontal: Ye,
84
+ MoreVertical: Xe
82
85
  };
83
- function we({ awaiting: n, dark: s }) {
84
- return /* @__PURE__ */ y(
86
+ function xe({ awaiting: l, dark: s }) {
87
+ return /* @__PURE__ */ b(
85
88
  "span",
86
89
  {
87
90
  className: `text-[12px] font-normal italic ${s ? "text-slate-400" : "text-slate-400 dark:text-slate-500"}`,
88
- "data-widget-awaiting": n,
89
- "data-tip": `Waiting for ${n} — this figure is scoped to it and shows once it is set`,
91
+ "data-widget-awaiting": l,
92
+ "data-tip": `Waiting for ${l} — this figure is scoped to it and shows once it is set`,
90
93
  children: [
91
94
  "needs ",
92
- n
95
+ l
93
96
  ]
94
97
  }
95
98
  );
96
99
  }
97
- function fe({
98
- label: n,
100
+ function me({
101
+ label: l,
99
102
  value: s,
100
103
  display: o,
101
104
  loading: a,
@@ -105,21 +108,21 @@ function fe({
105
108
  return (
106
109
  // Same label / value vocabulary as a field tile in the record sub-header
107
110
  // (lib/header-strip.ts) — the two kinds of cell read as one row.
108
- /* @__PURE__ */ y(
111
+ /* @__PURE__ */ b(
109
112
  "div",
110
113
  {
111
- className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${nr} ${lr}`,
114
+ className: `flex h-full min-w-0 flex-col justify-start gap-1 px-4 pt-[9px] pb-2 ${or} ${cr}`,
112
115
  children: [
113
- /* @__PURE__ */ t("span", { className: ar, "data-header-label": !0, children: n }),
116
+ /* @__PURE__ */ t("span", { className: dr, "data-header-label": !0, children: l }),
114
117
  /* @__PURE__ */ t(
115
118
  "span",
116
119
  {
117
120
  "data-header-value": !0,
118
- className: `${ir} max-w-[232px] items-baseline truncate leading-tight`,
119
- children: a ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : c && s == null ? /* @__PURE__ */ t(we, { awaiting: c }) : /* @__PURE__ */ y(
121
+ className: `${ur} max-w-[232px] items-baseline truncate leading-tight`,
122
+ children: a ? /* @__PURE__ */ t("span", { className: "animate-pulse inline-block h-3.5 w-16 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : c && s == null ? /* @__PURE__ */ t(xe, { awaiting: c }) : /* @__PURE__ */ b(
120
123
  "span",
121
124
  {
122
- className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ? sr : or,
125
+ className: String(o.format ?? "").startsWith("currency") || /^[$€£¥]/.test(m) ? pr : fr,
123
126
  children: [
124
127
  m,
125
128
  w,
@@ -134,18 +137,18 @@ function fe({
134
137
  )
135
138
  );
136
139
  }
137
- function xr({
138
- data: n,
140
+ function Nr({
141
+ data: l,
139
142
  label: s,
140
143
  loading: o,
141
144
  widgetConfig: a,
142
145
  awaiting: c
143
146
  }) {
144
147
  const m = "h-full flex items-stretch divide-x divide-slate-200 dark:divide-border [[data-header-list]_&]:w-full [[data-header-list]_&]:flex-col [[data-header-list]_&]:divide-x-0";
145
- if (n && "values" in n) {
146
- const w = n.values ?? [];
148
+ if (l && "values" in l) {
149
+ const w = l.values ?? [];
147
150
  return w.length === 0 ? null : /* @__PURE__ */ t("div", { className: m, children: w.map((_, R) => /* @__PURE__ */ t(
148
- fe,
151
+ me,
149
152
  {
150
153
  label: _.label,
151
154
  value: _.value,
@@ -159,7 +162,7 @@ function xr({
159
162
  if (o) {
160
163
  const w = (a == null ? void 0 : a.value_fields) ?? [], _ = w.length > 0 ? w : [{ label: s }];
161
164
  return /* @__PURE__ */ t("div", { className: m, children: _.map((R, $) => /* @__PURE__ */ t(
162
- fe,
165
+ me,
163
166
  {
164
167
  label: R.label ?? s,
165
168
  display: { prefix: R.prefix ?? "", suffix: R.suffix ?? "", format: R.format ?? "" },
@@ -168,34 +171,34 @@ function xr({
168
171
  $
169
172
  )) });
170
173
  }
171
- if (!n) return null;
172
- const v = n.display ?? {};
174
+ if (!l) return null;
175
+ const v = l.display ?? {};
173
176
  return /* @__PURE__ */ t("div", { className: m, children: /* @__PURE__ */ t(
174
- fe,
177
+ me,
175
178
  {
176
179
  label: s,
177
- value: n.value,
180
+ value: l.value,
178
181
  display: v,
179
182
  loading: !1,
180
183
  awaiting: c
181
184
  }
182
185
  ) });
183
186
  }
184
- function wr(n, s) {
185
- if (Object.hasOwn(n, s)) return n[s] ?? null;
187
+ function kr(l, s) {
188
+ if (Object.hasOwn(l, s)) return l[s] ?? null;
186
189
  const o = s.split(".");
187
- let a = n;
190
+ let a = l;
188
191
  for (const c of o) {
189
192
  if (a == null || typeof a != "object") return a ?? null;
190
193
  a = a[c];
191
194
  }
192
195
  return a ?? null;
193
196
  }
194
- function br(n, s) {
197
+ function Sr(l, s) {
195
198
  const o = {};
196
- for (const a of n)
199
+ for (const a of l)
197
200
  if (a.binding_type === "item_field")
198
- o[a.key] = wr(s, a.binding_value);
201
+ o[a.key] = kr(s, a.binding_value);
199
202
  else if (a.binding_type === "static")
200
203
  o[a.key] = a.binding_value;
201
204
  else if (a.binding_type === "url_param" && typeof window < "u") {
@@ -204,20 +207,20 @@ function br(n, s) {
204
207
  }
205
208
  return o;
206
209
  }
207
- function me({
208
- data: n,
210
+ function he({
211
+ data: l,
209
212
  awaiting: s
210
213
  }) {
211
- if (s && n.value == null) return /* @__PURE__ */ t(we, { awaiting: s });
212
- const o = n.display ?? {}, { prefix: a, suffix: c } = ae(n.value, o), m = ie(n.value, o.format ?? "");
213
- return /* @__PURE__ */ y("div", { className: "flex items-baseline gap-1", children: [
214
+ if (s && l.value == null) return /* @__PURE__ */ t(xe, { awaiting: s });
215
+ const o = l.display ?? {}, { prefix: a, suffix: c } = ae(l.value, o), m = ie(l.value, o.format ?? "");
216
+ return /* @__PURE__ */ b("div", { className: "flex items-baseline gap-1", children: [
214
217
  a && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: a }),
215
218
  /* @__PURE__ */ t("span", { className: "text-2xl font-semibold text-slate-900 dark:text-slate-100", children: m }),
216
219
  c && /* @__PURE__ */ t("span", { className: "text-[13px] text-slate-500", children: c })
217
220
  ] });
218
221
  }
219
- function he({
220
- label: n,
222
+ function ge({
223
+ label: l,
221
224
  value: s,
222
225
  display: o,
223
226
  dark: a,
@@ -225,12 +228,12 @@ function he({
225
228
  awaiting: m
226
229
  }) {
227
230
  const { prefix: v, suffix: w } = ae(s, o), _ = c ? null : ie(s, o.format ?? "");
228
- return /* @__PURE__ */ y("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
231
+ return /* @__PURE__ */ b("div", { className: "flex flex-col justify-center px-2.5 py-1 min-w-0 gap-0.5", children: [
229
232
  /* @__PURE__ */ t(
230
233
  "span",
231
234
  {
232
235
  className: `text-[9px] font-medium uppercase tracking-wider leading-none truncate ${a ? "text-slate-500" : "text-slate-400"}`,
233
- children: n
236
+ children: l
234
237
  }
235
238
  ),
236
239
  /* @__PURE__ */ t(
@@ -242,7 +245,7 @@ function he({
242
245
  {
243
246
  className: `animate-pulse inline-block h-3 w-14 rounded ${a ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
244
247
  }
245
- ) : m && s == null ? /* @__PURE__ */ t(we, { awaiting: m, dark: a }) : /* @__PURE__ */ y(ye, { children: [
248
+ ) : m && s == null ? /* @__PURE__ */ t(xe, { awaiting: m, dark: a }) : /* @__PURE__ */ b(be, { children: [
246
249
  v && /* @__PURE__ */ t("span", { className: `text-[10px] ${a ? "text-slate-400" : "text-slate-500"}`, children: v }),
247
250
  _,
248
251
  w && /* @__PURE__ */ t("span", { className: `text-[10px] ${a ? "text-slate-400" : "text-slate-500"}`, children: w })
@@ -251,8 +254,8 @@ function he({
251
254
  )
252
255
  ] });
253
256
  }
254
- function vr({
255
- data: n,
257
+ function Rr({
258
+ data: l,
256
259
  label: s,
257
260
  style: o,
258
261
  loading: a,
@@ -260,10 +263,10 @@ function vr({
260
263
  awaiting: m
261
264
  }) {
262
265
  const v = o === "pill-dark", w = v ? "flex items-stretch divide-x divide-slate-700 rounded-md bg-slate-800/90 border border-slate-700 overflow-hidden" : "flex items-stretch divide-x divide-slate-200 rounded-md bg-white border border-slate-200 overflow-hidden dark:bg-card dark:border-border dark:divide-border";
263
- if (n && "values" in n) {
264
- const R = n.values ?? [];
265
- return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: w, children: R.map(($, N) => /* @__PURE__ */ t(
266
- he,
266
+ if (l && "values" in l) {
267
+ const R = l.values ?? [];
268
+ return R.length === 0 ? null : /* @__PURE__ */ t("div", { className: w, children: R.map(($, k) => /* @__PURE__ */ t(
269
+ ge,
267
270
  {
268
271
  label: $.label,
269
272
  value: $.value,
@@ -272,29 +275,29 @@ function vr({
272
275
  loading: !1,
273
276
  awaiting: m
274
277
  },
275
- N
278
+ k
276
279
  )) });
277
280
  }
278
281
  if (a) {
279
282
  const R = (c == null ? void 0 : c.value_fields) ?? [], $ = R.length > 0 ? R : [{ label: s }];
280
- return /* @__PURE__ */ t("div", { className: w, children: $.map((N, D) => /* @__PURE__ */ t(
281
- he,
283
+ return /* @__PURE__ */ t("div", { className: w, children: $.map((k, U) => /* @__PURE__ */ t(
284
+ ge,
282
285
  {
283
- label: N.label ?? s,
284
- display: { prefix: N.prefix ?? "", suffix: N.suffix ?? "", format: N.format ?? "" },
286
+ label: k.label ?? s,
287
+ display: { prefix: k.prefix ?? "", suffix: k.suffix ?? "", format: k.format ?? "" },
285
288
  dark: v,
286
289
  loading: !0
287
290
  },
288
- D
291
+ U
289
292
  )) });
290
293
  }
291
- if (!n) return null;
292
- const _ = n.display ?? {};
294
+ if (!l) return null;
295
+ const _ = l.display ?? {};
293
296
  return /* @__PURE__ */ t("div", { className: w, children: /* @__PURE__ */ t(
294
- he,
297
+ ge,
295
298
  {
296
299
  label: s,
297
- value: n.value,
300
+ value: l.value,
298
301
  display: _,
299
302
  dark: v,
300
303
  loading: !1,
@@ -302,8 +305,8 @@ function vr({
302
305
  }
303
306
  ) });
304
307
  }
305
- function De({ data: n }) {
306
- const s = n.values ?? [];
308
+ function Be({ data: l }) {
309
+ const s = l.values ?? [];
307
310
  return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No values" }) : /* @__PURE__ */ t(
308
311
  "div",
309
312
  {
@@ -312,9 +315,9 @@ function De({ data: n }) {
312
315
  children: s.map((o, a) => {
313
316
  var w;
314
317
  const { prefix: c, suffix: m } = ae(o.value, o.display), v = ((w = o.display) == null ? void 0 : w.format) ?? "";
315
- return /* @__PURE__ */ y("div", { className: "flex flex-col gap-0.5", children: [
318
+ return /* @__PURE__ */ b("div", { className: "flex flex-col gap-0.5", children: [
316
319
  o.label && /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: o.label }),
317
- /* @__PURE__ */ y("div", { className: "flex items-baseline gap-0.5", children: [
320
+ /* @__PURE__ */ b("div", { className: "flex items-baseline gap-0.5", children: [
318
321
  c && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: c }),
319
322
  /* @__PURE__ */ t("span", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: ie(o.value, v) }),
320
323
  m && /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500", children: m })
@@ -324,29 +327,29 @@ function De({ data: n }) {
324
327
  }
325
328
  );
326
329
  }
327
- function _r({ data: n }) {
328
- const s = n.rows ?? [], o = n.fields ?? [];
329
- return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ y("table", { className: "w-full text-[12px]", children: [
330
+ function Lr({ data: l }) {
331
+ const s = l.rows ?? [], o = l.fields ?? [];
332
+ return s.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[12px] text-slate-400", children: "No items" }) : /* @__PURE__ */ t("div", { className: "overflow-x-auto", children: /* @__PURE__ */ b("table", { className: "w-full text-[12px]", children: [
330
333
  /* @__PURE__ */ t("thead", { children: /* @__PURE__ */ t("tr", { className: "border-b border-slate-100", children: o.map((a) => /* @__PURE__ */ t("th", { className: "py-1 pr-3 text-left font-medium text-slate-500", children: a }, a)) }) }),
331
334
  /* @__PURE__ */ t("tbody", { children: s.map((a, c) => /* @__PURE__ */ t("tr", { className: "border-b border-slate-50", children: o.map((m) => /* @__PURE__ */ t("td", { className: "py-1 pr-3 text-slate-700", children: String(a[m] ?? "") }, m)) }, c)) })
332
335
  ] }) });
333
336
  }
334
- function Ue({
335
- data: n,
337
+ function He({
338
+ data: l,
336
339
  widgetId: s,
337
340
  inputs: o,
338
341
  apiBase: a,
339
342
  onAction: c
340
343
  }) {
341
- const m = n.buttons ?? [], [v, w] = P(null), _ = xe(), R = async ($) => {
344
+ const m = l.buttons ?? [], [v, w] = P(null), _ = we(), R = async ($) => {
342
345
  w($);
343
346
  try {
344
- const N = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${a}/widgets-internal/${s}/action`, {
347
+ const k = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", C = (await (await fetch(`${a}/widgets-internal/${s}/action`, {
345
348
  method: "POST",
346
349
  headers: {
347
350
  "Content-Type": "application/json",
348
351
  ..._.authHeaders,
349
- ...N ? { "x-workspace": N } : {}
352
+ ...k ? { "x-workspace": k } : {}
350
353
  },
351
354
  credentials: _.credentials,
352
355
  body: JSON.stringify({ button_index: $, inputs: o })
@@ -362,41 +365,41 @@ function Ue({
362
365
  w(null);
363
366
  }
364
367
  };
365
- return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: m.map(($, N) => {
366
- const D = $.style ?? "secondary", q = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50", C = D === "primary" ? `${q} bg-nvr-cyan text-white hover:bg-nvr-cyan/90` : D === "danger" ? `${q} bg-red-500 text-white hover:bg-red-600` : `${q} border border-slate-200 bg-white text-slate-700 hover:bg-slate-50`;
368
+ return /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: m.map(($, k) => {
369
+ const U = $.style ?? "secondary", q = "inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-[12px] font-medium transition-colors disabled:opacity-50", C = U === "primary" ? `${q} bg-nvr-cyan text-white hover:bg-nvr-cyan/90` : U === "danger" ? `${q} bg-red-500 text-white hover:bg-red-600` : `${q} border border-slate-200 bg-white text-slate-700 hover:bg-slate-50`;
367
370
  return /* @__PURE__ */ t(
368
371
  "button",
369
372
  {
370
373
  type: "button",
371
374
  className: C,
372
375
  disabled: v !== null,
373
- onClick: () => R(N),
374
- children: v === N ? "…" : String($.label ?? `Action ${N + 1}`)
376
+ onClick: () => R(k),
377
+ children: v === k ? "…" : String($.label ?? `Action ${k + 1}`)
375
378
  },
376
- N
379
+ k
377
380
  );
378
381
  }) });
379
382
  }
380
- const Nr = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
381
- function ge({
382
- buttons: n,
383
+ const $r = /* @__PURE__ */ new Set(["navigate", "field-update", "flow", "toggle"]);
384
+ function ye({
385
+ buttons: l,
383
386
  layout: s,
384
387
  widgetId: o,
385
388
  inputs: a,
386
389
  apiBase: c,
387
390
  onClientAction: m
388
391
  }) {
389
- const [v, w] = P(null), [_, R] = P(null), [$, N] = P({}), D = le(null), q = xe();
392
+ const [v, w] = P(null), [_, R] = P(null), [$, k] = P({}), U = le(null), q = we();
390
393
  function C(e) {
391
394
  return e === !0 || e === 1 ? "1" : e === !1 || e === 0 ? "0" : String(e ?? "");
392
395
  }
393
396
  function E(e, p) {
394
- const d = e.id ?? String(p);
395
- return $[d] !== void 0 ? $[d] : e.is_on !== void 0 ? e.is_on : C(a[e.toggle_input ?? ""]) === C(e.toggle_on_value ?? "1");
397
+ const u = e.id ?? String(p);
398
+ return $[u] !== void 0 ? $[u] : e.is_on !== void 0 ? e.is_on : C(a[e.toggle_input ?? ""]) === C(e.toggle_on_value ?? "1");
396
399
  }
397
400
  function G(e, p) {
398
401
  if (e.action !== "toggle") return e.label ?? `Action ${p + 1}`;
399
- const d = e.action_config, f = e.toggle_input || (d == null ? void 0 : d.toggle_input) || (d == null ? void 0 : d.field) || "", j = f && f !== e.toggle_input ? { ...e, toggle_input: f } : e;
402
+ const u = e.action_config, f = e.toggle_input || (u == null ? void 0 : u.toggle_input) || (u == null ? void 0 : u.field) || "", j = f && f !== e.toggle_input ? { ...e, toggle_input: f } : e;
400
403
  return E(j, p) ? e.label_on || e.label || `Action ${p + 1}` : e.label_off || e.label || `Action ${p + 1}`;
401
404
  }
402
405
  function se(e) {
@@ -409,10 +412,10 @@ function ge({
409
412
  }
410
413
  }
411
414
  async function r(e, p) {
412
- const d = e.id ?? String(p);
413
- R(d);
415
+ const u = e.id ?? String(p);
416
+ R(u);
414
417
  try {
415
- const f = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", x = (await (await fetch(`${c}/widgets-internal/${o}/action`, {
418
+ const f = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "", g = (await (await fetch(`${c}/widgets-internal/${o}/action`, {
416
419
  method: "POST",
417
420
  headers: {
418
421
  "Content-Type": "application/json",
@@ -422,39 +425,39 @@ function ge({
422
425
  credentials: q.credentials,
423
426
  body: JSON.stringify({ button_index: p, inputs: a })
424
427
  })).json()).data;
425
- if (x != null && x.redirect_url)
428
+ if (g != null && g.redirect_url)
426
429
  try {
427
- const k = new URL(x.redirect_url, window.location.origin);
428
- k.origin === window.location.origin && (window.location.href = k.toString());
430
+ const N = new URL(g.redirect_url, window.location.origin);
431
+ N.origin === window.location.origin && (window.location.href = N.toString());
429
432
  } catch {
430
433
  }
431
434
  } finally {
432
435
  R(null);
433
436
  }
434
437
  }
435
- function J(e, p) {
436
- const d = e.action ?? "open-url";
437
- if (Nr.has(d)) {
438
- if (d === "toggle") {
438
+ function z(e, p) {
439
+ const u = e.action ?? "open-url";
440
+ if ($r.has(u)) {
441
+ if (u === "toggle") {
439
442
  const f = e.id ?? String(p);
440
- N((j) => ({ ...j, [f]: !E(e, p) }));
443
+ k((j) => ({ ...j, [f]: !E(e, p) }));
441
444
  }
442
445
  r(e, p);
443
446
  return;
444
447
  }
445
- if (d === "open-url" && e.url) {
448
+ if (u === "open-url" && e.url) {
446
449
  const f = se(e.url);
447
450
  if (!f) return;
448
451
  e.new_tab ? window.open(f, "_blank", "noopener,noreferrer") : window.location.href = f;
449
- } else if (d === "email") {
452
+ } else if (u === "email") {
450
453
  const f = [];
451
454
  e.email_subject && f.push(`subject=${encodeURIComponent(e.email_subject)}`), e.email_body && f.push(`body=${encodeURIComponent(e.email_body)}`), window.location.href = `mailto:${e.email_to ?? ""}${f.length ? `?${f.join("&")}` : ""}`;
452
- } else if (d === "copy") {
455
+ } else if (u === "copy") {
453
456
  const f = e.copy_value ?? "";
454
457
  navigator.clipboard.writeText(f).then(() => {
455
- w(e.id ?? String(p)), D.current && clearTimeout(D.current), D.current = setTimeout(() => w(null), 1800);
458
+ w(e.id ?? String(p)), U.current && clearTimeout(U.current), U.current = setTimeout(() => w(null), 1800);
456
459
  });
457
- } else d === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (m == null || m({
460
+ } else u === "open-sidebar" && e.sidebar_collection && e.sidebar_id && (m == null || m({
458
461
  type: "open-sidebar",
459
462
  collection: e.sidebar_collection,
460
463
  itemId: e.sidebar_id
@@ -463,67 +466,67 @@ function ge({
463
466
  function i(e) {
464
467
  const p = e.replace("#", "");
465
468
  if (p.length < 6) return !0;
466
- const d = parseInt(p.slice(0, 2), 16), f = parseInt(p.slice(2, 4), 16), j = parseInt(p.slice(4, 6), 16);
467
- return (d * 299 + f * 587 + j * 114) / 1e3 > 128;
469
+ const u = parseInt(p.slice(0, 2), 16), f = parseInt(p.slice(2, 4), 16), j = parseInt(p.slice(4, 6), 16);
470
+ return (u * 299 + f * 587 + j * 114) / 1e3 > 128;
468
471
  }
469
- function Y(e, p, d) {
470
- const f = e.id ?? String(p), j = v === f, U = _ === f;
471
- let x = e.label ?? "Button", k = e.variant ?? "secondary";
472
- const W = e.action_config, A = e.toggle_input || (W == null ? void 0 : W.toggle_input) || (W == null ? void 0 : W.field) || "";
472
+ function Z(e, p, u) {
473
+ const f = e.id ?? String(p), j = v === f, A = _ === f;
474
+ let g = e.label ?? "Button", N = e.variant ?? "secondary";
475
+ const W = e.action_config, D = e.toggle_input || (W == null ? void 0 : W.toggle_input) || (W == null ? void 0 : W.field) || "";
473
476
  if (e.action === "toggle") {
474
- const I = A && A !== e.toggle_input ? { ...e, toggle_input: A } : e, H = E(I, p);
475
- x = H ? e.label_on || x : e.label_off || x, k = H ? e.variant_on ?? k : e.variant_off ?? k;
477
+ const O = D && D !== e.toggle_input ? { ...e, toggle_input: D } : e, V = E(O, p);
478
+ g = V ? e.label_on || g : e.label_off || g, N = V ? e.variant_on ?? N : e.variant_off ?? N;
476
479
  }
477
- const B = e.icon ? Q[e.icon] : null, L = e.color ? {
480
+ const H = e.icon ? Q[e.icon] : null, L = e.color ? {
478
481
  backgroundColor: e.color,
479
482
  borderColor: e.color,
480
483
  color: i(e.color) ? "#1e293b" : "#ffffff"
481
484
  } : void 0;
482
- return /* @__PURE__ */ y(
485
+ return /* @__PURE__ */ b(
483
486
  ne,
484
487
  {
485
488
  type: "button",
486
- variant: k,
489
+ variant: N,
487
490
  size: "sm",
488
491
  className: "h-7 gap-1.5 text-[12px]",
489
492
  style: L,
490
493
  disabled: _ !== null,
491
- onClick: () => J(e, p),
494
+ onClick: () => z(e, p),
492
495
  children: [
493
- B && /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5 shrink-0" }),
494
- U ? "…" : j ? "✓ Copied" : x
496
+ H && /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5 shrink-0" }),
497
+ A ? "…" : j ? "✓ Copied" : g
495
498
  ]
496
499
  },
497
500
  f
498
501
  );
499
502
  }
500
- if (n.length === 0) return null;
501
- if (s === "split" && n.length > 1) {
502
- const [e, ...p] = n, d = e.id ?? "0", f = _ === d, j = e.action === "none" || !e.action;
503
- let U = e.label ?? "Button", x = e.variant ?? "default";
504
- const k = e.action_config, W = e.toggle_input || (k == null ? void 0 : k.toggle_input) || (k == null ? void 0 : k.field) || "";
503
+ if (l.length === 0) return null;
504
+ if (s === "split" && l.length > 1) {
505
+ const [e, ...p] = l, u = e.id ?? "0", f = _ === u, j = e.action === "none" || !e.action;
506
+ let A = e.label ?? "Button", g = e.variant ?? "default";
507
+ const N = e.action_config, W = e.toggle_input || (N == null ? void 0 : N.toggle_input) || (N == null ? void 0 : N.field) || "";
505
508
  if (e.action === "toggle" && W) {
506
- const L = W !== e.toggle_input ? { ...e, toggle_input: W } : e, I = E(L, 0);
507
- U = I ? e.label_on || U : e.label_off || U, x = I ? e.variant_on ?? x : e.variant_off ?? x;
509
+ const L = W !== e.toggle_input ? { ...e, toggle_input: W } : e, O = E(L, 0);
510
+ A = O ? e.label_on || A : e.label_off || A, g = O ? e.variant_on ?? g : e.variant_off ?? g;
508
511
  }
509
- const A = e.icon ? Q[e.icon] : null, B = e.color ? {
512
+ const D = e.icon ? Q[e.icon] : null, H = e.color ? {
510
513
  backgroundColor: e.color,
511
514
  borderColor: e.color,
512
515
  color: i(e.color) ? "#1e293b" : "#ffffff"
513
516
  } : void 0;
514
- return j ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ y(Te, { children: [
515
- /* @__PURE__ */ t(Ie, { asChild: !0, children: /* @__PURE__ */ y(
517
+ return j ? /* @__PURE__ */ t("div", { className: "flex items-center", children: /* @__PURE__ */ b(Ae, { children: [
518
+ /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ b(
516
519
  ne,
517
520
  {
518
521
  type: "button",
519
- variant: x,
522
+ variant: g,
520
523
  size: "sm",
521
524
  className: "h-7 gap-1.5 text-[12px]",
522
- style: B,
525
+ style: H,
523
526
  disabled: _ !== null,
524
527
  children: [
525
- A && /* @__PURE__ */ t(A, { className: "h-3.5 w-3.5 shrink-0" }),
526
- U,
528
+ D && /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
529
+ A,
527
530
  /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
528
531
  "path",
529
532
  {
@@ -537,47 +540,47 @@ function ge({
537
540
  ]
538
541
  }
539
542
  ) }),
540
- /* @__PURE__ */ t(Oe, { align: "end", className: "min-w-[140px]", children: p.map((L, I) => /* @__PURE__ */ y(
541
- qe,
543
+ /* @__PURE__ */ t(We, { align: "end", className: "min-w-[140px]", children: p.map((L, O) => /* @__PURE__ */ b(
544
+ Me,
542
545
  {
543
546
  className: "cursor-pointer text-[12px]",
544
- onSelect: () => J(L, I + 1),
547
+ onSelect: () => z(L, O + 1),
545
548
  children: [
546
549
  L.icon && Q[L.icon] && (() => {
547
- const H = Q[L.icon];
548
- return /* @__PURE__ */ t(H, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
550
+ const V = Q[L.icon];
551
+ return /* @__PURE__ */ t(V, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
549
552
  })(),
550
- G(L, I + 1)
553
+ G(L, O + 1)
551
554
  ]
552
555
  },
553
- L.id ?? I
556
+ L.id ?? O
554
557
  )) })
555
- ] }) }) : /* @__PURE__ */ y("div", { className: "flex items-center", children: [
556
- /* @__PURE__ */ y(
558
+ ] }) }) : /* @__PURE__ */ b("div", { className: "flex items-center", children: [
559
+ /* @__PURE__ */ b(
557
560
  ne,
558
561
  {
559
562
  type: "button",
560
- variant: x,
563
+ variant: g,
561
564
  size: "sm",
562
565
  className: "h-7 rounded-r-none text-[12px] gap-1.5 border-r-0",
563
- style: B,
566
+ style: H,
564
567
  disabled: _ !== null,
565
- onClick: () => J(e, 0),
568
+ onClick: () => z(e, 0),
566
569
  children: [
567
- A && /* @__PURE__ */ t(A, { className: "h-3.5 w-3.5 shrink-0" }),
568
- f ? "…" : v === d ? "✓ Copied" : U
570
+ D && /* @__PURE__ */ t(D, { className: "h-3.5 w-3.5 shrink-0" }),
571
+ f ? "…" : v === u ? "✓ Copied" : A
569
572
  ]
570
573
  }
571
574
  ),
572
- /* @__PURE__ */ y(Te, { children: [
573
- /* @__PURE__ */ t(Ie, { asChild: !0, children: /* @__PURE__ */ t(
575
+ /* @__PURE__ */ b(Ae, { children: [
576
+ /* @__PURE__ */ t(Pe, { asChild: !0, children: /* @__PURE__ */ t(
574
577
  ne,
575
578
  {
576
579
  type: "button",
577
- variant: x,
580
+ variant: g,
578
581
  size: "sm",
579
582
  className: "h-7 rounded-l-none px-1.5 text-[12px]",
580
- style: B,
583
+ style: H,
581
584
  disabled: _ !== null,
582
585
  "aria-label": "More actions",
583
586
  children: /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ t(
@@ -592,28 +595,28 @@ function ge({
592
595
  ) })
593
596
  }
594
597
  ) }),
595
- /* @__PURE__ */ t(Oe, { align: "end", className: "min-w-[140px]", children: p.map((L, I) => /* @__PURE__ */ y(
596
- qe,
598
+ /* @__PURE__ */ t(We, { align: "end", className: "min-w-[140px]", children: p.map((L, O) => /* @__PURE__ */ b(
599
+ Me,
597
600
  {
598
601
  className: "text-[12px]",
599
- onSelect: () => J(L, I + 1),
602
+ onSelect: () => z(L, O + 1),
600
603
  children: [
601
604
  L.icon && Q[L.icon] && (() => {
602
- const H = Q[L.icon];
603
- return /* @__PURE__ */ t(H, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
605
+ const V = Q[L.icon];
606
+ return /* @__PURE__ */ t(V, { className: "mr-1.5 h-3.5 w-3.5 shrink-0" });
604
607
  })(),
605
- G(L, I + 1)
608
+ G(L, O + 1)
606
609
  ]
607
610
  },
608
- L.id ?? I
611
+ L.id ?? O
609
612
  )) })
610
613
  ] })
611
614
  ] });
612
615
  }
613
- return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: n.map((e, p) => Y(e, p)) });
616
+ return /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-1.5", children: l.map((e, p) => Z(e, p)) });
614
617
  }
615
- function Br({
616
- widgetId: n,
618
+ function Gr({
619
+ widgetId: l,
617
620
  inputBindings: s = [],
618
621
  itemDraft: o = {},
619
622
  itemCollection: a,
@@ -624,212 +627,229 @@ function Br({
624
627
  apiBase: _,
625
628
  compact: R = !1,
626
629
  strip: $ = !1,
627
- onClientAction: N,
628
- onWidgetType: D,
630
+ onClientAction: k,
631
+ onWidgetType: U,
629
632
  onContentChange: q
630
633
  }) {
631
- var Ce, Ee;
632
- const C = xe(), E = _ ?? C.apiBase, [G, se] = P(v), [r, J] = P(null), [i, Y] = P(null), [e, p] = P(!0), [d, f] = P(!0), [j, U] = P(!0), [x, k] = P(null), [W, A] = P(0), [B, L] = P(null), I = le(!1), H = Xt(() => {
633
- I.current = !0, A((l) => l + 1);
634
- }, []), oe = le(null), ce = le(!1), be = Be();
635
- re(() => {
636
- const l = r == null ? void 0 : r.widget_type;
637
- if (l !== "rollup" && l !== "review_list" && l !== "custom-query") return;
638
- let u = null;
639
- const g = be.getQueryCache().subscribe((S) => {
634
+ var je, Te;
635
+ const C = we(), E = _ ?? C.apiBase, [G, se] = P(v), [r, z] = P(null), [i, Z] = P(null), [e, p] = P(!0), [u, f] = P(!0), [j, A] = P(!0), [g, N] = P(null), [W, D] = P(0), [H, L] = P(null), O = le(!1), V = Oe(() => {
636
+ O.current = !0, D((n) => n + 1);
637
+ }, []), oe = le(null), ce = le(!1), ve = Qe();
638
+ Y(() => {
639
+ const n = r == null ? void 0 : r.widget_type;
640
+ if (n !== "rollup" && n !== "review_list" && n !== "custom-query") return;
641
+ let d = null;
642
+ const y = ve.getQueryCache().subscribe((S) => {
640
643
  var K;
641
644
  if (S.type !== "updated" || ((K = S.action) == null ? void 0 : K.type) !== "success") return;
642
- const b = S.query.queryKey, T = b == null ? void 0 : b[0];
643
- typeof T == "string" && (!T.startsWith("o2m-rows") && !T.startsWith("nested") && T !== "match-agg" && T !== "m2m-items" || S.query.state.dataUpdateCount <= 1 || T.startsWith("o2m-rows") && oe.current != null && String(b[3]) !== String(oe.current) || (u && clearTimeout(u), u = setTimeout(() => A((te) => te + 1), 400)));
645
+ const x = S.query.queryKey, T = x == null ? void 0 : x[0];
646
+ typeof T == "string" && (!T.startsWith("o2m-rows") && !T.startsWith("nested") && T !== "match-agg" && T !== "m2m-items" || S.query.state.dataUpdateCount <= 1 || T.startsWith("o2m-rows") && oe.current != null && String(x[3]) !== String(oe.current) || (d && clearTimeout(d), d = setTimeout(() => D((re) => re + 1), 400)));
644
647
  });
645
648
  return () => {
646
- u && clearTimeout(u), g();
649
+ d && clearTimeout(d), y();
647
650
  };
648
- }, [be, r == null ? void 0 : r.widget_type]);
649
- const ve = {};
650
- for (const [l, u] of Object.entries(o))
651
- l.includes(".") || (u == null || typeof u != "object") && (ve[l] = u);
652
- const O = { ...ve, ...br(s, o) }, de = pr(), F = je(() => {
651
+ }, [ve, r == null ? void 0 : r.widget_type]);
652
+ const _e = {};
653
+ for (const [n, d] of Object.entries(o))
654
+ n.includes(".") || (d == null || typeof d != "object") && (_e[n] = d);
655
+ const I = { ..._e, ...Sr(s, o) }, de = yr(), F = Ie(() => {
653
656
  if ((r == null ? void 0 : r.widget_type) !== "rollup" || !de) return null;
654
- const l = r.config, u = l == null ? void 0 : l.collection;
655
- if (!u) return null;
656
- const g = {
657
+ const n = r.config, d = n == null ? void 0 : n.collection;
658
+ if (!d) return null;
659
+ const y = {
657
660
  created: [],
658
661
  updated: [],
659
662
  deleted: []
660
663
  };
661
664
  for (const S of de.byGrid.values()) {
662
- const b = S[u];
663
- b && (g.created.push(...b.created), g.updated.push(...b.updated), g.deleted.push(...b.deleted));
665
+ const x = S[d];
666
+ x && (y.created.push(...x.created), y.updated.push(...x.updated), y.deleted.push(...x.deleted));
664
667
  }
665
- return !g.created.length && !g.updated.length && !g.deleted.length ? null : g;
666
- }, [r, de]), Pe = je(
668
+ return !y.created.length && !y.updated.length && !y.deleted.length ? null : y;
669
+ }, [r, de]), Je = Ie(
667
670
  () => F ? JSON.stringify(F) : "",
668
671
  [F]
669
- ), h = (Ce = r == null ? void 0 : r.config) == null ? void 0 : Ce.drilldown, Z = Yt(), ue = h != null && h.id_input ? O[h.id_input] : null, pe = !!Z && !!(h != null && h.collection) && ue != null && ue !== "", _e = async () => {
670
- var S, b;
672
+ ), h = (je = r == null ? void 0 : r.config) == null ? void 0 : je.drilldown, ee = nr(), ue = h != null && h.id_input ? I[h.id_input] : null, pe = !!ee && !!(h != null && h.collection) && ue != null && ue !== "", Ne = async () => {
673
+ var S, x;
671
674
  if (!pe || !(h != null && h.collection)) return;
672
- const l = String(ue);
673
- let u = null;
674
- const g = (T) => fetch(`${E}${T}`, {
675
+ const n = String(ue);
676
+ let d = null;
677
+ const y = (T) => fetch(`${E}${T}`, {
675
678
  credentials: C.credentials,
676
679
  headers: C.authHeaders
677
680
  });
678
681
  try {
679
682
  if (h.match_field) {
680
- const T = await g(
683
+ const T = await y(
681
684
  `/items/${h.collection}?filter=${encodeURIComponent(
682
- JSON.stringify({ [h.match_field]: { _eq: l } })
685
+ JSON.stringify({ [h.match_field]: { _eq: n } })
683
686
  )}&fields=id&limit=1`
684
687
  );
685
688
  if (T.ok) {
686
- const K = await T.json(), te = (b = (S = K == null ? void 0 : K.data) == null ? void 0 : S[0]) == null ? void 0 : b.id;
687
- te != null && (u = String(te));
689
+ const K = await T.json(), re = (x = (S = K == null ? void 0 : K.data) == null ? void 0 : S[0]) == null ? void 0 : x.id;
690
+ re != null && (d = String(re));
688
691
  }
689
692
  }
690
- u == null && (await g(`/items/${h.collection}/${encodeURIComponent(l)}?fields=id`)).ok && (u = l);
693
+ d == null && (await y(`/items/${h.collection}/${encodeURIComponent(n)}?fields=id`)).ok && (d = n);
691
694
  } catch {
692
695
  return;
693
696
  }
694
- u != null && (Z == null || Z.open({
697
+ d != null && (ee == null || ee.open({
695
698
  collection: h.collection,
696
- itemId: u,
699
+ itemId: d,
697
700
  layoutId: h.layout_id ?? null,
698
701
  width: h.width ?? "75%",
699
702
  title: h.title
700
703
  }));
701
704
  };
702
- if (O.record_id == null || O.record_id === "") {
703
- const l = o.id;
704
- l != null && l !== "" && (O.record_id = l);
705
+ if (I.record_id == null || I.record_id === "") {
706
+ const n = o.id;
707
+ n != null && n !== "" && (I.record_id = n);
705
708
  }
706
709
  oe.current = o.id ?? null;
707
- const We = JSON.stringify(O) + (a ?? "") + Pe, Me = er(We, 400);
708
- function Ne() {
709
- const l = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
710
+ const ze = JSON.stringify(I) + (a ?? "") + Je, Ke = ar(ze, 400);
711
+ function ke() {
712
+ const n = typeof window < "u" ? localStorage.getItem("nivaro_workspace") ?? "" : "";
710
713
  return {
711
714
  "Content-Type": "application/json",
712
715
  ...C.authHeaders,
713
- ...l ? { "x-workspace": l } : {}
716
+ ...n ? { "x-workspace": n } : {}
714
717
  };
715
718
  }
716
- const X = Zt(), z = He({
717
- queryKey: ["nvr-widget-def", n],
719
+ const X = lr(), B = Ge({
720
+ queryKey: ["nvr-widget-def", l],
718
721
  enabled: c,
719
722
  staleTime: 6e4,
720
723
  retry: !1,
721
724
  queryFn: async () => {
722
725
  if (X)
723
- return (await X.request(tr(`/widgets-internal/${n}`))).data;
724
- const l = await fetch(`${E}/widgets-internal/${n}`, {
726
+ return (await X.request(ir(`/widgets-internal/${l}`))).data;
727
+ const n = await fetch(`${E}/widgets-internal/${l}`, {
725
728
  credentials: C.credentials,
726
- headers: Ne()
729
+ headers: ke()
727
730
  });
728
- if (!l.ok) throw new Error("Widget not found");
729
- return (await l.json()).data;
731
+ if (!n.ok) throw Object.assign(new Error("Widget not found"), { status: n.status });
732
+ return (await n.json()).data;
730
733
  }
731
- });
732
- re(() => {
733
- c && (z.data ? (J(z.data), p(!1), k(null), D == null || D(z.data.widget_type)) : z.error && k("Widget not found"));
734
- }, [c, z.data, z.error]), re(() => {
734
+ }), Se = B.refetch, fe = Oe(() => {
735
+ N(null), B.error ? Se() : D((n) => n + 1);
736
+ }, [B.error, Se]);
737
+ Y(() => {
738
+ const n = () => D((d) => d + 1);
739
+ return window.addEventListener(De, n), () => window.removeEventListener(De, n);
740
+ }, []), Y(() => {
741
+ c && (B.data ? (z(B.data), p(!1), N(null), U == null || U(B.data.widget_type)) : B.error && N(qe(B.error, "this widget")));
742
+ }, [c, B.data, B.error]), Y(() => {
735
743
  if (!c || !r) return;
736
- const l = O.record_id == null || O.record_id === "";
737
- if (r.widget_type === "review_list" && l || r.widget_type === "rollup" && l && !F) return;
738
- let u = !1;
739
- return ce.current || (f(!0), U(!0)), (async () => {
744
+ const n = I.record_id == null || I.record_id === "";
745
+ if (r.widget_type === "review_list" && n || r.widget_type === "rollup" && n && !F) return;
746
+ let d = !1;
747
+ return ce.current || (f(!0), A(!0)), (async () => {
740
748
  try {
741
- const g = {
742
- inputs: F ? { ...O, staged: F } : O,
749
+ const y = {
750
+ inputs: F ? { ...I, staged: F } : I,
743
751
  draft: o,
744
752
  bindings: s,
745
753
  item_collection: a
746
754
  };
747
- I.current && (g.refresh = !0, I.current = !1), L(g);
755
+ O.current && (y.refresh = !0, O.current = !1), L(y);
748
756
  let S;
749
757
  if (X)
750
758
  S = await X.request(
751
- rr(`/widgets-internal/${n}/render`, g)
759
+ sr(`/widgets-internal/${l}/render`, y)
752
760
  );
753
761
  else {
754
- const b = await fetch(`${E}/widgets-internal/${n}/render`, {
762
+ const x = await fetch(`${E}/widgets-internal/${l}/render`, {
755
763
  method: "POST",
756
764
  credentials: C.credentials,
757
- headers: Ne(),
758
- body: JSON.stringify(g)
765
+ headers: ke(),
766
+ body: JSON.stringify(y)
759
767
  });
760
- if (!b.ok) throw new Error("Render failed");
761
- S = await b.json();
768
+ if (!x.ok)
769
+ throw Object.assign(new Error("Render failed"), { status: x.status });
770
+ S = await x.json();
762
771
  }
763
- if (u) return;
764
- u || (ce.current = !0, Y(S.data), f(!1), k(null));
765
- } catch (g) {
766
- u || k(String(g));
772
+ if (d) return;
773
+ d || (ce.current = !0, Z(S.data), f(!1), N(null));
774
+ } catch (y) {
775
+ d || N(qe(y, "this widget"));
767
776
  } finally {
768
- u || U(!1);
777
+ d || A(!1);
769
778
  }
770
779
  })(), () => {
771
- u = !0;
780
+ d = !0;
772
781
  };
773
- }, [n, E, Me, c, W, r == null ? void 0 : r.widget_type]), re(() => {
782
+ }, [l, E, Ke, c, W, r == null ? void 0 : r.widget_type]), Y(() => {
774
783
  if (q) {
775
- if (x) {
784
+ if (g) {
776
785
  q(!0);
777
786
  return;
778
787
  }
779
788
  if (i) {
780
789
  if ((r == null ? void 0 : r.widget_type) === "review_list" || (r == null ? void 0 : r.widget_type) === "rollup") {
781
- const l = i.rows;
782
- q(Array.isArray(l) && l.length > 0);
790
+ const n = i.rows;
791
+ q(Array.isArray(n) && n.length > 0);
783
792
  return;
784
793
  }
785
794
  if ((r == null ? void 0 : r.widget_type) === "custom-query" && "rows" in i) {
786
- const l = i.rows;
787
- q(Array.isArray(l) && l.length > 0);
795
+ const n = i.rows;
796
+ q(Array.isArray(n) && n.length > 0);
788
797
  return;
789
798
  }
790
799
  q(!0);
791
800
  }
792
801
  }
793
- }, [i, x, r == null ? void 0 : r.widget_type, q]);
794
- const V = m || (r == null ? void 0 : r.name) || "", ee = (r == null ? void 0 : r.widget_type) === "report_widget" && i ? mr(i) : i, M = (() => {
795
- const l = i == null ? void 0 : i.awaiting;
796
- if (!Array.isArray(l) || l.length === 0) return null;
797
- const u = l.map((g) => {
798
- const S = s.find((T) => T.key === g && T.binding_type === "item_field");
799
- return String((S == null ? void 0 : S.binding_value) ?? g).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (T) => T.toUpperCase());
802
+ }, [i, g, r == null ? void 0 : r.widget_type, q]);
803
+ const J = m || (r == null ? void 0 : r.name) || "", te = (r == null ? void 0 : r.widget_type) === "report_widget" && i ? wr(i) : i, M = (() => {
804
+ const n = i == null ? void 0 : i.awaiting;
805
+ if (!Array.isArray(n) || n.length === 0) return null;
806
+ const d = n.map((y) => {
807
+ const S = s.find((T) => T.key === y && T.binding_type === "item_field");
808
+ return String((S == null ? void 0 : S.binding_value) ?? y).split(".")[0].replace(/_id$/, "").replace(/_/g, " ").replace(/^\w/, (T) => T.toUpperCase());
800
809
  });
801
- return [...new Set(u)].join(", ");
802
- })(), ke = O.record_id, Se = ke == null || ke === "";
803
- if ((r == null ? void 0 : r.widget_type) === "review_list" && Se || (r == null ? void 0 : r.widget_type) === "rollup" && Se && !F) return null;
810
+ return [...new Set(d)].join(", ");
811
+ })(), Re = I.record_id, Le = Re == null || Re === "";
812
+ if ((r == null ? void 0 : r.widget_type) === "review_list" && Le || (r == null ? void 0 : r.widget_type) === "rollup" && Le && !F) return null;
804
813
  if (R) {
805
- const l = ((Ee = r == null ? void 0 : r.config) == null ? void 0 : Ee.compact_style) ?? "default", u = l === "pill-dark" || l === "pill-light";
806
- if (x)
807
- return /* @__PURE__ */ t("span", { className: "text-[11px] text-red-400", title: x, children: "!" });
814
+ const n = ((Te = r == null ? void 0 : r.config) == null ? void 0 : Te.compact_style) ?? "default", d = n === "pill-dark" || n === "pill-light";
815
+ if (g)
816
+ return /* @__PURE__ */ t(
817
+ "button",
818
+ {
819
+ type: "button",
820
+ onClick: fe,
821
+ "data-load-error": "",
822
+ "data-tip": `${g} Click to try again.`,
823
+ "aria-label": `${g} Try again`,
824
+ className: "inline-flex h-5 w-5 items-center justify-center rounded text-amber-500 hover:bg-amber-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-amber-400 dark:hover:bg-amber-400/10",
825
+ children: /* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
826
+ }
827
+ );
808
828
  if ($) {
809
829
  if (e)
810
- return /* @__PURE__ */ y("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
830
+ return /* @__PURE__ */ b("div", { className: "flex h-full w-36 flex-col justify-center px-4 py-2.5", children: [
811
831
  /* @__PURE__ */ t("span", { className: "animate-pulse h-2 w-10 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))] mb-1" }),
812
832
  /* @__PURE__ */ t("span", { className: "animate-pulse h-3.5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
813
833
  ] });
814
834
  if (r.widget_type === "button-group")
815
- return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: d ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : i && /* @__PURE__ */ t(
816
- ge,
835
+ return /* @__PURE__ */ t("div", { className: "h-full flex items-center px-3", children: u ? /* @__PURE__ */ t("div", { className: "animate-pulse h-7 w-24 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : i && /* @__PURE__ */ t(
836
+ ye,
817
837
  {
818
838
  buttons: i.buttons ?? [],
819
839
  layout: i.layout ?? "flat",
820
- widgetId: n,
821
- inputs: O,
840
+ widgetId: l,
841
+ inputs: I,
822
842
  apiBase: E,
823
- onClientAction: N
843
+ onClientAction: k
824
844
  }
825
845
  ) });
826
846
  {
827
- const g = /* @__PURE__ */ t(
828
- xr,
847
+ const y = /* @__PURE__ */ t(
848
+ Nr,
829
849
  {
830
- data: d ? null : ee ?? null,
850
+ data: u ? null : te ?? null,
831
851
  label: m || r.name,
832
- loading: d,
852
+ loading: u,
833
853
  widgetConfig: r.config,
834
854
  awaiting: M
835
855
  }
@@ -837,31 +857,31 @@ function Br({
837
857
  "button",
838
858
  {
839
859
  type: "button",
840
- onClick: () => void _e(),
860
+ onClick: () => void Ne(),
841
861
  title: (h == null ? void 0 : h.title) ?? "Open details",
842
862
  className: "h-full w-full cursor-pointer text-left transition-colors hover:bg-nvr-cyan/5",
843
863
  "data-nvr-widget-drill": h == null ? void 0 : h.collection,
844
- children: g
864
+ children: y
845
865
  }
846
- ) : g, b = i == null ? void 0 : i.cache;
847
- return b != null && b.cache_ttl ? /* @__PURE__ */ y(
866
+ ) : y, x = i == null ? void 0 : i.cache;
867
+ return x != null && x.cache_ttl ? /* @__PURE__ */ b(
848
868
  "div",
849
869
  {
850
870
  className: "group/cache relative h-full w-full",
851
- "data-cache-stamp": b.cached ? "cached" : "fresh",
871
+ "data-cache-stamp": x.cached ? "cached" : "fresh",
852
872
  children: [
853
873
  S,
854
874
  /* @__PURE__ */ t(
855
875
  "button",
856
876
  {
857
877
  type: "button",
858
- onClick: H,
859
- disabled: d,
878
+ onClick: V,
879
+ disabled: u,
860
880
  "data-cache-refresh": !0,
861
881
  "aria-label": "Refresh this figure",
862
- "data-tip": dr(b),
882
+ "data-tip": hr(x),
863
883
  className: "absolute bottom-1 right-1 rounded p-0.5 text-muted-foreground opacity-0 transition-opacity hover:bg-muted group-hover/cache:opacity-100 focus-visible:opacity-100 disabled:opacity-50",
864
- children: /* @__PURE__ */ t(Ae, { className: `h-3 w-3 ${d ? "animate-spin" : ""}` })
884
+ children: /* @__PURE__ */ t(Fe, { className: `h-3 w-3 ${u ? "animate-spin" : ""}` })
865
885
  }
866
886
  )
867
887
  ]
@@ -869,22 +889,22 @@ function Br({
869
889
  ) : S;
870
890
  }
871
891
  }
872
- if (u) {
892
+ if (d) {
873
893
  if (e)
874
894
  return /* @__PURE__ */ t(
875
895
  "div",
876
896
  {
877
- className: `animate-pulse h-8 w-36 rounded-md ${l === "pill-dark" ? "bg-slate-700 border border-slate-700" : "bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] border border-slate-200"}`
897
+ className: `animate-pulse h-8 w-36 rounded-md ${n === "pill-dark" ? "bg-slate-700 border border-slate-700" : "bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] border border-slate-200"}`
878
898
  }
879
899
  );
880
900
  {
881
- const g = /* @__PURE__ */ t(
882
- vr,
901
+ const y = /* @__PURE__ */ t(
902
+ Rr,
883
903
  {
884
- data: d ? null : ee ?? null,
904
+ data: u ? null : te ?? null,
885
905
  label: m || r.name,
886
- style: l,
887
- loading: d,
906
+ style: n,
907
+ loading: u,
888
908
  widgetConfig: r.config,
889
909
  awaiting: M
890
910
  }
@@ -893,91 +913,91 @@ function Br({
893
913
  "button",
894
914
  {
895
915
  type: "button",
896
- onClick: () => void _e(),
916
+ onClick: () => void Ne(),
897
917
  title: (h == null ? void 0 : h.title) ?? "Open details",
898
918
  className: "cursor-pointer text-left",
899
919
  "data-nvr-widget-drill": h == null ? void 0 : h.collection,
900
- children: g
920
+ children: y
901
921
  }
902
- ) : g;
922
+ ) : y;
903
923
  }
904
924
  }
905
- return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: d ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : i && r && /* @__PURE__ */ y(ye, { children: [
906
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(me, { data: i, awaiting: M }),
907
- r.widget_type === "report_widget" && ee && /* @__PURE__ */ t(me, { data: ee, awaiting: M }),
908
- r.widget_type === "custom-query" && "values" in i && /* @__PURE__ */ t(De, { data: i }),
925
+ return e ? /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: u ? /* @__PURE__ */ t("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ t("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : i && r && /* @__PURE__ */ b(be, { children: [
926
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(he, { data: i, awaiting: M }),
927
+ r.widget_type === "report_widget" && te && /* @__PURE__ */ t(he, { data: te, awaiting: M }),
928
+ r.widget_type === "custom-query" && "values" in i && /* @__PURE__ */ t(Be, { data: i }),
909
929
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
910
- Ue,
930
+ He,
911
931
  {
912
932
  data: i,
913
- widgetId: n,
914
- inputs: O,
933
+ widgetId: l,
934
+ inputs: I,
915
935
  apiBase: E
916
936
  }
917
937
  ),
918
938
  r.widget_type === "button-group" && /* @__PURE__ */ t(
919
- ge,
939
+ ye,
920
940
  {
921
941
  buttons: i.buttons ?? [],
922
942
  layout: i.layout ?? "flat",
923
- widgetId: n,
924
- inputs: O,
943
+ widgetId: l,
944
+ inputs: I,
925
945
  apiBase: E,
926
- onClientAction: N
946
+ onClientAction: k
927
947
  }
928
948
  )
929
949
  ] }) });
930
950
  }
931
- const Re = /* @__PURE__ */ y("div", { className: "space-y-2 py-0.5", children: [
951
+ const $e = /* @__PURE__ */ b("div", { className: "space-y-2 py-0.5", children: [
932
952
  /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-2/3 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
933
953
  /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-full rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
934
954
  /* @__PURE__ */ t("div", { className: "animate-pulse h-4 w-5/6 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
935
- ] }), Le = X ? /* @__PURE__ */ t(
936
- cr,
955
+ ] }), Ce = X ? /* @__PURE__ */ t(
956
+ mr,
937
957
  {
938
958
  className: "mt-2",
939
- pending: d && !!r,
940
- request: B ? { method: "POST", url: `/widgets-internal/${n}/render`, body: B } : null,
941
- label: V || "Widget",
942
- onResult: (l) => {
943
- const u = l == null ? void 0 : l.data;
944
- u && (ce.current = !0, Y(u), f(!1), U(!1), k(null));
959
+ pending: u && !!r,
960
+ request: H ? { method: "POST", url: `/widgets-internal/${l}/render`, body: H } : null,
961
+ label: J || "Widget",
962
+ onResult: (n) => {
963
+ const d = n == null ? void 0 : n.data;
964
+ d && (ce.current = !0, Z(d), f(!1), A(!1), N(null));
945
965
  },
946
- onGone: () => A((l) => l + 1)
966
+ onGone: () => D((n) => n + 1)
947
967
  }
948
968
  ) : null;
949
969
  if (w)
950
- return /* @__PURE__ */ y("div", { children: [
951
- j && Re,
952
- j && Le,
953
- x && /* @__PURE__ */ t("p", { className: "text-[12px] text-red-500", children: x }),
954
- !j && !x && i && r && $e()
970
+ return /* @__PURE__ */ b("div", { children: [
971
+ j && $e,
972
+ j && Ce,
973
+ g && /* @__PURE__ */ t(Ue, { message: g, onRetry: fe }),
974
+ !j && !g && i && r && Ee()
955
975
  ] });
956
- return /* @__PURE__ */ y("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
957
- /* @__PURE__ */ y(
976
+ return /* @__PURE__ */ b("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
977
+ /* @__PURE__ */ b(
958
978
  "button",
959
979
  {
960
980
  type: "button",
961
981
  className: "flex w-full items-center justify-between px-4 py-3 text-left",
962
- onClick: () => se((l) => !l),
982
+ onClick: () => se((n) => !n),
963
983
  children: [
964
- /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: V || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
984
+ /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: J || /* @__PURE__ */ t("span", { className: "inline-block h-3 w-28 animate-pulse rounded bg-[hsl(var(--nvr-skeleton))] align-middle" }) }),
965
985
  /* @__PURE__ */ t("span", { className: `text-slate-400 transition-transform ${G ? "rotate-90" : ""}`, children: "›" })
966
986
  ]
967
987
  }
968
988
  ),
969
- G && /* @__PURE__ */ y("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
970
- j && Re,
971
- j && Le,
972
- x && /* @__PURE__ */ t("p", { className: "text-[12px] text-red-500", children: x }),
973
- !j && !x && i && r && $e()
989
+ G && /* @__PURE__ */ b("div", { className: "border-t border-slate-100 px-4 py-3 dark:border-border", children: [
990
+ j && $e,
991
+ j && Ce,
992
+ g && /* @__PURE__ */ t(Ue, { message: g, onRetry: fe }),
993
+ !j && !g && i && r && Ee()
974
994
  ] })
975
995
  ] });
976
- function $e() {
977
- var l;
978
- return !i || !r ? null : /* @__PURE__ */ y(ye, { children: [
979
- (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(me, { data: i, awaiting: M }),
980
- r.widget_type === "custom-query" && "values" in i && (M ? /* @__PURE__ */ y(
996
+ function Ee() {
997
+ var n;
998
+ return !i || !r ? null : /* @__PURE__ */ b(be, { children: [
999
+ (r.widget_type === "stat" || r.widget_type === "custom-query" && "value" in i) && /* @__PURE__ */ t(he, { data: i, awaiting: M }),
1000
+ r.widget_type === "custom-query" && "values" in i && (M ? /* @__PURE__ */ b(
981
1001
  "p",
982
1002
  {
983
1003
  className: "text-[12px] text-slate-500 dark:text-slate-400",
@@ -986,13 +1006,13 @@ function Br({
986
1006
  "Set ",
987
1007
  M,
988
1008
  " on this record to see ",
989
- V || "this",
1009
+ J || "this",
990
1010
  "."
991
1011
  ]
992
1012
  }
993
- ) : /* @__PURE__ */ t(De, { data: i })),
994
- r.widget_type === "list" && /* @__PURE__ */ t(_r, { data: i }),
995
- M && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ y(
1013
+ ) : /* @__PURE__ */ t(Be, { data: i })),
1014
+ r.widget_type === "list" && /* @__PURE__ */ t(Lr, { data: i }),
1015
+ M && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ b(
996
1016
  "p",
997
1017
  {
998
1018
  className: "text-[12px] text-slate-500 dark:text-slate-400",
@@ -1001,56 +1021,56 @@ function Br({
1001
1021
  "Set ",
1002
1022
  M,
1003
1023
  " on this record to see ",
1004
- V || "this",
1024
+ J || "this",
1005
1025
  "."
1006
1026
  ]
1007
1027
  }
1008
1028
  ),
1009
1029
  !M && r.widget_type === "custom-query" && "rows" in i && /* @__PURE__ */ t(
1010
- fr,
1030
+ br,
1011
1031
  {
1012
1032
  rows: i.rows ?? [],
1013
- config: (l = r.config) == null ? void 0 : l.table,
1014
- emptyLabel: V
1033
+ config: (n = r.config) == null ? void 0 : n.table,
1034
+ emptyLabel: J
1015
1035
  }
1016
1036
  ),
1017
1037
  r.widget_type === "review_list" && /* @__PURE__ */ t(
1018
- gr,
1038
+ vr,
1019
1039
  {
1020
1040
  data: i,
1021
1041
  config: r.config ?? {},
1022
- onRefetch: () => A((u) => u + 1),
1023
- hostRecordId: O.record_id,
1024
- emptyLabel: V
1042
+ onRefetch: () => D((d) => d + 1),
1043
+ hostRecordId: I.record_id,
1044
+ emptyLabel: J
1025
1045
  }
1026
1046
  ),
1027
1047
  r.widget_type === "rollup" && /* @__PURE__ */ t(
1028
- yr,
1048
+ _r,
1029
1049
  {
1030
1050
  data: i,
1031
1051
  config: r.config ?? {},
1032
- emptyLabel: V
1052
+ emptyLabel: J
1033
1053
  }
1034
1054
  ),
1035
- r.widget_type === "report_widget" && /* @__PURE__ */ t(hr, { payload: i }),
1055
+ r.widget_type === "report_widget" && /* @__PURE__ */ t(xr, { payload: i }),
1036
1056
  r.widget_type === "action-buttons" && /* @__PURE__ */ t(
1037
- Ue,
1057
+ He,
1038
1058
  {
1039
1059
  data: i,
1040
- widgetId: n,
1041
- inputs: O,
1060
+ widgetId: l,
1061
+ inputs: I,
1042
1062
  apiBase: E
1043
1063
  }
1044
1064
  ),
1045
1065
  r.widget_type === "button-group" && /* @__PURE__ */ t(
1046
- ge,
1066
+ ye,
1047
1067
  {
1048
1068
  buttons: i.buttons ?? [],
1049
1069
  layout: i.layout ?? "flat",
1050
- widgetId: n,
1051
- inputs: O,
1070
+ widgetId: l,
1071
+ inputs: I,
1052
1072
  apiBase: E,
1053
- onClientAction: N
1073
+ onClientAction: k
1054
1074
  }
1055
1075
  ),
1056
1076
  ![
@@ -1064,11 +1084,11 @@ function Br({
1064
1084
  "report_widget"
1065
1085
  ].includes(r.widget_type) && /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap text-[11px] text-slate-500", children: JSON.stringify(i, null, 2) }),
1066
1086
  i.cache ? /* @__PURE__ */ t(
1067
- ur,
1087
+ gr,
1068
1088
  {
1069
1089
  envelope: i.cache,
1070
- onRefresh: H,
1071
- refreshing: d,
1090
+ onRefresh: V,
1091
+ refreshing: u,
1072
1092
  className: "mt-2 justify-end"
1073
1093
  }
1074
1094
  ) : null
@@ -1076,5 +1096,5 @@ function Br({
1076
1096
  }
1077
1097
  }
1078
1098
  export {
1079
- Br as WidgetSlot
1099
+ Gr as WidgetSlot
1080
1100
  };