@burdenoff/fe-libs 2026.1113.9 → 2026.1113.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/shared/assistant/index.d.ts +4 -0
  2. package/dist/shared/assistant/ui/AIAssistantPanel.d.ts +7 -0
  3. package/dist/shared/assistant/ui/AIAssistantPanel.js +278 -250
  4. package/dist/shared/assistant/ui/AssistantChatArea.js +1243 -1241
  5. package/dist/shared/assistant/ui/AssistantConversationList.js +253 -252
  6. package/dist/shared/assistant/ui/AssistantHeader.d.ts +2 -1
  7. package/dist/shared/assistant/ui/AssistantHeader.js +1 -1
  8. package/dist/shared/assistant/ui/AssistantMessageList.js +48 -47
  9. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +46 -2
  10. package/dist/shared/assistant/ui/AssistantOverlay.js +359 -307
  11. package/dist/shared/assistant/ui/AssistantPageHost.d.ts +11 -0
  12. package/dist/shared/assistant/ui/AssistantPageHost.js +17 -0
  13. package/dist/shared/assistant/ui/assistantPageLayout.d.ts +13 -0
  14. package/dist/shared/assistant/ui/assistantPageLayout.js +8 -0
  15. package/dist/shared/assistant/ui/assistantPageSurface.d.ts +11 -0
  16. package/dist/shared/assistant/ui/assistantPageSurface.js +10 -0
  17. package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.d.ts +6 -0
  18. package/dist/shared/assistant/ui/avatar/AssistantCompactAvatar.js +77 -71
  19. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.d.ts +2 -1
  20. package/dist/shared/assistant/ui/compact/AssistantCompactHeader.js +2 -2
  21. package/dist/shared/assistant/ui/compact/AssistantMenuView.d.ts +5 -2
  22. package/dist/shared/assistant/ui/compact/AssistantMenuView.js +132 -131
  23. package/dist/shared/assistant/ui/compact/AssistantPageBar.d.ts +13 -0
  24. package/dist/shared/assistant/ui/compact/AssistantPageBar.js +46 -0
  25. package/dist/shared/assistant/ui/compact/AssistantViewSwitch.d.ts +5 -0
  26. package/dist/shared/assistant/ui/compact/AssistantViewSwitch.js +11 -11
  27. package/dist/shared/assistant/ui/composer/AssistantCompactFooter.js +15 -11
  28. package/dist/shared/assistant/ui/composer/AssistantComposer.js +258 -257
  29. package/dist/shared-assistant.js +71 -67
  30. 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 i } from "./closeGuard.js";
6
- import { useAssistantVisualViewport as a } from "./useAssistantVisualViewport.js";
7
- import { assistantPanelOwnsEscape as o } from "./panelOverlays.js";
8
- import { AssistantPanelPlaceholder as s } from "./AssistantPanelPlaceholder.js";
9
- import { scheduleAssistantPanelPreload as c, useAssistantPanelLoaded as l, useAssistantPanelModule as u } from "./assistantPanelLoader.js";
10
- import { ASSISTANT_COMPACT_DOCKED_DEFAULT_QUERY as d, ASSISTANT_DOCK_WIDTH_VAR as f, ASSISTANT_OVERLAY_DESKTOP_QUERY as p, ASSISTANT_OVERLAY_TOP_VAR as ee, ASSISTANT_PANEL_INSET_VAR as te, ASSISTANT_SHEET_BOTTOM_VAR as ne, ASSISTANT_WINDOW_BOTTOM_VAR as m, assistantCompactLauncherBottom as h, assistantCompactLauncherVisibility as re, assistantCompactOverlayClassName as ie, assistantCompactOverlayKeys as ae, assistantLauncherBottom as g, assistantLauncherRight as oe, assistantOverlayClassName as _, assistantOverlayEscapeAction as se, assistantOverlayKeys as v, assistantQuotaKindOf as ce, assistantWindowBottom as le, closestAround as ue, createAssistantNavigate as y, isAssistantSurface as de, isAssistantToggleShortcut as fe, nextAssistantOpenState as b, publishedAssistantDockWidth as pe, publishedAssistantPanelInset as me, publishedCompactDockWidth as x, publishedCompactPanelInset as he, readAssistantLayoutChoice as ge, readAssistantLegacyDockChoice as _e, readAssistantOverlayFlag as S, readAssistantWindowView as C, requestedAssistantOpenState as w, resolveCompactDocked as ve, writeAssistantLayoutChoice as T, writeAssistantOverlayFlag as E, writeAssistantWindowView as ye } from "./assistantOverlayState.js";
11
- import { AskAboutLayer as be } from "../askAbout/AskAboutLayer.js";
12
- import { useAssistantSignInWarm as xe } from "../useAssistantSignInWarm.js";
13
- import { useAssistantProductOrNull as D } from "../product.js";
14
- import { createContext as O, useCallback as k, useContext as A, useEffect as j, useMemo as M, useRef as N, useState as P, useSyncExternalStore as F } from "react";
15
- import { Sparkles as I } from "lucide-react";
16
- import { jsx as L, jsxs as R } from "react/jsx-runtime";
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 z = O(null);
19
- function B() {
20
- return A(z);
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
- function V() {
23
- return A(z)?.dockWidthPx ?? 0;
25
+ var R = k(null);
26
+ function z() {
27
+ return j(R);
24
28
  }
25
- function H() {
26
- return A(z)?.panelInsetPx ?? 0;
29
+ function Ee() {
30
+ return j(R)?.dockWidthPx ?? 0;
27
31
  }
28
- var U = () => typeof window > "u" ? void 0 : window.sessionStorage, W = () => typeof window > "u" ? void 0 : window.localStorage;
29
- function G(e) {
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(p);
38
+ let t = window.matchMedia(f);
32
39
  return t.addEventListener("change", e), () => t.removeEventListener("change", e);
33
40
  }
34
- function K() {
41
+ function U() {
35
42
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 640px)").matches;
36
43
  }
37
- function Se() {
38
- return F(G, K, () => !1);
44
+ function Oe() {
45
+ return F(H, U, () => !1);
39
46
  }
40
- function Ce(t, n) {
47
+ function ke(t, n) {
41
48
  let r = N(n);
42
- j(() => {
49
+ M(() => {
43
50
  r.current = n;
44
- }, [n]), j(() => {
51
+ }, [n]), M(() => {
45
52
  if (!t || typeof window > "u") return;
46
- let n = e(t), i = (e) => r.current(ce(e), e);
47
- return window.addEventListener(n, i), () => window.removeEventListener(n, i);
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 we = () => {};
51
- function q(e) {
57
+ var Ae = () => {};
58
+ function W(e) {
52
59
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
53
- let t = window.matchMedia(d);
60
+ let t = window.matchMedia(u);
54
61
  return t.addEventListener("change", e), () => t.removeEventListener("change", e);
55
62
  }
56
- function J() {
63
+ function G() {
57
64
  return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(min-width: 1280px)").matches;
58
65
  }
59
- var Y = () => () => {}, X = () => !1;
60
- function Te(e) {
61
- return F(e ? q : Y, e ? J : X, X);
66
+ var K = () => () => {}, q = () => !1;
67
+ function je(e) {
68
+ return F(e ? W : K, e ? G : q, q);
62
69
  }
63
- function Ee({ keyPrefix: e, quota: t, presentation: n = "classic", children: r }) {
64
- let i = M(() => v(e), [e]), a = M(() => ae(e), [e]), o = n === "compact", s = N(o);
65
- j(() => {
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, l] = P(() => S(U, i.openStorageKey)), [u, d] = P(() => S(W, i.dockStorageKey)), [p, ee] = P(() => {
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 = U()?.getItem(a.surfaceStorageKey);
87
+ let e = B()?.getItem(a.surfaceStorageKey);
72
88
  return de(e) ? e : "panel";
73
89
  } catch {
74
90
  return "panel";
75
91
  }
76
- }), [ne, m] = P(() => o && S(U, a.minimizedStorageKey)), h = o && c && p === "window" && ne, [re, ie] = P(!1), g = o && c && p === "panel" && re, [oe] = P(() => o ? C(W, a.windowViewStorageKey) : null), [_, se] = P(null), ce = _ ?? oe, le = k((e) => {
77
- s.current && se(e);
78
- }, []), [ue] = P(() => o ? {
79
- explicit: ge(W, a.layoutStorageKey),
80
- legacy: _e(W, i.dockStorageKey)
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
- }), [y, be] = P(null), xe = Te(o), D = o ? ve({
85
- explicit: y ?? ue.explicit,
86
- legacy: ue.legacy,
87
- wideViewport: xe
88
- }) : u, O = N(D);
89
- j(() => {
90
- O.current = D;
91
- }, [D]);
92
- let A = N(null), F = N(c);
93
- j(() => {
94
- F.current = c;
95
- }, [c]);
96
- let I = N(!1), R = c && (!o || p === "panel" && !h);
97
- j(() => {
98
- I.current = R;
99
- }, [R]);
100
- let B = k(() => {
101
- let e = A.current?.() === !0;
102
- return e && s.current && m(!1), e;
103
- }, []), V = k((e) => (A.current = e, () => {
104
- A.current === e && (A.current = null);
105
- }), []), H = k(() => {
106
- l(!0), ee("panel"), m(!1);
107
- }, []), G = k(() => {
108
- l(!1), m(!1), ie(!1), Ee(0);
109
- }, []), K = k(() => {
110
- s.current ? H() : l(!0);
111
- }, [H]), q = k(() => {
112
- B() || (s.current ? G() : l(!1));
113
- }, [B, G]), J = k(() => {
114
- if (s.current) {
115
- if (I.current) {
116
- if (B()) return;
117
- G();
118
- } else H();
119
- } else F.current && B() || l((e) => !e);
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
- B,
122
- G,
123
- H
124
- ]), Y = k(() => {
125
- if (s.current) {
126
- let e = O.current ? "floating" : "docked";
127
- O.current = e === "docked", be(e);
128
- } else d((e) => !e);
129
- }, []), [X, Ee] = P(0), Z = k((e) => {
130
- K(), s.current && e?.menu === "settings/avatar" && Ee((e) => e + 1);
131
- }, [K]), De = k(() => {
132
- s.current ? I.current || (l(!0), ee("window"), m(!1)) : l(!0);
133
- }, []), Oe = k(() => {
134
- s.current && F.current && !I.current && m(!0);
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
- j(() => {
137
- E(U, i.openStorageKey, c);
138
- }, [i.openStorageKey, c]), j(() => {
139
- o || E(W, i.dockStorageKey, u);
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
- u
144
- ]), j(() => {
145
- o && y !== null && T(W, a.layoutStorageKey, y);
163
+ _
164
+ ]), M(() => {
165
+ o && z !== null && T(V, a.layoutStorageKey, z);
146
166
  }, [
147
167
  o,
148
168
  a.layoutStorageKey,
149
- y
150
- ]), j(() => {
151
- o && _ !== null && ye(W, a.windowViewStorageKey, _);
169
+ z
170
+ ]), M(() => {
171
+ o && F !== null && D(V, a.windowViewStorageKey, F);
152
172
  }, [
153
173
  o,
154
174
  a.windowViewStorageKey,
155
- _
156
- ]), j(() => {
175
+ F
176
+ ]), M(() => {
157
177
  if (o) try {
158
- U()?.setItem(a.surfaceStorageKey, p);
178
+ B()?.setItem(a.surfaceStorageKey, v);
159
179
  } catch {}
160
180
  }, [
161
181
  o,
162
182
  a.surfaceStorageKey,
163
- p
164
- ]), j(() => {
165
- o && E(U, a.minimizedStorageKey, h);
183
+ v
184
+ ]), M(() => {
185
+ o && E(B, a.minimizedStorageKey, O);
166
186
  }, [
167
187
  o,
168
188
  a.minimizedStorageKey,
169
- h
170
- ]), j(() => {
189
+ O
190
+ ]), M(() => {
171
191
  if (typeof window > "u") return;
172
192
  let e = (e) => {
173
- let t = w(e);
174
- s.current ? t === !0 ? H() : t === !1 ? F.current && !B() && G() : I.current ? B() || G() : H() : (!F.current || b(!0, t) || A.current?.() !== !0) && l((e) => b(e, t));
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
- H,
180
- G,
181
- B
182
- ]), j(() => {
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 ? I.current ? B() || G() : H() : F.current && A.current?.() === !0 || l((e) => !e));
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
- H,
190
- G,
191
- B
192
- ]), Ce(t?.product ?? null, t?.onExhausted ?? we);
193
- let Q = Se(), ke = o ? x({
194
- isOpen: c,
195
- docked: D,
196
- isDesktop: Q,
197
- surface: p,
198
- expanded: g
199
- }) : pe({
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: c,
211
- docked: u,
212
- isDesktop: Q
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
- j(() => {
236
+ M(() => {
215
237
  if (typeof document > "u") return;
216
238
  let e = document.documentElement.style;
217
- return e.setProperty(f, `${ke}px`), () => {
218
- e.removeProperty(f);
239
+ return e.setProperty(d, `${Ve}px`), () => {
240
+ e.removeProperty(d);
219
241
  };
220
- }, [ke]), j(() => {
242
+ }, [Ve]), M(() => {
221
243
  if (typeof document > "u") return;
222
244
  let e = document.documentElement.style;
223
- return e.setProperty(te, `${$}px`), () => {
245
+ return e.setProperty(te, `${He}px`), () => {
224
246
  e.removeProperty(te);
225
247
  };
226
- }, [$]);
227
- let Ae = M(() => ({
228
- isOpen: c,
229
- open: K,
230
- close: q,
231
- toggle: J,
232
- docked: D,
233
- toggleDock: Y,
234
- dockWidthPx: ke,
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: V,
259
+ registerCloseGuard: Y,
238
260
  presentation: n,
239
- surface: p,
240
- minimized: h,
241
- fullOpen: R,
242
- openFull: Z,
243
- avatarSettingsRequest: X,
244
- openWindow: De,
245
- minimize: Oe,
246
- expanded: g,
247
- setExpanded: ie,
248
- windowView: o ? ce : null,
249
- setWindowView: le
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
- c,
252
- K,
253
- q,
254
- J,
255
- D,
256
- Y,
257
- ke,
279
+ h,
280
+ Q,
281
+ Me,
282
+ Ne,
283
+ H,
258
284
  $,
285
+ Ve,
286
+ He,
259
287
  i,
260
- V,
288
+ Y,
261
289
  n,
262
- p,
263
- h,
264
- R,
265
- Z,
266
- X,
267
- De,
268
- Oe,
269
- g,
290
+ v,
291
+ O,
292
+ q,
293
+ Ie,
294
+ Pe,
295
+ Le,
296
+ Re,
297
+ k,
270
298
  o,
271
- ce,
272
- le
299
+ Ce,
300
+ we,
301
+ c,
302
+ ie,
303
+ ae,
304
+ ne
273
305
  ]);
274
- return /* @__PURE__ */ L(z.Provider, {
275
- value: Ae,
276
- children: r
306
+ return /* @__PURE__ */ I(R.Provider, {
307
+ value: Ue,
308
+ children: ee
277
309
  });
278
310
  }
279
- function Z(e) {
280
- let { state: t, retry: n } = u();
281
- if (t.status !== "ready") return /* @__PURE__ */ L(s, {
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__ */ L(r, { ...e });
318
+ return /* @__PURE__ */ I(r, { ...e });
287
319
  }
288
- var De = (e, t) => /* @__PURE__ */ L(Z, {
320
+ var X = (e, t) => /* @__PURE__ */ I(Y, {
289
321
  ...e,
290
322
  ...t
291
323
  });
292
- function Oe(e) {
293
- let t = B();
294
- return t ? /* @__PURE__ */ L(Q, {
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: s = "ai-assistant", panelProps: u, renderPanel: d, navigate: f, isShellLessTarget: p, topOffsetPx: te = 56, launcherIcon: ae, launcherBottomInset: v = "1.5rem", showLauncher: ce = !0, closeOnEscape: de = !0, warmOnSignIn: fe = !0 }) {
300
- let { isOpen: b, close: pe, toggle: me, docked: x, toggleDock: he, dockWidthPx: ge } = e, _e = D()?.product ?? "";
301
- xe({
302
- product: _e,
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: b
336
+ panelOpen: S || x
305
337
  });
306
- let S = e.presentation === "compact", { surface: C, minimized: w, setExpanded: ve } = e, T = t();
307
- r(u?.serverHistory === !0);
308
- let [E, ye] = P(!1), O = N(null), A = N(null), F = Se(), [z, B] = P(0), [V, H] = P(0), U = l();
309
- j(() => {
310
- z !== 0 && O.current?.querySelector("[data-testid=\"assistant-input\"]")?.focus({ preventScroll: !0 });
311
- }, [z, U]);
312
- let W = !d;
313
- j(() => {
314
- if (W) return c();
315
- }, [W]), j(() => {
316
- V !== 0 && O.current?.querySelector("[data-testid=\"assistant-window-language\"]")?.focus({ preventScroll: !0 });
317
- }, [V, U]), a(O, S && b && !w && !F);
318
- let G = N(u?.onExpandedChange);
319
- j(() => {
320
- G.current = u?.onExpandedChange;
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 Ce = k((e) => {
323
- ve(e), G.current?.(e);
324
- }, [ve]), we = M(() => f ? y({
325
- navigate: f,
326
- isShellLessTarget: p,
327
- isDesktop: K,
328
- collapseSheet: () => ye(!1),
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, [f, p]), q = S && C === "window" ? e.minimize : pe;
331
- j(() => {
332
- if (!b || !de || w) return;
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: b,
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: o()
341
- }) === "close" && (e.preventDefault(), q());
372
+ panelOwnsEscape: a()
373
+ }) === "close" && (e.preventDefault(), G());
342
374
  };
343
375
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
344
376
  }, [
345
- b,
346
- w,
347
- q,
377
+ S,
378
+ T,
379
+ G,
348
380
  de
349
381
  ]);
350
- let J = N(w);
351
- j(() => {
352
- if (S && w && !J.current) {
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 || O.current?.contains(e)) && A.current?.focus({ preventScroll: !0 });
401
+ (!e || e === document.body || F.current?.contains(e)) && Te.current?.focus({ preventScroll: !0 });
355
402
  }
356
- J.current = w;
357
- }, [S, w]);
358
- let Y = {
359
- panelId: s,
360
- visible: !w,
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: he,
364
- onNavigate: we,
365
- isShellLessTarget: p,
366
- ...S ? {
409
+ docked: !x && he,
410
+ onToggleDock: ge,
411
+ onNavigate: W,
412
+ isShellLessTarget: f,
413
+ ...C ? {
367
414
  presentation: "compact",
368
- surface: C,
415
+ surface: x ? "panel" : w,
369
416
  onOpenFull: e.openFull,
370
417
  avatarSettingsRequest: e.avatarSettingsRequest,
371
418
  onMinimize: e.minimize,
372
- onExpandedChange: Ce,
419
+ onExpandedChange: Ae,
373
420
  windowView: e.windowView,
374
421
  onWindowViewChange: e.setWindowView
375
- } : {}
376
- }, X = S ? T("overlay.launcherQuick", "Open quick assistant") : T("overlay.launcher", "AI Assistant"), Te = {
377
- [ee]: `${te}px`,
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
- }, Ee = {
380
- ...Te,
381
- [m]: le(v)
382
- }, Z = S ? re({
383
- isOpen: b,
384
- surface: C,
385
- minimized: w
386
- }) : b ? "desktop-only" : "always", Oe = (t) => {
387
- !S || e.fullOpen ? me() : b && !w ? e.minimize() : (e.openWindow(), F || t.detail === 0 ? B((e) => e + 1) : H((e) => e + 1));
388
- };
389
- return /* @__PURE__ */ R(n, {
390
- preview: u?.preview,
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
- b && /* @__PURE__ */ R("div", {
393
- ref: O,
394
- className: S ? ie({
395
- surface: C,
396
- minimized: w,
397
- docked: x,
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: E
450
+ sheetExpanded: k
400
451
  }) : _({
401
- expanded: E,
402
- docked: x
452
+ expanded: k,
453
+ docked: he
403
454
  }),
404
- style: S ? Ee : Te,
455
+ style: C ? Q : Z,
405
456
  "data-testid": "assistant-overlay",
406
- ...S ? {
407
- id: s,
408
- "data-surface": C,
409
- ...w ? {
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__ */ L("button", {
466
+ children: [/* @__PURE__ */ I("button", {
416
467
  type: "button",
417
- onClick: () => ye((e) => !e),
468
+ onClick: () => j((e) => !e),
418
469
  className: "flex w-full shrink-0 justify-center pt-2 pb-1 sm:hidden",
419
- "aria-label": E ? T("sheet.collapse", "Shrink the assistant") : T("sheet.expand", "Expand the assistant"),
420
- "aria-expanded": E,
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__ */ L("span", { className: "h-1.5 w-10 rounded-full bg-border-strong" })
423
- }), /* @__PURE__ */ L("div", {
424
- className: "flex min-h-0 flex-1 flex-col",
425
- children: /* @__PURE__ */ L(i.Provider, {
426
- value: e.registerCloseGuard ?? null,
427
- children: d ? d(Y) : De(u, Y)
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
- ce && /* @__PURE__ */ L("button", {
432
- ref: A,
482
+ b && $ && we($, b),
483
+ v && !x && /* @__PURE__ */ I("button", {
484
+ ref: Te,
433
485
  type: "button",
434
- onClick: Oe,
435
- title: S ? X : T("overlay.launcherTitle", "AI Assistant ({{shortcut}})", { shortcut: "Ctrl+Shift+A" }),
436
- "aria-label": X,
437
- "aria-haspopup": S ? void 0 : "dialog",
438
- "aria-expanded": S ? b && !w : b,
439
- ...S && b ? { "aria-controls": s } : {},
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: S ? h(v) : g(v),
443
- right: oe(ge)
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 " + (Z === "hidden" ? "hidden" : Z === "desktop-only" ? "hidden sm:inline-flex" : "inline-flex") + (S ? " max-[480px]:[--assistant-consent-clearance:var(--bf-consent-banner-offset,0px)]" : ""),
446
- children: ae ?? /* @__PURE__ */ L(I, {
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__ */ L(be, { onOpenAssistant: e.openFull })
503
+ /* @__PURE__ */ I(O, { onOpenAssistant: e.openFull })
452
504
  ]
453
505
  });
454
506
  }
455
- export { Oe as AssistantOverlay, Ee as AssistantOverlayProvider, V as useAssistantDockWidth, B as useAssistantOverlayOrNull, H as useAssistantPanelInset, Ce as useAssistantQuotaExhausted };
507
+ export { Z as AssistantOverlay, J as AssistantOverlayProvider, Ee as useAssistantDockWidth, z as useAssistantOverlayOrNull, De as useAssistantPanelInset, ke as useAssistantQuotaExhausted };