@burdenoff/fe-libs 2026.1029.10 → 2026.1030.1

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