@uipath/apollo-wind 2.68.0 → 2.70.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.
Files changed (80) hide show
  1. package/dist/components/custom/chat-first-experience.cjs +3 -3
  2. package/dist/components/custom/chat-first-experience.js +3 -3
  3. package/dist/components/custom/demo-composer.cjs +80 -0
  4. package/dist/components/custom/demo-composer.d.ts +11 -0
  5. package/dist/components/custom/demo-composer.js +46 -0
  6. package/dist/components/custom/panel-flow.cjs +2 -2
  7. package/dist/components/custom/panel-flow.js +2 -2
  8. package/dist/components/ui/chat-composer.cjs +429 -0
  9. package/dist/components/ui/chat-composer.d.ts +157 -0
  10. package/dist/components/ui/chat-composer.js +359 -0
  11. package/dist/components/ui/citation.cjs +188 -0
  12. package/dist/components/ui/citation.d.ts +42 -0
  13. package/dist/components/ui/citation.js +148 -0
  14. package/dist/components/ui/code-block.cjs +375 -0
  15. package/dist/components/ui/code-block.d.ts +38 -0
  16. package/dist/components/ui/code-block.js +307 -0
  17. package/dist/components/ui/dropzone-overlay.cjs +142 -0
  18. package/dist/components/ui/dropzone-overlay.d.ts +27 -0
  19. package/dist/components/ui/dropzone-overlay.js +105 -0
  20. package/dist/components/ui/file-upload.cjs +5 -29
  21. package/dist/components/ui/file-upload.js +2 -26
  22. package/dist/components/ui/file-validation.cjs +91 -0
  23. package/dist/components/ui/file-validation.d.ts +24 -0
  24. package/dist/components/ui/file-validation.js +51 -0
  25. package/dist/components/ui/hover-card.cjs +15 -8
  26. package/dist/components/ui/hover-card.d.ts +4 -1
  27. package/dist/components/ui/hover-card.js +16 -9
  28. package/dist/components/ui/index.cjs +330 -198
  29. package/dist/components/ui/index.d.ts +12 -0
  30. package/dist/components/ui/index.js +12 -0
  31. package/dist/components/ui/input-group.cjs +1 -1
  32. package/dist/components/ui/input-group.d.ts +2 -1
  33. package/dist/components/ui/input-group.js +1 -1
  34. package/dist/components/ui/json-tree-view/JsonTree.cjs +2 -2
  35. package/dist/components/ui/json-tree-view/JsonTree.js +1 -1
  36. package/dist/components/ui/json-tree-view/index.cjs +26 -23
  37. package/dist/components/ui/json-tree-view/index.d.ts +2 -2
  38. package/dist/components/ui/json-tree-view/index.js +2 -2
  39. package/dist/components/ui/live-region.cjs +106 -0
  40. package/dist/components/ui/live-region.d.ts +31 -0
  41. package/dist/components/ui/live-region.js +72 -0
  42. package/dist/components/ui/loading-dots.cjs +95 -0
  43. package/dist/components/ui/loading-dots.d.ts +21 -0
  44. package/dist/components/ui/loading-dots.js +55 -0
  45. package/dist/components/ui/markdown.cjs +428 -0
  46. package/dist/components/ui/markdown.d.ts +55 -0
  47. package/dist/components/ui/markdown.js +378 -0
  48. package/dist/components/ui/message-actions.cjs +302 -0
  49. package/dist/components/ui/message-actions.d.ts +102 -0
  50. package/dist/components/ui/message-actions.js +241 -0
  51. package/dist/components/ui/message.cjs +1 -1
  52. package/dist/components/ui/message.d.ts +2 -0
  53. package/dist/components/ui/message.js +1 -1
  54. package/dist/components/ui/sources.cjs +175 -0
  55. package/dist/components/ui/sources.d.ts +44 -0
  56. package/dist/components/ui/sources.js +132 -0
  57. package/dist/components/ui/thinking-indicator.cjs +146 -0
  58. package/dist/components/ui/thinking-indicator.d.ts +38 -0
  59. package/dist/components/ui/thinking-indicator.js +106 -0
  60. package/dist/components/ui/tool-call.cjs +359 -0
  61. package/dist/components/ui/tool-call.d.ts +75 -0
  62. package/dist/components/ui/tool-call.js +301 -0
  63. package/dist/index.cjs +433 -253
  64. package/dist/index.d.ts +24 -0
  65. package/dist/index.js +13 -1
  66. package/dist/lib/index.cjs +8 -1
  67. package/dist/lib/index.d.ts +1 -0
  68. package/dist/lib/index.js +2 -1
  69. package/dist/lib/url.cjs +54 -0
  70. package/dist/lib/url.d.ts +8 -0
  71. package/dist/lib/url.js +17 -0
  72. package/dist/styles.css +363 -35
  73. package/dist/tailwind.utilities.css +21 -0
  74. package/package.json +7 -1
  75. package/dist/components/custom/chat-composer.cjs +0 -134
  76. package/dist/components/custom/chat-composer.d.ts +0 -14
  77. package/dist/components/custom/chat-composer.js +0 -100
  78. /package/dist/{components/ui/json-tree-view → lib}/clipboard.cjs +0 -0
  79. /package/dist/{components/ui/json-tree-view → lib}/clipboard.d.ts +0 -0
  80. /package/dist/{components/ui/json-tree-view → lib}/clipboard.js +0 -0
@@ -0,0 +1,21 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import * as React from 'react';
3
+ declare const loadingDotsVariants: (props?: ({
4
+ size?: "lg" | "sm" | "md" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export interface LoadingDotsStrings {
7
+ /** Accessible name of the status. */
8
+ label: string;
9
+ }
10
+ export declare const DEFAULT_LOADING_DOTS_STRINGS: LoadingDotsStrings;
11
+ export interface LoadingDotsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>, VariantProps<typeof loadingDotsVariants> {
12
+ /** Overrides for any subset of the English strings. An explicit `aria-label` wins over `label`. */
13
+ strings?: Partial<LoadingDotsStrings>;
14
+ }
15
+ /**
16
+ * Three dots with a staggered bounce, for compact waits inside a conversation such as loading
17
+ * older messages or a typing hint. The dots take `currentColor`, so set the colour with a text
18
+ * class. They hold still under `prefers-reduced-motion` (handled by `animate-loading-dot`).
19
+ */
20
+ declare const LoadingDots: React.ForwardRefExoticComponent<LoadingDotsProps & React.RefAttributes<HTMLDivElement>>;
21
+ export { LoadingDots, loadingDotsVariants };
@@ -0,0 +1,55 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { forwardRef } from "react";
4
+ import { cn } from "../../lib/index.js";
5
+ const loadingDotsVariants = cva('inline-flex shrink-0 items-end text-muted-foreground', {
6
+ variants: {
7
+ size: {
8
+ sm: 'h-2 gap-0.5 [&>[data-slot=loading-dot]]:size-1',
9
+ md: 'h-3 gap-1 [&>[data-slot=loading-dot]]:size-1.5',
10
+ lg: 'h-4 gap-1.5 [&>[data-slot=loading-dot]]:size-2'
11
+ }
12
+ },
13
+ defaultVariants: {
14
+ size: 'md'
15
+ }
16
+ });
17
+ const DOT_DELAYS = [
18
+ '[animation-delay:0ms]',
19
+ '[animation-delay:150ms]',
20
+ '[animation-delay:300ms]'
21
+ ];
22
+ const DEFAULT_LOADING_DOTS_STRINGS = {
23
+ label: 'Loading'
24
+ };
25
+ const LoadingDots = /*#__PURE__*/ forwardRef(({ className, size = 'md', strings, 'aria-label': ariaLabel, ...props }, ref)=>{
26
+ const text = {
27
+ ...DEFAULT_LOADING_DOTS_STRINGS,
28
+ ...strings
29
+ };
30
+ const name = ariaLabel ?? text.label;
31
+ return /*#__PURE__*/ jsxs("div", {
32
+ ref: ref,
33
+ "data-slot": "loading-dots",
34
+ "data-size": size,
35
+ role: "status",
36
+ "aria-label": name,
37
+ className: cn(loadingDotsVariants({
38
+ size
39
+ }), className),
40
+ ...props,
41
+ children: [
42
+ DOT_DELAYS.map((delay)=>/*#__PURE__*/ jsx("span", {
43
+ "data-slot": "loading-dot",
44
+ "aria-hidden": "true",
45
+ className: cn('animate-loading-dot rounded-full bg-current', delay)
46
+ }, delay)),
47
+ /*#__PURE__*/ jsx("span", {
48
+ className: "sr-only",
49
+ children: name
50
+ })
51
+ ]
52
+ });
53
+ });
54
+ LoadingDots.displayName = 'LoadingDots';
55
+ export { DEFAULT_LOADING_DOTS_STRINGS, LoadingDots, loadingDotsVariants };
@@ -0,0 +1,428 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ DEFAULT_MARKDOWN_STRINGS: ()=>DEFAULT_MARKDOWN_STRINGS,
37
+ Markdown: ()=>Markdown
38
+ });
39
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
40
+ const external_react_namespaceObject = require("react");
41
+ const external_react_markdown_namespaceObject = require("react-markdown");
42
+ var external_react_markdown_default = /*#__PURE__*/ __webpack_require__.n(external_react_markdown_namespaceObject);
43
+ const external_rehype_katex_namespaceObject = require("rehype-katex");
44
+ var external_rehype_katex_default = /*#__PURE__*/ __webpack_require__.n(external_rehype_katex_namespaceObject);
45
+ const external_remark_gfm_namespaceObject = require("remark-gfm");
46
+ var external_remark_gfm_default = /*#__PURE__*/ __webpack_require__.n(external_remark_gfm_namespaceObject);
47
+ const external_remark_math_namespaceObject = require("remark-math");
48
+ var external_remark_math_default = /*#__PURE__*/ __webpack_require__.n(external_remark_math_namespaceObject);
49
+ const external_code_block_cjs_namespaceObject = require("./code-block.cjs");
50
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
51
+ function hastText(node) {
52
+ if ('text' === node.type) return node.value ?? '';
53
+ return (node.children ?? []).map(hastText).join('');
54
+ }
55
+ function languageOf(node) {
56
+ const className = node.properties?.className;
57
+ const classes = Array.isArray(className) ? className.map(String) : [];
58
+ return classes.find((name)=>name.startsWith('language-'))?.slice('language-'.length);
59
+ }
60
+ const opensInNewTab = (href)=>!!href && !/^(#|mailto:|tel:)/i.test(href);
61
+ const BR_TAG = /^<br\s*\/?>$/i;
62
+ function remarkHtmlBreaks() {
63
+ const visit = (node)=>{
64
+ if (!node.children) return;
65
+ node.children = node.children.map((child)=>'html' === child.type && BR_TAG.test(child.value?.trim() ?? '') ? {
66
+ type: 'break'
67
+ } : child);
68
+ node.children.forEach(visit);
69
+ };
70
+ return (tree)=>visit(tree);
71
+ }
72
+ const CURSOR_CONTAINERS = new Set([
73
+ 'ul',
74
+ 'ol',
75
+ 'li',
76
+ 'blockquote',
77
+ 'table',
78
+ 'thead',
79
+ 'tbody',
80
+ 'tr'
81
+ ]);
82
+ const CURSOR_TEXT_BLOCKS = new Set([
83
+ 'p',
84
+ 'h1',
85
+ 'h2',
86
+ 'h3',
87
+ 'h4',
88
+ 'h5',
89
+ 'h6',
90
+ 'td',
91
+ 'th'
92
+ ]);
93
+ const CURSOR_CLASS = 'ml-0.5 inline-block h-[1.1em] w-[0.45em] translate-y-[0.2em] rounded-[1px] bg-foreground animate-pulse motion-reduce:animate-none';
94
+ function lastContent(node) {
95
+ const children = node.children ?? [];
96
+ for(let i = children.length - 1; i >= 0; i--){
97
+ const child = children[i];
98
+ if ('element' === child.type) return child;
99
+ if ('text' === child.type && child.value?.trim()) return child;
100
+ }
101
+ }
102
+ function findCursorHost(root) {
103
+ let node = root;
104
+ for(;;){
105
+ const last = lastContent(node);
106
+ if (last?.type !== 'element' || !last.tagName) return node;
107
+ if (CURSOR_TEXT_BLOCKS.has(last.tagName)) return last;
108
+ if (!CURSOR_CONTAINERS.has(last.tagName)) return node;
109
+ node = last;
110
+ }
111
+ }
112
+ function rehypeStreamingCursor() {
113
+ return (tree)=>{
114
+ const host = findCursorHost(tree);
115
+ host.children = [
116
+ ...host.children ?? [],
117
+ {
118
+ type: 'element',
119
+ tagName: 'span',
120
+ properties: {
121
+ dataSlot: 'markdown-cursor',
122
+ ariaHidden: 'true',
123
+ className: [
124
+ CURSOR_CLASS
125
+ ]
126
+ },
127
+ children: []
128
+ }
129
+ ];
130
+ };
131
+ }
132
+ function rehypeScopeFootnoteLabel(options) {
133
+ const LABEL = 'footnote-label';
134
+ const scoped = `${options.prefix}${LABEL}`;
135
+ const visit = (node)=>{
136
+ const properties = node.properties;
137
+ if (properties?.id === LABEL) properties.id = scoped;
138
+ if (properties && Array.isArray(properties.ariaDescribedBy)) properties.ariaDescribedBy = properties.ariaDescribedBy.map((ref)=>ref === LABEL ? scoped : ref);
139
+ node.children?.forEach(visit);
140
+ };
141
+ return (tree)=>visit(tree);
142
+ }
143
+ const DEFAULT_MARKDOWN_STRINGS = {
144
+ ...external_code_block_cjs_namespaceObject.DEFAULT_CODE_BLOCK_STRINGS,
145
+ footnotes: 'Footnotes',
146
+ footnoteBack: 'Back to content',
147
+ taskDone: 'Done',
148
+ taskOpen: 'Not done'
149
+ };
150
+ function isAllowedImageSrc(src, policy) {
151
+ if ('none' === policy) return false;
152
+ if ('all' === policy) return true;
153
+ if ('function' == typeof policy) return policy(src);
154
+ try {
155
+ const base = "u" < typeof window ? 'https://relative.invalid' : window.location.href;
156
+ return new URL(src, base).origin === new URL(base).origin;
157
+ } catch {
158
+ return false;
159
+ }
160
+ }
161
+ const MarkdownContext = /*#__PURE__*/ external_react_namespaceObject.createContext({
162
+ strings: DEFAULT_MARKDOWN_STRINGS,
163
+ images: 'none',
164
+ codeWrap: false
165
+ });
166
+ const InsideLinkContext = /*#__PURE__*/ external_react_namespaceObject.createContext(false);
167
+ const LINK_CLASS = 'font-medium text-foreground-link underline underline-offset-2 hover:no-underline';
168
+ function MarkdownLink({ node: _node, className, href, children, ...rest }) {
169
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
170
+ href: href,
171
+ className: (0, index_cjs_namespaceObject.cn)(LINK_CLASS, className),
172
+ ...opensInNewTab(href) ? {
173
+ target: '_blank',
174
+ rel: 'noreferrer'
175
+ } : {},
176
+ ...rest,
177
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InsideLinkContext.Provider, {
178
+ value: true,
179
+ children: children
180
+ })
181
+ });
182
+ }
183
+ function MarkdownImage({ node: _node, className, alt, src, ...rest }) {
184
+ const { images } = external_react_namespaceObject.useContext(MarkdownContext);
185
+ const insideLink = external_react_namespaceObject.useContext(InsideLinkContext);
186
+ const source = 'string' == typeof src ? src : '';
187
+ if (source && isAllowedImageSrc(source, images)) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
188
+ alt: alt ?? '',
189
+ src: source,
190
+ loading: "lazy",
191
+ referrerPolicy: "no-referrer",
192
+ className: (0, index_cjs_namespaceObject.cn)('h-auto max-w-full rounded-md', className),
193
+ ...rest
194
+ });
195
+ const label = alt || source;
196
+ if (insideLink || !source) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
197
+ "data-slot": "markdown-image-text",
198
+ children: label
199
+ });
200
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("a", {
201
+ "data-slot": "markdown-image-link",
202
+ href: source,
203
+ target: "_blank",
204
+ rel: "noreferrer",
205
+ className: LINK_CLASS,
206
+ children: label
207
+ });
208
+ }
209
+ function MarkdownInput({ node: _node, className, type, checked, ...rest }) {
210
+ const { strings } = external_react_namespaceObject.useContext(MarkdownContext);
211
+ if ('checkbox' !== type) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
212
+ type: type,
213
+ className: className,
214
+ ...rest
215
+ });
216
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
217
+ children: [
218
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("input", {
219
+ type: "checkbox",
220
+ checked: checked,
221
+ "aria-hidden": "true",
222
+ tabIndex: -1,
223
+ className: (0, index_cjs_namespaceObject.cn)('mr-2 size-3.5 translate-y-0.5 accent-primary', className),
224
+ ...rest
225
+ }),
226
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
227
+ "data-slot": "markdown-task-state",
228
+ className: "sr-only",
229
+ children: [
230
+ checked ? strings.taskDone : strings.taskOpen,
231
+ ' '
232
+ ]
233
+ })
234
+ ]
235
+ });
236
+ }
237
+ function MarkdownPre({ node, children, ...rest }) {
238
+ const { strings, codeWrap, renderCodeActions } = external_react_namespaceObject.useContext(MarkdownContext);
239
+ const codeNode = node?.children?.find((child)=>'element' === child.type && 'code' === child.tagName);
240
+ if (!codeNode) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
241
+ ...rest,
242
+ children: children
243
+ });
244
+ const block = {
245
+ code: hastText(codeNode).replace(/\n$/, ''),
246
+ language: languageOf(codeNode)
247
+ };
248
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_code_block_cjs_namespaceObject.CodeBlock, {
249
+ code: block.code,
250
+ language: block.language,
251
+ wrap: codeWrap,
252
+ actions: renderCodeActions?.(block),
253
+ strings: strings
254
+ });
255
+ }
256
+ const BUILT_IN_COMPONENTS = {
257
+ h1: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h1", {
258
+ className: (0, index_cjs_namespaceObject.cn)('text-xl font-semibold tracking-tight', className),
259
+ ...rest
260
+ }),
261
+ h2: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h2", {
262
+ className: (0, index_cjs_namespaceObject.cn)('text-lg font-semibold tracking-tight', className),
263
+ ...rest
264
+ }),
265
+ h3: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h3", {
266
+ className: (0, index_cjs_namespaceObject.cn)('text-base font-semibold', className),
267
+ ...rest
268
+ }),
269
+ h4: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h4", {
270
+ className: (0, index_cjs_namespaceObject.cn)('text-sm font-semibold', className),
271
+ ...rest
272
+ }),
273
+ h5: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h5", {
274
+ className: (0, index_cjs_namespaceObject.cn)('text-sm font-semibold', className),
275
+ ...rest
276
+ }),
277
+ h6: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h6", {
278
+ className: (0, index_cjs_namespaceObject.cn)('text-sm font-semibold text-muted-foreground', className),
279
+ ...rest
280
+ }),
281
+ p: ({ node: _node, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("p", {
282
+ ...rest
283
+ }),
284
+ a: MarkdownLink,
285
+ ul: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("ul", {
286
+ className: (0, index_cjs_namespaceObject.cn)('flex flex-col gap-1 pl-6', className?.includes('contains-task-list') ? 'list-none pl-1' : 'list-disc', 'marker:text-muted-foreground', className),
287
+ ...rest
288
+ }),
289
+ ol: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("ol", {
290
+ className: (0, index_cjs_namespaceObject.cn)('flex list-decimal flex-col gap-1 pl-6 marker:text-muted-foreground', className),
291
+ ...rest
292
+ }),
293
+ li: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("li", {
294
+ className: (0, index_cjs_namespaceObject.cn)('pl-1 [&>ol]:mt-1 [&>p+p]:mt-2 [&>ul]:mt-1 [&>ul.contains-task-list]:pl-6', className),
295
+ ...rest
296
+ }),
297
+ input: MarkdownInput,
298
+ blockquote: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("blockquote", {
299
+ className: (0, index_cjs_namespaceObject.cn)('flex flex-col gap-2 border-l-2 border-border pl-4 text-muted-foreground', className),
300
+ ...rest
301
+ }),
302
+ hr: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("hr", {
303
+ className: (0, index_cjs_namespaceObject.cn)('border-border-subtle', className),
304
+ ...rest
305
+ }),
306
+ img: MarkdownImage,
307
+ table: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
308
+ "data-slot": "markdown-table",
309
+ tabIndex: 0,
310
+ className: "max-w-full overflow-x-auto rounded-lg border border-border-subtle outline-none focus-visible:ring-2 focus-visible:ring-ring",
311
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("table", {
312
+ className: (0, index_cjs_namespaceObject.cn)('w-full border-collapse text-left [&_tr:last-child>td]:border-b-0', className),
313
+ ...rest
314
+ })
315
+ }),
316
+ th: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("th", {
317
+ className: (0, index_cjs_namespaceObject.cn)('border-b border-border-subtle bg-surface-overlay px-3 py-2 font-semibold', className),
318
+ ...rest
319
+ }),
320
+ td: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("td", {
321
+ className: (0, index_cjs_namespaceObject.cn)('border-b border-border-subtle px-3 py-2 align-top', className),
322
+ ...rest
323
+ }),
324
+ code: ({ node: _node, className, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("code", {
325
+ className: (0, index_cjs_namespaceObject.cn)('rounded-md bg-surface-overlay px-1.5 py-0.5 font-mono text-[0.875em]', className),
326
+ ...rest
327
+ }),
328
+ pre: MarkdownPre
329
+ };
330
+ const Markdown = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ children, components, remarkPlugins, rehypePlugins, streaming = false, images = 'none', codeWrap = false, renderCodeActions, strings, className, ...props }, ref)=>{
331
+ const context = external_react_namespaceObject.useMemo(()=>({
332
+ strings: {
333
+ ...DEFAULT_MARKDOWN_STRINGS,
334
+ ...strings
335
+ },
336
+ images,
337
+ codeWrap,
338
+ renderCodeActions
339
+ }), [
340
+ strings,
341
+ images,
342
+ codeWrap,
343
+ renderCodeActions
344
+ ]);
345
+ const { footnotes, footnoteBack } = context.strings;
346
+ const footnotePrefix = `markdown${external_react_namespaceObject.useId().replace(/[^\w-]/g, '')}-`;
347
+ const mergedComponents = external_react_namespaceObject.useMemo(()=>components ? {
348
+ ...BUILT_IN_COMPONENTS,
349
+ ...components
350
+ } : BUILT_IN_COMPONENTS, [
351
+ components
352
+ ]);
353
+ const mergedRemarkPlugins = external_react_namespaceObject.useMemo(()=>[
354
+ external_remark_gfm_default(),
355
+ [
356
+ external_remark_math_default(),
357
+ {
358
+ singleDollarTextMath: false
359
+ }
360
+ ],
361
+ remarkHtmlBreaks,
362
+ ...remarkPlugins ?? []
363
+ ], [
364
+ remarkPlugins
365
+ ]);
366
+ const mergedRehypePlugins = external_react_namespaceObject.useMemo(()=>[
367
+ [
368
+ rehypeScopeFootnoteLabel,
369
+ {
370
+ prefix: footnotePrefix
371
+ }
372
+ ],
373
+ [
374
+ external_rehype_katex_default(),
375
+ {
376
+ output: 'mathml',
377
+ throwOnError: false,
378
+ trust: false,
379
+ strict: 'ignore'
380
+ }
381
+ ],
382
+ ...rehypePlugins ?? [],
383
+ ...streaming ? [
384
+ rehypeStreamingCursor
385
+ ] : []
386
+ ], [
387
+ rehypePlugins,
388
+ streaming,
389
+ footnotePrefix
390
+ ]);
391
+ const remarkRehypeOptions = external_react_namespaceObject.useMemo(()=>({
392
+ clobberPrefix: footnotePrefix,
393
+ footnoteLabel: footnotes,
394
+ footnoteBackLabel: footnoteBack
395
+ }), [
396
+ footnotePrefix,
397
+ footnotes,
398
+ footnoteBack
399
+ ]);
400
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
401
+ ref: ref,
402
+ "data-slot": "markdown",
403
+ "data-streaming": streaming || void 0,
404
+ "aria-busy": streaming || void 0,
405
+ className: (0, index_cjs_namespaceObject.cn)('flex min-w-0 flex-col gap-3 text-sm leading-relaxed break-words text-foreground [&_math]:text-[1.15em] [&>.katex]:overflow-x-auto [&>.katex]:py-1', className),
406
+ ...props,
407
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(MarkdownContext.Provider, {
408
+ value: context,
409
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_markdown_default(), {
410
+ components: mergedComponents,
411
+ remarkPlugins: mergedRemarkPlugins,
412
+ rehypePlugins: mergedRehypePlugins,
413
+ remarkRehypeOptions: remarkRehypeOptions,
414
+ children: children
415
+ })
416
+ })
417
+ });
418
+ });
419
+ Markdown.displayName = 'Markdown';
420
+ exports.DEFAULT_MARKDOWN_STRINGS = __webpack_exports__.DEFAULT_MARKDOWN_STRINGS;
421
+ exports.Markdown = __webpack_exports__.Markdown;
422
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
423
+ "DEFAULT_MARKDOWN_STRINGS",
424
+ "Markdown"
425
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
426
+ Object.defineProperty(exports, '__esModule', {
427
+ value: true
428
+ });
@@ -0,0 +1,55 @@
1
+ import * as React from 'react';
2
+ import { type Components, type Options } from 'react-markdown';
3
+ import { type CodeBlockStrings } from './code-block';
4
+ export interface MarkdownStrings extends CodeBlockStrings {
5
+ /** Heading of the generated footnotes section. */
6
+ footnotes: string;
7
+ /** Label of the link from a footnote back to its reference. */
8
+ footnoteBack: string;
9
+ /** Read by screen readers before a completed task list item. */
10
+ taskDone: string;
11
+ /** Read by screen readers before an open task list item. */
12
+ taskOpen: string;
13
+ }
14
+ export declare const DEFAULT_MARKDOWN_STRINGS: MarkdownStrings;
15
+ export interface MarkdownProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
16
+ /** The markdown source. */
17
+ children: string;
18
+ /**
19
+ * react-markdown renderers merged over the built-in ones. Use it with `remarkPlugins` to render
20
+ * custom nodes such as citations or resource chips. `code` only styles inline code: fenced blocks
21
+ * render through `pre`, so override `pre` (or use `renderCodeActions`) to change them.
22
+ */
23
+ components?: Components;
24
+ /** Extra remark plugins, run after GFM and math. */
25
+ remarkPlugins?: Options['remarkPlugins'];
26
+ /** Extra rehype plugins, run after KaTeX. */
27
+ rehypePlugins?: Options['rehypePlugins'];
28
+ /**
29
+ * The source is still arriving. Shows a caret after the last text and marks the region busy.
30
+ * Partial markdown is safe to pass: unclosed fences render as code and broken TeX as source.
31
+ */
32
+ streaming?: boolean;
33
+ /**
34
+ * Which images load automatically. Markdown in a chat comes from a model: a cross-origin image
35
+ * URL can carry conversation data to a third party, and a same-origin one can fire an
36
+ * authenticated GET, both without any click. By default no image loads; each renders as a link
37
+ * the reader can choose to open. Opt in with `'same-origin'`, `'all'` for trusted content, or a
38
+ * predicate for an allowlist. (react-markdown already drops `data:` and other unsafe URLs.)
39
+ */
40
+ images?: MarkdownImagePolicy;
41
+ /** Wrap long lines in fenced code instead of scrolling horizontally. */
42
+ codeWrap?: boolean;
43
+ /** Extra header actions for each fenced code block (preview, expand), placed before the copy. */
44
+ renderCodeActions?: (block: MarkdownCodeBlock) => React.ReactNode;
45
+ strings?: Partial<MarkdownStrings>;
46
+ }
47
+ export interface MarkdownCodeBlock {
48
+ /** The block's source without the trailing newline. */
49
+ code: string;
50
+ /** The fence's info string as written, e.g. `ts` or `html`. */
51
+ language: string | undefined;
52
+ }
53
+ export type MarkdownImagePolicy = 'none' | 'same-origin' | 'all' | ((src: string) => boolean);
54
+ declare const Markdown: React.ForwardRefExoticComponent<MarkdownProps & React.RefAttributes<HTMLDivElement>>;
55
+ export { Markdown };