react-semaphor 0.1.539 → 0.1.541

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 (51) hide show
  1. package/dist/assistant-context/index.js +1 -1
  2. package/dist/assistant-protocol/index.js +63 -54
  3. package/dist/brand-studio/index.js +1 -1
  4. package/dist/briefings/index.js +41 -38
  5. package/dist/chunks/add-to-dashboard-BuAqfA2Y.js +80 -0
  6. package/dist/chunks/{aggregate-table-row-presentation-BjK9YfMI.js → aggregate-table-row-presentation-B_vQjYR3.js} +319 -302
  7. package/dist/chunks/{assistant-chat-DgiSuFT4.js → assistant-chat-D1fDZD6O.js} +2448 -2228
  8. package/dist/chunks/{context-HD9usB1P.js → context-ClREvqCZ.js} +101 -102
  9. package/dist/chunks/{dashboard-y5BwcvzT.js → dashboard-B6IrON_Q.js} +1 -1
  10. package/dist/chunks/{dashboard-briefing-launcher-Bl3gCeBR.js → dashboard-briefing-launcher-DwjFpewq.js} +117 -117
  11. package/dist/chunks/{dashboard-controls-0EX0HiJt.js → dashboard-controls-C_BI28ME.js} +6 -6
  12. package/dist/chunks/{dashboard-json-6X_2BDiL.js → dashboard-json-DDY15Trn.js} +2 -2
  13. package/dist/chunks/{document-dashboard-inputs-BrYYlRVo.js → document-dashboard-inputs-DP_Op5mu.js} +1168 -1166
  14. package/dist/chunks/{edit-dashboard-visual-Bzchfgga.js → edit-dashboard-visual-CH2dzWW-.js} +5 -5
  15. package/dist/chunks/{index-CqMiAkay.js → index-DaQlghLY.js} +547 -511
  16. package/dist/chunks/report-preferences-dialog-DpNkFfQO.js +1950 -0
  17. package/dist/chunks/{saved-dashboard-context-Dqve2jlB.js → saved-dashboard-context-CJ2WpoMF.js} +2 -2
  18. package/dist/chunks/{semaphor-ready-indicator-ldcwmLoY.js → semaphor-ready-indicator-KT598QJq.js} +33482 -33334
  19. package/dist/chunks/{shelf-drop-preview-context-BWxunXTq.js → shelf-drop-preview-context-BxV3Fl8h.js} +3 -3
  20. package/dist/chunks/{switch-CvItuC1Q.js → switch-DWEWiv1J.js} +53 -52
  21. package/dist/chunks/{use-create-flow-overlay-state-RHgzVfcz.js → use-create-flow-overlay-state-DdD12SMY.js} +3 -3
  22. package/dist/dashboard/index.js +1 -1
  23. package/dist/dashboard-authoring/index.js +582 -568
  24. package/dist/format-utils/index.js +117 -114
  25. package/dist/index.js +11 -11
  26. package/dist/pdf-export-policy/index.js +20 -10
  27. package/dist/style.css +1 -1
  28. package/dist/surfboard/index.js +1 -1
  29. package/dist/types/briefings/attachment-outcomes.d.ts +23 -0
  30. package/dist/types/briefings/index.d.ts +1 -0
  31. package/dist/types/components/assistant/assistant-entry-points.d.ts +3 -0
  32. package/dist/types/components/assistant/assistant-store.d.ts +49 -1
  33. package/dist/types/components/assistant/use-assistant.d.ts +10 -1
  34. package/dist/types/lib/hooks/use-dashboard-card.d.ts +2 -0
  35. package/dist/types/lib/query-context/card-server-request.d.ts +5 -1
  36. package/dist/types/lib/types/common-types.d.ts +7 -0
  37. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  38. package/dist/types/shared/assistant-protocol/context.d.ts +88 -66
  39. package/dist/types/shared/assistant-protocol/conversation.d.ts +3 -0
  40. package/dist/types/shared/assistant-protocol/index.d.ts +1 -0
  41. package/dist/types/shared/assistant-protocol/limits.d.ts +2 -0
  42. package/dist/types/shared/assistant-protocol/request.d.ts +6 -1
  43. package/dist/types/shared/assistant-protocol/tagged-fields.d.ts +29 -0
  44. package/dist/types/shared/dashboard-authoring/card-query-request.d.ts +20 -0
  45. package/dist/types/shared/format-utils/attachment-filter-line.d.ts +14 -0
  46. package/dist/types/shared/format-utils/filter-line.d.ts +7 -0
  47. package/dist/types/shared/format-utils/index.d.ts +1 -0
  48. package/dist/types/shared/format-utils/pdf-export-policy.d.ts +9 -0
  49. package/package.json +2 -1
  50. package/dist/chunks/add-to-dashboard-CxtTfISD.js +0 -56
  51. package/dist/chunks/report-preferences-dialog-CWhSbc5_.js +0 -1808
@@ -0,0 +1,1950 @@
1
+ import { jsxs as h, jsx as l, Fragment as ie } from "react/jsx-runtime";
2
+ import * as p from "react";
3
+ import Ft, { useRef as J, useState as F, useCallback as W, useEffect as ee, useMemo as Q, lazy as Se, Suspense as ye, useLayoutEffect as Ge, Activity as Lt, useId as ce } from "react";
4
+ import { u as j, b6 as _t, b7 as Mt, X as Ut, b8 as Ot, b9 as jt, ba as $t, b as Bt, aX as Be, bb as Wt, bc as Vt, bd as mt, p as Kt, be as Ht, bf as qt, bg as Xt, bh as Gt, bi as be, bj as ft, bk as Je, E as Jt, F as Yt, S as Zt, B as Qt, a as ea, U as ta, D as aa, C as ra, bl as na, bm as la, bn as sa, bo as ia, bp as oa, bq as Ye, br as Ne, bs as da, bt as We, bu as ca, bv as ua, bw as ma, bx as fa, by as ha } from "./semaphor-ready-indicator-KT598QJq.js";
5
+ import { $ as pa, u as H } from "./custom-visual-inputs-BrUOIwln.js";
6
+ import { l as oe, B as V, N as va, O as ba, Q as ga, U as ya, V as wa, W as Sa, X as se, z as Z, Y as he, P as xa, a as Ca, b as Na, c as Ze, L as ht, r as Pe, s as ze, t as Fe, u as Le, v as G, T as Ea, d as Ta, e as Qe, g as et } from "./switch-DWEWiv1J.js";
7
+ import { X as ka } from "./x-4f5U2XwU.js";
8
+ import { j as Ia } from "./index-CuHybtft.js";
9
+ import "./validators-Ej1DdCXa.js";
10
+ import "./matrix-operation-contract-B8PBF1Gd.js";
11
+ import "./analytics-base-schemas-BFAoRlkU.js";
12
+ import "zod";
13
+ import { parseValueFormatPreferencesResponse as Aa, canonicalizeSupportedLocale as pt, getSupportedCurrencyCodes as Da, canonicalizeSupportedCurrencyCode as Ra } from "../value-format-preferences/index.js";
14
+ import { c as M } from "./class-utils-Df1OVOT1.js";
15
+ import { t as Pa } from "./document-sheet-utils-C1eEldxs.js";
16
+ import { k as za } from "./bookmark-state-k7y5SNGf.js";
17
+ import { r as Fa, a as vt } from "./availability-Bp5Gfu1I.js";
18
+ import { s as La } from "./stable-serialize-CfqXeiBP.js";
19
+ import { S as _a } from "./selection-reducer-vKIb_jS6.js";
20
+ import { a as Ma } from "./report-runtime-context-B984Nq1E.js";
21
+ import { q as ge, A as ue } from "./raw-temporal-D61lr48Y.js";
22
+ function Ua(e = []) {
23
+ const a = J(null), t = J(null), r = J(null), [n, i] = F(), s = W(() => {
24
+ var m, S, N;
25
+ const o = ((m = a.current) == null ? void 0 : m.clientWidth) ?? 0, f = ((S = r.current) == null ? void 0 : S.offsetWidth) ?? 0, u = ((N = t.current) == null ? void 0 : N.offsetWidth) ?? 0, c = o - f - u - 8, v = Math.max(c, 0);
26
+ i((w) => w === v ? w : v);
27
+ }, []);
28
+ return ee(() => {
29
+ const o = a.current;
30
+ if (!o || typeof ResizeObserver > "u") return;
31
+ const f = new ResizeObserver(() => s());
32
+ return f.observe(o), s(), () => f.disconnect();
33
+ }, [s, ...e]), {
34
+ headerRef: a,
35
+ leftActionsRef: t,
36
+ rightActionsRef: r,
37
+ titleMaxWidth: n,
38
+ updateAvailableWidth: s
39
+ };
40
+ }
41
+ function Oa({ filter: e }) {
42
+ var S;
43
+ const a = j(
44
+ (N) => N.isDashboardEditing
45
+ ), { preferences: t } = _t(), r = Mt((S = t == null ? void 0 : t.cardDisplay) == null ? void 0 : S.mode), n = j((N) => N.filterValues), i = n == null ? void 0 : n.some(
46
+ (N) => N.filterId === e.id
47
+ ), { removeFilterValues: s, removeFilter: o, updateFilter: f } = Ut(), {
48
+ headerRef: u,
49
+ leftActionsRef: g,
50
+ rightActionsRef: c,
51
+ titleMaxWidth: v,
52
+ updateAvailableWidth: m
53
+ } = Ua([
54
+ a,
55
+ i,
56
+ r
57
+ ]);
58
+ return ee(() => {
59
+ m();
60
+ }, [e.title, m]), /* @__PURE__ */ h(
61
+ "div",
62
+ {
63
+ ref: u,
64
+ className: "group mb-1 flex h-5 items-center justify-between",
65
+ children: [
66
+ /* @__PURE__ */ h("div", { className: "flex grow items-center gap-2 min-w-0", children: [
67
+ /* @__PURE__ */ l(
68
+ "div",
69
+ {
70
+ className: "min-w-0 flex-1",
71
+ style: v !== void 0 ? { maxWidth: v } : void 0,
72
+ children: /* @__PURE__ */ l(oe, { className: "my-1 block w-full text-sm", children: /* @__PURE__ */ l(
73
+ Ot,
74
+ {
75
+ value: e.title || e.column,
76
+ onSave: (N) => f({ ...e, title: N }),
77
+ isEditable: a,
78
+ placeholder: "Filter",
79
+ displayClassName: "text-sm truncate",
80
+ inputClassName: "text-sm"
81
+ }
82
+ ) })
83
+ }
84
+ ),
85
+ /* @__PURE__ */ h(
86
+ "div",
87
+ {
88
+ className: "flex shrink-0 items-center gap-1.5",
89
+ ref: g,
90
+ children: [
91
+ a && /* @__PURE__ */ l(jt, { filter: e, isEditing: a }),
92
+ a && /* @__PURE__ */ l(
93
+ "button",
94
+ {
95
+ onClick: () => {
96
+ s(e.id), o(e.id);
97
+ },
98
+ className: "text-muted-foreground hover:text-foreground",
99
+ children: /* @__PURE__ */ l(ka, { className: "size-3.5" })
100
+ }
101
+ )
102
+ ]
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ l("div", { className: "hidden", ref: c })
107
+ ]
108
+ }
109
+ );
110
+ }
111
+ function ja() {
112
+ const e = j((r) => r.dashboard.filters), a = j((r) => r.theme), t = e == null ? void 0 : e.filter((r) => r.hide);
113
+ return t != null && t.length ? /* @__PURE__ */ l(
114
+ "div",
115
+ {
116
+ className: M("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
117
+ "bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": a === "light",
118
+ "bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": a === "dark"
119
+ }),
120
+ children: t == null ? void 0 : t.map((r) => /* @__PURE__ */ h(
121
+ "div",
122
+ {
123
+ className: "flex min-w-[250px] max-w-fit flex-col gap-1 p-2",
124
+ children: [
125
+ /* @__PURE__ */ l(Oa, { filter: r }),
126
+ /* @__PURE__ */ l($t, { filter: r })
127
+ ]
128
+ },
129
+ r.id
130
+ ))
131
+ }
132
+ ) : null;
133
+ }
134
+ function $a() {
135
+ var i;
136
+ const e = j((s) => s.dashboard), a = j((s) => s.selectedSheetId), t = j(
137
+ (s) => s.isDashboardEditing
138
+ ), r = (i = e.sheets) == null ? void 0 : i.find(
139
+ (s) => s.id === a
140
+ ), n = Pa(r);
141
+ return /* @__PURE__ */ l(
142
+ "div",
143
+ {
144
+ role: "dashboard-plus-main",
145
+ className: "flex min-h-0 grow basis-0 overflow-hidden",
146
+ children: /* @__PURE__ */ h("section", { className: "flex min-h-0 grow basis-0 flex-col overflow-hidden", children: [
147
+ t && !n && /* @__PURE__ */ l(ja, {}),
148
+ /* @__PURE__ */ l(Bt, {})
149
+ ] })
150
+ }
151
+ );
152
+ }
153
+ const Ba = /* @__PURE__ */ new Set(["iat", "exp", "nbf", "jti"]);
154
+ function Wa(e) {
155
+ return La(
156
+ Object.fromEntries(
157
+ Object.entries(e ?? {}).filter(([a]) => !Ba.has(a))
158
+ )
159
+ );
160
+ }
161
+ function Va(e) {
162
+ var t;
163
+ const a = e == null ? void 0 : e.config;
164
+ return Fa({
165
+ features: ((t = a == null ? void 0 : a.projectFeatures) == null ? void 0 : t.features) ?? {},
166
+ config: { enabled: vt(a).enabled },
167
+ identity: {
168
+ orgUserId: e == null ? void 0 : e.orgUserId,
169
+ tenantId: e == null ? void 0 : e.tenantId,
170
+ endUserId: e == null ? void 0 : e.endUserId
171
+ },
172
+ modelConfigured: !0
173
+ });
174
+ }
175
+ let tt = 0;
176
+ function at(e, a) {
177
+ tt += 1;
178
+ const { name: t, layout: r } = vt(a == null ? void 0 : a.config);
179
+ return { ...Vt(r), id: tt, callerKey: e, assistantName: t };
180
+ }
181
+ function Ka({
182
+ children: e,
183
+ authToken: a
184
+ }) {
185
+ const t = Be(), r = Q(
186
+ () => a === void 0 ? t.tokenProps : qa(a),
187
+ [a, t.tokenProps]
188
+ ), n = Q(() => Wa(r), [r]), i = Q(
189
+ () => Va(r).available,
190
+ [r]
191
+ ), [s, o] = F(() => at(n, r));
192
+ s.callerKey !== n && o(at(n, r)), Xa(s);
193
+ const f = Q(() => ({ instance: s, available: i }), [s, i]);
194
+ return /* @__PURE__ */ l(Wt.Provider, { value: f, children: e });
195
+ }
196
+ function Ha({ children: e }) {
197
+ return mt() ? /* @__PURE__ */ l(ie, { children: e }) : /* @__PURE__ */ l(Ka, { children: e });
198
+ }
199
+ function qa(e) {
200
+ if (!(e != null && e.accessToken)) return {};
201
+ try {
202
+ return Ia(e.accessToken);
203
+ } catch {
204
+ return {};
205
+ }
206
+ }
207
+ function Xa(e) {
208
+ ee(() => {
209
+ const a = (r, n) => {
210
+ const i = e.store.getState().focus;
211
+ i && !Ga(i, r, n) && e.clearFocus();
212
+ }, t = j.getState();
213
+ return a(t.selectedSheetId, t.dashboard), j.subscribe((r, n) => {
214
+ (r.selectedSheetId !== n.selectedSheetId || r.dashboard !== n.dashboard) && a(r.selectedSheetId, r.dashboard), r.isVisualEditing && !n.isVisualEditing && e.leaveBeside();
215
+ });
216
+ }, [e]);
217
+ }
218
+ function Ga(e, a, t) {
219
+ if ((a ?? null) !== e.sheetId) return !1;
220
+ const r = t ? za(t, e.cardId) : void 0;
221
+ return !!r && r.sheet.id === e.sheetId;
222
+ }
223
+ const Ja = Se(() => import("./assistant-chat-D1fDZD6O.js"));
224
+ function fn() {
225
+ const e = Kt();
226
+ return e.available ? /* @__PURE__ */ h(
227
+ V,
228
+ {
229
+ variant: e.isOpen ? "secondary" : "outline",
230
+ size: "xs",
231
+ "aria-pressed": e.isOpen,
232
+ onClick: e.toggle,
233
+ children: [
234
+ /* @__PURE__ */ l(Ht, { className: "h-3.5 w-3.5" }),
235
+ e.assistantName
236
+ ]
237
+ }
238
+ ) : null;
239
+ }
240
+ const Ya = {
241
+ // Docked widths are the viewer's (the resize handle), applied as a style.
242
+ "docked-right": "relative shrink-0 border-l border-border",
243
+ "docked-left": "relative order-first shrink-0 border-r border-border",
244
+ centered: "absolute left-1/2 top-1/2 z-30 h-[min(80%,760px)] w-[min(640px,calc(100%-2rem))] -translate-x-1/2 -translate-y-1/2 rounded-card border border-border shadow-lg",
245
+ "full-page": "absolute inset-0 z-30"
246
+ }, Za = "absolute left-0 top-0 z-30 max-h-[var(--assistant-beside-max-h)] max-w-[var(--assistant-beside-max-w)] rounded-card border border-border shadow-lg", Qa = 640, fe = 8;
247
+ function er({ surface: e = "dashboard" } = {}) {
248
+ const a = mt(), { isOpen: t, mounted: r, storedLayout: n, width: i, beside: s, besideSize: o, focusCardId: f, askCount: u } = qt(
249
+ (a == null ? void 0 : a.instance.store) ?? Gt,
250
+ Xt((w) => {
251
+ var k;
252
+ return {
253
+ isOpen: w.isOpen,
254
+ mounted: w.mounted,
255
+ storedLayout: w.layout,
256
+ width: w.width,
257
+ beside: w.beside,
258
+ besideSize: w.besideSize,
259
+ focusCardId: (k = w.focus) == null ? void 0 : k.cardId,
260
+ askCount: w.askCount
261
+ };
262
+ })
263
+ ), g = e === "none", c = j(
264
+ (w) => s && t && f && !g ? tr(w.dashboard, w.selectedSheetId, f) : void 0
265
+ ), v = ar(c, u);
266
+ if (!(a != null && a.available) || !r && !g) return null;
267
+ const m = g ? "full-page" : v.shown ? "beside-card" : n, S = g || t, N = m === "docked-right" || m === "docked-left";
268
+ return /* @__PURE__ */ h(
269
+ "aside",
270
+ {
271
+ ref: v.setFloating,
272
+ "aria-label": a.instance.assistantName,
273
+ "data-testid": "assistant-panel",
274
+ "data-layout": m,
275
+ "data-beside-frame": m === "beside-card" ? c : void 0,
276
+ "data-beside-side": m === "beside-card" ? v.side : void 0,
277
+ className: M(
278
+ "flex-col bg-background",
279
+ m === "beside-card" ? Za : Ya[m],
280
+ S ? "flex" : "hidden"
281
+ ),
282
+ style: m === "beside-card" ? { ...v.style, width: o.width, height: o.height } : (
283
+ // The saved width, never more than the share of the dashboard's area the
284
+ // handle allows, however the area is sized now or later (P4-10).
285
+ N ? { width: i, maxWidth: `${bt * 100}%` } : void 0
286
+ ),
287
+ onKeyDown: m === "beside-card" ? (w) => {
288
+ if (w.key !== "Escape" || w.defaultPrevented || !(w.target instanceof Node) || !w.currentTarget.contains(w.target)) return;
289
+ w.preventDefault();
290
+ const k = v.cardActions();
291
+ a.instance.close(), k == null || k.focus();
292
+ } : void 0,
293
+ children: [
294
+ N ? /* @__PURE__ */ l(lr, { instance: a.instance, side: m === "docked-left" ? "right" : "left", width: i }) : null,
295
+ m === "beside-card" ? /* @__PURE__ */ l(nr, { instance: a.instance, size: o, side: v.handleSide }) : null,
296
+ /* @__PURE__ */ l(ye, { fallback: null, children: /* @__PURE__ */ l(Ja, { instance: a.instance, surface: e, placement: m }, a.instance.id) })
297
+ ]
298
+ }
299
+ );
300
+ }
301
+ function tr(e, a, t) {
302
+ var n, i, s;
303
+ const r = (n = e.sheets) == null ? void 0 : n.find((o) => o.id === a);
304
+ return (s = (i = r == null ? void 0 : r.frames) == null ? void 0 : i.find((o) => {
305
+ var f;
306
+ return (f = o.cards) == null ? void 0 : f.some((u) => u.id === t);
307
+ })) == null ? void 0 : s.id;
308
+ }
309
+ function ar(e, a) {
310
+ var S;
311
+ const [t, r] = F(void 0), [n, i] = F(void 0), s = J(a);
312
+ Ge(() => {
313
+ s.current = a;
314
+ });
315
+ const o = n === a ? null : t, { refs: f, elements: u, floatingStyles: g, middlewareData: c, isPositioned: v } = va({
316
+ strategy: "absolute",
317
+ placement: o ?? "right-start",
318
+ middleware: [
319
+ ba(fe),
320
+ ga({ padding: fe }),
321
+ ya({
322
+ padding: fe,
323
+ apply: ({ availableWidth: N, availableHeight: w, elements: k }) => {
324
+ k.floating.style.setProperty("--assistant-beside-max-w", `${Math.max(0, N)}px`), k.floating.style.setProperty("--assistant-beside-max-h", `${Math.max(0, w)}px`);
325
+ }
326
+ }),
327
+ wa()
328
+ ],
329
+ whileElementsMounted: (N, w, k) => Sa(N, w, () => {
330
+ const z = rr(N, w);
331
+ r(z), z === null && i(s.current), k();
332
+ })
333
+ }), m = u.floating;
334
+ return Ge(() => {
335
+ f.setReference(e ? rt(m == null ? void 0 : m.parentElement, e) : null);
336
+ }, [e, m, f]), {
337
+ shown: e !== void 0 && o !== null && u.reference !== null,
338
+ setFloating: f.setFloating,
339
+ style: {
340
+ ...g,
341
+ // Not before it is placed (its side is chosen first): never a flash at
342
+ // the row's corner. With the card wholly out of view, it goes with the card.
343
+ ...!v || (S = c.hide) != null && S.referenceHidden ? { visibility: "hidden" } : {}
344
+ },
345
+ /** The side the conversation took; the size handle sits on the corner away from the card. */
346
+ side: o ?? void 0,
347
+ handleSide: o === "left-start" ? "left" : "right",
348
+ /** The card's ··· menu, where Ask lives and focus returns on Escape. */
349
+ cardActions: () => {
350
+ var N;
351
+ return e ? (N = rt(m == null ? void 0 : m.parentElement, e)) == null ? void 0 : N.querySelector("[data-card-actions]") : null;
352
+ }
353
+ };
354
+ }
355
+ function rt(e, a) {
356
+ return e ? Array.from(e.querySelectorAll("[data-frame-id]")).find((t) => t.dataset.frameId === a) ?? null : null;
357
+ }
358
+ function rr(e, a) {
359
+ const t = a.parentElement;
360
+ if (!t || !e.isConnected) return null;
361
+ const r = t.getBoundingClientRect();
362
+ if (r.width < Qa) return null;
363
+ const n = e.getBoundingClientRect(), { min: i } = ft, s = (o, f) => o >= i.width + 2 * fe && f >= i.height + 2 * fe;
364
+ return s(r.right - n.right, r.height) ? "right-start" : s(n.left - r.left, r.height) ? "left-start" : s(r.width, r.bottom - n.bottom) ? "bottom-start" : null;
365
+ }
366
+ function nr({
367
+ instance: e,
368
+ size: a,
369
+ side: t
370
+ }) {
371
+ const r = J(void 0), n = t === "left" ? -1 : 1, i = (s) => {
372
+ const o = r.current;
373
+ return {
374
+ width: o.start.width + n * (s.clientX - o.x),
375
+ height: o.start.height + (s.clientY - o.y)
376
+ };
377
+ };
378
+ return /* @__PURE__ */ l(
379
+ "div",
380
+ {
381
+ role: "separator",
382
+ "aria-label": "Resize assistant",
383
+ tabIndex: 0,
384
+ title: "Drag to resize. Double-click to reset.",
385
+ onPointerDown: (s) => {
386
+ var o, f;
387
+ s.preventDefault(), (f = (o = s.currentTarget).setPointerCapture) == null || f.call(o, s.pointerId), r.current = { x: s.clientX, y: s.clientY, start: a };
388
+ },
389
+ onPointerMove: (s) => {
390
+ r.current && e.setBesideSize(i(s));
391
+ },
392
+ onPointerUp: (s) => {
393
+ r.current && (e.setBesideSize(i(s), { save: !0 }), r.current = void 0);
394
+ },
395
+ onPointerCancel: () => {
396
+ r.current = void 0;
397
+ },
398
+ onKeyDown: (s) => {
399
+ const o = {
400
+ ArrowLeft: { width: -n * le, height: 0 },
401
+ ArrowRight: { width: n * le, height: 0 },
402
+ ArrowUp: { width: 0, height: -le },
403
+ ArrowDown: { width: 0, height: le }
404
+ }[s.key];
405
+ o && (s.preventDefault(), e.setBesideSize({ width: a.width + o.width, height: a.height + o.height }, { save: !0 }));
406
+ },
407
+ onDoubleClick: () => e.setBesideSize(ft.default, { save: !0 }),
408
+ className: M(
409
+ "absolute bottom-0 z-10 h-3 w-3 touch-none outline-none hover:bg-primary/30 focus-visible:bg-primary/40",
410
+ t === "left" ? "left-0 cursor-nesw-resize rounded-bl-card" : "right-0 cursor-nwse-resize rounded-br-card"
411
+ )
412
+ }
413
+ );
414
+ }
415
+ const le = 16, bt = 0.6;
416
+ function lr({ instance: e, side: a, width: t }) {
417
+ const r = J(void 0), n = (c) => {
418
+ var m, S;
419
+ const v = (S = (m = c.closest("aside")) == null ? void 0 : m.parentElement) == null ? void 0 : S.clientWidth;
420
+ return v ? v * bt : be.max;
421
+ }, i = (c) => {
422
+ var v;
423
+ return ((v = c.closest("aside")) == null ? void 0 : v.getBoundingClientRect().width) || t;
424
+ }, s = (c) => {
425
+ const v = r.current;
426
+ if (!v) return t;
427
+ const m = c - v.startX;
428
+ return Je(v.startWidth + (a === "left" ? -m : m), v.maxForArea);
429
+ }, o = (c) => {
430
+ var v, m;
431
+ c.preventDefault(), (m = (v = c.currentTarget).setPointerCapture) == null || m.call(v, c.pointerId), r.current = { startX: c.clientX, startWidth: i(c.currentTarget), maxForArea: n(c.currentTarget) };
432
+ }, f = (c) => {
433
+ r.current && e.setWidth(s(c.clientX));
434
+ }, u = (c) => {
435
+ r.current && (e.setWidth(s(c.clientX), { save: !0 }), r.current = void 0);
436
+ }, g = (c) => {
437
+ if (c.key !== "ArrowLeft" && c.key !== "ArrowRight") return;
438
+ c.preventDefault();
439
+ const v = c.key === "ArrowLeft" == (a === "left");
440
+ e.setWidth(Je(i(c.currentTarget) + (v ? le : -le), n(c.currentTarget)), { save: !0 });
441
+ };
442
+ return /* @__PURE__ */ l(
443
+ "div",
444
+ {
445
+ role: "separator",
446
+ "aria-orientation": "vertical",
447
+ "aria-label": "Resize assistant",
448
+ "aria-valuenow": t,
449
+ "aria-valuemin": be.min,
450
+ "aria-valuemax": be.max,
451
+ tabIndex: 0,
452
+ title: "Drag to resize. Double-click to reset.",
453
+ onPointerDown: o,
454
+ onPointerMove: f,
455
+ onPointerUp: u,
456
+ onPointerCancel: u,
457
+ onKeyDown: g,
458
+ onDoubleClick: () => e.setWidth(be.default, { save: !0 }),
459
+ className: M(
460
+ "absolute inset-y-0 z-10 w-1.5 cursor-col-resize touch-none outline-none hover:bg-primary/30 focus-visible:bg-primary/40",
461
+ a === "left" ? "-left-[3px]" : "-right-[3px]"
462
+ )
463
+ }
464
+ );
465
+ }
466
+ const sr = Se(() => import("./dashboard-controls-C_BI28ME.js")), ir = Se(
467
+ () => import("./edit-dashboard-visual-CH2dzWW-.js")
468
+ ), or = Se(() => import("./dashboard-json-DDY15Trn.js"));
469
+ function hn({
470
+ showControls: e = !1,
471
+ showFooter: a = !0,
472
+ ...t
473
+ }) {
474
+ const r = j((o) => o.isVisualEditing), n = j(
475
+ (o) => o.showDashboardJSON
476
+ ), { appearance: i, preferences: s } = t;
477
+ return /* @__PURE__ */ l(Jt, { FallbackComponent: Yt, children: /* @__PURE__ */ l(Zt, { dashboardProps: t, children: /* @__PURE__ */ h(Qt, { children: [
478
+ /* @__PURE__ */ l(ea, { componentType: "surfboard", componentId: t.id }),
479
+ /* @__PURE__ */ h(ta, { appearance: i, children: [
480
+ /* @__PURE__ */ l(
481
+ pa,
482
+ {
483
+ toastOptions: {
484
+ classNames: {
485
+ toast: "max-w-[calc(100vw-2rem)] overflow-x-hidden !items-start [--toast-close-button-end:0.5rem] [--toast-close-button-start:auto] [--toast-close-button-transform:translate(0,0)] sm:max-w-[44rem]",
486
+ content: "min-w-0 flex-1",
487
+ icon: "mt-0.5 shrink-0",
488
+ title: "max-w-full break-words pr-8",
489
+ description: "max-w-full break-words",
490
+ closeButton: "!top-2 h-6 w-6 rounded-md border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"
491
+ }
492
+ }
493
+ }
494
+ ),
495
+ /* @__PURE__ */ h(aa, { preferences: s, children: [
496
+ n && /* @__PURE__ */ l(ye, { fallback: null, children: /* @__PURE__ */ l(or, {}) }),
497
+ /* @__PURE__ */ l(Ha, { children: /* @__PURE__ */ h("main", { className: "relative flex h-full w-full flex-col overflow-hidden", children: [
498
+ e && /* @__PURE__ */ l(ye, { fallback: null, children: /* @__PURE__ */ l(sr, {}) }),
499
+ /* @__PURE__ */ h("div", { className: "relative flex grow overflow-hidden", children: [
500
+ /* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1", children: /* @__PURE__ */ h(ra, { ...t, type: "dashboard", children: [
501
+ r && /* @__PURE__ */ l(ye, { fallback: null, children: /* @__PURE__ */ l(ir, {}) }),
502
+ /* @__PURE__ */ l(Lt, { mode: r ? "hidden" : "visible", children: /* @__PURE__ */ l($a, {}) })
503
+ ] }) }),
504
+ /* @__PURE__ */ l(er, {})
505
+ ] })
506
+ ] }) })
507
+ ] })
508
+ ] })
509
+ ] }) }) });
510
+ }
511
+ var nt = 1, dr = 0.9, cr = 0.8, ur = 0.17, Ee = 0.1, Te = 0.999, mr = 0.9999, fr = 0.99, hr = /[\\\/_+.#"@\[\(\{&]/, pr = /[\\\/_+.#"@\[\(\{&]/g, vr = /[\s-]/, gt = /[\s-]/g;
512
+ function _e(e, a, t, r, n, i, s) {
513
+ if (i === a.length) return n === e.length ? nt : fr;
514
+ var o = `${n},${i}`;
515
+ if (s[o] !== void 0) return s[o];
516
+ for (var f = r.charAt(i), u = t.indexOf(f, n), g = 0, c, v, m, S; u >= 0; ) c = _e(e, a, t, r, u + 1, i + 1, s), c > g && (u === n ? c *= nt : hr.test(e.charAt(u - 1)) ? (c *= cr, m = e.slice(n, u - 1).match(pr), m && n > 0 && (c *= Math.pow(Te, m.length))) : vr.test(e.charAt(u - 1)) ? (c *= dr, S = e.slice(n, u - 1).match(gt), S && n > 0 && (c *= Math.pow(Te, S.length))) : (c *= ur, n > 0 && (c *= Math.pow(Te, u - n))), e.charAt(u) !== a.charAt(i) && (c *= mr)), (c < Ee && t.charAt(u - 1) === r.charAt(i + 1) || r.charAt(i + 1) === r.charAt(i) && t.charAt(u - 1) !== r.charAt(i)) && (v = _e(e, a, t, r, u + 1, i + 2, s), v * Ee > c && (c = v * Ee)), c > g && (g = c), u = t.indexOf(f, u + 1);
517
+ return s[o] = g, g;
518
+ }
519
+ function lt(e) {
520
+ return e.toLowerCase().replace(gt, " ");
521
+ }
522
+ function br(e, a, t) {
523
+ return e = t && t.length > 0 ? `${e + " " + t.join(" ")}` : e, _e(e, a, lt(e), lt(a), 0, 0, {});
524
+ }
525
+ var me = '[cmdk-group=""]', ke = '[cmdk-group-items=""]', gr = '[cmdk-group-heading=""]', yt = '[cmdk-item=""]', st = `${yt}:not([aria-disabled="true"])`, Me = "cmdk-item-select", re = "data-value", yr = (e, a, t) => br(e, a, t), wt = p.createContext(void 0), pe = () => p.useContext(wt), St = p.createContext(void 0), Ve = () => p.useContext(St), xt = p.createContext(void 0), Ct = p.forwardRef((e, a) => {
526
+ let t = ne(() => {
527
+ var d, T;
528
+ return { search: "", value: (T = (d = e.value) != null ? d : e.defaultValue) != null ? T : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
529
+ }), r = ne(() => /* @__PURE__ */ new Set()), n = ne(() => /* @__PURE__ */ new Map()), i = ne(() => /* @__PURE__ */ new Map()), s = ne(() => /* @__PURE__ */ new Set()), o = Nt(e), { label: f, children: u, value: g, onValueChange: c, filter: v, shouldFilter: m, loop: S, disablePointerSelection: N = !1, vimBindings: w = !0, ...k } = e, z = se(), L = se(), U = se(), _ = p.useRef(null), E = Dr();
530
+ te(() => {
531
+ if (g !== void 0) {
532
+ let d = g.trim();
533
+ t.current.value = d, b.emit();
534
+ }
535
+ }, [g]), te(() => {
536
+ E(6, ae);
537
+ }, []);
538
+ let b = p.useMemo(() => ({ subscribe: (d) => (s.current.add(d), () => s.current.delete(d)), snapshot: () => t.current, setState: (d, T, A) => {
539
+ var y, D, P, B;
540
+ if (!Object.is(t.current[d], T)) {
541
+ if (t.current[d] = T, d === "search") K(), x(), E(1, q);
542
+ else if (d === "value") {
543
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
544
+ let O = document.getElementById(U);
545
+ O ? O.focus() : (y = document.getElementById(z)) == null || y.focus();
546
+ }
547
+ if (E(7, () => {
548
+ var O;
549
+ t.current.selectedItemId = (O = X()) == null ? void 0 : O.id, b.emit();
550
+ }), A || E(5, ae), ((D = o.current) == null ? void 0 : D.value) !== void 0) {
551
+ let O = T ?? "";
552
+ (B = (P = o.current).onValueChange) == null || B.call(P, O);
553
+ return;
554
+ }
555
+ }
556
+ b.emit();
557
+ }
558
+ }, emit: () => {
559
+ s.current.forEach((d) => d());
560
+ } }), []), C = p.useMemo(() => ({ value: (d, T, A) => {
561
+ var y;
562
+ T !== ((y = i.current.get(d)) == null ? void 0 : y.value) && (i.current.set(d, { value: T, keywords: A }), t.current.filtered.items.set(d, R(T, A)), E(2, () => {
563
+ x(), b.emit();
564
+ }));
565
+ }, item: (d, T) => (r.current.add(d), T && (n.current.has(T) ? n.current.get(T).add(d) : n.current.set(T, /* @__PURE__ */ new Set([d]))), E(3, () => {
566
+ K(), x(), t.current.value || q(), b.emit();
567
+ }), () => {
568
+ i.current.delete(d), r.current.delete(d), t.current.filtered.items.delete(d);
569
+ let A = X();
570
+ E(4, () => {
571
+ K(), (A == null ? void 0 : A.getAttribute("id")) === d && q(), b.emit();
572
+ });
573
+ }), group: (d) => (n.current.has(d) || n.current.set(d, /* @__PURE__ */ new Set()), () => {
574
+ i.current.delete(d), n.current.delete(d);
575
+ }), filter: () => o.current.shouldFilter, label: f || e["aria-label"], getDisablePointerSelection: () => o.current.disablePointerSelection, listId: z, inputId: U, labelId: L, listInnerRef: _ }), []);
576
+ function R(d, T) {
577
+ var A, y;
578
+ let D = (y = (A = o.current) == null ? void 0 : A.filter) != null ? y : yr;
579
+ return d ? D(d, t.current.search, T) : 0;
580
+ }
581
+ function x() {
582
+ if (!t.current.search || o.current.shouldFilter === !1) return;
583
+ let d = t.current.filtered.items, T = [];
584
+ t.current.filtered.groups.forEach((y) => {
585
+ let D = n.current.get(y), P = 0;
586
+ D.forEach((B) => {
587
+ let O = d.get(B);
588
+ P = Math.max(O, P);
589
+ }), T.push([y, P]);
590
+ });
591
+ let A = _.current;
592
+ I().sort((y, D) => {
593
+ var P, B;
594
+ let O = y.getAttribute("id"), ve = D.getAttribute("id");
595
+ return ((P = d.get(ve)) != null ? P : 0) - ((B = d.get(O)) != null ? B : 0);
596
+ }).forEach((y) => {
597
+ let D = y.closest(ke);
598
+ D ? D.appendChild(y.parentElement === D ? y : y.closest(`${ke} > *`)) : A.appendChild(y.parentElement === A ? y : y.closest(`${ke} > *`));
599
+ }), T.sort((y, D) => D[1] - y[1]).forEach((y) => {
600
+ var D;
601
+ let P = (D = _.current) == null ? void 0 : D.querySelector(`${me}[${re}="${encodeURIComponent(y[0])}"]`);
602
+ P == null || P.parentElement.appendChild(P);
603
+ });
604
+ }
605
+ function q() {
606
+ let d = I().find((A) => A.getAttribute("aria-disabled") !== "true"), T = d == null ? void 0 : d.getAttribute(re);
607
+ b.setState("value", T || void 0);
608
+ }
609
+ function K() {
610
+ var d, T, A, y;
611
+ if (!t.current.search || o.current.shouldFilter === !1) {
612
+ t.current.filtered.count = r.current.size;
613
+ return;
614
+ }
615
+ t.current.filtered.groups = /* @__PURE__ */ new Set();
616
+ let D = 0;
617
+ for (let P of r.current) {
618
+ let B = (T = (d = i.current.get(P)) == null ? void 0 : d.value) != null ? T : "", O = (y = (A = i.current.get(P)) == null ? void 0 : A.keywords) != null ? y : [], ve = R(B, O);
619
+ t.current.filtered.items.set(P, ve), ve > 0 && D++;
620
+ }
621
+ for (let [P, B] of n.current) for (let O of B) if (t.current.filtered.items.get(O) > 0) {
622
+ t.current.filtered.groups.add(P);
623
+ break;
624
+ }
625
+ t.current.filtered.count = D;
626
+ }
627
+ function ae() {
628
+ var d, T, A;
629
+ let y = X();
630
+ y && (((d = y.parentElement) == null ? void 0 : d.firstChild) === y && ((A = (T = y.closest(me)) == null ? void 0 : T.querySelector(gr)) == null || A.scrollIntoView({ block: "nearest" })), y.scrollIntoView({ block: "nearest" }));
631
+ }
632
+ function X() {
633
+ var d;
634
+ return (d = _.current) == null ? void 0 : d.querySelector(`${yt}[aria-selected="true"]`);
635
+ }
636
+ function I() {
637
+ var d;
638
+ return Array.from(((d = _.current) == null ? void 0 : d.querySelectorAll(st)) || []);
639
+ }
640
+ function de(d) {
641
+ let T = I()[d];
642
+ T && b.setState("value", T.getAttribute(re));
643
+ }
644
+ function Ce(d) {
645
+ var T;
646
+ let A = X(), y = I(), D = y.findIndex((B) => B === A), P = y[D + d];
647
+ (T = o.current) != null && T.loop && (P = D + d < 0 ? y[y.length - 1] : D + d === y.length ? y[0] : y[D + d]), P && b.setState("value", P.getAttribute(re));
648
+ }
649
+ function Ke(d) {
650
+ let T = X(), A = T == null ? void 0 : T.closest(me), y;
651
+ for (; A && !y; ) A = d > 0 ? Ir(A, me) : Ar(A, me), y = A == null ? void 0 : A.querySelector(st);
652
+ y ? b.setState("value", y.getAttribute(re)) : Ce(d);
653
+ }
654
+ let He = () => de(I().length - 1), qe = (d) => {
655
+ d.preventDefault(), d.metaKey ? He() : d.altKey ? Ke(1) : Ce(1);
656
+ }, Xe = (d) => {
657
+ d.preventDefault(), d.metaKey ? de(0) : d.altKey ? Ke(-1) : Ce(-1);
658
+ };
659
+ return p.createElement(Z.div, { ref: a, tabIndex: -1, ...k, "cmdk-root": "", onKeyDown: (d) => {
660
+ var T;
661
+ (T = k.onKeyDown) == null || T.call(k, d);
662
+ let A = d.nativeEvent.isComposing || d.keyCode === 229;
663
+ if (!(d.defaultPrevented || A)) switch (d.key) {
664
+ case "n":
665
+ case "j": {
666
+ w && d.ctrlKey && qe(d);
667
+ break;
668
+ }
669
+ case "ArrowDown": {
670
+ qe(d);
671
+ break;
672
+ }
673
+ case "p":
674
+ case "k": {
675
+ w && d.ctrlKey && Xe(d);
676
+ break;
677
+ }
678
+ case "ArrowUp": {
679
+ Xe(d);
680
+ break;
681
+ }
682
+ case "Home": {
683
+ d.preventDefault(), de(0);
684
+ break;
685
+ }
686
+ case "End": {
687
+ d.preventDefault(), He();
688
+ break;
689
+ }
690
+ case "Enter": {
691
+ d.preventDefault();
692
+ let y = X();
693
+ if (y) {
694
+ let D = new Event(Me);
695
+ y.dispatchEvent(D);
696
+ }
697
+ }
698
+ }
699
+ } }, p.createElement("label", { "cmdk-label": "", htmlFor: C.inputId, id: C.labelId, style: Pr }, f), xe(e, (d) => p.createElement(St.Provider, { value: b }, p.createElement(wt.Provider, { value: C }, d))));
700
+ }), wr = p.forwardRef((e, a) => {
701
+ var t, r;
702
+ let n = se(), i = p.useRef(null), s = p.useContext(xt), o = pe(), f = Nt(e), u = (r = (t = f.current) == null ? void 0 : t.forceMount) != null ? r : s == null ? void 0 : s.forceMount;
703
+ te(() => {
704
+ if (!u) return o.item(n, s == null ? void 0 : s.id);
705
+ }, [u]);
706
+ let g = Et(n, i, [e.value, e.children, i], e.keywords), c = Ve(), v = Y((E) => E.value && E.value === g.current), m = Y((E) => u || o.filter() === !1 ? !0 : E.search ? E.filtered.items.get(n) > 0 : !0);
707
+ p.useEffect(() => {
708
+ let E = i.current;
709
+ if (!(!E || e.disabled)) return E.addEventListener(Me, S), () => E.removeEventListener(Me, S);
710
+ }, [m, e.onSelect, e.disabled]);
711
+ function S() {
712
+ var E, b;
713
+ N(), (b = (E = f.current).onSelect) == null || b.call(E, g.current);
714
+ }
715
+ function N() {
716
+ c.setState("value", g.current, !0);
717
+ }
718
+ if (!m) return null;
719
+ let { disabled: w, value: k, onSelect: z, forceMount: L, keywords: U, ..._ } = e;
720
+ return p.createElement(Z.div, { ref: he(i, a), ..._, id: n, "cmdk-item": "", role: "option", "aria-disabled": !!w, "aria-selected": !!v, "data-disabled": !!w, "data-selected": !!v, onPointerMove: w || o.getDisablePointerSelection() ? void 0 : N, onClick: w ? void 0 : S }, e.children);
721
+ }), Sr = p.forwardRef((e, a) => {
722
+ let { heading: t, children: r, forceMount: n, ...i } = e, s = se(), o = p.useRef(null), f = p.useRef(null), u = se(), g = pe(), c = Y((m) => n || g.filter() === !1 ? !0 : m.search ? m.filtered.groups.has(s) : !0);
723
+ te(() => g.group(s), []), Et(s, o, [e.value, e.heading, f]);
724
+ let v = p.useMemo(() => ({ id: s, forceMount: n }), [n]);
725
+ return p.createElement(Z.div, { ref: he(o, a), ...i, "cmdk-group": "", role: "presentation", hidden: c ? void 0 : !0 }, t && p.createElement("div", { ref: f, "cmdk-group-heading": "", "aria-hidden": !0, id: u }, t), xe(e, (m) => p.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": t ? u : void 0 }, p.createElement(xt.Provider, { value: v }, m))));
726
+ }), xr = p.forwardRef((e, a) => {
727
+ let { alwaysRender: t, ...r } = e, n = p.useRef(null), i = Y((s) => !s.search);
728
+ return !t && !i ? null : p.createElement(Z.div, { ref: he(n, a), ...r, "cmdk-separator": "", role: "separator" });
729
+ }), Cr = p.forwardRef((e, a) => {
730
+ let { onValueChange: t, ...r } = e, n = e.value != null, i = Ve(), s = Y((u) => u.search), o = Y((u) => u.selectedItemId), f = pe();
731
+ return p.useEffect(() => {
732
+ e.value != null && i.setState("search", e.value);
733
+ }, [e.value]), p.createElement(Z.input, { ref: a, ...r, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": f.listId, "aria-labelledby": f.labelId, "aria-activedescendant": o, id: f.inputId, type: "text", value: n ? e.value : s, onChange: (u) => {
734
+ n || i.setState("search", u.target.value), t == null || t(u.target.value);
735
+ } });
736
+ }), Nr = p.forwardRef((e, a) => {
737
+ let { children: t, label: r = "Suggestions", ...n } = e, i = p.useRef(null), s = p.useRef(null), o = Y((u) => u.selectedItemId), f = pe();
738
+ return p.useEffect(() => {
739
+ if (s.current && i.current) {
740
+ let u = s.current, g = i.current, c, v = new ResizeObserver(() => {
741
+ c = requestAnimationFrame(() => {
742
+ let m = u.offsetHeight;
743
+ g.style.setProperty("--cmdk-list-height", m.toFixed(1) + "px");
744
+ });
745
+ });
746
+ return v.observe(u), () => {
747
+ cancelAnimationFrame(c), v.unobserve(u);
748
+ };
749
+ }
750
+ }, []), p.createElement(Z.div, { ref: he(i, a), ...n, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": o, "aria-label": r, id: f.listId }, xe(e, (u) => p.createElement("div", { ref: he(s, f.listInnerRef), "cmdk-list-sizer": "" }, u)));
751
+ }), Er = p.forwardRef((e, a) => {
752
+ let { open: t, onOpenChange: r, overlayClassName: n, contentClassName: i, container: s, ...o } = e;
753
+ return p.createElement(na, { open: t, onOpenChange: r }, p.createElement(la, { container: s }, p.createElement(sa, { "cmdk-overlay": "", className: n }), p.createElement(ia, { "aria-label": e.label, "cmdk-dialog": "", className: i }, p.createElement(Ct, { ref: a, ...o }))));
754
+ }), Tr = p.forwardRef((e, a) => Y((t) => t.filtered.count === 0) ? p.createElement(Z.div, { ref: a, ...e, "cmdk-empty": "", role: "presentation" }) : null), kr = p.forwardRef((e, a) => {
755
+ let { progress: t, children: r, label: n = "Loading...", ...i } = e;
756
+ return p.createElement(Z.div, { ref: a, ...i, "cmdk-loading": "", role: "progressbar", "aria-valuenow": t, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": n }, xe(e, (s) => p.createElement("div", { "aria-hidden": !0 }, s)));
757
+ }), $ = Object.assign(Ct, { List: Nr, Item: wr, Input: Cr, Group: Sr, Separator: xr, Dialog: Er, Empty: Tr, Loading: kr });
758
+ function Ir(e, a) {
759
+ let t = e.nextElementSibling;
760
+ for (; t; ) {
761
+ if (t.matches(a)) return t;
762
+ t = t.nextElementSibling;
763
+ }
764
+ }
765
+ function Ar(e, a) {
766
+ let t = e.previousElementSibling;
767
+ for (; t; ) {
768
+ if (t.matches(a)) return t;
769
+ t = t.previousElementSibling;
770
+ }
771
+ }
772
+ function Nt(e) {
773
+ let a = p.useRef(e);
774
+ return te(() => {
775
+ a.current = e;
776
+ }), a;
777
+ }
778
+ var te = typeof window > "u" ? p.useEffect : p.useLayoutEffect;
779
+ function ne(e) {
780
+ let a = p.useRef();
781
+ return a.current === void 0 && (a.current = e()), a;
782
+ }
783
+ function Y(e) {
784
+ let a = Ve(), t = () => e(a.snapshot());
785
+ return p.useSyncExternalStore(a.subscribe, t, t);
786
+ }
787
+ function Et(e, a, t, r = []) {
788
+ let n = p.useRef(), i = pe();
789
+ return te(() => {
790
+ var s;
791
+ let o = (() => {
792
+ var u;
793
+ for (let g of t) {
794
+ if (typeof g == "string") return g.trim();
795
+ if (typeof g == "object" && "current" in g) return g.current ? (u = g.current.textContent) == null ? void 0 : u.trim() : n.current;
796
+ }
797
+ })(), f = r.map((u) => u.trim());
798
+ i.value(e, o, f), (s = a.current) == null || s.setAttribute(re, o), n.current = o;
799
+ }), n;
800
+ }
801
+ var Dr = () => {
802
+ let [e, a] = p.useState(), t = ne(() => /* @__PURE__ */ new Map());
803
+ return te(() => {
804
+ t.current.forEach((r) => r()), t.current = /* @__PURE__ */ new Map();
805
+ }, [e]), (r, n) => {
806
+ t.current.set(r, n), a({});
807
+ };
808
+ };
809
+ function Rr(e) {
810
+ let a = e.type;
811
+ return typeof a == "function" ? a(e.props) : "render" in a ? a.render(e.props) : e;
812
+ }
813
+ function xe({ asChild: e, children: a }, t) {
814
+ return e && p.isValidElement(a) ? p.cloneElement(Rr(a), { ref: a.ref }, t(a.props.children)) : t(a);
815
+ }
816
+ var Pr = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
817
+ const Tt = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ l(
818
+ $,
819
+ {
820
+ ref: t,
821
+ className: M(
822
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
823
+ e
824
+ ),
825
+ ...a
826
+ }
827
+ ));
828
+ Tt.displayName = $.displayName;
829
+ const kt = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ h("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
830
+ /* @__PURE__ */ l(_a, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
831
+ /* @__PURE__ */ l(
832
+ $.Input,
833
+ {
834
+ ref: t,
835
+ className: M(
836
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-[hsl(var(--semaphor-placeholder-foreground))] disabled:cursor-not-allowed disabled:opacity-50",
837
+ e
838
+ ),
839
+ ...a
840
+ }
841
+ )
842
+ ] }));
843
+ kt.displayName = $.Input.displayName;
844
+ const It = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ l(
845
+ $.List,
846
+ {
847
+ ref: t,
848
+ className: M("max-h-[300px] overflow-y-auto overflow-x-hidden", e),
849
+ ...a
850
+ }
851
+ ));
852
+ It.displayName = $.List.displayName;
853
+ const At = p.forwardRef((e, a) => /* @__PURE__ */ l(
854
+ $.Empty,
855
+ {
856
+ ref: a,
857
+ className: "py-6 text-center text-sm",
858
+ ...e
859
+ }
860
+ ));
861
+ At.displayName = $.Empty.displayName;
862
+ const Ue = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ l(
863
+ $.Group,
864
+ {
865
+ ref: t,
866
+ className: M(
867
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
868
+ e
869
+ ),
870
+ ...a
871
+ }
872
+ ));
873
+ Ue.displayName = $.Group.displayName;
874
+ const Dt = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ l(
875
+ $.Separator,
876
+ {
877
+ ref: t,
878
+ className: M("-mx-1 h-px bg-border", e),
879
+ ...a
880
+ }
881
+ ));
882
+ Dt.displayName = $.Separator.displayName;
883
+ const Oe = p.forwardRef(({ className: e, ...a }, t) => /* @__PURE__ */ l(
884
+ $.Item,
885
+ {
886
+ ref: t,
887
+ className: M(
888
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50",
889
+ e
890
+ ),
891
+ ...a
892
+ }
893
+ ));
894
+ Oe.displayName = $.Item.displayName;
895
+ function zr(e = {}) {
896
+ const { authToken: a, tokenProps: t } = Be(), r = j(
897
+ (E) => E.actions.applyResolvedCalendarPreferences
898
+ ), n = e.enabled ?? !0, i = (a == null ? void 0 : a.accessToken) ?? null, s = (t == null ? void 0 : t.apiServiceUrl) ?? null, [o, f] = F(!1), [u, g] = F(!1), [c, v] = F(!1), [m, S] = F(null), [N, w] = F(null), k = J(i);
899
+ k.current = i, ee(() => {
900
+ w(null), S(null), f(!1), g(!1), v(!1);
901
+ }, [i]);
902
+ const z = W(async (E) => {
903
+ const b = Ma(await E.json());
904
+ if (!b.ok)
905
+ throw new Error("Calendar preferences response is invalid");
906
+ return b.value;
907
+ }, []), L = W(async () => {
908
+ if (!n || !i || !s) return;
909
+ const E = i;
910
+ f(!0), S(null);
911
+ try {
912
+ const b = await fetch(
913
+ `${s}/v1/user-preferences/calendar`,
914
+ {
915
+ method: "GET",
916
+ headers: { Authorization: `Bearer ${i}` }
917
+ }
918
+ );
919
+ if (!b.ok) {
920
+ const R = await b.json().catch(() => ({}));
921
+ throw new Error(R.error || "Failed to fetch preferences");
922
+ }
923
+ const C = await z(b);
924
+ k.current === E && w(C);
925
+ } catch (b) {
926
+ k.current === E && S(b instanceof Error ? b.message : "Unknown error");
927
+ } finally {
928
+ k.current === E && f(!1);
929
+ }
930
+ }, [i, s, n, z]);
931
+ ee(() => {
932
+ n && L();
933
+ }, [n, L]);
934
+ const U = W(
935
+ async (E) => {
936
+ if (!i || !s)
937
+ return S("Not authenticated"), !1;
938
+ const b = i;
939
+ g(!0), S(null);
940
+ try {
941
+ const C = await fetch(
942
+ `${s}/v1/user-preferences/calendar`,
943
+ {
944
+ method: "PATCH",
945
+ headers: {
946
+ "Content-Type": "application/json",
947
+ Authorization: `Bearer ${i}`
948
+ },
949
+ body: JSON.stringify(E)
950
+ }
951
+ );
952
+ if (!C.ok) {
953
+ const x = await C.json().catch(() => ({}));
954
+ throw new Error(x.error || "Failed to update preferences");
955
+ }
956
+ const R = await z(C);
957
+ return k.current !== b ? !1 : (w(R), r(R.resolved, R.sources), !0);
958
+ } catch (C) {
959
+ return k.current === b && S(C instanceof Error ? C.message : "Unknown error"), !1;
960
+ } finally {
961
+ k.current === b && g(!1);
962
+ }
963
+ },
964
+ [
965
+ i,
966
+ s,
967
+ r,
968
+ z
969
+ ]
970
+ ), _ = W(async () => {
971
+ if (!i || !s)
972
+ return S("Not authenticated"), !1;
973
+ const E = i;
974
+ v(!0), S(null);
975
+ try {
976
+ const b = await fetch(
977
+ `${s}/v1/user-preferences/calendar`,
978
+ {
979
+ method: "DELETE",
980
+ headers: { Authorization: `Bearer ${i}` }
981
+ }
982
+ );
983
+ if (!b.ok) {
984
+ const R = await b.json().catch(() => ({}));
985
+ throw new Error(R.error || "Failed to clear preferences");
986
+ }
987
+ const C = await z(b);
988
+ return k.current !== E ? !1 : (w(C), r(C.resolved, C.sources), !0);
989
+ } catch (b) {
990
+ return k.current === E && S(b instanceof Error ? b.message : "Unknown error"), !1;
991
+ } finally {
992
+ k.current === E && v(!1);
993
+ }
994
+ }, [
995
+ i,
996
+ s,
997
+ r,
998
+ z
999
+ ]);
1000
+ return {
1001
+ preferences: N,
1002
+ isLoading: o,
1003
+ isSaving: u,
1004
+ isClearing: c,
1005
+ error: m,
1006
+ updatePreferences: U,
1007
+ clearPreferences: _,
1008
+ refetch: L
1009
+ };
1010
+ }
1011
+ const we = [
1012
+ { value: "America/New_York", label: "Eastern Time (US & Canada)" },
1013
+ { value: "America/Chicago", label: "Central Time (US & Canada)" },
1014
+ { value: "America/Denver", label: "Mountain Time (US & Canada)" },
1015
+ { value: "America/Los_Angeles", label: "Pacific Time (US & Canada)" },
1016
+ { value: "America/Phoenix", label: "Arizona" },
1017
+ { value: "America/Anchorage", label: "Alaska" },
1018
+ { value: "Pacific/Honolulu", label: "Hawaii" },
1019
+ { value: "Europe/London", label: "London" },
1020
+ { value: "Europe/Paris", label: "Paris, Berlin, Rome" },
1021
+ { value: "Asia/Tokyo", label: "Tokyo" },
1022
+ { value: "Asia/Shanghai", label: "Beijing, Shanghai" },
1023
+ { value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
1024
+ { value: "Australia/Sydney", label: "Sydney" },
1025
+ { value: "UTC", label: "UTC" }
1026
+ ], Rt = [
1027
+ { value: 0, label: "Sunday" },
1028
+ { value: 1, label: "Monday" },
1029
+ { value: 6, label: "Saturday" }
1030
+ ], it = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
1031
+ function Fr() {
1032
+ try {
1033
+ const e = Intl;
1034
+ if (e.supportedValuesOf)
1035
+ return e.supportedValuesOf("timeZone");
1036
+ } catch {
1037
+ }
1038
+ return we.map((e) => e.value);
1039
+ }
1040
+ function Lr(e) {
1041
+ if (!e) return "default";
1042
+ if (e.tz !== e.weekStart) return "inherited";
1043
+ switch (e.tz) {
1044
+ case "viewer_tenant":
1045
+ return "tenant";
1046
+ case "viewer_organization":
1047
+ return "organization";
1048
+ case "system_default":
1049
+ return "system";
1050
+ case "session_initial":
1051
+ return "embedded";
1052
+ default:
1053
+ return "default";
1054
+ }
1055
+ }
1056
+ function ot(e) {
1057
+ const a = we.find((t) => t.value === e);
1058
+ return a ? a.label : e;
1059
+ }
1060
+ function _r(e) {
1061
+ const a = Rt.find((t) => t.value === e);
1062
+ return a ? a.label : String(e);
1063
+ }
1064
+ function Mr({
1065
+ active: e,
1066
+ onClose: a
1067
+ }) {
1068
+ const {
1069
+ preferences: t,
1070
+ isLoading: r,
1071
+ isSaving: n,
1072
+ isClearing: i,
1073
+ updatePreferences: s,
1074
+ clearPreferences: o
1075
+ } = zr({ enabled: e }), f = oa(), u = (t == null ? void 0 : t.resolved.tz) || (f == null ? void 0 : f.tz) || "UTC", g = (t == null ? void 0 : t.resolved.weekStart) ?? (f == null ? void 0 : f.weekStart) ?? 1, [c, v] = F((t == null ? void 0 : t.stored) === null), [m, S] = F(!1), [N, w] = F(
1076
+ u
1077
+ ), [k, z] = F(
1078
+ g
1079
+ ), [L, U] = F(!1), _ = Q(() => Fr(), []), E = Q(
1080
+ () => _.filter(
1081
+ (I) => !we.some((de) => de.value === I)
1082
+ ),
1083
+ [_]
1084
+ ), b = Q(() => ot(N), [N]), C = t != null && t.inherited ? ot(t.inherited.tz) : "UTC", R = t != null && t.inherited ? _r(t.inherited.weekStart) : "Monday", x = Lr(
1085
+ t == null ? void 0 : t.inheritedSources
1086
+ );
1087
+ Ft.useEffect(() => {
1088
+ if (!e) {
1089
+ S(!1);
1090
+ return;
1091
+ }
1092
+ m || (t && v(t.stored === null), w(u), z(g));
1093
+ }, [
1094
+ e,
1095
+ m,
1096
+ t,
1097
+ u,
1098
+ g
1099
+ ]);
1100
+ const q = async () => {
1101
+ if (r) {
1102
+ H.error("Preferences are still loading. Please try again.");
1103
+ return;
1104
+ }
1105
+ c ? await o() ? (H.success("Now using default settings."), a()) : H.error("Failed to save preferences. Please try again.") : await s({
1106
+ tz: N,
1107
+ weekStart: k
1108
+ }) ? (H.success("Preferences saved."), a()) : H.error("Failed to save preferences. Please try again.");
1109
+ }, K = () => {
1110
+ a();
1111
+ }, ae = n || i, X = ae || r;
1112
+ return /* @__PURE__ */ h(ie, { children: [
1113
+ /* @__PURE__ */ h("div", { className: "space-y-4 py-1", children: [
1114
+ /* @__PURE__ */ h(
1115
+ Ye,
1116
+ {
1117
+ value: c ? "defaults" : "custom",
1118
+ onValueChange: (I) => {
1119
+ S(!0), v(I === "defaults");
1120
+ },
1121
+ className: "space-y-0.5",
1122
+ children: [
1123
+ /* @__PURE__ */ h(
1124
+ "label",
1125
+ {
1126
+ htmlFor: "mode-defaults",
1127
+ className: M(
1128
+ "flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
1129
+ c && "bg-muted/50"
1130
+ ),
1131
+ onClick: () => {
1132
+ S(!0), v(!0);
1133
+ },
1134
+ children: [
1135
+ /* @__PURE__ */ l(
1136
+ Ne,
1137
+ {
1138
+ value: "defaults",
1139
+ id: "mode-defaults",
1140
+ className: "mt-0.5"
1141
+ }
1142
+ ),
1143
+ /* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
1144
+ /* @__PURE__ */ h("p", { className: "text-[13px] font-medium text-foreground", children: [
1145
+ "Use ",
1146
+ x,
1147
+ " defaults"
1148
+ ] }),
1149
+ /* @__PURE__ */ h("p", { className: "text-[12px] text-muted-foreground", children: [
1150
+ C,
1151
+ ", week starts ",
1152
+ R
1153
+ ] })
1154
+ ] })
1155
+ ]
1156
+ }
1157
+ ),
1158
+ /* @__PURE__ */ h(
1159
+ "label",
1160
+ {
1161
+ htmlFor: "mode-custom",
1162
+ className: M(
1163
+ "flex cursor-pointer items-start gap-2 rounded-control px-2 py-1.5 hover:bg-muted/50",
1164
+ !c && "bg-muted/50"
1165
+ ),
1166
+ onClick: () => {
1167
+ S(!0), v(!1);
1168
+ },
1169
+ children: [
1170
+ /* @__PURE__ */ l(
1171
+ Ne,
1172
+ {
1173
+ value: "custom",
1174
+ id: "mode-custom",
1175
+ className: "mt-0.5"
1176
+ }
1177
+ ),
1178
+ /* @__PURE__ */ l("p", { className: "flex-1 text-[13px] font-medium text-foreground", children: "Use custom settings" })
1179
+ ]
1180
+ }
1181
+ )
1182
+ ]
1183
+ }
1184
+ ),
1185
+ /* @__PURE__ */ h(
1186
+ "div",
1187
+ {
1188
+ className: M(
1189
+ "space-y-4 border-t border-border/60 pt-4 transition-opacity",
1190
+ c && "pointer-events-none opacity-50"
1191
+ ),
1192
+ children: [
1193
+ /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
1194
+ /* @__PURE__ */ l(oe, { className: it, children: "Timezone" }),
1195
+ /* @__PURE__ */ h(
1196
+ xa,
1197
+ {
1198
+ open: L,
1199
+ onOpenChange: U,
1200
+ modal: !0,
1201
+ children: [
1202
+ /* @__PURE__ */ l(Ca, { asChild: !0, children: /* @__PURE__ */ h(
1203
+ V,
1204
+ {
1205
+ variant: "outline",
1206
+ size: "xs",
1207
+ role: "combobox",
1208
+ "aria-expanded": L,
1209
+ className: "w-full justify-between text-[12px] font-normal",
1210
+ disabled: c,
1211
+ children: [
1212
+ /* @__PURE__ */ l("span", { className: "truncate", children: b }),
1213
+ /* @__PURE__ */ l(da, { className: "ml-2 h-3.5 w-3.5 shrink-0 opacity-50" })
1214
+ ]
1215
+ }
1216
+ ) }),
1217
+ /* @__PURE__ */ l(
1218
+ Na,
1219
+ {
1220
+ className: "z-50 w-[--radix-popover-trigger-width] p-0",
1221
+ align: "start",
1222
+ children: /* @__PURE__ */ h(Tt, { className: "overflow-visible", children: [
1223
+ /* @__PURE__ */ l(kt, { placeholder: "Search timezones…" }),
1224
+ /* @__PURE__ */ h(It, { children: [
1225
+ /* @__PURE__ */ l(At, { children: "No timezone found." }),
1226
+ /* @__PURE__ */ l(Ue, { heading: "Common", children: we.map((I) => /* @__PURE__ */ h(
1227
+ Oe,
1228
+ {
1229
+ value: `${I.value} ${I.label}`,
1230
+ onSelect: () => {
1231
+ S(!0), w(I.value), U(!1);
1232
+ },
1233
+ children: [
1234
+ /* @__PURE__ */ l(
1235
+ Ze,
1236
+ {
1237
+ className: M(
1238
+ "h-3.5 w-3.5",
1239
+ N === I.value ? "opacity-100" : "opacity-0"
1240
+ )
1241
+ }
1242
+ ),
1243
+ /* @__PURE__ */ l("span", { className: "flex-1", children: I.label }),
1244
+ /* @__PURE__ */ l("span", { className: "text-[11px] text-muted-foreground", children: I.value })
1245
+ ]
1246
+ },
1247
+ I.value
1248
+ )) }),
1249
+ /* @__PURE__ */ l(Dt, {}),
1250
+ /* @__PURE__ */ l(Ue, { heading: "All timezones", children: E.map((I) => /* @__PURE__ */ h(
1251
+ Oe,
1252
+ {
1253
+ value: I,
1254
+ onSelect: () => {
1255
+ S(!0), w(I), U(!1);
1256
+ },
1257
+ children: [
1258
+ /* @__PURE__ */ l(
1259
+ Ze,
1260
+ {
1261
+ className: M(
1262
+ "h-3.5 w-3.5",
1263
+ N === I ? "opacity-100" : "opacity-0"
1264
+ )
1265
+ }
1266
+ ),
1267
+ I
1268
+ ]
1269
+ },
1270
+ I
1271
+ )) })
1272
+ ] })
1273
+ ] })
1274
+ }
1275
+ )
1276
+ ]
1277
+ }
1278
+ )
1279
+ ] }),
1280
+ /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
1281
+ /* @__PURE__ */ l(oe, { className: it, children: "Week starts on" }),
1282
+ /* @__PURE__ */ l(
1283
+ Ye,
1284
+ {
1285
+ value: String(k),
1286
+ onValueChange: (I) => {
1287
+ S(!0), z(Number(I));
1288
+ },
1289
+ className: "flex gap-4",
1290
+ disabled: c,
1291
+ children: Rt.map((I) => /* @__PURE__ */ h(
1292
+ "label",
1293
+ {
1294
+ htmlFor: `week-start-${I.value}`,
1295
+ className: M(
1296
+ "flex cursor-pointer items-center gap-2 text-[13px]",
1297
+ c && "cursor-not-allowed"
1298
+ ),
1299
+ children: [
1300
+ /* @__PURE__ */ l(
1301
+ Ne,
1302
+ {
1303
+ value: String(I.value),
1304
+ id: `week-start-${I.value}`,
1305
+ disabled: c
1306
+ }
1307
+ ),
1308
+ I.label
1309
+ ]
1310
+ },
1311
+ I.value
1312
+ ))
1313
+ }
1314
+ )
1315
+ ] })
1316
+ ]
1317
+ }
1318
+ )
1319
+ ] }),
1320
+ /* @__PURE__ */ h(We, { children: [
1321
+ /* @__PURE__ */ l(
1322
+ V,
1323
+ {
1324
+ variant: "outline",
1325
+ size: "xs",
1326
+ onClick: K,
1327
+ disabled: ae,
1328
+ children: "Cancel"
1329
+ }
1330
+ ),
1331
+ /* @__PURE__ */ l(V, { size: "xs", onClick: q, disabled: X, children: ae ? /* @__PURE__ */ h(ie, { children: [
1332
+ /* @__PURE__ */ l(ht, { className: "h-3.5 w-3.5 animate-spin" }),
1333
+ "Saving…"
1334
+ ] }) : "Save" })
1335
+ ] })
1336
+ ] });
1337
+ }
1338
+ function Ur(e = {}) {
1339
+ const { authToken: a, tokenProps: t } = Be(), r = j(
1340
+ (b) => b.actions.applyResolvedValueFormatPreferences
1341
+ ), n = e.enabled ?? !0, i = (a == null ? void 0 : a.accessToken) ?? null, s = (t == null ? void 0 : t.apiServiceUrl) ?? null, o = J(i);
1342
+ o.current = i;
1343
+ const [f, u] = F(null), [g, c] = F(!1), [v, m] = F(!1), [S, N] = F(!1), [w, k] = F(null);
1344
+ ee(() => {
1345
+ u(null), k(null), c(!1), m(!1), N(!1);
1346
+ }, [i]);
1347
+ const z = W(async (b) => {
1348
+ const C = Aa(await b.json());
1349
+ if (!C.ok)
1350
+ throw new Error("Value format preferences response is invalid");
1351
+ return C.value;
1352
+ }, []), L = W(
1353
+ async (b, C) => {
1354
+ if (!i || !s)
1355
+ throw new Error("Not authenticated");
1356
+ const R = await fetch(
1357
+ `${s}/v1/user-preferences/value-format`,
1358
+ {
1359
+ method: b,
1360
+ headers: {
1361
+ Authorization: `Bearer ${i}`,
1362
+ ...C ? { "Content-Type": "application/json" } : {}
1363
+ },
1364
+ body: C ? JSON.stringify(C) : void 0
1365
+ }
1366
+ );
1367
+ if (!R.ok) {
1368
+ const x = await R.json().catch(() => ({}));
1369
+ throw new Error(x.error || "Failed to update preferences");
1370
+ }
1371
+ return z(R);
1372
+ },
1373
+ [i, s, z]
1374
+ ), U = W(async () => {
1375
+ if (!n || !i || !s) return;
1376
+ const b = i;
1377
+ c(!0), k(null);
1378
+ try {
1379
+ const C = await L("GET");
1380
+ o.current === b && u(C);
1381
+ } catch (C) {
1382
+ o.current === b && k(C instanceof Error ? C.message : "Unknown error");
1383
+ } finally {
1384
+ o.current === b && c(!1);
1385
+ }
1386
+ }, [i, s, n, L]);
1387
+ ee(() => {
1388
+ n && U();
1389
+ }, [n, U]);
1390
+ const _ = W(
1391
+ async (b) => {
1392
+ const C = i;
1393
+ m(!0), k(null);
1394
+ try {
1395
+ const R = await L("PATCH", b);
1396
+ return o.current !== C ? !1 : (u(R), r(R.resolved, R.sources), !0);
1397
+ } catch (R) {
1398
+ return o.current === C && k(R instanceof Error ? R.message : "Unknown error"), !1;
1399
+ } finally {
1400
+ o.current === C && m(!1);
1401
+ }
1402
+ },
1403
+ [i, r, L]
1404
+ ), E = W(async () => {
1405
+ const b = i;
1406
+ N(!0), k(null);
1407
+ try {
1408
+ const C = await L("DELETE");
1409
+ return o.current !== b ? !1 : (u(C), r(C.resolved, C.sources), !0);
1410
+ } catch (C) {
1411
+ return o.current === b && k(C instanceof Error ? C.message : "Unknown error"), !1;
1412
+ } finally {
1413
+ o.current === b && N(!1);
1414
+ }
1415
+ }, [i, r, L]);
1416
+ return {
1417
+ preferences: f,
1418
+ isLoading: g,
1419
+ isSaving: v,
1420
+ isClearing: S,
1421
+ error: w,
1422
+ updatePreferences: _,
1423
+ clearPreferences: E,
1424
+ refetch: U
1425
+ };
1426
+ }
1427
+ const je = [
1428
+ { value: "en-US", label: "English (United States)" },
1429
+ { value: "en-GB", label: "English (United Kingdom)" },
1430
+ { value: "de-DE", label: "German (Germany)" },
1431
+ { value: "fr-FR", label: "French (France)" },
1432
+ { value: "es-ES", label: "Spanish (Spain)" },
1433
+ { value: "it-IT", label: "Italian (Italy)" },
1434
+ { value: "nl-NL", label: "Dutch (Netherlands)" },
1435
+ { value: "pt-BR", label: "Portuguese (Brazil)" },
1436
+ { value: "ja-JP", label: "Japanese (Japan)" },
1437
+ { value: "en-IN", label: "English (India)" },
1438
+ { value: "en-NZ", label: "English (New Zealand)" },
1439
+ { value: "mi-NZ", label: "Māori (New Zealand)" }
1440
+ ], Pt = /* @__PURE__ */ new Set([
1441
+ "USD",
1442
+ "EUR",
1443
+ "GBP",
1444
+ "CAD",
1445
+ "AUD",
1446
+ "JPY",
1447
+ "CHF",
1448
+ "INR",
1449
+ "BRL",
1450
+ "KWD"
1451
+ ]), Or = Da(), jr = Or.filter(
1452
+ (e) => !Pt.has(e)
1453
+ ), zt = [
1454
+ { value: "short", label: "Short" },
1455
+ { value: "medium", label: "Medium" },
1456
+ { value: "long", label: "Long" }
1457
+ ], dt = "2026-07-31", Ie = "2026-07-31T14:30:45";
1458
+ function $e(e) {
1459
+ switch (e) {
1460
+ case "viewer_user":
1461
+ return "user";
1462
+ case "viewer_tenant_user":
1463
+ return "tenant user";
1464
+ case "viewer_tenant":
1465
+ return "tenant";
1466
+ case "viewer_organization":
1467
+ return "organization";
1468
+ case "session_initial":
1469
+ return "embedded session";
1470
+ case "system_default":
1471
+ return "system";
1472
+ default:
1473
+ return "another preference level";
1474
+ }
1475
+ }
1476
+ function Ae(e) {
1477
+ var a;
1478
+ return ((a = zt.find((t) => t.value === e)) == null ? void 0 : a.label) ?? e;
1479
+ }
1480
+ function $r(e) {
1481
+ const a = je.find((t) => t.value === e);
1482
+ return a ? `${a.label} — ${a.value}` : e;
1483
+ }
1484
+ function De(e) {
1485
+ return {
1486
+ short: e("short"),
1487
+ medium: e("medium"),
1488
+ long: e("long")
1489
+ };
1490
+ }
1491
+ function Re({
1492
+ id: e,
1493
+ label: a,
1494
+ value: t,
1495
+ inherited: r,
1496
+ inheritedSource: n,
1497
+ examples: i,
1498
+ disabled: s,
1499
+ onValueChange: o
1500
+ }) {
1501
+ const f = t === void 0 ? `Inherited · ${Ae(r)}` : Ae(t);
1502
+ return /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
1503
+ /* @__PURE__ */ l(oe, { htmlFor: e, className: "text-[11px] text-muted-foreground", children: a }),
1504
+ /* @__PURE__ */ h(
1505
+ Pe,
1506
+ {
1507
+ value: t ?? "inherit",
1508
+ disabled: s,
1509
+ onValueChange: o,
1510
+ children: [
1511
+ /* @__PURE__ */ l(ze, { id: e, size: "xs", children: /* @__PURE__ */ l(Fe, { children: f }) }),
1512
+ /* @__PURE__ */ h(Le, { children: [
1513
+ /* @__PURE__ */ l(G, { value: "inherit", className: "[&>span:last-child]:w-full", children: /* @__PURE__ */ h("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
1514
+ /* @__PURE__ */ h("span", { children: [
1515
+ "Inherited from ",
1516
+ $e(n),
1517
+ " ·",
1518
+ " ",
1519
+ Ae(r)
1520
+ ] }),
1521
+ /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: i[r] })
1522
+ ] }) }),
1523
+ zt.map((u) => /* @__PURE__ */ l(
1524
+ G,
1525
+ {
1526
+ value: u.value,
1527
+ className: "[&>span:last-child]:w-full",
1528
+ children: /* @__PURE__ */ h("span", { className: "flex w-full min-w-0 items-center justify-between gap-4", children: [
1529
+ /* @__PURE__ */ l("span", { children: u.label }),
1530
+ /* @__PURE__ */ l("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: i[u.value] })
1531
+ ] })
1532
+ },
1533
+ u.value
1534
+ ))
1535
+ ] })
1536
+ ]
1537
+ }
1538
+ )
1539
+ ] });
1540
+ }
1541
+ function Br({
1542
+ value: e,
1543
+ inherited: a,
1544
+ inheritedSources: t,
1545
+ onChange: r,
1546
+ disabled: n
1547
+ }) {
1548
+ var E, b, C, R;
1549
+ const i = ce(), s = ce(), o = ce(), f = ce(), u = ce(), c = (e.locale === void 0 ? void 0 : pt(e.locale)) ?? a.locale, v = e.defaultCurrency ?? a.defaultCurrency, m = {
1550
+ locale: c,
1551
+ dateStyle: e.dateStyle ?? a.dateStyle,
1552
+ dateTime: {
1553
+ dateStyle: ((E = e.dateTime) == null ? void 0 : E.dateStyle) ?? a.dateTime.dateStyle,
1554
+ timeStyle: ((b = e.dateTime) == null ? void 0 : b.timeStyle) ?? a.dateTime.timeStyle
1555
+ },
1556
+ defaultCurrency: v
1557
+ }, S = new Intl.NumberFormat(c, {
1558
+ style: "currency",
1559
+ currency: v
1560
+ }).format(1e3), N = ge({
1561
+ preferences: m,
1562
+ calendar: { tz: "UTC" }
1563
+ }), w = ue({
1564
+ value: dt,
1565
+ metadata: { kind: "raw_temporal", valueKind: "date" },
1566
+ format: N
1567
+ }).text, k = ue({
1568
+ value: Ie,
1569
+ metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
1570
+ format: N
1571
+ }).text, z = De(
1572
+ (x) => ue({
1573
+ value: dt,
1574
+ metadata: { kind: "raw_temporal", valueKind: "date" },
1575
+ format: ge({
1576
+ preferences: { ...m, dateStyle: x },
1577
+ calendar: { tz: "UTC" }
1578
+ })
1579
+ }).text
1580
+ ), L = De(
1581
+ (x) => ue({
1582
+ value: Ie,
1583
+ metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
1584
+ format: ge({
1585
+ preferences: {
1586
+ ...m,
1587
+ dateTime: { ...m.dateTime, dateStyle: x }
1588
+ },
1589
+ calendar: { tz: "UTC" }
1590
+ })
1591
+ }).text
1592
+ ), U = De(
1593
+ (x) => ue({
1594
+ value: Ie,
1595
+ metadata: { kind: "raw_temporal", valueKind: "wall_datetime" },
1596
+ format: ge({
1597
+ preferences: {
1598
+ ...m,
1599
+ dateTime: { ...m.dateTime, timeStyle: x }
1600
+ },
1601
+ calendar: { tz: "UTC" }
1602
+ })
1603
+ }).text
1604
+ ), _ = (x, q) => {
1605
+ const K = {
1606
+ ...e.dateTime,
1607
+ [x]: q === "inherit" ? void 0 : q
1608
+ };
1609
+ r({
1610
+ ...e,
1611
+ dateTime: K.dateStyle === void 0 && K.timeStyle === void 0 ? void 0 : K
1612
+ });
1613
+ };
1614
+ return /* @__PURE__ */ h("div", { className: "space-y-4", children: [
1615
+ /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
1616
+ /* @__PURE__ */ l(
1617
+ oe,
1618
+ {
1619
+ htmlFor: i,
1620
+ className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
1621
+ children: "Locale"
1622
+ }
1623
+ ),
1624
+ /* @__PURE__ */ h(
1625
+ Pe,
1626
+ {
1627
+ value: e.locale ?? "inherit",
1628
+ disabled: n,
1629
+ onValueChange: (x) => r({
1630
+ ...e,
1631
+ locale: x === "inherit" ? void 0 : x
1632
+ }),
1633
+ children: [
1634
+ /* @__PURE__ */ l(ze, { id: i, size: "xs", children: /* @__PURE__ */ l(Fe, { children: e.locale === void 0 ? `Inherited · ${a.locale}` : $r(e.locale) }) }),
1635
+ /* @__PURE__ */ h(Le, { children: [
1636
+ /* @__PURE__ */ h(G, { value: "inherit", children: [
1637
+ "Inherited from ",
1638
+ $e(t.locale),
1639
+ " ·",
1640
+ " ",
1641
+ a.locale
1642
+ ] }),
1643
+ e.locale && !je.some(
1644
+ (x) => x.value === e.locale
1645
+ ) && /* @__PURE__ */ l(G, { value: e.locale, children: e.locale }),
1646
+ je.map((x) => /* @__PURE__ */ h(G, { value: x.value, children: [
1647
+ x.label,
1648
+ " — ",
1649
+ x.value
1650
+ ] }, x.value))
1651
+ ] })
1652
+ ]
1653
+ }
1654
+ )
1655
+ ] }),
1656
+ /* @__PURE__ */ h("fieldset", { className: "space-y-2", children: [
1657
+ /* @__PURE__ */ l("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date values" }),
1658
+ /* @__PURE__ */ l(
1659
+ Re,
1660
+ {
1661
+ id: o,
1662
+ label: "Format",
1663
+ value: e.dateStyle,
1664
+ inherited: a.dateStyle,
1665
+ inheritedSource: t.dateStyle,
1666
+ examples: z,
1667
+ disabled: n,
1668
+ onValueChange: (x) => r({
1669
+ ...e,
1670
+ dateStyle: x === "inherit" ? void 0 : x
1671
+ })
1672
+ }
1673
+ )
1674
+ ] }),
1675
+ /* @__PURE__ */ h("fieldset", { className: "space-y-2", children: [
1676
+ /* @__PURE__ */ l("legend", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Date & time values" }),
1677
+ /* @__PURE__ */ l(
1678
+ Re,
1679
+ {
1680
+ id: f,
1681
+ label: "Date",
1682
+ value: (C = e.dateTime) == null ? void 0 : C.dateStyle,
1683
+ inherited: a.dateTime.dateStyle,
1684
+ inheritedSource: t.dateTime.dateStyle,
1685
+ examples: L,
1686
+ disabled: n,
1687
+ onValueChange: (x) => _("dateStyle", x)
1688
+ }
1689
+ ),
1690
+ /* @__PURE__ */ l(
1691
+ Re,
1692
+ {
1693
+ id: u,
1694
+ label: "Time",
1695
+ value: (R = e.dateTime) == null ? void 0 : R.timeStyle,
1696
+ inherited: a.dateTime.timeStyle,
1697
+ inheritedSource: t.dateTime.timeStyle,
1698
+ examples: U,
1699
+ disabled: n,
1700
+ onValueChange: (x) => _("timeStyle", x)
1701
+ }
1702
+ )
1703
+ ] }),
1704
+ /* @__PURE__ */ h("div", { className: "space-y-1.5", children: [
1705
+ /* @__PURE__ */ l(
1706
+ oe,
1707
+ {
1708
+ htmlFor: s,
1709
+ className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground",
1710
+ children: "Default currency"
1711
+ }
1712
+ ),
1713
+ /* @__PURE__ */ h(
1714
+ Pe,
1715
+ {
1716
+ value: e.defaultCurrency ?? "inherit",
1717
+ disabled: n,
1718
+ onValueChange: (x) => r({
1719
+ ...e,
1720
+ defaultCurrency: x === "inherit" ? void 0 : x
1721
+ }),
1722
+ children: [
1723
+ /* @__PURE__ */ l(ze, { id: s, size: "xs", children: /* @__PURE__ */ l(Fe, { children: e.defaultCurrency === void 0 ? `Inherited · ${a.defaultCurrency}` : e.defaultCurrency }) }),
1724
+ /* @__PURE__ */ h(Le, { children: [
1725
+ /* @__PURE__ */ h(G, { value: "inherit", children: [
1726
+ "Inherited from ",
1727
+ $e(t.defaultCurrency),
1728
+ " ·",
1729
+ " ",
1730
+ a.defaultCurrency
1731
+ ] }),
1732
+ [...Pt].map((x) => /* @__PURE__ */ l(G, { value: x, children: x }, x)),
1733
+ jr.map((x) => /* @__PURE__ */ l(G, { value: x, children: x }, x))
1734
+ ] })
1735
+ ]
1736
+ }
1737
+ )
1738
+ ] }),
1739
+ /* @__PURE__ */ h("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2", children: [
1740
+ /* @__PURE__ */ l("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Preview" }),
1741
+ /* @__PURE__ */ h("dl", { className: "mt-1.5 space-y-1 text-[12px]", children: [
1742
+ /* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
1743
+ /* @__PURE__ */ l("dt", { className: "text-muted-foreground", children: "Date" }),
1744
+ /* @__PURE__ */ l("dd", { className: "text-right font-medium text-foreground", children: w })
1745
+ ] }),
1746
+ /* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
1747
+ /* @__PURE__ */ l("dt", { className: "text-muted-foreground", children: "Date & time" }),
1748
+ /* @__PURE__ */ l("dd", { className: "text-right font-medium text-foreground", children: k })
1749
+ ] }),
1750
+ /* @__PURE__ */ h("div", { className: "flex items-baseline justify-between gap-4", children: [
1751
+ /* @__PURE__ */ l("dt", { className: "text-muted-foreground", children: "Currency" }),
1752
+ /* @__PURE__ */ l("dd", { className: "text-right font-medium text-foreground", children: S })
1753
+ ] })
1754
+ ] })
1755
+ ] }),
1756
+ /* @__PURE__ */ l("p", { className: "text-[11px] text-muted-foreground", children: "Currency values are not converted. Date examples use a fixed reference value and the Gregorian calendar." })
1757
+ ] });
1758
+ }
1759
+ const ct = [
1760
+ "locale",
1761
+ "dateStyle",
1762
+ "dateTime.dateStyle",
1763
+ "dateTime.timeStyle",
1764
+ "defaultCurrency"
1765
+ ];
1766
+ function ut(e, a) {
1767
+ var t, r;
1768
+ switch (a) {
1769
+ case "locale":
1770
+ return e == null ? void 0 : e.locale;
1771
+ case "dateStyle":
1772
+ return e == null ? void 0 : e.dateStyle;
1773
+ case "dateTime.dateStyle":
1774
+ return (t = e == null ? void 0 : e.dateTime) == null ? void 0 : t.dateStyle;
1775
+ case "dateTime.timeStyle":
1776
+ return (r = e == null ? void 0 : e.dateTime) == null ? void 0 : r.timeStyle;
1777
+ case "defaultCurrency":
1778
+ return e == null ? void 0 : e.defaultCurrency;
1779
+ }
1780
+ }
1781
+ function Wr(e) {
1782
+ var r, n;
1783
+ const a = (r = e == null ? void 0 : e.dateTime) == null ? void 0 : r.dateStyle, t = (n = e == null ? void 0 : e.dateTime) == null ? void 0 : n.timeStyle;
1784
+ return {
1785
+ locale: e == null ? void 0 : e.locale,
1786
+ dateStyle: e == null ? void 0 : e.dateStyle,
1787
+ dateTime: a === void 0 && t === void 0 ? void 0 : { dateStyle: a, timeStyle: t },
1788
+ defaultCurrency: e == null ? void 0 : e.defaultCurrency
1789
+ };
1790
+ }
1791
+ function Vr({
1792
+ active: e,
1793
+ onClose: a
1794
+ }) {
1795
+ var o, f, u, g, c, v, m;
1796
+ const { preferences: t, isLoading: r, isSaving: n, updatePreferences: i } = Ur({ enabled: e });
1797
+ if (!e) return null;
1798
+ if (!t)
1799
+ return /* @__PURE__ */ h(ie, { children: [
1800
+ /* @__PURE__ */ l("div", { className: "py-2", children: /* @__PURE__ */ l("div", { className: "flex min-h-36 items-center justify-center text-[12px] text-muted-foreground", children: r ? "Loading preferences…" : "Preferences unavailable." }) }),
1801
+ /* @__PURE__ */ h(We, { className: "justify-between sm:justify-between", children: [
1802
+ /* @__PURE__ */ l(V, { variant: "ghost", size: "xs", disabled: !0, children: "Reset display formats" }),
1803
+ /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1804
+ /* @__PURE__ */ l(V, { variant: "outline", size: "xs", onClick: a, children: "Cancel" }),
1805
+ /* @__PURE__ */ l(V, { size: "xs", disabled: !0, children: "Save" })
1806
+ ] })
1807
+ ] })
1808
+ ] });
1809
+ const s = [
1810
+ ((o = t.stored) == null ? void 0 : o.locale) ?? "",
1811
+ ((f = t.stored) == null ? void 0 : f.dateStyle) ?? "",
1812
+ ((g = (u = t.stored) == null ? void 0 : u.dateTime) == null ? void 0 : g.dateStyle) ?? "",
1813
+ ((v = (c = t.stored) == null ? void 0 : c.dateTime) == null ? void 0 : v.timeStyle) ?? "",
1814
+ ((m = t.stored) == null ? void 0 : m.defaultCurrency) ?? ""
1815
+ ].join(":");
1816
+ return /* @__PURE__ */ l(
1817
+ Kr,
1818
+ {
1819
+ preferences: t,
1820
+ isSaving: n,
1821
+ updatePreferences: i,
1822
+ onClose: a
1823
+ },
1824
+ s
1825
+ );
1826
+ }
1827
+ function Kr({
1828
+ preferences: e,
1829
+ isSaving: a,
1830
+ updatePreferences: t,
1831
+ onClose: r
1832
+ }) {
1833
+ var u, g;
1834
+ const [n, i] = F(
1835
+ () => Wr(e.stored)
1836
+ ), s = (n.locale === void 0 || pt(n.locale) !== void 0) && (n.defaultCurrency === void 0 || Ra(n.defaultCurrency) !== void 0) && (n.dateStyle === void 0 || ["short", "medium", "long"].includes(n.dateStyle)) && (((u = n.dateTime) == null ? void 0 : u.dateStyle) === void 0 || ["short", "medium", "long"].includes(n.dateTime.dateStyle)) && (((g = n.dateTime) == null ? void 0 : g.timeStyle) === void 0 || ["short", "medium", "long"].includes(n.dateTime.timeStyle)), o = async () => {
1837
+ const c = {
1838
+ ...n.locale !== void 0 ? { locale: n.locale } : {},
1839
+ ...n.dateStyle !== void 0 ? { dateStyle: n.dateStyle } : {},
1840
+ ...n.dateTime ? { dateTime: { ...n.dateTime } } : {},
1841
+ ...n.defaultCurrency !== void 0 ? { defaultCurrency: n.defaultCurrency } : {}
1842
+ }, v = ct.filter(
1843
+ (N) => ut(n, N) === void 0 && ut(e.stored, N) !== void 0
1844
+ ), m = {
1845
+ ...Object.keys(c).length > 0 ? { set: c } : {},
1846
+ ...v.length > 0 ? { clear: v } : {}
1847
+ };
1848
+ (Object.keys(m).length === 0 ? !0 : await t(m)) ? (H.success("Display format preferences saved."), r()) : H.error("Failed to save preferences. Please try again.");
1849
+ }, f = async () => {
1850
+ await t({
1851
+ clear: [...ct]
1852
+ }) ? (H.success("Display format preferences reset."), r()) : H.error(
1853
+ "Failed to reset display format preferences. Please try again."
1854
+ );
1855
+ };
1856
+ return /* @__PURE__ */ h(ie, { children: [
1857
+ /* @__PURE__ */ l("div", { className: "py-2", children: /* @__PURE__ */ l(
1858
+ Br,
1859
+ {
1860
+ value: n,
1861
+ inherited: e.inherited,
1862
+ inheritedSources: e.inheritedSources,
1863
+ onChange: i,
1864
+ disabled: a
1865
+ }
1866
+ ) }),
1867
+ /* @__PURE__ */ h(We, { className: "justify-between sm:justify-between", children: [
1868
+ /* @__PURE__ */ l(
1869
+ V,
1870
+ {
1871
+ variant: "ghost",
1872
+ size: "xs",
1873
+ onClick: f,
1874
+ disabled: a || e.stored === null,
1875
+ children: "Reset display formats"
1876
+ }
1877
+ ),
1878
+ /* @__PURE__ */ h("div", { className: "flex gap-2", children: [
1879
+ /* @__PURE__ */ l(
1880
+ V,
1881
+ {
1882
+ variant: "outline",
1883
+ size: "xs",
1884
+ onClick: r,
1885
+ disabled: a,
1886
+ children: "Cancel"
1887
+ }
1888
+ ),
1889
+ /* @__PURE__ */ l(
1890
+ V,
1891
+ {
1892
+ size: "xs",
1893
+ onClick: o,
1894
+ disabled: a || !s,
1895
+ children: a ? /* @__PURE__ */ h(ie, { children: [
1896
+ /* @__PURE__ */ l(ht, { className: "h-3.5 w-3.5 animate-spin" }),
1897
+ "Saving…"
1898
+ ] }) : "Save"
1899
+ }
1900
+ )
1901
+ ] })
1902
+ ] })
1903
+ ] });
1904
+ }
1905
+ function pn({
1906
+ open: e,
1907
+ onOpenChange: a
1908
+ }) {
1909
+ const [t, r] = F("display"), n = () => a(!1);
1910
+ return /* @__PURE__ */ l(ca, { open: e, onOpenChange: a, children: /* @__PURE__ */ h(ua, { className: "rounded-control border-border/60 sm:max-w-[440px] sm:rounded-control", children: [
1911
+ /* @__PURE__ */ h(ma, { children: [
1912
+ /* @__PURE__ */ l(fa, { className: "text-[15px]", children: "Report preferences" }),
1913
+ /* @__PURE__ */ l(ha, { className: "text-[13px] leading-5", children: "Set how values and Calendar periods appear for you." })
1914
+ ] }),
1915
+ /* @__PURE__ */ h(Ea, { value: t, onValueChange: r, children: [
1916
+ /* @__PURE__ */ h(Ta, { variant: "underline", className: "w-full justify-start", children: [
1917
+ /* @__PURE__ */ l(Qe, { value: "display", children: "Display formats" }),
1918
+ /* @__PURE__ */ l(Qe, { value: "calendar", children: "Calendar" })
1919
+ ] }),
1920
+ /* @__PURE__ */ l(et, { value: "display", children: /* @__PURE__ */ l(
1921
+ Vr,
1922
+ {
1923
+ active: e && t === "display",
1924
+ onClose: n
1925
+ }
1926
+ ) }),
1927
+ /* @__PURE__ */ l(et, { value: "calendar", children: /* @__PURE__ */ l(
1928
+ Mr,
1929
+ {
1930
+ active: e && t === "calendar",
1931
+ onClose: n
1932
+ }
1933
+ ) })
1934
+ ] })
1935
+ ] }) });
1936
+ }
1937
+ export {
1938
+ Ka as A,
1939
+ Tt as C,
1940
+ hn as D,
1941
+ pn as R,
1942
+ Br as a,
1943
+ kt as b,
1944
+ It as c,
1945
+ At as d,
1946
+ Ue as e,
1947
+ Oe as f,
1948
+ er as g,
1949
+ fn as h
1950
+ };