@trinityui/design-system 1.0.0

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/ai.js ADDED
@@ -0,0 +1,4466 @@
1
+ import { jsxs as l, jsx as e, Fragment as G } from "react/jsx-runtime";
2
+ import { Button as Ce, Box as d, Popover as Ye, Avatar as we, Stack as C, Typography as u, Divider as ue, Paper as Y, Tooltip as P, IconButton as z, TextField as Se, Chip as te, Menu as ye, MenuItem as Z, ListItemIcon as N, ListItemText as K, Switch as Je, Link as Ge, Collapse as J, useTheme as ee, alpha as ce, Card as er, List as _e, ListItem as qe, ListItemButton as Ne, ButtonBase as $e, AppBar as rr, Toolbar as or, Drawer as ir } from "@mui/material";
3
+ import Ae, { useState as R, createContext as nr, useContext as tr, useEffect as We, useRef as ve, useCallback as Q } from "react";
4
+ import { b as T, a as Pe, s as X } from "./navigation.js";
5
+ import ar from "@mui/icons-material/Home";
6
+ import lr from "@mui/icons-material/Menu";
7
+ import sr from "@mui/icons-material/Close";
8
+ import cr from "@mui/icons-material/ArrowBack";
9
+ import dr from "@mui/icons-material/ArrowForward";
10
+ import mr from "@mui/icons-material/ArrowUpward";
11
+ import pr from "@mui/icons-material/ArrowDownward";
12
+ import hr from "@mui/icons-material/ChevronLeft";
13
+ import ur from "@mui/icons-material/ChevronRight";
14
+ import xr from "@mui/icons-material/ExpandLess";
15
+ import gr from "@mui/icons-material/ExpandMore";
16
+ import fr from "@mui/icons-material/MoreVert";
17
+ import br from "@mui/icons-material/MoreHoriz";
18
+ import yr from "@mui/icons-material/Add";
19
+ import vr from "@mui/icons-material/Remove";
20
+ import kr from "@mui/icons-material/Edit";
21
+ import Cr from "@mui/icons-material/Delete";
22
+ import wr from "@mui/icons-material/Save";
23
+ import Sr from "@mui/icons-material/ContentCopy";
24
+ import zr from "@mui/icons-material/ContentPaste";
25
+ import Ir from "@mui/icons-material/ContentCut";
26
+ import $r from "@mui/icons-material/Undo";
27
+ import Ar from "@mui/icons-material/Redo";
28
+ import Wr from "@mui/icons-material/Refresh";
29
+ import Pr from "@mui/icons-material/Download";
30
+ import Rr from "@mui/icons-material/Upload";
31
+ import Fr from "@mui/icons-material/Share";
32
+ import Mr from "@mui/icons-material/Print";
33
+ import Tr from "@mui/icons-material/FilterList";
34
+ import Br from "@mui/icons-material/Sort";
35
+ import Dr from "@mui/icons-material/Search";
36
+ import Lr from "@mui/icons-material/ZoomIn";
37
+ import Er from "@mui/icons-material/ZoomOut";
38
+ import Hr from "@mui/icons-material/Check";
39
+ import Re from "@mui/icons-material/CheckCircle";
40
+ import Or from "@mui/icons-material/Error";
41
+ import jr from "@mui/icons-material/Warning";
42
+ import Ur from "@mui/icons-material/Info";
43
+ import Vr from "@mui/icons-material/Help";
44
+ import Gr from "@mui/icons-material/Email";
45
+ import _r from "@mui/icons-material/Phone";
46
+ import qr from "@mui/icons-material/Chat";
47
+ import Nr from "@mui/icons-material/Send";
48
+ import Kr from "@mui/icons-material/Mic";
49
+ import Qr from "@mui/icons-material/Memory";
50
+ import Zr from "@mui/icons-material/LightbulbOutlined";
51
+ import Xr from "@mui/icons-material/Notifications";
52
+ import Yr from "@mui/icons-material/NotificationsOff";
53
+ import Jr from "@mui/icons-material/InsertDriveFile";
54
+ import eo from "@mui/icons-material/Folder";
55
+ import ro from "@mui/icons-material/FolderOpen";
56
+ import oo from "@mui/icons-material/Image";
57
+ import io from "@mui/icons-material/VideoLibrary";
58
+ import no from "@mui/icons-material/Audiotrack";
59
+ import to from "@mui/icons-material/Description";
60
+ import ao from "@mui/icons-material/Link";
61
+ import Fe from "@mui/icons-material/AttachFile";
62
+ import lo from "@mui/icons-material/Person";
63
+ import so from "@mui/icons-material/Group";
64
+ import co from "@mui/icons-material/PersonAdd";
65
+ import mo from "@mui/icons-material/PersonRemove";
66
+ import po from "@mui/icons-material/Settings";
67
+ import ho from "@mui/icons-material/Logout";
68
+ import uo from "@mui/icons-material/Login";
69
+ import xo from "@mui/icons-material/Lock";
70
+ import go from "@mui/icons-material/LockOpen";
71
+ import fo from "@mui/icons-material/Key";
72
+ import bo from "@mui/icons-material/BarChart";
73
+ import yo from "@mui/icons-material/PieChart";
74
+ import vo from "@mui/icons-material/ShowChart";
75
+ import ko from "@mui/icons-material/TrendingUp";
76
+ import Co from "@mui/icons-material/TrendingDown";
77
+ import wo from "@mui/icons-material/Storage";
78
+ import So from "@mui/icons-material/TableChart";
79
+ import zo from "@mui/icons-material/Star";
80
+ import Io from "@mui/icons-material/StarBorder";
81
+ import $o from "@mui/icons-material/Favorite";
82
+ import Ao from "@mui/icons-material/FavoriteBorder";
83
+ import Wo from "@mui/icons-material/Bookmark";
84
+ import Po from "@mui/icons-material/Flag";
85
+ import Ro from "@mui/icons-material/LocalOffer";
86
+ import Fo from "@mui/icons-material/CalendarToday";
87
+ import Mo from "@mui/icons-material/Schedule";
88
+ import To from "@mui/icons-material/LocationOn";
89
+ import Bo from "@mui/icons-material/Language";
90
+ import Do from "@mui/icons-material/Visibility";
91
+ import Lo from "@mui/icons-material/VisibilityOff";
92
+ import Eo from "@mui/icons-material/GridView";
93
+ import Ho from "@mui/icons-material/ViewList";
94
+ import Oo from "@mui/icons-material/ViewColumn";
95
+ import jo from "@mui/icons-material/Fullscreen";
96
+ import Uo from "@mui/icons-material/FullscreenExit";
97
+ import Vo from "@mui/icons-material/ViewSidebar";
98
+ import Go from "@mui/icons-material/PlayArrow";
99
+ import _o from "@mui/icons-material/Pause";
100
+ import qo from "@mui/icons-material/Stop";
101
+ import No from "@mui/icons-material/SkipNext";
102
+ import Ko from "@mui/icons-material/SkipPrevious";
103
+ import Qo from "@mui/icons-material/VolumeUp";
104
+ import Zo from "@mui/icons-material/VolumeOff";
105
+ import Xo from "@mui/icons-material/Code";
106
+ import Yo from "@mui/icons-material/Terminal";
107
+ import Jo from "@mui/icons-material/OpenInNew";
108
+ import ei from "@mui/icons-material/Cloud";
109
+ import ri from "@mui/icons-material/CloudUpload";
110
+ import oi from "@mui/icons-material/CloudDownload";
111
+ import ii from "@mui/icons-material/Wifi";
112
+ import ni from "@mui/icons-material/WifiOff";
113
+ import ti from "@mui/icons-material/Battery90";
114
+ import ai from "@mui/icons-material/PowerSettingsNew";
115
+ import li from "@mui/icons-material/LightMode";
116
+ import si from "@mui/icons-material/DarkMode";
117
+ import ci from "@mui/icons-material/FlashOn";
118
+ import di from "@mui/icons-material/CardGiftcard";
119
+ import mi from "@mui/icons-material/LocalShipping";
120
+ import pi from "@mui/icons-material/Inventory";
121
+ import hi from "@mui/icons-material/Layers";
122
+ import ui from "@mui/icons-material/Security";
123
+ import xi from "@mui/icons-material/EmojiEvents";
124
+ import gi from "@mui/icons-material/Timeline";
125
+ import fi from "@mui/icons-material/AutoAwesome";
126
+ import bi from "@mui/icons-material/ThumbUpOutlined";
127
+ import yi from "@mui/icons-material/ThumbDownOutlined";
128
+ import { ThumbsDown as vi, ThumbsUp as ki, Star as fe, Paperclip as Me, Zap as Te, Cpu as Ci, Mic as wi, Activity as Si, Award as zi, Shield as Ii, Layers as $i, Box as Ai, Package as Wi, Gift as Pi, Moon as Ri, Sun as Fi, Power as Mi, Battery as Ti, WifiOff as Bi, Wifi as Di, DownloadCloud as Li, UploadCloud as Ei, Cloud as Hi, ExternalLink as Oi, Terminal as ji, Code as Ui, VolumeX as Vi, Volume2 as Gi, SkipBack as _i, SkipForward as qi, Square as Ni, Pause as Ki, Play as Qi, Sidebar as Zi, Minimize as Xi, Maximize as Yi, Columns as Ji, List as en, Grid as Be, EyeOff as rn, Eye as on, Globe as nn, MapPin as tn, Clock as an, Calendar as ln, Tag as sn, Flag as cn, Bookmark as dn, Heart as De, Database as mn, TrendingDown as pn, TrendingUp as Le, PieChart as hn, BarChart2 as un, Key as xn, Unlock as gn, Lock as fn, LogIn as bn, LogOut as yn, Settings as vn, UserMinus as kn, UserPlus as Cn, Users as wn, User as Sn, Link as zn, FileText as In, Music as $n, Video as An, Image as Wn, FolderPlus as Pn, Folder as Rn, File as Fn, BellOff as Mn, Bell as Tn, Send as Bn, MessageSquare as Dn, Phone as Ln, Mail as En, CheckCircle as Ee, HelpCircle as Hn, Info as On, AlertTriangle as jn, AlertCircle as Un, Check as Vn, ZoomOut as Gn, ZoomIn as _n, Search as qn, ArrowUp as He, Filter as Nn, Printer as Kn, Share2 as Qn, Upload as Zn, Download as Xn, RefreshCw as Yn, RotateCw as Jn, RotateCcw as et, Scissors as rt, Clipboard as ot, Copy as it, Save as nt, Trash2 as tt, Edit2 as at, Minus as lt, Plus as st, MoreHorizontal as ct, MoreVertical as dt, ChevronDown as mt, ChevronUp as pt, ChevronRight as ht, ChevronLeft as ut, ArrowDown as xt, ArrowRight as gt, ArrowLeft as ft, X as bt, Menu as yt, Home as vt } from "react-feather";
129
+ const kt = {
130
+ /** Extra small radius for tags, badges - 4px */
131
+ xs: 1,
132
+ /** Small radius for chips, small buttons - 6px */
133
+ sm: 1.5,
134
+ /** Medium radius for inputs, small cards - 8px */
135
+ md: 2,
136
+ /** Large radius for cards, containers - 12px */
137
+ lg: 3,
138
+ /** Extra large radius for large cards, modals - 16px */
139
+ xl: 4,
140
+ /** Full pill shape - 9999px */
141
+ full: "9999px",
142
+ /** Circle shape */
143
+ circle: "50%"
144
+ }, v = {
145
+ /** Extra small radius - 4px */
146
+ xs: "4px",
147
+ /** Small radius - 6px */
148
+ sm: "6px",
149
+ /** Medium radius - 8px */
150
+ md: "8px",
151
+ /** Large radius - 12px */
152
+ lg: "12px",
153
+ /** Extra large radius - 16px */
154
+ xl: "16px",
155
+ /** Full pill shape */
156
+ full: "9999px",
157
+ /** Circle shape */
158
+ circle: "50%"
159
+ }, c = {
160
+ /** Tight spacing - 4px */
161
+ xs: 0.5,
162
+ /** Small spacing - 8px */
163
+ sm: 1,
164
+ /** Medium spacing - 12px */
165
+ md: 1.5,
166
+ /** Default spacing - 16px */
167
+ base: 2,
168
+ /** Large spacing - 24px */
169
+ lg: 3,
170
+ /** Extra large spacing - 32px */
171
+ xl: 4
172
+ }, h = {
173
+ // Gradient colors for AI presence - Coral to Purple (Trinity brand)
174
+ gradient: {
175
+ // Primary gradient: coral/pink at top to purple at bottom
176
+ primary: `linear-gradient(180deg, ${T.secondary.main} 0%, ${T.primary.light} 100%)`,
177
+ // Text gradient for large stats/numbers
178
+ text: `linear-gradient(180deg, ${T.secondary.main} 0%, ${T.primary.light} 100%)`,
179
+ // Subtle background gradient - soft indigo/purple tint
180
+ subtle: "linear-gradient(180deg, rgba(120, 65, 201, 0.03) 0%, rgba(120, 65, 201, 0.06) 100%)",
181
+ // Border gradient
182
+ border: `linear-gradient(180deg, ${T.secondary.main}, ${T.primary.light})`,
183
+ // Glow effect
184
+ glow: "0 0 20px rgba(255, 97, 80, 0.3), 0 0 40px rgba(120, 65, 201, 0.2)",
185
+ // Subtle glow for inputs
186
+ inputGlow: "0 0 0 3px rgba(120, 65, 201, 0.15)",
187
+ // Horizontal variant (left to right)
188
+ horizontal: `linear-gradient(90deg, ${T.secondary.main} 0%, ${T.primary.light} 100%)`,
189
+ // Diagonal variant (top-left to bottom-right)
190
+ diagonal: `linear-gradient(135deg, ${T.secondary.main} 0%, ${T.primary.light} 100%)`
191
+ },
192
+ // AI-specific colors
193
+ colors: {
194
+ aiPrimary: T.primary.light,
195
+ // Purple
196
+ aiSecondary: T.secondary.main,
197
+ // Coral
198
+ aiBackground: "rgba(120, 65, 201, 0.05)",
199
+ aiBackgroundDark: "rgba(120, 65, 201, 0.15)",
200
+ aiBorder: "rgba(120, 65, 201, 0.2)",
201
+ aiBorderDark: "rgba(120, 65, 201, 0.3)",
202
+ aiHover: Pe.colors.indigo[50],
203
+ // #EDE7FD
204
+ aiHoverDark: Pe.colors.indigo[100],
205
+ // #D2C3FA
206
+ aiGradientStart: T.secondary.main,
207
+ // Coral
208
+ aiGradientEnd: T.primary.light,
209
+ // Purple
210
+ // Source badge colors
211
+ sourceBadgeBg: "rgba(120, 65, 201, 0.15)",
212
+ sourceBadgeBgDark: "rgba(120, 65, 201, 0.25)",
213
+ // Typing indicator
214
+ typingDot: T.primary.light,
215
+ typingDotDark: T.secondary.main
216
+ },
217
+ // Standardized spacing and radius
218
+ radius: kt,
219
+ radiusPx: v,
220
+ spacing: c
221
+ }, Ct = {
222
+ mini: { size: 16, fontSize: X.typography.dense.badge, padding: "2px 4px" },
223
+ // 10px
224
+ "2xs": { size: 20, fontSize: "0.6875rem", padding: "2px 6px" },
225
+ // 11px - no exact token, retained
226
+ xs: { size: 24, fontSize: X.typography.dense.text, padding: "3px 8px" },
227
+ // 12px
228
+ sm: { size: 32, fontSize: "0.8125rem", padding: "4px 10px" },
229
+ // 13px - no exact token, retained
230
+ md: { size: 40, fontSize: "0.875rem", padding: "6px 12px" },
231
+ // 14px - body.small available but different intent
232
+ lg: { size: 48, fontSize: "1rem", padding: "8px 14px" },
233
+ xl: { size: 64, fontSize: "1.125rem", padding: "10px 16px" }
234
+ }, wt = ({ size: r = 16 }) => /* @__PURE__ */ e("svg", { width: r, height: r, viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z" }) }), St = ({
235
+ size: r = "sm",
236
+ variant: n = "default",
237
+ text: t = "AI",
238
+ showPopover: i = !0,
239
+ popoverContent: o,
240
+ clickable: a = !0,
241
+ onClick: m,
242
+ sx: s
243
+ }) => {
244
+ const [g, p] = R(null), x = Ct[r], k = ($) => {
245
+ i && p($.currentTarget), m?.();
246
+ }, b = () => {
247
+ p(null);
248
+ }, y = !!g, I = /* @__PURE__ */ l(
249
+ Ce,
250
+ {
251
+ onClick: a ? k : void 0,
252
+ disabled: !a,
253
+ disableRipple: !a,
254
+ sx: {
255
+ display: "inline-flex",
256
+ alignItems: "center",
257
+ justifyContent: "center",
258
+ gap: 0.5,
259
+ padding: n === "inline" ? "1px 6px" : x.padding,
260
+ borderRadius: n === "inline" ? "10px" : "100px",
261
+ background: h.gradient.primary,
262
+ color: "common.white",
263
+ // Use MUI theme
264
+ fontSize: x.fontSize,
265
+ fontWeight: 600,
266
+ fontFamily: '"Montserrat", sans-serif',
267
+ border: "none",
268
+ minWidth: "auto",
269
+ textTransform: "none",
270
+ cursor: a ? "pointer" : "default",
271
+ transition: "all 0.2s ease",
272
+ boxShadow: "0 2px 8px rgba(120, 65, 201, 0.3)",
273
+ ...a && {
274
+ "&:hover": {
275
+ boxShadow: h.gradient.glow,
276
+ transform: "scale(1.02)",
277
+ background: h.gradient.primary
278
+ },
279
+ "&:focus": {
280
+ outline: `2px solid ${h.colors.aiPrimary}`,
281
+ outlineOffset: 2
282
+ }
283
+ },
284
+ "&.Mui-disabled": {
285
+ background: h.gradient.primary,
286
+ color: "common.white",
287
+ opacity: 1
288
+ },
289
+ ...s
290
+ },
291
+ children: [
292
+ /* @__PURE__ */ e(
293
+ d,
294
+ {
295
+ component: "span",
296
+ sx: {
297
+ display: "flex",
298
+ alignItems: "center",
299
+ "& svg": {
300
+ width: n === "inline" ? 12 : x.size * 0.4,
301
+ height: n === "inline" ? 12 : x.size * 0.4
302
+ }
303
+ },
304
+ children: /* @__PURE__ */ e(wt, {})
305
+ }
306
+ ),
307
+ t
308
+ ]
309
+ }
310
+ );
311
+ return /* @__PURE__ */ l(G, { children: [
312
+ I,
313
+ i && o && /* @__PURE__ */ e(
314
+ Ye,
315
+ {
316
+ open: y,
317
+ anchorEl: g,
318
+ onClose: b,
319
+ anchorOrigin: {
320
+ vertical: "bottom",
321
+ horizontal: "center"
322
+ },
323
+ transformOrigin: {
324
+ vertical: "top",
325
+ horizontal: "center"
326
+ },
327
+ slotProps: {
328
+ paper: {
329
+ sx: {
330
+ mt: 1,
331
+ borderRadius: v.md,
332
+ boxShadow: "0 8px 32px rgba(0, 0, 0, 0.12)",
333
+ border: `1px solid ${h.colors.aiBorder}`,
334
+ background: `linear-gradient(180deg, ${h.colors.aiBackground} 0%, #FFFFFF 100%)`,
335
+ // @intentional-color: gradient to white
336
+ maxWidth: 360,
337
+ minWidth: 280
338
+ }
339
+ }
340
+ },
341
+ children: o
342
+ }
343
+ )
344
+ ] });
345
+ }, zt = {
346
+ xs: 16,
347
+ small: 20,
348
+ medium: 24,
349
+ large: 32,
350
+ xl: 48
351
+ }, Ke = {
352
+ home: ar,
353
+ menu: lr,
354
+ close: sr,
355
+ back: cr,
356
+ forward: dr,
357
+ up: mr,
358
+ down: pr,
359
+ "chevron-left": hr,
360
+ "chevron-right": ur,
361
+ "chevron-up": xr,
362
+ "chevron-down": gr,
363
+ "more-vertical": fr,
364
+ "more-horizontal": br,
365
+ add: yr,
366
+ remove: vr,
367
+ edit: kr,
368
+ delete: Cr,
369
+ save: wr,
370
+ copy: Sr,
371
+ paste: zr,
372
+ cut: Ir,
373
+ undo: $r,
374
+ redo: Ar,
375
+ refresh: Wr,
376
+ download: Pr,
377
+ upload: Rr,
378
+ share: Fr,
379
+ print: Mr,
380
+ filter: Tr,
381
+ sort: Br,
382
+ search: Dr,
383
+ "zoom-in": Lr,
384
+ "zoom-out": Er,
385
+ check: Hr,
386
+ "check-circle": Re,
387
+ error: Or,
388
+ warning: jr,
389
+ info: Ur,
390
+ help: Vr,
391
+ success: Re,
392
+ email: Gr,
393
+ phone: _r,
394
+ chat: qr,
395
+ send: Nr,
396
+ notification: Xr,
397
+ "notification-off": Yr,
398
+ file: Jr,
399
+ folder: eo,
400
+ "folder-open": ro,
401
+ image: oo,
402
+ video: io,
403
+ audio: no,
404
+ document: to,
405
+ link: ao,
406
+ attachment: Fe,
407
+ user: lo,
408
+ users: so,
409
+ "user-add": co,
410
+ "user-remove": mo,
411
+ settings: po,
412
+ logout: ho,
413
+ login: uo,
414
+ lock: xo,
415
+ unlock: go,
416
+ key: fo,
417
+ chart: bo,
418
+ "pie-chart": yo,
419
+ "line-chart": vo,
420
+ "trending-up": ko,
421
+ "trending-down": Co,
422
+ database: wo,
423
+ table: So,
424
+ star: zo,
425
+ "star-outline": Io,
426
+ heart: $o,
427
+ "heart-outline": Ao,
428
+ bookmark: Wo,
429
+ flag: Po,
430
+ tag: Ro,
431
+ calendar: Fo,
432
+ clock: Mo,
433
+ location: To,
434
+ globe: Bo,
435
+ eye: Do,
436
+ "eye-off": Lo,
437
+ grid: Eo,
438
+ list: Ho,
439
+ columns: Oo,
440
+ maximize: jo,
441
+ minimize: Uo,
442
+ sidebar: Vo,
443
+ play: Go,
444
+ pause: _o,
445
+ stop: qo,
446
+ "skip-forward": No,
447
+ "skip-back": Ko,
448
+ volume: Qo,
449
+ "volume-off": Zo,
450
+ code: Xo,
451
+ terminal: Yo,
452
+ "external-link": Jo,
453
+ cloud: ei,
454
+ "cloud-upload": ri,
455
+ "cloud-download": oi,
456
+ wifi: ii,
457
+ "wifi-off": ni,
458
+ battery: ti,
459
+ power: ai,
460
+ sun: li,
461
+ moon: si,
462
+ zap: ci,
463
+ gift: di,
464
+ package: mi,
465
+ box: pi,
466
+ layers: hi,
467
+ shield: ui,
468
+ award: xi,
469
+ activity: gi,
470
+ mic: Kr,
471
+ cpu: Qr,
472
+ lightbulb: Zr,
473
+ paperclip: Fe,
474
+ sparkles: fi,
475
+ "thumbs-up": bi,
476
+ "thumbs-down": yi
477
+ }, It = {
478
+ home: vt,
479
+ menu: yt,
480
+ close: bt,
481
+ back: ft,
482
+ forward: gt,
483
+ up: He,
484
+ down: xt,
485
+ "chevron-left": ut,
486
+ "chevron-right": ht,
487
+ "chevron-up": pt,
488
+ "chevron-down": mt,
489
+ "more-vertical": dt,
490
+ "more-horizontal": ct,
491
+ add: st,
492
+ remove: lt,
493
+ edit: at,
494
+ delete: tt,
495
+ save: nt,
496
+ copy: it,
497
+ paste: ot,
498
+ cut: rt,
499
+ undo: et,
500
+ redo: Jn,
501
+ refresh: Yn,
502
+ download: Xn,
503
+ upload: Zn,
504
+ share: Qn,
505
+ print: Kn,
506
+ filter: Nn,
507
+ sort: He,
508
+ // No direct equivalent, using ArrowUp
509
+ search: qn,
510
+ "zoom-in": _n,
511
+ "zoom-out": Gn,
512
+ check: Vn,
513
+ "check-circle": Ee,
514
+ error: Un,
515
+ warning: jn,
516
+ info: On,
517
+ help: Hn,
518
+ success: Ee,
519
+ email: En,
520
+ phone: Ln,
521
+ chat: Dn,
522
+ send: Bn,
523
+ notification: Tn,
524
+ "notification-off": Mn,
525
+ file: Fn,
526
+ folder: Rn,
527
+ "folder-open": Pn,
528
+ image: Wn,
529
+ video: An,
530
+ audio: $n,
531
+ document: In,
532
+ link: zn,
533
+ attachment: Me,
534
+ user: Sn,
535
+ users: wn,
536
+ "user-add": Cn,
537
+ "user-remove": kn,
538
+ settings: vn,
539
+ logout: yn,
540
+ login: bn,
541
+ lock: fn,
542
+ unlock: gn,
543
+ key: xn,
544
+ chart: un,
545
+ "pie-chart": hn,
546
+ "line-chart": Le,
547
+ "trending-up": Le,
548
+ "trending-down": pn,
549
+ database: mn,
550
+ table: Be,
551
+ star: fe,
552
+ "star-outline": fe,
553
+ heart: De,
554
+ "heart-outline": De,
555
+ bookmark: dn,
556
+ flag: cn,
557
+ tag: sn,
558
+ calendar: ln,
559
+ clock: an,
560
+ location: tn,
561
+ globe: nn,
562
+ eye: on,
563
+ "eye-off": rn,
564
+ grid: Be,
565
+ list: en,
566
+ columns: Ji,
567
+ maximize: Yi,
568
+ minimize: Xi,
569
+ sidebar: Zi,
570
+ play: Qi,
571
+ pause: Ki,
572
+ stop: Ni,
573
+ "skip-forward": qi,
574
+ "skip-back": _i,
575
+ volume: Gi,
576
+ "volume-off": Vi,
577
+ code: Ui,
578
+ terminal: ji,
579
+ "external-link": Oi,
580
+ cloud: Hi,
581
+ "cloud-upload": Ei,
582
+ "cloud-download": Li,
583
+ wifi: Di,
584
+ "wifi-off": Bi,
585
+ battery: Ti,
586
+ power: Mi,
587
+ sun: Fi,
588
+ moon: Ri,
589
+ zap: Te,
590
+ gift: Pi,
591
+ package: Wi,
592
+ box: Ai,
593
+ layers: $i,
594
+ shield: Ii,
595
+ award: zi,
596
+ activity: Si,
597
+ mic: wi,
598
+ cpu: Ci,
599
+ lightbulb: Te,
600
+ // Using Zap as lightbulb equivalent
601
+ paperclip: Me,
602
+ sparkles: fe,
603
+ // Using Star as sparkles equivalent
604
+ "thumbs-up": ki,
605
+ "thumbs-down": vi
606
+ };
607
+ Object.keys(Ke).reduce((r, n) => (r[n] = { material: n, feather: n }, r), {});
608
+ const Qe = nr(void 0), $t = () => {
609
+ const r = tr(Qe);
610
+ return r || {
611
+ library: "material",
612
+ setLibrary: () => console.warn("IconProvider not found. Wrap your app with <IconProvider>")
613
+ };
614
+ }, Ss = ({
615
+ children: r,
616
+ defaultLibrary: n = "material"
617
+ }) => {
618
+ const [t, i] = R(n);
619
+ return /* @__PURE__ */ e(Qe.Provider, { value: { library: t, setLibrary: i }, children: r });
620
+ }, f = ({
621
+ name: r,
622
+ size: n = "medium",
623
+ library: t,
624
+ color: i = "inherit",
625
+ sx: o,
626
+ className: a
627
+ }) => {
628
+ const { library: m } = $t(), s = t || m, g = zt[n], p = () => i === "inherit" ? "inherit" : i === "primary" ? "primary.main" : i === "secondary" ? "secondary.main" : i === "action" ? "action.active" : i === "disabled" ? "action.disabled" : i === "error" ? "error.main" : i;
629
+ if (s === "feather") {
630
+ const k = It[r];
631
+ if (!k)
632
+ return console.warn(`Feather icon "${r}" not found`), null;
633
+ const b = i === "inherit" ? "currentColor" : i.startsWith("#") || i.startsWith("rgb") ? i : void 0;
634
+ return /* @__PURE__ */ e(
635
+ d,
636
+ {
637
+ component: "span",
638
+ className: a,
639
+ sx: {
640
+ display: "inline-flex",
641
+ alignItems: "center",
642
+ justifyContent: "center",
643
+ width: g,
644
+ height: g,
645
+ color: b ? void 0 : p(),
646
+ ...o
647
+ },
648
+ children: /* @__PURE__ */ e(
649
+ k,
650
+ {
651
+ size: g,
652
+ color: b
653
+ }
654
+ )
655
+ }
656
+ );
657
+ }
658
+ const x = Ke[r];
659
+ return x ? /* @__PURE__ */ e(
660
+ x,
661
+ {
662
+ className: a,
663
+ sx: {
664
+ fontSize: g,
665
+ color: p(),
666
+ ...o
667
+ }
668
+ }
669
+ ) : (console.warn(`Material icon "${r}" not found`), null);
670
+ }, At = {
671
+ xs: 28,
672
+ small: 32,
673
+ medium: 40,
674
+ large: 56
675
+ }, de = ({
676
+ size: r = "medium",
677
+ animated: n = !1,
678
+ icon: t = "zap",
679
+ sx: i
680
+ }) => {
681
+ const o = At[r], a = r === "xs" ? v.md : "50%", m = r === "large" ? "medium" : "small";
682
+ return /* @__PURE__ */ e(
683
+ we,
684
+ {
685
+ sx: {
686
+ width: o,
687
+ height: o,
688
+ borderRadius: a,
689
+ background: h.gradient.primary,
690
+ boxShadow: n ? h.gradient.glow : "0 2px 8px rgba(120, 65, 201, 0.3)",
691
+ ...n && {
692
+ animation: "pulse 2s infinite",
693
+ "@keyframes pulse": {
694
+ "0%": { boxShadow: "0 0 0 0 rgba(120, 65, 201, 0.4)" },
695
+ "70%": { boxShadow: "0 0 0 10px transparent" },
696
+ "100%": { boxShadow: "0 0 0 0 transparent" }
697
+ }
698
+ },
699
+ ...i
700
+ },
701
+ children: /* @__PURE__ */ e(f, { name: t, size: m })
702
+ }
703
+ );
704
+ }, zs = ({
705
+ title: r = "AI-generated content",
706
+ description: n,
707
+ modelName: t,
708
+ confidence: i,
709
+ lastUpdated: o,
710
+ details: a,
711
+ actions: m,
712
+ sx: s
713
+ }) => /* @__PURE__ */ e(d, { sx: { p: 2, ...s }, children: /* @__PURE__ */ l(C, { spacing: 2, children: [
714
+ /* @__PURE__ */ l(d, { children: [
715
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 0.5 }, children: [
716
+ /* @__PURE__ */ e(St, { size: "2xs", clickable: !1, showPopover: !1 }),
717
+ /* @__PURE__ */ e(u, { variant: "subtitle2", fontWeight: 600, children: r })
718
+ ] }),
719
+ n && /* @__PURE__ */ e(u, { variant: "body2", color: "text.secondary", children: n })
720
+ ] }),
721
+ (t || i !== void 0 || o || a) && /* @__PURE__ */ l(d, { children: [
722
+ /* @__PURE__ */ e(ue, { sx: { my: 1 } }),
723
+ /* @__PURE__ */ l(C, { spacing: 1, children: [
724
+ t && /* @__PURE__ */ l(C, { direction: "row", justifyContent: "space-between", children: [
725
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: "Model" }),
726
+ /* @__PURE__ */ e(u, { variant: "caption", fontWeight: 500, children: t })
727
+ ] }),
728
+ i !== void 0 && /* @__PURE__ */ l(C, { direction: "row", justifyContent: "space-between", children: [
729
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: "Confidence" }),
730
+ /* @__PURE__ */ l(u, { variant: "caption", fontWeight: 500, children: [
731
+ i,
732
+ "%"
733
+ ] })
734
+ ] }),
735
+ o && /* @__PURE__ */ l(C, { direction: "row", justifyContent: "space-between", children: [
736
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: "Last updated" }),
737
+ /* @__PURE__ */ e(u, { variant: "caption", fontWeight: 500, children: o })
738
+ ] }),
739
+ a?.map((g, p) => /* @__PURE__ */ l(C, { direction: "row", justifyContent: "space-between", children: [
740
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: g.label }),
741
+ /* @__PURE__ */ e(u, { variant: "caption", fontWeight: 500, children: g.value })
742
+ ] }, p))
743
+ ] })
744
+ ] }),
745
+ m && m.length > 0 && /* @__PURE__ */ l(d, { children: [
746
+ /* @__PURE__ */ e(ue, { sx: { my: 1 } }),
747
+ /* @__PURE__ */ e(C, { direction: "row", spacing: 1, children: m.map((g, p) => /* @__PURE__ */ e(
748
+ Ce,
749
+ {
750
+ size: "small",
751
+ variant: "text",
752
+ onClick: g.onClick,
753
+ sx: { fontSize: X.typography.dense.text },
754
+ children: g.label
755
+ },
756
+ p
757
+ )) })
758
+ ] })
759
+ ] }) }), ke = 32, Oe = c.md, be = ke + 12, Is = ({
760
+ content: r,
761
+ role: n,
762
+ timestamp: t,
763
+ isLoading: i = !1,
764
+ userAvatar: o,
765
+ aiAvatar: a,
766
+ userInitials: m = "U",
767
+ showCopy: s = !1,
768
+ showFeedback: g = !1,
769
+ showShare: p = !1,
770
+ showRegenerate: x = !1,
771
+ onCopy: k,
772
+ onFeedback: b,
773
+ onShare: y,
774
+ onRegenerate: I,
775
+ children: $,
776
+ sx: S
777
+ }) => {
778
+ const A = n === "user", [B, M] = R(!1), W = () => {
779
+ typeof r == "string" && navigator.clipboard.writeText(r), M(!0), setTimeout(() => M(!1), 2e3), k?.();
780
+ }, D = /* @__PURE__ */ e(
781
+ we,
782
+ {
783
+ sx: {
784
+ width: ke,
785
+ height: ke,
786
+ bgcolor: "primary.main",
787
+ fontSize: 12,
788
+ fontWeight: 600,
789
+ flexShrink: 0
790
+ },
791
+ children: m
792
+ }
793
+ ), H = a || /* @__PURE__ */ e(de, { size: "small", animated: i });
794
+ if (A)
795
+ return /* @__PURE__ */ l(
796
+ C,
797
+ {
798
+ direction: "row",
799
+ spacing: Oe,
800
+ justifyContent: "flex-end",
801
+ alignItems: "flex-start",
802
+ sx: { py: c.sm, ...S },
803
+ children: [
804
+ /* @__PURE__ */ e(
805
+ Y,
806
+ {
807
+ elevation: 0,
808
+ sx: {
809
+ py: c.md,
810
+ px: c.base,
811
+ borderRadius: v.md,
812
+ backgroundColor: "action.hover",
813
+ maxWidth: "75%"
814
+ },
815
+ children: /* @__PURE__ */ e(u, { variant: "body2", color: "text.primary", fontWeight: 500, children: r })
816
+ }
817
+ ),
818
+ o || D
819
+ ]
820
+ }
821
+ );
822
+ const O = s || g || p || x;
823
+ return /* @__PURE__ */ l(d, { sx: { py: c.sm, ...S }, children: [
824
+ /* @__PURE__ */ l(C, { direction: "row", spacing: Oe, alignItems: "flex-start", children: [
825
+ /* @__PURE__ */ e(d, { sx: { flexShrink: 0 }, children: H }),
826
+ /* @__PURE__ */ e(d, { sx: { flex: 1, minWidth: 0 }, children: i ? /* @__PURE__ */ e(Wt, { text: "Searching..." }) : /* @__PURE__ */ e(
827
+ u,
828
+ {
829
+ variant: "body2",
830
+ color: "text.primary",
831
+ sx: {
832
+ whiteSpace: "pre-wrap",
833
+ lineHeight: 1.7,
834
+ "& strong": { fontWeight: 600 }
835
+ },
836
+ children: r
837
+ }
838
+ ) })
839
+ ] }),
840
+ !i && O && /* @__PURE__ */ l(
841
+ C,
842
+ {
843
+ direction: "row",
844
+ spacing: 0.5,
845
+ sx: {
846
+ mt: c.sm,
847
+ ml: `${be}px`
848
+ },
849
+ children: [
850
+ s && /* @__PURE__ */ e(P, { title: B ? "Copied!" : "Copy", children: /* @__PURE__ */ e(
851
+ z,
852
+ {
853
+ size: "small",
854
+ onClick: W,
855
+ "aria-label": B ? "Copied" : "Copy message",
856
+ sx: {
857
+ color: B ? "primary.main" : "text.disabled",
858
+ "&:hover": {
859
+ backgroundColor: h.colors.aiHover,
860
+ color: "text.primary"
861
+ }
862
+ },
863
+ children: /* @__PURE__ */ e(f, { name: B ? "check" : "copy", size: "small", "aria-hidden": "true" })
864
+ }
865
+ ) }),
866
+ g && /* @__PURE__ */ l(G, { children: [
867
+ /* @__PURE__ */ e(P, { title: "Good response", children: /* @__PURE__ */ e(
868
+ z,
869
+ {
870
+ size: "small",
871
+ onClick: () => b?.(!0),
872
+ "aria-label": "Mark as good response",
873
+ sx: {
874
+ color: "text.disabled",
875
+ "&:hover": {
876
+ backgroundColor: h.colors.aiHover,
877
+ color: "primary.main"
878
+ }
879
+ },
880
+ children: /* @__PURE__ */ e(f, { name: "thumbs-up", size: "small", "aria-hidden": "true" })
881
+ }
882
+ ) }),
883
+ /* @__PURE__ */ e(P, { title: "Bad response", children: /* @__PURE__ */ e(
884
+ z,
885
+ {
886
+ size: "small",
887
+ onClick: () => b?.(!1),
888
+ "aria-label": "Mark as bad response",
889
+ sx: {
890
+ color: "text.disabled",
891
+ "&:hover": {
892
+ backgroundColor: h.colors.aiHover,
893
+ color: "secondary.main"
894
+ }
895
+ },
896
+ children: /* @__PURE__ */ e(f, { name: "thumbs-down", size: "small", "aria-hidden": "true" })
897
+ }
898
+ ) })
899
+ ] }),
900
+ p && /* @__PURE__ */ e(P, { title: "Share", children: /* @__PURE__ */ e(
901
+ z,
902
+ {
903
+ size: "small",
904
+ onClick: y,
905
+ "aria-label": "Share message",
906
+ sx: {
907
+ color: "text.disabled",
908
+ "&:hover": {
909
+ backgroundColor: h.colors.aiHover,
910
+ color: "text.primary"
911
+ }
912
+ },
913
+ children: /* @__PURE__ */ e(f, { name: "share", size: "small", "aria-hidden": "true" })
914
+ }
915
+ ) }),
916
+ x && /* @__PURE__ */ e(P, { title: "Regenerate", children: /* @__PURE__ */ e(
917
+ z,
918
+ {
919
+ size: "small",
920
+ onClick: I,
921
+ "aria-label": "Regenerate response",
922
+ sx: {
923
+ color: "text.disabled",
924
+ "&:hover": {
925
+ backgroundColor: h.colors.aiHover,
926
+ color: "text.primary"
927
+ }
928
+ },
929
+ children: /* @__PURE__ */ e(f, { name: "refresh", size: "small", "aria-hidden": "true" })
930
+ }
931
+ ) })
932
+ ]
933
+ }
934
+ ),
935
+ t && !i && /* @__PURE__ */ e(
936
+ u,
937
+ {
938
+ variant: "caption",
939
+ color: "text.secondary",
940
+ sx: {
941
+ display: "block",
942
+ mt: c.xs,
943
+ ml: `${be}px`
944
+ },
945
+ children: t
946
+ }
947
+ ),
948
+ $ && !i && /* @__PURE__ */ e(d, { sx: { mt: c.base, ml: `${be}px` }, children: $ })
949
+ ] });
950
+ }, $s = ({
951
+ placeholder: r = "Enter a message",
952
+ value: n,
953
+ onChange: t,
954
+ onSubmit: i,
955
+ disabled: o = !1,
956
+ showVoiceInput: a = !0,
957
+ onVoiceInput: m,
958
+ isGenerating: s = !1,
959
+ onStopGeneration: g,
960
+ sx: p
961
+ }) => {
962
+ const [x, k] = R(""), b = n !== void 0 ? n : x, y = (S) => {
963
+ const A = S.target.value;
964
+ n === void 0 && k(A), t?.(A);
965
+ }, I = () => {
966
+ b.trim() && !o && !s && (i?.(b.trim()), n === void 0 && k(""));
967
+ }, $ = (S) => {
968
+ S.key === "Enter" && !S.shiftKey && (S.preventDefault(), I());
969
+ };
970
+ return /* @__PURE__ */ l(
971
+ Y,
972
+ {
973
+ elevation: 0,
974
+ sx: {
975
+ display: "flex",
976
+ alignItems: "center",
977
+ gap: 1,
978
+ p: 1,
979
+ pl: 2,
980
+ borderRadius: v.full,
981
+ border: "1px solid",
982
+ borderColor: "divider",
983
+ // Use MUI theme
984
+ backgroundColor: "background.paper",
985
+ // Use MUI theme
986
+ transition: `border-color ${X.motion.duration.fast}, box-shadow ${X.motion.duration.fast}`,
987
+ "&:focus-within": {
988
+ borderColor: h.colors.aiPrimary,
989
+ // @intentional-color: AI domain focus color
990
+ boxShadow: `0 0 0 3px ${h.colors.aiHover}`
991
+ // @intentional-color: AI domain hover color
992
+ },
993
+ ...p
994
+ },
995
+ children: [
996
+ /* @__PURE__ */ e(
997
+ d,
998
+ {
999
+ sx: {
1000
+ display: "flex",
1001
+ alignItems: "center",
1002
+ color: h.colors.aiPrimary
1003
+ },
1004
+ children: /* @__PURE__ */ e("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z" }) })
1005
+ }
1006
+ ),
1007
+ /* @__PURE__ */ e(
1008
+ Se,
1009
+ {
1010
+ fullWidth: !0,
1011
+ variant: "standard",
1012
+ placeholder: r,
1013
+ value: b,
1014
+ onChange: y,
1015
+ onKeyDown: $,
1016
+ disabled: o || s,
1017
+ InputProps: {
1018
+ disableUnderline: !0,
1019
+ sx: {
1020
+ fontSize: "0.9375rem"
1021
+ }
1022
+ }
1023
+ }
1024
+ ),
1025
+ a && /* @__PURE__ */ e(
1026
+ z,
1027
+ {
1028
+ size: "small",
1029
+ onClick: m,
1030
+ disabled: o || s,
1031
+ sx: { color: "text.secondary" },
1032
+ children: /* @__PURE__ */ e(f, { name: "volume", size: "small" })
1033
+ }
1034
+ ),
1035
+ s ? /* @__PURE__ */ e(
1036
+ z,
1037
+ {
1038
+ onClick: g,
1039
+ sx: {
1040
+ backgroundColor: "secondary.main",
1041
+ // Use MUI theme
1042
+ color: "common.white",
1043
+ // Use MUI theme
1044
+ "&:hover": {
1045
+ backgroundColor: "secondary.dark"
1046
+ // Use MUI theme
1047
+ }
1048
+ },
1049
+ children: /* @__PURE__ */ e(f, { name: "stop", size: "small" })
1050
+ }
1051
+ ) : /* @__PURE__ */ e(
1052
+ z,
1053
+ {
1054
+ onClick: I,
1055
+ disabled: o || !b.trim(),
1056
+ sx: {
1057
+ backgroundColor: b.trim() ? h.colors.aiPrimary : "action.hover",
1058
+ // @intentional-color: AI primary when active
1059
+ color: b.trim() ? "common.white" : "text.disabled",
1060
+ // Use MUI theme
1061
+ "&:hover": {
1062
+ backgroundColor: b.trim() ? h.colors.aiHover : "action.selected"
1063
+ // @intentional-color: AI hover when active
1064
+ },
1065
+ "&:disabled": {
1066
+ backgroundColor: "action.disabledBackground",
1067
+ // Use MUI theme
1068
+ color: "text.disabled"
1069
+ // Use MUI theme
1070
+ }
1071
+ },
1072
+ children: /* @__PURE__ */ e(f, { name: "send", size: "small" })
1073
+ }
1074
+ )
1075
+ ]
1076
+ }
1077
+ );
1078
+ }, Wt = ({
1079
+ text: r = "AI is thinking",
1080
+ sx: n
1081
+ }) => /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, sx: n, children: [
1082
+ /* @__PURE__ */ e(
1083
+ d,
1084
+ {
1085
+ sx: {
1086
+ display: "flex",
1087
+ alignItems: "center",
1088
+ gap: 0.5
1089
+ },
1090
+ children: [0, 1, 2].map((t) => /* @__PURE__ */ e(
1091
+ d,
1092
+ {
1093
+ sx: {
1094
+ width: 6,
1095
+ height: 6,
1096
+ borderRadius: v.circle,
1097
+ backgroundColor: h.colors.aiPrimary,
1098
+ animation: "bounce 1.4s infinite ease-in-out both",
1099
+ animationDelay: `${t * 0.16}s`,
1100
+ "@keyframes bounce": {
1101
+ "0%, 80%, 100%": {
1102
+ transform: "scale(0)"
1103
+ },
1104
+ "40%": {
1105
+ transform: "scale(1)"
1106
+ }
1107
+ }
1108
+ }
1109
+ },
1110
+ t
1111
+ ))
1112
+ }
1113
+ ),
1114
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: r })
1115
+ ] }), As = ({
1116
+ options: r,
1117
+ onSelect: n,
1118
+ sx: t
1119
+ }) => /* @__PURE__ */ e(C, { direction: "row", spacing: 1, flexWrap: "wrap", useFlexGap: !0, sx: t, children: r.map((i, o) => /* @__PURE__ */ e(
1120
+ te,
1121
+ {
1122
+ label: i,
1123
+ onClick: () => n(i),
1124
+ sx: {
1125
+ borderColor: h.colors.aiPrimary,
1126
+ color: h.colors.aiPrimary,
1127
+ "&:hover": {
1128
+ backgroundColor: h.colors.aiHover
1129
+ }
1130
+ },
1131
+ variant: "outlined"
1132
+ },
1133
+ o
1134
+ )) }), Ws = ({
1135
+ value: r,
1136
+ onChange: n,
1137
+ onSubmit: t,
1138
+ placeholder: i = "Type a message...",
1139
+ disabled: o = !1,
1140
+ showClear: a = !0,
1141
+ showVoice: m = !0,
1142
+ multiline: s = !0,
1143
+ maxRows: g = 4,
1144
+ autoFocus: p = !1,
1145
+ sx: x
1146
+ }) => {
1147
+ We(() => {
1148
+ process.env.NODE_ENV === "development" && console.warn(
1149
+ "[Trinity Design System] QueryInput is deprecated and will be removed in v2.0.0. Use InsightEngineInput instead. See migration guide: https://trinity.design/migration"
1150
+ );
1151
+ }, []);
1152
+ const [k, b] = R(""), [y, I] = R(!1), [$, S] = R(""), A = ve(null), B = ve(null), M = r !== void 0 ? r : k, W = y && $ ? `${M}${$}` : M, D = typeof window < "u" && ("SpeechRecognition" in window || "webkitSpeechRecognition" in window);
1153
+ We(() => {
1154
+ if (!D || !m) return;
1155
+ const L = window.SpeechRecognition || window.webkitSpeechRecognition, F = new L();
1156
+ return F.continuous = !0, F.interimResults = !0, F.lang = "en-US", F.onstart = () => {
1157
+ I(!0);
1158
+ }, F.onresult = (U) => {
1159
+ let V = "", ne = "";
1160
+ for (let E = U.resultIndex; E < U.results.length; E++) {
1161
+ const _ = U.results[E][0].transcript;
1162
+ U.results[E].isFinal ? V += _ : ne += _;
1163
+ }
1164
+ if (S(ne), V) {
1165
+ const E = M + V;
1166
+ r === void 0 && b(E), n?.(E), S("");
1167
+ }
1168
+ }, F.onerror = () => {
1169
+ I(!1), S("");
1170
+ }, F.onend = () => {
1171
+ I(!1), S("");
1172
+ }, A.current = F, () => {
1173
+ F.abort();
1174
+ };
1175
+ }, [D, m, M, r, n]);
1176
+ const H = Q((L) => {
1177
+ const F = L.target.value;
1178
+ r === void 0 && b(F), n?.(F);
1179
+ }, [r, n]), O = Q(() => {
1180
+ !M.trim() || o || (t?.(M.trim()), r === void 0 && b(""));
1181
+ }, [M, o, t, r]), re = Q((L) => {
1182
+ L.key === "Enter" && !L.shiftKey && (L.preventDefault(), O());
1183
+ }, [O]), oe = Q(() => {
1184
+ r === void 0 && b(""), n?.(""), B.current?.focus();
1185
+ }, [r, n]), ie = Q(() => {
1186
+ A.current && (y ? A.current.stop() : A.current.start());
1187
+ }, [y]), j = M.trim().length > 0;
1188
+ return /* @__PURE__ */ l(
1189
+ d,
1190
+ {
1191
+ sx: {
1192
+ display: "flex",
1193
+ alignItems: "flex-end",
1194
+ gap: c.sm,
1195
+ p: c.md,
1196
+ borderRadius: v.lg,
1197
+ border: 1,
1198
+ borderColor: y ? "primary.main" : "divider",
1199
+ backgroundColor: "background.paper",
1200
+ transition: "border-color 0.2s, box-shadow 0.2s",
1201
+ "&:focus-within": {
1202
+ borderColor: "primary.main",
1203
+ boxShadow: `0 0 0 3px ${h.colors.aiHover}`
1204
+ },
1205
+ ...y && {
1206
+ boxShadow: `0 0 0 3px ${h.colors.aiHover}`
1207
+ },
1208
+ ...x
1209
+ },
1210
+ children: [
1211
+ /* @__PURE__ */ e(
1212
+ Se,
1213
+ {
1214
+ inputRef: B,
1215
+ fullWidth: !0,
1216
+ multiline: s,
1217
+ maxRows: g,
1218
+ value: W,
1219
+ onChange: H,
1220
+ onKeyDown: re,
1221
+ placeholder: y ? "Listening..." : i,
1222
+ disabled: o,
1223
+ autoFocus: p,
1224
+ variant: "standard",
1225
+ InputProps: {
1226
+ disableUnderline: !0,
1227
+ sx: {
1228
+ fontSize: "0.875rem",
1229
+ lineHeight: 1.5
1230
+ }
1231
+ },
1232
+ sx: { flex: 1 }
1233
+ }
1234
+ ),
1235
+ /* @__PURE__ */ l(C, { direction: "row", spacing: 0.5, alignItems: "center", children: [
1236
+ a && j && !y && /* @__PURE__ */ e(P, { title: "Clear", children: /* @__PURE__ */ e(
1237
+ z,
1238
+ {
1239
+ size: "small",
1240
+ onClick: oe,
1241
+ disabled: o,
1242
+ "aria-label": "Clear input",
1243
+ sx: {
1244
+ color: "text.disabled",
1245
+ "&:hover": {
1246
+ color: "text.secondary",
1247
+ backgroundColor: "action.hover"
1248
+ }
1249
+ },
1250
+ children: /* @__PURE__ */ e(f, { name: "close", size: "small", "aria-hidden": "true" })
1251
+ }
1252
+ ) }),
1253
+ m && D && /* @__PURE__ */ e(P, { title: y ? "Stop listening" : "Start dictation", children: /* @__PURE__ */ e(
1254
+ z,
1255
+ {
1256
+ size: "small",
1257
+ onClick: ie,
1258
+ disabled: o,
1259
+ "aria-label": y ? "Stop listening" : "Start dictation",
1260
+ "aria-pressed": y,
1261
+ sx: {
1262
+ color: y ? "secondary.main" : "text.disabled",
1263
+ backgroundColor: y ? "secondary.light" : "transparent",
1264
+ "&:hover": {
1265
+ color: y ? "secondary.main" : "text.secondary",
1266
+ backgroundColor: y ? "secondary.light" : "action.hover"
1267
+ },
1268
+ // Pulsing animation when listening
1269
+ ...y && {
1270
+ animation: "pulse 1.5s ease-in-out infinite",
1271
+ "@keyframes pulse": {
1272
+ "0%, 100%": { opacity: 1 },
1273
+ "50%": { opacity: 0.6 }
1274
+ }
1275
+ }
1276
+ },
1277
+ children: /* @__PURE__ */ e(f, { name: "mic", size: "small", "aria-hidden": "true" })
1278
+ }
1279
+ ) }),
1280
+ /* @__PURE__ */ e(P, { title: "Send (Enter)", children: /* @__PURE__ */ l("span", { children: [
1281
+ " ",
1282
+ /* @__PURE__ */ e(
1283
+ z,
1284
+ {
1285
+ size: "small",
1286
+ onClick: O,
1287
+ disabled: o || !j,
1288
+ "aria-label": "Send message",
1289
+ sx: {
1290
+ color: j ? "primary.contrastText" : "text.disabled",
1291
+ backgroundColor: j ? "primary.main" : "action.disabledBackground",
1292
+ borderRadius: v.sm,
1293
+ "&:hover": {
1294
+ backgroundColor: j ? "primary.dark" : "action.disabledBackground"
1295
+ },
1296
+ "&:disabled": {
1297
+ color: "text.disabled",
1298
+ backgroundColor: "action.disabledBackground"
1299
+ }
1300
+ },
1301
+ children: /* @__PURE__ */ e(f, { name: "send", size: "small", "aria-hidden": "true" })
1302
+ }
1303
+ )
1304
+ ] }) })
1305
+ ] })
1306
+ ]
1307
+ }
1308
+ );
1309
+ }, Pt = ({
1310
+ // Input props
1311
+ value: r,
1312
+ onChange: n,
1313
+ onSubmit: t,
1314
+ placeholder: i = "Ask anything. Type @ for mentions and / for shortcuts.",
1315
+ disabled: o = !1,
1316
+ // Model selection
1317
+ models: a = [],
1318
+ selectedModel: m,
1319
+ onModelChange: s,
1320
+ // Source selection
1321
+ sources: g = [],
1322
+ onSourceToggle: p,
1323
+ // Toggles
1324
+ webSearchEnabled: x = !1,
1325
+ onWebSearchToggle: k,
1326
+ deepThinkingEnabled: b = !1,
1327
+ onDeepThinkingToggle: y,
1328
+ // Voice
1329
+ onVoiceClick: I,
1330
+ isListening: $ = !1,
1331
+ // Attachments
1332
+ onAttachmentClick: S,
1333
+ attachmentCount: A = 0,
1334
+ // Disclaimer
1335
+ disclaimer: B,
1336
+ // Layout
1337
+ compact: M = !1,
1338
+ sx: W
1339
+ }) => {
1340
+ const [D, H] = R(""), [O, re] = R(null), [oe, ie] = R(null), j = ve(null), L = r !== void 0 ? r : D, F = !!O, U = !!oe, V = a.find((w) => w.id === m), ne = g.filter((w) => w.enabled).length, E = Q((w) => {
1341
+ const q = w.target.value;
1342
+ r === void 0 && H(q), n?.(q);
1343
+ }, [r, n]), _ = Q(() => {
1344
+ !L.trim() || o || (t?.(L.trim()), r === void 0 && H(""));
1345
+ }, [L, o, t, r]), xe = Q((w) => {
1346
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), _());
1347
+ }, [_]), me = (w) => {
1348
+ re(w.currentTarget);
1349
+ }, ae = () => {
1350
+ re(null);
1351
+ }, ge = (w) => {
1352
+ s?.(w), ae();
1353
+ }, ze = (w) => {
1354
+ ie(w.currentTarget);
1355
+ }, Xe = () => {
1356
+ ie(null);
1357
+ }, Ie = (w, q) => {
1358
+ p?.(w, !q);
1359
+ }, pe = L.trim().length > 0;
1360
+ return /* @__PURE__ */ l(
1361
+ d,
1362
+ {
1363
+ sx: {
1364
+ display: "flex",
1365
+ flexDirection: "column",
1366
+ gap: c.xs,
1367
+ ...W
1368
+ },
1369
+ children: [
1370
+ /* @__PURE__ */ l(
1371
+ d,
1372
+ {
1373
+ sx: {
1374
+ display: "flex",
1375
+ flexDirection: "column",
1376
+ borderRadius: v.lg,
1377
+ border: 1,
1378
+ borderColor: "divider",
1379
+ backgroundColor: "background.paper",
1380
+ overflow: "hidden",
1381
+ transition: "border-color 0.2s, box-shadow 0.2s",
1382
+ "&:focus-within": {
1383
+ borderColor: "primary.main",
1384
+ boxShadow: `0 0 0 3px ${h.colors.aiHover}`
1385
+ }
1386
+ },
1387
+ children: [
1388
+ /* @__PURE__ */ e(d, { sx: { px: c.md, pt: c.md, pb: c.sm }, children: /* @__PURE__ */ e(
1389
+ Se,
1390
+ {
1391
+ inputRef: j,
1392
+ fullWidth: !0,
1393
+ multiline: !0,
1394
+ maxRows: M ? 3 : 6,
1395
+ value: L,
1396
+ onChange: E,
1397
+ onKeyDown: xe,
1398
+ placeholder: i,
1399
+ disabled: o,
1400
+ variant: "standard",
1401
+ InputProps: {
1402
+ disableUnderline: !0,
1403
+ sx: {
1404
+ fontSize: "0.875rem",
1405
+ lineHeight: 1.6,
1406
+ color: "text.primary",
1407
+ "& input::placeholder, & textarea::placeholder": {
1408
+ color: "text.secondary",
1409
+ opacity: 1
1410
+ }
1411
+ }
1412
+ }
1413
+ }
1414
+ ) }),
1415
+ /* @__PURE__ */ l(
1416
+ C,
1417
+ {
1418
+ direction: "row",
1419
+ alignItems: "center",
1420
+ sx: {
1421
+ px: c.sm,
1422
+ pb: c.sm,
1423
+ gap: c.xs
1424
+ },
1425
+ children: [
1426
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 0.5, children: [
1427
+ a.length > 0 && /* @__PURE__ */ l(G, { children: [
1428
+ /* @__PURE__ */ e(
1429
+ te,
1430
+ {
1431
+ icon: /* @__PURE__ */ e(f, { name: V?.icon || "cpu", size: "small" }),
1432
+ label: V?.label || "Model",
1433
+ onClick: me,
1434
+ deleteIcon: /* @__PURE__ */ e(f, { name: "chevron-down", size: "small" }),
1435
+ onDelete: me,
1436
+ disabled: o,
1437
+ size: "small",
1438
+ variant: "outlined",
1439
+ "aria-haspopup": "listbox",
1440
+ "aria-expanded": F,
1441
+ sx: {
1442
+ height: 28,
1443
+ borderRadius: v.sm,
1444
+ borderColor: "divider",
1445
+ backgroundColor: "action.hover",
1446
+ "& .MuiChip-label": {
1447
+ px: 0.5,
1448
+ fontSize: "0.75rem",
1449
+ fontWeight: 500
1450
+ },
1451
+ "& .MuiChip-icon": {
1452
+ color: "text.secondary",
1453
+ ml: 0.5
1454
+ },
1455
+ "& .MuiChip-deleteIcon": {
1456
+ color: "text.secondary",
1457
+ fontSize: "1rem",
1458
+ mr: 0.25
1459
+ },
1460
+ "&:hover": {
1461
+ borderColor: "text.secondary"
1462
+ }
1463
+ }
1464
+ }
1465
+ ),
1466
+ /* @__PURE__ */ e(
1467
+ ye,
1468
+ {
1469
+ anchorEl: O,
1470
+ open: F,
1471
+ onClose: ae,
1472
+ MenuListProps: {
1473
+ "aria-label": "AI model selection",
1474
+ role: "listbox"
1475
+ },
1476
+ slotProps: {
1477
+ paper: {
1478
+ sx: {
1479
+ minWidth: 180,
1480
+ borderRadius: v.md,
1481
+ mt: 0.5
1482
+ }
1483
+ }
1484
+ },
1485
+ children: a.map((w) => /* @__PURE__ */ l(
1486
+ Z,
1487
+ {
1488
+ onClick: () => ge(w.id),
1489
+ selected: w.id === m,
1490
+ role: "option",
1491
+ "aria-selected": w.id === m,
1492
+ sx: { py: 1 },
1493
+ children: [
1494
+ w.icon && /* @__PURE__ */ e(N, { sx: { minWidth: 32 }, children: /* @__PURE__ */ e(f, { name: w.icon, size: "small" }) }),
1495
+ /* @__PURE__ */ e(
1496
+ K,
1497
+ {
1498
+ primary: w.label,
1499
+ secondary: w.description,
1500
+ primaryTypographyProps: { variant: "body2", fontWeight: 500 },
1501
+ secondaryTypographyProps: { variant: "caption" }
1502
+ }
1503
+ )
1504
+ ]
1505
+ },
1506
+ w.id
1507
+ ))
1508
+ }
1509
+ )
1510
+ ] }),
1511
+ g.length > 0 && /* @__PURE__ */ l(G, { children: [
1512
+ /* @__PURE__ */ e(
1513
+ te,
1514
+ {
1515
+ icon: /* @__PURE__ */ e(f, { name: "folder", size: "small" }),
1516
+ label: ne,
1517
+ onClick: ze,
1518
+ deleteIcon: /* @__PURE__ */ e(f, { name: "chevron-down", size: "small" }),
1519
+ onDelete: ze,
1520
+ disabled: o,
1521
+ size: "small",
1522
+ variant: "outlined",
1523
+ "aria-haspopup": "menu",
1524
+ "aria-expanded": U,
1525
+ sx: {
1526
+ height: 28,
1527
+ borderRadius: v.sm,
1528
+ borderColor: "divider",
1529
+ backgroundColor: "transparent",
1530
+ "& .MuiChip-label": {
1531
+ px: 0.5,
1532
+ fontSize: "0.75rem",
1533
+ fontWeight: 500
1534
+ },
1535
+ "& .MuiChip-icon": {
1536
+ color: "text.secondary",
1537
+ ml: 0.5
1538
+ },
1539
+ "& .MuiChip-deleteIcon": {
1540
+ color: "text.secondary",
1541
+ fontSize: "1rem",
1542
+ mr: 0.25
1543
+ },
1544
+ "&:hover": {
1545
+ borderColor: "text.secondary",
1546
+ backgroundColor: "action.hover"
1547
+ }
1548
+ }
1549
+ }
1550
+ ),
1551
+ /* @__PURE__ */ e(
1552
+ ye,
1553
+ {
1554
+ anchorEl: oe,
1555
+ open: U,
1556
+ onClose: Xe,
1557
+ MenuListProps: {
1558
+ "aria-label": "Data source toggles"
1559
+ },
1560
+ slotProps: {
1561
+ paper: {
1562
+ sx: {
1563
+ minWidth: 220,
1564
+ borderRadius: v.md,
1565
+ mt: 0.5
1566
+ }
1567
+ }
1568
+ },
1569
+ children: g.map((w) => /* @__PURE__ */ l(
1570
+ Z,
1571
+ {
1572
+ onClick: () => Ie(w.id, w.enabled ?? !1),
1573
+ sx: { py: 1, justifyContent: "space-between" },
1574
+ children: [
1575
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, children: [
1576
+ w.icon && /* @__PURE__ */ e(f, { name: w.icon, size: "small" }),
1577
+ /* @__PURE__ */ e(u, { variant: "body2", fontWeight: 500, children: w.label })
1578
+ ] }),
1579
+ /* @__PURE__ */ e(
1580
+ Je,
1581
+ {
1582
+ size: "small",
1583
+ checked: w.enabled ?? !1,
1584
+ onChange: (q) => {
1585
+ q.stopPropagation(), Ie(w.id, w.enabled ?? !1);
1586
+ },
1587
+ onClick: (q) => q.stopPropagation(),
1588
+ inputProps: { "aria-label": `Toggle ${w.label}` }
1589
+ }
1590
+ )
1591
+ ]
1592
+ },
1593
+ w.id
1594
+ ))
1595
+ }
1596
+ )
1597
+ ] }),
1598
+ y && /* @__PURE__ */ e(P, { title: b ? "Disable deep thinking" : "Enable deep thinking", children: /* @__PURE__ */ e(
1599
+ z,
1600
+ {
1601
+ size: "small",
1602
+ onClick: () => y(!b),
1603
+ disabled: o,
1604
+ "aria-pressed": b,
1605
+ "aria-label": "Deep thinking",
1606
+ sx: {
1607
+ width: 28,
1608
+ height: 28,
1609
+ color: b ? "secondary.main" : "text.disabled",
1610
+ backgroundColor: b ? "secondary.light" : "transparent",
1611
+ "&:hover": {
1612
+ backgroundColor: b ? "secondary.light" : "action.hover"
1613
+ }
1614
+ },
1615
+ children: /* @__PURE__ */ e(f, { name: "lightbulb", size: "small" })
1616
+ }
1617
+ ) })
1618
+ ] }),
1619
+ /* @__PURE__ */ e(d, { sx: { flex: 1 } }),
1620
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 0.5, children: [
1621
+ k && /* @__PURE__ */ e(P, { title: x ? "Disable web search" : "Enable web search", children: /* @__PURE__ */ e(
1622
+ z,
1623
+ {
1624
+ size: "small",
1625
+ onClick: () => k(!x),
1626
+ disabled: o,
1627
+ "aria-pressed": x,
1628
+ "aria-label": "Web search",
1629
+ sx: {
1630
+ width: 28,
1631
+ height: 28,
1632
+ color: x ? "primary.main" : "text.disabled",
1633
+ "&:hover": {
1634
+ backgroundColor: "action.hover"
1635
+ }
1636
+ },
1637
+ children: /* @__PURE__ */ e(f, { name: "globe", size: "small" })
1638
+ }
1639
+ ) }),
1640
+ S && /* @__PURE__ */ e(P, { title: "Attach files", children: /* @__PURE__ */ l(
1641
+ z,
1642
+ {
1643
+ size: "small",
1644
+ onClick: S,
1645
+ disabled: o,
1646
+ "aria-label": `Attach files${A > 0 ? ` (${A} attached)` : ""}`,
1647
+ sx: {
1648
+ width: 28,
1649
+ height: 28,
1650
+ color: A > 0 ? "primary.main" : "text.disabled",
1651
+ position: "relative",
1652
+ "&:hover": {
1653
+ backgroundColor: "action.hover"
1654
+ }
1655
+ },
1656
+ children: [
1657
+ /* @__PURE__ */ e(f, { name: "paperclip", size: "small" }),
1658
+ A > 0 && /* @__PURE__ */ e(
1659
+ d,
1660
+ {
1661
+ component: "span",
1662
+ sx: {
1663
+ position: "absolute",
1664
+ top: 2,
1665
+ right: 2,
1666
+ backgroundColor: "primary.main",
1667
+ color: "primary.contrastText",
1668
+ borderRadius: v.circle,
1669
+ width: 12,
1670
+ height: 12,
1671
+ fontSize: "0.5rem",
1672
+ fontWeight: 600,
1673
+ display: "flex",
1674
+ alignItems: "center",
1675
+ justifyContent: "center"
1676
+ },
1677
+ children: A
1678
+ }
1679
+ )
1680
+ ]
1681
+ }
1682
+ ) }),
1683
+ I && /* @__PURE__ */ e(P, { title: $ ? "Stop listening" : "Voice input", children: /* @__PURE__ */ e(
1684
+ z,
1685
+ {
1686
+ size: "small",
1687
+ onClick: I,
1688
+ disabled: o,
1689
+ "aria-pressed": $,
1690
+ "aria-label": $ ? "Stop listening" : "Voice input",
1691
+ sx: {
1692
+ width: 28,
1693
+ height: 28,
1694
+ color: $ ? "secondary.main" : "text.disabled",
1695
+ "&:hover": {
1696
+ backgroundColor: "action.hover"
1697
+ },
1698
+ ...$ && {
1699
+ animation: "pulse 1.5s ease-in-out infinite",
1700
+ "@keyframes pulse": {
1701
+ "0%, 100%": { opacity: 1 },
1702
+ "50%": { opacity: 0.5 }
1703
+ }
1704
+ }
1705
+ },
1706
+ children: /* @__PURE__ */ e(f, { name: "mic", size: "small" })
1707
+ }
1708
+ ) }),
1709
+ /* @__PURE__ */ e(P, { title: "Send (Enter)", children: /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(
1710
+ z,
1711
+ {
1712
+ size: "small",
1713
+ onClick: _,
1714
+ disabled: o || !pe,
1715
+ "aria-label": "Send message",
1716
+ sx: {
1717
+ width: 32,
1718
+ height: 32,
1719
+ color: pe ? "primary.contrastText" : "text.disabled",
1720
+ backgroundColor: pe ? "primary.main" : "action.disabledBackground",
1721
+ borderRadius: v.sm,
1722
+ "&:hover": {
1723
+ backgroundColor: pe ? "primary.dark" : "action.disabledBackground"
1724
+ },
1725
+ "&.Mui-disabled": {
1726
+ color: "text.disabled",
1727
+ backgroundColor: "action.disabledBackground"
1728
+ }
1729
+ },
1730
+ children: /* @__PURE__ */ e(f, { name: "send", size: "small" })
1731
+ }
1732
+ ) }) })
1733
+ ] })
1734
+ ]
1735
+ }
1736
+ )
1737
+ ]
1738
+ }
1739
+ ),
1740
+ B && /* @__PURE__ */ e(
1741
+ u,
1742
+ {
1743
+ variant: "caption",
1744
+ color: "text.secondary",
1745
+ align: "center",
1746
+ sx: { px: c.sm },
1747
+ children: B
1748
+ }
1749
+ )
1750
+ ]
1751
+ }
1752
+ );
1753
+ }, Rt = ({
1754
+ number: r,
1755
+ title: n,
1756
+ url: t,
1757
+ description: i,
1758
+ type: o = "webpage",
1759
+ favicon: a,
1760
+ onClick: m,
1761
+ sx: s
1762
+ }) => {
1763
+ const g = () => {
1764
+ switch (o) {
1765
+ case "document":
1766
+ return "document";
1767
+ case "article":
1768
+ return "document";
1769
+ case "video":
1770
+ return "trending-up";
1771
+ default:
1772
+ return "external-link";
1773
+ }
1774
+ };
1775
+ return /* @__PURE__ */ e(
1776
+ d,
1777
+ {
1778
+ onClick: m,
1779
+ sx: {
1780
+ p: c.sm,
1781
+ borderRadius: v.sm,
1782
+ border: "1px solid",
1783
+ borderColor: "divider",
1784
+ backgroundColor: "transparent",
1785
+ cursor: m ? "pointer" : "default",
1786
+ transition: "all 0.2s ease",
1787
+ "&:hover": m ? {
1788
+ borderColor: h.colors.aiPrimary,
1789
+ boxShadow: `0 2px 8px ${h.colors.aiHover}`
1790
+ } : {},
1791
+ ...s
1792
+ },
1793
+ children: /* @__PURE__ */ l(C, { direction: "row", spacing: 1.5, alignItems: "flex-start", children: [
1794
+ /* @__PURE__ */ e(
1795
+ we,
1796
+ {
1797
+ sx: {
1798
+ width: 24,
1799
+ height: 24,
1800
+ backgroundColor: h.colors.aiHover,
1801
+ color: h.colors.aiPrimary,
1802
+ fontSize: X.typography.dense.text,
1803
+ // 12px dense text
1804
+ fontWeight: 600
1805
+ },
1806
+ children: r
1807
+ }
1808
+ ),
1809
+ /* @__PURE__ */ l(d, { sx: { minWidth: 0, flex: 1 }, children: [
1810
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, children: [
1811
+ a && /* @__PURE__ */ e(
1812
+ d,
1813
+ {
1814
+ component: "img",
1815
+ src: a,
1816
+ alt: "",
1817
+ sx: {
1818
+ width: 16,
1819
+ height: 16,
1820
+ borderRadius: 0.5
1821
+ }
1822
+ }
1823
+ ),
1824
+ /* @__PURE__ */ e(
1825
+ u,
1826
+ {
1827
+ variant: "body2",
1828
+ sx: {
1829
+ fontWeight: 500,
1830
+ overflow: "hidden",
1831
+ textOverflow: "ellipsis",
1832
+ whiteSpace: "nowrap"
1833
+ },
1834
+ children: n
1835
+ }
1836
+ ),
1837
+ /* @__PURE__ */ e(f, { name: g(), size: "small" })
1838
+ ] }),
1839
+ t && /* @__PURE__ */ e(
1840
+ Ge,
1841
+ {
1842
+ href: t,
1843
+ target: "_blank",
1844
+ rel: "noopener noreferrer",
1845
+ onClick: (p) => p.stopPropagation(),
1846
+ sx: {
1847
+ fontSize: "0.75rem",
1848
+ color: "text.secondary",
1849
+ textDecoration: "none",
1850
+ display: "block",
1851
+ overflow: "hidden",
1852
+ textOverflow: "ellipsis",
1853
+ whiteSpace: "nowrap",
1854
+ "&:hover": {
1855
+ textDecoration: "underline"
1856
+ }
1857
+ },
1858
+ children: t
1859
+ }
1860
+ ),
1861
+ i && /* @__PURE__ */ e(
1862
+ u,
1863
+ {
1864
+ variant: "caption",
1865
+ color: "text.secondary",
1866
+ sx: {
1867
+ display: "-webkit-box",
1868
+ WebkitLineClamp: 2,
1869
+ WebkitBoxOrient: "vertical",
1870
+ overflow: "hidden",
1871
+ mt: 0.5
1872
+ },
1873
+ children: i
1874
+ }
1875
+ )
1876
+ ] })
1877
+ ] })
1878
+ }
1879
+ );
1880
+ }, Ps = ({
1881
+ sources: r,
1882
+ title: n = "Sources",
1883
+ collapsible: t = !0,
1884
+ defaultExpanded: i = !0,
1885
+ maxVisible: o = 3,
1886
+ onSourceClick: a,
1887
+ sx: m
1888
+ }) => {
1889
+ const [s, g] = R(i), [p, x] = R(!1), k = p ? r : r.slice(0, o), b = r.length > o;
1890
+ return /* @__PURE__ */ l(d, { sx: m, children: [
1891
+ /* @__PURE__ */ l(
1892
+ C,
1893
+ {
1894
+ direction: "row",
1895
+ alignItems: "center",
1896
+ justifyContent: "space-between",
1897
+ onClick: t ? () => g(!s) : void 0,
1898
+ sx: {
1899
+ cursor: t ? "pointer" : "default",
1900
+ mb: s ? 1.5 : 0
1901
+ },
1902
+ children: [
1903
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, children: [
1904
+ /* @__PURE__ */ e(u, { variant: "subtitle2", sx: { fontWeight: 600 }, children: n }),
1905
+ /* @__PURE__ */ e(
1906
+ te,
1907
+ {
1908
+ label: r.length,
1909
+ size: "small",
1910
+ sx: {
1911
+ height: 20,
1912
+ fontSize: "0.75rem",
1913
+ backgroundColor: h.colors.aiHover,
1914
+ color: h.colors.aiPrimary
1915
+ }
1916
+ }
1917
+ )
1918
+ ] }),
1919
+ t && /* @__PURE__ */ e(z, { size: "small", children: /* @__PURE__ */ e(
1920
+ f,
1921
+ {
1922
+ name: s ? "chevron-up" : "chevron-down",
1923
+ size: "small"
1924
+ }
1925
+ ) })
1926
+ ]
1927
+ }
1928
+ ),
1929
+ /* @__PURE__ */ e(J, { in: s, children: /* @__PURE__ */ l(C, { spacing: 1, children: [
1930
+ k.map((y, I) => /* @__PURE__ */ e(
1931
+ Rt,
1932
+ {
1933
+ number: I + 1,
1934
+ ...y,
1935
+ onClick: () => a?.(I, y)
1936
+ },
1937
+ I
1938
+ )),
1939
+ b && /* @__PURE__ */ e(
1940
+ Ce,
1941
+ {
1942
+ variant: "text",
1943
+ size: "small",
1944
+ onClick: () => x(!p),
1945
+ endIcon: /* @__PURE__ */ e(f, { name: p ? "chevron-up" : "chevron-down", size: "small" }),
1946
+ sx: {
1947
+ color: h.colors.aiPrimary,
1948
+ textTransform: "none",
1949
+ "&:hover": {
1950
+ backgroundColor: h.colors.aiHover
1951
+ }
1952
+ },
1953
+ children: p ? "Show less" : `Show ${r.length - o} more`
1954
+ }
1955
+ )
1956
+ ] }) })
1957
+ ] });
1958
+ }, Ft = ({
1959
+ sources: r,
1960
+ title: n = "Sources",
1961
+ defaultExpanded: t = !0,
1962
+ expanded: i,
1963
+ onExpandedChange: o,
1964
+ sx: a
1965
+ }) => {
1966
+ const m = ee(), [s, g] = R(t), [p, x] = R(null), [k, b] = R(null), y = i ?? s, I = r.reduce((S, A) => S + A.count, 0), $ = () => {
1967
+ const S = !y;
1968
+ i === void 0 && g(S), o?.(S);
1969
+ };
1970
+ return /* @__PURE__ */ l(
1971
+ d,
1972
+ {
1973
+ sx: {
1974
+ backgroundColor: "background.paper",
1975
+ borderRadius: v.lg,
1976
+ border: "1px solid",
1977
+ borderColor: "divider",
1978
+ overflow: "hidden",
1979
+ ...a
1980
+ },
1981
+ children: [
1982
+ /* @__PURE__ */ l(
1983
+ d,
1984
+ {
1985
+ onClick: $,
1986
+ sx: {
1987
+ display: "flex",
1988
+ alignItems: "center",
1989
+ justifyContent: "space-between",
1990
+ cursor: "pointer",
1991
+ px: c.base,
1992
+ py: c.md,
1993
+ "&:hover": {
1994
+ backgroundColor: h.colors.aiHover
1995
+ }
1996
+ },
1997
+ children: [
1998
+ /* @__PURE__ */ l(u, { variant: "body2", fontWeight: 600, color: "text.primary", children: [
1999
+ n,
2000
+ " (",
2001
+ I,
2002
+ ")"
2003
+ ] }),
2004
+ /* @__PURE__ */ e(
2005
+ f,
2006
+ {
2007
+ name: y ? "chevron-up" : "chevron-down",
2008
+ size: "small",
2009
+ color: m.palette.text.disabled
2010
+ }
2011
+ )
2012
+ ]
2013
+ }
2014
+ ),
2015
+ /* @__PURE__ */ e(J, { in: y, children: /* @__PURE__ */ e(d, { sx: { px: c.sm, pb: c.sm }, children: r.map((S, A) => /* @__PURE__ */ e(
2016
+ Mt,
2017
+ {
2018
+ category: S,
2019
+ index: A + 1,
2020
+ isExpanded: p === S.id,
2021
+ onToggle: () => {
2022
+ x(p === S.id ? null : S.id), b(null);
2023
+ },
2024
+ selectedItem: k,
2025
+ onSelectItem: b
2026
+ },
2027
+ S.id
2028
+ )) }) })
2029
+ ]
2030
+ }
2031
+ );
2032
+ }, Mt = ({
2033
+ category: r,
2034
+ index: n,
2035
+ isExpanded: t,
2036
+ onToggle: i,
2037
+ selectedItem: o,
2038
+ onSelectItem: a,
2039
+ sx: m
2040
+ }) => {
2041
+ const s = ee(), g = r.items && r.items.length > 0;
2042
+ return /* @__PURE__ */ l(d, { sx: { mb: 0.5, ...m }, children: [
2043
+ /* @__PURE__ */ l(
2044
+ d,
2045
+ {
2046
+ onClick: g ? i : void 0,
2047
+ sx: {
2048
+ display: "flex",
2049
+ alignItems: "center",
2050
+ gap: c.md,
2051
+ py: c.sm,
2052
+ cursor: g ? "pointer" : "default"
2053
+ },
2054
+ children: [
2055
+ /* @__PURE__ */ e(
2056
+ u,
2057
+ {
2058
+ variant: "caption",
2059
+ sx: {
2060
+ color: s.palette.primary.main,
2061
+ fontWeight: 500,
2062
+ minWidth: 16
2063
+ },
2064
+ children: n
2065
+ }
2066
+ ),
2067
+ /* @__PURE__ */ l(u, { variant: "body2", color: "text.primary", sx: { flex: 1 }, children: [
2068
+ r.name,
2069
+ " (",
2070
+ r.count,
2071
+ ")"
2072
+ ] }),
2073
+ g && /* @__PURE__ */ l(
2074
+ u,
2075
+ {
2076
+ variant: "caption",
2077
+ sx: {
2078
+ color: s.palette.primary.main,
2079
+ cursor: "pointer",
2080
+ "&:hover": { textDecoration: "underline" }
2081
+ },
2082
+ children: [
2083
+ "[",
2084
+ t ? "Hide" : "Show",
2085
+ "]"
2086
+ ]
2087
+ }
2088
+ )
2089
+ ]
2090
+ }
2091
+ ),
2092
+ g && /* @__PURE__ */ e(J, { in: t, children: /* @__PURE__ */ l(d, { sx: { pl: c.lg, pb: c.sm }, children: [
2093
+ /* @__PURE__ */ e(d, { sx: { display: "flex", flexWrap: "wrap", gap: c.sm, mb: c.base }, children: r.items.map((p, x) => {
2094
+ const k = String.fromCharCode(97 + x), b = o?.id === p.id;
2095
+ return /* @__PURE__ */ e(
2096
+ te,
2097
+ {
2098
+ label: /* @__PURE__ */ l(d, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
2099
+ /* @__PURE__ */ e(
2100
+ u,
2101
+ {
2102
+ component: "span",
2103
+ sx: {
2104
+ fontWeight: 600,
2105
+ // eslint-disable-next-line no-restricted-syntax -- @intentional-color: white when selected
2106
+ color: b ? "#FFFFFF" : s.palette.primary.main,
2107
+ fontSize: 12
2108
+ },
2109
+ children: k
2110
+ }
2111
+ ),
2112
+ /* @__PURE__ */ e(
2113
+ u,
2114
+ {
2115
+ component: "span",
2116
+ sx: {
2117
+ fontSize: 12,
2118
+ maxWidth: 150,
2119
+ overflow: "hidden",
2120
+ textOverflow: "ellipsis",
2121
+ whiteSpace: "nowrap"
2122
+ },
2123
+ children: p.label.length > 25 ? p.label.substring(0, 25) + "..." : p.label
2124
+ }
2125
+ )
2126
+ ] }),
2127
+ onClick: () => a(b ? null : p),
2128
+ sx: {
2129
+ backgroundColor: b ? s.palette.primary.main : s.palette.action.hover,
2130
+ // eslint-disable-next-line no-restricted-syntax -- @intentional-color: white when selected
2131
+ color: b ? "#FFFFFF" : s.palette.text.primary,
2132
+ border: `1px solid ${b ? s.palette.primary.main : s.palette.divider}`,
2133
+ borderRadius: v.xl,
2134
+ height: 28,
2135
+ "&:hover": {
2136
+ backgroundColor: b ? s.palette.primary.main : ce(s.palette.primary.main, 0.1)
2137
+ }
2138
+ }
2139
+ },
2140
+ p.id
2141
+ );
2142
+ }) }),
2143
+ o?.details && /* @__PURE__ */ e(
2144
+ Y,
2145
+ {
2146
+ elevation: 0,
2147
+ sx: {
2148
+ border: `1px solid ${s.palette.divider}`,
2149
+ borderRadius: v.md,
2150
+ overflow: "hidden",
2151
+ backgroundColor: s.palette.background.default
2152
+ },
2153
+ children: Object.entries(o.details).map(([p, x], k) => /* @__PURE__ */ l(
2154
+ d,
2155
+ {
2156
+ sx: {
2157
+ display: "flex",
2158
+ borderBottom: k < Object.entries(o.details).length - 1 ? `1px solid ${s.palette.divider}` : "none"
2159
+ },
2160
+ children: [
2161
+ /* @__PURE__ */ e(
2162
+ d,
2163
+ {
2164
+ sx: {
2165
+ width: 140,
2166
+ flexShrink: 0,
2167
+ p: c.md,
2168
+ backgroundColor: s.palette.background.paper,
2169
+ borderRight: `1px solid ${s.palette.divider}`
2170
+ },
2171
+ children: /* @__PURE__ */ e(u, { variant: "caption", fontWeight: 600, color: "text.primary", children: p })
2172
+ }
2173
+ ),
2174
+ /* @__PURE__ */ e(d, { sx: { flex: 1, p: c.md }, children: /* @__PURE__ */ e(u, { variant: "caption", color: "text.primary", children: x }) })
2175
+ ]
2176
+ },
2177
+ p
2178
+ ))
2179
+ }
2180
+ )
2181
+ ] }) })
2182
+ ] });
2183
+ }, je = ({
2184
+ questions: r,
2185
+ onQuestionClick: n,
2186
+ title: t = "Related Questions",
2187
+ defaultExpanded: i = !0,
2188
+ expanded: o,
2189
+ onExpandedChange: a,
2190
+ emptyTitle: m = "No related questions",
2191
+ emptyDescription: s = "Questions will appear here based on the conversation context.",
2192
+ showEmpty: g = !1,
2193
+ sx: p
2194
+ }) => {
2195
+ const x = ee(), [k, b] = R(i), y = o ?? k, I = () => {
2196
+ const $ = !y;
2197
+ o === void 0 && b($), a?.($);
2198
+ };
2199
+ return !r.length && !g ? null : /* @__PURE__ */ l(
2200
+ er,
2201
+ {
2202
+ elevation: 0,
2203
+ sx: {
2204
+ backgroundColor: x.palette.mode === "dark" ? "background.paper" : "grey.50",
2205
+ borderRadius: v.lg,
2206
+ border: "1px solid",
2207
+ borderColor: "divider",
2208
+ overflow: "hidden",
2209
+ ...p
2210
+ },
2211
+ children: [
2212
+ /* @__PURE__ */ l(
2213
+ d,
2214
+ {
2215
+ component: "button",
2216
+ onClick: I,
2217
+ "aria-expanded": y,
2218
+ "aria-controls": "related-questions-content",
2219
+ sx: {
2220
+ display: "flex",
2221
+ alignItems: "center",
2222
+ justifyContent: "space-between",
2223
+ width: "100%",
2224
+ cursor: "pointer",
2225
+ px: c.base,
2226
+ py: c.md,
2227
+ border: "none",
2228
+ backgroundColor: "transparent",
2229
+ "&:hover": {
2230
+ backgroundColor: h.colors.aiHover
2231
+ },
2232
+ "&:focus-visible": {
2233
+ outline: `2px solid ${x.palette.primary.main}`,
2234
+ outlineOffset: -2
2235
+ }
2236
+ },
2237
+ children: [
2238
+ /* @__PURE__ */ e(
2239
+ u,
2240
+ {
2241
+ variant: "body2",
2242
+ fontWeight: 600,
2243
+ color: "text.primary",
2244
+ component: "span",
2245
+ children: t
2246
+ }
2247
+ ),
2248
+ /* @__PURE__ */ e(
2249
+ f,
2250
+ {
2251
+ name: y ? "chevron-up" : "chevron-down",
2252
+ size: "small",
2253
+ color: x.palette.text.secondary,
2254
+ "aria-hidden": "true"
2255
+ }
2256
+ )
2257
+ ]
2258
+ }
2259
+ ),
2260
+ /* @__PURE__ */ e(J, { in: y, children: /* @__PURE__ */ e(
2261
+ d,
2262
+ {
2263
+ id: "related-questions-content",
2264
+ role: "region",
2265
+ "aria-label": t,
2266
+ children: r.length === 0 ? (
2267
+ /* Empty State with Icon, Title, and Description */
2268
+ /* @__PURE__ */ l(
2269
+ d,
2270
+ {
2271
+ sx: {
2272
+ py: c.lg,
2273
+ px: c.base,
2274
+ display: "flex",
2275
+ flexDirection: "column",
2276
+ alignItems: "center",
2277
+ textAlign: "center",
2278
+ gap: c.sm
2279
+ },
2280
+ children: [
2281
+ /* @__PURE__ */ e(
2282
+ f,
2283
+ {
2284
+ name: "help",
2285
+ size: "large",
2286
+ color: x.palette.text.disabled,
2287
+ "aria-hidden": "true"
2288
+ }
2289
+ ),
2290
+ /* @__PURE__ */ e(
2291
+ u,
2292
+ {
2293
+ variant: "body2",
2294
+ fontWeight: 600,
2295
+ color: "text.secondary",
2296
+ children: m
2297
+ }
2298
+ ),
2299
+ /* @__PURE__ */ e(
2300
+ u,
2301
+ {
2302
+ variant: "caption",
2303
+ color: "text.disabled",
2304
+ sx: { maxWidth: 280 },
2305
+ children: s
2306
+ }
2307
+ )
2308
+ ]
2309
+ }
2310
+ )
2311
+ ) : (
2312
+ /* Question List - Left aligned with arrow icons */
2313
+ /* @__PURE__ */ e(
2314
+ _e,
2315
+ {
2316
+ disablePadding: !0,
2317
+ sx: {
2318
+ px: c.sm,
2319
+ pb: c.sm
2320
+ },
2321
+ "aria-label": "Related questions list",
2322
+ children: r.map(($, S) => /* @__PURE__ */ e(
2323
+ qe,
2324
+ {
2325
+ disablePadding: !0,
2326
+ sx: { mb: 0.5 },
2327
+ children: /* @__PURE__ */ l(
2328
+ Ne,
2329
+ {
2330
+ onClick: () => n?.($),
2331
+ sx: {
2332
+ borderRadius: v.sm,
2333
+ py: c.sm,
2334
+ px: c.sm,
2335
+ alignItems: "flex-start",
2336
+ "&:hover": {
2337
+ backgroundColor: h.colors.aiHover
2338
+ },
2339
+ "&:focus-visible": {
2340
+ backgroundColor: h.colors.aiHover,
2341
+ outline: `2px solid ${x.palette.primary.main}`,
2342
+ outlineOffset: -2
2343
+ }
2344
+ },
2345
+ children: [
2346
+ /* @__PURE__ */ e(
2347
+ N,
2348
+ {
2349
+ sx: {
2350
+ minWidth: 28,
2351
+ mt: 0.25
2352
+ },
2353
+ children: /* @__PURE__ */ e(
2354
+ f,
2355
+ {
2356
+ name: "forward",
2357
+ size: "small",
2358
+ color: x.palette.primary.main,
2359
+ "aria-hidden": "true"
2360
+ }
2361
+ )
2362
+ }
2363
+ ),
2364
+ /* @__PURE__ */ e(
2365
+ K,
2366
+ {
2367
+ primary: $,
2368
+ primaryTypographyProps: {
2369
+ variant: "body2",
2370
+ color: "text.primary",
2371
+ sx: { textAlign: "left" }
2372
+ }
2373
+ }
2374
+ )
2375
+ ]
2376
+ }
2377
+ )
2378
+ },
2379
+ S
2380
+ ))
2381
+ }
2382
+ )
2383
+ )
2384
+ }
2385
+ ) })
2386
+ ]
2387
+ }
2388
+ );
2389
+ }, Rs = ({
2390
+ open: r,
2391
+ isListening: n,
2392
+ onListeningToggle: t,
2393
+ onClose: i,
2394
+ listeningText: o = "Listening...",
2395
+ readyText: a = "Tap to speak",
2396
+ listeningInstruction: m = "Speak your question clearly",
2397
+ readyInstruction: s = "Voice mode is ready",
2398
+ sx: g
2399
+ }) => {
2400
+ const p = ee();
2401
+ return /* @__PURE__ */ e(J, { in: r, children: /* @__PURE__ */ l(
2402
+ Y,
2403
+ {
2404
+ elevation: 0,
2405
+ sx: {
2406
+ mt: c.base,
2407
+ p: c.lg,
2408
+ backgroundColor: p.palette.action.hover,
2409
+ borderRadius: v.xl,
2410
+ textAlign: "center",
2411
+ border: `1px solid ${p.palette.divider}`,
2412
+ ...g
2413
+ },
2414
+ children: [
2415
+ /* @__PURE__ */ e(
2416
+ d,
2417
+ {
2418
+ sx: {
2419
+ width: 80,
2420
+ height: 80,
2421
+ borderRadius: v.circle,
2422
+ backgroundColor: n ? p.palette.primary.main : ce(p.palette.text.disabled, 0.1),
2423
+ display: "flex",
2424
+ alignItems: "center",
2425
+ justifyContent: "center",
2426
+ mx: "auto",
2427
+ mb: c.base,
2428
+ cursor: "pointer",
2429
+ transition: "all 0.3s ease",
2430
+ animation: n ? "voicePulse 1.5s infinite" : "none",
2431
+ "@keyframes voicePulse": {
2432
+ "0%": {
2433
+ boxShadow: `0 0 0 0 ${ce(p.palette.primary.main, 0.4)}`
2434
+ },
2435
+ "70%": {
2436
+ boxShadow: `0 0 0 20px ${ce(p.palette.primary.main, 0)}`
2437
+ },
2438
+ "100%": {
2439
+ boxShadow: `0 0 0 0 ${ce(p.palette.primary.main, 0)}`
2440
+ }
2441
+ }
2442
+ },
2443
+ onClick: t,
2444
+ children: /* @__PURE__ */ e(
2445
+ f,
2446
+ {
2447
+ name: "mic",
2448
+ size: "large",
2449
+ color: n ? "#FFFFFF" : p.palette.text.disabled
2450
+ }
2451
+ )
2452
+ }
2453
+ ),
2454
+ /* @__PURE__ */ e(u, { variant: "body1", sx: { color: p.palette.text.primary, mb: c.sm }, children: n ? o : a }),
2455
+ /* @__PURE__ */ e(u, { variant: "caption", sx: { color: p.palette.text.secondary }, children: n ? m : s }),
2456
+ /* @__PURE__ */ e(d, { sx: { mt: c.base }, children: /* @__PURE__ */ e(
2457
+ z,
2458
+ {
2459
+ size: "small",
2460
+ onClick: i,
2461
+ sx: { color: p.palette.text.disabled },
2462
+ children: /* @__PURE__ */ e(f, { name: "x", size: "small" })
2463
+ }
2464
+ ) })
2465
+ ]
2466
+ }
2467
+ ) });
2468
+ }, Fs = ({
2469
+ isListening: r,
2470
+ onStop: n,
2471
+ text: t = "Listening... Speak now",
2472
+ sx: i
2473
+ }) => {
2474
+ const o = ee();
2475
+ return r ? /* @__PURE__ */ l(
2476
+ d,
2477
+ {
2478
+ sx: {
2479
+ mt: c.sm,
2480
+ display: "flex",
2481
+ alignItems: "center",
2482
+ justifyContent: "center",
2483
+ gap: c.sm,
2484
+ ...i
2485
+ },
2486
+ children: [
2487
+ /* @__PURE__ */ e(
2488
+ d,
2489
+ {
2490
+ sx: {
2491
+ width: 8,
2492
+ height: 8,
2493
+ borderRadius: v.circle,
2494
+ backgroundColor: h.colors.aiSecondary,
2495
+ animation: "listeningBlink 1s infinite",
2496
+ "@keyframes listeningBlink": {
2497
+ "0%, 100%": { opacity: 1 },
2498
+ "50%": { opacity: 0.3 }
2499
+ }
2500
+ }
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: t }),
2504
+ /* @__PURE__ */ e(
2505
+ z,
2506
+ {
2507
+ size: "small",
2508
+ onClick: n,
2509
+ sx: { color: o.palette.text.disabled },
2510
+ children: /* @__PURE__ */ e(f, { name: "x", size: "small" })
2511
+ }
2512
+ )
2513
+ ]
2514
+ }
2515
+ ) : null;
2516
+ }, Ze = ({
2517
+ label: r,
2518
+ description: n,
2519
+ icon: t,
2520
+ onClick: i,
2521
+ disabled: o = !1,
2522
+ variant: a = "default",
2523
+ sx: m
2524
+ }) => {
2525
+ const s = ee(), g = t ?? (a === "list" ? "forward" : "sparkles");
2526
+ if (a === "list")
2527
+ return /* @__PURE__ */ l(
2528
+ $e,
2529
+ {
2530
+ onClick: i,
2531
+ disabled: o,
2532
+ sx: {
2533
+ display: "flex",
2534
+ alignItems: "center",
2535
+ justifyContent: "flex-start",
2536
+ gap: c.md,
2537
+ width: "100%",
2538
+ textAlign: "left",
2539
+ py: c.md,
2540
+ px: c.base,
2541
+ borderRadius: v.md,
2542
+ backgroundColor: s.palette.mode === "dark" ? "action.hover" : "grey.100",
2543
+ cursor: o ? "not-allowed" : "pointer",
2544
+ opacity: o ? 0.5 : 1,
2545
+ transition: "background-color 0.2s ease",
2546
+ "&:hover": {
2547
+ backgroundColor: h.colors.aiHover
2548
+ },
2549
+ "&:focus-visible": {
2550
+ outline: `2px solid ${s.palette.primary.main}`,
2551
+ outlineOffset: 2
2552
+ },
2553
+ ...m
2554
+ },
2555
+ children: [
2556
+ /* @__PURE__ */ e(
2557
+ f,
2558
+ {
2559
+ name: g,
2560
+ size: "small",
2561
+ color: s.palette.primary.main,
2562
+ "aria-hidden": "true"
2563
+ }
2564
+ ),
2565
+ /* @__PURE__ */ e(
2566
+ u,
2567
+ {
2568
+ variant: "body2",
2569
+ color: "text.primary",
2570
+ sx: { fontWeight: 400 },
2571
+ children: r
2572
+ }
2573
+ )
2574
+ ]
2575
+ }
2576
+ );
2577
+ const p = () => {
2578
+ switch (a) {
2579
+ case "primary":
2580
+ return {
2581
+ backgroundColor: "primary.main",
2582
+ color: "primary.contrastText",
2583
+ border: "none",
2584
+ "&:hover": {
2585
+ backgroundColor: "primary.dark"
2586
+ }
2587
+ };
2588
+ case "outlined":
2589
+ return {
2590
+ backgroundColor: "transparent",
2591
+ color: "primary.main",
2592
+ border: 1,
2593
+ borderColor: "primary.main",
2594
+ "&:hover": {
2595
+ backgroundColor: h.colors.aiHover
2596
+ }
2597
+ };
2598
+ default:
2599
+ return {
2600
+ backgroundColor: "background.paper",
2601
+ color: "text.primary",
2602
+ border: 1,
2603
+ borderColor: "divider",
2604
+ "&:hover": {
2605
+ borderColor: "primary.main",
2606
+ backgroundColor: h.colors.aiHover
2607
+ }
2608
+ };
2609
+ }
2610
+ }, x = a === "primary", k = p();
2611
+ return /* @__PURE__ */ e(
2612
+ $e,
2613
+ {
2614
+ onClick: i,
2615
+ disabled: o,
2616
+ sx: {
2617
+ display: "block",
2618
+ width: "100%",
2619
+ textAlign: "left",
2620
+ p: c.md,
2621
+ borderRadius: v.md,
2622
+ cursor: o ? "not-allowed" : "pointer",
2623
+ opacity: o ? 0.5 : 1,
2624
+ transition: "all 0.2s ease",
2625
+ "&:focus-visible": {
2626
+ outline: `2px solid ${s.palette.primary.main}`,
2627
+ outlineOffset: 2
2628
+ },
2629
+ ...k,
2630
+ ...m
2631
+ },
2632
+ children: /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: c.md, children: [
2633
+ /* @__PURE__ */ e(
2634
+ d,
2635
+ {
2636
+ sx: {
2637
+ width: 36,
2638
+ height: 36,
2639
+ borderRadius: v.sm,
2640
+ backgroundColor: x ? "rgba(255, 255, 255, 0.2)" : h.colors.aiHover,
2641
+ display: "flex",
2642
+ alignItems: "center",
2643
+ justifyContent: "center",
2644
+ flexShrink: 0
2645
+ },
2646
+ children: /* @__PURE__ */ e(
2647
+ f,
2648
+ {
2649
+ name: g,
2650
+ size: "small",
2651
+ color: x ? s.palette.primary.contrastText : s.palette.primary.main,
2652
+ "aria-hidden": "true"
2653
+ }
2654
+ )
2655
+ }
2656
+ ),
2657
+ /* @__PURE__ */ l(d, { sx: { flex: 1, minWidth: 0 }, children: [
2658
+ /* @__PURE__ */ e(
2659
+ u,
2660
+ {
2661
+ variant: "body2",
2662
+ sx: {
2663
+ fontWeight: 500,
2664
+ color: x ? "primary.contrastText" : "text.primary"
2665
+ },
2666
+ children: r
2667
+ }
2668
+ ),
2669
+ n && /* @__PURE__ */ e(
2670
+ u,
2671
+ {
2672
+ variant: "caption",
2673
+ sx: {
2674
+ color: x ? "rgba(255, 255, 255, 0.8)" : "text.secondary",
2675
+ display: "block",
2676
+ mt: 0.25
2677
+ },
2678
+ children: n
2679
+ }
2680
+ )
2681
+ ] }),
2682
+ /* @__PURE__ */ e(
2683
+ f,
2684
+ {
2685
+ name: "chevron-right",
2686
+ size: "small",
2687
+ color: x ? s.palette.primary.contrastText : s.palette.text.disabled,
2688
+ "aria-hidden": "true"
2689
+ }
2690
+ )
2691
+ ] })
2692
+ }
2693
+ );
2694
+ }, Ms = ({
2695
+ label: r,
2696
+ icon: n,
2697
+ onClick: t,
2698
+ disabled: i = !1,
2699
+ size: o = "medium",
2700
+ variant: a = "default",
2701
+ showBadge: m = !1,
2702
+ badgeContent: s,
2703
+ sx: g
2704
+ }) => {
2705
+ const p = ee(), x = {
2706
+ small: 32,
2707
+ medium: 44,
2708
+ large: 56
2709
+ }, k = {
2710
+ small: "small",
2711
+ medium: "medium",
2712
+ large: "medium"
2713
+ }, b = () => {
2714
+ switch (a) {
2715
+ case "primary":
2716
+ return {
2717
+ backgroundColor: "primary.main",
2718
+ color: "primary.contrastText",
2719
+ "&:hover": {
2720
+ backgroundColor: "primary.dark"
2721
+ }
2722
+ };
2723
+ case "gradient":
2724
+ return {
2725
+ background: h.gradient.diagonal,
2726
+ color: "common.white",
2727
+ "&:hover": {
2728
+ opacity: 0.9
2729
+ }
2730
+ };
2731
+ default:
2732
+ return {
2733
+ backgroundColor: "background.paper",
2734
+ color: "primary.main",
2735
+ border: 1,
2736
+ borderColor: "divider",
2737
+ "&:hover": {
2738
+ borderColor: "primary.main",
2739
+ backgroundColor: h.colors.aiHover
2740
+ }
2741
+ };
2742
+ }
2743
+ }, y = /* @__PURE__ */ l(d, { sx: { position: "relative", display: "inline-flex" }, children: [
2744
+ /* @__PURE__ */ e(
2745
+ z,
2746
+ {
2747
+ onClick: t,
2748
+ disabled: i,
2749
+ "aria-label": r,
2750
+ sx: {
2751
+ width: x[o],
2752
+ height: x[o],
2753
+ transition: "all 0.2s ease",
2754
+ "&:focus-visible": {
2755
+ outline: `2px solid ${p.palette.primary.main}`,
2756
+ outlineOffset: 2
2757
+ },
2758
+ ...b(),
2759
+ ...g
2760
+ },
2761
+ children: /* @__PURE__ */ e(f, { name: n, size: k[o], "aria-hidden": "true" })
2762
+ }
2763
+ ),
2764
+ m && /* @__PURE__ */ e(
2765
+ d,
2766
+ {
2767
+ sx: {
2768
+ position: "absolute",
2769
+ top: -4,
2770
+ right: -4,
2771
+ minWidth: 18,
2772
+ height: 18,
2773
+ borderRadius: v.circle,
2774
+ backgroundColor: "secondary.main",
2775
+ color: "common.white",
2776
+ // Use MUI theme
2777
+ fontSize: X.typography.dense.badge,
2778
+ // 10px badge text
2779
+ fontWeight: 600,
2780
+ display: "flex",
2781
+ alignItems: "center",
2782
+ justifyContent: "center",
2783
+ padding: "0 4px"
2784
+ },
2785
+ children: s
2786
+ }
2787
+ )
2788
+ ] });
2789
+ return r ? /* @__PURE__ */ e(P, { title: r, children: y }) : y;
2790
+ }, Ts = ({
2791
+ actions: r,
2792
+ direction: n = "column",
2793
+ spacing: t = 1,
2794
+ sx: i
2795
+ }) => /* @__PURE__ */ e(C, { direction: n, spacing: t, sx: i, children: r.map((o, a) => /* @__PURE__ */ e(Ze, { ...o }, a)) }), Bs = ({
2796
+ title: r,
2797
+ subtitle: n,
2798
+ headerActions: t,
2799
+ showAvatar: i = !1,
2800
+ children: o,
2801
+ bordered: a = !0,
2802
+ filled: m = !1,
2803
+ padded: s = !0,
2804
+ sx: g
2805
+ }) => {
2806
+ const p = r || n || t || i;
2807
+ return /* @__PURE__ */ l(
2808
+ Y,
2809
+ {
2810
+ elevation: 0,
2811
+ sx: {
2812
+ borderRadius: v.lg,
2813
+ border: a ? `1px solid ${h.colors.aiBorder}` : "none",
2814
+ backgroundColor: m ? h.colors.aiBackground : "transparent",
2815
+ overflow: "hidden",
2816
+ ...g
2817
+ },
2818
+ children: [
2819
+ p && /* @__PURE__ */ e(
2820
+ d,
2821
+ {
2822
+ sx: {
2823
+ p: s ? c.base : 0,
2824
+ borderBottom: a ? `1px solid ${h.colors.aiBorder}` : "none",
2825
+ backgroundColor: m ? h.colors.aiHover : "transparent"
2826
+ },
2827
+ children: /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", justifyContent: "space-between", children: [
2828
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1.5, children: [
2829
+ i && /* @__PURE__ */ e(de, { size: "small" }),
2830
+ /* @__PURE__ */ l(d, { children: [
2831
+ r && /* @__PURE__ */ e(u, { variant: "subtitle2", sx: { fontWeight: 600 }, children: r }),
2832
+ n && /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: n })
2833
+ ] })
2834
+ ] }),
2835
+ t && /* @__PURE__ */ e(d, { children: t })
2836
+ ] })
2837
+ }
2838
+ ),
2839
+ /* @__PURE__ */ e(d, { sx: { p: s ? c.base : 0 }, children: o })
2840
+ ]
2841
+ }
2842
+ );
2843
+ }, Ds = ({
2844
+ title: r,
2845
+ subtitle: n,
2846
+ icon: t,
2847
+ children: i,
2848
+ defaultExpanded: o = !1,
2849
+ expanded: a,
2850
+ onChange: m,
2851
+ sx: s
2852
+ }) => {
2853
+ const [g, p] = R(o), x = a !== void 0 ? a : g;
2854
+ return /* @__PURE__ */ l(d, { sx: s, children: [
2855
+ /* @__PURE__ */ l(
2856
+ d,
2857
+ {
2858
+ onClick: () => {
2859
+ const b = !x;
2860
+ a === void 0 && p(b), m?.(b);
2861
+ },
2862
+ sx: {
2863
+ display: "flex",
2864
+ alignItems: "center",
2865
+ justifyContent: "space-between",
2866
+ py: 1.5,
2867
+ px: c.base,
2868
+ cursor: "pointer",
2869
+ borderRadius: x ? `${v.md} ${v.md} 0 0` : v.md,
2870
+ backgroundColor: h.colors.aiHover,
2871
+ transition: "all 0.2s ease",
2872
+ "&:hover": {
2873
+ backgroundColor: h.colors.aiHoverDark
2874
+ }
2875
+ },
2876
+ children: [
2877
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1.5, children: [
2878
+ t && /* @__PURE__ */ e(f, { name: t, size: "small", color: h.colors.aiPrimary }),
2879
+ /* @__PURE__ */ l(d, { children: [
2880
+ /* @__PURE__ */ e(u, { variant: "body2", sx: { fontWeight: 500 }, children: r }),
2881
+ n && /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: n })
2882
+ ] })
2883
+ ] }),
2884
+ /* @__PURE__ */ e(z, { size: "small", sx: { ml: 1 }, children: /* @__PURE__ */ e(
2885
+ f,
2886
+ {
2887
+ name: x ? "chevron-up" : "chevron-down",
2888
+ size: "small",
2889
+ color: "text.secondary"
2890
+ }
2891
+ ) })
2892
+ ]
2893
+ }
2894
+ ),
2895
+ /* @__PURE__ */ e(J, { in: x, children: /* @__PURE__ */ e(
2896
+ d,
2897
+ {
2898
+ sx: {
2899
+ p: c.base,
2900
+ borderRadius: `0 0 ${v.md} ${v.md}`,
2901
+ background: h.gradient.subtle,
2902
+ border: `1px solid ${h.colors.aiBorder}`,
2903
+ borderTop: "none"
2904
+ },
2905
+ children: i
2906
+ }
2907
+ ) })
2908
+ ] });
2909
+ }, Ls = ({
2910
+ name: r,
2911
+ description: n,
2912
+ avatar: t,
2913
+ capabilities: i = [],
2914
+ selected: o = !1,
2915
+ onClick: a,
2916
+ sx: m
2917
+ }) => /* @__PURE__ */ e(
2918
+ Y,
2919
+ {
2920
+ elevation: 0,
2921
+ onClick: a,
2922
+ sx: {
2923
+ p: c.base,
2924
+ borderRadius: v.lg,
2925
+ border: o ? `2px solid ${h.colors.aiPrimary}` : "2px solid",
2926
+ // @intentional-color: AI primary when selected
2927
+ borderColor: o ? void 0 : "divider",
2928
+ backgroundColor: o ? h.colors.aiHover : "background.paper",
2929
+ // @intentional-color: AI hover when selected
2930
+ cursor: a ? "pointer" : "default",
2931
+ transition: "all 0.2s ease",
2932
+ "&:hover": a ? {
2933
+ borderColor: h.colors.aiPrimary,
2934
+ backgroundColor: h.colors.aiHover
2935
+ } : {},
2936
+ ...m
2937
+ },
2938
+ children: /* @__PURE__ */ l(C, { direction: "row", spacing: 2, alignItems: "flex-start", children: [
2939
+ t || /* @__PURE__ */ e(de, { size: "medium" }),
2940
+ /* @__PURE__ */ l(d, { sx: { flex: 1, minWidth: 0 }, children: [
2941
+ /* @__PURE__ */ e(u, { variant: "subtitle2", sx: { fontWeight: 600 }, children: r }),
2942
+ n && /* @__PURE__ */ e(
2943
+ u,
2944
+ {
2945
+ variant: "body2",
2946
+ color: "text.secondary",
2947
+ sx: {
2948
+ mt: 0.5,
2949
+ display: "-webkit-box",
2950
+ WebkitLineClamp: 2,
2951
+ WebkitBoxOrient: "vertical",
2952
+ overflow: "hidden"
2953
+ },
2954
+ children: n
2955
+ }
2956
+ ),
2957
+ i.length > 0 && /* @__PURE__ */ l(G, { children: [
2958
+ /* @__PURE__ */ e(ue, { sx: { my: 1.5 } }),
2959
+ /* @__PURE__ */ e(C, { direction: "row", spacing: 0.5, flexWrap: "wrap", useFlexGap: !0, children: i.map((s, g) => /* @__PURE__ */ e(
2960
+ te,
2961
+ {
2962
+ label: s,
2963
+ size: "small",
2964
+ sx: {
2965
+ height: "auto",
2966
+ px: 0.5,
2967
+ py: 0.25,
2968
+ borderRadius: v.sm,
2969
+ backgroundColor: h.colors.aiBackgroundDark,
2970
+ color: h.colors.aiPrimary,
2971
+ fontSize: "0.6875rem",
2972
+ fontWeight: 500,
2973
+ "& .MuiChip-label": {
2974
+ px: 0.5,
2975
+ py: 0
2976
+ }
2977
+ }
2978
+ },
2979
+ g
2980
+ )) })
2981
+ ] })
2982
+ ] }),
2983
+ o && /* @__PURE__ */ e(
2984
+ d,
2985
+ {
2986
+ sx: {
2987
+ width: 24,
2988
+ height: 24,
2989
+ borderRadius: v.circle,
2990
+ backgroundColor: h.colors.aiPrimary,
2991
+ display: "flex",
2992
+ alignItems: "center",
2993
+ justifyContent: "center",
2994
+ flexShrink: 0
2995
+ },
2996
+ children: /* @__PURE__ */ e(f, { name: "check", size: "small", color: "#FFFFFF" })
2997
+ }
2998
+ )
2999
+ ] })
3000
+ }
3001
+ ), he = {
3002
+ success: "#24a148",
3003
+ error: "#da1e28"
3004
+ }, Es = ({
3005
+ children: r,
3006
+ startColor: n = h.colors.aiPrimary,
3007
+ endColor: t = h.colors.aiSecondary,
3008
+ direction: i = "135deg",
3009
+ variant: o = "h6",
3010
+ fontWeight: a = 600,
3011
+ sx: m
3012
+ }) => /* @__PURE__ */ e(
3013
+ u,
3014
+ {
3015
+ variant: o,
3016
+ sx: {
3017
+ fontWeight: a,
3018
+ background: `linear-gradient(${i}, ${n} 0%, ${t} 100%)`,
3019
+ backgroundClip: "text",
3020
+ WebkitBackgroundClip: "text",
3021
+ WebkitTextFillColor: "transparent",
3022
+ ...m
3023
+ },
3024
+ children: r
3025
+ }
3026
+ ), Hs = ({
3027
+ label: r,
3028
+ value: n,
3029
+ icon: t,
3030
+ trend: i,
3031
+ trendLabel: o,
3032
+ variant: a = "default",
3033
+ size: m = "medium",
3034
+ sx: s
3035
+ }) => {
3036
+ const g = {
3037
+ small: { p: 1.5, valueSize: "h6", labelSize: "caption" },
3038
+ medium: { p: 2, valueSize: "h5", labelSize: "body2" },
3039
+ large: { p: 3, valueSize: "h4", labelSize: "body1" }
3040
+ }, p = () => {
3041
+ switch (a) {
3042
+ case "gradient":
3043
+ return {
3044
+ background: `linear-gradient(135deg, ${h.colors.aiPrimary} 0%, ${h.colors.aiSecondary} 100%)`,
3045
+ color: "common.white",
3046
+ // Use MUI theme
3047
+ border: "none"
3048
+ };
3049
+ case "outlined":
3050
+ return {
3051
+ backgroundColor: "transparent",
3052
+ border: "1px solid",
3053
+ // Uses MUI theme divider
3054
+ borderColor: "divider"
3055
+ };
3056
+ default:
3057
+ return {
3058
+ backgroundColor: "background.paper",
3059
+ // Use MUI theme
3060
+ border: "1px solid",
3061
+ borderColor: "divider"
3062
+ };
3063
+ }
3064
+ }, x = g[m];
3065
+ return /* @__PURE__ */ e(
3066
+ Y,
3067
+ {
3068
+ elevation: 0,
3069
+ sx: {
3070
+ p: x.p,
3071
+ borderRadius: v.lg,
3072
+ ...p(),
3073
+ ...s
3074
+ },
3075
+ children: /* @__PURE__ */ l(C, { spacing: 1, children: [
3076
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", justifyContent: "space-between", children: [
3077
+ /* @__PURE__ */ e(
3078
+ u,
3079
+ {
3080
+ variant: x.labelSize,
3081
+ sx: {
3082
+ color: a === "gradient" ? "rgba(255, 255, 255, 0.8)" : "text.secondary",
3083
+ fontWeight: 500
3084
+ },
3085
+ children: r
3086
+ }
3087
+ ),
3088
+ t && /* @__PURE__ */ e(
3089
+ d,
3090
+ {
3091
+ sx: {
3092
+ width: m === "small" ? 28 : 36,
3093
+ height: m === "small" ? 28 : 36,
3094
+ borderRadius: v.sm,
3095
+ backgroundColor: a === "gradient" ? "rgba(255, 255, 255, 0.2)" : h.colors.aiHover,
3096
+ display: "flex",
3097
+ alignItems: "center",
3098
+ justifyContent: "center"
3099
+ },
3100
+ children: /* @__PURE__ */ e(
3101
+ f,
3102
+ {
3103
+ name: t,
3104
+ size: "small",
3105
+ color: a === "gradient" ? "#FFFFFF" : h.colors.aiPrimary
3106
+ }
3107
+ )
3108
+ }
3109
+ )
3110
+ ] }),
3111
+ /* @__PURE__ */ e(
3112
+ u,
3113
+ {
3114
+ variant: x.valueSize,
3115
+ sx: {
3116
+ fontWeight: 700,
3117
+ color: a === "gradient" ? "common.white" : "text.primary"
3118
+ // Use MUI theme
3119
+ },
3120
+ children: n
3121
+ }
3122
+ ),
3123
+ i !== void 0 && /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 0.5, children: [
3124
+ /* @__PURE__ */ e(
3125
+ f,
3126
+ {
3127
+ name: i >= 0 ? "trending-up" : "trending-down",
3128
+ size: "small",
3129
+ color: a === "gradient" ? "#FFFFFF" : i >= 0 ? he.success : he.error
3130
+ }
3131
+ ),
3132
+ /* @__PURE__ */ l(
3133
+ u,
3134
+ {
3135
+ variant: "caption",
3136
+ sx: {
3137
+ color: a === "gradient" ? "common.white" : i >= 0 ? he.success : he.error,
3138
+ fontWeight: 500
3139
+ },
3140
+ children: [
3141
+ i >= 0 ? "+" : "",
3142
+ i,
3143
+ "%"
3144
+ ]
3145
+ }
3146
+ ),
3147
+ o && /* @__PURE__ */ e(
3148
+ u,
3149
+ {
3150
+ variant: "caption",
3151
+ sx: {
3152
+ color: a === "gradient" ? "rgba(255, 255, 255, 0.7)" : "text.secondary"
3153
+ },
3154
+ children: o
3155
+ }
3156
+ )
3157
+ ] })
3158
+ ] })
3159
+ }
3160
+ );
3161
+ }, Os = ({
3162
+ icon: r,
3163
+ size: n = "medium",
3164
+ startColor: t = h.colors.aiPrimary,
3165
+ endColor: i = h.colors.aiSecondary,
3166
+ label: o,
3167
+ sx: a
3168
+ }) => {
3169
+ const s = {
3170
+ small: { container: 32, icon: "small" },
3171
+ medium: { container: 44, icon: "medium" },
3172
+ large: { container: 56, icon: "medium" }
3173
+ }[n];
3174
+ return /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, sx: a, children: [
3175
+ /* @__PURE__ */ e(
3176
+ d,
3177
+ {
3178
+ sx: {
3179
+ width: s.container,
3180
+ height: s.container,
3181
+ borderRadius: v.md,
3182
+ background: `linear-gradient(135deg, ${t} 0%, ${i} 100%)`,
3183
+ display: "flex",
3184
+ alignItems: "center",
3185
+ justifyContent: "center",
3186
+ boxShadow: `0 4px 12px ${t}33`
3187
+ },
3188
+ children: /* @__PURE__ */ e(f, { name: r, size: s.icon, color: "#FFFFFF" })
3189
+ }
3190
+ ),
3191
+ o && /* @__PURE__ */ e(u, { variant: "body2", sx: { fontWeight: 500 }, children: o })
3192
+ ] });
3193
+ }, js = ({
3194
+ width: r = "100%",
3195
+ height: n = 20,
3196
+ borderRadius: t = v.sm,
3197
+ sx: i
3198
+ }) => /* @__PURE__ */ e(
3199
+ d,
3200
+ {
3201
+ sx: {
3202
+ width: r,
3203
+ height: n,
3204
+ borderRadius: t,
3205
+ background: `linear-gradient(
3206
+ 90deg,
3207
+ ${h.colors.aiBackground} 0%,
3208
+ ${h.colors.aiHover} 50%,
3209
+ ${h.colors.aiBackground} 100%
3210
+ )`,
3211
+ backgroundSize: "200% 100%",
3212
+ animation: "shimmer 1.5s infinite",
3213
+ "@keyframes shimmer": {
3214
+ "0%": { backgroundPosition: "200% 0" },
3215
+ "100%": { backgroundPosition: "-200% 0" }
3216
+ },
3217
+ ...i
3218
+ }
3219
+ }
3220
+ );
3221
+ function Tt(r) {
3222
+ return r.type === "text";
3223
+ }
3224
+ function Bt(r) {
3225
+ return r.type === "table";
3226
+ }
3227
+ function Dt(r) {
3228
+ return r.type === "chart";
3229
+ }
3230
+ function Lt(r) {
3231
+ return r.type === "image";
3232
+ }
3233
+ function Et(r) {
3234
+ return r.type === "form";
3235
+ }
3236
+ function Ht(r) {
3237
+ return r.type === "actions";
3238
+ }
3239
+ const Ot = ({
3240
+ content: r,
3241
+ markdown: n = !1,
3242
+ variant: t = "body",
3243
+ id: i,
3244
+ sx: o
3245
+ }) => n ? /* @__PURE__ */ e(
3246
+ Ut,
3247
+ {
3248
+ content: r,
3249
+ variant: t,
3250
+ id: i,
3251
+ sx: o
3252
+ }
3253
+ ) : /* @__PURE__ */ e(
3254
+ jt,
3255
+ {
3256
+ content: r,
3257
+ variant: t,
3258
+ id: i,
3259
+ sx: o
3260
+ }
3261
+ ), jt = ({
3262
+ content: r,
3263
+ variant: n = "body",
3264
+ id: t,
3265
+ sx: i
3266
+ }) => {
3267
+ const { typographyVariant: o, component: a } = qt(n), m = Nt(n);
3268
+ return /* @__PURE__ */ e(
3269
+ u,
3270
+ {
3271
+ id: t,
3272
+ variant: o,
3273
+ component: a,
3274
+ color: "text.primary",
3275
+ sx: [
3276
+ { whiteSpace: "pre-wrap" },
3277
+ m,
3278
+ ...Array.isArray(i) ? i : [i]
3279
+ ],
3280
+ children: r
3281
+ }
3282
+ );
3283
+ }, Ut = ({
3284
+ content: r,
3285
+ variant: n = "body",
3286
+ id: t,
3287
+ sx: i
3288
+ }) => {
3289
+ const o = Vt(r);
3290
+ return /* @__PURE__ */ e(
3291
+ d,
3292
+ {
3293
+ id: t,
3294
+ component: "div",
3295
+ sx: {
3296
+ "& > *:first-of-type": { mt: 0 },
3297
+ "& > *:last-child": { mb: 0 },
3298
+ ...i
3299
+ },
3300
+ children: o.map((a, m) => /* @__PURE__ */ e(Gt, { element: a, variant: n }, m))
3301
+ }
3302
+ );
3303
+ };
3304
+ function Vt(r) {
3305
+ const n = r.split(`
3306
+ `), t = [];
3307
+ let i = [], o = null;
3308
+ const a = () => {
3309
+ i.length > 0 && (t.push({
3310
+ type: "paragraph",
3311
+ content: i.join(`
3312
+ `)
3313
+ }), i = []);
3314
+ }, m = () => {
3315
+ o && (t.push({
3316
+ type: o.type === "bullet" ? "bullet-list" : "numbered-list",
3317
+ content: "",
3318
+ items: o.items
3319
+ }), o = null);
3320
+ };
3321
+ for (let s = 0; s < n.length; s++) {
3322
+ const g = n[s], p = g.trim();
3323
+ if (p === "") {
3324
+ a(), m();
3325
+ continue;
3326
+ }
3327
+ if (/^-{3,}$/.test(p) || /^\*{3,}$/.test(p)) {
3328
+ a(), m(), t.push({ type: "hr", content: "" });
3329
+ continue;
3330
+ }
3331
+ const x = p.match(/^(#{1,6})\s+(.+)$/);
3332
+ if (x) {
3333
+ a(), m(), t.push({
3334
+ type: "heading",
3335
+ level: x[1].length,
3336
+ content: x[2]
3337
+ });
3338
+ continue;
3339
+ }
3340
+ if (p.startsWith(">")) {
3341
+ a(), m(), t.push({
3342
+ type: "blockquote",
3343
+ content: p.slice(1).trim()
3344
+ });
3345
+ continue;
3346
+ }
3347
+ const k = p.match(/^[-*+]\s+(.+)$/);
3348
+ if (k) {
3349
+ a(), (!o || o.type !== "bullet") && (m(), o = { type: "bullet", items: [] }), o.items.push(k[1]);
3350
+ continue;
3351
+ }
3352
+ const b = p.match(/^\d+\.\s+(.+)$/);
3353
+ if (b) {
3354
+ a(), (!o || o.type !== "numbered") && (m(), o = { type: "numbered", items: [] }), o.items.push(b[1]);
3355
+ continue;
3356
+ }
3357
+ if (p.startsWith("```")) {
3358
+ a(), m();
3359
+ const y = [];
3360
+ for (s++; s < n.length && !n[s].trim().startsWith("```"); )
3361
+ y.push(n[s]), s++;
3362
+ t.push({
3363
+ type: "code-block",
3364
+ content: y.join(`
3365
+ `)
3366
+ });
3367
+ continue;
3368
+ }
3369
+ m(), i.push(g);
3370
+ }
3371
+ return a(), m(), t;
3372
+ }
3373
+ const Gt = ({ element: r, variant: n }) => {
3374
+ switch (r.type) {
3375
+ case "paragraph":
3376
+ return /* @__PURE__ */ e(
3377
+ u,
3378
+ {
3379
+ variant: "body2",
3380
+ component: "p",
3381
+ color: "text.primary",
3382
+ sx: { mb: 1.5 },
3383
+ children: /* @__PURE__ */ e(le, { content: r.content })
3384
+ }
3385
+ );
3386
+ case "heading": {
3387
+ const t = Kt(r.level || 1);
3388
+ return /* @__PURE__ */ e(
3389
+ u,
3390
+ {
3391
+ variant: t,
3392
+ component: `h${Math.min(r.level || 1, 6)}`,
3393
+ color: "text.primary",
3394
+ sx: { mt: 2, mb: 1 },
3395
+ children: /* @__PURE__ */ e(le, { content: r.content })
3396
+ }
3397
+ );
3398
+ }
3399
+ case "bullet-list":
3400
+ return /* @__PURE__ */ e(
3401
+ d,
3402
+ {
3403
+ component: "ul",
3404
+ sx: {
3405
+ pl: 2.5,
3406
+ my: 1,
3407
+ "& li": {
3408
+ mb: 0.5
3409
+ }
3410
+ },
3411
+ children: r.items?.map((t, i) => /* @__PURE__ */ e(u, { component: "li", variant: "body2", color: "text.primary", children: /* @__PURE__ */ e(le, { content: t }) }, i))
3412
+ }
3413
+ );
3414
+ case "numbered-list":
3415
+ return /* @__PURE__ */ e(
3416
+ d,
3417
+ {
3418
+ component: "ol",
3419
+ sx: {
3420
+ pl: 2.5,
3421
+ my: 1,
3422
+ "& li": {
3423
+ mb: 0.5
3424
+ }
3425
+ },
3426
+ children: r.items?.map((t, i) => /* @__PURE__ */ e(u, { component: "li", variant: "body2", color: "text.primary", children: /* @__PURE__ */ e(le, { content: t }) }, i))
3427
+ }
3428
+ );
3429
+ case "blockquote":
3430
+ return /* @__PURE__ */ e(
3431
+ d,
3432
+ {
3433
+ component: "blockquote",
3434
+ sx: {
3435
+ borderLeft: 3,
3436
+ borderColor: "divider",
3437
+ pl: 2,
3438
+ my: 1.5,
3439
+ fontStyle: "italic"
3440
+ },
3441
+ children: /* @__PURE__ */ e(u, { variant: "body2", color: "text.secondary", children: /* @__PURE__ */ e(le, { content: r.content }) })
3442
+ }
3443
+ );
3444
+ case "hr":
3445
+ return /* @__PURE__ */ e(
3446
+ d,
3447
+ {
3448
+ component: "hr",
3449
+ sx: {
3450
+ border: "none",
3451
+ borderTop: 1,
3452
+ borderColor: "divider",
3453
+ my: 2
3454
+ }
3455
+ }
3456
+ );
3457
+ case "code-block":
3458
+ return /* @__PURE__ */ e(
3459
+ d,
3460
+ {
3461
+ component: "pre",
3462
+ sx: {
3463
+ backgroundColor: "action.hover",
3464
+ borderRadius: v.xs,
3465
+ p: 1.5,
3466
+ my: 1.5,
3467
+ overflow: "auto"
3468
+ },
3469
+ children: /* @__PURE__ */ e(
3470
+ u,
3471
+ {
3472
+ component: "code",
3473
+ variant: "body2",
3474
+ sx: {
3475
+ fontFamily: "monospace",
3476
+ fontSize: "0.85em"
3477
+ },
3478
+ children: r.content
3479
+ }
3480
+ )
3481
+ }
3482
+ );
3483
+ default:
3484
+ return null;
3485
+ }
3486
+ }, le = ({ content: r }) => {
3487
+ const n = _t(r);
3488
+ return /* @__PURE__ */ e(G, { children: n.map((t, i) => {
3489
+ switch (t.type) {
3490
+ case "text":
3491
+ return /* @__PURE__ */ e(Ae.Fragment, { children: t.content }, i);
3492
+ case "bold":
3493
+ return /* @__PURE__ */ e("strong", { children: t.content }, i);
3494
+ case "italic":
3495
+ return /* @__PURE__ */ e("em", { children: t.content }, i);
3496
+ case "code":
3497
+ return /* @__PURE__ */ e(
3498
+ u,
3499
+ {
3500
+ component: "code",
3501
+ sx: {
3502
+ backgroundColor: "action.hover",
3503
+ borderRadius: v.xs,
3504
+ px: 0.5,
3505
+ fontFamily: "monospace",
3506
+ fontSize: "0.9em"
3507
+ },
3508
+ children: t.content
3509
+ },
3510
+ i
3511
+ );
3512
+ case "link":
3513
+ return /* @__PURE__ */ e(
3514
+ Ge,
3515
+ {
3516
+ href: t.url,
3517
+ target: "_blank",
3518
+ rel: "noopener noreferrer",
3519
+ underline: "hover",
3520
+ children: t.content
3521
+ },
3522
+ i
3523
+ );
3524
+ default:
3525
+ return /* @__PURE__ */ e(Ae.Fragment, { children: t.content }, i);
3526
+ }
3527
+ }) });
3528
+ };
3529
+ function _t(r) {
3530
+ const n = [], t = [
3531
+ { regex: /\*\*(.+?)\*\*/g, type: "bold" },
3532
+ { regex: /\*(.+?)\*/g, type: "italic" },
3533
+ { regex: /`(.+?)`/g, type: "code" },
3534
+ { regex: /\[(.+?)\]\((.+?)\)/g, type: "link" }
3535
+ ], i = [];
3536
+ for (const { regex: a, type: m } of t) {
3537
+ let s;
3538
+ for (a.lastIndex = 0; (s = a.exec(r)) !== null; )
3539
+ i.push({
3540
+ start: s.index,
3541
+ end: s.index + s[0].length,
3542
+ type: m,
3543
+ content: s[1],
3544
+ url: m === "link" ? s[2] : void 0
3545
+ });
3546
+ }
3547
+ i.sort((a, m) => a.start - m.start);
3548
+ let o = 0;
3549
+ for (const a of i)
3550
+ a.start < o || (a.start > o && n.push({
3551
+ type: "text",
3552
+ content: r.slice(o, a.start)
3553
+ }), n.push({
3554
+ type: a.type,
3555
+ content: a.content,
3556
+ url: a.url
3557
+ }), o = a.end);
3558
+ return o < r.length && n.push({
3559
+ type: "text",
3560
+ content: r.slice(o)
3561
+ }), n.length > 0 ? n : [{ type: "text", content: r }];
3562
+ }
3563
+ function qt(r) {
3564
+ switch (r) {
3565
+ case "heading":
3566
+ return {
3567
+ typographyVariant: "h6",
3568
+ component: "h3"
3569
+ };
3570
+ case "caption":
3571
+ return {
3572
+ typographyVariant: "caption",
3573
+ component: "p"
3574
+ };
3575
+ case "quote":
3576
+ return {
3577
+ typographyVariant: "body2",
3578
+ component: "blockquote"
3579
+ };
3580
+ default:
3581
+ return {
3582
+ typographyVariant: "body2",
3583
+ component: "p"
3584
+ };
3585
+ }
3586
+ }
3587
+ function Nt(r) {
3588
+ switch (r) {
3589
+ case "heading":
3590
+ return { fontWeight: 600, mb: 1 };
3591
+ case "caption":
3592
+ return { color: "text.secondary" };
3593
+ case "quote":
3594
+ return {
3595
+ borderLeft: 3,
3596
+ borderColor: "divider",
3597
+ pl: 2,
3598
+ fontStyle: "italic",
3599
+ color: "text.secondary"
3600
+ };
3601
+ default:
3602
+ return {};
3603
+ }
3604
+ }
3605
+ function Kt(r) {
3606
+ switch (r) {
3607
+ case 1:
3608
+ return "h4";
3609
+ case 2:
3610
+ return "h5";
3611
+ case 3:
3612
+ return "h6";
3613
+ case 4:
3614
+ return "subtitle1";
3615
+ case 5:
3616
+ return "subtitle2";
3617
+ default:
3618
+ return "body1";
3619
+ }
3620
+ }
3621
+ const Qt = ({
3622
+ response: r,
3623
+ blockGap: n = c.sm
3624
+ }) => {
3625
+ const { blocks: t } = r;
3626
+ return !t || t.length === 0 ? null : /* @__PURE__ */ e(
3627
+ d,
3628
+ {
3629
+ sx: {
3630
+ display: "flex",
3631
+ flexDirection: "column",
3632
+ gap: `${n}px`
3633
+ },
3634
+ children: t.map((i, o) => /* @__PURE__ */ e(
3635
+ Zt,
3636
+ {
3637
+ block: i
3638
+ },
3639
+ i.id ?? `block-${o}`
3640
+ ))
3641
+ }
3642
+ );
3643
+ }, Zt = ({ block: r }) => Tt(r) ? /* @__PURE__ */ e(
3644
+ Ot,
3645
+ {
3646
+ content: r.content,
3647
+ markdown: r.markdown,
3648
+ variant: r.variant,
3649
+ id: r.id
3650
+ }
3651
+ ) : Bt(r) ? /* @__PURE__ */ e(se, { type: "table" }) : Dt(r) ? /* @__PURE__ */ e(se, { type: "chart" }) : Lt(r) ? /* @__PURE__ */ e(se, { type: "image" }) : Et(r) ? /* @__PURE__ */ e(se, { type: "form" }) : Ht(r) ? /* @__PURE__ */ e(se, { type: "actions" }) : (console.warn(`[AIResponseRenderer] Unknown block type: ${r.type}`), null), se = ({ type: r }) => process.env.NODE_ENV === "production" ? null : /* @__PURE__ */ e(
3652
+ d,
3653
+ {
3654
+ sx: {
3655
+ p: 2,
3656
+ border: "1px dashed",
3657
+ borderColor: "warning.main",
3658
+ borderRadius: v.xs,
3659
+ backgroundColor: "warning.lighter"
3660
+ },
3661
+ children: /* @__PURE__ */ l(u, { variant: "caption", color: "warning.main", children: [
3662
+ "[",
3663
+ r.toUpperCase(),
3664
+ " block - not yet implemented]"
3665
+ ] })
3666
+ }
3667
+ ), Ue = ({
3668
+ response: r,
3669
+ children: n,
3670
+ timestamp: t,
3671
+ avatar: i,
3672
+ showCopy: o = !0,
3673
+ showFeedback: a = !0,
3674
+ showShare: m = !0,
3675
+ showDownload: s = !0,
3676
+ onCopy: g,
3677
+ onFeedback: p,
3678
+ onShare: x,
3679
+ onDownload: k,
3680
+ sx: b
3681
+ }) => {
3682
+ const y = o || a || m || s, I = r ? /* @__PURE__ */ e(Qt, { response: r }) : n;
3683
+ return !r && !n ? null : /* @__PURE__ */ l(
3684
+ d,
3685
+ {
3686
+ sx: {
3687
+ display: "flex",
3688
+ gap: c.md,
3689
+ py: c.sm,
3690
+ ...b
3691
+ },
3692
+ children: [
3693
+ /* @__PURE__ */ e(d, { sx: { flexShrink: 0, pt: 0.5 }, children: i || /* @__PURE__ */ e(de, { size: "small" }) }),
3694
+ /* @__PURE__ */ l(d, { sx: { flex: 1, minWidth: 0 }, children: [
3695
+ /* @__PURE__ */ e(d, { sx: { mb: y || t ? c.sm : 0 }, children: I }),
3696
+ (y || t) && /* @__PURE__ */ l(
3697
+ C,
3698
+ {
3699
+ direction: "row",
3700
+ alignItems: "center",
3701
+ justifyContent: "space-between",
3702
+ sx: { pt: c.xs },
3703
+ children: [
3704
+ t && /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", children: t }),
3705
+ y && /* @__PURE__ */ l(C, { direction: "row", spacing: 0.5, sx: { ml: "auto" }, children: [
3706
+ o && /* @__PURE__ */ e(P, { title: "Copy", children: /* @__PURE__ */ e(
3707
+ z,
3708
+ {
3709
+ size: "small",
3710
+ onClick: g,
3711
+ "aria-label": "Copy response",
3712
+ sx: {
3713
+ color: "text.disabled",
3714
+ "&:hover": {
3715
+ color: "text.secondary",
3716
+ backgroundColor: "action.hover"
3717
+ }
3718
+ },
3719
+ children: /* @__PURE__ */ e(f, { name: "copy", size: "small" })
3720
+ }
3721
+ ) }),
3722
+ a && /* @__PURE__ */ l(G, { children: [
3723
+ /* @__PURE__ */ e(P, { title: "Good response", children: /* @__PURE__ */ e(
3724
+ z,
3725
+ {
3726
+ size: "small",
3727
+ onClick: () => p?.(!0),
3728
+ "aria-label": "Mark as good response",
3729
+ sx: {
3730
+ color: "text.disabled",
3731
+ "&:hover": {
3732
+ color: "success.main",
3733
+ backgroundColor: "action.hover"
3734
+ }
3735
+ },
3736
+ children: /* @__PURE__ */ e(f, { name: "thumbs-up", size: "small" })
3737
+ }
3738
+ ) }),
3739
+ /* @__PURE__ */ e(P, { title: "Poor response", children: /* @__PURE__ */ e(
3740
+ z,
3741
+ {
3742
+ size: "small",
3743
+ onClick: () => p?.(!1),
3744
+ "aria-label": "Mark as poor response",
3745
+ sx: {
3746
+ color: "text.disabled",
3747
+ "&:hover": {
3748
+ color: "error.main",
3749
+ backgroundColor: "action.hover"
3750
+ }
3751
+ },
3752
+ children: /* @__PURE__ */ e(f, { name: "thumbs-down", size: "small" })
3753
+ }
3754
+ ) })
3755
+ ] }),
3756
+ m && /* @__PURE__ */ e(P, { title: "Share", children: /* @__PURE__ */ e(
3757
+ z,
3758
+ {
3759
+ size: "small",
3760
+ onClick: x,
3761
+ "aria-label": "Share response",
3762
+ sx: {
3763
+ color: "text.disabled",
3764
+ "&:hover": {
3765
+ color: "text.secondary",
3766
+ backgroundColor: "action.hover"
3767
+ }
3768
+ },
3769
+ children: /* @__PURE__ */ e(f, { name: "share", size: "small" })
3770
+ }
3771
+ ) }),
3772
+ s && /* @__PURE__ */ e(P, { title: "Download", children: /* @__PURE__ */ e(
3773
+ z,
3774
+ {
3775
+ size: "small",
3776
+ onClick: k,
3777
+ "aria-label": "Download response",
3778
+ sx: {
3779
+ color: "text.disabled",
3780
+ "&:hover": {
3781
+ color: "text.secondary",
3782
+ backgroundColor: "action.hover"
3783
+ }
3784
+ },
3785
+ children: /* @__PURE__ */ e(f, { name: "download", size: "small" })
3786
+ }
3787
+ ) })
3788
+ ] })
3789
+ ]
3790
+ }
3791
+ )
3792
+ ] })
3793
+ ]
3794
+ }
3795
+ );
3796
+ }, Xt = ({
3797
+ title: r,
3798
+ viewMode: n,
3799
+ onToggleView: t,
3800
+ onClose: i,
3801
+ showLogo: o = !0,
3802
+ sx: a
3803
+ }) => {
3804
+ const m = n === "expanded";
3805
+ return /* @__PURE__ */ e(
3806
+ rr,
3807
+ {
3808
+ position: "static",
3809
+ color: "default",
3810
+ elevation: 0,
3811
+ sx: {
3812
+ borderBottom: 1,
3813
+ borderColor: "divider",
3814
+ backgroundColor: "background.paper",
3815
+ ...a
3816
+ },
3817
+ children: /* @__PURE__ */ l(
3818
+ or,
3819
+ {
3820
+ variant: "dense",
3821
+ sx: {
3822
+ minHeight: 48,
3823
+ px: c.md,
3824
+ gap: c.sm
3825
+ },
3826
+ children: [
3827
+ /* @__PURE__ */ l(C, { direction: "row", alignItems: "center", spacing: 1, sx: { flex: 1 }, children: [
3828
+ o && /* @__PURE__ */ e(de, { size: "xs" }),
3829
+ /* @__PURE__ */ e(
3830
+ u,
3831
+ {
3832
+ variant: "subtitle1",
3833
+ component: "h2",
3834
+ fontWeight: 600,
3835
+ sx: { color: "text.primary" },
3836
+ children: r
3837
+ }
3838
+ )
3839
+ ] }),
3840
+ t && /* @__PURE__ */ e(P, { title: m ? "Collapse to sidepanel" : "Expand view", children: /* @__PURE__ */ e(
3841
+ z,
3842
+ {
3843
+ size: "small",
3844
+ onClick: t,
3845
+ "aria-label": m ? "Collapse to sidepanel" : "Expand view",
3846
+ sx: { color: "text.secondary" },
3847
+ children: /* @__PURE__ */ e(
3848
+ f,
3849
+ {
3850
+ name: m ? "minimize" : "maximize",
3851
+ size: "small"
3852
+ }
3853
+ )
3854
+ }
3855
+ ) }),
3856
+ i && /* @__PURE__ */ e(P, { title: "Close", children: /* @__PURE__ */ e(
3857
+ z,
3858
+ {
3859
+ size: "small",
3860
+ onClick: i,
3861
+ "aria-label": "Close panel",
3862
+ sx: { color: "text.secondary" },
3863
+ children: /* @__PURE__ */ e(f, { name: "close", size: "small" })
3864
+ }
3865
+ ) })
3866
+ ]
3867
+ }
3868
+ )
3869
+ }
3870
+ );
3871
+ }, Ve = ({
3872
+ chats: r,
3873
+ activeChatId: n,
3874
+ onSelectChat: t,
3875
+ onRename: i,
3876
+ onDelete: o,
3877
+ onShare: a,
3878
+ onPin: m,
3879
+ onAddToProject: s,
3880
+ emptyMessage: g = "No conversations yet",
3881
+ compact: p = !1,
3882
+ sx: x
3883
+ }) => {
3884
+ const [k, b] = R(null), [y, I] = R(null), $ = (W, D) => {
3885
+ W.stopPropagation(), b(W.currentTarget), I(D);
3886
+ }, S = () => {
3887
+ b(null), I(null);
3888
+ }, A = (W) => {
3889
+ W && y && W(y), S();
3890
+ }, B = r.find((W) => W.id === y), M = i || o || a || m || s;
3891
+ return r.length === 0 ? /* @__PURE__ */ l(
3892
+ d,
3893
+ {
3894
+ sx: {
3895
+ py: c.lg,
3896
+ px: c.md,
3897
+ textAlign: "center",
3898
+ ...x
3899
+ },
3900
+ children: [
3901
+ /* @__PURE__ */ e(
3902
+ f,
3903
+ {
3904
+ name: "chat",
3905
+ size: "large",
3906
+ sx: { color: "text.disabled", mb: c.sm }
3907
+ }
3908
+ ),
3909
+ /* @__PURE__ */ e(u, { variant: "body2", color: "text.secondary", children: g })
3910
+ ]
3911
+ }
3912
+ ) : /* @__PURE__ */ l(G, { children: [
3913
+ /* @__PURE__ */ e(
3914
+ _e,
3915
+ {
3916
+ role: "listbox",
3917
+ "aria-label": "Conversation history",
3918
+ disablePadding: !0,
3919
+ sx: {
3920
+ py: c.xs,
3921
+ ...x
3922
+ },
3923
+ children: r.map((W) => {
3924
+ const D = W.id === n;
3925
+ return /* @__PURE__ */ e(
3926
+ qe,
3927
+ {
3928
+ disablePadding: !0,
3929
+ secondaryAction: M ? /* @__PURE__ */ e(
3930
+ z,
3931
+ {
3932
+ size: "small",
3933
+ onClick: (H) => $(H, W.id),
3934
+ "aria-label": "Chat options",
3935
+ sx: {
3936
+ opacity: 0,
3937
+ color: "text.secondary",
3938
+ ".MuiListItem-root:hover &": {
3939
+ opacity: 1
3940
+ }
3941
+ },
3942
+ children: /* @__PURE__ */ e(f, { name: "more-vertical", size: "small" })
3943
+ }
3944
+ ) : void 0,
3945
+ sx: {
3946
+ px: c.xs,
3947
+ "&:hover .MuiIconButton-root": {
3948
+ opacity: 1
3949
+ }
3950
+ },
3951
+ children: /* @__PURE__ */ l(
3952
+ Ne,
3953
+ {
3954
+ selected: D,
3955
+ onClick: () => t?.(W.id),
3956
+ role: "option",
3957
+ "aria-selected": D,
3958
+ sx: {
3959
+ borderRadius: v.sm,
3960
+ py: p ? c.xs : c.sm,
3961
+ px: c.sm,
3962
+ pr: M ? 5 : c.sm,
3963
+ "&.Mui-selected": {
3964
+ backgroundColor: "action.selected",
3965
+ "&:hover": {
3966
+ backgroundColor: "action.selected"
3967
+ }
3968
+ },
3969
+ "&:hover": {
3970
+ backgroundColor: "action.hover"
3971
+ }
3972
+ },
3973
+ children: [
3974
+ /* @__PURE__ */ e(
3975
+ N,
3976
+ {
3977
+ sx: {
3978
+ minWidth: p ? 28 : 36,
3979
+ color: h.colors.aiPrimary
3980
+ },
3981
+ children: W.pinned ? /* @__PURE__ */ e(f, { name: "bookmark", size: p ? "small" : "medium" }) : /* @__PURE__ */ e(f, { name: "chat", size: p ? "small" : "medium" })
3982
+ }
3983
+ ),
3984
+ /* @__PURE__ */ e(
3985
+ K,
3986
+ {
3987
+ primary: W.title,
3988
+ secondary: p ? void 0 : W.timestamp,
3989
+ primaryTypographyProps: {
3990
+ variant: "body2",
3991
+ fontWeight: D ? 600 : 400,
3992
+ color: "text.primary",
3993
+ noWrap: !0,
3994
+ sx: {
3995
+ overflow: "hidden",
3996
+ textOverflow: "ellipsis"
3997
+ }
3998
+ },
3999
+ secondaryTypographyProps: {
4000
+ variant: "caption",
4001
+ color: "text.secondary"
4002
+ },
4003
+ sx: {
4004
+ // In compact mode, limit width to make room for timestamp
4005
+ ...p && {
4006
+ flex: "1 1 auto",
4007
+ minWidth: 0,
4008
+ mr: 1
4009
+ }
4010
+ }
4011
+ }
4012
+ ),
4013
+ p && /* @__PURE__ */ e(
4014
+ u,
4015
+ {
4016
+ variant: "caption",
4017
+ color: "text.disabled",
4018
+ sx: {
4019
+ flexShrink: 0,
4020
+ whiteSpace: "nowrap"
4021
+ },
4022
+ children: W.timestamp
4023
+ }
4024
+ )
4025
+ ]
4026
+ }
4027
+ )
4028
+ },
4029
+ W.id
4030
+ );
4031
+ })
4032
+ }
4033
+ ),
4034
+ /* @__PURE__ */ l(
4035
+ ye,
4036
+ {
4037
+ anchorEl: k,
4038
+ open: !!k,
4039
+ onClose: S,
4040
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
4041
+ transformOrigin: { vertical: "top", horizontal: "right" },
4042
+ slotProps: {
4043
+ paper: {
4044
+ sx: {
4045
+ minWidth: 160,
4046
+ borderRadius: v.md
4047
+ }
4048
+ }
4049
+ },
4050
+ children: [
4051
+ m && /* @__PURE__ */ l(Z, { onClick: () => A(m), children: [
4052
+ /* @__PURE__ */ e(N, { sx: { minWidth: 32 }, children: /* @__PURE__ */ e(f, { name: (B?.pinned, "bookmark"), size: "small" }) }),
4053
+ /* @__PURE__ */ e(K, { primary: B?.pinned ? "Unpin" : "Pin" })
4054
+ ] }),
4055
+ i && /* @__PURE__ */ l(Z, { onClick: () => A(i), children: [
4056
+ /* @__PURE__ */ e(N, { sx: { minWidth: 32 }, children: /* @__PURE__ */ e(f, { name: "edit", size: "small" }) }),
4057
+ /* @__PURE__ */ e(K, { primary: "Rename" })
4058
+ ] }),
4059
+ a && /* @__PURE__ */ l(Z, { onClick: () => A(a), children: [
4060
+ /* @__PURE__ */ e(N, { sx: { minWidth: 32 }, children: /* @__PURE__ */ e(f, { name: "share", size: "small" }) }),
4061
+ /* @__PURE__ */ e(K, { primary: "Share" })
4062
+ ] }),
4063
+ s && /* @__PURE__ */ l(Z, { onClick: () => A(s), children: [
4064
+ /* @__PURE__ */ e(N, { sx: { minWidth: 32 }, children: /* @__PURE__ */ e(f, { name: "folder", size: "small" }) }),
4065
+ /* @__PURE__ */ e(K, { primary: "Add to Project" })
4066
+ ] }),
4067
+ o && (m || i || a || s) && /* @__PURE__ */ e(ue, {}),
4068
+ o && /* @__PURE__ */ l(Z, { onClick: () => A(o), sx: { color: "error.main" }, children: [
4069
+ /* @__PURE__ */ e(N, { sx: { minWidth: 32, color: "error.main" }, children: /* @__PURE__ */ e(f, { name: "trash", size: "small" }) }),
4070
+ /* @__PURE__ */ e(K, { primary: "Delete" })
4071
+ ] })
4072
+ ]
4073
+ }
4074
+ )
4075
+ ] });
4076
+ }, Yt = ({ size: r = "small" }) => {
4077
+ const n = r === "small" ? 32 : 40;
4078
+ return /* @__PURE__ */ e(
4079
+ d,
4080
+ {
4081
+ sx: {
4082
+ width: n,
4083
+ height: n,
4084
+ borderRadius: v.circle,
4085
+ backgroundColor: "grey.300",
4086
+ display: "flex",
4087
+ alignItems: "center",
4088
+ justifyContent: "center",
4089
+ flexShrink: 0
4090
+ },
4091
+ children: /* @__PURE__ */ e(f, { name: "user", size: "small", color: "action" })
4092
+ }
4093
+ );
4094
+ }, Jt = ({ content: r }) => /* @__PURE__ */ l(
4095
+ d,
4096
+ {
4097
+ sx: {
4098
+ display: "flex",
4099
+ gap: c.md,
4100
+ justifyContent: "flex-end",
4101
+ mb: c.md
4102
+ },
4103
+ children: [
4104
+ /* @__PURE__ */ e(
4105
+ d,
4106
+ {
4107
+ sx: {
4108
+ maxWidth: "80%",
4109
+ px: c.md,
4110
+ py: c.sm,
4111
+ borderRadius: v.lg,
4112
+ backgroundColor: "primary.main",
4113
+ color: "primary.contrastText"
4114
+ },
4115
+ children: /* @__PURE__ */ e(u, { variant: "body2", children: r })
4116
+ }
4117
+ ),
4118
+ /* @__PURE__ */ e(d, { sx: { flexShrink: 0, pt: 0.5 }, children: /* @__PURE__ */ e(Yt, { size: "small" }) })
4119
+ ]
4120
+ }
4121
+ ), ea = ({
4122
+ messages: r,
4123
+ relatedQuestions: n,
4124
+ onRelatedQuestionClick: t,
4125
+ suggestedActions: i
4126
+ }) => /* @__PURE__ */ e(
4127
+ d,
4128
+ {
4129
+ sx: {
4130
+ flex: 1,
4131
+ overflow: "auto",
4132
+ px: c.md,
4133
+ py: c.md
4134
+ },
4135
+ children: r.length === 0 ? /* @__PURE__ */ l(
4136
+ d,
4137
+ {
4138
+ sx: {
4139
+ display: "flex",
4140
+ flexDirection: "column",
4141
+ alignItems: "center",
4142
+ justifyContent: "center",
4143
+ height: "100%",
4144
+ textAlign: "center",
4145
+ color: "text.secondary"
4146
+ },
4147
+ children: [
4148
+ /* @__PURE__ */ e(f, { name: "chat", size: "large", sx: { mb: c.sm, opacity: 0.5 } }),
4149
+ /* @__PURE__ */ e(u, { variant: "body2", children: "Start a conversation" })
4150
+ ]
4151
+ }
4152
+ ) : /* @__PURE__ */ l(G, { children: [
4153
+ r.map(
4154
+ (o) => o.role === "user" ? /* @__PURE__ */ e(Jt, { content: o.content }, o.id) : /* @__PURE__ */ l(d, { children: [
4155
+ o.response ? /* @__PURE__ */ e(
4156
+ Ue,
4157
+ {
4158
+ response: o.response,
4159
+ timestamp: o.timestamp
4160
+ }
4161
+ ) : /* @__PURE__ */ e(Ue, { timestamp: o.timestamp, children: /* @__PURE__ */ e(u, { variant: "body2", color: "text.primary", children: o.content }) }),
4162
+ o.sources && o.sources.length > 0 && /* @__PURE__ */ e(d, { sx: { ml: `calc(32px + ${c.md}px)`, mt: c.sm, mb: c.md }, children: /* @__PURE__ */ e(
4163
+ Ft,
4164
+ {
4165
+ sources: o.sources,
4166
+ defaultExpanded: !1
4167
+ }
4168
+ ) }),
4169
+ o.relatedQuestions && o.relatedQuestions.length > 0 && /* @__PURE__ */ e(d, { sx: { ml: `calc(32px + ${c.md}px)`, mt: c.sm, mb: c.md }, children: /* @__PURE__ */ e(
4170
+ je,
4171
+ {
4172
+ questions: o.relatedQuestions,
4173
+ onQuestionClick: t,
4174
+ defaultExpanded: !0
4175
+ }
4176
+ ) })
4177
+ ] }, o.id)
4178
+ ),
4179
+ n && n.length > 0 && !r.some((o) => o.role === "assistant" && o.relatedQuestions?.length) && /* @__PURE__ */ e(d, { sx: { ml: `calc(32px + ${c.md}px)`, mt: c.md }, children: /* @__PURE__ */ e(
4180
+ je,
4181
+ {
4182
+ questions: n,
4183
+ onQuestionClick: t,
4184
+ defaultExpanded: !0
4185
+ }
4186
+ ) }),
4187
+ i && i.length > 0 && /* @__PURE__ */ e(
4188
+ C,
4189
+ {
4190
+ direction: "row",
4191
+ spacing: 1.5,
4192
+ flexWrap: "wrap",
4193
+ useFlexGap: !0,
4194
+ sx: { ml: `calc(32px + ${c.md}px)`, mt: c.lg, gap: c.sm },
4195
+ children: i.map((o, a) => /* @__PURE__ */ e(
4196
+ Ze,
4197
+ {
4198
+ label: o.label,
4199
+ onClick: o.onClick,
4200
+ variant: "outlined"
4201
+ },
4202
+ a
4203
+ ))
4204
+ }
4205
+ )
4206
+ ] })
4207
+ }
4208
+ ), ra = 400, oa = 800, ia = 260, Us = ({
4209
+ isOpen: r,
4210
+ onClose: n,
4211
+ defaultViewMode: t = "sidepanel",
4212
+ title: i = "Insight Engine",
4213
+ // Chat history
4214
+ chats: o = [],
4215
+ activeChatId: a,
4216
+ onSelectChat: m,
4217
+ onRenameChat: s,
4218
+ onDeleteChat: g,
4219
+ onShareChat: p,
4220
+ onPinChat: x,
4221
+ onAddChatToProject: k,
4222
+ // Messages
4223
+ messages: b = [],
4224
+ // Input
4225
+ inputValue: y = "",
4226
+ onInputChange: I,
4227
+ onSendMessage: $,
4228
+ models: S,
4229
+ selectedModel: A,
4230
+ onModelChange: B,
4231
+ sources: M,
4232
+ onSourceToggle: W,
4233
+ // Related questions & actions
4234
+ relatedQuestions: D,
4235
+ onRelatedQuestionClick: H,
4236
+ suggestedActions: O,
4237
+ // Sizing
4238
+ sidepanelWidth: re = ra,
4239
+ expandedWidth: oe = oa,
4240
+ sx: ie
4241
+ }) => {
4242
+ const [j, L] = R(t), [F, U] = R(!1), V = j === "expanded", ne = V ? oe : re, E = () => {
4243
+ L((ge) => ge === "sidepanel" ? "expanded" : "sidepanel");
4244
+ }, _ = () => {
4245
+ y.trim() && $ && $(y.trim());
4246
+ }, xe = /* @__PURE__ */ l(
4247
+ d,
4248
+ {
4249
+ sx: {
4250
+ width: ia,
4251
+ borderRight: 1,
4252
+ borderColor: "divider",
4253
+ display: "flex",
4254
+ flexDirection: "column",
4255
+ backgroundColor: "background.default"
4256
+ },
4257
+ children: [
4258
+ /* @__PURE__ */ e(d, { sx: { p: c.sm, borderBottom: 1, borderColor: "divider" }, children: /* @__PURE__ */ e(u, { variant: "caption", color: "text.secondary", fontWeight: 600, children: "HISTORY" }) }),
4259
+ /* @__PURE__ */ e(d, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(
4260
+ Ve,
4261
+ {
4262
+ chats: o,
4263
+ activeChatId: a,
4264
+ onSelectChat: m,
4265
+ onRename: s,
4266
+ onDelete: g,
4267
+ onShare: p,
4268
+ onPin: x,
4269
+ onAddToProject: k,
4270
+ compact: !0
4271
+ }
4272
+ ) })
4273
+ ]
4274
+ }
4275
+ ), me = o.length > 0 && /* @__PURE__ */ l(d, { sx: { borderBottom: 1, borderColor: "divider" }, children: [
4276
+ /* @__PURE__ */ l(
4277
+ d,
4278
+ {
4279
+ component: "button",
4280
+ onClick: () => U(!F),
4281
+ sx: {
4282
+ width: "100%",
4283
+ display: "flex",
4284
+ alignItems: "center",
4285
+ justifyContent: "space-between",
4286
+ px: c.md,
4287
+ py: c.sm,
4288
+ border: "none",
4289
+ backgroundColor: "transparent",
4290
+ cursor: "pointer",
4291
+ "&:hover": {
4292
+ backgroundColor: "action.hover"
4293
+ }
4294
+ },
4295
+ children: [
4296
+ /* @__PURE__ */ l(u, { variant: "caption", color: "text.secondary", fontWeight: 600, children: [
4297
+ "HISTORY (",
4298
+ o.length,
4299
+ ")"
4300
+ ] }),
4301
+ /* @__PURE__ */ e(
4302
+ f,
4303
+ {
4304
+ name: F ? "chevron-up" : "chevron-down",
4305
+ size: "small",
4306
+ sx: { color: "text.secondary" }
4307
+ }
4308
+ )
4309
+ ]
4310
+ }
4311
+ ),
4312
+ /* @__PURE__ */ e(J, { in: F, children: /* @__PURE__ */ e(d, { sx: { maxHeight: 200, overflow: "auto" }, children: /* @__PURE__ */ e(
4313
+ Ve,
4314
+ {
4315
+ chats: o,
4316
+ activeChatId: a,
4317
+ onSelectChat: m,
4318
+ onRename: s,
4319
+ onDelete: g,
4320
+ onShare: p,
4321
+ onPin: x,
4322
+ onAddToProject: k,
4323
+ compact: !0
4324
+ }
4325
+ ) }) })
4326
+ ] }), ae = /* @__PURE__ */ l(
4327
+ d,
4328
+ {
4329
+ sx: {
4330
+ flex: 1,
4331
+ display: "flex",
4332
+ flexDirection: "column",
4333
+ minHeight: 0,
4334
+ overflow: "hidden"
4335
+ },
4336
+ children: [
4337
+ /* @__PURE__ */ e(
4338
+ ea,
4339
+ {
4340
+ messages: b,
4341
+ relatedQuestions: D,
4342
+ onRelatedQuestionClick: H,
4343
+ suggestedActions: O
4344
+ }
4345
+ ),
4346
+ /* @__PURE__ */ e(
4347
+ d,
4348
+ {
4349
+ sx: {
4350
+ flexShrink: 0,
4351
+ borderTop: 1,
4352
+ borderColor: "divider",
4353
+ p: c.md,
4354
+ backgroundColor: "background.paper"
4355
+ },
4356
+ children: /* @__PURE__ */ e(
4357
+ Pt,
4358
+ {
4359
+ value: y,
4360
+ onChange: I,
4361
+ onSubmit: _,
4362
+ models: S,
4363
+ selectedModel: A,
4364
+ onModelChange: B,
4365
+ sources: M,
4366
+ onSourceToggle: W,
4367
+ placeholder: "Ask anything..."
4368
+ }
4369
+ )
4370
+ }
4371
+ )
4372
+ ]
4373
+ }
4374
+ );
4375
+ return /* @__PURE__ */ e(
4376
+ ir,
4377
+ {
4378
+ anchor: "right",
4379
+ open: r,
4380
+ onClose: n,
4381
+ variant: "persistent",
4382
+ sx: {
4383
+ "& .MuiDrawer-paper": {
4384
+ width: ne,
4385
+ transition: "width 0.2s ease-in-out"
4386
+ },
4387
+ ...ie
4388
+ },
4389
+ children: /* @__PURE__ */ l(
4390
+ d,
4391
+ {
4392
+ sx: {
4393
+ height: "100%",
4394
+ display: "flex",
4395
+ flexDirection: "column",
4396
+ backgroundColor: "background.paper"
4397
+ },
4398
+ children: [
4399
+ /* @__PURE__ */ e(
4400
+ Xt,
4401
+ {
4402
+ title: i,
4403
+ viewMode: j,
4404
+ onToggleView: E,
4405
+ onClose: n
4406
+ }
4407
+ ),
4408
+ V ? (
4409
+ // Expanded: side-by-side layout
4410
+ /* @__PURE__ */ l(d, { sx: { flex: 1, display: "flex", minHeight: 0 }, children: [
4411
+ xe,
4412
+ ae
4413
+ ] })
4414
+ ) : (
4415
+ // Sidepanel: stacked layout
4416
+ /* @__PURE__ */ l(d, { sx: { flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }, children: [
4417
+ me,
4418
+ ae
4419
+ ] })
4420
+ )
4421
+ ]
4422
+ }
4423
+ )
4424
+ }
4425
+ );
4426
+ };
4427
+ export {
4428
+ Is as A,
4429
+ Os as B,
4430
+ ea as C,
4431
+ js as D,
4432
+ $s as E,
4433
+ As as F,
4434
+ Es as G,
4435
+ Ss as H,
4436
+ f as I,
4437
+ Ws as Q,
4438
+ Hs as S,
4439
+ Jt as U,
4440
+ h as a,
4441
+ v as b,
4442
+ Ft as c,
4443
+ je as d,
4444
+ Wt as e,
4445
+ Pt as f,
4446
+ Rs as g,
4447
+ Fs as h,
4448
+ de as i,
4449
+ Us as j,
4450
+ Xt as k,
4451
+ Ve as l,
4452
+ Qt as m,
4453
+ Ot as n,
4454
+ Ue as o,
4455
+ Yt as p,
4456
+ St as q,
4457
+ zs as r,
4458
+ Rt as s,
4459
+ Ps as t,
4460
+ Ze as u,
4461
+ Ms as v,
4462
+ Ts as w,
4463
+ Bs as x,
4464
+ Ds as y,
4465
+ Ls as z
4466
+ };