@cognite/aura 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/DESIGN.md +1651 -7
  2. package/README.md +45 -3
  3. package/dist/components/index.d.ts +4 -2
  4. package/dist/components/index.js +58 -325
  5. package/dist/components/ui/core/accordion/accordion.js +79 -114
  6. package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
  7. package/dist/components/ui/core/alert/alert.js +158 -206
  8. package/dist/components/ui/core/avatar/avatar.js +64 -90
  9. package/dist/components/ui/core/badge/badge.js +73 -108
  10. package/dist/components/ui/core/banner/banner.js +146 -215
  11. package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
  12. package/dist/components/ui/core/button/button.js +47 -52
  13. package/dist/components/ui/core/button-group/button-group.js +40 -79
  14. package/dist/components/ui/core/card/card.js +102 -185
  15. package/dist/components/ui/core/chart/chart.js +116 -206
  16. package/dist/components/ui/core/chart/index.js +2 -8
  17. package/dist/components/ui/core/checkbox/checkbox.js +67 -132
  18. package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
  19. package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
  20. package/dist/components/ui/core/code-block/code-block.js +179 -267
  21. package/dist/components/ui/core/collapsible/collapsible.js +29 -49
  22. package/dist/components/ui/core/combobox/combobox.js +41 -0
  23. package/dist/components/ui/core/command/command.js +85 -150
  24. package/dist/components/ui/core/count/count.js +21 -32
  25. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -83
  26. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +1 -2
  27. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -62
  28. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -98
  29. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
  30. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -81
  31. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -189
  32. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
  33. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -158
  34. package/dist/components/ui/core/date-time-pickers/index.d.ts +2 -0
  35. package/dist/components/ui/core/date-time-pickers/index.js +5 -8
  36. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
  37. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
  38. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
  39. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
  40. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
  41. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
  42. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
  43. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -39
  44. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
  45. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
  46. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
  47. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
  48. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
  49. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
  50. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
  51. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
  52. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
  53. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
  54. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
  55. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
  56. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +79 -0
  57. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
  58. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
  59. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +42 -0
  60. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
  61. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
  62. package/dist/components/ui/core/dialog/dialog.js +82 -155
  63. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +19 -17
  64. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -250
  65. package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
  66. package/dist/components/ui/core/empty-state/empty-state.js +86 -138
  67. package/dist/components/ui/core/helper-text/helper-text.js +37 -65
  68. package/dist/components/ui/core/hover-card/hover-card.js +54 -80
  69. package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
  70. package/dist/components/ui/core/input/input.js +12 -27
  71. package/dist/components/ui/core/input-group/input-group.js +76 -173
  72. package/dist/components/ui/core/kbd/kbd.js +20 -36
  73. package/dist/components/ui/core/label/label.js +26 -43
  74. package/dist/components/ui/core/loader/loader.js +80 -117
  75. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
  76. package/dist/components/ui/core/message/message.d.ts +2 -2
  77. package/dist/components/ui/core/message/message.js +316 -542
  78. package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
  79. package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
  80. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  81. package/dist/components/ui/core/pagination/pagination.js +231 -334
  82. package/dist/components/ui/core/popover/popover.js +90 -157
  83. package/dist/components/ui/core/progress/progress.js +36 -61
  84. package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
  85. package/dist/components/ui/core/radio-group/radio-group.js +58 -113
  86. package/dist/components/ui/core/reasoning/reasoning.js +55 -86
  87. package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
  88. package/dist/components/ui/core/search/search.js +77 -99
  89. package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
  90. package/dist/components/ui/core/select/select.js +168 -293
  91. package/dist/components/ui/core/separator/separator.js +13 -23
  92. package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
  93. package/dist/components/ui/core/shimmer/shimmer.js +40 -107
  94. package/dist/components/ui/core/skeleton/skeleton.js +13 -18
  95. package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
  96. package/dist/components/ui/core/sources/sources.d.ts +5 -1
  97. package/dist/components/ui/core/sources/sources.js +58 -79
  98. package/dist/components/ui/core/switch/switch.js +62 -0
  99. package/dist/components/ui/core/tabs/tabs.js +149 -223
  100. package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
  101. package/dist/components/ui/core/textarea/textarea.js +13 -27
  102. package/dist/components/ui/core/toggle/toggle.js +55 -74
  103. package/dist/components/ui/core/tool/tool.js +127 -163
  104. package/dist/components/ui/core/tooltip/tooltip.js +47 -86
  105. package/dist/components/ui/core/topbar/topbar.js +106 -190
  106. package/dist/eslint/index.js +5 -10
  107. package/dist/eslint/no-overriding-styles.js +178 -237
  108. package/dist/icons/index.d.ts +1 -0
  109. package/dist/icons/index.js +1 -0
  110. package/dist/lib/highlight-code.d.ts +9 -0
  111. package/dist/lib/highlight-code.js +42 -0
  112. package/dist/lib/portal-container-context.js +8 -9
  113. package/dist/lib/style-scope.js +6 -6
  114. package/dist/lib/use-controllable-state.js +21 -30
  115. package/dist/lib/utils.d.ts +0 -2
  116. package/dist/lib/utils.js +32 -112
  117. package/dist/styles.css +1 -1
  118. package/dist/styles.source.css +23 -0
  119. package/package.json +23 -7
  120. package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
@@ -1,544 +1,318 @@
1
- import { jsx as t, jsxs as l, Fragment as h } from "react/jsx-runtime";
2
- import { createContext as A, memo as T, useState as w, useCallback as v, useMemo as k, useEffect as z, useContext as C } from "react";
3
- import { mermaid as I } from "@streamdown/mermaid";
4
- import { IconX as f, IconPaperclip as P, IconChevronRight as E, IconChevronLeft as S } from "@tabler/icons-react";
5
- import { Streamdown as R } from "streamdown";
6
- import { cn as c, getInitials as j } from "../../../../lib/utils.js";
7
- import { Avatar as q, AvatarImage as L, AvatarFallback as O, AvatarIcon as F } from "../avatar/avatar.js";
8
- import { Button as g } from "../button/button.js";
9
- import { ButtonGroupText as G, ButtonGroup as D } from "../button-group/button-group.js";
10
- import { Tooltip as x, TooltipTrigger as N, TooltipContent as y } from "../tooltip/tooltip.js";
11
- import { MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS as W } from "./message-response-default-streamdown-controls.js";
12
- const oe = ({
13
- className: e,
14
- isResponse: a = !1,
15
- ...o
16
- }) => /* @__PURE__ */ t(
17
- "div",
18
- {
19
- "data-slot": "message",
20
- className: c(
21
- "group flex w-full items-start justify-start gap-3 mb-0 py-3",
22
- a ? "is-assistant items-start" : "is-user flex-row-reverse",
23
- e
24
- ),
25
- ...o
26
- }
27
- ), re = ({
28
- children: e,
29
- className: a,
30
- ...o
31
- }) => /* @__PURE__ */ t(
32
- "div",
33
- {
34
- "data-slot": "message-content",
35
- className: c(
36
- "is-user:dark flex flex-col gap-4 rounded-md text-base leading-tight tracking-tightest",
37
- "max-w-4/5",
38
- "group-[.is-user]:overflow-hidden group-[.is-user]:bg-accent-background group-[.is-user]:p-2 group-[.is-user]:text-foreground",
39
- "group-[.is-assistant]:text-foreground group-[.is-assistant]:pt-1",
40
- a
41
- ),
42
- ...o,
43
- children: e
44
- }
45
- ), de = ({
46
- avatarUrl: e,
47
- name: a,
48
- className: o,
49
- children: r,
50
- variant: s,
51
- sizes: n,
52
- ...d
53
- }) => {
54
- const m = a ? j(a) : "ME";
55
- return /* @__PURE__ */ t(
56
- q,
57
- {
58
- "data-slot": "message-avatar",
59
- className: c("size-7 group-[.is-user]:mt-1", o),
60
- variant: s,
61
- sizes: n,
62
- ...d,
63
- children: r || /* @__PURE__ */ l(h, { children: [
64
- e && /* @__PURE__ */ t(
65
- L,
66
- {
67
- alt: a || "",
68
- className: "mt-0 mb-0",
69
- src: e
70
- }
71
- ),
72
- /* @__PURE__ */ t(O, { children: m })
73
- ] })
74
- }
75
- );
76
- }, se = (e) => /* @__PURE__ */ t(F, { "data-slot": "message-avatar-icon", ...e }), ne = ({
77
- className: e,
78
- children: a,
79
- ...o
80
- }) => /* @__PURE__ */ t(
81
- "div",
82
- {
83
- "data-slot": "message-actions",
84
- className: c("flex items-center gap-2 pt-2", e),
85
- ...o,
86
- children: a
87
- }
88
- ), ce = ({
89
- tooltip: e,
90
- children: a,
91
- label: o,
92
- className: r,
93
- variant: s = "ghost",
94
- size: n = "sm",
95
- ...d
96
- }) => {
97
- const m = /* @__PURE__ */ l(
98
- g,
99
- {
100
- "data-slot": "message-action",
101
- className: c(
102
- "relative icon-sm text-muted-foreground hover:text-foreground",
103
- r
104
- ),
105
- size: n,
106
- type: "button",
107
- variant: s,
108
- ...d,
109
- children: [
110
- a,
111
- /* @__PURE__ */ t("span", { className: "sr-only", children: o || e })
112
- ]
113
- }
114
- );
115
- return e ? /* @__PURE__ */ l(x, { children: [
116
- /* @__PURE__ */ t(N, { render: m }),
117
- /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("p", { children: e }) })
118
- ] }) : m;
119
- }, M = A(
120
- null
121
- ), p = () => {
122
- const e = C(M);
123
- if (!e)
124
- throw new Error(
125
- "MessageBranch components must be used within MessageBranch"
126
- );
127
- return e;
128
- }, me = ({
129
- defaultBranch: e = 0,
130
- onBranchChange: a,
131
- className: o,
132
- ...r
133
- }) => {
134
- const [s, n] = w(e), [d, m] = w([]), i = v(() => {
135
- n((b) => {
136
- const u = b > 0 ? b - 1 : d.length - 1;
137
- return a?.(u), u;
138
- });
139
- }, [d.length, a]), _ = v(() => {
140
- n((b) => {
141
- const u = b < d.length - 1 ? b + 1 : 0;
142
- return a?.(u), u;
143
- });
144
- }, [d.length, a]), B = k(
145
- () => ({
146
- currentBranch: s,
147
- totalBranches: d.length,
148
- goToPrevious: i,
149
- goToNext: _,
150
- branches: d,
151
- setBranches: m
152
- }),
153
- [s, d, i, _, m]
154
- );
155
- return /* @__PURE__ */ t(M.Provider, { value: B, children: /* @__PURE__ */ t(
156
- "div",
157
- {
158
- "data-slot": "message-branch",
159
- className: c("grid w-full gap-2 [&>div]:pb-0", o),
160
- ...r
161
- }
162
- ) });
163
- }, le = ({
164
- children: e,
165
- ...a
166
- }) => {
167
- const { currentBranch: o, setBranches: r, branches: s } = p(), n = k(
168
- () => Array.isArray(e) ? e : [e],
169
- [e]
170
- );
171
- return z(() => {
172
- s.length !== n.length && r(n);
173
- }, [n, s, r]), n.map((d, m) => /* @__PURE__ */ t(
174
- "div",
175
- {
176
- "data-slot": "message-branch-content",
177
- className: c(
178
- "grid gap-2 overflow-hidden [&>div]:pb-0",
179
- m === o ? "block" : "hidden"
180
- ),
181
- ...a,
182
- children: d
183
- },
184
- d.key
185
- ));
186
- }, ie = ({
187
- ...e
188
- }) => {
189
- const { totalBranches: a } = p();
190
- return a <= 1 ? null : /* @__PURE__ */ t(
191
- D,
192
- {
193
- "data-slot": "message-branch-selector",
194
- className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
195
- orientation: "horizontal",
196
- ...e
197
- }
198
- );
199
- }, be = ({
200
- children: e,
201
- ...a
202
- }) => {
203
- const { goToPrevious: o, totalBranches: r } = p();
204
- return /* @__PURE__ */ t(
205
- g,
206
- {
207
- "data-slot": "message-branch-previous",
208
- "aria-label": "Previous branch",
209
- disabled: r <= 1,
210
- onClick: o,
211
- size: "icon-sm",
212
- type: "button",
213
- variant: "ghost",
214
- ...a,
215
- children: e ?? /* @__PURE__ */ t(S, { size: 14 })
216
- }
217
- );
218
- }, ue = ({
219
- children: e,
220
- ...a
221
- }) => {
222
- const { goToNext: o, totalBranches: r } = p();
223
- return /* @__PURE__ */ t(
224
- g,
225
- {
226
- "data-slot": "message-branch-next",
227
- "aria-label": "Next branch",
228
- disabled: r <= 1,
229
- onClick: o,
230
- size: "icon-sm",
231
- type: "button",
232
- variant: "ghost",
233
- ...a,
234
- children: e ?? /* @__PURE__ */ t(E, { size: 14 })
235
- }
236
- );
237
- }, ge = ({
238
- className: e,
239
- ...a
240
- }) => {
241
- const { currentBranch: o, totalBranches: r } = p();
242
- return /* @__PURE__ */ l(
243
- G,
244
- {
245
- "data-slot": "message-branch-page",
246
- className: c(
247
- "border-none bg-transparent text-muted-foreground shadow-none px-2",
248
- e
249
- ),
250
- ...a,
251
- children: [
252
- o + 1,
253
- "/",
254
- r
255
- ]
256
- }
257
- );
258
- }, V = {
259
- h1: ({ children: e }) => /* @__PURE__ */ t("h1", { className: "mt-0 mb-2 scroll-m-20 text-xl font-medium tracking-tightest", children: e }),
260
- h2: ({ children: e }) => /* @__PURE__ */ t("h2", { className: "mt-4 mb-1 scroll-m-20 text-lg font-medium tracking-tightest", children: e }),
261
- h3: ({ children: e }) => /* @__PURE__ */ t("h3", { className: "mt-4 mb-1 scroll-m-20 text-base font-medium tracking-tighter", children: e }),
262
- h4: ({ children: e }) => /* @__PURE__ */ t("h4", { className: "mt-2 mb-0 scroll-m-20 text-sm font-medium tracking-normal", children: e }),
263
- h5: ({ children: e }) => /* @__PURE__ */ t("h5", { className: "mt-0 mb-0 scroll-m-20 text-xs font-medium tracking-tighter", children: e }),
264
- h6: ({ children: e }) => /* @__PURE__ */ t("h6", { className: "mt-0 mb-0 scroll-m-20 text-2xs font-medium tracking-tighter", children: e }),
265
- p: ({ children: e }) => /* @__PURE__ */ t("p", { className: "mt-2 mb-3 text-base font-normal leading-5 tracking-tightest", children: e }),
266
- strong: ({ children: e }) => /* @__PURE__ */ t("strong", { className: "font-medium", children: e }),
267
- em: ({ children: e }) => /* @__PURE__ */ t("em", { className: "italic", children: e }),
268
- b: ({ children: e }) => /* @__PURE__ */ t("b", { className: "font-medium", children: e }),
269
- i: ({ children: e }) => /* @__PURE__ */ t("i", { className: "italic", children: e }),
270
- ul: ({ children: e }) => /* @__PURE__ */ t("ul", { className: "ml-8.25 mb-3 pt-2 pl-0 pb-0 list-disc text-base font-normal tracking-tightest", children: e }),
271
- ol: ({ children: e }) => /* @__PURE__ */ t("ol", { className: "ml-8.25 mb-3 pt-2 pl-0 pb-0 list-decimal text-base font-normal tracking-tightest", children: e }),
272
- li: ({ children: e }) => /* @__PURE__ */ t("li", { className: "py-0", children: e }),
273
- blockquote: ({ children: e }) => /* @__PURE__ */ t("blockquote", { className: "my-3 pr-2 pl-2 border-l border-l-border text-sm text-muted-foreground font-normal tracking-tight not-italic", children: e }),
274
- hr: () => /* @__PURE__ */ t("hr", { className: "my-4 border-border" }),
275
- a: ({ children: e, href: a, ...o }) => /* @__PURE__ */ t(
276
- "a",
277
- {
278
- className: "text-link-foreground no-underline hover:underline underline-offset-4",
279
- href: a,
280
- ...o,
281
- children: e
282
- }
283
- ),
284
- table: ({ children: e }) => /* @__PURE__ */ t(
285
- "div",
286
- {
287
- className: "my-6 overflow-x-auto",
288
- tabIndex: 0,
289
- role: "group",
290
- "aria-label": "Atlas AI Chat Table",
291
- children: /* @__PURE__ */ t("table", { className: "w-full", children: e })
292
- }
293
- ),
294
- thead: ({ children: e }) => /* @__PURE__ */ t("thead", { children: e }),
295
- tbody: ({ children: e }) => /* @__PURE__ */ t("tbody", { children: e }),
296
- tr: ({ children: e }) => /* @__PURE__ */ t("tr", { className: "m-0 border-t p-0 even:bg-muted-background", children: e }),
297
- th: ({ children: e }) => /* @__PURE__ */ t("th", { className: "border px-4 py-2 text-left font-bold", children: e }),
298
- td: ({ children: e }) => /* @__PURE__ */ t("td", { className: "border px-4 py-2 text-left", children: e })
299
- }, X = T(
300
- ({
301
- className: e,
302
- components: a,
303
- plugins: o,
304
- controls: r,
305
- ...s
306
- }) => /* @__PURE__ */ t(
307
- R,
308
- {
309
- "data-slot": "message-response",
310
- className: c(
311
- "size-full",
312
- // Blockquote paragraph overrides
313
- "[&_blockquote_p]:text-sm",
314
- "[&_blockquote_p]:tracking-tight",
315
- // Inline code
316
- "[&_code]:relative",
317
- "[&_code]:rounded",
318
- "[&_code]:bg-muted-background",
319
- "[&_code]:px-[0.3rem]",
320
- "[&_code]:py-[0.2rem]",
321
- "[&_code]:font-mono",
322
- "[&_code]:text-sm",
323
- "[&_code]:font-semibold",
324
- // Code blocks (Streamdown container)
325
- '[&_div[data-streamdown="code-block"]]:my-4',
326
- '[&_div[data-streamdown="code-block"]]:w-full',
327
- '[&_div[data-streamdown="code-block"]]:overflow-hidden',
328
- '[&_div[data-streamdown="code-block"]]:rounded-xl',
329
- '[&_div[data-streamdown="code-block"]]:border',
330
- '[&_div[data-streamdown="code-block"]]:border-border',
331
- // Code block header
332
- '[&_div[data-streamdown="code-block-header"]]:flex',
333
- '[&_div[data-streamdown="code-block-header"]]:items-center',
334
- '[&_div[data-streamdown="code-block-header"]]:justify-between',
335
- '[&_div[data-streamdown="code-block-header"]]:bg-muted-background/80',
336
- '[&_div[data-streamdown="code-block-header"]]:px-4',
337
- '[&_div[data-streamdown="code-block-header"]]:py-3',
338
- '[&_div[data-streamdown="code-block-header"]]:text-xs',
339
- '[&_div[data-streamdown="code-block-header"]]:text-muted-foreground',
340
- // Pre element inside code block
341
- '[&_div[data-streamdown="code-block"]_pre]:m-0',
342
- '[&_div[data-streamdown="code-block"]_pre]:overflow-x-auto',
343
- '[&_div[data-streamdown="code-block"]_pre]:border-t',
344
- '[&_div[data-streamdown="code-block"]_pre]:border-border',
345
- '[&_div[data-streamdown="code-block"]_pre]:bg-background!',
346
- '[&_div[data-streamdown="code-block"]_pre]:p-4',
347
- '[&_div[data-streamdown="code-block"]_pre]:text-sm',
348
- '[&_div[data-streamdown="code-block"]_pre]:text-foreground!',
349
- // Code element inside pre
350
- '[&_div[data-streamdown="code-block"]_pre_code]:static',
351
- '[&_div[data-streamdown="code-block"]_pre_code]:rounded-none',
352
- '[&_div[data-streamdown="code-block"]_pre_code]:bg-transparent',
353
- '[&_div[data-streamdown="code-block"]_pre_code]:p-0',
354
- '[&_div[data-streamdown="code-block"]_pre_code]:font-mono',
355
- '[&_div[data-streamdown="code-block"]_pre_code]:text-sm',
356
- '[&_div[data-streamdown="code-block"]_pre_code]:font-normal',
357
- // Code block buttons
358
- '[&_button[data-streamdown="code-block-copy-button"]]:cursor-pointer',
359
- '[&_button[data-streamdown="code-block-copy-button"]]:p-1',
360
- '[&_button[data-streamdown="code-block-copy-button"]]:text-muted-foreground',
361
- '[&_button[data-streamdown="code-block-copy-button"]]:transition-all',
362
- '[&_button[data-streamdown="code-block-copy-button"]]:hover:text-foreground',
363
- '[&_button[data-streamdown="code-block-download-button"]]:cursor-pointer',
364
- '[&_button[data-streamdown="code-block-download-button"]]:p-1',
365
- '[&_button[data-streamdown="code-block-download-button"]]:text-muted-foreground',
366
- '[&_button[data-streamdown="code-block-download-button"]]:transition-all',
367
- '[&_button[data-streamdown="code-block-download-button"]]:hover:text-foreground',
368
- // Regular pre blocks (not in Streamdown code blocks)
369
- "[&_pre:not([data-streamdown])]:my-3",
370
- "[&_pre:not([data-streamdown])]:mx-0",
371
- "[&_pre:not([data-streamdown])]:overflow-x-auto",
372
- "[&_pre:not([data-streamdown])]:rounded-md",
373
- "[&_pre:not([data-streamdown])]:border",
374
- "[&_pre:not([data-streamdown])]:bg-card-background",
375
- "[&_pre:not([data-streamdown])]:p-4",
376
- "[&_pre:not([data-streamdown])]:text-foreground",
377
- "[&_pre:not([data-streamdown])]:text-sm",
378
- "[&_pre:not([data-streamdown])_code]:static",
379
- "[&_pre:not([data-streamdown])_code]:rounded-none",
380
- "[&_pre:not([data-streamdown])_code]:bg-transparent",
381
- "[&_pre:not([data-streamdown])_code]:px-0",
382
- "[&_pre:not([data-streamdown])_code]:py-0",
383
- "[&_pre:not([data-streamdown])_code]:font-mono",
384
- "[&_pre:not([data-streamdown])_code]:text-sm",
385
- "[&_pre:not([data-streamdown])_code]:font-normal",
386
- // Mermaid diagram blocks
387
- '[&_div[data-streamdown="mermaid-block"]]:bg-card-background',
388
- '[&_div[data-streamdown="mermaid-block"]]:text-foreground',
389
- '[&_div[data-streamdown="mermaid-block"]]:flex',
390
- '[&_div[data-streamdown="mermaid-block"]]:flex-col',
391
- '[&_div[data-streamdown="mermaid-block"]]:rounded-lg',
392
- '[&_div[data-streamdown="mermaid-block"]]:hover:bg-accent-background',
393
- '[&_div[data-streamdown="mermaid-block"]]:border-0',
394
- // Positioning context for the action strip (see below)
395
- '[&_div[data-streamdown="mermaid-block"]]:relative',
396
- // Nested scroll + sticky + pointer-events breaks hit-testing on Mermaid Copy/Download
397
- // (same class of issue as github.com/vercel/streamdown/issues/494). Force absolute strip.
398
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!absolute',
399
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!top-2',
400
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!right-2',
401
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!z-10',
402
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!mt-0',
403
- '[&_div[data-streamdown="mermaid-block"]>div:has([data-streamdown="mermaid-block-actions"])]:!pointer-events-auto',
404
- // Ensure mermaid container is tall enough for the toolbar (pan/zoom + actions)
405
- '[&_div[data-streamdown="mermaid-block"]_.relative.w-full]:!min-h-28',
406
- // First and last child margin resets
407
- "[&>*:first-child]:mt-0",
408
- "[&>*:last-child]:mb-0",
409
- e
410
- ),
411
- components: { ...V, ...a },
412
- controls: r ?? W,
413
- plugins: { ...o, mermaid: I },
414
- ...s
415
- }
416
- ),
417
- (e, a) => e.children === a.children
418
- );
419
- X.displayName = "MessageResponse";
420
- function pe({
421
- data: e,
422
- className: a,
423
- onRemove: o,
424
- ...r
425
- }) {
426
- const s = e.filename || "", d = (e.mediaType?.startsWith("image/") && e.url ? "image" : "file") === "image", m = s || (d ? "Image" : "Attachment");
427
- return /* @__PURE__ */ t(
428
- "div",
429
- {
430
- "data-slot": "message-attachment",
431
- className: c(
432
- "group relative size-24 overflow-hidden rounded-lg",
433
- a
434
- ),
435
- ...r,
436
- children: d ? /* @__PURE__ */ l(h, { children: [
437
- /* @__PURE__ */ t(
438
- "img",
439
- {
440
- alt: s || "attachment",
441
- className: "size-full object-cover",
442
- height: 100,
443
- src: e.url,
444
- width: 100
445
- }
446
- ),
447
- o && /* @__PURE__ */ l(
448
- g,
449
- {
450
- "aria-label": "Remove attachment",
451
- className: "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3",
452
- onClick: (i) => {
453
- i.stopPropagation(), o();
454
- },
455
- type: "button",
456
- variant: "ghost",
457
- children: [
458
- /* @__PURE__ */ t(f, {}),
459
- /* @__PURE__ */ t("span", { className: "sr-only", children: "Remove" })
460
- ]
461
- }
462
- )
463
- ] }) : /* @__PURE__ */ l(h, { children: [
464
- /* @__PURE__ */ l(x, { children: [
465
- /* @__PURE__ */ t(
466
- N,
467
- {
468
- render: /* @__PURE__ */ t("div", { className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground", children: /* @__PURE__ */ t(P, { className: "size-4" }) })
469
- }
470
- ),
471
- /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t("p", { children: m }) })
472
- ] }),
473
- o && /* @__PURE__ */ l(
474
- g,
475
- {
476
- "aria-label": "Remove attachment",
477
- className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent-background group-hover:opacity-100 [&>svg]:size-3",
478
- onClick: (i) => {
479
- i.stopPropagation(), o();
480
- },
481
- type: "button",
482
- variant: "ghost",
483
- children: [
484
- /* @__PURE__ */ t(f, {}),
485
- /* @__PURE__ */ t("span", { className: "sr-only", children: "Remove" })
486
- ]
487
- }
488
- )
489
- ] })
490
- }
491
- );
1
+ import { cn as e, getInitials as t } from "../../../../lib/utils.js";
2
+ import { Button as n } from "../button/button.js";
3
+ import { Tooltip as r, TooltipContent as i, TooltipTrigger as a } from "../tooltip/tooltip.js";
4
+ import { ButtonGroup as o, ButtonGroupText as s } from "../button-group/button-group.js";
5
+ import { Avatar as c, AvatarFallback as l, AvatarIcon as u, AvatarImage as d } from "../avatar/avatar.js";
6
+ import { MESSAGE_RESPONSE_DEFAULT_STREAMDOWN_CONTROLS as f } from "./message-response-default-streamdown-controls.js";
7
+ import { createContext as p, useCallback as m, useContext as h, useEffect as g, useMemo as _, useState as v } from "react";
8
+ import { IconChevronLeft as y, IconChevronRight as b, IconPaperclip as x, IconX as S } from "@tabler/icons-react";
9
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
10
+ import { mermaid as E } from "@streamdown/mermaid";
11
+ import { Streamdown as D } from "streamdown";
12
+ //#region libs/aura/src/components/ui/core/message/message.tsx
13
+ var O = ({ className: t, isResponse: n = !1, ...r }) => /* @__PURE__ */ w("div", {
14
+ "data-slot": "message",
15
+ className: e("group flex w-full items-start justify-start gap-3 mb-0 py-3", n ? "is-assistant items-start" : "is-user flex-row-reverse", t),
16
+ ...r
17
+ }), k = ({ children: t, className: n, ...r }) => /* @__PURE__ */ w("div", {
18
+ "data-slot": "message-content",
19
+ className: e("is-user:dark flex flex-col gap-4 rounded-md text-base leading-tight tracking-tightest", "max-w-4/5", "group-[.is-user]:overflow-hidden group-[.is-user]:bg-accent-background group-[.is-user]:p-2 group-[.is-user]:text-foreground", "group-[.is-assistant]:text-foreground group-[.is-assistant]:pt-1", n),
20
+ ...r,
21
+ children: t
22
+ }), A = ({ avatarUrl: n, name: r, className: i, children: a, variant: o, sizes: s, ...u }) => {
23
+ let f = r ? t(r) : "ME";
24
+ return /* @__PURE__ */ w(c, {
25
+ "data-slot": "message-avatar",
26
+ className: e("size-7 group-[.is-user]:mt-1", i),
27
+ variant: o,
28
+ sizes: s,
29
+ ...u,
30
+ children: a || /* @__PURE__ */ T(C, { children: [n && /* @__PURE__ */ w(d, {
31
+ alt: r || "",
32
+ className: "mt-0 mb-0",
33
+ src: n
34
+ }), /* @__PURE__ */ w(l, { children: f })] })
35
+ });
36
+ }, j = (e) => /* @__PURE__ */ w(u, {
37
+ "data-slot": "message-avatar-icon",
38
+ ...e
39
+ }), M = ({ className: t, children: n, ...r }) => /* @__PURE__ */ w("div", {
40
+ "data-slot": "message-actions",
41
+ className: e("flex items-center gap-2 pt-2", t),
42
+ ...r,
43
+ children: n
44
+ }), N = ({ tooltip: t, children: o, label: s, className: c, variant: l = "ghost", size: u = "sm", ...d }) => {
45
+ let f = /* @__PURE__ */ T(n, {
46
+ "data-slot": "message-action",
47
+ className: e("relative icon-sm text-muted-foreground hover:text-foreground", c),
48
+ size: u,
49
+ type: "button",
50
+ variant: l,
51
+ ...d,
52
+ children: [o, /* @__PURE__ */ w("span", {
53
+ className: "sr-only",
54
+ children: s || t
55
+ })]
56
+ });
57
+ return t ? /* @__PURE__ */ T(r, { children: [/* @__PURE__ */ w(a, { render: f }), /* @__PURE__ */ w(i, { children: /* @__PURE__ */ w("p", { children: t }) })] }) : f;
58
+ }, P = p(null), F = () => {
59
+ let e = h(P);
60
+ if (!e) throw Error("MessageBranch components must be used within MessageBranch");
61
+ return e;
62
+ }, I = ({ defaultBranch: t = 0, onBranchChange: n, className: r, ...i }) => {
63
+ let [a, o] = v(t), [s, c] = v([]), l = m(() => {
64
+ o((e) => {
65
+ let t = e > 0 ? e - 1 : s.length - 1;
66
+ return n?.(t), t;
67
+ });
68
+ }, [s.length, n]), u = m(() => {
69
+ o((e) => {
70
+ let t = e < s.length - 1 ? e + 1 : 0;
71
+ return n?.(t), t;
72
+ });
73
+ }, [s.length, n]), d = _(() => ({
74
+ currentBranch: a,
75
+ totalBranches: s.length,
76
+ goToPrevious: l,
77
+ goToNext: u,
78
+ branches: s,
79
+ setBranches: c
80
+ }), [
81
+ a,
82
+ s,
83
+ l,
84
+ u,
85
+ c
86
+ ]);
87
+ return /* @__PURE__ */ w(P.Provider, {
88
+ value: d,
89
+ children: /* @__PURE__ */ w("div", {
90
+ "data-slot": "message-branch",
91
+ className: e("grid w-full gap-2 [&>div]:pb-0", r),
92
+ ...i
93
+ })
94
+ });
95
+ }, L = ({ children: t, ...n }) => {
96
+ let { currentBranch: r, setBranches: i, branches: a } = F(), o = _(() => Array.isArray(t) ? t : [t], [t]);
97
+ return g(() => {
98
+ a.length !== o.length && i(o);
99
+ }, [
100
+ o,
101
+ a,
102
+ i
103
+ ]), o.map((t, i) => /* @__PURE__ */ w("div", {
104
+ "data-slot": "message-branch-content",
105
+ className: e("grid gap-2 overflow-hidden [&>div]:pb-0", i === r ? "block" : "hidden"),
106
+ ...n,
107
+ children: t
108
+ }, t.key));
109
+ }, R = ({ ...e }) => {
110
+ let { totalBranches: t } = F();
111
+ return t <= 1 ? null : /* @__PURE__ */ w(o, {
112
+ "data-slot": "message-branch-selector",
113
+ className: "[&>*:not(:first-child)]:rounded-l-md [&>*:not(:last-child)]:rounded-r-md",
114
+ orientation: "horizontal",
115
+ ...e
116
+ });
117
+ }, z = ({ children: e, ...t }) => {
118
+ let { goToPrevious: r, totalBranches: i } = F();
119
+ return /* @__PURE__ */ w(n, {
120
+ "data-slot": "message-branch-previous",
121
+ "aria-label": "Previous branch",
122
+ disabled: i <= 1,
123
+ onClick: r,
124
+ size: "icon-sm",
125
+ type: "button",
126
+ variant: "ghost",
127
+ ...t,
128
+ children: e ?? /* @__PURE__ */ w(y, { size: 14 })
129
+ });
130
+ }, B = ({ children: e, ...t }) => {
131
+ let { goToNext: r, totalBranches: i } = F();
132
+ return /* @__PURE__ */ w(n, {
133
+ "data-slot": "message-branch-next",
134
+ "aria-label": "Next branch",
135
+ disabled: i <= 1,
136
+ onClick: r,
137
+ size: "icon-sm",
138
+ type: "button",
139
+ variant: "ghost",
140
+ ...t,
141
+ children: e ?? /* @__PURE__ */ w(b, { size: 14 })
142
+ });
143
+ }, V = ({ className: t, ...n }) => {
144
+ let { currentBranch: r, totalBranches: i } = F();
145
+ return /* @__PURE__ */ T(s, {
146
+ "data-slot": "message-branch-page",
147
+ className: e("border-none bg-transparent text-muted-foreground shadow-none px-2", t),
148
+ ...n,
149
+ children: [
150
+ r + 1,
151
+ "/",
152
+ i
153
+ ]
154
+ });
155
+ }, H = {
156
+ h1: ({ children: e }) => /* @__PURE__ */ w("h1", {
157
+ className: "mt-0 mb-2 scroll-m-20 text-xl font-medium tracking-tightest",
158
+ children: e
159
+ }),
160
+ h2: ({ children: e }) => /* @__PURE__ */ w("h2", {
161
+ className: "mt-4 mb-1 scroll-m-20 text-lg font-medium tracking-tightest",
162
+ children: e
163
+ }),
164
+ h3: ({ children: e }) => /* @__PURE__ */ w("h3", {
165
+ className: "mt-4 mb-1 scroll-m-20 text-base font-medium tracking-tighter",
166
+ children: e
167
+ }),
168
+ h4: ({ children: e }) => /* @__PURE__ */ w("h4", {
169
+ className: "mt-2 mb-0 scroll-m-20 text-sm font-medium tracking-normal",
170
+ children: e
171
+ }),
172
+ h5: ({ children: e }) => /* @__PURE__ */ w("h5", {
173
+ className: "mt-0 mb-0 scroll-m-20 text-xs font-medium tracking-tighter",
174
+ children: e
175
+ }),
176
+ h6: ({ children: e }) => /* @__PURE__ */ w("h6", {
177
+ className: "mt-0 mb-0 scroll-m-20 text-2xs font-medium tracking-tighter",
178
+ children: e
179
+ }),
180
+ p: ({ children: e }) => /* @__PURE__ */ w("p", {
181
+ className: "mt-2 mb-3 text-base font-normal leading-5 tracking-tightest",
182
+ children: e
183
+ }),
184
+ strong: ({ children: e }) => /* @__PURE__ */ w("strong", {
185
+ className: "font-medium",
186
+ children: e
187
+ }),
188
+ em: ({ children: e }) => /* @__PURE__ */ w("em", {
189
+ className: "italic",
190
+ children: e
191
+ }),
192
+ b: ({ children: e }) => /* @__PURE__ */ w("b", {
193
+ className: "font-medium",
194
+ children: e
195
+ }),
196
+ i: ({ children: e }) => /* @__PURE__ */ w("i", {
197
+ className: "italic",
198
+ children: e
199
+ }),
200
+ ul: ({ children: e }) => /* @__PURE__ */ w("ul", {
201
+ className: "ml-8.25 mb-3 pt-2 pl-0 pb-0 list-disc text-base font-normal tracking-tightest",
202
+ children: e
203
+ }),
204
+ ol: ({ children: e }) => /* @__PURE__ */ w("ol", {
205
+ className: "ml-8.25 mb-3 pt-2 pl-0 pb-0 list-decimal text-base font-normal tracking-tightest",
206
+ children: e
207
+ }),
208
+ li: ({ children: e }) => /* @__PURE__ */ w("li", {
209
+ className: "py-0",
210
+ children: e
211
+ }),
212
+ blockquote: ({ children: e }) => /* @__PURE__ */ w("blockquote", {
213
+ className: "my-3 pr-2 pl-2 border-l border-l-border text-sm text-muted-foreground font-normal tracking-tight not-italic",
214
+ children: e
215
+ }),
216
+ hr: () => /* @__PURE__ */ w("hr", { className: "my-4 border-border" }),
217
+ a: ({ children: e, href: t, ...n }) => /* @__PURE__ */ w("a", {
218
+ className: "text-link-foreground no-underline hover:underline underline-offset-4",
219
+ href: t,
220
+ ...n,
221
+ children: e
222
+ }),
223
+ table: ({ children: e }) => /* @__PURE__ */ w("div", {
224
+ className: "my-6 overflow-x-auto",
225
+ tabIndex: 0,
226
+ role: "group",
227
+ "aria-label": "Atlas AI Chat Table",
228
+ children: /* @__PURE__ */ w("table", {
229
+ className: "w-full",
230
+ children: e
231
+ })
232
+ }),
233
+ thead: ({ children: e }) => /* @__PURE__ */ w("thead", { children: e }),
234
+ tbody: ({ children: e }) => /* @__PURE__ */ w("tbody", { children: e }),
235
+ tr: ({ children: e }) => /* @__PURE__ */ w("tr", {
236
+ className: "m-0 border-t p-0 even:bg-muted-background",
237
+ children: e
238
+ }),
239
+ th: ({ children: e }) => /* @__PURE__ */ w("th", {
240
+ className: "border px-4 py-2 text-left font-bold",
241
+ children: e
242
+ }),
243
+ td: ({ children: e }) => /* @__PURE__ */ w("td", {
244
+ className: "border px-4 py-2 text-left",
245
+ children: e
246
+ })
247
+ }, U = ({ className: t, components: n, plugins: r, controls: i, ...a }) => /* @__PURE__ */ w(D, {
248
+ "data-slot": "message-response",
249
+ className: e("size-full", "[&_blockquote_p]:text-sm", "[&_blockquote_p]:tracking-tight", "[&_code]:relative", "[&_code]:rounded", "[&_code]:bg-muted-background", "[&_code]:px-[0.3rem]", "[&_code]:py-[0.2rem]", "[&_code]:font-mono", "[&_code]:text-sm", "[&_code]:font-semibold", "[&_div[data-streamdown=\"code-block\"]]:my-4", "[&_div[data-streamdown=\"code-block\"]]:w-full", "[&_div[data-streamdown=\"code-block\"]]:overflow-hidden", "[&_div[data-streamdown=\"code-block\"]]:rounded-xl", "[&_div[data-streamdown=\"code-block\"]]:border", "[&_div[data-streamdown=\"code-block\"]]:border-border", "[&_div[data-streamdown=\"code-block-header\"]]:flex", "[&_div[data-streamdown=\"code-block-header\"]]:items-center", "[&_div[data-streamdown=\"code-block-header\"]]:justify-between", "[&_div[data-streamdown=\"code-block-header\"]]:bg-muted-background/80", "[&_div[data-streamdown=\"code-block-header\"]]:px-4", "[&_div[data-streamdown=\"code-block-header\"]]:py-3", "[&_div[data-streamdown=\"code-block-header\"]]:text-xs", "[&_div[data-streamdown=\"code-block-header\"]]:text-muted-foreground", "[&_div[data-streamdown=\"code-block\"]_pre]:m-0", "[&_div[data-streamdown=\"code-block\"]_pre]:overflow-x-auto", "[&_div[data-streamdown=\"code-block\"]_pre]:border-t", "[&_div[data-streamdown=\"code-block\"]_pre]:border-border", "[&_div[data-streamdown=\"code-block\"]_pre]:bg-background!", "[&_div[data-streamdown=\"code-block\"]_pre]:p-4", "[&_div[data-streamdown=\"code-block\"]_pre]:text-sm", "[&_div[data-streamdown=\"code-block\"]_pre]:text-foreground!", "[&_div[data-streamdown=\"code-block\"]_pre_code]:static", "[&_div[data-streamdown=\"code-block\"]_pre_code]:rounded-none", "[&_div[data-streamdown=\"code-block\"]_pre_code]:bg-transparent", "[&_div[data-streamdown=\"code-block\"]_pre_code]:p-0", "[&_div[data-streamdown=\"code-block\"]_pre_code]:font-mono", "[&_div[data-streamdown=\"code-block\"]_pre_code]:text-sm", "[&_div[data-streamdown=\"code-block\"]_pre_code]:font-normal", "[&_button[data-streamdown=\"code-block-copy-button\"]]:cursor-pointer", "[&_button[data-streamdown=\"code-block-copy-button\"]]:p-1", "[&_button[data-streamdown=\"code-block-copy-button\"]]:text-muted-foreground", "[&_button[data-streamdown=\"code-block-copy-button\"]]:transition-all", "[&_button[data-streamdown=\"code-block-copy-button\"]]:hover:text-foreground", "[&_button[data-streamdown=\"code-block-download-button\"]]:cursor-pointer", "[&_button[data-streamdown=\"code-block-download-button\"]]:p-1", "[&_button[data-streamdown=\"code-block-download-button\"]]:text-muted-foreground", "[&_button[data-streamdown=\"code-block-download-button\"]]:transition-all", "[&_button[data-streamdown=\"code-block-download-button\"]]:hover:text-foreground", "[&_pre:not([data-streamdown])]:my-3", "[&_pre:not([data-streamdown])]:mx-0", "[&_pre:not([data-streamdown])]:overflow-x-auto", "[&_pre:not([data-streamdown])]:rounded-md", "[&_pre:not([data-streamdown])]:border", "[&_pre:not([data-streamdown])]:bg-card-background", "[&_pre:not([data-streamdown])]:p-4", "[&_pre:not([data-streamdown])]:text-foreground", "[&_pre:not([data-streamdown])]:text-sm", "[&_pre:not([data-streamdown])_code]:static", "[&_pre:not([data-streamdown])_code]:rounded-none", "[&_pre:not([data-streamdown])_code]:bg-transparent", "[&_pre:not([data-streamdown])_code]:px-0", "[&_pre:not([data-streamdown])_code]:py-0", "[&_pre:not([data-streamdown])_code]:font-mono", "[&_pre:not([data-streamdown])_code]:text-sm", "[&_pre:not([data-streamdown])_code]:font-normal", "[&_div[data-streamdown=\"mermaid-block\"]]:bg-card-background", "[&_div[data-streamdown=\"mermaid-block\"]]:text-foreground", "[&_div[data-streamdown=\"mermaid-block\"]]:flex", "[&_div[data-streamdown=\"mermaid-block\"]]:flex-col", "[&_div[data-streamdown=\"mermaid-block\"]]:rounded-lg", "[&_div[data-streamdown=\"mermaid-block\"]]:hover:bg-accent-background", "[&_div[data-streamdown=\"mermaid-block\"]]:border-0", "[&_div[data-streamdown=\"mermaid-block\"]]:relative", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!absolute", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!top-2", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!right-2", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!z-10", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!mt-0", "[&_div[data-streamdown=\"mermaid-block\"]>div:has([data-streamdown=\"mermaid-block-actions\"])]:!pointer-events-auto", "[&_div[data-streamdown=\"mermaid-block\"]_.relative.w-full]:!min-h-28", "[&>*:first-child]:mt-0", "[&>*:last-child]:mb-0", t),
250
+ components: {
251
+ ...H,
252
+ ...n
253
+ },
254
+ controls: i ?? f,
255
+ plugins: {
256
+ ...r,
257
+ mermaid: E
258
+ },
259
+ ...a
260
+ });
261
+ function W({ data: t, className: o, onRemove: s, ...c }) {
262
+ let l = t.filename || "", u = (t.mediaType?.startsWith("image/") && t.url ? "image" : "file") == "image", d = l || (u ? "Image" : "Attachment");
263
+ return /* @__PURE__ */ w("div", {
264
+ "data-slot": "message-attachment",
265
+ className: e("group relative size-24 overflow-hidden rounded-lg", o),
266
+ ...c,
267
+ children: u ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("img", {
268
+ alt: l || "attachment",
269
+ className: "size-full object-cover",
270
+ height: 100,
271
+ src: t.url,
272
+ width: 100
273
+ }), s && /* @__PURE__ */ T(n, {
274
+ "aria-label": "Remove attachment",
275
+ className: "absolute top-2 right-2 size-6 rounded-full bg-background/80 p-0 opacity-0 backdrop-blur-sm transition-opacity hover:bg-background group-hover:opacity-100 [&>svg]:size-3",
276
+ onClick: (e) => {
277
+ e.stopPropagation(), s();
278
+ },
279
+ type: "button",
280
+ variant: "ghost",
281
+ children: [/* @__PURE__ */ w(S, {}), /* @__PURE__ */ w("span", {
282
+ className: "sr-only",
283
+ children: "Remove"
284
+ })]
285
+ })] }) : /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ T(r, { children: [/* @__PURE__ */ w(a, { render: /* @__PURE__ */ w("div", {
286
+ className: "flex size-full shrink-0 items-center justify-center rounded-lg bg-muted-background text-muted-foreground",
287
+ children: /* @__PURE__ */ w(x, { className: "size-4" })
288
+ }) }), /* @__PURE__ */ w(i, { children: /* @__PURE__ */ w("p", { children: d }) })] }), s && /* @__PURE__ */ T(n, {
289
+ "aria-label": "Remove attachment",
290
+ className: "size-6 shrink-0 rounded-full p-0 opacity-0 transition-opacity hover:bg-accent-background group-hover:opacity-100 [&>svg]:size-3",
291
+ onClick: (e) => {
292
+ e.stopPropagation(), s();
293
+ },
294
+ type: "button",
295
+ variant: "ghost",
296
+ children: [/* @__PURE__ */ w(S, {}), /* @__PURE__ */ w("span", {
297
+ className: "sr-only",
298
+ children: "Remove"
299
+ })]
300
+ })] })
301
+ });
492
302
  }
493
- function he({
494
- children: e,
495
- className: a,
496
- ...o
497
- }) {
498
- return e ? /* @__PURE__ */ t(
499
- "div",
500
- {
501
- "data-slot": "message-attachments",
502
- className: c(
503
- "ml-auto flex w-fit flex-wrap items-start gap-2",
504
- a
505
- ),
506
- ...o,
507
- children: e
508
- }
509
- ) : null;
303
+ function G({ children: t, className: n, ...r }) {
304
+ return t ? /* @__PURE__ */ w("div", {
305
+ "data-slot": "message-attachments",
306
+ className: e("ml-auto flex w-fit flex-wrap items-start gap-2", n),
307
+ ...r,
308
+ children: t
309
+ }) : null;
510
310
  }
511
- const _e = ({
512
- className: e,
513
- children: a,
514
- ...o
515
- }) => /* @__PURE__ */ t(
516
- "div",
517
- {
518
- "data-slot": "message-toolbar",
519
- className: c(
520
- "mt-4 flex w-full items-center justify-between gap-4",
521
- e
522
- ),
523
- ...o,
524
- children: a
525
- }
526
- );
527
- export {
528
- oe as Message,
529
- ce as MessageAction,
530
- ne as MessageActions,
531
- pe as MessageAttachment,
532
- he as MessageAttachments,
533
- de as MessageAvatar,
534
- se as MessageAvatarIcon,
535
- me as MessageBranch,
536
- le as MessageBranchContent,
537
- ue as MessageBranchNext,
538
- ge as MessageBranchPage,
539
- be as MessageBranchPrevious,
540
- ie as MessageBranchSelector,
541
- re as MessageContent,
542
- X as MessageResponse,
543
- _e as MessageToolbar
544
- };
311
+ var K = ({ className: t, children: n, ...r }) => /* @__PURE__ */ w("div", {
312
+ "data-slot": "message-toolbar",
313
+ className: e("mt-4 flex w-full items-center justify-between gap-4", t),
314
+ ...r,
315
+ children: n
316
+ });
317
+ //#endregion
318
+ export { O as Message, N as MessageAction, M as MessageActions, W as MessageAttachment, G as MessageAttachments, A as MessageAvatar, j as MessageAvatarIcon, I as MessageBranch, L as MessageBranchContent, B as MessageBranchNext, V as MessageBranchPage, z as MessageBranchPrevious, R as MessageBranchSelector, k as MessageContent, U as MessageResponse, K as MessageToolbar };