@burdenoff/fe-libs 2026.1113.9 → 2026.1113.10
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/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +7 -0
- package/dist/shared/assistant/ui/AIAssistantPanel.js +214 -212
- package/dist/shared/assistant/ui/AssistantHeader.d.ts +2 -1
- package/dist/shared/assistant/ui/AssistantHeader.js +1 -1
- package/dist/shared/assistant/ui/AssistantOverlay.d.ts +46 -2
- package/dist/shared/assistant/ui/AssistantOverlay.js +359 -307
- package/dist/shared/assistant/ui/AssistantPageHost.d.ts +11 -0
- package/dist/shared/assistant/ui/AssistantPageHost.js +17 -0
- package/dist/shared/assistant/ui/assistantPageSurface.d.ts +11 -0
- package/dist/shared/assistant/ui/assistantPageSurface.js +10 -0
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +2 -1
- package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +2 -2
- package/dist/shared/assistant/ui/compact/AssistantMenuView.d.ts +5 -2
- package/dist/shared/assistant/ui/compact/AssistantMenuView.js +4 -4
- package/dist/shared-assistant.js +69 -67
- package/package.json +1 -1
|
@@ -2,454 +2,506 @@ import { quotaExhaustedEventName as e } from "../quota.js";
|
|
|
2
2
|
import { useAssistantTr as t } from "../i18n.js";
|
|
3
3
|
import { AssistantPreviewBridgeHost as n } from "../preview/bridgeHost.js";
|
|
4
4
|
import { useAssistantServerHistory as r } from "../history/useAssistantServerHistory.js";
|
|
5
|
-
import { AssistantCloseGuardContext as
|
|
6
|
-
import { useAssistantVisualViewport as
|
|
7
|
-
import { assistantPanelOwnsEscape as
|
|
8
|
-
import { AssistantPanelPlaceholder as
|
|
9
|
-
import { scheduleAssistantPanelPreload as
|
|
10
|
-
import { ASSISTANT_COMPACT_DOCKED_DEFAULT_QUERY as
|
|
11
|
-
import { AskAboutLayer as
|
|
12
|
-
import { useAssistantSignInWarm as
|
|
13
|
-
import { useAssistantProductOrNull as
|
|
14
|
-
import { createContext as
|
|
15
|
-
import { Sparkles as
|
|
16
|
-
import { jsx as
|
|
5
|
+
import { AssistantCloseGuardContext as ee } from "./closeGuard.js";
|
|
6
|
+
import { useAssistantVisualViewport as i } from "./useAssistantVisualViewport.js";
|
|
7
|
+
import { assistantPanelOwnsEscape as a } from "./panelOverlays.js";
|
|
8
|
+
import { AssistantPanelPlaceholder as o } from "./AssistantPanelPlaceholder.js";
|
|
9
|
+
import { scheduleAssistantPanelPreload as s, useAssistantPanelLoaded as c, useAssistantPanelModule as l } from "./assistantPanelLoader.js";
|
|
10
|
+
import { ASSISTANT_COMPACT_DOCKED_DEFAULT_QUERY as u, ASSISTANT_DOCK_WIDTH_VAR as d, ASSISTANT_OVERLAY_DESKTOP_QUERY as f, ASSISTANT_OVERLAY_TOP_VAR as p, ASSISTANT_PANEL_INSET_VAR as te, ASSISTANT_SHEET_BOTTOM_VAR as ne, ASSISTANT_WINDOW_BOTTOM_VAR as re, assistantCompactLauncherBottom as m, assistantCompactLauncherVisibility as ie, assistantCompactOverlayClassName as ae, assistantCompactOverlayKeys as oe, assistantLauncherBottom as h, assistantLauncherRight as g, assistantOverlayClassName as _, assistantOverlayEscapeAction as se, assistantOverlayKeys as ce, assistantQuotaKindOf as v, assistantWindowBottom as le, closestAround as ue, createAssistantNavigate as y, isAssistantSurface as de, isAssistantToggleShortcut as fe, nextAssistantOpenState as pe, publishedAssistantDockWidth as me, publishedAssistantPanelInset as he, publishedCompactDockWidth as ge, publishedCompactPanelInset as _e, readAssistantLayoutChoice as b, readAssistantLegacyDockChoice as x, readAssistantOverlayFlag as S, readAssistantWindowView as ve, requestedAssistantOpenState as C, resolveCompactDocked as w, writeAssistantLayoutChoice as T, writeAssistantOverlayFlag as E, writeAssistantWindowView as D } from "./assistantOverlayState.js";
|
|
11
|
+
import { AskAboutLayer as O } from "../askAbout/AskAboutLayer.js";
|
|
12
|
+
import { useAssistantSignInWarm as ye } from "../useAssistantSignInWarm.js";
|
|
13
|
+
import { useAssistantProductOrNull as be } from "../product.js";
|
|
14
|
+
import { createContext as k, useCallback as A, useContext as j, useEffect as M, useMemo as xe, useRef as N, useState as P, useSyncExternalStore as F } from "react";
|
|
15
|
+
import { Sparkles as Se } from "lucide-react";
|
|
16
|
+
import { jsx as I, jsxs as Ce } from "react/jsx-runtime";
|
|
17
|
+
import { createPortal as we } from "react-dom";
|
|
17
18
|
// src/shared/assistant/ui/AssistantOverlay.tsx
|
|
18
|
-
var
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
var L = "flex min-h-0 flex-1 flex-col";
|
|
20
|
+
function Te() {
|
|
21
|
+
if (typeof document > "u") return null;
|
|
22
|
+
let e = document.createElement("div");
|
|
23
|
+
return e.setAttribute("class", L), e.setAttribute("data-assistant-panel-root", ""), e;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
var R = k(null);
|
|
26
|
+
function z() {
|
|
27
|
+
return j(R);
|
|
24
28
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
29
|
+
function Ee() {
|
|
30
|
+
return j(R)?.dockWidthPx ?? 0;
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
function De() {
|
|
33
|
+
return j(R)?.panelInsetPx ?? 0;
|
|
34
|
+
}
|
|
35
|
+
var B = () => typeof window > "u" ? void 0 : window.sessionStorage, V = () => typeof window > "u" ? void 0 : window.localStorage;
|
|
36
|
+
function H(e) {
|
|
30
37
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
31
|
-
let t = window.matchMedia(
|
|
38
|
+
let t = window.matchMedia(f);
|
|
32
39
|
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
33
40
|
}
|
|
34
|
-
function
|
|
41
|
+
function U() {
|
|
35
42
|
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 640px)").matches;
|
|
36
43
|
}
|
|
37
|
-
function
|
|
38
|
-
return F(
|
|
44
|
+
function Oe() {
|
|
45
|
+
return F(H, U, () => !1);
|
|
39
46
|
}
|
|
40
|
-
function
|
|
47
|
+
function ke(t, n) {
|
|
41
48
|
let r = N(n);
|
|
42
|
-
|
|
49
|
+
M(() => {
|
|
43
50
|
r.current = n;
|
|
44
|
-
}, [n]),
|
|
51
|
+
}, [n]), M(() => {
|
|
45
52
|
if (!t || typeof window > "u") return;
|
|
46
|
-
let n = e(t),
|
|
47
|
-
return window.addEventListener(n,
|
|
53
|
+
let n = e(t), ee = (e) => r.current(v(e), e);
|
|
54
|
+
return window.addEventListener(n, ee), () => window.removeEventListener(n, ee);
|
|
48
55
|
}, [t]);
|
|
49
56
|
}
|
|
50
|
-
var
|
|
51
|
-
function
|
|
57
|
+
var Ae = () => {};
|
|
58
|
+
function W(e) {
|
|
52
59
|
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
|
|
53
|
-
let t = window.matchMedia(
|
|
60
|
+
let t = window.matchMedia(u);
|
|
54
61
|
return t.addEventListener("change", e), () => t.removeEventListener("change", e);
|
|
55
62
|
}
|
|
56
|
-
function
|
|
63
|
+
function G() {
|
|
57
64
|
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 1280px)").matches;
|
|
58
65
|
}
|
|
59
|
-
var
|
|
60
|
-
function
|
|
61
|
-
return F(e ?
|
|
66
|
+
var K = () => () => {}, q = () => !1;
|
|
67
|
+
function je(e) {
|
|
68
|
+
return F(e ? W : K, e ? G : q, q);
|
|
62
69
|
}
|
|
63
|
-
function
|
|
64
|
-
let i =
|
|
65
|
-
|
|
70
|
+
function J({ keyPrefix: e, quota: t, presentation: n = "classic", pageSurface: r = !1, children: ee }) {
|
|
71
|
+
let i = xe(() => ce(e), [e]), a = xe(() => oe(e), [e]), o = n === "compact", s = N(o);
|
|
72
|
+
M(() => {
|
|
66
73
|
s.current = o;
|
|
67
74
|
}, [o]);
|
|
68
|
-
let [c
|
|
75
|
+
let [c] = P(() => r ? Te() : null), l = N([]), [u, f] = P(null), p = N(!1), [ne, re] = P(null), m = A((e) => {
|
|
76
|
+
re((t) => ({
|
|
77
|
+
seq: (t?.seq ?? 0) + 1,
|
|
78
|
+
force: e
|
|
79
|
+
}));
|
|
80
|
+
}, []), ie = A((e) => (l.current = [...l.current.filter((t) => t !== e), e], p.current = !0, c && e.appendChild(c), f(e), m(!1), () => {
|
|
81
|
+
l.current = l.current.filter((t) => t !== e);
|
|
82
|
+
let t = l.current.at(-1) ?? null;
|
|
83
|
+
p.current = t !== null, t && c && t.appendChild(c), f(t);
|
|
84
|
+
}), [c, m]), ae = c !== null && u !== null, [h, g] = P(() => S(B, i.openStorageKey)), [_, se] = P(() => S(V, i.dockStorageKey)), [v, le] = P(() => {
|
|
69
85
|
if (!o) return "panel";
|
|
70
86
|
try {
|
|
71
|
-
let e =
|
|
87
|
+
let e = B()?.getItem(a.surfaceStorageKey);
|
|
72
88
|
return de(e) ? e : "panel";
|
|
73
89
|
} catch {
|
|
74
90
|
return "panel";
|
|
75
91
|
}
|
|
76
|
-
}), [
|
|
77
|
-
s.current &&
|
|
78
|
-
}, []), [
|
|
79
|
-
explicit:
|
|
80
|
-
legacy:
|
|
92
|
+
}), [ue, y] = P(() => o && S(B, a.minimizedStorageKey)), O = o && h && v === "window" && ue, [ye, be] = P(!1), k = o && h && v === "panel" && ye, [j] = P(() => o ? ve(V, a.windowViewStorageKey) : null), [F, Se] = P(null), Ce = F ?? j, we = A((e) => {
|
|
93
|
+
s.current && Se(e);
|
|
94
|
+
}, []), [L] = P(() => o ? {
|
|
95
|
+
explicit: b(V, a.layoutStorageKey),
|
|
96
|
+
legacy: x(V, i.dockStorageKey)
|
|
81
97
|
} : {
|
|
82
98
|
explicit: null,
|
|
83
99
|
legacy: null
|
|
84
|
-
}), [
|
|
85
|
-
explicit:
|
|
86
|
-
legacy:
|
|
87
|
-
wideViewport:
|
|
88
|
-
}) :
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}, [
|
|
92
|
-
let
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
let
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}, [
|
|
100
|
-
let
|
|
101
|
-
let e =
|
|
102
|
-
return e && s.current &&
|
|
103
|
-
}, []),
|
|
104
|
-
|
|
105
|
-
}), []),
|
|
106
|
-
|
|
107
|
-
}, []),
|
|
108
|
-
|
|
109
|
-
}, []),
|
|
110
|
-
s.current ?
|
|
111
|
-
}, [
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
}), [z, Ee] = P(null), De = je(o), H = o ? w({
|
|
101
|
+
explicit: z ?? L.explicit,
|
|
102
|
+
legacy: L.legacy,
|
|
103
|
+
wideViewport: De
|
|
104
|
+
}) : _, U = N(H);
|
|
105
|
+
M(() => {
|
|
106
|
+
U.current = H;
|
|
107
|
+
}, [H]);
|
|
108
|
+
let W = N(null), G = N(h);
|
|
109
|
+
M(() => {
|
|
110
|
+
G.current = h;
|
|
111
|
+
}, [h]);
|
|
112
|
+
let K = N(!1), q = h && (!o || v === "panel" && !O);
|
|
113
|
+
M(() => {
|
|
114
|
+
K.current = q;
|
|
115
|
+
}, [q]);
|
|
116
|
+
let J = A(() => {
|
|
117
|
+
let e = W.current?.() === !0;
|
|
118
|
+
return e && s.current && y(!1), e;
|
|
119
|
+
}, []), Y = A((e) => (W.current = e, () => {
|
|
120
|
+
W.current === e && (W.current = null);
|
|
121
|
+
}), []), X = A(() => {
|
|
122
|
+
g(!0), le("panel"), y(!1);
|
|
123
|
+
}, []), Z = A(() => {
|
|
124
|
+
g(!1), y(!1), be(!1), Fe(0);
|
|
125
|
+
}, []), Q = A(() => {
|
|
126
|
+
p.current ? m(!0) : s.current ? X() : g(!0);
|
|
127
|
+
}, [X, m]), Me = A(() => {
|
|
128
|
+
p.current || J() || (s.current ? Z() : g(!1));
|
|
129
|
+
}, [J, Z]), Ne = A(() => {
|
|
130
|
+
if (p.current) m(!0);
|
|
131
|
+
else if (s.current) {
|
|
132
|
+
if (K.current) {
|
|
133
|
+
if (J()) return;
|
|
134
|
+
Z();
|
|
135
|
+
} else X();
|
|
136
|
+
} else G.current && J() || g((e) => !e);
|
|
120
137
|
}, [
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
J,
|
|
139
|
+
Z,
|
|
140
|
+
X,
|
|
141
|
+
m
|
|
142
|
+
]), $ = A(() => {
|
|
143
|
+
if (!p.current) {
|
|
144
|
+
if (s.current) {
|
|
145
|
+
let e = U.current ? "floating" : "docked";
|
|
146
|
+
U.current = e === "docked", Ee(e);
|
|
147
|
+
} else se((e) => !e);
|
|
148
|
+
}
|
|
149
|
+
}, []), [Pe, Fe] = P(0), Ie = A((e) => {
|
|
150
|
+
Q(), s.current && e?.menu === "settings/avatar" && Fe((e) => e + 1);
|
|
151
|
+
}, [Q]), Le = A(() => {
|
|
152
|
+
p.current ? m(!0) : s.current ? K.current || (g(!0), le("window"), y(!1)) : g(!0);
|
|
153
|
+
}, [m]), Re = A(() => {
|
|
154
|
+
p.current || s.current && G.current && !K.current && y(!0);
|
|
135
155
|
}, []);
|
|
136
|
-
|
|
137
|
-
E(
|
|
138
|
-
}, [i.openStorageKey,
|
|
139
|
-
o || E(
|
|
156
|
+
M(() => {
|
|
157
|
+
E(B, i.openStorageKey, h);
|
|
158
|
+
}, [i.openStorageKey, h]), M(() => {
|
|
159
|
+
o || E(V, i.dockStorageKey, _);
|
|
140
160
|
}, [
|
|
141
161
|
o,
|
|
142
162
|
i.dockStorageKey,
|
|
143
|
-
|
|
144
|
-
]),
|
|
145
|
-
o &&
|
|
163
|
+
_
|
|
164
|
+
]), M(() => {
|
|
165
|
+
o && z !== null && T(V, a.layoutStorageKey, z);
|
|
146
166
|
}, [
|
|
147
167
|
o,
|
|
148
168
|
a.layoutStorageKey,
|
|
149
|
-
|
|
150
|
-
]),
|
|
151
|
-
o &&
|
|
169
|
+
z
|
|
170
|
+
]), M(() => {
|
|
171
|
+
o && F !== null && D(V, a.windowViewStorageKey, F);
|
|
152
172
|
}, [
|
|
153
173
|
o,
|
|
154
174
|
a.windowViewStorageKey,
|
|
155
|
-
|
|
156
|
-
]),
|
|
175
|
+
F
|
|
176
|
+
]), M(() => {
|
|
157
177
|
if (o) try {
|
|
158
|
-
|
|
178
|
+
B()?.setItem(a.surfaceStorageKey, v);
|
|
159
179
|
} catch {}
|
|
160
180
|
}, [
|
|
161
181
|
o,
|
|
162
182
|
a.surfaceStorageKey,
|
|
163
|
-
|
|
164
|
-
]),
|
|
165
|
-
o && E(
|
|
183
|
+
v
|
|
184
|
+
]), M(() => {
|
|
185
|
+
o && E(B, a.minimizedStorageKey, O);
|
|
166
186
|
}, [
|
|
167
187
|
o,
|
|
168
188
|
a.minimizedStorageKey,
|
|
169
|
-
|
|
170
|
-
]),
|
|
189
|
+
O
|
|
190
|
+
]), M(() => {
|
|
171
191
|
if (typeof window > "u") return;
|
|
172
192
|
let e = (e) => {
|
|
173
|
-
let t =
|
|
174
|
-
s.current ? t === !0 ?
|
|
193
|
+
let t = C(e);
|
|
194
|
+
p.current ? t !== !1 && m(!0) : s.current ? t === !0 ? X() : t === !1 ? G.current && !J() && Z() : K.current ? J() || Z() : X() : (!G.current || pe(!0, t) || W.current?.() !== !0) && g((e) => pe(e, t));
|
|
175
195
|
};
|
|
176
196
|
return window.addEventListener(i.toggleEvent, e), () => window.removeEventListener(i.toggleEvent, e);
|
|
177
197
|
}, [
|
|
178
198
|
i.toggleEvent,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
X,
|
|
200
|
+
Z,
|
|
201
|
+
J,
|
|
202
|
+
m
|
|
203
|
+
]), M(() => {
|
|
183
204
|
if (typeof document > "u") return;
|
|
184
205
|
let e = (e) => {
|
|
185
|
-
fe(e) && (e.preventDefault(), s.current ?
|
|
206
|
+
fe(e) && (e.preventDefault(), p.current ? m(!0) : s.current ? K.current ? J() || Z() : X() : G.current && W.current?.() === !0 || g((e) => !e));
|
|
186
207
|
};
|
|
187
208
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
188
209
|
}, [
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
isOpen: c,
|
|
201
|
-
docked: u,
|
|
202
|
-
isDesktop: Q
|
|
203
|
-
}), $ = o ? he({
|
|
204
|
-
isOpen: c,
|
|
205
|
-
docked: D,
|
|
206
|
-
isDesktop: Q,
|
|
207
|
-
surface: p,
|
|
208
|
-
expanded: g
|
|
210
|
+
X,
|
|
211
|
+
Z,
|
|
212
|
+
J,
|
|
213
|
+
m
|
|
214
|
+
]), ke(t?.product ?? null, t?.onExhausted ?? Ae);
|
|
215
|
+
let ze = Oe(), Be = h && !ae, Ve = o ? ge({
|
|
216
|
+
isOpen: Be,
|
|
217
|
+
docked: H,
|
|
218
|
+
isDesktop: ze,
|
|
219
|
+
surface: v,
|
|
220
|
+
expanded: k
|
|
209
221
|
}) : me({
|
|
210
|
-
isOpen:
|
|
211
|
-
docked:
|
|
212
|
-
isDesktop:
|
|
222
|
+
isOpen: Be,
|
|
223
|
+
docked: _,
|
|
224
|
+
isDesktop: ze
|
|
225
|
+
}), He = o ? _e({
|
|
226
|
+
isOpen: Be,
|
|
227
|
+
docked: H,
|
|
228
|
+
isDesktop: ze,
|
|
229
|
+
surface: v,
|
|
230
|
+
expanded: k
|
|
231
|
+
}) : he({
|
|
232
|
+
isOpen: Be,
|
|
233
|
+
docked: _,
|
|
234
|
+
isDesktop: ze
|
|
213
235
|
});
|
|
214
|
-
|
|
236
|
+
M(() => {
|
|
215
237
|
if (typeof document > "u") return;
|
|
216
238
|
let e = document.documentElement.style;
|
|
217
|
-
return e.setProperty(
|
|
218
|
-
e.removeProperty(
|
|
239
|
+
return e.setProperty(d, `${Ve}px`), () => {
|
|
240
|
+
e.removeProperty(d);
|
|
219
241
|
};
|
|
220
|
-
}, [
|
|
242
|
+
}, [Ve]), M(() => {
|
|
221
243
|
if (typeof document > "u") return;
|
|
222
244
|
let e = document.documentElement.style;
|
|
223
|
-
return e.setProperty(te, `${
|
|
245
|
+
return e.setProperty(te, `${He}px`), () => {
|
|
224
246
|
e.removeProperty(te);
|
|
225
247
|
};
|
|
226
|
-
}, [
|
|
227
|
-
let
|
|
228
|
-
isOpen:
|
|
229
|
-
open:
|
|
230
|
-
close:
|
|
231
|
-
toggle:
|
|
232
|
-
docked:
|
|
233
|
-
toggleDock:
|
|
234
|
-
dockWidthPx:
|
|
235
|
-
panelInsetPx:
|
|
248
|
+
}, [He]);
|
|
249
|
+
let Ue = xe(() => ({
|
|
250
|
+
isOpen: h,
|
|
251
|
+
open: Q,
|
|
252
|
+
close: Me,
|
|
253
|
+
toggle: Ne,
|
|
254
|
+
docked: H,
|
|
255
|
+
toggleDock: $,
|
|
256
|
+
dockWidthPx: Ve,
|
|
257
|
+
panelInsetPx: He,
|
|
236
258
|
keys: i,
|
|
237
|
-
registerCloseGuard:
|
|
259
|
+
registerCloseGuard: Y,
|
|
238
260
|
presentation: n,
|
|
239
|
-
surface:
|
|
240
|
-
minimized:
|
|
241
|
-
fullOpen:
|
|
242
|
-
openFull:
|
|
243
|
-
avatarSettingsRequest:
|
|
244
|
-
openWindow:
|
|
245
|
-
minimize:
|
|
246
|
-
expanded:
|
|
247
|
-
setExpanded:
|
|
248
|
-
windowView: o ?
|
|
249
|
-
setWindowView:
|
|
261
|
+
surface: v,
|
|
262
|
+
minimized: O,
|
|
263
|
+
fullOpen: q,
|
|
264
|
+
openFull: Ie,
|
|
265
|
+
avatarSettingsRequest: Pe,
|
|
266
|
+
openWindow: Le,
|
|
267
|
+
minimize: Re,
|
|
268
|
+
expanded: k,
|
|
269
|
+
setExpanded: be,
|
|
270
|
+
windowView: o ? Ce : null,
|
|
271
|
+
setWindowView: we,
|
|
272
|
+
...c ? {
|
|
273
|
+
registerPageHost: ie,
|
|
274
|
+
pageHosted: ae,
|
|
275
|
+
pagePanelRoot: c,
|
|
276
|
+
pageFocusRequest: ne
|
|
277
|
+
} : {}
|
|
250
278
|
}), [
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
Y,
|
|
257
|
-
ke,
|
|
279
|
+
h,
|
|
280
|
+
Q,
|
|
281
|
+
Me,
|
|
282
|
+
Ne,
|
|
283
|
+
H,
|
|
258
284
|
$,
|
|
285
|
+
Ve,
|
|
286
|
+
He,
|
|
259
287
|
i,
|
|
260
|
-
|
|
288
|
+
Y,
|
|
261
289
|
n,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
290
|
+
v,
|
|
291
|
+
O,
|
|
292
|
+
q,
|
|
293
|
+
Ie,
|
|
294
|
+
Pe,
|
|
295
|
+
Le,
|
|
296
|
+
Re,
|
|
297
|
+
k,
|
|
270
298
|
o,
|
|
271
|
-
|
|
272
|
-
|
|
299
|
+
Ce,
|
|
300
|
+
we,
|
|
301
|
+
c,
|
|
302
|
+
ie,
|
|
303
|
+
ae,
|
|
304
|
+
ne
|
|
273
305
|
]);
|
|
274
|
-
return /* @__PURE__ */
|
|
275
|
-
value:
|
|
276
|
-
children:
|
|
306
|
+
return /* @__PURE__ */ I(R.Provider, {
|
|
307
|
+
value: Ue,
|
|
308
|
+
children: ee
|
|
277
309
|
});
|
|
278
310
|
}
|
|
279
|
-
function
|
|
280
|
-
let { state: t, retry: n } =
|
|
281
|
-
if (t.status !== "ready") return /* @__PURE__ */
|
|
311
|
+
function Y(e) {
|
|
312
|
+
let { state: t, retry: n } = l();
|
|
313
|
+
if (t.status !== "ready") return /* @__PURE__ */ I(o, {
|
|
282
314
|
failed: t.status === "failed",
|
|
283
315
|
onRetry: n
|
|
284
316
|
});
|
|
285
317
|
let { AIAssistantPanel: r } = t.module;
|
|
286
|
-
return /* @__PURE__ */
|
|
318
|
+
return /* @__PURE__ */ I(r, { ...e });
|
|
287
319
|
}
|
|
288
|
-
var
|
|
320
|
+
var X = (e, t) => /* @__PURE__ */ I(Y, {
|
|
289
321
|
...e,
|
|
290
322
|
...t
|
|
291
323
|
});
|
|
292
|
-
function
|
|
293
|
-
let t =
|
|
294
|
-
return t ? /* @__PURE__ */
|
|
324
|
+
function Z(e) {
|
|
325
|
+
let t = z();
|
|
326
|
+
return t ? /* @__PURE__ */ I(Q, {
|
|
295
327
|
state: t,
|
|
296
328
|
...e
|
|
297
329
|
}) : null;
|
|
298
330
|
}
|
|
299
|
-
function Q({ state: e, panelId:
|
|
300
|
-
let {
|
|
301
|
-
|
|
302
|
-
product:
|
|
331
|
+
function Q({ state: e, panelId: o = "ai-assistant", panelProps: l, renderPanel: u, navigate: d, isShellLessTarget: f, topOffsetPx: te = 56, launcherIcon: oe, launcherBottomInset: ce = "1.5rem", showLauncher: v = !0, closeOnEscape: de = !0, warmOnSignIn: fe = !0 }) {
|
|
332
|
+
let { close: pe, toggle: me, docked: he, toggleDock: ge, dockWidthPx: _e } = e, b = e.pagePanelRoot ?? null, x = b !== null && e.pageHosted === !0, S = e.isOpen && !x, ve = be()?.product ?? "";
|
|
333
|
+
ye({
|
|
334
|
+
product: ve,
|
|
303
335
|
enabled: fe,
|
|
304
|
-
panelOpen:
|
|
336
|
+
panelOpen: S || x
|
|
305
337
|
});
|
|
306
|
-
let
|
|
307
|
-
r(
|
|
308
|
-
let [
|
|
309
|
-
|
|
310
|
-
z !== 0 &&
|
|
311
|
-
}, [z,
|
|
312
|
-
let
|
|
313
|
-
|
|
314
|
-
if (
|
|
315
|
-
}, [
|
|
316
|
-
|
|
317
|
-
}, [
|
|
318
|
-
let
|
|
319
|
-
|
|
320
|
-
|
|
338
|
+
let C = e.presentation === "compact", { surface: w, minimized: T, setExpanded: E } = e, D = t();
|
|
339
|
+
r(l?.serverHistory === !0);
|
|
340
|
+
let [k, j] = P(!1), F = N(null), Te = N(null), R = Oe(), [z, Ee] = P(0), [De, B] = P(0), V = c();
|
|
341
|
+
M(() => {
|
|
342
|
+
z !== 0 && F.current?.querySelector("[data-testid=\"assistant-input\"]")?.focus({ preventScroll: !0 });
|
|
343
|
+
}, [z, V]);
|
|
344
|
+
let H = !u;
|
|
345
|
+
M(() => {
|
|
346
|
+
if (H) return s();
|
|
347
|
+
}, [H]), M(() => {
|
|
348
|
+
De !== 0 && F.current?.querySelector("[data-testid=\"assistant-window-language\"]")?.focus({ preventScroll: !0 });
|
|
349
|
+
}, [De, V]), i(F, C && S && !T && !R);
|
|
350
|
+
let ke = N(l?.onExpandedChange);
|
|
351
|
+
M(() => {
|
|
352
|
+
ke.current = l?.onExpandedChange;
|
|
321
353
|
});
|
|
322
|
-
let
|
|
323
|
-
|
|
324
|
-
}, [
|
|
325
|
-
navigate:
|
|
326
|
-
isShellLessTarget:
|
|
327
|
-
isDesktop:
|
|
328
|
-
collapseSheet: () =>
|
|
354
|
+
let Ae = A((e) => {
|
|
355
|
+
E(e), ke.current?.(e);
|
|
356
|
+
}, [E]), W = xe(() => d ? y({
|
|
357
|
+
navigate: d,
|
|
358
|
+
isShellLessTarget: f,
|
|
359
|
+
isDesktop: U,
|
|
360
|
+
collapseSheet: () => j(!1),
|
|
329
361
|
openInNewTab: (e) => window.open(e, "_blank", "noopener,noreferrer")
|
|
330
|
-
}) : void 0, [
|
|
331
|
-
|
|
332
|
-
if (!
|
|
362
|
+
}) : void 0, [d, f]), G = C && w === "window" ? e.minimize : pe;
|
|
363
|
+
M(() => {
|
|
364
|
+
if (!S || !de || T) return;
|
|
333
365
|
let e = (e) => {
|
|
334
366
|
se({
|
|
335
367
|
key: e.key,
|
|
336
|
-
isOpen:
|
|
368
|
+
isOpen: S,
|
|
337
369
|
alreadyHandled: e.defaultPrevented,
|
|
338
370
|
dialogOpen: document.querySelector("[role=\"dialog\"],[role=\"alertdialog\"],dialog[open]") !== null,
|
|
339
371
|
pressedInsideDialog: ue(e.target, "[role=\"dialog\"],[role=\"alertdialog\"],dialog[open]") !== null,
|
|
340
|
-
panelOwnsEscape:
|
|
341
|
-
}) === "close" && (e.preventDefault(),
|
|
372
|
+
panelOwnsEscape: a()
|
|
373
|
+
}) === "close" && (e.preventDefault(), G());
|
|
342
374
|
};
|
|
343
375
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
344
376
|
}, [
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
377
|
+
S,
|
|
378
|
+
T,
|
|
379
|
+
G,
|
|
348
380
|
de
|
|
349
381
|
]);
|
|
350
|
-
let
|
|
351
|
-
|
|
352
|
-
if (
|
|
382
|
+
let K = e.pageFocusRequest ?? null;
|
|
383
|
+
M(() => {
|
|
384
|
+
if (!x || !K || !b) return;
|
|
385
|
+
let e = document.activeElement;
|
|
386
|
+
if (!K.force && e && e !== document.body) return;
|
|
387
|
+
let t = b.querySelector("[data-testid=\"ai-assistant-panel\"]");
|
|
388
|
+
((U() ? b.querySelector("[data-testid=\"assistant-input\"]") : null) ?? t)?.focus({ preventScroll: !0 });
|
|
389
|
+
}, [
|
|
390
|
+
x,
|
|
391
|
+
K,
|
|
392
|
+
b,
|
|
393
|
+
V
|
|
394
|
+
]);
|
|
395
|
+
let q = A((e) => {
|
|
396
|
+
e && b && b.parentNode !== e && e.appendChild(b);
|
|
397
|
+
}, [b]), je = N(T);
|
|
398
|
+
M(() => {
|
|
399
|
+
if (C && T && !je.current) {
|
|
353
400
|
let e = document.activeElement;
|
|
354
|
-
(!e || e === document.body ||
|
|
401
|
+
(!e || e === document.body || F.current?.contains(e)) && Te.current?.focus({ preventScroll: !0 });
|
|
355
402
|
}
|
|
356
|
-
|
|
357
|
-
}, [
|
|
358
|
-
let
|
|
359
|
-
panelId:
|
|
360
|
-
visible: !
|
|
403
|
+
je.current = T;
|
|
404
|
+
}, [C, T]);
|
|
405
|
+
let J = {
|
|
406
|
+
panelId: o,
|
|
407
|
+
visible: x || !T,
|
|
361
408
|
onClose: pe,
|
|
362
|
-
docked: x,
|
|
363
|
-
onToggleDock:
|
|
364
|
-
onNavigate:
|
|
365
|
-
isShellLessTarget:
|
|
366
|
-
...
|
|
409
|
+
docked: !x && he,
|
|
410
|
+
onToggleDock: ge,
|
|
411
|
+
onNavigate: W,
|
|
412
|
+
isShellLessTarget: f,
|
|
413
|
+
...C ? {
|
|
367
414
|
presentation: "compact",
|
|
368
|
-
surface:
|
|
415
|
+
surface: x ? "panel" : w,
|
|
369
416
|
onOpenFull: e.openFull,
|
|
370
417
|
avatarSettingsRequest: e.avatarSettingsRequest,
|
|
371
418
|
onMinimize: e.minimize,
|
|
372
|
-
onExpandedChange:
|
|
419
|
+
onExpandedChange: Ae,
|
|
373
420
|
windowView: e.windowView,
|
|
374
421
|
onWindowViewChange: e.setWindowView
|
|
375
|
-
} : {}
|
|
376
|
-
|
|
377
|
-
|
|
422
|
+
} : {},
|
|
423
|
+
...x ? { pageHosted: !0 } : {}
|
|
424
|
+
}, Y = C ? D("overlay.launcherQuick", "Open quick assistant") : D("overlay.launcher", "AI Assistant"), Z = {
|
|
425
|
+
[p]: `${te}px`,
|
|
378
426
|
[ne]: "var(--mobile-tabbar-height, 0px)"
|
|
379
|
-
},
|
|
380
|
-
...
|
|
381
|
-
[
|
|
382
|
-
},
|
|
383
|
-
isOpen:
|
|
384
|
-
surface:
|
|
385
|
-
minimized:
|
|
386
|
-
}) :
|
|
387
|
-
!
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
|
|
427
|
+
}, Q = {
|
|
428
|
+
...Z,
|
|
429
|
+
[re]: le(ce)
|
|
430
|
+
}, Me = C ? ie({
|
|
431
|
+
isOpen: S,
|
|
432
|
+
surface: w,
|
|
433
|
+
minimized: T
|
|
434
|
+
}) : S ? "desktop-only" : "always", Ne = (t) => {
|
|
435
|
+
!C || e.fullOpen ? me() : S && !T ? e.minimize() : (e.openWindow(), R || t.detail === 0 ? Ee((e) => e + 1) : B((e) => e + 1));
|
|
436
|
+
}, $ = (S || x) && /* @__PURE__ */ I(ee.Provider, {
|
|
437
|
+
value: e.registerCloseGuard ?? null,
|
|
438
|
+
children: u ? u(J) : X(l, J)
|
|
439
|
+
});
|
|
440
|
+
return /* @__PURE__ */ Ce(n, {
|
|
441
|
+
preview: l?.preview,
|
|
391
442
|
children: [
|
|
392
|
-
|
|
393
|
-
ref:
|
|
394
|
-
className:
|
|
395
|
-
surface:
|
|
396
|
-
minimized:
|
|
397
|
-
docked:
|
|
443
|
+
S && /* @__PURE__ */ Ce("div", {
|
|
444
|
+
ref: F,
|
|
445
|
+
className: C ? ae({
|
|
446
|
+
surface: w,
|
|
447
|
+
minimized: T,
|
|
448
|
+
docked: he,
|
|
398
449
|
expanded: e.expanded,
|
|
399
|
-
sheetExpanded:
|
|
450
|
+
sheetExpanded: k
|
|
400
451
|
}) : _({
|
|
401
|
-
expanded:
|
|
402
|
-
docked:
|
|
452
|
+
expanded: k,
|
|
453
|
+
docked: he
|
|
403
454
|
}),
|
|
404
|
-
style:
|
|
455
|
+
style: C ? Q : Z,
|
|
405
456
|
"data-testid": "assistant-overlay",
|
|
406
|
-
...
|
|
407
|
-
id:
|
|
408
|
-
"data-surface":
|
|
409
|
-
...
|
|
457
|
+
...C ? {
|
|
458
|
+
id: o,
|
|
459
|
+
"data-surface": w,
|
|
460
|
+
...T ? {
|
|
410
461
|
hidden: !0,
|
|
411
462
|
inert: !0,
|
|
412
463
|
"data-minimized": ""
|
|
413
464
|
} : {}
|
|
414
465
|
} : {},
|
|
415
|
-
children: [/* @__PURE__ */
|
|
466
|
+
children: [/* @__PURE__ */ I("button", {
|
|
416
467
|
type: "button",
|
|
417
|
-
onClick: () =>
|
|
468
|
+
onClick: () => j((e) => !e),
|
|
418
469
|
className: "flex w-full shrink-0 justify-center pt-2 pb-1 sm:hidden",
|
|
419
|
-
"aria-label":
|
|
420
|
-
"aria-expanded":
|
|
470
|
+
"aria-label": k ? D("sheet.collapse", "Shrink the assistant") : D("sheet.expand", "Expand the assistant"),
|
|
471
|
+
"aria-expanded": k,
|
|
421
472
|
"data-testid": "assistant-sheet-handle",
|
|
422
|
-
children: /* @__PURE__ */
|
|
423
|
-
}), /* @__PURE__ */
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
473
|
+
children: /* @__PURE__ */ I("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
|
|
474
|
+
}), b ? /* @__PURE__ */ I("div", {
|
|
475
|
+
ref: q,
|
|
476
|
+
className: L
|
|
477
|
+
}) : /* @__PURE__ */ I("div", {
|
|
478
|
+
className: L,
|
|
479
|
+
children: $
|
|
429
480
|
})]
|
|
430
481
|
}),
|
|
431
|
-
|
|
432
|
-
|
|
482
|
+
b && $ && we($, b),
|
|
483
|
+
v && !x && /* @__PURE__ */ I("button", {
|
|
484
|
+
ref: Te,
|
|
433
485
|
type: "button",
|
|
434
|
-
onClick:
|
|
435
|
-
title:
|
|
436
|
-
"aria-label":
|
|
437
|
-
"aria-haspopup":
|
|
438
|
-
"aria-expanded":
|
|
439
|
-
...
|
|
486
|
+
onClick: Ne,
|
|
487
|
+
title: C ? Y : D("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
|
|
488
|
+
"aria-label": Y,
|
|
489
|
+
"aria-haspopup": C ? void 0 : "dialog",
|
|
490
|
+
"aria-expanded": C ? S && !T : S,
|
|
491
|
+
...C && S ? { "aria-controls": o } : {},
|
|
440
492
|
"data-testid": "assistant-fab",
|
|
441
493
|
style: {
|
|
442
|
-
bottom:
|
|
443
|
-
right:
|
|
494
|
+
bottom: C ? m(ce) : h(ce),
|
|
495
|
+
right: g(_e)
|
|
444
496
|
},
|
|
445
|
-
className: "fixed z-30 size-14 items-center justify-center rounded-full border border-border-strong bg-[var(--color-accent-soft)] text-action-primary-bg shadow-float transition-colors duration-200 hover:border-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] cursor-pointer " + (
|
|
446
|
-
children:
|
|
497
|
+
className: "fixed z-30 size-14 items-center justify-center rounded-full border border-border-strong bg-[var(--color-accent-soft)] text-action-primary-bg shadow-float transition-colors duration-200 hover:border-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] cursor-pointer " + (Me === "hidden" ? "hidden" : Me === "desktop-only" ? "hidden sm:inline-flex" : "inline-flex") + (C ? " max-[480px]:[--assistant-consent-clearance:var(--bf-consent-banner-offset,0px)]" : ""),
|
|
498
|
+
children: oe ?? /* @__PURE__ */ I(Se, {
|
|
447
499
|
className: "size-6",
|
|
448
500
|
"aria-hidden": "true"
|
|
449
501
|
})
|
|
450
502
|
}),
|
|
451
|
-
/* @__PURE__ */
|
|
503
|
+
/* @__PURE__ */ I(O, { onOpenAssistant: e.openFull })
|
|
452
504
|
]
|
|
453
505
|
});
|
|
454
506
|
}
|
|
455
|
-
export {
|
|
507
|
+
export { Z as AssistantOverlay, J as AssistantOverlayProvider, Ee as useAssistantDockWidth, z as useAssistantOverlayOrNull, De as useAssistantPanelInset, ke as useAssistantQuotaExhausted };
|