@inkeep/agents-ui 0.0.0-dev-20260507192144 → 0.0.0-dev-20260508004313
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/primitives/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/built-in-icons.d.ts +1 -4
- package/dist/primitives/atoms/icons/built-in-icons.js +91 -94
- package/dist/primitives/atoms/icons/collections/pi.cjs +1 -1
- package/dist/primitives/atoms/icons/collections/pi.d.ts +0 -3
- package/dist/primitives/atoms/icons/collections/pi.js +37 -82
- package/dist/primitives/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/primitives/atoms/icons/inkeep-default-icons.js +1 -4
- package/dist/primitives/components/embedded-chat/file-upload-input.cjs +1 -1
- package/dist/primitives/components/embedded-chat/file-upload-input.d.ts +1 -0
- package/dist/primitives/components/embedded-chat/file-upload-input.js +207 -346
- package/dist/primitives/components/embedded-chat.js +1 -6
- package/dist/primitives/components/tagline-logo-icon.js +9 -50
- package/dist/primitives/hooks/use-initial-conversation.js +1 -4
- package/dist/primitives/hooks/use-input-notification.js +9 -9
- package/dist/styled/components/embedded-chat/image-preview-modal.js +2 -9
- package/dist/styled/components/embedded-chat.js +2 -14
- package/dist/styled/components/embedded-search.js +1 -7
- package/dist/types/icons/built-in.d.ts +1 -1
- package/dist/types/icons/custom.d.ts +0 -3
- package/package.json +2 -2
|
@@ -1,205 +1,65 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { CustomIcon as
|
|
5
|
-
import { useImagePreview as
|
|
6
|
-
import { useMessage as
|
|
7
|
-
import { useChat as
|
|
8
|
-
import { useFileUploadApi as
|
|
9
|
-
import { dataAttr as
|
|
10
|
-
import { composeEventHandlers as
|
|
2
|
+
import { jsx as a, jsxs as x } from "react/jsx-runtime";
|
|
3
|
+
import P, { useState as C, useEffect as T, useMemo as w } from "react";
|
|
4
|
+
import { CustomIcon as F } from "../../atoms/icons/custom-icon.js";
|
|
5
|
+
import { useImagePreview as b } from "../../providers/image-preview-provider.js";
|
|
6
|
+
import { useMessage as L } from "../../providers/message-provider.js";
|
|
7
|
+
import { useChat as d } from "./chat-provider.js";
|
|
8
|
+
import { useFileUploadApi as m, FileUploadRoot as M } from "../../atoms/file-upload.js";
|
|
9
|
+
import { dataAttr as I } from "../../utils/misc.js";
|
|
10
|
+
import { composeEventHandlers as l } from "../../utils/compose-event-handlers.js";
|
|
11
11
|
import { ikp as o } from "../factory.js";
|
|
12
|
-
import { useInkeepConfig as
|
|
13
|
-
const
|
|
12
|
+
import { useInkeepConfig as y } from "../../providers/config-provider.js";
|
|
13
|
+
const j = {
|
|
14
14
|
"application/pdf": "filePdf",
|
|
15
15
|
"text/plain": "fileText",
|
|
16
16
|
"text/markdown": "fileMarkdown",
|
|
17
17
|
"text/html": "fileHtml",
|
|
18
18
|
"text/csv": "fileCsv",
|
|
19
19
|
"text/x-log": "fileLog",
|
|
20
|
-
"application/json": "fileJson"
|
|
21
|
-
"text/x-sql": "fileSql",
|
|
22
|
-
"application/x-sql": "fileSql",
|
|
23
|
-
"text/x-script.python": "filePy",
|
|
24
|
-
"text/x-python": "filePy",
|
|
25
|
-
"text/x-python-script": "filePy"
|
|
20
|
+
"application/json": "fileJson"
|
|
26
21
|
};
|
|
27
|
-
function
|
|
28
|
-
return
|
|
22
|
+
function g(e) {
|
|
23
|
+
return e.startsWith("image/");
|
|
29
24
|
}
|
|
30
|
-
const
|
|
31
|
-
// Images
|
|
25
|
+
const p = {
|
|
32
26
|
"image/png": [".png"],
|
|
33
27
|
"image/jpeg": [".jpg", ".jpeg"],
|
|
34
28
|
"image/webp": [".webp"],
|
|
35
|
-
// PDF
|
|
36
29
|
"application/pdf": [".pdf"],
|
|
37
|
-
|
|
38
|
-
"text/
|
|
39
|
-
"text/
|
|
40
|
-
// Markup & web
|
|
41
|
-
"text/markdown": [".md", ".markdown"],
|
|
42
|
-
"text/html": [".html", ".htm"],
|
|
30
|
+
"text/plain": [".txt"],
|
|
31
|
+
"text/markdown": [".md"],
|
|
32
|
+
"text/html": [".html"],
|
|
43
33
|
"text/csv": [".csv"],
|
|
44
|
-
"text/
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"text/x-yaml": [".yaml", ".yml"],
|
|
51
|
-
"application/toml": [".toml"],
|
|
52
|
-
"application/x-toml": [".toml"],
|
|
53
|
-
"application/graphql": [".graphql", ".gql"],
|
|
54
|
-
"application/x-graphql": [".graphql", ".gql"],
|
|
55
|
-
"text/x-graphql": [".graphql", ".gql"],
|
|
56
|
-
"application/x-ndjson": [".ndjson"],
|
|
57
|
-
"application/json5": [".json5"],
|
|
58
|
-
"application/x-json5": [".json5"],
|
|
59
|
-
// JavaScript & TypeScript
|
|
60
|
-
"application/javascript": [".js", ".mjs"],
|
|
61
|
-
"text/javascript": [".js", ".mjs"],
|
|
62
|
-
"application/typescript": [".ts"],
|
|
63
|
-
"text/x-typescript": [".ts"],
|
|
64
|
-
"text/jsx": [".jsx"],
|
|
65
|
-
"text/tsx": [".tsx"],
|
|
66
|
-
// Shell & scripting
|
|
67
|
-
"text/x-sh": [".sh"],
|
|
68
|
-
"text/x-bash": [".bash"],
|
|
69
|
-
"application/x-bash": [".bash"],
|
|
70
|
-
"text/x-zsh": [".zsh"],
|
|
71
|
-
"text/x-shellscript": [".sh", ".ksh"],
|
|
72
|
-
"application/x-powershell": [".ps1"],
|
|
73
|
-
"text/vbscript": [".vbs"],
|
|
74
|
-
"text/x-awk": [".awk"],
|
|
75
|
-
"application/x-awk": [".awk"],
|
|
76
|
-
// C-family
|
|
77
|
-
"text/x-c": [".c", ".h"],
|
|
78
|
-
"text/x-c++": [".cpp", ".cc", ".cxx", ".hh"],
|
|
79
|
-
"text/x-csharp": [".cs"],
|
|
80
|
-
"text/x-objectivec": [".m"],
|
|
81
|
-
"text/x-objectivec++": [".mm"],
|
|
82
|
-
// JVM
|
|
83
|
-
"text/x-java": [".java"],
|
|
84
|
-
"text/x-scala": [".scala"],
|
|
85
|
-
"application/x-scala": [".scala"],
|
|
86
|
-
"text/x-kotlin": [".kt"],
|
|
87
|
-
"text/x-groovy": [".groovy"],
|
|
88
|
-
"text/x-clojure": [".clj"],
|
|
89
|
-
// Systems & compiled
|
|
90
|
-
"text/x-go": [".go"],
|
|
91
|
-
"text/x-golang": [".go"],
|
|
92
|
-
"text/x-rust": [".rs"],
|
|
93
|
-
"application/x-rust": [".rs"],
|
|
94
|
-
"text/x-swift": [".swift"],
|
|
95
|
-
"text/x-dart": [".dart"],
|
|
96
|
-
// Scripting languages
|
|
97
|
-
"text/x-python": [".py"],
|
|
98
|
-
"text/x-script.python": [".py"],
|
|
99
|
-
"text/x-python-script": [".py"],
|
|
100
|
-
"text/x-ruby": [".rb"],
|
|
101
|
-
"text/x-perl": [".pl"],
|
|
102
|
-
"text/x-lua": [".lua"],
|
|
103
|
-
"text/x-r": [".r"],
|
|
104
|
-
"text/x-R": [".r"],
|
|
105
|
-
"text/x-julia": [".jl"],
|
|
106
|
-
"text/x-elixir": [".ex"],
|
|
107
|
-
"text/x-erlang": [".erl"],
|
|
108
|
-
"text/x-haskell": [".hs"],
|
|
109
|
-
"text/x-lisp": [".lisp"],
|
|
110
|
-
// PHP
|
|
111
|
-
"text/x-php": [".php"],
|
|
112
|
-
"application/x-php": [".php"],
|
|
113
|
-
"application/x-httpd-php": [".php"],
|
|
114
|
-
"application/x-httpd-php-source": [".php"],
|
|
115
|
-
// Markup & templating
|
|
116
|
-
"text/x-tex": [".tex"],
|
|
117
|
-
"text/x-rst": [".rst"],
|
|
118
|
-
"text/x-handlebars": [".hbs"],
|
|
119
|
-
"text/x-mustache": [".mustache"],
|
|
120
|
-
"text/x-ejs": [".ejs"],
|
|
121
|
-
"text/x-jinja2": [".jinja", ".jinja2"],
|
|
122
|
-
"text/x-liquid": [".liquid"],
|
|
123
|
-
"text/x-erb": [".erb"],
|
|
124
|
-
"text/x-twig": [".twig"],
|
|
125
|
-
"text/x-pug": [".pug"],
|
|
126
|
-
"text/x-jade": [".jade"],
|
|
127
|
-
"text/x-tmpl": [".tmpl"],
|
|
128
|
-
"text/x-astro": [".astro"],
|
|
129
|
-
// Style
|
|
130
|
-
"text/x-sass": [".sass"],
|
|
131
|
-
"text/x-scss": [".scss"],
|
|
132
|
-
"text/x-less": [".less"],
|
|
133
|
-
// SQL
|
|
134
|
-
"text/x-sql": [".sql"],
|
|
135
|
-
"application/x-sql": [".sql"],
|
|
136
|
-
// Config & build
|
|
137
|
-
"text/x-makefile": [".makefile", ".mk"],
|
|
138
|
-
"text/x-cmake": [".cmake"],
|
|
139
|
-
"text/x-dockerfile": [".dockerfile"],
|
|
140
|
-
"text/x-gradle": [".gradle"],
|
|
141
|
-
"text/x-ini": [".ini"],
|
|
142
|
-
"text/x-properties": [".properties"],
|
|
143
|
-
"text/x-protobuf": [".proto"],
|
|
144
|
-
"application/x-protobuf": [".proto"],
|
|
145
|
-
"text/x-hcl": [".hcl"],
|
|
146
|
-
"text/x-terraform": [".tf"],
|
|
147
|
-
"application/x-terraform": [".tf"],
|
|
148
|
-
// Diff & patch
|
|
149
|
-
"text/x-diff": [".diff"],
|
|
150
|
-
"text/x-patch": [".patch"],
|
|
151
|
-
"application/x-patch": [".patch"],
|
|
152
|
-
// Assembly
|
|
153
|
-
"text/x-asm": [".asm", ".s"],
|
|
154
|
-
// Email
|
|
155
|
-
"message/rfc822": [".eml", ".mht", ".mhtml", ".mime", ".nws"],
|
|
156
|
-
// Subtitles & calendar
|
|
157
|
-
"text/srt": [".srt"],
|
|
158
|
-
"application/x-subrip": [".srt"],
|
|
159
|
-
"text/x-subrip": [".srt"],
|
|
160
|
-
"text/vtt": [".vtt"],
|
|
161
|
-
"text/x-vcard": [".vcf"],
|
|
162
|
-
"text/calendar": [".ics", ".ifb"],
|
|
163
|
-
// Office documents
|
|
164
|
-
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"],
|
|
165
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
|
|
166
|
-
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [".pptx"],
|
|
167
|
-
"application/vnd.oasis.opendocument.text": [".odt"],
|
|
168
|
-
"application/vnd.oasis.opendocument.spreadsheet": [".ods"],
|
|
169
|
-
"application/vnd.oasis.opendocument.presentation": [".odp"],
|
|
170
|
-
"application/vnd.apple.pages": [".pages"],
|
|
171
|
-
"application/vnd.apple.numbers": [".numbers"],
|
|
172
|
-
"application/vnd.apple.keynote": [".key"],
|
|
173
|
-
"application/x-iwork-pages-sffpages": [".pages"],
|
|
174
|
-
"application/x-iwork-numbers-sffnumbers": [".numbers"],
|
|
175
|
-
"application/x-iwork-keynote-sffkey": [".key"]
|
|
176
|
-
}, M = new Set(Object.keys(_)), P = 10, y = 1024 * 1024 * 10, q = Object.entries(_).reduce(
|
|
177
|
-
(t, [e, i]) => {
|
|
178
|
-
for (const n of i) t[n] = e;
|
|
179
|
-
return t;
|
|
34
|
+
"text/x-log": [".log"],
|
|
35
|
+
"application/json": [".json"]
|
|
36
|
+
}, k = new Set(Object.keys(p)), U = Object.values(p).flat().join(", "), E = 10, N = 1024 * 1024 * 10, R = Object.entries(p).reduce(
|
|
37
|
+
(e, [t, i]) => {
|
|
38
|
+
for (const n of i) e[n] = t;
|
|
39
|
+
return e;
|
|
180
40
|
},
|
|
181
41
|
{}
|
|
182
42
|
);
|
|
183
|
-
function
|
|
184
|
-
if (
|
|
185
|
-
const
|
|
186
|
-
return i ? new File([
|
|
43
|
+
function A(e) {
|
|
44
|
+
if (e.type) return e;
|
|
45
|
+
const t = `.${e.name.split(".").pop()?.toLowerCase()}`, i = R[t];
|
|
46
|
+
return i ? new File([e], e.name, { type: i }) : e;
|
|
187
47
|
}
|
|
188
|
-
function
|
|
189
|
-
if (!
|
|
190
|
-
const
|
|
191
|
-
return
|
|
48
|
+
function O(e) {
|
|
49
|
+
if (!e.length) return null;
|
|
50
|
+
const t = (i) => e.some((n) => n.errors.includes(i));
|
|
51
|
+
return t("TOO_MANY_FILES") ? {
|
|
192
52
|
title: "Attachment limit reached",
|
|
193
|
-
message: `You can only attach up to ${
|
|
194
|
-
} :
|
|
53
|
+
message: `You can only attach up to ${E} files per message.`
|
|
54
|
+
} : t("FILE_INVALID_TYPE") ? {
|
|
195
55
|
title: "Unsupported file type",
|
|
196
|
-
message:
|
|
197
|
-
} :
|
|
56
|
+
message: `Only ${U} files are supported.`
|
|
57
|
+
} : t("FILE_TOO_LARGE") ? {
|
|
198
58
|
title: "File too large",
|
|
199
|
-
message: `Files must be smaller than ${
|
|
200
|
-
} :
|
|
59
|
+
message: `Files must be smaller than ${N / 1024 / 1024}MB.`
|
|
60
|
+
} : t("FILE_EXISTS") ? {
|
|
201
61
|
title: "File already exists",
|
|
202
|
-
message: `The file "${
|
|
62
|
+
message: `The file "${e.find((n) => n.errors.includes("FILE_EXISTS"))?.file.name ?? "file"}" is already attached to this message.`
|
|
203
63
|
} : {
|
|
204
64
|
title: "File rejected",
|
|
205
65
|
message: "This file could not be added."
|
|
@@ -207,264 +67,265 @@ function U(t) {
|
|
|
207
67
|
}
|
|
208
68
|
const S = o("div", {
|
|
209
69
|
_id: "aiChatMessage__Files"
|
|
210
|
-
}),
|
|
211
|
-
const { message: i } =
|
|
70
|
+
}), ue = ({ children: e, ...t }) => {
|
|
71
|
+
const { message: i } = L();
|
|
212
72
|
if (i.role !== "user") return null;
|
|
213
|
-
const n = (i.parts ?? []).filter((
|
|
214
|
-
if (
|
|
215
|
-
const
|
|
216
|
-
return
|
|
73
|
+
const n = (i.parts ?? []).filter((r) => {
|
|
74
|
+
if (r.type !== "file") return !1;
|
|
75
|
+
const s = r.mediaType;
|
|
76
|
+
return k.has(s ?? "");
|
|
217
77
|
});
|
|
218
|
-
return n.length ? /* @__PURE__ */ a(S, { ...
|
|
219
|
-
},
|
|
78
|
+
return n.length ? /* @__PURE__ */ a(S, { ...t, children: e(n) }) : null;
|
|
79
|
+
}, D = o("button", {
|
|
220
80
|
_id: "aiChatMessage__File"
|
|
221
|
-
}),
|
|
222
|
-
url:
|
|
223
|
-
name:
|
|
81
|
+
}), pe = ({
|
|
82
|
+
url: e,
|
|
83
|
+
name: t,
|
|
224
84
|
mediaType: i,
|
|
225
85
|
onClick: n,
|
|
226
|
-
...
|
|
86
|
+
...r
|
|
227
87
|
}) => {
|
|
228
|
-
const { openImagePreview:
|
|
229
|
-
() => new File([],
|
|
230
|
-
[
|
|
88
|
+
const { openImagePreview: s } = b(), [c, f] = C(!0), _ = w(
|
|
89
|
+
() => new File([], t ?? "file", { type: i }),
|
|
90
|
+
[t, i]
|
|
231
91
|
);
|
|
232
92
|
return /* @__PURE__ */ a(
|
|
233
|
-
|
|
93
|
+
v.Provider,
|
|
234
94
|
{
|
|
235
|
-
value: { file:
|
|
95
|
+
value: { file: _, objectUrl: e, isLoading: c, setIsLoading: f, onRemove: () => {
|
|
236
96
|
} },
|
|
237
97
|
children: /* @__PURE__ */ a(
|
|
238
|
-
|
|
98
|
+
D,
|
|
239
99
|
{
|
|
240
100
|
type: "button",
|
|
241
|
-
"aria-label":
|
|
242
|
-
"data-loading":
|
|
243
|
-
onClick:
|
|
244
|
-
if (
|
|
245
|
-
|
|
246
|
-
else if (
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
|
|
101
|
+
"aria-label": g(i ?? "") ? `Preview ${t ?? "file"}` : `Open ${t ?? "file"} in new tab`,
|
|
102
|
+
"data-loading": I(c),
|
|
103
|
+
onClick: l(n, () => {
|
|
104
|
+
if (g(i ?? ""))
|
|
105
|
+
s({ url: e, name: t ?? "file" });
|
|
106
|
+
else if (e)
|
|
107
|
+
if (e.startsWith("data:")) {
|
|
108
|
+
const h = document.createElement("a");
|
|
109
|
+
h.href = e, h.download = t ?? "file", h.click();
|
|
250
110
|
} else
|
|
251
|
-
window.open(
|
|
111
|
+
window.open(e, "_blank", "noopener,noreferrer");
|
|
252
112
|
}),
|
|
253
|
-
...
|
|
113
|
+
...r
|
|
254
114
|
}
|
|
255
115
|
)
|
|
256
116
|
}
|
|
257
117
|
);
|
|
258
|
-
},
|
|
118
|
+
}, $ = o("div", {
|
|
259
119
|
_id: "aiChatInput__Fieldset"
|
|
260
|
-
}),
|
|
261
|
-
const
|
|
120
|
+
}), B = (e) => {
|
|
121
|
+
const t = m();
|
|
262
122
|
return /* @__PURE__ */ a(
|
|
263
|
-
|
|
123
|
+
$,
|
|
264
124
|
{
|
|
265
|
-
...
|
|
266
|
-
"data-drag-over":
|
|
267
|
-
...
|
|
125
|
+
...t.getDropzoneProps({ disableClick: !0 }),
|
|
126
|
+
"data-drag-over": I(t.dragging),
|
|
127
|
+
...e
|
|
268
128
|
}
|
|
269
129
|
);
|
|
270
|
-
},
|
|
271
|
-
...
|
|
130
|
+
}, fe = ({
|
|
131
|
+
...e
|
|
272
132
|
}) => {
|
|
273
|
-
const { files:
|
|
133
|
+
const { files: t, setFiles: i, showInputNotification: n } = d();
|
|
274
134
|
return /* @__PURE__ */ a(
|
|
275
|
-
|
|
135
|
+
M,
|
|
276
136
|
{
|
|
277
|
-
accept:
|
|
278
|
-
maxFiles:
|
|
279
|
-
maxFileSize:
|
|
137
|
+
accept: p,
|
|
138
|
+
maxFiles: E,
|
|
139
|
+
maxFileSize: N,
|
|
280
140
|
preventDocumentDrop: !0,
|
|
281
|
-
acceptedFiles:
|
|
282
|
-
onFileAccept: (
|
|
283
|
-
onFileReject: (
|
|
284
|
-
const
|
|
285
|
-
|
|
141
|
+
acceptedFiles: t,
|
|
142
|
+
onFileAccept: (r) => i(r.files),
|
|
143
|
+
onFileReject: (r) => {
|
|
144
|
+
const s = O(r.files);
|
|
145
|
+
s && n(s);
|
|
286
146
|
},
|
|
287
|
-
children: /* @__PURE__ */ a(
|
|
147
|
+
children: /* @__PURE__ */ a(B, { ...e })
|
|
288
148
|
}
|
|
289
149
|
);
|
|
290
|
-
},
|
|
150
|
+
}, _e = o("div", {
|
|
291
151
|
_id: "aiChatInput__DropZone"
|
|
292
|
-
}),
|
|
152
|
+
}), X = o("div", {
|
|
293
153
|
_id: "aiChatInput__Notification"
|
|
294
|
-
}),
|
|
295
|
-
const { inputNotification:
|
|
296
|
-
return
|
|
297
|
-
},
|
|
154
|
+
}), he = (e) => {
|
|
155
|
+
const { inputNotification: t } = d();
|
|
156
|
+
return t ? /* @__PURE__ */ a(X, { role: "alert", ...e }) : null;
|
|
157
|
+
}, H = o("p", {
|
|
298
158
|
_id: "aiChatInput__NotificationTitle"
|
|
299
|
-
}),
|
|
300
|
-
children:
|
|
301
|
-
...
|
|
159
|
+
}), Ce = ({
|
|
160
|
+
children: e,
|
|
161
|
+
...t
|
|
302
162
|
}) => {
|
|
303
|
-
const { inputNotification: i } =
|
|
304
|
-
return i?.title ? /* @__PURE__ */
|
|
305
|
-
|
|
163
|
+
const { inputNotification: i } = d();
|
|
164
|
+
return i?.title ? /* @__PURE__ */ x(H, { ...t, children: [
|
|
165
|
+
e,
|
|
306
166
|
i.title
|
|
307
167
|
] }) : null;
|
|
308
|
-
},
|
|
168
|
+
}, Y = o("p", {
|
|
309
169
|
_id: "aiChatInput__NotificationMessage"
|
|
310
|
-
}),
|
|
311
|
-
const { inputNotification:
|
|
312
|
-
return /* @__PURE__ */ a(
|
|
313
|
-
},
|
|
170
|
+
}), Fe = (e) => {
|
|
171
|
+
const { inputNotification: t } = d();
|
|
172
|
+
return /* @__PURE__ */ a(Y, { ...e, children: t?.message });
|
|
173
|
+
}, z = o("button", {
|
|
314
174
|
_id: "aiChatInput__NotificationClose"
|
|
315
|
-
}),
|
|
316
|
-
onClick:
|
|
317
|
-
...
|
|
175
|
+
}), Ie = ({
|
|
176
|
+
onClick: e,
|
|
177
|
+
...t
|
|
318
178
|
}) => {
|
|
319
|
-
const { clearInputNotification: i } =
|
|
179
|
+
const { clearInputNotification: i } = d();
|
|
320
180
|
return /* @__PURE__ */ a(
|
|
321
|
-
|
|
181
|
+
z,
|
|
322
182
|
{
|
|
323
183
|
type: "button",
|
|
324
184
|
"aria-label": "Dismiss",
|
|
325
|
-
onClick:
|
|
326
|
-
...
|
|
185
|
+
onClick: l(e, i),
|
|
186
|
+
...t
|
|
327
187
|
}
|
|
328
188
|
);
|
|
329
|
-
},
|
|
189
|
+
}, ve = o("div", {
|
|
330
190
|
_id: "aiChatInput__NotificationContent"
|
|
331
|
-
}),
|
|
191
|
+
}), ge = o("div", {
|
|
332
192
|
_id: "aiChatInput__NotificationHeader"
|
|
333
|
-
}),
|
|
193
|
+
}), Pe = o(F, {
|
|
334
194
|
_id: "aiChatInput__FileUploadButtonIcon",
|
|
335
195
|
iconKey: "fileUpload"
|
|
336
|
-
}),
|
|
196
|
+
}), K = o("button", {
|
|
337
197
|
_id: "aiChatInput__FileUploadButton"
|
|
338
|
-
}),
|
|
339
|
-
const { aiChatSettings:
|
|
198
|
+
}), be = (e) => {
|
|
199
|
+
const { aiChatSettings: t } = y(), i = m(), { onClick: n, ...r } = e;
|
|
340
200
|
return /* @__PURE__ */ a(
|
|
341
|
-
|
|
201
|
+
K,
|
|
342
202
|
{
|
|
343
203
|
type: "button",
|
|
344
204
|
"aria-label": "Upload file",
|
|
345
|
-
disabled:
|
|
346
|
-
onClick:
|
|
347
|
-
...
|
|
205
|
+
disabled: t.isViewOnly,
|
|
206
|
+
onClick: l(n, () => i.openFilePicker()),
|
|
207
|
+
...r
|
|
348
208
|
}
|
|
349
209
|
);
|
|
350
|
-
},
|
|
210
|
+
}, Z = o("input", {
|
|
351
211
|
_id: "aiChatInput__FileInput"
|
|
352
|
-
}),
|
|
353
|
-
const
|
|
354
|
-
return /* @__PURE__ */ a(
|
|
355
|
-
},
|
|
212
|
+
}), Ee = (e) => {
|
|
213
|
+
const t = m();
|
|
214
|
+
return /* @__PURE__ */ a(Z, { ...e, ...t.getHiddenInputProps() });
|
|
215
|
+
}, V = o("div", {
|
|
356
216
|
_id: "aiChatInput__FileList"
|
|
357
|
-
}),
|
|
358
|
-
const n =
|
|
359
|
-
return n.length ? /* @__PURE__ */ a(
|
|
360
|
-
},
|
|
361
|
-
function
|
|
362
|
-
const
|
|
363
|
-
if (!
|
|
364
|
-
return
|
|
217
|
+
}), Ne = ({ children: e, ...t }) => {
|
|
218
|
+
const n = m().acceptedFiles;
|
|
219
|
+
return n.length ? /* @__PURE__ */ a(V, { ...t, children: e(n) }) : null;
|
|
220
|
+
}, v = P.createContext(null);
|
|
221
|
+
function u() {
|
|
222
|
+
const e = P.useContext(v);
|
|
223
|
+
if (!e) throw new Error("useFileContext must be used within EmbeddedChatPrimitiveFileItem");
|
|
224
|
+
return e;
|
|
365
225
|
}
|
|
366
|
-
const
|
|
226
|
+
const W = o("div", {
|
|
367
227
|
_id: "aiChatInput__FileItem"
|
|
368
|
-
}),
|
|
369
|
-
const i =
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
}), [
|
|
373
|
-
const
|
|
374
|
-
return /* @__PURE__ */ a(
|
|
375
|
-
},
|
|
228
|
+
}), xe = ({ file: e, ...t }) => {
|
|
229
|
+
const i = m(), [n, r] = C(void 0), [s, c] = C(!0);
|
|
230
|
+
T(() => i.createFileUrl(e, (_) => {
|
|
231
|
+
r(_), c(!0);
|
|
232
|
+
}), [e]);
|
|
233
|
+
const f = () => i.deleteFile(e);
|
|
234
|
+
return /* @__PURE__ */ a(v.Provider, { value: { file: e, objectUrl: n, isLoading: s, setIsLoading: c, onRemove: f }, children: /* @__PURE__ */ a(W, { "data-loading": I(s), ...t }) });
|
|
235
|
+
}, G = o("button", {
|
|
376
236
|
_id: "aiChatInput__FilePreviewTrigger"
|
|
377
|
-
}),
|
|
378
|
-
onClick:
|
|
379
|
-
...
|
|
237
|
+
}), Te = ({
|
|
238
|
+
onClick: e,
|
|
239
|
+
...t
|
|
380
240
|
}) => {
|
|
381
|
-
const { objectUrl: i, file: n } =
|
|
241
|
+
const { objectUrl: i, file: n } = u(), { openImagePreview: r } = b();
|
|
382
242
|
return /* @__PURE__ */ a(
|
|
383
|
-
|
|
243
|
+
G,
|
|
384
244
|
{
|
|
385
245
|
type: "button",
|
|
386
246
|
"aria-label": `Preview ${n.name}`,
|
|
387
247
|
disabled: !i,
|
|
388
|
-
onClick:
|
|
389
|
-
i &&
|
|
248
|
+
onClick: l(e, () => {
|
|
249
|
+
i && r({ url: i, name: n.name });
|
|
390
250
|
}),
|
|
391
|
-
...
|
|
251
|
+
...t
|
|
392
252
|
}
|
|
393
253
|
);
|
|
394
|
-
},
|
|
254
|
+
}, J = o("span", {
|
|
395
255
|
_id: "aiChatInput__FileContent"
|
|
396
|
-
}),
|
|
256
|
+
}), we = (e) => /* @__PURE__ */ a(J, { ...e }), q = o("img", {
|
|
397
257
|
_id: "aiChatInput__FileThumbnail"
|
|
398
|
-
}),
|
|
399
|
-
onLoad:
|
|
400
|
-
...
|
|
258
|
+
}), Le = ({
|
|
259
|
+
onLoad: e,
|
|
260
|
+
...t
|
|
401
261
|
}) => {
|
|
402
|
-
const { objectUrl: i, file: n, setIsLoading:
|
|
262
|
+
const { objectUrl: i, file: n, setIsLoading: r } = u();
|
|
403
263
|
return /* @__PURE__ */ a(
|
|
404
|
-
|
|
264
|
+
q,
|
|
405
265
|
{
|
|
406
266
|
src: i,
|
|
407
267
|
alt: n.name,
|
|
408
|
-
onLoad:
|
|
409
|
-
...
|
|
268
|
+
onLoad: l(e, () => r(!1)),
|
|
269
|
+
...t
|
|
410
270
|
}
|
|
411
271
|
);
|
|
412
|
-
},
|
|
413
|
-
const { file:
|
|
414
|
-
return /* @__PURE__ */ a(
|
|
415
|
-
},
|
|
272
|
+
}, Me = ({ className: e }) => {
|
|
273
|
+
const { file: t } = u(), i = j[A(t).type] ?? "fileText";
|
|
274
|
+
return /* @__PURE__ */ a(F, { iconKey: i, className: e });
|
|
275
|
+
}, Q = o("span", {
|
|
416
276
|
_id: "aiChatInput__FileName"
|
|
417
|
-
}),
|
|
418
|
-
const { file:
|
|
419
|
-
return /* @__PURE__ */ a(
|
|
420
|
-
},
|
|
277
|
+
}), ye = (e) => {
|
|
278
|
+
const { file: t } = u();
|
|
279
|
+
return /* @__PURE__ */ a(Q, { ...e, children: t.name });
|
|
280
|
+
}, ee = o("button", {
|
|
421
281
|
_id: "aiChatInput__FileRemove"
|
|
422
|
-
}),
|
|
282
|
+
}), je = o(F, {
|
|
423
283
|
_id: "aiChatInput__FileRemoveIcon",
|
|
424
284
|
iconKey: "close"
|
|
425
|
-
}),
|
|
426
|
-
onClick:
|
|
427
|
-
...
|
|
285
|
+
}), ke = ({
|
|
286
|
+
onClick: e,
|
|
287
|
+
...t
|
|
428
288
|
}) => {
|
|
429
|
-
const { onRemove: i } =
|
|
289
|
+
const { onRemove: i } = u();
|
|
430
290
|
return /* @__PURE__ */ a(
|
|
431
|
-
|
|
291
|
+
ee,
|
|
432
292
|
{
|
|
433
293
|
type: "button",
|
|
434
294
|
"aria-label": "Remove file",
|
|
435
|
-
onClick:
|
|
436
|
-
...
|
|
295
|
+
onClick: l(e, i),
|
|
296
|
+
...t
|
|
437
297
|
}
|
|
438
298
|
);
|
|
439
299
|
};
|
|
440
300
|
export {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
301
|
+
U as ACCEPTED_FILE_EXTENSIONS,
|
|
302
|
+
k as ACCEPTED_FILE_MIME_TYPES,
|
|
303
|
+
_e as EmbeddedChatPrimitiveDropZone,
|
|
304
|
+
we as EmbeddedChatPrimitiveFileContent,
|
|
305
|
+
Ee as EmbeddedChatPrimitiveFileInput,
|
|
306
|
+
xe as EmbeddedChatPrimitiveFileItem,
|
|
307
|
+
Ne as EmbeddedChatPrimitiveFileList,
|
|
308
|
+
ye as EmbeddedChatPrimitiveFileName,
|
|
309
|
+
Te as EmbeddedChatPrimitiveFilePreviewTrigger,
|
|
310
|
+
ke as EmbeddedChatPrimitiveFileRemove,
|
|
311
|
+
je as EmbeddedChatPrimitiveFileRemoveIcon,
|
|
312
|
+
Le as EmbeddedChatPrimitiveFileThumbnail,
|
|
313
|
+
Me as EmbeddedChatPrimitiveFileTypeIcon,
|
|
314
|
+
be as EmbeddedChatPrimitiveFileUploadButton,
|
|
315
|
+
Pe as EmbeddedChatPrimitiveFileUploadButtonIcon,
|
|
316
|
+
fe as EmbeddedChatPrimitiveInputFieldset,
|
|
317
|
+
he as EmbeddedChatPrimitiveInputNotification,
|
|
318
|
+
Ie as EmbeddedChatPrimitiveInputNotificationClose,
|
|
319
|
+
ve as EmbeddedChatPrimitiveInputNotificationContent,
|
|
320
|
+
ge as EmbeddedChatPrimitiveInputNotificationHeader,
|
|
321
|
+
Fe as EmbeddedChatPrimitiveInputNotificationMessage,
|
|
322
|
+
Ce as EmbeddedChatPrimitiveInputNotificationTitle,
|
|
323
|
+
pe as EmbeddedChatPrimitiveMessageFile,
|
|
324
|
+
ue as EmbeddedChatPrimitiveMessageFiles,
|
|
325
|
+
p as FILE_ACCEPT_MAP,
|
|
326
|
+
j as FILE_TYPE_ICON_MAP,
|
|
327
|
+
E as MAX_FILES,
|
|
328
|
+
N as MAX_FILE_SIZE,
|
|
329
|
+
g as isImageMimeType,
|
|
330
|
+
A as normalizeFileType
|
|
470
331
|
};
|