@tetrascience-npm/tetrascience-react-ui 0.5.0-beta.39.1 → 0.5.0-beta.41.1

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 (91) hide show
  1. package/dist/components/ai/attachments.cjs +2 -0
  2. package/dist/components/ai/attachments.cjs.map +1 -0
  3. package/dist/components/ai/attachments.js +224 -0
  4. package/dist/components/ai/attachments.js.map +1 -0
  5. package/dist/components/ai/chain-of-thought.cjs +2 -0
  6. package/dist/components/ai/chain-of-thought.cjs.map +1 -0
  7. package/dist/components/ai/chain-of-thought.js +145 -0
  8. package/dist/components/ai/chain-of-thought.js.map +1 -0
  9. package/dist/components/ai/confirmation.cjs +2 -0
  10. package/dist/components/ai/confirmation.cjs.map +1 -0
  11. package/dist/components/ai/confirmation.js +109 -0
  12. package/dist/components/ai/confirmation.js.map +1 -0
  13. package/dist/components/ai/context.cjs +2 -0
  14. package/dist/components/ai/context.cjs.map +1 -0
  15. package/dist/components/ai/context.js +266 -0
  16. package/dist/components/ai/context.js.map +1 -0
  17. package/dist/components/ai/conversation.cjs +4 -0
  18. package/dist/components/ai/conversation.cjs.map +1 -0
  19. package/dist/components/ai/conversation.js +108 -0
  20. package/dist/components/ai/conversation.js.map +1 -0
  21. package/dist/components/ai/inline-citation.cjs +2 -0
  22. package/dist/components/ai/inline-citation.cjs.map +1 -0
  23. package/dist/components/ai/inline-citation.js +182 -0
  24. package/dist/components/ai/inline-citation.js.map +1 -0
  25. package/dist/components/ai/message.cjs +2 -0
  26. package/dist/components/ai/message.cjs.map +1 -0
  27. package/dist/components/ai/message.js +237 -0
  28. package/dist/components/ai/message.js.map +1 -0
  29. package/dist/components/ai/model-selector.cjs +2 -0
  30. package/dist/components/ai/model-selector.cjs.map +1 -0
  31. package/dist/components/ai/model-selector.js +77 -0
  32. package/dist/components/ai/model-selector.js.map +1 -0
  33. package/dist/components/ai/prompt-input.cjs +2 -0
  34. package/dist/components/ai/prompt-input.cjs.map +1 -0
  35. package/dist/components/ai/prompt-input.js +774 -0
  36. package/dist/components/ai/prompt-input.js.map +1 -0
  37. package/dist/components/ai/queue.cjs +2 -0
  38. package/dist/components/ai/queue.cjs.map +1 -0
  39. package/dist/components/ai/queue.js +209 -0
  40. package/dist/components/ai/queue.js.map +1 -0
  41. package/dist/components/ai/reasoning.cjs +2 -0
  42. package/dist/components/ai/reasoning.cjs.map +1 -0
  43. package/dist/components/ai/reasoning.js +129 -0
  44. package/dist/components/ai/reasoning.js.map +1 -0
  45. package/dist/components/ai/shimmer.cjs +2 -0
  46. package/dist/components/ai/shimmer.cjs.map +1 -0
  47. package/dist/components/ai/shimmer.js +49 -0
  48. package/dist/components/ai/shimmer.js.map +1 -0
  49. package/dist/components/ai/sources.cjs +2 -0
  50. package/dist/components/ai/sources.cjs.map +1 -0
  51. package/dist/components/ai/sources.js +54 -0
  52. package/dist/components/ai/sources.js.map +1 -0
  53. package/dist/components/ai/speech-input.cjs +2 -0
  54. package/dist/components/ai/speech-input.cjs.map +1 -0
  55. package/dist/components/ai/speech-input.js +123 -0
  56. package/dist/components/ai/speech-input.js.map +1 -0
  57. package/dist/components/ai/stream-status.cjs +2 -0
  58. package/dist/components/ai/stream-status.cjs.map +1 -0
  59. package/dist/components/ai/stream-status.js +106 -0
  60. package/dist/components/ai/stream-status.js.map +1 -0
  61. package/dist/components/ai/suggestion.cjs +2 -0
  62. package/dist/components/ai/suggestion.cjs.map +1 -0
  63. package/dist/components/ai/suggestion.js +38 -0
  64. package/dist/components/ai/suggestion.js.map +1 -0
  65. package/dist/components/ai/task.cjs +2 -0
  66. package/dist/components/ai/task.cjs.map +1 -0
  67. package/dist/components/ai/task.js +94 -0
  68. package/dist/components/ai/task.js.map +1 -0
  69. package/dist/components/ai/tool.cjs +2 -0
  70. package/dist/components/ai/tool.cjs.map +1 -0
  71. package/dist/components/ai/tool.js +143 -0
  72. package/dist/components/ai/tool.js.map +1 -0
  73. package/dist/components/composed/Chat/Chat.cjs +2 -0
  74. package/dist/components/composed/Chat/Chat.cjs.map +1 -0
  75. package/dist/components/composed/Chat/Chat.js +167 -0
  76. package/dist/components/composed/Chat/Chat.js.map +1 -0
  77. package/dist/components/ui/code-block.cjs +4 -0
  78. package/dist/components/ui/code-block.cjs.map +1 -0
  79. package/dist/components/ui/code-block.js +306 -0
  80. package/dist/components/ui/code-block.js.map +1 -0
  81. package/dist/components/ui/progress.cjs +2 -0
  82. package/dist/components/ui/progress.cjs.map +1 -0
  83. package/dist/components/ui/progress.js +32 -0
  84. package/dist/components/ui/progress.js.map +1 -0
  85. package/dist/index.cjs +1 -1
  86. package/dist/index.css +1 -1
  87. package/dist/index.d.ts +1145 -0
  88. package/dist/index.js +574 -372
  89. package/dist/index.js.map +1 -1
  90. package/dist/index.tailwind.css +1 -1
  91. package/package.json +12 -1
@@ -0,0 +1,774 @@
1
+ import { jsxs as j, Fragment as fe, jsx as n } from "react/jsx-runtime";
2
+ import { ImageIcon as he, Monitor as ge, PlusIcon as ve, CornerDownLeftIcon as Ie, SquareIcon as Pe, XIcon as ye } from "lucide-react";
3
+ import { createContext as G, useRef as O, useState as E, useEffect as U, useCallback as d, useMemo as W, Children as be, useContext as z } from "react";
4
+ import { Command as Ce, CommandEmpty as we, CommandGroup as xe, CommandInput as Ne, CommandItem as Te, CommandList as Se, CommandSeparator as De } from "../ui/command.js";
5
+ import { DropdownMenuItem as K, DropdownMenu as Le, DropdownMenuContent as Re, DropdownMenuTrigger as Ae } from "../ui/dropdown-menu.js";
6
+ import { HoverCard as Ue, HoverCardContent as ke, HoverCardTrigger as Me } from "../ui/hover-card.js";
7
+ import { InputGroup as Oe, InputGroupButton as Y, InputGroupAddon as ee, InputGroupTextarea as je } from "../ui/input-group.js";
8
+ import { Select as ze, SelectContent as Ee, SelectItem as _e, SelectTrigger as Be, SelectValue as Fe } from "../ui/select.js";
9
+ import { Spinner as He } from "../ui/spinner.js";
10
+ import { Tooltip as We, TooltipTrigger as Ge, TooltipContent as qe } from "../ui/tooltip.js";
11
+ import { cn as l } from "../../lib/utils.js";
12
+ const Ve = async (e) => {
13
+ try {
14
+ const r = await (await fetch(e)).blob();
15
+ return new Promise((o) => {
16
+ const c = new FileReader();
17
+ c.onloadend = () => o(c.result), c.onerror = () => o(null), c.readAsDataURL(r);
18
+ });
19
+ } catch {
20
+ return null;
21
+ }
22
+ }, Ke = async () => {
23
+ if (typeof navigator > "u" || !navigator.mediaDevices?.getDisplayMedia)
24
+ return null;
25
+ let e = null;
26
+ const t = document.createElement("video");
27
+ t.muted = !0, t.playsInline = !0;
28
+ try {
29
+ e = await navigator.mediaDevices.getDisplayMedia({
30
+ audio: !1,
31
+ video: !0
32
+ }), t.srcObject = e, await new Promise((v, C) => {
33
+ t.onloadedmetadata = () => v(), t.onerror = () => C(new Error("Failed to load screen stream"));
34
+ }), await t.play();
35
+ const r = t.videoWidth, o = t.videoHeight;
36
+ if (!r || !o)
37
+ return null;
38
+ const c = document.createElement("canvas");
39
+ c.width = r, c.height = o;
40
+ const i = c.getContext("2d");
41
+ if (!i)
42
+ return null;
43
+ i.drawImage(t, 0, 0, r, o);
44
+ const a = await new Promise((v) => {
45
+ c.toBlob(v, "image/png");
46
+ });
47
+ if (!a)
48
+ return null;
49
+ const g = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").replace("T", "_").replace("Z", "");
50
+ return new File([a], `screenshot-${g}.png`, {
51
+ lastModified: Date.now(),
52
+ type: "image/png"
53
+ });
54
+ } finally {
55
+ if (e)
56
+ for (const r of e.getTracks())
57
+ r.stop();
58
+ t.pause(), t.srcObject = null;
59
+ }
60
+ }, X = G(
61
+ null
62
+ ), Z = G(
63
+ null
64
+ ), ct = () => {
65
+ const e = z(X);
66
+ if (!e)
67
+ throw new Error(
68
+ "Wrap your component inside <PromptInputProvider> to use usePromptInputController()."
69
+ );
70
+ return e;
71
+ }, te = () => z(X), it = () => {
72
+ const e = z(Z);
73
+ if (!e)
74
+ throw new Error(
75
+ "Wrap your component inside <PromptInputProvider> to use useProviderAttachments()."
76
+ );
77
+ return e;
78
+ }, Xe = () => z(Z), lt = ({
79
+ initialInput: e = "",
80
+ children: t
81
+ }) => {
82
+ const [r, o] = E(e), c = d(() => o(""), []), [i, a] = E([]), g = O(null), v = O(() => {
83
+ }), C = d((u) => {
84
+ const b = [...u];
85
+ b.length !== 0 && a((R) => [
86
+ ...R,
87
+ ...b.map((D) => ({
88
+ filename: D.name,
89
+ id: crypto.randomUUID(),
90
+ mediaType: D.type,
91
+ type: "file",
92
+ url: URL.createObjectURL(D)
93
+ }))
94
+ ]);
95
+ }, []), L = d((u) => {
96
+ a((b) => {
97
+ const R = b.find((D) => D.id === u);
98
+ return R?.url && URL.revokeObjectURL(R.url), b.filter((D) => D.id !== u);
99
+ });
100
+ }, []), f = d(() => {
101
+ a((u) => {
102
+ for (const b of u)
103
+ b.url && URL.revokeObjectURL(b.url);
104
+ return [];
105
+ });
106
+ }, []), I = O(i);
107
+ U(() => {
108
+ I.current = i;
109
+ }, [i]), U(
110
+ () => () => {
111
+ for (const u of I.current)
112
+ u.url && URL.revokeObjectURL(u.url);
113
+ },
114
+ []
115
+ );
116
+ const T = d(() => {
117
+ v.current?.();
118
+ }, []), p = W(
119
+ () => ({
120
+ add: C,
121
+ clear: f,
122
+ fileInputRef: g,
123
+ files: i,
124
+ openFileDialog: T,
125
+ remove: L
126
+ }),
127
+ [i, C, L, f, T]
128
+ ), N = d(
129
+ (u, b) => {
130
+ g.current = u.current, v.current = b;
131
+ },
132
+ []
133
+ ), S = W(
134
+ () => ({
135
+ __registerFileInput: N,
136
+ attachments: p,
137
+ textInput: {
138
+ clear: c,
139
+ setInput: o,
140
+ value: r
141
+ }
142
+ }),
143
+ [r, c, p, N]
144
+ );
145
+ return /* @__PURE__ */ n(X.Provider, { value: S, children: /* @__PURE__ */ n(Z.Provider, { value: p, children: t }) });
146
+ }, ne = G(null), $ = () => {
147
+ const e = Xe(), r = z(ne) ?? e;
148
+ if (!r)
149
+ throw new Error(
150
+ "usePromptInputAttachments must be used within a PromptInput or PromptInputProvider"
151
+ );
152
+ return r;
153
+ }, re = G(null), ut = () => {
154
+ const e = z(re);
155
+ if (!e)
156
+ throw new Error(
157
+ "usePromptInputReferencedSources must be used within a LocalReferencedSourcesContext.Provider"
158
+ );
159
+ return e;
160
+ }, mt = ({
161
+ label: e = "Add photos or files",
162
+ ...t
163
+ }) => {
164
+ const r = $(), o = d(
165
+ (c) => {
166
+ c.preventDefault(), r.openFileDialog();
167
+ },
168
+ [r]
169
+ );
170
+ return /* @__PURE__ */ j(K, { ...t, onSelect: o, children: [
171
+ /* @__PURE__ */ n(he, { className: "mr-2 size-4" }),
172
+ " ",
173
+ e
174
+ ] });
175
+ }, dt = ({
176
+ label: e = "Take screenshot",
177
+ onSelect: t,
178
+ ...r
179
+ }) => {
180
+ const o = $(), c = d(
181
+ async (i) => {
182
+ if (t?.(i), !i.defaultPrevented)
183
+ try {
184
+ const a = await Ke();
185
+ a && o.add([a]);
186
+ } catch (a) {
187
+ if (a instanceof DOMException && (a.name === "NotAllowedError" || a.name === "AbortError"))
188
+ return;
189
+ throw a;
190
+ }
191
+ },
192
+ [t, o]
193
+ );
194
+ return /* @__PURE__ */ j(K, { ...r, onSelect: c, children: [
195
+ /* @__PURE__ */ n(ge, { className: "mr-2 size-4" }),
196
+ e
197
+ ] });
198
+ }, pt = ({
199
+ className: e,
200
+ accept: t,
201
+ multiple: r,
202
+ globalDrop: o,
203
+ syncHiddenInput: c,
204
+ maxFiles: i,
205
+ maxFileSize: a,
206
+ onError: g,
207
+ onSubmit: v,
208
+ children: C,
209
+ ...L
210
+ }) => {
211
+ const f = te(), I = !!f, T = O(null), p = O(null), [N, S] = E([]), u = I ? f.attachments.files : N, [b, R] = E([]), D = O(u);
212
+ U(() => {
213
+ D.current = u;
214
+ }, [u]);
215
+ const oe = d(() => {
216
+ T.current?.click();
217
+ }, []), _ = d(
218
+ (s) => !t || t.trim() === "" ? !0 : t.split(",").map((m) => m.trim()).filter(Boolean).some((m) => {
219
+ if (m.endsWith("/*")) {
220
+ const y = m.slice(0, -1);
221
+ return s.type.startsWith(y);
222
+ }
223
+ return s.type === m;
224
+ }),
225
+ [t]
226
+ ), se = d(
227
+ (s) => {
228
+ const h = [...s], m = h.filter((w) => _(w));
229
+ if (h.length && m.length === 0) {
230
+ g?.({
231
+ code: "accept",
232
+ message: "No files match the accepted types."
233
+ });
234
+ return;
235
+ }
236
+ const y = (w) => a ? w.size <= a : !0, P = m.filter(y);
237
+ if (m.length > 0 && P.length === 0) {
238
+ g?.({
239
+ code: "max_file_size",
240
+ message: "All files exceed the maximum size."
241
+ });
242
+ return;
243
+ }
244
+ S((w) => {
245
+ const x = typeof i == "number" ? Math.max(0, i - w.length) : void 0, k = typeof x == "number" ? P.slice(0, x) : P;
246
+ typeof x == "number" && P.length > x && g?.({
247
+ code: "max_files",
248
+ message: "Too many files. Some were not added."
249
+ });
250
+ const M = [];
251
+ for (const V of k)
252
+ M.push({
253
+ filename: V.name,
254
+ id: crypto.randomUUID(),
255
+ mediaType: V.type,
256
+ type: "file",
257
+ url: URL.createObjectURL(V)
258
+ });
259
+ return [...w, ...M];
260
+ });
261
+ },
262
+ [_, i, a, g]
263
+ ), ae = d(
264
+ (s) => S((h) => {
265
+ const m = h.find((y) => y.id === s);
266
+ return m?.url && URL.revokeObjectURL(m.url), h.filter((y) => y.id !== s);
267
+ }),
268
+ []
269
+ ), ce = d(
270
+ (s) => {
271
+ const h = [...s], m = h.filter((M) => _(M));
272
+ if (h.length && m.length === 0) {
273
+ g?.({
274
+ code: "accept",
275
+ message: "No files match the accepted types."
276
+ });
277
+ return;
278
+ }
279
+ const y = (M) => a ? M.size <= a : !0, P = m.filter(y);
280
+ if (m.length > 0 && P.length === 0) {
281
+ g?.({
282
+ code: "max_file_size",
283
+ message: "All files exceed the maximum size."
284
+ });
285
+ return;
286
+ }
287
+ const w = u.length, x = typeof i == "number" ? Math.max(0, i - w) : void 0, k = typeof x == "number" ? P.slice(0, x) : P;
288
+ typeof x == "number" && P.length > x && g?.({
289
+ code: "max_files",
290
+ message: "Too many files. Some were not added."
291
+ }), k.length > 0 && f?.attachments.add(k);
292
+ },
293
+ [_, a, i, g, u.length, f]
294
+ ), B = d(
295
+ () => I ? f?.attachments.clear() : S((s) => {
296
+ for (const h of s)
297
+ h.url && URL.revokeObjectURL(h.url);
298
+ return [];
299
+ }),
300
+ [I, f]
301
+ ), F = d(
302
+ () => R([]),
303
+ []
304
+ ), A = I ? ce : se, J = I ? f.attachments.remove : ae, Q = I ? f.attachments.openFileDialog : oe, q = d(() => {
305
+ B(), F();
306
+ }, [B, F]);
307
+ U(() => {
308
+ I && f.__registerFileInput(T, () => T.current?.click());
309
+ }, [I, f]), U(() => {
310
+ c && T.current && u.length === 0 && (T.current.value = "");
311
+ }, [u, c]);
312
+ const H = d(
313
+ (s, h) => {
314
+ const m = (P) => {
315
+ P.dataTransfer?.types?.includes("Files") && P.preventDefault();
316
+ }, y = (P) => {
317
+ const w = P;
318
+ w.dataTransfer?.types?.includes("Files") && P.preventDefault(), w.dataTransfer?.files && w.dataTransfer.files.length > 0 && h(w.dataTransfer.files);
319
+ };
320
+ return s.addEventListener("dragover", m), s.addEventListener("drop", y), () => {
321
+ s.removeEventListener("dragover", m), s.removeEventListener("drop", y);
322
+ };
323
+ },
324
+ []
325
+ );
326
+ U(() => {
327
+ const s = p.current;
328
+ if (s && !o)
329
+ return H(s, A);
330
+ }, [A, o, H]), U(() => {
331
+ if (o)
332
+ return H(document, A);
333
+ }, [A, o, H]), U(
334
+ () => () => {
335
+ if (!I)
336
+ for (const s of D.current)
337
+ s.url && URL.revokeObjectURL(s.url);
338
+ },
339
+ [I]
340
+ );
341
+ const ie = d(
342
+ (s) => {
343
+ s.currentTarget.files && A(s.currentTarget.files), s.currentTarget.value = "";
344
+ },
345
+ [A]
346
+ ), le = W(
347
+ () => ({
348
+ add: A,
349
+ clear: B,
350
+ fileInputRef: T,
351
+ files: u.map((s) => ({ ...s, id: s.id })),
352
+ openFileDialog: Q,
353
+ remove: J
354
+ }),
355
+ [u, A, J, B, Q]
356
+ ), ue = W(
357
+ () => ({
358
+ add: (s) => {
359
+ const h = Array.isArray(s) ? s : [s];
360
+ R((m) => [
361
+ ...m,
362
+ ...h.map((y) => ({ ...y, id: crypto.randomUUID() }))
363
+ ]);
364
+ },
365
+ clear: F,
366
+ remove: (s) => {
367
+ R((h) => h.filter((m) => m.id !== s));
368
+ },
369
+ sources: b
370
+ }),
371
+ [b, F]
372
+ ), me = d(
373
+ async (s) => {
374
+ s.preventDefault();
375
+ const h = s.currentTarget, m = I ? f.textInput.value : new FormData(h).get("message") || "";
376
+ I || h.reset();
377
+ try {
378
+ const y = await Promise.all(
379
+ u.map(async ({ id: w, ...x }) => {
380
+ if (x.url?.startsWith("blob:")) {
381
+ const k = await Ve(x.url);
382
+ return {
383
+ ...x,
384
+ url: k ?? x.url
385
+ };
386
+ }
387
+ return x;
388
+ })
389
+ ), P = v({ files: y, text: m }, s);
390
+ if (P instanceof Promise)
391
+ try {
392
+ await P, q(), I && f.textInput.clear();
393
+ } catch {
394
+ }
395
+ else
396
+ q(), I && f.textInput.clear();
397
+ } catch {
398
+ }
399
+ },
400
+ [I, f, u, v, q]
401
+ ), de = /* @__PURE__ */ j(fe, { children: [
402
+ /* @__PURE__ */ n(
403
+ "input",
404
+ {
405
+ accept: t,
406
+ "aria-label": "Upload files",
407
+ className: "hidden",
408
+ multiple: r,
409
+ onChange: ie,
410
+ ref: T,
411
+ title: "Upload files",
412
+ type: "file"
413
+ }
414
+ ),
415
+ /* @__PURE__ */ n(
416
+ "form",
417
+ {
418
+ className: l("w-full", e),
419
+ onSubmit: me,
420
+ ref: p,
421
+ ...L,
422
+ children: /* @__PURE__ */ n(Oe, { className: "border-border overflow-hidden has-[[data-slot=input-group-control]:focus-visible]:ring-0", children: C })
423
+ }
424
+ )
425
+ ] }), pe = /* @__PURE__ */ n(re.Provider, { value: ue, children: de });
426
+ return /* @__PURE__ */ n(ne.Provider, { value: le, children: pe });
427
+ }, ft = ({
428
+ className: e,
429
+ ...t
430
+ }) => /* @__PURE__ */ n("div", { className: l("contents", e), ...t }), ht = ({
431
+ onChange: e,
432
+ onKeyDown: t,
433
+ className: r,
434
+ placeholder: o = "What would you like to know?",
435
+ ...c
436
+ }) => {
437
+ const i = te(), a = $(), [g, v] = E(!1), C = d(
438
+ (p) => {
439
+ if (t?.(p), !p.defaultPrevented) {
440
+ if (p.key === "Enter") {
441
+ if (g || p.nativeEvent.isComposing || p.shiftKey)
442
+ return;
443
+ p.preventDefault();
444
+ const { form: N } = p.currentTarget;
445
+ if (N?.querySelector(
446
+ 'button[type="submit"]'
447
+ )?.disabled)
448
+ return;
449
+ N?.requestSubmit();
450
+ }
451
+ if (p.key === "Backspace" && p.currentTarget.value === "" && a.files.length > 0) {
452
+ p.preventDefault();
453
+ const N = a.files[a.files.length - 1];
454
+ N && a.remove(N.id);
455
+ }
456
+ }
457
+ },
458
+ [t, g, a]
459
+ ), L = d(
460
+ (p) => {
461
+ const N = p.clipboardData?.items;
462
+ if (!N)
463
+ return;
464
+ const S = [];
465
+ for (const u of N)
466
+ if (u.kind === "file") {
467
+ const b = u.getAsFile();
468
+ b && S.push(b);
469
+ }
470
+ S.length > 0 && (p.preventDefault(), a.add(S));
471
+ },
472
+ [a]
473
+ ), f = d(() => v(!1), []), I = d(() => v(!0), []), T = i ? {
474
+ onChange: (p) => {
475
+ i.textInput.setInput(p.currentTarget.value), e?.(p);
476
+ },
477
+ value: i.textInput.value
478
+ } : {
479
+ onChange: e
480
+ };
481
+ return /* @__PURE__ */ n(
482
+ je,
483
+ {
484
+ className: l("field-sizing-content max-h-48 min-h-16", r),
485
+ name: "message",
486
+ onCompositionEnd: f,
487
+ onCompositionStart: I,
488
+ onKeyDown: C,
489
+ onPaste: L,
490
+ placeholder: o,
491
+ ...c,
492
+ ...T
493
+ }
494
+ );
495
+ }, gt = ({
496
+ className: e,
497
+ ...t
498
+ }) => /* @__PURE__ */ n(
499
+ ee,
500
+ {
501
+ align: "block-end",
502
+ className: l("order-first flex-wrap gap-1", e),
503
+ ...t
504
+ }
505
+ ), vt = ({
506
+ className: e,
507
+ ...t
508
+ }) => /* @__PURE__ */ n(
509
+ ee,
510
+ {
511
+ align: "block-end",
512
+ className: l("justify-between gap-1", e),
513
+ ...t
514
+ }
515
+ ), It = ({
516
+ className: e,
517
+ ...t
518
+ }) => /* @__PURE__ */ n(
519
+ "div",
520
+ {
521
+ className: l("flex min-w-0 items-center gap-1", e),
522
+ ...t
523
+ }
524
+ ), Ze = ({
525
+ variant: e = "ghost",
526
+ className: t,
527
+ size: r,
528
+ tooltip: o,
529
+ ...c
530
+ }) => {
531
+ const i = r ?? (be.count(c.children) > 1 ? "sm" : "icon-sm"), a = /* @__PURE__ */ n(
532
+ Y,
533
+ {
534
+ className: l(t),
535
+ size: i,
536
+ type: "button",
537
+ variant: e,
538
+ ...c
539
+ }
540
+ );
541
+ if (!o)
542
+ return a;
543
+ const g = typeof o == "string" ? o : o.content, v = typeof o == "string" ? void 0 : o.shortcut, C = typeof o == "string" ? "top" : o.side ?? "top";
544
+ return /* @__PURE__ */ j(We, { children: [
545
+ /* @__PURE__ */ n(Ge, { asChild: !0, children: a }),
546
+ /* @__PURE__ */ j(qe, { side: C, children: [
547
+ g,
548
+ v && /* @__PURE__ */ n("span", { className: "ml-2 text-muted-foreground", children: v })
549
+ ] })
550
+ ] });
551
+ }, Pt = (e) => /* @__PURE__ */ n(Le, { ...e }), yt = ({
552
+ className: e,
553
+ children: t,
554
+ tooltip: r,
555
+ "aria-label": o,
556
+ ...c
557
+ }) => {
558
+ const i = o ?? (typeof r == "string" ? r : typeof r?.content == "string" ? r.content : void 0);
559
+ return /* @__PURE__ */ n(Ae, { asChild: !0, children: /* @__PURE__ */ n(
560
+ Ze,
561
+ {
562
+ "aria-label": i,
563
+ className: e,
564
+ tooltip: r,
565
+ ...c,
566
+ children: t ?? /* @__PURE__ */ n(ve, { className: "size-4" })
567
+ }
568
+ ) });
569
+ }, bt = ({
570
+ className: e,
571
+ ...t
572
+ }) => /* @__PURE__ */ n(Re, { align: "start", className: l(e), ...t }), Ct = ({
573
+ className: e,
574
+ ...t
575
+ }) => /* @__PURE__ */ n(K, { className: l(e), ...t }), wt = ({
576
+ className: e,
577
+ variant: t = "default",
578
+ size: r = "icon-sm",
579
+ status: o,
580
+ onStop: c,
581
+ onClick: i,
582
+ children: a,
583
+ ...g
584
+ }) => {
585
+ const v = o === "submitted" || o === "streaming";
586
+ let C = /* @__PURE__ */ n(Ie, { className: "size-4" });
587
+ o === "submitted" ? C = /* @__PURE__ */ n(He, {}) : o === "streaming" ? C = /* @__PURE__ */ n(Pe, { className: "size-4" }) : o === "error" && (C = /* @__PURE__ */ n(ye, { className: "size-4" }));
588
+ const L = d(
589
+ (f) => {
590
+ if (v && c) {
591
+ f.preventDefault(), c();
592
+ return;
593
+ }
594
+ i?.(f);
595
+ },
596
+ [v, c, i]
597
+ );
598
+ return /* @__PURE__ */ n(
599
+ Y,
600
+ {
601
+ "aria-label": v ? "Stop" : "Submit",
602
+ className: l(e),
603
+ onClick: L,
604
+ size: r,
605
+ type: v && c ? "button" : "submit",
606
+ variant: t,
607
+ ...g,
608
+ children: a ?? C
609
+ }
610
+ );
611
+ }, xt = (e) => /* @__PURE__ */ n(ze, { ...e }), Nt = ({
612
+ className: e,
613
+ ...t
614
+ }) => /* @__PURE__ */ n(
615
+ Be,
616
+ {
617
+ className: l(
618
+ "border-none bg-transparent font-medium text-muted-foreground shadow-none transition-colors",
619
+ "hover:bg-accent hover:text-foreground aria-expanded:bg-accent aria-expanded:text-foreground",
620
+ e
621
+ ),
622
+ ...t
623
+ }
624
+ ), Tt = ({
625
+ className: e,
626
+ ...t
627
+ }) => /* @__PURE__ */ n(Ee, { className: l(e), ...t }), St = ({
628
+ className: e,
629
+ ...t
630
+ }) => /* @__PURE__ */ n(_e, { className: l(e), ...t }), Dt = ({
631
+ className: e,
632
+ ...t
633
+ }) => /* @__PURE__ */ n(Fe, { className: l(e), ...t }), Lt = ({
634
+ openDelay: e = 0,
635
+ closeDelay: t = 0,
636
+ ...r
637
+ }) => /* @__PURE__ */ n(Ue, { closeDelay: t, openDelay: e, ...r }), Rt = (e) => /* @__PURE__ */ n(Me, { ...e }), At = ({
638
+ align: e = "start",
639
+ ...t
640
+ }) => /* @__PURE__ */ n(ke, { align: e, ...t }), Ut = ({
641
+ a: e,
642
+ b: t,
643
+ show: r,
644
+ className: o
645
+ }) => /* @__PURE__ */ j(
646
+ "div",
647
+ {
648
+ className: l("relative inline-flex items-center justify-center", o),
649
+ children: [
650
+ /* @__PURE__ */ n(
651
+ "div",
652
+ {
653
+ "aria-hidden": r,
654
+ className: l(
655
+ "transition-all duration-200 ease-out",
656
+ r ? "pointer-events-none scale-75 opacity-0" : "scale-100 opacity-100"
657
+ ),
658
+ children: e
659
+ }
660
+ ),
661
+ /* @__PURE__ */ n(
662
+ "div",
663
+ {
664
+ "aria-hidden": !r,
665
+ className: l(
666
+ "absolute transition-all duration-200 ease-out",
667
+ r ? "scale-100 opacity-100" : "pointer-events-none scale-75 opacity-0"
668
+ ),
669
+ children: t
670
+ }
671
+ )
672
+ ]
673
+ }
674
+ ), kt = ({
675
+ className: e,
676
+ ...t
677
+ }) => /* @__PURE__ */ n("div", { className: l(e), ...t }), Mt = ({
678
+ className: e,
679
+ ...t
680
+ }) => /* @__PURE__ */ n("div", { className: l(e), ...t }), Ot = ({
681
+ className: e,
682
+ children: t,
683
+ ...r
684
+ }) => /* @__PURE__ */ n(
685
+ "h3",
686
+ {
687
+ className: l(
688
+ "mb-2 px-3 font-medium text-muted-foreground text-xs",
689
+ e
690
+ ),
691
+ ...r,
692
+ children: t
693
+ }
694
+ ), jt = ({
695
+ className: e,
696
+ ...t
697
+ }) => /* @__PURE__ */ n("div", { className: l("space-y-1", e), ...t }), zt = ({
698
+ className: e,
699
+ ...t
700
+ }) => /* @__PURE__ */ n(
701
+ "div",
702
+ {
703
+ className: l(
704
+ "flex items-center gap-2 px-3 py-2 text-xs hover:bg-accent",
705
+ e
706
+ ),
707
+ ...t
708
+ }
709
+ ), Et = ({
710
+ className: e,
711
+ ...t
712
+ }) => /* @__PURE__ */ n(Ce, { className: l(e), ...t }), _t = ({
713
+ className: e,
714
+ ...t
715
+ }) => /* @__PURE__ */ n(Ne, { className: l(e), ...t }), Bt = ({
716
+ className: e,
717
+ ...t
718
+ }) => /* @__PURE__ */ n(Se, { className: l(e), ...t }), Ft = ({
719
+ className: e,
720
+ ...t
721
+ }) => /* @__PURE__ */ n(we, { className: l(e), ...t }), Ht = ({
722
+ className: e,
723
+ ...t
724
+ }) => /* @__PURE__ */ n(xe, { className: l(e), ...t }), Wt = ({
725
+ className: e,
726
+ ...t
727
+ }) => /* @__PURE__ */ n(Te, { className: l(e), ...t }), Gt = ({
728
+ className: e,
729
+ ...t
730
+ }) => /* @__PURE__ */ n(De, { className: l(e), ...t });
731
+ export {
732
+ re as LocalReferencedSourcesContext,
733
+ pt as PromptInput,
734
+ mt as PromptInputActionAddAttachments,
735
+ dt as PromptInputActionAddScreenshot,
736
+ Pt as PromptInputActionMenu,
737
+ bt as PromptInputActionMenuContent,
738
+ Ct as PromptInputActionMenuItem,
739
+ yt as PromptInputActionMenuTrigger,
740
+ ft as PromptInputBody,
741
+ Ze as PromptInputButton,
742
+ Et as PromptInputCommand,
743
+ Ft as PromptInputCommandEmpty,
744
+ Ht as PromptInputCommandGroup,
745
+ _t as PromptInputCommandInput,
746
+ Wt as PromptInputCommandItem,
747
+ Bt as PromptInputCommandList,
748
+ Gt as PromptInputCommandSeparator,
749
+ vt as PromptInputFooter,
750
+ gt as PromptInputHeader,
751
+ Lt as PromptInputHoverCard,
752
+ At as PromptInputHoverCardContent,
753
+ Rt as PromptInputHoverCardTrigger,
754
+ lt as PromptInputProvider,
755
+ xt as PromptInputSelect,
756
+ Tt as PromptInputSelectContent,
757
+ St as PromptInputSelectItem,
758
+ Nt as PromptInputSelectTrigger,
759
+ Dt as PromptInputSelectValue,
760
+ Ut as PromptInputSlotSwap,
761
+ wt as PromptInputSubmit,
762
+ Mt as PromptInputTab,
763
+ jt as PromptInputTabBody,
764
+ zt as PromptInputTabItem,
765
+ Ot as PromptInputTabLabel,
766
+ kt as PromptInputTabsList,
767
+ ht as PromptInputTextarea,
768
+ It as PromptInputTools,
769
+ $ as usePromptInputAttachments,
770
+ ct as usePromptInputController,
771
+ ut as usePromptInputReferencedSources,
772
+ it as useProviderAttachments
773
+ };
774
+ //# sourceMappingURL=prompt-input.js.map