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