@epam/ai-dial-chat-shared 1.2.0-dev.3 → 1.2.0-dev.303

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 (58) hide show
  1. package/components/ConfirmationDialog/ConfirmationDialog.js +34 -0
  2. package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.js +21 -0
  3. package/components/ConfirmationIdentityCard/ConfirmationIdentityCard.module.scss.js +6 -0
  4. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.js +24 -0
  5. package/components/ConfirmationIdentityRow/ConfirmationIdentityRow.module.scss.js +3 -0
  6. package/components/ConfirmationView/ConfirmationFooter.js +42 -0
  7. package/components/ConfirmationView/ConfirmationView.js +39 -0
  8. package/components/ConfirmationView/ConfirmationView.module.scss.js +7 -0
  9. package/components/FeaturedChip/FeaturedChip.js +9 -14
  10. package/components/InitialsAvatar/InitialsAvatar.js +10 -27
  11. package/components/MarkdownRenderer/CodeBlock/CodeBlock.js +65 -63
  12. package/components/MarkdownRenderer/CodeBlock/CodeBlock.module.scss.js +6 -6
  13. package/components/MarkdownRenderer/MDMessageViewer.js +25 -17
  14. package/components/MarkdownRenderer/MarkdownRenderer.js +119 -118
  15. package/components/MarkdownRenderer/MarkdownRenderer.module.scss.js +7 -7
  16. package/components/MarkdownRenderer/Math/MarkdownMathBlock.js +19 -18
  17. package/components/MarkdownRenderer/Math/MarkdownMathBlock.module.scss.js +2 -2
  18. package/components/MarkdownRenderer/PlainTextRenderer.js +21 -0
  19. package/components/MarkdownRenderer/Table/MarkdownTable.js +71 -56
  20. package/components/MarkdownRenderer/Table/MarkdownTable.module.scss.js +11 -11
  21. package/components/MarkdownRenderer/Table/TableHeader.js +18 -21
  22. package/components/MarkdownRenderer/Table/table-serialization.js +23 -3
  23. package/components/MarkdownRenderer/Table/useMarkdownTableActions/useMarkdownTableActions.js +48 -62
  24. package/components/MarkdownRenderer/ThinkingShimmer.js +14 -0
  25. package/components/MarkdownWithPlaceholders/MarkdownWithPlaceholders.js +3 -2
  26. package/components/PanelEmptyState/PanelEmptyState.js +2 -1
  27. package/components/TextRefinementField/TextRefinementField.js +86 -0
  28. package/constants/dial.js +2 -2
  29. package/constants/mime-types.js +49 -2
  30. package/constants/public-class-names.js +10 -0
  31. package/constants/resizable-fields.js +2 -2
  32. package/file-manager/DialFileManagerShell/DialFileManagerShell.js +257 -239
  33. package/file-manager/FileManagerAttachModal/FileManagerAttachModal.js +36 -32
  34. package/file-manager/OperationLoaderModal/OperationLoaderModal.js +17 -20
  35. package/file-manager/upload-batch.js +2 -2
  36. package/file-manager/upload-queue.js +17 -0
  37. package/file-manager.d.ts +35 -20
  38. package/file-manager.js +4 -3
  39. package/hooks/useTextRefinement.js +66 -0
  40. package/hooks/useUnsavedChangesGuard.js +30 -0
  41. package/index.css +2 -2
  42. package/index.d.ts +616 -53
  43. package/index.js +73 -62
  44. package/markdown.d.ts +79 -15
  45. package/markdown.js +13 -11
  46. package/models/chat.js +4 -2
  47. package/package.json +5 -5
  48. package/types/attachment.js +1 -1
  49. package/utils/entity-field-limits.js +4 -0
  50. package/utils/entity-type.js +15 -0
  51. package/utils/file-download.js +6 -6
  52. package/utils/is-skill-selection-unsupported.js +4 -0
  53. package/utils/latex.js +5 -3
  54. package/utils/merge-class.js +5 -4
  55. package/utils/mime-type.js +10 -6
  56. package/utils/syntax-highlighting.js +13 -0
  57. package/components/InitialsAvatar/InitialsAvatar.module.scss.js +0 -6
  58. package/file-manager/UploadProgressModal/UploadProgressModal.js +0 -56
@@ -8,20 +8,21 @@ import { MarkdownMathBlock as o } from "./Math/MarkdownMathBlock.js";
8
8
  import s from "./Table/MarkdownTable.module.scss.js";
9
9
  import { MarkdownTable as c } from "./Table/MarkdownTable.js";
10
10
  import { MarkdownTaskCheckbox as l } from "./TaskCheckbox/MarkdownTaskCheckbox.js";
11
- import u from "remark-gfm";
12
- import { memo as d, useEffect as f, useMemo as p, useState as m } from "react";
13
- import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
14
- import v, { defaultUrlTransform as y } from "react-markdown";
15
- import b from "rehype-raw";
16
- import x, { defaultSchema as S } from "rehype-sanitize";
17
- import C from "remark-breaks";
18
- import w from "remark-math";
11
+ import { ThinkingShimmer as u } from "./ThinkingShimmer.js";
12
+ import d from "remark-gfm";
13
+ import { memo as f, useEffect as p, useMemo as m, useState as h } from "react";
14
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
15
+ import y, { defaultUrlTransform as b } from "react-markdown";
16
+ import x from "rehype-raw";
17
+ import S, { defaultSchema as C } from "rehype-sanitize";
18
+ import w from "remark-breaks";
19
+ import T from "remark-math";
19
20
  //#region src/components/MarkdownRenderer/MarkdownRenderer.tsx
20
- var T = [
21
- u,
22
- C,
23
- [w, { singleDollarTextMath: !1 }]
24
- ], E = /* @__PURE__ */ "math.maction.annotation.annotation-xml.menclose.merror.mfenced.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.semantics.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover".split("."), D = {
21
+ var E = [
22
+ d,
23
+ w,
24
+ [T, { singleDollarTextMath: !1 }]
25
+ ], D = /* @__PURE__ */ "math.maction.annotation.annotation-xml.menclose.merror.mfenced.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.semantics.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover".split("."), O = {
25
26
  math: ["display", "xmlns"],
26
27
  annotation: ["encoding"],
27
28
  mfrac: ["linethickness"],
@@ -50,231 +51,231 @@ var T = [
50
51
  "width"
51
52
  ],
52
53
  mtd: ["width"]
53
- }, O = [b], k = [x, {
54
- ...S,
54
+ }, k = [x], A = [S, {
55
+ ...C,
55
56
  tagNames: [
56
- ...S.tagNames ?? [],
57
- ...E,
57
+ ...C.tagNames ?? [],
58
+ ...D,
58
59
  "cit"
59
60
  ],
60
61
  attributes: {
61
- ...S.attributes,
62
- ...D,
63
- code: [...S.attributes?.code ?? [], ["className"]],
62
+ ...C.attributes,
63
+ ...O,
64
+ code: [...C.attributes?.code ?? [], ["className"]],
64
65
  cit: ["dataId"],
65
- span: [...S.attributes?.span ?? [], [
66
+ span: [...C.attributes?.span ?? [], [
66
67
  "className",
67
68
  "katex",
68
69
  "katex-error"
69
70
  ]]
70
71
  }
71
- }], A = [], j = /\$\$|\\\(|\\\[/, M = (e) => j.test(e), N = {}, P = (e) => e == null ? y : (t) => y(e(t)), F = {
72
- li: ({ children: e }) => /* @__PURE__ */ g("li", {
72
+ }], j = [], M = /\$\$|\\\(|\\\[/, N = (e) => M.test(e), P = {}, F = (e) => e == null ? b : (t) => b(e(t)), I = {
73
+ li: ({ children: e }) => /* @__PURE__ */ _("li", {
73
74
  className: "mb-1.5 last:mb-0",
74
75
  children: e
75
76
  }),
76
- cit: ({ children: e, ...t }) => /* @__PURE__ */ _(h, { children: [
77
+ cit: ({ children: e, ...t }) => /* @__PURE__ */ v(g, { children: [
77
78
  t["data-id"] == null ? "<cit>" : `<cit data-id="${t["data-id"]}">`,
78
79
  e,
79
80
  "</cit>"
80
81
  ] })
81
- }, I = (e) => {
82
+ }, L = (e) => {
82
83
  let t = e?.properties?.className;
83
84
  return !Array.isArray(t) || !t.includes("katex") ? !1 : (e?.children ?? []).some((e) => e.type === "element" && e.tagName === "math" && e.properties?.display === "block");
84
- }, L = {
85
+ }, R = {
85
86
  left: "text-start",
86
87
  center: "text-center",
87
88
  right: "text-end"
88
- }, R = (e) => {
89
+ }, z = (e) => {
89
90
  let t = e?.properties?.align;
90
- return typeof t == "string" ? L[t] : void 0;
91
- }, z = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(z).join("") : "", B = (t, { isStreaming: n, codeBlockCopyLabel: r, codeBlockCopiedLabel: u, codeBlockTheme: d, tableActionLabels: f, tableDownloadFilename: p, tableOnOpenInCanvas: m, tableScrollRegionAriaLabel: _, mathScrollRegionAriaLabel: v }) => ({
92
- h1: ({ children: e }) => /* @__PURE__ */ g("h1", {
91
+ return typeof t == "string" ? R[t] : void 0;
92
+ }, B = (e) => e ? e.type === "text" ? e.value ?? "" : (e.children ?? []).map(B).join("") : "", V = (t, { isStreaming: n, codeBlockCopyLabel: r, codeBlockCopiedLabel: u, codeBlockDownloadLabel: d, codeBlockTheme: f, tableActionLabels: p, tableDownloadFilename: m, tableOnOpenInCanvas: h, tableScrollRegionAriaLabel: v, mathScrollRegionAriaLabel: y }) => ({
93
+ h1: ({ children: e }) => /* @__PURE__ */ _("h1", {
93
94
  className: t.h1,
94
95
  children: e
95
96
  }),
96
- h2: ({ children: e }) => /* @__PURE__ */ g("h2", {
97
+ h2: ({ children: e }) => /* @__PURE__ */ _("h2", {
97
98
  className: t.h2,
98
99
  children: e
99
100
  }),
100
- h3: ({ children: e }) => /* @__PURE__ */ g("h3", {
101
+ h3: ({ children: e }) => /* @__PURE__ */ _("h3", {
101
102
  className: t.h3,
102
103
  children: e
103
104
  }),
104
- h4: ({ children: e }) => /* @__PURE__ */ g("h4", {
105
+ h4: ({ children: e }) => /* @__PURE__ */ _("h4", {
105
106
  className: t.h4,
106
107
  children: e
107
108
  }),
108
- h5: ({ children: e }) => /* @__PURE__ */ g("h5", {
109
+ h5: ({ children: e }) => /* @__PURE__ */ _("h5", {
109
110
  className: t.h5,
110
111
  children: e
111
112
  }),
112
- h6: ({ children: n }) => /* @__PURE__ */ g("h6", {
113
+ h6: ({ children: n }) => /* @__PURE__ */ _("h6", {
113
114
  className: e(a.h6, t.h6),
114
115
  children: n
115
116
  }),
116
- p: ({ children: n }) => /* @__PURE__ */ g("p", {
117
+ p: ({ children: n }) => /* @__PURE__ */ _("p", {
117
118
  className: e("break-words", t.p),
118
119
  children: n
119
120
  }),
120
- ul: ({ children: n }) => /* @__PURE__ */ g("ul", {
121
+ ul: ({ children: n }) => /* @__PURE__ */ _("ul", {
121
122
  className: e("list-disc ps-[2em]", t.ul),
122
123
  children: n
123
124
  }),
124
- ol: ({ children: n }) => /* @__PURE__ */ g("ol", {
125
+ ol: ({ children: n }) => /* @__PURE__ */ _("ol", {
125
126
  className: e("list-decimal ps-[2em]", t.ol),
126
127
  children: n
127
128
  }),
128
- strong: ({ children: e }) => /* @__PURE__ */ g("strong", {
129
+ strong: ({ children: e }) => /* @__PURE__ */ _("strong", {
129
130
  className: t.strong ?? "dial-body-paragraph-semi-text",
130
131
  children: e
131
132
  }),
132
- em: ({ children: e }) => /* @__PURE__ */ g("em", {
133
+ em: ({ children: e }) => /* @__PURE__ */ _("em", {
133
134
  className: t.em ?? "italic",
134
135
  children: e
135
136
  }),
136
- pre: ({ children: e }) => /* @__PURE__ */ g(h, { children: e }),
137
+ pre: ({ children: e }) => /* @__PURE__ */ _(g, { children: e }),
137
138
  code: ({ children: o, className: s }) => {
138
139
  let c = /language-(\w+)/.exec(s ?? "")?.[1] ?? "", l = String(o);
139
- return c || l.includes("\n") ? /* @__PURE__ */ g(i, {
140
+ return c || l.includes("\n") ? /* @__PURE__ */ _(i, {
140
141
  language: c,
141
142
  value: l.replace(/\n$/, ""),
142
143
  isStreaming: n,
143
- theme: d,
144
+ theme: f,
144
145
  copyLabel: r,
145
146
  copiedLabel: u,
147
+ downloadLabel: d,
146
148
  containerClassName: t.codeBlockContainer,
147
149
  headerClassName: t.codeBlockHeader,
148
150
  codeClassName: t.codeFont
149
- }) : /* @__PURE__ */ g("code", {
151
+ }) : /* @__PURE__ */ _("code", {
150
152
  className: e("rounded px-1 py-0.5", a.codeInline, t.codeInlineFont ?? "dial-code-text", t.codeInline),
151
153
  children: o
152
154
  });
153
155
  },
154
- blockquote: ({ children: n }) => /* @__PURE__ */ g("blockquote", {
156
+ blockquote: ({ children: n }) => /* @__PURE__ */ _("blockquote", {
155
157
  className: e("border-s-2 py-1 ps-4", a.blockquote, t.blockquote),
156
158
  children: n
157
159
  }),
158
- a: ({ href: n, children: r }) => /* @__PURE__ */ g("a", {
160
+ a: ({ href: n, children: r }) => /* @__PURE__ */ _("a", {
159
161
  href: n,
160
162
  target: "_blank",
161
163
  rel: "noopener noreferrer",
162
164
  className: e("decoration-current/60 break-words underline underline-offset-2 hover:decoration-current focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-2", a.link, t.link),
163
165
  children: r
164
166
  }),
165
- hr: () => /* @__PURE__ */ g("hr", { className: e("my-5 border-t", a.secondaryBorder, t.hr) }),
166
- del: ({ children: n }) => /* @__PURE__ */ g("del", {
167
+ hr: () => /* @__PURE__ */ _("hr", { className: e("my-5 border-t", a.secondaryBorder, t.hr) }),
168
+ del: ({ children: n }) => /* @__PURE__ */ _("del", {
167
169
  className: e("opacity-75", t.del),
168
170
  children: n
169
171
  }),
170
- input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */ g(l, { checked: t ?? !1 }) : null,
171
- span: ({ children: e, node: n, ...r }) => I(n) ? /* @__PURE__ */ g(o, {
172
+ input: ({ type: e, checked: t }) => e === "checkbox" ? /* @__PURE__ */ _(l, { checked: t ?? !1 }) : null,
173
+ span: ({ children: e, node: n, ...r }) => L(n) ? /* @__PURE__ */ _(o, {
172
174
  className: t.mathBlock,
173
- scrollRegionAriaLabel: v,
175
+ scrollRegionAriaLabel: y,
174
176
  children: e
175
- }) : /* @__PURE__ */ g("span", {
177
+ }) : /* @__PURE__ */ _("span", {
176
178
  ...r,
177
179
  children: e
178
180
  }),
179
- table: ({ children: e }) => /* @__PURE__ */ g(c, {
181
+ table: ({ children: e }) => /* @__PURE__ */ _(c, {
180
182
  classNames: t,
181
- actionLabels: f,
182
- downloadFilename: p,
183
- onOpenInCanvas: m,
183
+ actionLabels: p,
184
+ downloadFilename: m,
185
+ onOpenInCanvas: h,
184
186
  isStreaming: n,
185
- scrollRegionAriaLabel: _,
187
+ scrollRegionAriaLabel: v,
186
188
  children: e
187
189
  }),
188
190
  tr: ({ children: t, node: n }) => {
189
- let r = n?.children.filter((e) => e.type === "element") ?? [], i = r.some((e) => e.tagName === "th"), a = r.filter((e) => z(e).trim().length > 0).length, o = !i && r.length > 1 && a === 1;
190
- return /* @__PURE__ */ g("tr", {
191
+ let r = n?.children.filter((e) => e.type === "element") ?? [], i = r.some((e) => e.tagName === "th"), a = r.filter((e) => B(e).trim().length > 0).length, o = !i && r.length > 1 && a === 1;
192
+ return /* @__PURE__ */ _("tr", {
191
193
  className: e(s.row, o && s.sectionRow),
192
194
  children: t
193
195
  });
194
196
  },
195
- th: ({ children: n, node: r }) => /* @__PURE__ */ g("th", {
197
+ th: ({ children: n, node: r }) => /* @__PURE__ */ _("th", {
196
198
  scope: "col",
197
- className: e("sticky top-0 z-[2] max-w-96 whitespace-normal break-words px-3 py-2.5 text-start", R(r), s.rowDivider, s.tableHeaderCell, t.tableHeaderFont ?? "dial-tiny-lead-semi-text", t.tableCell, t.tableHeader),
199
+ className: e("sticky top-0 z-[2] max-w-96 whitespace-normal break-words px-3 py-2.5 text-start", z(r), s.rowDivider, s.tableHeaderCell, t.tableHeaderFont ?? "dial-tiny-lead-semi-text", t.tableCell, t.tableHeader),
198
200
  children: n
199
201
  }),
200
- td: ({ children: n, node: r }) => /* @__PURE__ */ g("td", {
201
- className: e("max-w-96 whitespace-normal px-3 py-2.5 align-top [overflow-wrap:anywhere]", R(r), s.rowDivider, t.tableBodyCell, t.tableCell),
202
+ td: ({ children: n, node: r }) => /* @__PURE__ */ _("td", {
203
+ className: e("max-w-96 whitespace-normal px-3 py-[7px] align-top [overflow-wrap:anywhere]", z(r), s.rowDivider, t.tableBodyCell, t.tableCell),
202
204
  children: n
203
205
  })
204
- }), V = d(({ content: e, containerClassName: i, isStreaming: o, streamCharactersPerSecond: s, classNames: c = N, components: l, urlTransform: u, rehypePlugins: d = A, thinkingLabel: h = "Thinking", codeBlockCopyLabel: _, codeBlockCopiedLabel: y, codeBlockTheme: b, colors: x, tableActionLabels: S, tableDownloadFilename: C, tableOnOpenInCanvas: w, tableScrollRegionAriaLabel: E, mathScrollRegionAriaLabel: D }) => {
205
- let j = n(e, o, s), I = p(() => r(j), [j]), L = p(() => M(I), [I]), [R, z] = m(null);
206
- f(() => {
207
- if (!L || R) return;
206
+ }), H = f(({ content: e, containerClassName: i, isStreaming: a, streamCharactersPerSecond: o, classNames: s = P, components: c, urlTransform: l, rehypePlugins: d = j, thinkingLabel: f = "Thinking", codeBlockCopyLabel: g, codeBlockCopiedLabel: v, codeBlockDownloadLabel: b, codeBlockTheme: x, colors: S, tableActionLabels: C, tableDownloadFilename: w, tableOnOpenInCanvas: T, tableScrollRegionAriaLabel: D, mathScrollRegionAriaLabel: O }) => {
207
+ let M = n(e, a, o), L = m(() => r(M), [M]), R = m(() => N(L), [L]), [z, B] = h(null);
208
+ p(() => {
209
+ if (!R || z) return;
208
210
  let e = !1;
209
211
  return (async () => {
210
212
  let [t] = await Promise.all([import("rehype-katex"), import("katex/dist/katex.min.css")]);
211
- e || z([t.default, {
213
+ e || B([t.default, {
212
214
  output: "mathml",
213
215
  strict: !1
214
216
  }]);
215
217
  })(), () => {
216
218
  e = !0;
217
219
  };
218
- }, [L, R]);
219
- let V = p(() => [
220
- ...O,
221
- ...R ? [R] : [],
222
- k,
220
+ }, [R, z]);
221
+ let H = m(() => [
222
+ ...k,
223
+ ...z ? [z] : [],
224
+ A,
223
225
  ...d
224
- ], [R, d]), H = t({
225
- "--cm-thinking-inverted": x?.thinkingPrimary,
226
- "--cm-thinking-secondary": x?.thinkingSecondary,
227
- "--cm-markdown-border": x?.border,
228
- "--cm-blockquote-border": x?.blockquoteBorder,
229
- "--cm-blockquote-text": x?.blockquoteText,
230
- "--cm-link-text": x?.linkText,
231
- "--cm-link-focus": x?.linkFocus,
232
- "--cm-table-header-text": x?.tableHeaderText,
233
- "--cm-h6-text": x?.headingSixText,
234
- "--cm-code-inline-bg": x?.inlineCodeBackground,
235
- "--cm-code-inline-text": x?.inlineCodeText
236
- }), U = p(() => P(u), [u]), W = p(() => ({
237
- ...B(c, {
238
- isStreaming: o,
239
- codeBlockCopyLabel: _,
240
- codeBlockCopiedLabel: y,
241
- codeBlockTheme: b,
242
- tableActionLabels: S,
243
- tableDownloadFilename: C,
244
- tableOnOpenInCanvas: w,
245
- tableScrollRegionAriaLabel: E,
246
- mathScrollRegionAriaLabel: D
226
+ ], [z, d]), U = t({
227
+ "--cm-markdown-border": S?.border,
228
+ "--cm-blockquote-border": S?.blockquoteBorder,
229
+ "--cm-blockquote-text": S?.blockquoteText,
230
+ "--cm-link-text": S?.linkText,
231
+ "--cm-link-focus": S?.linkFocus,
232
+ "--cm-table-header-text": S?.tableHeaderText,
233
+ "--cm-h6-text": S?.headingSixText,
234
+ "--cm-code-inline-bg": S?.inlineCodeBackground,
235
+ "--cm-code-inline-text": S?.inlineCodeText
236
+ }), W = m(() => F(l), [l]), G = m(() => ({
237
+ ...V(s, {
238
+ isStreaming: a,
239
+ codeBlockCopyLabel: g,
240
+ codeBlockCopiedLabel: v,
241
+ codeBlockDownloadLabel: b,
242
+ codeBlockTheme: x,
243
+ tableActionLabels: C,
244
+ tableDownloadFilename: w,
245
+ tableOnOpenInCanvas: T,
246
+ tableScrollRegionAriaLabel: D,
247
+ mathScrollRegionAriaLabel: O
247
248
  }),
248
- ...F,
249
- ...l
249
+ ...I,
250
+ ...c
250
251
  }), [
251
- c,
252
- o,
253
- _,
254
- y,
252
+ s,
253
+ a,
254
+ g,
255
+ v,
255
256
  b,
256
- S,
257
+ x,
257
258
  C,
258
259
  w,
259
- E,
260
+ T,
260
261
  D,
261
- l
262
+ O,
263
+ c
262
264
  ]);
263
- return o && !j ? /* @__PURE__ */ g("span", {
264
- className: a.thinking,
265
- style: H,
266
- children: h
267
- }) : /* @__PURE__ */ g("div", {
268
- style: H,
265
+ return a && !M ? /* @__PURE__ */ _(u, {
266
+ label: f,
267
+ colors: S
268
+ }) : /* @__PURE__ */ _("div", {
269
+ style: U,
269
270
  className: i,
270
- children: /* @__PURE__ */ g(v, {
271
- remarkPlugins: T,
272
- rehypePlugins: V,
273
- components: W,
274
- urlTransform: U,
275
- children: I
271
+ children: /* @__PURE__ */ _(y, {
272
+ remarkPlugins: E,
273
+ rehypePlugins: H,
274
+ components: G,
275
+ urlTransform: W,
276
+ children: L
276
277
  })
277
278
  });
278
279
  });
279
280
  //#endregion
280
- export { V as MarkdownRenderer, F as defaultMarkdownComponents };
281
+ export { H as MarkdownRenderer, I as defaultMarkdownComponents };
@@ -1,11 +1,11 @@
1
1
  var e = {
2
- thinking: "_thinking_1g29w_9",
3
- "cm-shimmer": "_cm-shimmer_1g29w_1",
4
- h6: "_h6_1g29w_18",
5
- codeInline: "_codeInline_1g29w_22",
6
- secondaryBorder: "_secondaryBorder_1g29w_27",
7
- blockquote: "_blockquote_1g29w_31",
8
- link: "_link_1g29w_36"
2
+ thinking: "_thinking_1ql91_9",
3
+ "cm-shimmer": "_cm-shimmer_1ql91_1",
4
+ h6: "_h6_1ql91_18",
5
+ codeInline: "_codeInline_1ql91_22",
6
+ secondaryBorder: "_secondaryBorder_1ql91_27",
7
+ blockquote: "_blockquote_1ql91_31",
8
+ link: "_link_1ql91_36"
9
9
  };
10
10
  //#endregion
11
11
  export { e as default };
@@ -1,24 +1,25 @@
1
1
  import { mergeClasses as e } from "../../../utils/merge-class.js";
2
- import { useHorizontalOverflow as t } from "../../../hooks/useHorizontalOverflow.js";
3
- import n from "./MarkdownMathBlock.module.scss.js";
4
- import { memo as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
2
+ import { CHAT_SHARED_CLASS as t } from "../../../constants/public-class-names.js";
3
+ import { useHorizontalOverflow as n } from "../../../hooks/useHorizontalOverflow.js";
4
+ import r from "./MarkdownMathBlock.module.scss.js";
5
+ import { memo as i } from "react";
6
+ import { jsx as a } from "react/jsx-runtime";
6
7
  //#region src/components/MarkdownRenderer/Math/MarkdownMathBlock.tsx
7
- var a = r(({ children: r, className: a, scrollRegionAriaLabel: o = "Scrollable formula" }) => {
8
- let { scrollContainerRef: s, contentRef: c, hasContentBeyondStart: l, hasContentBeyondEnd: u, handleScroll: d } = t(), f = l || u;
9
- return /* @__PURE__ */ i("div", {
10
- ref: s,
11
- className: e("w-full min-w-0 max-w-full overflow-x-auto overflow-y-hidden", n.scrollContainer, a),
12
- onScroll: d,
13
- role: f ? "region" : void 0,
14
- "aria-label": f ? o : void 0,
15
- tabIndex: f ? 0 : void 0,
16
- children: /* @__PURE__ */ i("span", {
17
- ref: c,
18
- className: e("katex", n.mathContent),
19
- children: r
8
+ var o = i(({ children: i, className: o, scrollRegionAriaLabel: s = "Scrollable formula" }) => {
9
+ let { scrollContainerRef: c, contentRef: l, hasContentBeyondStart: u, hasContentBeyondEnd: d, handleScroll: f } = n(), p = u || d;
10
+ return /* @__PURE__ */ a("div", {
11
+ ref: c,
12
+ className: e("w-full min-w-0 max-w-full overflow-x-auto overflow-y-hidden", r.scrollContainer, o, t.mathBlock),
13
+ onScroll: f,
14
+ role: p ? "region" : void 0,
15
+ "aria-label": p ? s : void 0,
16
+ tabIndex: p ? 0 : void 0,
17
+ children: /* @__PURE__ */ a("span", {
18
+ ref: l,
19
+ className: e("katex", r.mathContent),
20
+ children: i
20
21
  })
21
22
  });
22
23
  });
23
24
  //#endregion
24
- export { a as MarkdownMathBlock };
25
+ export { o as MarkdownMathBlock };
@@ -1,6 +1,6 @@
1
1
  var e = {
2
- scrollContainer: "_scrollContainer_1f433_1",
3
- mathContent: "_mathContent_1f433_24"
2
+ scrollContainer: "_scrollContainer_n2oom_1",
3
+ mathContent: "_mathContent_n2oom_24"
4
4
  };
5
5
  //#endregion
6
6
  export { e as default };
@@ -0,0 +1,21 @@
1
+ import { mergeClasses as e } from "../../utils/merge-class.js";
2
+ import { useStreamedMarkdownContent as t } from "../../hooks/useStreamedMarkdownContent.js";
3
+ import { ThinkingShimmer as n } from "./ThinkingShimmer.js";
4
+ import { memo as r } from "react";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ //#region src/components/MarkdownRenderer/PlainTextRenderer.tsx
7
+ var a = {}, o = r(({ content: r, containerClassName: o, isStreaming: s, streamCharactersPerSecond: c, classNames: l = a, thinkingLabel: u = "Thinking", colors: d }) => {
8
+ let f = t(r, s, c);
9
+ return s && !f ? /* @__PURE__ */ i(n, {
10
+ label: u,
11
+ colors: d
12
+ }) : /* @__PURE__ */ i("div", {
13
+ className: o,
14
+ children: /* @__PURE__ */ i("p", {
15
+ className: e(l.p, "whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),
16
+ children: f
17
+ })
18
+ });
19
+ });
20
+ //#endregion
21
+ export { o as PlainTextRenderer };
@@ -1,77 +1,92 @@
1
1
  import { mergeClasses as e } from "../../../utils/merge-class.js";
2
2
  import { buildCssVars as t } from "../../../utils/build-css-vars.js";
3
- import { copyToClipboard as n } from "../../../utils/copy-to-clipboard.js";
3
+ import { copyMarkdownAsRichText as n } from "../../../utils/copy-to-clipboard.js";
4
4
  import { downloadTextFile as r } from "../../../utils/file-download.js";
5
- import { TableHeader as i } from "./TableHeader.js";
5
+ import { CHAT_SHARED_CLASS as i } from "../../../constants/public-class-names.js";
6
6
  import { useHorizontalOverflow as a } from "../../../hooks/useHorizontalOverflow.js";
7
7
  import o from "./MarkdownTable.module.scss.js";
8
8
  import { MARKDOWN_TABLE_CSV_MIME_TYPE as s, MarkdownTableCopyFormat as c, serializeMarkdownTableRows as l } from "./table-serialization.js";
9
9
  import { useMarkdownTableActions as u } from "./useMarkdownTableActions/useMarkdownTableActions.js";
10
- import { memo as d, useCallback as f, useEffect as p, useRef as m, useState as h } from "react";
11
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ import { ElementSize as d, GhostIconButton as f } from "@epam/ai-dial-ui-kit";
11
+ import { memo as p, useCallback as m, useEffect as h, useRef as g, useState as _ } from "react";
12
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
12
13
  //#region src/components/MarkdownRenderer/Table/MarkdownTable.tsx
13
- var v = 2e3, y = d(({ children: d, classNames: y, colors: b, actionLabels: x, downloadFilename: S, isStreaming: C, onOpenInCanvas: w, scrollRegionAriaLabel: T = "Scrollable table" }) => {
14
- let [E, D] = h(void 0), O = m(null), { scrollContainerRef: k, contentRef: A, hasContentBeyondStart: j, hasContentBeyondEnd: M, handleScroll: N } = a(), P = t({
15
- "--cm-markdown-border": b?.border,
16
- "--cm-table-scrollbar": b?.scrollbar,
17
- "--cm-table-fade": b?.fade,
18
- "--cm-table-row-divider": b?.rowDivider,
19
- "--cm-table-row-zebra-bg": b?.rowZebraBackground,
20
- "--cm-table-row-hover-bg": b?.rowHoverBackground
21
- }), F = j || M;
22
- p(() => () => {
23
- O.current != null && clearTimeout(O.current);
14
+ var b = 2e3, x = p(({ children: p, classNames: x, colors: S, actionLabels: C, downloadFilename: w, isStreaming: T, onOpenInCanvas: E, scrollRegionAriaLabel: D = "Scrollable table" }) => {
15
+ let [O, k] = _(!1), A = g(null), { scrollContainerRef: j, contentRef: M, hasContentBeyondStart: N, hasContentBeyondEnd: P, handleScroll: F } = a(), I = t({
16
+ "--cm-markdown-border": S?.border,
17
+ "--cm-table-scrollbar": S?.scrollbar,
18
+ "--cm-table-fade": S?.fade,
19
+ "--cm-table-row-divider": S?.rowDivider,
20
+ "--cm-table-row-hover-bg": S?.rowHoverBackground
21
+ }), L = N || P;
22
+ h(() => () => {
23
+ A.current != null && clearTimeout(A.current);
24
24
  }, []);
25
- let I = f((e) => {
26
- let t = A.current;
27
- t != null && n(l(Array.from(t.rows), e)).then((t) => {
28
- t && (O.current != null && clearTimeout(O.current), D(e), O.current = setTimeout(() => {
29
- D(void 0);
30
- }, v));
25
+ let R = m(() => {
26
+ let e = M.current;
27
+ e != null && n(l(Array.from(e.rows), c.Markdown)).then((e) => {
28
+ e && (A.current != null && clearTimeout(A.current), k(!0), A.current = setTimeout(() => {
29
+ k(!1);
30
+ }, b));
31
31
  });
32
- }, [A]), L = f(() => {
33
- let e = A.current;
34
- e != null && r(`\uFEFF${l(Array.from(e.rows), c.Csv)}`, S ?? "table.csv", s);
35
- }, [A, S]), R = f(() => {
36
- let e = A.current;
37
- e == null || w == null || w(l(Array.from(e.rows), c.Markdown));
38
- }, [A, w]), z = u({
39
- actionLabels: x,
40
- copiedFormat: E,
41
- onCopy: I,
42
- onDownloadCsv: L,
43
- onOpenInCanvas: w == null ? void 0 : R
44
- }), B = z.length > 0 && !C;
45
- return /* @__PURE__ */ _("div", {
46
- style: P,
47
- className: e("relative w-full min-w-0 max-w-full overflow-hidden rounded-xl border", o.tableContainer, o.tableContainerLight, y.tableWrapper),
32
+ }, [M]), z = m(() => {
33
+ let e = M.current;
34
+ e != null && r(`\uFEFF${l(Array.from(e.rows), c.Csv)}`, w ?? "table.csv", s);
35
+ }, [M, w]), B = m(() => {
36
+ let e = M.current;
37
+ e == null || E == null || E(l(Array.from(e.rows), c.Markdown));
38
+ }, [M, E]), V = u({
39
+ actionLabels: C,
40
+ isCopied: O,
41
+ onCopy: R,
42
+ onDownloadCsv: z,
43
+ onOpenInCanvas: E == null ? void 0 : B
44
+ }), H = V.length > 0 && !T;
45
+ return /* @__PURE__ */ y("div", {
46
+ style: I,
47
+ className: e("group/table relative w-full min-w-0 max-w-full rounded-xl border [overflow:clip]", o.tableContainer, x.tableWrapper, i.table),
48
48
  children: [
49
- B && /* @__PURE__ */ g(i, { actions: z }),
50
- /* @__PURE__ */ g("div", {
51
- ref: k,
52
- className: e("w-full min-w-0 max-w-full overflow-x-auto", o.scrollContainer, y.tableScrollContainer, {
53
- [o.tableScrollFadeBoth]: j && M,
54
- [o.tableScrollFadeStart]: j && !M,
55
- [o.tableScrollFadeEnd]: !j && M
56
- }),
57
- onScroll: N,
58
- role: F ? "region" : void 0,
59
- "aria-label": F ? T : void 0,
60
- tabIndex: F ? 0 : void 0,
61
- children: /* @__PURE__ */ g("table", {
62
- ref: A,
63
- className: e("w-max min-w-full border-collapse", y.tableFont ?? "dial-small-text"),
64
- children: d
49
+ H && /* @__PURE__ */ v("div", {
50
+ className: "sticky top-0 z-10 h-0",
51
+ children: /* @__PURE__ */ v("div", {
52
+ className: "absolute end-2 top-2 flex items-center gap-1 rounded-lg border border-tertiary bg-layer-raised px-2 py-1 opacity-0 shadow-xs transition-opacity focus-within:opacity-100 group-hover/table:opacity-100",
53
+ children: V.map((e) => /* @__PURE__ */ v(f, {
54
+ tooltipProps: { tooltip: e.label },
55
+ "aria-label": e.label,
56
+ icon: /* @__PURE__ */ v("span", {
57
+ "aria-hidden": !0,
58
+ children: e.icon
59
+ }),
60
+ size: d.Small,
61
+ onClick: e.onClick
62
+ }, e.label))
65
63
  })
66
64
  }),
67
- x?.copiedLabel && /* @__PURE__ */ g("span", {
65
+ /* @__PURE__ */ v("div", {
66
+ ref: j,
67
+ className: e("w-full min-w-0 max-w-full overflow-x-auto", o.scrollContainer, x.tableScrollContainer, {
68
+ [o.tableScrollFadeBoth]: N && P,
69
+ [o.tableScrollFadeStart]: N && !P,
70
+ [o.tableScrollFadeEnd]: !N && P
71
+ }, i.tableScroll),
72
+ onScroll: F,
73
+ role: L ? "region" : void 0,
74
+ "aria-label": L ? D : void 0,
75
+ tabIndex: L ? 0 : void 0,
76
+ children: /* @__PURE__ */ v("table", {
77
+ ref: M,
78
+ className: e("w-max min-w-full border-collapse", x.tableFont ?? "dial-small-text"),
79
+ children: p
80
+ })
81
+ }),
82
+ C?.copyLabel && /* @__PURE__ */ v("span", {
68
83
  "aria-live": "polite",
69
84
  className: "sr-only",
70
85
  role: "status",
71
- children: E ? x.copiedLabel : ""
86
+ children: O ? C.copiedLabel ?? "" : ""
72
87
  })
73
88
  ]
74
89
  });
75
90
  });
76
91
  //#endregion
77
- export { y as MarkdownTable };
92
+ export { x as MarkdownTable };