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