@duskmoon-dev/components 0.6.0 → 0.6.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.
- package/README.md +27 -3
- package/dist/{chunk-b1jnq16e.js → chunk-rd10x4gc.js} +6 -0
- package/dist/components/chat/Chat.types.d.ts +7 -0
- package/dist/components/chat/ChatSessionComposer.types.d.ts +4 -0
- package/dist/components/chat/ComposerProvider.types.d.ts +4 -0
- package/dist/components/chat/composer/CompletionList.d.ts +6 -1
- package/dist/components/chat/composer/ComposerShell.d.ts +4 -0
- package/dist/components/chat/composer/DraftLifecycle.d.ts +3 -1
- package/dist/components/chat/index.js +826 -659
- package/dist/components/chat/rich/index.js +644 -603
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +1939 -1540
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +180 -2
- package/package.json +3 -3
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
// src/components/chat/Chat.tsx
|
|
4
4
|
import {
|
|
5
|
-
forwardRef as
|
|
5
|
+
forwardRef as forwardRef5,
|
|
6
6
|
useId as useId3,
|
|
7
|
-
useLayoutEffect as
|
|
7
|
+
useLayoutEffect as useLayoutEffect4,
|
|
8
8
|
useRef as useRef5,
|
|
9
9
|
useState as useState3
|
|
10
10
|
} from "react";
|
|
11
11
|
|
|
12
12
|
// src/components/chat/ChatComposer.tsx
|
|
13
13
|
import {
|
|
14
|
-
forwardRef as
|
|
14
|
+
forwardRef as forwardRef3,
|
|
15
15
|
useId,
|
|
16
|
-
useLayoutEffect as
|
|
16
|
+
useLayoutEffect as useLayoutEffect3,
|
|
17
17
|
useRef as useRef4,
|
|
18
18
|
useState as useState2
|
|
19
19
|
} from "react";
|
|
20
20
|
|
|
21
21
|
// src/components/chat/composer/ComposerShell.tsx
|
|
22
|
-
import { forwardRef, useEffect, useRef } from "react";
|
|
22
|
+
import { forwardRef, useEffect, useRef as useRef2, useState } from "react";
|
|
23
23
|
|
|
24
24
|
// src/components/button/Button.tsx
|
|
25
25
|
import React from "react";
|
|
@@ -374,8 +374,8 @@ function Button({
|
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
376
|
// src/components/chat/composer/CompletionList.tsx
|
|
377
|
-
import React2 from "react";
|
|
378
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
377
|
+
import React2, { useLayoutEffect, useRef } from "react";
|
|
378
|
+
import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
379
379
|
function completionOptionId(composerId, candidateId) {
|
|
380
380
|
return `${composerId}-option-${encodeURIComponent(candidateId)}`;
|
|
381
381
|
}
|
|
@@ -384,13 +384,37 @@ function CompletionList({
|
|
|
384
384
|
label,
|
|
385
385
|
candidates,
|
|
386
386
|
activeId,
|
|
387
|
-
onSelect
|
|
387
|
+
onSelect,
|
|
388
|
+
compact = false,
|
|
389
|
+
anchorName,
|
|
390
|
+
header,
|
|
391
|
+
status,
|
|
392
|
+
onDismiss
|
|
388
393
|
}) {
|
|
389
|
-
|
|
394
|
+
const surface = useRef(null);
|
|
395
|
+
useLayoutEffect(() => {
|
|
396
|
+
if (compact)
|
|
397
|
+
surface.current?.showPopover?.();
|
|
398
|
+
}, [compact]);
|
|
399
|
+
useLayoutEffect(() => {
|
|
400
|
+
const tray = surface.current;
|
|
401
|
+
const option = tray?.querySelector('[aria-selected="true"]');
|
|
402
|
+
if (!compact || !tray || !option)
|
|
403
|
+
return;
|
|
404
|
+
const bounds = tray.getBoundingClientRect();
|
|
405
|
+
const selected = option.getBoundingClientRect();
|
|
406
|
+
const top = bounds.top + tray.clientTop;
|
|
407
|
+
const bottom = top + tray.clientHeight;
|
|
408
|
+
if (selected.top < top)
|
|
409
|
+
tray.scrollTop += selected.top - top;
|
|
410
|
+
else if (selected.bottom > bottom)
|
|
411
|
+
tray.scrollTop += selected.bottom - bottom;
|
|
412
|
+
}, [compact, activeId, candidates]);
|
|
413
|
+
const list = candidates.length ? /* @__PURE__ */ jsx2("ul", {
|
|
390
414
|
id: `${composerId}-completions`,
|
|
391
415
|
role: "listbox",
|
|
392
416
|
"aria-label": label,
|
|
393
|
-
className: "chat-composer-completions",
|
|
417
|
+
className: compact ? "chat-composer-completion-list" : "chat-composer-completions",
|
|
394
418
|
children: candidates.map((item, index) => /* @__PURE__ */ jsxs2(React2.Fragment, {
|
|
395
419
|
children: [
|
|
396
420
|
item.group && candidates[index - 1]?.group !== item.group ? /* @__PURE__ */ jsx2("li", {
|
|
@@ -401,7 +425,7 @@ function CompletionList({
|
|
|
401
425
|
}) : null,
|
|
402
426
|
/* @__PURE__ */ jsxs2("li", {
|
|
403
427
|
id: completionOptionId(composerId, item.id),
|
|
404
|
-
className: "chat-composer-option",
|
|
428
|
+
className: compact ? "chat-composer-option chat-composer-option-compact" : "chat-composer-option",
|
|
405
429
|
role: "option",
|
|
406
430
|
"aria-label": item.group ? `${item.group}: ${item.label}` : undefined,
|
|
407
431
|
"aria-selected": item.id === activeId,
|
|
@@ -418,24 +442,57 @@ function CompletionList({
|
|
|
418
442
|
}
|
|
419
443
|
},
|
|
420
444
|
children: [
|
|
445
|
+
compact && item.icon ? /* @__PURE__ */ jsx2("span", {
|
|
446
|
+
className: "chat-composer-option-icon",
|
|
447
|
+
"aria-hidden": "true",
|
|
448
|
+
children: item.icon
|
|
449
|
+
}) : null,
|
|
421
450
|
/* @__PURE__ */ jsx2("span", {
|
|
451
|
+
className: compact ? "chat-composer-label" : undefined,
|
|
452
|
+
title: item.label,
|
|
422
453
|
children: item.label
|
|
423
454
|
}),
|
|
424
455
|
item.description ? /* @__PURE__ */ jsx2("span", {
|
|
425
|
-
className: "chat-composer-description",
|
|
456
|
+
className: compact ? "chat-composer-description chat-composer-option-description" : "chat-composer-description",
|
|
457
|
+
title: typeof item.description === "string" ? item.description : undefined,
|
|
426
458
|
children: item.description
|
|
459
|
+
}) : null,
|
|
460
|
+
compact && item.sourceLabel ? /* @__PURE__ */ jsx2("span", {
|
|
461
|
+
className: "chat-composer-description chat-composer-option-source",
|
|
462
|
+
children: item.sourceLabel
|
|
427
463
|
}) : null
|
|
428
464
|
]
|
|
429
465
|
})
|
|
430
466
|
]
|
|
431
467
|
}, item.id))
|
|
468
|
+
}) : null;
|
|
469
|
+
return compact ? /* @__PURE__ */ jsxs2("div", {
|
|
470
|
+
ref: surface,
|
|
471
|
+
popover: "auto",
|
|
472
|
+
className: "chat-composer-completions chat-composer-completions-compact",
|
|
473
|
+
style: { positionAnchor: anchorName },
|
|
474
|
+
onToggle: (event) => {
|
|
475
|
+
if (event.newState === "closed")
|
|
476
|
+
onDismiss?.();
|
|
477
|
+
},
|
|
478
|
+
children: [
|
|
479
|
+
header,
|
|
480
|
+
list,
|
|
481
|
+
status
|
|
482
|
+
]
|
|
483
|
+
}) : /* @__PURE__ */ jsxs2(Fragment2, {
|
|
484
|
+
children: [
|
|
485
|
+
header,
|
|
486
|
+
status,
|
|
487
|
+
list
|
|
488
|
+
]
|
|
432
489
|
});
|
|
433
490
|
}
|
|
434
491
|
|
|
435
492
|
// src/components/chat/composer/ComposerShell.tsx
|
|
436
|
-
import { jsx as jsx3, jsxs as jsxs3, Fragment as
|
|
493
|
+
import { jsx as jsx3, jsxs as jsxs3, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
437
494
|
function AttachmentPreview({ file }) {
|
|
438
|
-
const imageRef =
|
|
495
|
+
const imageRef = useRef2(null);
|
|
439
496
|
useEffect(() => {
|
|
440
497
|
const image = imageRef.current;
|
|
441
498
|
if (!image || !file.type.startsWith("image/") || !URL.createObjectURL)
|
|
@@ -451,10 +508,44 @@ function AttachmentPreview({ file }) {
|
|
|
451
508
|
}, [file]);
|
|
452
509
|
return file.type.startsWith("image/") ? /* @__PURE__ */ jsx3("img", {
|
|
453
510
|
ref: imageRef,
|
|
511
|
+
className: "chat-composer-preview",
|
|
454
512
|
alt: file.name,
|
|
455
513
|
hidden: true
|
|
456
514
|
}) : null;
|
|
457
515
|
}
|
|
516
|
+
function ComposerIcon({
|
|
517
|
+
action
|
|
518
|
+
}) {
|
|
519
|
+
return /* @__PURE__ */ jsx3("svg", {
|
|
520
|
+
width: "18",
|
|
521
|
+
height: "18",
|
|
522
|
+
viewBox: "0 0 24 24",
|
|
523
|
+
fill: "none",
|
|
524
|
+
stroke: "currentColor",
|
|
525
|
+
strokeWidth: "2",
|
|
526
|
+
strokeLinecap: "round",
|
|
527
|
+
strokeLinejoin: "round",
|
|
528
|
+
"aria-hidden": "true",
|
|
529
|
+
focusable: "false",
|
|
530
|
+
children: action === "attach" ? /* @__PURE__ */ jsx3("path", {
|
|
531
|
+
d: "M12 5v14M5 12h14"
|
|
532
|
+
}) : action === "send" ? /* @__PURE__ */ jsx3("path", {
|
|
533
|
+
d: "m5 12 7-7 7 7M12 5v14"
|
|
534
|
+
}) : action === "stop" ? /* @__PURE__ */ jsx3("rect", {
|
|
535
|
+
x: "6",
|
|
536
|
+
y: "6",
|
|
537
|
+
width: "12",
|
|
538
|
+
height: "12",
|
|
539
|
+
rx: "1",
|
|
540
|
+
fill: "currentColor",
|
|
541
|
+
stroke: "none"
|
|
542
|
+
}) : action === "retry" ? /* @__PURE__ */ jsx3("path", {
|
|
543
|
+
d: "M3 11a9 9 0 1 1 2.6 7.4M3 4v7h7"
|
|
544
|
+
}) : /* @__PURE__ */ jsx3("path", {
|
|
545
|
+
d: "m6 6 12 12M6 18 18 6"
|
|
546
|
+
})
|
|
547
|
+
});
|
|
548
|
+
}
|
|
458
549
|
function AttachmentContent({
|
|
459
550
|
file,
|
|
460
551
|
renderAttachment,
|
|
@@ -471,6 +562,8 @@ function ExtraActions({
|
|
|
471
562
|
var ComposerShell = forwardRef(({
|
|
472
563
|
editor,
|
|
473
564
|
composerId,
|
|
565
|
+
compact = false,
|
|
566
|
+
addMenu,
|
|
474
567
|
entries,
|
|
475
568
|
renderAttachment,
|
|
476
569
|
removeAttachment,
|
|
@@ -489,12 +582,14 @@ var ComposerShell = forwardRef(({
|
|
|
489
582
|
active,
|
|
490
583
|
showCompletion,
|
|
491
584
|
selectCompletion,
|
|
585
|
+
dismissCompletion,
|
|
492
586
|
visibleError,
|
|
493
587
|
hasError,
|
|
494
588
|
intakeEvents = true,
|
|
495
589
|
completionHeader,
|
|
496
590
|
completionStatus,
|
|
497
591
|
statusContent,
|
|
592
|
+
renderFooter,
|
|
498
593
|
attachLabel,
|
|
499
594
|
sendLabel,
|
|
500
595
|
stopLabel,
|
|
@@ -504,215 +599,346 @@ var ComposerShell = forwardRef(({
|
|
|
504
599
|
children,
|
|
505
600
|
className,
|
|
506
601
|
...props
|
|
507
|
-
}, ref) =>
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
previewUrl,
|
|
544
|
-
state,
|
|
545
|
-
status,
|
|
546
|
-
progress,
|
|
547
|
-
retry,
|
|
548
|
-
cancel
|
|
549
|
-
}) => {
|
|
550
|
-
const name = file?.name ?? entryName ?? "Attachment";
|
|
551
|
-
return /* @__PURE__ */ jsx3("li", {
|
|
552
|
-
className: "chat-composer-attachment",
|
|
553
|
-
"data-state": state,
|
|
554
|
-
children: renderAttachment && file ? /* @__PURE__ */ jsx3(AttachmentContent, {
|
|
555
|
-
file,
|
|
556
|
-
renderAttachment,
|
|
557
|
-
context: {
|
|
558
|
-
remove: () => removeAttachment(id),
|
|
559
|
-
disabled: disabled || !onAttachmentsChange
|
|
560
|
-
}
|
|
561
|
-
}) : /* @__PURE__ */ jsxs3(Fragment2, {
|
|
562
|
-
children: [
|
|
563
|
-
previewUrl ? /* @__PURE__ */ jsx3("img", {
|
|
564
|
-
src: previewUrl,
|
|
565
|
-
alt: name
|
|
566
|
-
}) : file ? /* @__PURE__ */ jsx3(AttachmentPreview, {
|
|
567
|
-
file
|
|
568
|
-
}) : null,
|
|
569
|
-
/* @__PURE__ */ jsxs3("div", {
|
|
570
|
-
className: "chat-composer-attachment-info",
|
|
571
|
-
children: [
|
|
572
|
-
/* @__PURE__ */ jsx3("span", {
|
|
573
|
-
className: "chat-composer-filename",
|
|
574
|
-
title: name,
|
|
575
|
-
children: name
|
|
576
|
-
}),
|
|
577
|
-
status ? /* @__PURE__ */ jsx3("span", {
|
|
578
|
-
className: "chat-composer-description",
|
|
579
|
-
children: status
|
|
580
|
-
}) : null,
|
|
581
|
-
progress !== undefined ? /* @__PURE__ */ jsx3("progress", {
|
|
582
|
-
value: progress,
|
|
583
|
-
max: 1,
|
|
584
|
-
"aria-label": `Preparing ${name}`
|
|
585
|
-
}) : null
|
|
586
|
-
]
|
|
587
|
-
}),
|
|
588
|
-
retry ? /* @__PURE__ */ jsx3(Button, {
|
|
589
|
-
type: "button",
|
|
590
|
-
size: "sm",
|
|
591
|
-
disabled,
|
|
592
|
-
onClick: retry,
|
|
593
|
-
"aria-label": `Retry ${name}`,
|
|
594
|
-
children: "Retry"
|
|
595
|
-
}) : null,
|
|
596
|
-
cancel ? /* @__PURE__ */ jsx3(Button, {
|
|
597
|
-
type: "button",
|
|
598
|
-
size: "sm",
|
|
599
|
-
disabled,
|
|
600
|
-
onClick: cancel,
|
|
601
|
-
"aria-label": `Cancel ${name}`,
|
|
602
|
-
children: "Cancel"
|
|
603
|
-
}) : null,
|
|
604
|
-
onAttachmentsChange ? /* @__PURE__ */ jsx3(Button, {
|
|
605
|
-
type: "button",
|
|
606
|
-
size: "sm",
|
|
607
|
-
color: "base",
|
|
608
|
-
appearance: "ghost",
|
|
609
|
-
disabled,
|
|
610
|
-
"aria-label": `Remove ${name}`,
|
|
611
|
-
onClick: () => removeAttachment(id),
|
|
612
|
-
children: "Remove"
|
|
613
|
-
}) : null
|
|
614
|
-
]
|
|
615
|
-
})
|
|
616
|
-
}, id);
|
|
602
|
+
}, ref) => {
|
|
603
|
+
const [addOpen, setAddOpen] = useState(false);
|
|
604
|
+
const addId = `${composerId}-add`;
|
|
605
|
+
const addAnchor = `--composer-add-${composerId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
606
|
+
const completionAnchor = `--composer-completions-${composerId.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
607
|
+
const thumbnails = compact && entries.length > 0 && !renderAttachment && entries.every(({ file, previewUrl, state, status, progress, retry, cancel }) => (previewUrl || file?.type.startsWith("image/") && typeof URL.createObjectURL === "function") && (!state || state === "ready") && !status && progress === undefined && !retry && !cancel);
|
|
608
|
+
const attachmentAction = onAttachmentsChange ? /* @__PURE__ */ jsxs3(Fragment3, {
|
|
609
|
+
children: [
|
|
610
|
+
/* @__PURE__ */ jsx3("input", {
|
|
611
|
+
ref: pickerRef,
|
|
612
|
+
type: "file",
|
|
613
|
+
accept,
|
|
614
|
+
multiple,
|
|
615
|
+
disabled,
|
|
616
|
+
hidden: true,
|
|
617
|
+
"aria-label": attachLabel,
|
|
618
|
+
onChange: (event) => {
|
|
619
|
+
const files = Array.from(event.currentTarget.files ?? []);
|
|
620
|
+
event.currentTarget.value = "";
|
|
621
|
+
if (files.length > 0)
|
|
622
|
+
addAttachments(files, "picker");
|
|
623
|
+
}
|
|
624
|
+
}),
|
|
625
|
+
/* @__PURE__ */ jsx3(Button, {
|
|
626
|
+
type: "button",
|
|
627
|
+
color: "base",
|
|
628
|
+
appearance: "ghost",
|
|
629
|
+
size: "sm",
|
|
630
|
+
shape: "circle",
|
|
631
|
+
"aria-label": attachLabel,
|
|
632
|
+
title: attachLabel,
|
|
633
|
+
disabled,
|
|
634
|
+
onClick: openAttachments,
|
|
635
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
636
|
+
action: "attach"
|
|
637
|
+
})
|
|
617
638
|
})
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
+
]
|
|
640
|
+
}) : null;
|
|
641
|
+
const actionContent = /* @__PURE__ */ jsxs3(Fragment3, {
|
|
642
|
+
children: [
|
|
643
|
+
/* @__PURE__ */ jsx3(ExtraActions, {
|
|
644
|
+
context: {
|
|
645
|
+
submit: () => {
|
|
646
|
+
submit();
|
|
647
|
+
},
|
|
648
|
+
submitting,
|
|
649
|
+
canSubmit: eligible,
|
|
650
|
+
disabled,
|
|
651
|
+
generating,
|
|
652
|
+
openAttachments
|
|
653
|
+
},
|
|
654
|
+
children
|
|
655
|
+
}),
|
|
656
|
+
generating && onStop && (!compact || !eligible) ? /* @__PURE__ */ jsx3(Button, {
|
|
657
|
+
type: "button",
|
|
658
|
+
color: compact ? "primary" : undefined,
|
|
659
|
+
size: "sm",
|
|
660
|
+
shape: "circle",
|
|
661
|
+
"aria-label": stopLabel,
|
|
662
|
+
title: stopLabel,
|
|
663
|
+
disabled,
|
|
664
|
+
onClick: onStop,
|
|
665
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
666
|
+
action: "stop"
|
|
667
|
+
})
|
|
668
|
+
}) : null,
|
|
669
|
+
!compact || !generating || !onStop || eligible ? /* @__PURE__ */ jsx3(Button, {
|
|
670
|
+
type: "button",
|
|
671
|
+
color: "primary",
|
|
672
|
+
size: "sm",
|
|
673
|
+
shape: "circle",
|
|
674
|
+
"aria-label": sendLabel,
|
|
675
|
+
title: sendLabel,
|
|
676
|
+
disabled: !eligible,
|
|
677
|
+
"aria-busy": busy || submitting || undefined,
|
|
678
|
+
onClick: () => {
|
|
679
|
+
submit();
|
|
680
|
+
},
|
|
681
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
682
|
+
action: "send"
|
|
683
|
+
})
|
|
684
|
+
}) : null
|
|
685
|
+
]
|
|
686
|
+
});
|
|
687
|
+
function renderToolbar(menuContent) {
|
|
688
|
+
return compact ? /* @__PURE__ */ jsxs3("div", {
|
|
689
|
+
className: "chat-composer-toolbar chat-composer-toolbar-compact",
|
|
639
690
|
children: [
|
|
640
|
-
onAttachmentsChange ? /* @__PURE__ */ jsxs3(
|
|
691
|
+
onAttachmentsChange || addMenu || menuContent ? /* @__PURE__ */ jsxs3(Fragment3, {
|
|
641
692
|
children: [
|
|
642
|
-
/* @__PURE__ */ jsx3("input", {
|
|
643
|
-
ref: pickerRef,
|
|
644
|
-
type: "file",
|
|
645
|
-
accept,
|
|
646
|
-
multiple,
|
|
647
|
-
disabled,
|
|
648
|
-
hidden: true,
|
|
649
|
-
"aria-label": attachLabel,
|
|
650
|
-
onChange: (event) => {
|
|
651
|
-
const files = Array.from(event.currentTarget.files ?? []);
|
|
652
|
-
event.currentTarget.value = "";
|
|
653
|
-
if (files.length > 0)
|
|
654
|
-
addAttachments(files, "picker");
|
|
655
|
-
}
|
|
656
|
-
}),
|
|
657
693
|
/* @__PURE__ */ jsx3(Button, {
|
|
658
694
|
type: "button",
|
|
659
695
|
color: "base",
|
|
660
696
|
appearance: "ghost",
|
|
697
|
+
size: "sm",
|
|
698
|
+
shape: "circle",
|
|
699
|
+
"aria-label": attachLabel,
|
|
700
|
+
title: attachLabel,
|
|
661
701
|
disabled,
|
|
662
|
-
|
|
663
|
-
|
|
702
|
+
popoverTarget: addId,
|
|
703
|
+
"aria-controls": addId,
|
|
704
|
+
"aria-expanded": addOpen,
|
|
705
|
+
style: { anchorName: addAnchor },
|
|
706
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
707
|
+
action: "attach"
|
|
708
|
+
})
|
|
709
|
+
}),
|
|
710
|
+
/* @__PURE__ */ jsxs3("div", {
|
|
711
|
+
id: addId,
|
|
712
|
+
popover: "auto",
|
|
713
|
+
role: "group",
|
|
714
|
+
"aria-label": "Add files and more",
|
|
715
|
+
className: "popover popover-menu chat-composer-menu",
|
|
716
|
+
style: { positionAnchor: addAnchor },
|
|
717
|
+
onToggle: (event) => setAddOpen(event.currentTarget.matches(":popover-open")),
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsx3("div", {
|
|
720
|
+
className: "chat-composer-group",
|
|
721
|
+
children: "Add"
|
|
722
|
+
}),
|
|
723
|
+
onAttachmentsChange ? /* @__PURE__ */ jsxs3(Fragment3, {
|
|
724
|
+
children: [
|
|
725
|
+
/* @__PURE__ */ jsx3("input", {
|
|
726
|
+
ref: pickerRef,
|
|
727
|
+
type: "file",
|
|
728
|
+
accept,
|
|
729
|
+
multiple,
|
|
730
|
+
disabled,
|
|
731
|
+
hidden: true,
|
|
732
|
+
"aria-label": attachLabel,
|
|
733
|
+
onChange: (event) => {
|
|
734
|
+
const files = Array.from(event.currentTarget.files ?? []);
|
|
735
|
+
event.currentTarget.value = "";
|
|
736
|
+
if (files.length)
|
|
737
|
+
addAttachments(files, "picker");
|
|
738
|
+
}
|
|
739
|
+
}),
|
|
740
|
+
/* @__PURE__ */ jsxs3("button", {
|
|
741
|
+
type: "button",
|
|
742
|
+
className: "popover-menu-item",
|
|
743
|
+
disabled,
|
|
744
|
+
onClick: (event) => {
|
|
745
|
+
event.currentTarget.closest("[popover]")?.hidePopover?.();
|
|
746
|
+
openAttachments();
|
|
747
|
+
},
|
|
748
|
+
children: [
|
|
749
|
+
/* @__PURE__ */ jsx3(ComposerIcon, {
|
|
750
|
+
action: "attach"
|
|
751
|
+
}),
|
|
752
|
+
/* @__PURE__ */ jsx3("span", {
|
|
753
|
+
children: "Files"
|
|
754
|
+
})
|
|
755
|
+
]
|
|
756
|
+
})
|
|
757
|
+
]
|
|
758
|
+
}) : null,
|
|
759
|
+
menuContent,
|
|
760
|
+
addMenu
|
|
761
|
+
]
|
|
664
762
|
})
|
|
665
763
|
]
|
|
666
764
|
}) : null,
|
|
667
|
-
/* @__PURE__ */ jsx3(
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
submit();
|
|
671
|
-
},
|
|
672
|
-
submitting,
|
|
673
|
-
canSubmit: eligible,
|
|
674
|
-
disabled,
|
|
675
|
-
generating,
|
|
676
|
-
openAttachments
|
|
677
|
-
},
|
|
678
|
-
children
|
|
679
|
-
}),
|
|
680
|
-
generating && onStop ? /* @__PURE__ */ jsx3(Button, {
|
|
681
|
-
type: "button",
|
|
682
|
-
disabled,
|
|
683
|
-
onClick: onStop,
|
|
684
|
-
children: stopLabel
|
|
685
|
-
}) : null,
|
|
686
|
-
/* @__PURE__ */ jsx3(Button, {
|
|
687
|
-
type: "button",
|
|
688
|
-
color: "primary",
|
|
689
|
-
disabled: !eligible,
|
|
690
|
-
"aria-busy": busy || submitting || undefined,
|
|
691
|
-
onClick: () => {
|
|
692
|
-
submit();
|
|
693
|
-
},
|
|
694
|
-
children: sendLabel
|
|
765
|
+
/* @__PURE__ */ jsx3("div", {
|
|
766
|
+
className: "chat-composer-actions",
|
|
767
|
+
children: actionContent
|
|
695
768
|
})
|
|
696
769
|
]
|
|
697
|
-
})
|
|
698
|
-
|
|
699
|
-
|
|
770
|
+
}) : /* @__PURE__ */ jsxs3("div", {
|
|
771
|
+
className: "chat-composer-actions",
|
|
772
|
+
children: [
|
|
773
|
+
attachmentAction,
|
|
774
|
+
actionContent
|
|
775
|
+
]
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
779
|
+
...props,
|
|
780
|
+
ref,
|
|
781
|
+
className: cn("chat-composer", className),
|
|
782
|
+
style: compact ? {
|
|
783
|
+
...props.style,
|
|
784
|
+
anchorName: props.style?.anchorName && props.style.anchorName !== "none" ? `${props.style.anchorName}, ${completionAnchor}` : completionAnchor
|
|
785
|
+
} : props.style,
|
|
786
|
+
onPaste: (event) => {
|
|
787
|
+
props.onPaste?.(event);
|
|
788
|
+
if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
|
|
789
|
+
return;
|
|
790
|
+
const files = Array.from(event.clipboardData.files ?? []);
|
|
791
|
+
if (files.length)
|
|
792
|
+
addAttachments(files, "paste");
|
|
793
|
+
},
|
|
794
|
+
onDragOver: (event) => {
|
|
795
|
+
props.onDragOver?.(event);
|
|
796
|
+
if (intakeEvents && !event.defaultPrevented && !disabled && onAttachmentsChange && Array.from(event.dataTransfer.types).includes("Files"))
|
|
797
|
+
event.preventDefault();
|
|
798
|
+
},
|
|
799
|
+
onDrop: (event) => {
|
|
800
|
+
props.onDrop?.(event);
|
|
801
|
+
if (!intakeEvents || event.defaultPrevented || disabled || !onAttachmentsChange)
|
|
802
|
+
return;
|
|
803
|
+
const files = Array.from(event.dataTransfer.files ?? []);
|
|
804
|
+
if (files.length) {
|
|
805
|
+
event.preventDefault();
|
|
806
|
+
addAttachments(files, "drop");
|
|
807
|
+
}
|
|
808
|
+
},
|
|
809
|
+
children: [
|
|
810
|
+
entries.length > 0 ? /* @__PURE__ */ jsx3("ul", {
|
|
811
|
+
role: "list",
|
|
812
|
+
className: cn("chat-composer-attachments", thumbnails && "chat-composer-thumbnails"),
|
|
813
|
+
"aria-label": "Attachments",
|
|
814
|
+
children: entries.map(({
|
|
815
|
+
file,
|
|
816
|
+
id,
|
|
817
|
+
name: entryName,
|
|
818
|
+
previewUrl,
|
|
819
|
+
state,
|
|
820
|
+
status,
|
|
821
|
+
progress,
|
|
822
|
+
retry,
|
|
823
|
+
cancel
|
|
824
|
+
}) => {
|
|
825
|
+
const name = file?.name ?? entryName ?? "Attachment";
|
|
826
|
+
return /* @__PURE__ */ jsx3("li", {
|
|
827
|
+
className: cn("chat-composer-attachment", thumbnails && "chat-composer-attachment-tile"),
|
|
828
|
+
"data-state": state,
|
|
829
|
+
children: renderAttachment && file ? /* @__PURE__ */ jsx3(AttachmentContent, {
|
|
830
|
+
file,
|
|
831
|
+
renderAttachment,
|
|
832
|
+
context: {
|
|
833
|
+
remove: () => removeAttachment(id),
|
|
834
|
+
disabled: disabled || !onAttachmentsChange
|
|
835
|
+
}
|
|
836
|
+
}) : /* @__PURE__ */ jsxs3(Fragment3, {
|
|
837
|
+
children: [
|
|
838
|
+
previewUrl ? /* @__PURE__ */ jsx3("img", {
|
|
839
|
+
className: "chat-composer-preview",
|
|
840
|
+
src: previewUrl,
|
|
841
|
+
alt: name
|
|
842
|
+
}) : file ? /* @__PURE__ */ jsx3(AttachmentPreview, {
|
|
843
|
+
file
|
|
844
|
+
}) : null,
|
|
845
|
+
!thumbnails ? /* @__PURE__ */ jsxs3("div", {
|
|
846
|
+
className: "chat-composer-attachment-info",
|
|
847
|
+
children: [
|
|
848
|
+
/* @__PURE__ */ jsx3("span", {
|
|
849
|
+
className: "chat-composer-filename",
|
|
850
|
+
title: name,
|
|
851
|
+
children: name
|
|
852
|
+
}),
|
|
853
|
+
status ? /* @__PURE__ */ jsx3("span", {
|
|
854
|
+
className: "chat-composer-description",
|
|
855
|
+
children: status
|
|
856
|
+
}) : null,
|
|
857
|
+
progress !== undefined ? /* @__PURE__ */ jsx3("progress", {
|
|
858
|
+
className: "progress",
|
|
859
|
+
value: progress,
|
|
860
|
+
max: 1,
|
|
861
|
+
"aria-label": `Preparing ${name}`
|
|
862
|
+
}) : null
|
|
863
|
+
]
|
|
864
|
+
}) : null,
|
|
865
|
+
retry ? /* @__PURE__ */ jsx3(Button, {
|
|
866
|
+
type: "button",
|
|
867
|
+
size: "sm",
|
|
868
|
+
shape: "circle",
|
|
869
|
+
disabled,
|
|
870
|
+
onClick: retry,
|
|
871
|
+
"aria-label": `Retry ${name}`,
|
|
872
|
+
title: `Retry ${name}`,
|
|
873
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
874
|
+
action: "retry"
|
|
875
|
+
})
|
|
876
|
+
}) : null,
|
|
877
|
+
cancel ? /* @__PURE__ */ jsx3(Button, {
|
|
878
|
+
type: "button",
|
|
879
|
+
size: "sm",
|
|
880
|
+
shape: "circle",
|
|
881
|
+
disabled,
|
|
882
|
+
onClick: cancel,
|
|
883
|
+
"aria-label": `Cancel ${name}`,
|
|
884
|
+
title: `Cancel ${name}`,
|
|
885
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
886
|
+
action: "remove"
|
|
887
|
+
})
|
|
888
|
+
}) : null,
|
|
889
|
+
onAttachmentsChange ? /* @__PURE__ */ jsx3(Button, {
|
|
890
|
+
type: "button",
|
|
891
|
+
size: thumbnails ? "xs" : "sm",
|
|
892
|
+
shape: "circle",
|
|
893
|
+
className: thumbnails ? "chat-composer-attachment-remove" : undefined,
|
|
894
|
+
color: "base",
|
|
895
|
+
appearance: "ghost",
|
|
896
|
+
disabled,
|
|
897
|
+
"aria-label": `Remove ${name}`,
|
|
898
|
+
title: `Remove ${name}`,
|
|
899
|
+
onClick: () => removeAttachment(id),
|
|
900
|
+
children: /* @__PURE__ */ jsx3(ComposerIcon, {
|
|
901
|
+
action: "remove"
|
|
902
|
+
})
|
|
903
|
+
}) : null
|
|
904
|
+
]
|
|
905
|
+
})
|
|
906
|
+
}, id);
|
|
907
|
+
})
|
|
908
|
+
}) : null,
|
|
909
|
+
editor,
|
|
910
|
+
showCompletion || completionHeader || completionStatus ? /* @__PURE__ */ jsx3(CompletionList, {
|
|
911
|
+
composerId,
|
|
912
|
+
label: completion?.label ?? "Suggestions",
|
|
913
|
+
candidates: showCompletion ? candidates : [],
|
|
914
|
+
activeId: active?.id,
|
|
915
|
+
onSelect: selectCompletion,
|
|
916
|
+
compact,
|
|
917
|
+
anchorName: completionAnchor,
|
|
918
|
+
header: completionHeader,
|
|
919
|
+
status: completionStatus,
|
|
920
|
+
onDismiss: dismissCompletion
|
|
921
|
+
}) : null,
|
|
922
|
+
statusContent,
|
|
923
|
+
hasError ? /* @__PURE__ */ jsx3("div", {
|
|
924
|
+
id: `${composerId}-error`,
|
|
925
|
+
role: "alert",
|
|
926
|
+
className: "chat-composer-error chat-composer-status",
|
|
927
|
+
"data-state": "error",
|
|
928
|
+
children: visibleError
|
|
929
|
+
}) : null,
|
|
930
|
+
renderFooter ? renderFooter(renderToolbar) : renderToolbar()
|
|
931
|
+
]
|
|
932
|
+
});
|
|
933
|
+
});
|
|
700
934
|
ComposerShell.displayName = "ComposerShell";
|
|
701
935
|
|
|
702
936
|
// src/components/chat/composer/PlainEditor.tsx
|
|
703
|
-
import {
|
|
704
|
-
forwardRef as forwardRef3,
|
|
705
|
-
useImperativeHandle as useImperativeHandle2,
|
|
706
|
-
useLayoutEffect,
|
|
707
|
-
useRef as useRef3
|
|
708
|
-
} from "react";
|
|
709
|
-
|
|
710
|
-
// src/components/input/Input.tsx
|
|
711
937
|
import {
|
|
712
938
|
forwardRef as forwardRef2,
|
|
713
939
|
useImperativeHandle,
|
|
714
|
-
|
|
715
|
-
|
|
940
|
+
useLayoutEffect as useLayoutEffect2,
|
|
941
|
+
useRef as useRef3
|
|
716
942
|
} from "react";
|
|
717
943
|
|
|
718
944
|
// src/classes/input.ts
|
|
@@ -800,234 +1026,9 @@ function getTextAreaCountClasses({ exceeded }) {
|
|
|
800
1026
|
return cn(textAreaCountClass, exceeded && textAreaCountExceededClass);
|
|
801
1027
|
}
|
|
802
1028
|
|
|
803
|
-
// src/components/input/Input.tsx
|
|
804
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
805
|
-
function toTextValue(value) {
|
|
806
|
-
if (Array.isArray(value)) {
|
|
807
|
-
return value.join(",");
|
|
808
|
-
}
|
|
809
|
-
return value == null ? "" : String(value);
|
|
810
|
-
}
|
|
811
|
-
var InputRoot = forwardRef2(({
|
|
812
|
-
allowClear,
|
|
813
|
-
className,
|
|
814
|
-
defaultValue,
|
|
815
|
-
disabled,
|
|
816
|
-
onChange,
|
|
817
|
-
prefix,
|
|
818
|
-
size = "md",
|
|
819
|
-
status,
|
|
820
|
-
suffix,
|
|
821
|
-
type = "text",
|
|
822
|
-
value,
|
|
823
|
-
variant = "outlined",
|
|
824
|
-
...props
|
|
825
|
-
}, ref) => {
|
|
826
|
-
const inputRef = useRef2(null);
|
|
827
|
-
const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
|
|
828
|
-
const isControlled = value !== undefined;
|
|
829
|
-
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
830
|
-
const hasAffix = prefix != null || suffix != null || allowClear;
|
|
831
|
-
useImperativeHandle(ref, () => inputRef.current);
|
|
832
|
-
function handleChange(event) {
|
|
833
|
-
if (!isControlled) {
|
|
834
|
-
setInternalValue(event.currentTarget.value);
|
|
835
|
-
}
|
|
836
|
-
onChange?.(event);
|
|
837
|
-
}
|
|
838
|
-
function handleClear() {
|
|
839
|
-
const input = inputRef.current;
|
|
840
|
-
if (!input || disabled) {
|
|
841
|
-
return;
|
|
842
|
-
}
|
|
843
|
-
input.value = "";
|
|
844
|
-
if (!isControlled) {
|
|
845
|
-
setInternalValue("");
|
|
846
|
-
}
|
|
847
|
-
onChange?.({
|
|
848
|
-
currentTarget: input,
|
|
849
|
-
target: input,
|
|
850
|
-
type: "change"
|
|
851
|
-
});
|
|
852
|
-
input.focus();
|
|
853
|
-
}
|
|
854
|
-
const control = /* @__PURE__ */ jsx4("input", {
|
|
855
|
-
...props,
|
|
856
|
-
ref: inputRef,
|
|
857
|
-
type,
|
|
858
|
-
className: getInputClasses({ size, status, variant, className }),
|
|
859
|
-
disabled,
|
|
860
|
-
value: currentValue,
|
|
861
|
-
onChange: handleChange
|
|
862
|
-
});
|
|
863
|
-
if (!hasAffix) {
|
|
864
|
-
return control;
|
|
865
|
-
}
|
|
866
|
-
const showClear = allowClear && !disabled && currentValue.length > 0;
|
|
867
|
-
return /* @__PURE__ */ jsxs4("span", {
|
|
868
|
-
className: getInputWrapperClasses({ affixed: hasAffix }),
|
|
869
|
-
children: [
|
|
870
|
-
prefix != null ? /* @__PURE__ */ jsx4("span", {
|
|
871
|
-
className: inputPrefixClass,
|
|
872
|
-
children: prefix
|
|
873
|
-
}) : null,
|
|
874
|
-
control,
|
|
875
|
-
showClear ? /* @__PURE__ */ jsx4("button", {
|
|
876
|
-
type: "button",
|
|
877
|
-
className: inputClearClass,
|
|
878
|
-
"aria-label": "Clear input",
|
|
879
|
-
onClick: handleClear,
|
|
880
|
-
children: "x"
|
|
881
|
-
}) : null,
|
|
882
|
-
suffix != null ? /* @__PURE__ */ jsx4("span", {
|
|
883
|
-
className: inputSuffixClass,
|
|
884
|
-
children: suffix
|
|
885
|
-
}) : null
|
|
886
|
-
]
|
|
887
|
-
});
|
|
888
|
-
});
|
|
889
|
-
InputRoot.displayName = "Input";
|
|
890
|
-
var Search = forwardRef2(({
|
|
891
|
-
className,
|
|
892
|
-
disabled,
|
|
893
|
-
enterButton,
|
|
894
|
-
loading,
|
|
895
|
-
onKeyDown,
|
|
896
|
-
onSearch,
|
|
897
|
-
...props
|
|
898
|
-
}, ref) => {
|
|
899
|
-
const inputRef = useRef2(null);
|
|
900
|
-
useImperativeHandle(ref, () => inputRef.current);
|
|
901
|
-
function emitSearch(event) {
|
|
902
|
-
onSearch?.(inputRef.current?.value ?? "", event);
|
|
903
|
-
}
|
|
904
|
-
function handleKeyDown(event) {
|
|
905
|
-
onKeyDown?.(event);
|
|
906
|
-
if (!event.defaultPrevented && event.key === "Enter") {
|
|
907
|
-
emitSearch(event);
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
|
|
911
|
-
return /* @__PURE__ */ jsxs4("span", {
|
|
912
|
-
className: getSearchWrapperClasses({ className }),
|
|
913
|
-
children: [
|
|
914
|
-
/* @__PURE__ */ jsx4(InputRoot, {
|
|
915
|
-
...props,
|
|
916
|
-
ref: inputRef,
|
|
917
|
-
disabled,
|
|
918
|
-
onKeyDown: handleKeyDown
|
|
919
|
-
}),
|
|
920
|
-
enterButton || loading ? /* @__PURE__ */ jsx4("button", {
|
|
921
|
-
type: "button",
|
|
922
|
-
className: inputSearchButtonClass,
|
|
923
|
-
disabled: disabled || loading,
|
|
924
|
-
"aria-busy": loading || undefined,
|
|
925
|
-
onClick: emitSearch,
|
|
926
|
-
children: loading ? "Loading" : buttonContent
|
|
927
|
-
}) : null
|
|
928
|
-
]
|
|
929
|
-
});
|
|
930
|
-
});
|
|
931
|
-
Search.displayName = "Input.Search";
|
|
932
|
-
var Password = forwardRef2(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
|
|
933
|
-
const [visible, setVisible] = useState(false);
|
|
934
|
-
const type = visible ? "text" : "password";
|
|
935
|
-
const toggle = visibilityToggle ? /* @__PURE__ */ jsx4("button", {
|
|
936
|
-
type: "button",
|
|
937
|
-
className: inputPasswordToggleClass,
|
|
938
|
-
disabled,
|
|
939
|
-
"aria-label": visible ? "Hide password" : "Show password",
|
|
940
|
-
onClick: () => {
|
|
941
|
-
setVisible((current) => !current);
|
|
942
|
-
},
|
|
943
|
-
children: visible ? "Hide" : "Show"
|
|
944
|
-
}) : undefined;
|
|
945
|
-
return /* @__PURE__ */ jsx4("span", {
|
|
946
|
-
className: getPasswordWrapperClasses({ className }),
|
|
947
|
-
children: /* @__PURE__ */ jsx4(InputRoot, {
|
|
948
|
-
...props,
|
|
949
|
-
ref,
|
|
950
|
-
disabled,
|
|
951
|
-
type,
|
|
952
|
-
suffix: toggle
|
|
953
|
-
})
|
|
954
|
-
});
|
|
955
|
-
});
|
|
956
|
-
Password.displayName = "Input.Password";
|
|
957
|
-
var TextArea = forwardRef2(({
|
|
958
|
-
autoSize,
|
|
959
|
-
className,
|
|
960
|
-
defaultValue,
|
|
961
|
-
maxLength,
|
|
962
|
-
onChange,
|
|
963
|
-
resize = "vertical",
|
|
964
|
-
showCount,
|
|
965
|
-
size = "md",
|
|
966
|
-
status,
|
|
967
|
-
value,
|
|
968
|
-
variant = "outlined",
|
|
969
|
-
...props
|
|
970
|
-
}, ref) => {
|
|
971
|
-
const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
|
|
972
|
-
const isControlled = value !== undefined;
|
|
973
|
-
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
974
|
-
const count = currentValue.length;
|
|
975
|
-
const exceeded = maxLength !== undefined && count > maxLength;
|
|
976
|
-
function handleChange(event) {
|
|
977
|
-
if (!isControlled) {
|
|
978
|
-
setInternalValue(event.currentTarget.value);
|
|
979
|
-
}
|
|
980
|
-
onChange?.(event);
|
|
981
|
-
}
|
|
982
|
-
const control = /* @__PURE__ */ jsx4("textarea", {
|
|
983
|
-
...props,
|
|
984
|
-
ref,
|
|
985
|
-
className: getTextAreaClasses({
|
|
986
|
-
size,
|
|
987
|
-
status,
|
|
988
|
-
variant,
|
|
989
|
-
resize,
|
|
990
|
-
autoSize: Boolean(autoSize),
|
|
991
|
-
className
|
|
992
|
-
}),
|
|
993
|
-
maxLength,
|
|
994
|
-
value: currentValue,
|
|
995
|
-
onChange: handleChange
|
|
996
|
-
});
|
|
997
|
-
if (!showCount) {
|
|
998
|
-
return control;
|
|
999
|
-
}
|
|
1000
|
-
return /* @__PURE__ */ jsxs4("span", {
|
|
1001
|
-
className: textAreaWrapperClass,
|
|
1002
|
-
children: [
|
|
1003
|
-
control,
|
|
1004
|
-
/* @__PURE__ */ jsxs4("span", {
|
|
1005
|
-
className: getTextAreaCountClasses({ exceeded }),
|
|
1006
|
-
children: [
|
|
1007
|
-
count,
|
|
1008
|
-
maxLength !== undefined ? ` / ${maxLength}` : null
|
|
1009
|
-
]
|
|
1010
|
-
})
|
|
1011
|
-
]
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
TextArea.displayName = "Input.TextArea";
|
|
1015
|
-
var Group = forwardRef2(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx4("div", {
|
|
1016
|
-
...props,
|
|
1017
|
-
ref,
|
|
1018
|
-
className: cn(inputGroupClass, className),
|
|
1019
|
-
children
|
|
1020
|
-
}));
|
|
1021
|
-
Group.displayName = "Input.Group";
|
|
1022
|
-
var Input = Object.assign(InputRoot, {
|
|
1023
|
-
Search,
|
|
1024
|
-
Password,
|
|
1025
|
-
TextArea,
|
|
1026
|
-
Group
|
|
1027
|
-
});
|
|
1028
1029
|
// src/components/chat/composer/PlainEditor.tsx
|
|
1029
|
-
import { jsx as
|
|
1030
|
-
var PlainEditor =
|
|
1030
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1031
|
+
var PlainEditor = forwardRef2(({
|
|
1031
1032
|
value,
|
|
1032
1033
|
disabled,
|
|
1033
1034
|
minRows,
|
|
@@ -1047,7 +1048,12 @@ var PlainEditor = forwardRef3(({
|
|
|
1047
1048
|
const composingRef = useRef3(false);
|
|
1048
1049
|
const minimumRows = Math.max(1, Math.floor(minRows));
|
|
1049
1050
|
const maximumRows = Math.max(minimumRows, Math.floor(maxRows));
|
|
1050
|
-
|
|
1051
|
+
const { showCount, ...nativeProps } = textareaProps ?? {};
|
|
1052
|
+
delete nativeProps.size;
|
|
1053
|
+
delete nativeProps.status;
|
|
1054
|
+
delete nativeProps.variant;
|
|
1055
|
+
delete nativeProps.resize;
|
|
1056
|
+
useImperativeHandle(ref, () => ({
|
|
1051
1057
|
focus: () => editorRef.current?.focus(),
|
|
1052
1058
|
select: (start, end) => editorRef.current?.setSelectionRange(start, end),
|
|
1053
1059
|
selection: (currentValue) => ({
|
|
@@ -1056,10 +1062,10 @@ var PlainEditor = forwardRef3(({
|
|
|
1056
1062
|
selectionEnd: editorRef.current?.selectionEnd ?? currentValue.length
|
|
1057
1063
|
})
|
|
1058
1064
|
}), []);
|
|
1059
|
-
|
|
1065
|
+
useLayoutEffect2(() => {
|
|
1060
1066
|
composingRef.current = false;
|
|
1061
1067
|
}, [generation]);
|
|
1062
|
-
|
|
1068
|
+
useLayoutEffect2(() => {
|
|
1063
1069
|
const editor = editorRef.current;
|
|
1064
1070
|
if (!editor)
|
|
1065
1071
|
return;
|
|
@@ -1087,17 +1093,16 @@ var PlainEditor = forwardRef3(({
|
|
|
1087
1093
|
window.removeEventListener("resize", measure);
|
|
1088
1094
|
};
|
|
1089
1095
|
}, [value, minimumRows, maximumRows, textareaProps?.style]);
|
|
1090
|
-
|
|
1091
|
-
...
|
|
1096
|
+
const control = /* @__PURE__ */ jsx4("textarea", {
|
|
1097
|
+
...nativeProps,
|
|
1092
1098
|
ref: editorRef,
|
|
1093
1099
|
className: cn("chat-composer-editor", textareaProps?.className),
|
|
1094
1100
|
value,
|
|
1095
1101
|
disabled,
|
|
1096
1102
|
rows: minimumRows,
|
|
1097
|
-
resize: "none",
|
|
1098
1103
|
"aria-label": textareaProps?.["aria-label"] ?? (textareaProps?.["aria-labelledby"] ? undefined : "Message"),
|
|
1099
1104
|
"aria-describedby": cn(textareaProps?.["aria-describedby"], hasError && `${composerId}-error`) || undefined,
|
|
1100
|
-
"aria-invalid": hasError ? true : textareaProps?.["aria-invalid"],
|
|
1105
|
+
"aria-invalid": hasError || textareaProps?.status === "error" ? true : textareaProps?.["aria-invalid"],
|
|
1101
1106
|
"aria-controls": showCompletion ? `${composerId}-completions` : undefined,
|
|
1102
1107
|
"aria-autocomplete": hasCompletion ? "list" : undefined,
|
|
1103
1108
|
"aria-haspopup": hasCompletion ? "listbox" : undefined,
|
|
@@ -1118,6 +1123,21 @@ var PlainEditor = forwardRef3(({
|
|
|
1118
1123
|
onKeyDown(event);
|
|
1119
1124
|
}
|
|
1120
1125
|
});
|
|
1126
|
+
return showCount ? /* @__PURE__ */ jsxs4("span", {
|
|
1127
|
+
className: textAreaWrapperClass,
|
|
1128
|
+
children: [
|
|
1129
|
+
control,
|
|
1130
|
+
/* @__PURE__ */ jsxs4("span", {
|
|
1131
|
+
className: getTextAreaCountClasses({
|
|
1132
|
+
exceeded: textareaProps?.maxLength !== undefined && value.length > textareaProps.maxLength
|
|
1133
|
+
}),
|
|
1134
|
+
children: [
|
|
1135
|
+
value.length,
|
|
1136
|
+
textareaProps?.maxLength !== undefined ? ` / ${textareaProps.maxLength}` : null
|
|
1137
|
+
]
|
|
1138
|
+
})
|
|
1139
|
+
]
|
|
1140
|
+
}) : control;
|
|
1121
1141
|
});
|
|
1122
1142
|
PlainEditor.displayName = "PlainEditor";
|
|
1123
1143
|
|
|
@@ -1757,8 +1777,8 @@ function createComposerAttachmentController(options) {
|
|
|
1757
1777
|
}
|
|
1758
1778
|
|
|
1759
1779
|
// src/components/chat/ChatComposer.tsx
|
|
1760
|
-
import { jsx as
|
|
1761
|
-
var ChatComposer =
|
|
1780
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1781
|
+
var ChatComposer = forwardRef3(({
|
|
1762
1782
|
value,
|
|
1763
1783
|
onValueChange,
|
|
1764
1784
|
onSubmit,
|
|
@@ -1770,6 +1790,8 @@ var ChatComposer = forwardRef4(({
|
|
|
1770
1790
|
onAttachmentRejected,
|
|
1771
1791
|
multiple = true,
|
|
1772
1792
|
allowAttachmentOnly = false,
|
|
1793
|
+
compact = false,
|
|
1794
|
+
addMenu,
|
|
1773
1795
|
disabled = false,
|
|
1774
1796
|
busy = false,
|
|
1775
1797
|
generating = false,
|
|
@@ -1820,13 +1842,13 @@ var ChatComposer = forwardRef4(({
|
|
|
1820
1842
|
const scopeChanged = scopeRef.current.contextKey !== scope?.contextKey || scopeRef.current.conversationId !== scope?.conversationId;
|
|
1821
1843
|
const generation = generationRef.current + (scopeChanged ? 1 : 0);
|
|
1822
1844
|
const occurrences = reconcileAttachments(scopeChanged ? [] : entriesRef.current, attachments, nextEntryRef.current);
|
|
1823
|
-
|
|
1845
|
+
useLayoutEffect3(() => {
|
|
1824
1846
|
mountedRef.current = true;
|
|
1825
1847
|
return () => {
|
|
1826
1848
|
mountedRef.current = false;
|
|
1827
1849
|
};
|
|
1828
1850
|
}, []);
|
|
1829
|
-
|
|
1851
|
+
useLayoutEffect3(() => {
|
|
1830
1852
|
if (scopeChanged) {
|
|
1831
1853
|
scopeRef.current = {
|
|
1832
1854
|
contextKey: scope?.contextKey,
|
|
@@ -1842,7 +1864,7 @@ var ChatComposer = forwardRef4(({
|
|
|
1842
1864
|
revisionRef.current++;
|
|
1843
1865
|
}
|
|
1844
1866
|
}, [scopeChanged, scope?.contextKey, scope?.conversationId, generation]);
|
|
1845
|
-
|
|
1867
|
+
useLayoutEffect3(() => {
|
|
1846
1868
|
if (observedValueRef.current !== value) {
|
|
1847
1869
|
revisionRef.current++;
|
|
1848
1870
|
observedValueRef.current = value;
|
|
@@ -1870,7 +1892,7 @@ var ChatComposer = forwardRef4(({
|
|
|
1870
1892
|
const candidates = completion?.items ?? [];
|
|
1871
1893
|
const { enabled, active } = legacyCompletion(candidates, activeId);
|
|
1872
1894
|
const showCompletion = !disabled && !dismissed && candidates.length > 0;
|
|
1873
|
-
const visibleError = error ?? submitError ?? (attachmentRejections.length ? /* @__PURE__ */
|
|
1895
|
+
const visibleError = error ?? submitError ?? (attachmentRejections.length ? /* @__PURE__ */ jsx5("ul", {
|
|
1874
1896
|
children: attachmentRejections.map((item, index) => /* @__PURE__ */ jsxs5("li", {
|
|
1875
1897
|
children: [
|
|
1876
1898
|
item.metadata.name,
|
|
@@ -1961,11 +1983,13 @@ var ChatComposer = forwardRef4(({
|
|
|
1961
1983
|
}
|
|
1962
1984
|
}
|
|
1963
1985
|
}
|
|
1964
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ jsx5(ComposerShell, {
|
|
1965
1987
|
...props,
|
|
1966
1988
|
ref,
|
|
1967
1989
|
className,
|
|
1968
1990
|
composerId: id,
|
|
1991
|
+
compact,
|
|
1992
|
+
addMenu,
|
|
1969
1993
|
entries: occurrences.entries,
|
|
1970
1994
|
renderAttachment,
|
|
1971
1995
|
removeAttachment: (entryId) => {
|
|
@@ -1987,6 +2011,7 @@ var ChatComposer = forwardRef4(({
|
|
|
1987
2011
|
active,
|
|
1988
2012
|
showCompletion,
|
|
1989
2013
|
selectCompletion,
|
|
2014
|
+
dismissCompletion: () => setDismissed(true),
|
|
1990
2015
|
visibleError,
|
|
1991
2016
|
hasError,
|
|
1992
2017
|
attachLabel,
|
|
@@ -1995,7 +2020,7 @@ var ChatComposer = forwardRef4(({
|
|
|
1995
2020
|
openAttachments,
|
|
1996
2021
|
submit,
|
|
1997
2022
|
onStop,
|
|
1998
|
-
editor: /* @__PURE__ */
|
|
2023
|
+
editor: /* @__PURE__ */ jsx5(PlainEditor, {
|
|
1999
2024
|
ref: editorRef,
|
|
2000
2025
|
value,
|
|
2001
2026
|
disabled,
|
|
@@ -2047,7 +2072,7 @@ var ChatComposer = forwardRef4(({
|
|
|
2047
2072
|
ChatComposer.displayName = "Chat.Composer";
|
|
2048
2073
|
|
|
2049
2074
|
// src/components/chat/ChatPrimitives.tsx
|
|
2050
|
-
import { forwardRef as
|
|
2075
|
+
import { forwardRef as forwardRef4, useId as useId2 } from "react";
|
|
2051
2076
|
|
|
2052
2077
|
// src/classes/chat.ts
|
|
2053
2078
|
var chatBaseClass = "chat";
|
|
@@ -2124,69 +2149,69 @@ function getChatToolClasses({
|
|
|
2124
2149
|
}
|
|
2125
2150
|
|
|
2126
2151
|
// src/components/chat/ChatPrimitives.tsx
|
|
2127
|
-
import { jsx as
|
|
2128
|
-
var ChatAgent =
|
|
2152
|
+
import { jsx as jsx6, jsxs as jsxs6, Fragment as Fragment4 } from "react/jsx-runtime";
|
|
2153
|
+
var ChatAgent = forwardRef4(({ timeline, className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
2129
2154
|
...props,
|
|
2130
2155
|
ref,
|
|
2131
2156
|
"data-chat-tl": timeline ?? props["data-chat-tl"],
|
|
2132
2157
|
className: getChatClasses({ className: cn("chat-agent", className) })
|
|
2133
2158
|
}));
|
|
2134
2159
|
ChatAgent.displayName = "Chat.Agent";
|
|
2135
|
-
var ChatContent =
|
|
2160
|
+
var ChatContent = forwardRef4(({ streaming, className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
2136
2161
|
...props,
|
|
2137
2162
|
ref,
|
|
2138
2163
|
className: cn("chat-content", streaming && "chat-streaming", className)
|
|
2139
2164
|
}));
|
|
2140
2165
|
ChatContent.displayName = "Chat.Content";
|
|
2141
|
-
var ChatWork =
|
|
2166
|
+
var ChatWork = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("details", {
|
|
2142
2167
|
...props,
|
|
2143
2168
|
ref,
|
|
2144
2169
|
className: cn("chat-work", className)
|
|
2145
2170
|
}));
|
|
2146
2171
|
ChatWork.displayName = "Chat.Work";
|
|
2147
|
-
var ChatWorkSummary =
|
|
2172
|
+
var ChatWorkSummary = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("summary", {
|
|
2148
2173
|
...props,
|
|
2149
2174
|
ref,
|
|
2150
2175
|
className: cn("chat-work-summary", className)
|
|
2151
2176
|
}));
|
|
2152
2177
|
ChatWorkSummary.displayName = "Chat.WorkSummary";
|
|
2153
|
-
var ChatWorkBody =
|
|
2178
|
+
var ChatWorkBody = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
2154
2179
|
...props,
|
|
2155
2180
|
ref,
|
|
2156
2181
|
className: cn("chat-work-body", className)
|
|
2157
2182
|
}));
|
|
2158
2183
|
ChatWorkBody.displayName = "Chat.WorkBody";
|
|
2159
|
-
var ChatInputArea =
|
|
2184
|
+
var ChatInputArea = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
2160
2185
|
...props,
|
|
2161
2186
|
ref,
|
|
2162
2187
|
className: cn("chat-input-area", className)
|
|
2163
2188
|
}));
|
|
2164
2189
|
ChatInputArea.displayName = "Chat.InputArea";
|
|
2165
|
-
var ChatComposerForm =
|
|
2190
|
+
var ChatComposerForm = forwardRef4(({ color, ghost, className, ...props }, ref) => /* @__PURE__ */ jsx6("form", {
|
|
2166
2191
|
...props,
|
|
2167
2192
|
ref,
|
|
2168
2193
|
className: cn("chat-composer", color && `chat-composer-${color}`, ghost && "chat-composer-ghost", className)
|
|
2169
2194
|
}));
|
|
2170
2195
|
ChatComposerForm.displayName = "Chat.ComposerForm";
|
|
2171
|
-
var ChatComposerInput =
|
|
2196
|
+
var ChatComposerInput = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("textarea", {
|
|
2172
2197
|
...props,
|
|
2173
2198
|
ref,
|
|
2174
2199
|
className: cn("chat-composer-input", className)
|
|
2175
2200
|
}));
|
|
2176
2201
|
ChatComposerInput.displayName = "Chat.ComposerInput";
|
|
2177
|
-
var ChatComposerActions =
|
|
2202
|
+
var ChatComposerActions = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
2178
2203
|
...props,
|
|
2179
2204
|
ref,
|
|
2180
2205
|
className: cn("chat-composer-actions", className)
|
|
2181
2206
|
}));
|
|
2182
2207
|
ChatComposerActions.displayName = "Chat.ComposerActions";
|
|
2183
|
-
var ChatComposerHint =
|
|
2208
|
+
var ChatComposerHint = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx6("kbd", {
|
|
2184
2209
|
...props,
|
|
2185
2210
|
ref,
|
|
2186
2211
|
className: cn("chat-composer-hint", className)
|
|
2187
2212
|
}));
|
|
2188
2213
|
ChatComposerHint.displayName = "Chat.ComposerHint";
|
|
2189
|
-
var ChatQueue =
|
|
2214
|
+
var ChatQueue = forwardRef4(({
|
|
2190
2215
|
items,
|
|
2191
2216
|
activeId = items[0]?.id,
|
|
2192
2217
|
pendingIds = [],
|
|
@@ -2211,7 +2236,7 @@ var ChatQueue = forwardRef5(({
|
|
|
2211
2236
|
/* @__PURE__ */ jsxs6("div", {
|
|
2212
2237
|
className: "chat-queue-header sr-only",
|
|
2213
2238
|
children: [
|
|
2214
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsx6("h3", {
|
|
2215
2240
|
className: "chat-queue-title",
|
|
2216
2241
|
id: titleId,
|
|
2217
2242
|
children: label
|
|
@@ -2225,7 +2250,7 @@ var ChatQueue = forwardRef5(({
|
|
|
2225
2250
|
})
|
|
2226
2251
|
]
|
|
2227
2252
|
}),
|
|
2228
|
-
/* @__PURE__ */
|
|
2253
|
+
/* @__PURE__ */ jsx6("ol", {
|
|
2229
2254
|
className: "chat-queue-list",
|
|
2230
2255
|
role: "list",
|
|
2231
2256
|
tabIndex: 0,
|
|
@@ -2236,14 +2261,14 @@ var ChatQueue = forwardRef5(({
|
|
|
2236
2261
|
className: cn("chat-queue-item", item.id === activeId && "chat-queue-item-active"),
|
|
2237
2262
|
"aria-busy": pending || undefined,
|
|
2238
2263
|
children: [
|
|
2239
|
-
/* @__PURE__ */
|
|
2264
|
+
/* @__PURE__ */ jsx6("svg", {
|
|
2240
2265
|
className: "chat-queue-icon",
|
|
2241
2266
|
viewBox: "0 0 24 24",
|
|
2242
2267
|
fill: "none",
|
|
2243
2268
|
stroke: "currentColor",
|
|
2244
2269
|
"aria-hidden": "true",
|
|
2245
2270
|
focusable: "false",
|
|
2246
|
-
children: /* @__PURE__ */
|
|
2271
|
+
children: /* @__PURE__ */ jsx6("path", {
|
|
2247
2272
|
d: "m8 6 4 4-4 4M12 10H5m10-4h4m-4 6h4m-4 6h4"
|
|
2248
2273
|
})
|
|
2249
2274
|
}),
|
|
@@ -2254,57 +2279,58 @@ var ChatQueue = forwardRef5(({
|
|
|
2254
2279
|
index + 1
|
|
2255
2280
|
]
|
|
2256
2281
|
}),
|
|
2257
|
-
item.attachment ? /* @__PURE__ */
|
|
2282
|
+
item.attachment ? /* @__PURE__ */ jsx6("img", {
|
|
2258
2283
|
className: "chat-queue-attachment",
|
|
2259
2284
|
src: item.attachment.src,
|
|
2260
2285
|
alt: item.attachment.alt
|
|
2261
2286
|
}) : null,
|
|
2262
|
-
/* @__PURE__ */
|
|
2287
|
+
/* @__PURE__ */ jsx6("div", {
|
|
2263
2288
|
className: "chat-queue-content",
|
|
2264
2289
|
title: item.text,
|
|
2265
2290
|
children: renderItemContent ? renderItemContent(item, index) : item.text
|
|
2266
2291
|
}),
|
|
2267
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx6("div", {
|
|
2268
2293
|
className: "chat-actions chat-queue-actions",
|
|
2269
|
-
children: renderItemActions ? renderItemActions(item, index, pending) : /* @__PURE__ */ jsxs6(
|
|
2294
|
+
children: renderItemActions ? renderItemActions(item, index, pending) : /* @__PURE__ */ jsxs6(Fragment4, {
|
|
2270
2295
|
children: [
|
|
2271
|
-
/* @__PURE__ */
|
|
2272
|
-
className: "btn btn-ghost btn-sm chat-queue-steer",
|
|
2296
|
+
/* @__PURE__ */ jsx6("button", {
|
|
2297
|
+
className: "btn btn-ghost btn-sm btn-circle btn-icon btn-icon-sm chat-queue-steer",
|
|
2273
2298
|
type: "button",
|
|
2274
2299
|
disabled: pending || steerDisabled,
|
|
2275
2300
|
"aria-label": `Steer waiting message ${index + 1}`,
|
|
2301
|
+
title: `Steer waiting message ${index + 1}`,
|
|
2276
2302
|
onClick: () => onSteer(item.id),
|
|
2277
|
-
children:
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
"Steer"
|
|
2291
|
-
]
|
|
2303
|
+
children: /* @__PURE__ */ jsx6("svg", {
|
|
2304
|
+
width: "16",
|
|
2305
|
+
height: "16",
|
|
2306
|
+
style: { flexShrink: 0 },
|
|
2307
|
+
viewBox: "0 0 24 24",
|
|
2308
|
+
fill: "none",
|
|
2309
|
+
stroke: "currentColor",
|
|
2310
|
+
"aria-hidden": "true",
|
|
2311
|
+
focusable: "false",
|
|
2312
|
+
children: /* @__PURE__ */ jsx6("path", {
|
|
2313
|
+
d: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4"
|
|
2314
|
+
})
|
|
2315
|
+
})
|
|
2292
2316
|
}),
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
className: "btn btn-ghost btn-sm btn-
|
|
2317
|
+
/* @__PURE__ */ jsx6("button", {
|
|
2318
|
+
className: "btn btn-ghost btn-sm btn-circle btn-icon btn-icon-sm chat-queue-remove",
|
|
2295
2319
|
type: "button",
|
|
2296
2320
|
disabled: pending,
|
|
2297
2321
|
"aria-label": `Remove waiting message ${index + 1}`,
|
|
2322
|
+
title: `Remove waiting message ${index + 1}`,
|
|
2298
2323
|
onClick: () => onRemove(item.id),
|
|
2299
|
-
children: /* @__PURE__ */
|
|
2324
|
+
children: /* @__PURE__ */ jsx6("svg", {
|
|
2300
2325
|
width: "16",
|
|
2301
2326
|
height: "16",
|
|
2327
|
+
style: { flexShrink: 0 },
|
|
2302
2328
|
viewBox: "0 0 24 24",
|
|
2303
2329
|
fill: "none",
|
|
2304
2330
|
stroke: "currentColor",
|
|
2305
2331
|
"aria-hidden": "true",
|
|
2306
2332
|
focusable: "false",
|
|
2307
|
-
children: /* @__PURE__ */
|
|
2333
|
+
children: /* @__PURE__ */ jsx6("path", {
|
|
2308
2334
|
d: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7"
|
|
2309
2335
|
})
|
|
2310
2336
|
})
|
|
@@ -2322,20 +2348,20 @@ var ChatQueue = forwardRef5(({
|
|
|
2322
2348
|
ChatQueue.displayName = "Chat.Queue";
|
|
2323
2349
|
|
|
2324
2350
|
// src/components/chat/Chat.tsx
|
|
2325
|
-
import { jsx as
|
|
2326
|
-
var ChatAvatar =
|
|
2351
|
+
import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
2352
|
+
var ChatAvatar = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2327
2353
|
...props,
|
|
2328
2354
|
ref,
|
|
2329
2355
|
className: cn(chatAvatarClass, className)
|
|
2330
2356
|
}));
|
|
2331
2357
|
ChatAvatar.displayName = "Chat.Avatar";
|
|
2332
|
-
var ChatHeader =
|
|
2358
|
+
var ChatHeader = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2333
2359
|
...props,
|
|
2334
2360
|
ref,
|
|
2335
2361
|
className: cn(chatHeaderClass, className)
|
|
2336
2362
|
}));
|
|
2337
2363
|
ChatHeader.displayName = "Chat.Header";
|
|
2338
|
-
var ChatBubble =
|
|
2364
|
+
var ChatBubble = forwardRef5(({
|
|
2339
2365
|
color,
|
|
2340
2366
|
size = "md",
|
|
2341
2367
|
filled,
|
|
@@ -2356,7 +2382,7 @@ var ChatBubble = forwardRef6(({
|
|
|
2356
2382
|
const [internalExpanded, setInternalExpanded] = useState3(defaultExpanded);
|
|
2357
2383
|
const requestedExpanded = expanded ?? internalExpanded;
|
|
2358
2384
|
const isExpanded = overflows && requestedExpanded;
|
|
2359
|
-
|
|
2385
|
+
useLayoutEffect4(() => {
|
|
2360
2386
|
const content = contentRef.current;
|
|
2361
2387
|
if (!collapsible || !content) {
|
|
2362
2388
|
collapseRequestedRef.current = false;
|
|
@@ -2398,16 +2424,16 @@ var ChatBubble = forwardRef6(({
|
|
|
2398
2424
|
mutation?.disconnect();
|
|
2399
2425
|
};
|
|
2400
2426
|
}, [collapsible, children, requestedExpanded, expanded, onExpandedChange]);
|
|
2401
|
-
const body = /* @__PURE__ */ jsxs7(
|
|
2427
|
+
const body = /* @__PURE__ */ jsxs7(Fragment5, {
|
|
2402
2428
|
children: [
|
|
2403
2429
|
children,
|
|
2404
|
-
streaming ? /* @__PURE__ */
|
|
2430
|
+
streaming ? /* @__PURE__ */ jsx7("span", {
|
|
2405
2431
|
className: "chat-bubble-content chat-bubble-streaming",
|
|
2406
2432
|
"aria-hidden": "true"
|
|
2407
2433
|
}) : null
|
|
2408
2434
|
]
|
|
2409
2435
|
});
|
|
2410
|
-
return /* @__PURE__ */
|
|
2436
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
2411
2437
|
...props,
|
|
2412
2438
|
ref,
|
|
2413
2439
|
className: getChatBubbleClasses({
|
|
@@ -2417,16 +2443,16 @@ var ChatBubble = forwardRef6(({
|
|
|
2417
2443
|
streaming,
|
|
2418
2444
|
className: cn(collapsible && "chat-bubble-collapsible", className)
|
|
2419
2445
|
}),
|
|
2420
|
-
children: collapsible ? /* @__PURE__ */ jsxs7(
|
|
2446
|
+
children: collapsible ? /* @__PURE__ */ jsxs7(Fragment5, {
|
|
2421
2447
|
children: [
|
|
2422
|
-
/* @__PURE__ */
|
|
2448
|
+
/* @__PURE__ */ jsx7("div", {
|
|
2423
2449
|
ref: contentRef,
|
|
2424
2450
|
className: "chat-bubble-content",
|
|
2425
2451
|
id: contentId,
|
|
2426
2452
|
tabIndex: -1,
|
|
2427
2453
|
children: body
|
|
2428
2454
|
}),
|
|
2429
|
-
/* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ jsx7("button", {
|
|
2430
2456
|
ref: toggleRef,
|
|
2431
2457
|
type: "button",
|
|
2432
2458
|
className: "btn btn-ghost btn-xs chat-bubble-toggle",
|
|
@@ -2445,55 +2471,55 @@ var ChatBubble = forwardRef6(({
|
|
|
2445
2471
|
});
|
|
2446
2472
|
});
|
|
2447
2473
|
ChatBubble.displayName = "Chat.Bubble";
|
|
2448
|
-
var ChatFooter =
|
|
2474
|
+
var ChatFooter = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2449
2475
|
...props,
|
|
2450
2476
|
ref,
|
|
2451
2477
|
className: cn(chatFooterClass, className)
|
|
2452
2478
|
}));
|
|
2453
2479
|
ChatFooter.displayName = "Chat.Footer";
|
|
2454
|
-
var ChatStatus =
|
|
2480
|
+
var ChatStatus = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2455
2481
|
...props,
|
|
2456
2482
|
ref,
|
|
2457
2483
|
className: cn(chatStatusClass, className)
|
|
2458
2484
|
}));
|
|
2459
2485
|
ChatStatus.displayName = "Chat.Status";
|
|
2460
|
-
var ChatStatusItem =
|
|
2486
|
+
var ChatStatusItem = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
|
|
2461
2487
|
...props,
|
|
2462
2488
|
ref,
|
|
2463
2489
|
className: cn(chatStatusItemClass, className)
|
|
2464
2490
|
}));
|
|
2465
2491
|
ChatStatusItem.displayName = "Chat.StatusItem";
|
|
2466
|
-
var ChatStatusValue =
|
|
2492
|
+
var ChatStatusValue = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
|
|
2467
2493
|
...props,
|
|
2468
2494
|
ref,
|
|
2469
2495
|
className: cn(chatStatusValueClass, className)
|
|
2470
2496
|
}));
|
|
2471
2497
|
ChatStatusValue.displayName = "Chat.StatusValue";
|
|
2472
|
-
var ChatActions =
|
|
2498
|
+
var ChatActions = forwardRef5(({ hover, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2473
2499
|
...props,
|
|
2474
2500
|
ref,
|
|
2475
2501
|
className: cn(chatActionsClass, hover && chatActionsHoverClass, className)
|
|
2476
2502
|
}));
|
|
2477
2503
|
ChatActions.displayName = "Chat.Actions";
|
|
2478
|
-
var ChatScroll =
|
|
2504
|
+
var ChatScroll = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2479
2505
|
...props,
|
|
2480
2506
|
ref,
|
|
2481
2507
|
className: cn(chatScrollClass, className)
|
|
2482
2508
|
}));
|
|
2483
2509
|
ChatScroll.displayName = "Chat.Scroll";
|
|
2484
|
-
var ChatScrollBody =
|
|
2510
|
+
var ChatScrollBody = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2485
2511
|
...props,
|
|
2486
2512
|
ref,
|
|
2487
2513
|
className: cn(chatScrollBodyClass, className)
|
|
2488
2514
|
}));
|
|
2489
2515
|
ChatScrollBody.displayName = "Chat.ScrollBody";
|
|
2490
|
-
var ChatScrollTrack =
|
|
2516
|
+
var ChatScrollTrack = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2491
2517
|
...props,
|
|
2492
2518
|
ref,
|
|
2493
2519
|
className: cn(chatScrollTrackClass, className)
|
|
2494
2520
|
}));
|
|
2495
2521
|
ChatScrollTrack.displayName = "Chat.ScrollTrack";
|
|
2496
|
-
var ChatScrollIndicator =
|
|
2522
|
+
var ChatScrollIndicator = forwardRef5(({ targetId, timeline, type = "button", className, onClick, ...props }, ref) => /* @__PURE__ */ jsx7("button", {
|
|
2497
2523
|
...props,
|
|
2498
2524
|
ref,
|
|
2499
2525
|
type,
|
|
@@ -2515,59 +2541,59 @@ var ChatScrollIndicator = forwardRef6(({ targetId, timeline, type = "button", cl
|
|
|
2515
2541
|
}
|
|
2516
2542
|
}));
|
|
2517
2543
|
ChatScrollIndicator.displayName = "Chat.ScrollIndicator";
|
|
2518
|
-
var ChatReasoning =
|
|
2544
|
+
var ChatReasoning = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("details", {
|
|
2519
2545
|
...props,
|
|
2520
2546
|
ref,
|
|
2521
2547
|
className: cn(chatReasoningClass, className)
|
|
2522
2548
|
}));
|
|
2523
2549
|
ChatReasoning.displayName = "Chat.Reasoning";
|
|
2524
|
-
var ChatTool =
|
|
2550
|
+
var ChatTool = forwardRef5(({ status, className, ...props }, ref) => /* @__PURE__ */ jsx7("details", {
|
|
2525
2551
|
...props,
|
|
2526
2552
|
ref,
|
|
2527
2553
|
className: getChatToolClasses({ status, className })
|
|
2528
2554
|
}));
|
|
2529
2555
|
ChatTool.displayName = "Chat.Tool";
|
|
2530
|
-
var ChatToolHeader =
|
|
2556
|
+
var ChatToolHeader = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("summary", {
|
|
2531
2557
|
...props,
|
|
2532
2558
|
ref,
|
|
2533
2559
|
className: cn(chatToolHeaderClass, className)
|
|
2534
2560
|
}));
|
|
2535
2561
|
ChatToolHeader.displayName = "Chat.ToolHeader";
|
|
2536
|
-
var ChatToolStatus =
|
|
2562
|
+
var ChatToolStatus = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("span", {
|
|
2537
2563
|
...props,
|
|
2538
2564
|
ref,
|
|
2539
2565
|
className: cn(chatToolStatusClass, className)
|
|
2540
2566
|
}));
|
|
2541
2567
|
ChatToolStatus.displayName = "Chat.ToolStatus";
|
|
2542
|
-
var ChatToolCall =
|
|
2568
|
+
var ChatToolCall = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2543
2569
|
...props,
|
|
2544
2570
|
ref,
|
|
2545
2571
|
className: cn(chatToolCallClass, className)
|
|
2546
2572
|
}));
|
|
2547
2573
|
ChatToolCall.displayName = "Chat.ToolCall";
|
|
2548
|
-
var ChatToolResult =
|
|
2574
|
+
var ChatToolResult = forwardRef5(({ className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2549
2575
|
...props,
|
|
2550
2576
|
ref,
|
|
2551
2577
|
className: cn(chatToolResultClass, className)
|
|
2552
2578
|
}));
|
|
2553
2579
|
ChatToolResult.displayName = "Chat.ToolResult";
|
|
2554
|
-
var ChatTyping =
|
|
2580
|
+
var ChatTyping = forwardRef5(({
|
|
2555
2581
|
className,
|
|
2556
2582
|
role = "status",
|
|
2557
2583
|
"aria-label": ariaLabel = "Assistant is typing",
|
|
2558
2584
|
...props
|
|
2559
|
-
}, ref) => /* @__PURE__ */
|
|
2585
|
+
}, ref) => /* @__PURE__ */ jsx7("span", {
|
|
2560
2586
|
...props,
|
|
2561
2587
|
ref,
|
|
2562
2588
|
role,
|
|
2563
2589
|
"aria-label": ariaLabel,
|
|
2564
2590
|
className: cn(chatTypingClass, className),
|
|
2565
|
-
children: /* @__PURE__ */
|
|
2591
|
+
children: /* @__PURE__ */ jsx7("span", {
|
|
2566
2592
|
"aria-hidden": "true"
|
|
2567
2593
|
})
|
|
2568
2594
|
}));
|
|
2569
2595
|
ChatTyping.displayName = "Chat.Typing";
|
|
2570
|
-
var ChatRoot =
|
|
2596
|
+
var ChatRoot = forwardRef5(({ placement = "start", timeline, className, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
2571
2597
|
...props,
|
|
2572
2598
|
ref,
|
|
2573
2599
|
"data-chat-tl": timeline ?? props["data-chat-tl"],
|
|
@@ -2608,15 +2634,15 @@ var Chat = Object.assign(ChatRoot, {
|
|
|
2608
2634
|
Typing: ChatTyping
|
|
2609
2635
|
});
|
|
2610
2636
|
// src/components/chat/ChatSessionComposer.tsx
|
|
2611
|
-
import { forwardRef as
|
|
2637
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
2612
2638
|
|
|
2613
2639
|
// src/components/chat/composer/SemanticComposer.tsx
|
|
2614
2640
|
import {
|
|
2615
|
-
forwardRef as
|
|
2641
|
+
forwardRef as forwardRef7,
|
|
2616
2642
|
useId as useId7,
|
|
2617
2643
|
useCallback as useCallback2,
|
|
2618
|
-
useImperativeHandle as
|
|
2619
|
-
useLayoutEffect as
|
|
2644
|
+
useImperativeHandle as useImperativeHandle3,
|
|
2645
|
+
useLayoutEffect as useLayoutEffect10,
|
|
2620
2646
|
useRef as useRef7,
|
|
2621
2647
|
useState as useState8,
|
|
2622
2648
|
useSyncExternalStore as useSyncExternalStore5
|
|
@@ -2625,14 +2651,14 @@ import {
|
|
|
2625
2651
|
// src/components/chat/composer/useComposerAttachments.ts
|
|
2626
2652
|
import {
|
|
2627
2653
|
useEffect as useEffect2,
|
|
2628
|
-
useLayoutEffect as
|
|
2654
|
+
useLayoutEffect as useLayoutEffect5,
|
|
2629
2655
|
useState as useState4,
|
|
2630
2656
|
useSyncExternalStore
|
|
2631
2657
|
} from "react";
|
|
2632
2658
|
function useComposerAttachments(options) {
|
|
2633
2659
|
const [controller] = useState4(() => createComposerAttachmentController(options));
|
|
2634
2660
|
const snapshot = useSyncExternalStore(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
2635
|
-
|
|
2661
|
+
useLayoutEffect5(() => {
|
|
2636
2662
|
controller.configure(options);
|
|
2637
2663
|
});
|
|
2638
2664
|
useEffect2(() => () => {
|
|
@@ -2642,7 +2668,7 @@ function useComposerAttachments(options) {
|
|
|
2642
2668
|
}
|
|
2643
2669
|
|
|
2644
2670
|
// src/components/chat/composer/useComposerProviders.ts
|
|
2645
|
-
import { useLayoutEffect as
|
|
2671
|
+
import { useLayoutEffect as useLayoutEffect6, useState as useState5, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
2646
2672
|
|
|
2647
2673
|
// src/components/chat/composer/providers.ts
|
|
2648
2674
|
var nextController = 0;
|
|
@@ -3016,18 +3042,18 @@ class ComposerProviderController {
|
|
|
3016
3042
|
function useComposerProviders(context) {
|
|
3017
3043
|
const [controller] = useState5(() => new ComposerProviderController);
|
|
3018
3044
|
const snapshot = useSyncExternalStore2(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
3019
|
-
|
|
3045
|
+
useLayoutEffect6(() => {
|
|
3020
3046
|
controller.activate();
|
|
3021
3047
|
return () => controller.dispose();
|
|
3022
3048
|
}, [controller]);
|
|
3023
|
-
|
|
3049
|
+
useLayoutEffect6(() => {
|
|
3024
3050
|
controller.update(context);
|
|
3025
3051
|
});
|
|
3026
3052
|
return { controller, snapshot };
|
|
3027
3053
|
}
|
|
3028
3054
|
|
|
3029
3055
|
// src/components/chat/composer/useComposerSession.ts
|
|
3030
|
-
import { useId as useId4, useLayoutEffect as
|
|
3056
|
+
import { useId as useId4, useLayoutEffect as useLayoutEffect7, useState as useState6, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
3031
3057
|
|
|
3032
3058
|
// src/components/chat/composer/session.ts
|
|
3033
3059
|
function sameComposerScope(a, b) {
|
|
@@ -3436,11 +3462,11 @@ function useComposerSession(context) {
|
|
|
3436
3462
|
const instanceId = useId4();
|
|
3437
3463
|
const [controller] = useState6(() => createComposerSessionController(context, { instanceId }));
|
|
3438
3464
|
const snapshot = useSyncExternalStore3(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
3439
|
-
|
|
3465
|
+
useLayoutEffect7(() => {
|
|
3440
3466
|
controller.activate();
|
|
3441
3467
|
return () => controller.dispose();
|
|
3442
3468
|
}, [controller]);
|
|
3443
|
-
|
|
3469
|
+
useLayoutEffect7(() => {
|
|
3444
3470
|
controller.update(context);
|
|
3445
3471
|
});
|
|
3446
3472
|
return { controller, snapshot };
|
|
@@ -3448,25 +3474,25 @@ function useComposerSession(context) {
|
|
|
3448
3474
|
|
|
3449
3475
|
// src/components/chat/composer/PlainSemanticEditor.tsx
|
|
3450
3476
|
import {
|
|
3451
|
-
forwardRef as
|
|
3477
|
+
forwardRef as forwardRef6,
|
|
3452
3478
|
useId as useId5,
|
|
3453
|
-
useImperativeHandle as
|
|
3479
|
+
useImperativeHandle as useImperativeHandle2,
|
|
3454
3480
|
useCallback,
|
|
3455
|
-
useLayoutEffect as
|
|
3481
|
+
useLayoutEffect as useLayoutEffect8,
|
|
3456
3482
|
useRef as useRef6
|
|
3457
3483
|
} from "react";
|
|
3458
|
-
import { jsx as
|
|
3484
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3459
3485
|
function isPlainComposerDocument(document2) {
|
|
3460
3486
|
return !document2.command && document2.content.every((node) => node.type === "text");
|
|
3461
3487
|
}
|
|
3462
|
-
var PlainSemanticEditor =
|
|
3488
|
+
var PlainSemanticEditor = forwardRef6((props, ref) => {
|
|
3463
3489
|
const editor = useRef6(null);
|
|
3464
3490
|
const originId = useId5();
|
|
3465
3491
|
const latest = useRef6(props);
|
|
3466
3492
|
const revision = useRef6(props.value.revision);
|
|
3467
3493
|
const pendingCaret = useRef6(undefined);
|
|
3468
3494
|
const text = props.value.document.content.map((node) => node.type === "text" ? node.text : "").join("");
|
|
3469
|
-
|
|
3495
|
+
useLayoutEffect8(() => {
|
|
3470
3496
|
latest.current = props;
|
|
3471
3497
|
revision.current = Math.max(revision.current, props.value.revision);
|
|
3472
3498
|
const caret = pendingCaret.current;
|
|
@@ -3477,7 +3503,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
|
|
|
3477
3503
|
pendingCaret.current = undefined;
|
|
3478
3504
|
}
|
|
3479
3505
|
});
|
|
3480
|
-
|
|
3506
|
+
useLayoutEffect8(() => {
|
|
3481
3507
|
latest.current.onReady?.(true);
|
|
3482
3508
|
return () => latest.current.onReady?.(false);
|
|
3483
3509
|
}, []);
|
|
@@ -3517,7 +3543,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
|
|
|
3517
3543
|
}
|
|
3518
3544
|
return latest.current.value.document.content.length ? null : { nodeIndex: 0, start: 0, end: 0 };
|
|
3519
3545
|
}
|
|
3520
|
-
|
|
3546
|
+
useImperativeHandle2(ref, () => ({
|
|
3521
3547
|
focus: () => editor.current?.focus(),
|
|
3522
3548
|
selection,
|
|
3523
3549
|
insertText: (value) => {
|
|
@@ -3557,7 +3583,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
|
|
|
3557
3583
|
return true;
|
|
3558
3584
|
}
|
|
3559
3585
|
}), [change]);
|
|
3560
|
-
return /* @__PURE__ */
|
|
3586
|
+
return /* @__PURE__ */ jsx8(PlainEditor, {
|
|
3561
3587
|
ref: editor,
|
|
3562
3588
|
value: text,
|
|
3563
3589
|
disabled: !!props.disabled,
|
|
@@ -3595,7 +3621,7 @@ var PlainSemanticEditor = forwardRef7((props, ref) => {
|
|
|
3595
3621
|
PlainSemanticEditor.displayName = "PlainSemanticEditor";
|
|
3596
3622
|
|
|
3597
3623
|
// src/components/chat/composer/PreservedDraft.tsx
|
|
3598
|
-
import { jsx as
|
|
3624
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3599
3625
|
function PreservedDraft({
|
|
3600
3626
|
input,
|
|
3601
3627
|
reason,
|
|
@@ -3621,10 +3647,10 @@ function PreservedDraft({
|
|
|
3621
3647
|
" Your draft is preserved."
|
|
3622
3648
|
]
|
|
3623
3649
|
}),
|
|
3624
|
-
/* @__PURE__ */
|
|
3650
|
+
/* @__PURE__ */ jsx9("pre", {
|
|
3625
3651
|
children: document2.status === "compatible" ? exportComposerText(document2.value) : json ?? "The application retains the original incompatible input."
|
|
3626
3652
|
}),
|
|
3627
|
-
json ? /* @__PURE__ */
|
|
3653
|
+
json ? /* @__PURE__ */ jsx9("a", {
|
|
3628
3654
|
download: "composer-draft.json",
|
|
3629
3655
|
href: `data:application/json;charset=utf-8,${encodeURIComponent(json)}`,
|
|
3630
3656
|
children: "Export preserved draft"
|
|
@@ -3644,7 +3670,7 @@ function PreservedDraft({
|
|
|
3644
3670
|
import { useId as useId6 } from "react";
|
|
3645
3671
|
|
|
3646
3672
|
// src/components/chat/composer/useComposerDraft.ts
|
|
3647
|
-
import { useLayoutEffect as
|
|
3673
|
+
import { useLayoutEffect as useLayoutEffect9, useState as useState7, useSyncExternalStore as useSyncExternalStore4 } from "react";
|
|
3648
3674
|
|
|
3649
3675
|
// src/components/chat/composer/drafts.ts
|
|
3650
3676
|
function error2(cause, code) {
|
|
@@ -4010,18 +4036,18 @@ function createComposerDraftController(context) {
|
|
|
4010
4036
|
function useComposerDraft(context) {
|
|
4011
4037
|
const [controller] = useState7(() => createComposerDraftController(context));
|
|
4012
4038
|
const snapshot = useSyncExternalStore4(controller.subscribe, controller.getSnapshot, controller.getSnapshot);
|
|
4013
|
-
|
|
4039
|
+
useLayoutEffect9(() => {
|
|
4014
4040
|
controller.activate();
|
|
4015
4041
|
return () => controller.dispose();
|
|
4016
4042
|
}, [controller]);
|
|
4017
|
-
|
|
4043
|
+
useLayoutEffect9(() => {
|
|
4018
4044
|
controller.update(context);
|
|
4019
4045
|
});
|
|
4020
4046
|
return { controller, snapshot };
|
|
4021
4047
|
}
|
|
4022
4048
|
|
|
4023
4049
|
// src/components/chat/composer/DraftLifecycle.tsx
|
|
4024
|
-
import { jsx as
|
|
4050
|
+
import { jsx as jsx10, jsxs as jsxs9, Fragment as Fragment6 } from "react/jsx-runtime";
|
|
4025
4051
|
function DraftLifecycle({
|
|
4026
4052
|
adapter,
|
|
4027
4053
|
scope,
|
|
@@ -4030,7 +4056,9 @@ function DraftLifecycle({
|
|
|
4030
4056
|
value,
|
|
4031
4057
|
attachments,
|
|
4032
4058
|
onDocumentChange,
|
|
4033
|
-
disabled
|
|
4059
|
+
disabled,
|
|
4060
|
+
compact = false,
|
|
4061
|
+
children
|
|
4034
4062
|
}) {
|
|
4035
4063
|
const originId = `${useId6()}-draft`;
|
|
4036
4064
|
function restore(draft) {
|
|
@@ -4054,25 +4082,25 @@ function DraftLifecycle({
|
|
|
4054
4082
|
onRestore: restore
|
|
4055
4083
|
});
|
|
4056
4084
|
const blocked = disabled || snapshot.saving || snapshot.status === "idle" || snapshot.status === "loading" || snapshot.restorePending || snapshot.status === "incompatible" && !snapshot.overwriteAllowed || snapshot.status === "error" && snapshot.errorOperation !== "save";
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
"aria-label": "Draft storage",
|
|
4085
|
+
const status = snapshot.status === "loading" ? "Loading stored draft…" : snapshot.saving ? "Saving draft…" : snapshot.lastSavedRevision === value.revision ? "Draft saved by host storage." : snapshot.loaded?.applied ? "Stored draft restored." : "Draft storage is provided by the host.";
|
|
4086
|
+
const feedback = /* @__PURE__ */ jsxs9(Fragment6, {
|
|
4060
4087
|
children: [
|
|
4061
|
-
/* @__PURE__ */
|
|
4088
|
+
/* @__PURE__ */ jsx10("div", {
|
|
4062
4089
|
role: "status",
|
|
4063
|
-
|
|
4090
|
+
className: compact ? "sr-only" : undefined,
|
|
4091
|
+
children: status
|
|
4064
4092
|
}),
|
|
4065
|
-
snapshot.error ? /* @__PURE__ */
|
|
4093
|
+
snapshot.error ? /* @__PURE__ */ jsx10("p", {
|
|
4066
4094
|
role: "alert",
|
|
4067
4095
|
children: snapshot.error.message
|
|
4068
4096
|
}) : null,
|
|
4069
|
-
snapshot.incompatible ? /* @__PURE__ */ jsxs9(
|
|
4097
|
+
snapshot.incompatible ? /* @__PURE__ */ jsxs9(Fragment6, {
|
|
4070
4098
|
children: [
|
|
4071
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsx10(PreservedDraft, {
|
|
4072
4100
|
input: snapshot.incompatible.input,
|
|
4073
4101
|
reason: snapshot.incompatible.reason
|
|
4074
4102
|
}),
|
|
4075
|
-
!snapshot.overwriteAllowed ? /* @__PURE__ */
|
|
4103
|
+
!snapshot.overwriteAllowed ? /* @__PURE__ */ jsx10("button", {
|
|
4076
4104
|
type: "button",
|
|
4077
4105
|
disabled,
|
|
4078
4106
|
onClick: () => {
|
|
@@ -4083,14 +4111,14 @@ function DraftLifecycle({
|
|
|
4083
4111
|
}) : null
|
|
4084
4112
|
]
|
|
4085
4113
|
}) : null,
|
|
4086
|
-
snapshot.loaded && !snapshot.loaded.applied ? /* @__PURE__ */ jsxs9(
|
|
4114
|
+
snapshot.loaded && !snapshot.loaded.applied ? /* @__PURE__ */ jsxs9(Fragment6, {
|
|
4087
4115
|
children: [
|
|
4088
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx10(PreservedDraft, {
|
|
4089
4117
|
input: snapshot.loaded.draft,
|
|
4090
4118
|
reason: "A stored draft arrived after editing. Your current draft is preserved.",
|
|
4091
4119
|
state: "pending"
|
|
4092
4120
|
}),
|
|
4093
|
-
/* @__PURE__ */
|
|
4121
|
+
/* @__PURE__ */ jsx10("button", {
|
|
4094
4122
|
type: "button",
|
|
4095
4123
|
disabled,
|
|
4096
4124
|
onClick: () => {
|
|
@@ -4100,14 +4128,81 @@ function DraftLifecycle({
|
|
|
4100
4128
|
children: "Restore stored draft"
|
|
4101
4129
|
})
|
|
4102
4130
|
]
|
|
4103
|
-
}) : null
|
|
4104
|
-
|
|
4131
|
+
}) : null
|
|
4132
|
+
]
|
|
4133
|
+
});
|
|
4134
|
+
const actions = compact ? /* @__PURE__ */ jsxs9(Fragment6, {
|
|
4135
|
+
children: [
|
|
4136
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
4137
|
+
type: "button",
|
|
4138
|
+
className: "popover-menu-item",
|
|
4139
|
+
title: status,
|
|
4140
|
+
disabled: blocked,
|
|
4141
|
+
onClick: (event) => {
|
|
4142
|
+
controller.save();
|
|
4143
|
+
event.currentTarget.closest("[popover]")?.hidePopover?.();
|
|
4144
|
+
},
|
|
4145
|
+
children: [
|
|
4146
|
+
/* @__PURE__ */ jsx10("svg", {
|
|
4147
|
+
width: "18",
|
|
4148
|
+
height: "18",
|
|
4149
|
+
viewBox: "0 0 24 24",
|
|
4150
|
+
fill: "none",
|
|
4151
|
+
stroke: "currentColor",
|
|
4152
|
+
strokeWidth: "2",
|
|
4153
|
+
strokeLinecap: "round",
|
|
4154
|
+
strokeLinejoin: "round",
|
|
4155
|
+
"aria-hidden": "true",
|
|
4156
|
+
focusable: "false",
|
|
4157
|
+
children: /* @__PURE__ */ jsx10("path", {
|
|
4158
|
+
d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12l4 4v12a2 2 0 0 1-2 2ZM7 3v6h10V3M7 21v-8h10v8"
|
|
4159
|
+
})
|
|
4160
|
+
}),
|
|
4161
|
+
/* @__PURE__ */ jsx10("span", {
|
|
4162
|
+
children: "Save draft"
|
|
4163
|
+
})
|
|
4164
|
+
]
|
|
4165
|
+
}),
|
|
4166
|
+
/* @__PURE__ */ jsxs9("button", {
|
|
4167
|
+
type: "button",
|
|
4168
|
+
className: "popover-menu-item",
|
|
4169
|
+
title: "Reload stored draft",
|
|
4170
|
+
disabled: disabled || snapshot.status === "loading" || snapshot.saving,
|
|
4171
|
+
onClick: (event) => {
|
|
4172
|
+
controller.reload();
|
|
4173
|
+
event.currentTarget.closest("[popover]")?.hidePopover?.();
|
|
4174
|
+
},
|
|
4175
|
+
children: [
|
|
4176
|
+
/* @__PURE__ */ jsx10("svg", {
|
|
4177
|
+
width: "18",
|
|
4178
|
+
height: "18",
|
|
4179
|
+
viewBox: "0 0 24 24",
|
|
4180
|
+
fill: "none",
|
|
4181
|
+
stroke: "currentColor",
|
|
4182
|
+
strokeWidth: "2",
|
|
4183
|
+
strokeLinecap: "round",
|
|
4184
|
+
strokeLinejoin: "round",
|
|
4185
|
+
"aria-hidden": "true",
|
|
4186
|
+
focusable: "false",
|
|
4187
|
+
children: /* @__PURE__ */ jsx10("path", {
|
|
4188
|
+
d: "M3 11a9 9 0 1 1 2.6 7.4M3 4v7h7"
|
|
4189
|
+
})
|
|
4190
|
+
}),
|
|
4191
|
+
/* @__PURE__ */ jsx10("span", {
|
|
4192
|
+
children: "Reload stored draft"
|
|
4193
|
+
})
|
|
4194
|
+
]
|
|
4195
|
+
})
|
|
4196
|
+
]
|
|
4197
|
+
}) : /* @__PURE__ */ jsxs9(Fragment6, {
|
|
4198
|
+
children: [
|
|
4199
|
+
/* @__PURE__ */ jsx10("button", {
|
|
4105
4200
|
type: "button",
|
|
4106
4201
|
disabled: blocked,
|
|
4107
4202
|
onClick: () => void controller.save(),
|
|
4108
4203
|
children: "Save draft"
|
|
4109
4204
|
}),
|
|
4110
|
-
/* @__PURE__ */
|
|
4205
|
+
/* @__PURE__ */ jsx10("button", {
|
|
4111
4206
|
type: "button",
|
|
4112
4207
|
disabled: disabled || snapshot.status === "loading" || snapshot.saving,
|
|
4113
4208
|
onClick: () => void controller.reload(),
|
|
@@ -4115,11 +4210,19 @@ function DraftLifecycle({
|
|
|
4115
4210
|
})
|
|
4116
4211
|
]
|
|
4117
4212
|
});
|
|
4213
|
+
return compact ? children(feedback, actions) : children(/* @__PURE__ */ jsxs9("div", {
|
|
4214
|
+
className: "chat-composer-status",
|
|
4215
|
+
"aria-label": "Draft storage",
|
|
4216
|
+
children: [
|
|
4217
|
+
feedback,
|
|
4218
|
+
actions
|
|
4219
|
+
]
|
|
4220
|
+
}));
|
|
4118
4221
|
}
|
|
4119
4222
|
|
|
4120
4223
|
// src/components/chat/composer/SemanticComposer.tsx
|
|
4121
|
-
import { jsx as
|
|
4122
|
-
var SemanticComposer =
|
|
4224
|
+
import { jsx as jsx11, jsxs as jsxs10, Fragment as Fragment7 } from "react/jsx-runtime";
|
|
4225
|
+
var SemanticComposer = forwardRef7(({
|
|
4123
4226
|
Editor,
|
|
4124
4227
|
structured,
|
|
4125
4228
|
value,
|
|
@@ -4138,6 +4241,8 @@ var SemanticComposer = forwardRef8(({
|
|
|
4138
4241
|
busy = false,
|
|
4139
4242
|
canSubmit = true,
|
|
4140
4243
|
allowAttachmentOnly = false,
|
|
4244
|
+
compact = false,
|
|
4245
|
+
addMenu,
|
|
4141
4246
|
onStop,
|
|
4142
4247
|
label = "Message",
|
|
4143
4248
|
attachLabel = "Attach files",
|
|
@@ -4166,13 +4271,13 @@ var SemanticComposer = forwardRef8(({
|
|
|
4166
4271
|
const changedScope = !sameComposerScope(observed.current.scope, scope) || observed.current.draftKey !== draftKey;
|
|
4167
4272
|
const generation = observed.current.generation + (changedScope ? 1 : 0);
|
|
4168
4273
|
const alive = useRef7(false);
|
|
4169
|
-
|
|
4274
|
+
useLayoutEffect10(() => {
|
|
4170
4275
|
alive.current = true;
|
|
4171
4276
|
return () => {
|
|
4172
4277
|
alive.current = false;
|
|
4173
4278
|
};
|
|
4174
4279
|
}, []);
|
|
4175
|
-
|
|
4280
|
+
useLayoutEffect10(() => {
|
|
4176
4281
|
if (changedScope)
|
|
4177
4282
|
observed.current = { scope: { ...scope }, draftKey, generation };
|
|
4178
4283
|
}, [
|
|
@@ -4257,10 +4362,13 @@ var SemanticComposer = forwardRef8(({
|
|
|
4257
4362
|
const completion = useComposerProviders(providerContext);
|
|
4258
4363
|
const popup = completion.snapshot.status !== "idle";
|
|
4259
4364
|
const candidates = completion.snapshot.items.map((item) => {
|
|
4365
|
+
const provider = providers.find((entry) => entry.providerId === item.providerId);
|
|
4260
4366
|
const reason = item.candidate.disabledReason ?? candidateDisabledReason(item.candidate);
|
|
4261
4367
|
return {
|
|
4262
4368
|
id: item.id,
|
|
4263
4369
|
label: item.candidate.label,
|
|
4370
|
+
icon: provider?.icon,
|
|
4371
|
+
sourceLabel: provider?.sourceLabel,
|
|
4264
4372
|
description: reason ?? item.candidate.description,
|
|
4265
4373
|
disabled: reason !== undefined,
|
|
4266
4374
|
group: item.candidate.group ?? completion.snapshot.groups.find((group) => group.providerId === item.providerId)?.label
|
|
@@ -4270,7 +4378,7 @@ var SemanticComposer = forwardRef8(({
|
|
|
4270
4378
|
const showCompletion = popup && candidates.length > 0;
|
|
4271
4379
|
const visibleError = error ?? localError ?? session.snapshot.error?.message;
|
|
4272
4380
|
const hasError = visibleError !== undefined && visibleError !== null && visibleError !== false;
|
|
4273
|
-
|
|
4381
|
+
useImperativeHandle3(forwardedRef, () => ({
|
|
4274
4382
|
focus: () => editor.current?.focus(),
|
|
4275
4383
|
selection: () => editor.current?.selection() ?? null,
|
|
4276
4384
|
insertReference: (node) => {
|
|
@@ -4326,16 +4434,19 @@ var SemanticComposer = forwardRef8(({
|
|
|
4326
4434
|
}
|
|
4327
4435
|
editor.current?.focus();
|
|
4328
4436
|
}
|
|
4329
|
-
|
|
4437
|
+
const compactImages = compact && attachmentsCurrent && attachments.entries.length > 0 && attachments.entries.every((entry) => entry.state.status === "ready" && entry.metadata.mediaType.startsWith("image/") && !!attachments.controller.previewUrl(entry.entryId));
|
|
4438
|
+
return /* @__PURE__ */ jsx11(ComposerShell, {
|
|
4330
4439
|
...rootProps,
|
|
4331
4440
|
className,
|
|
4332
4441
|
composerId: id,
|
|
4442
|
+
compact,
|
|
4443
|
+
addMenu,
|
|
4333
4444
|
entries: (attachmentsCurrent ? attachments.entries : []).map((entry) => ({
|
|
4334
4445
|
id: entry.entryId,
|
|
4335
4446
|
name: entry.metadata.name,
|
|
4336
4447
|
previewUrl: attachments.controller.previewUrl(entry.entryId),
|
|
4337
4448
|
state: entry.state.status === "preparing" ? "validating" : entry.state.status,
|
|
4338
|
-
status: entry.state.status === "error" ? entry.state.error.message : entry.state.status === "reattach" ? "Select this file again to restore it" : entry.state.status === "ready" ? "Ready" : entry.state.status,
|
|
4449
|
+
status: entry.state.status === "error" ? entry.state.error.message : entry.state.status === "reattach" ? "Select this file again to restore it" : entry.state.status === "ready" ? compactImages ? undefined : "Ready" : entry.state.status,
|
|
4339
4450
|
...entry.state.status === "preparing" || entry.state.status === "uploading" ? {
|
|
4340
4451
|
progress: entry.state.progress,
|
|
4341
4452
|
cancel: () => attachments.controller.cancel(entry.entryId)
|
|
@@ -4385,23 +4496,24 @@ var SemanticComposer = forwardRef8(({
|
|
|
4385
4496
|
active,
|
|
4386
4497
|
showCompletion,
|
|
4387
4498
|
selectCompletion: selectCandidate,
|
|
4499
|
+
dismissCompletion: () => completion.controller.dismiss(),
|
|
4388
4500
|
completionHeader: completion.snapshot.breadcrumbs.length ? /* @__PURE__ */ jsxs10("nav", {
|
|
4389
4501
|
"aria-label": "Suggestion folders",
|
|
4390
4502
|
className: "chat-composer-breadcrumb",
|
|
4391
4503
|
children: [
|
|
4392
|
-
/* @__PURE__ */
|
|
4504
|
+
/* @__PURE__ */ jsx11("button", {
|
|
4393
4505
|
type: "button",
|
|
4394
4506
|
onMouseDown: (event) => event.preventDefault(),
|
|
4395
4507
|
onClick: () => completion.controller.back(0),
|
|
4396
4508
|
children: "All results"
|
|
4397
4509
|
}),
|
|
4398
|
-
completion.snapshot.breadcrumbs.map((crumb, index) => /* @__PURE__ */
|
|
4510
|
+
completion.snapshot.breadcrumbs.map((crumb, index) => /* @__PURE__ */ jsx11("button", {
|
|
4399
4511
|
type: "button",
|
|
4400
4512
|
onMouseDown: (event) => event.preventDefault(),
|
|
4401
4513
|
onClick: () => completion.controller.back(index + 1),
|
|
4402
4514
|
children: crumb.label
|
|
4403
4515
|
}, crumb.refId)),
|
|
4404
|
-
/* @__PURE__ */
|
|
4516
|
+
/* @__PURE__ */ jsx11("span", {
|
|
4405
4517
|
className: "chat-composer-hint",
|
|
4406
4518
|
children: "Alt+Left returns to the parent folder."
|
|
4407
4519
|
})
|
|
@@ -4412,7 +4524,7 @@ var SemanticComposer = forwardRef8(({
|
|
|
4412
4524
|
className: "chat-composer-status",
|
|
4413
4525
|
children: [
|
|
4414
4526
|
completion.snapshot.status === "loading" ? "Loading suggestions…" : completion.snapshot.status === "empty" ? "No suggestions" : completion.snapshot.error?.message ?? "Some suggestions could not be loaded",
|
|
4415
|
-
completion.snapshot.status === "error" ? /* @__PURE__ */
|
|
4527
|
+
completion.snapshot.status === "error" ? /* @__PURE__ */ jsx11("button", {
|
|
4416
4528
|
type: "button",
|
|
4417
4529
|
onClick: () => completion.controller.retry(),
|
|
4418
4530
|
children: "Retry suggestions"
|
|
@@ -4421,18 +4533,8 @@ var SemanticComposer = forwardRef8(({
|
|
|
4421
4533
|
}) : null,
|
|
4422
4534
|
visibleError,
|
|
4423
4535
|
hasError,
|
|
4424
|
-
statusContent: /* @__PURE__ */ jsxs10(
|
|
4536
|
+
statusContent: /* @__PURE__ */ jsxs10(Fragment7, {
|
|
4425
4537
|
children: [
|
|
4426
|
-
draftAdapter && attachmentsCurrent && read.status === "compatible" ? /* @__PURE__ */ jsx12(DraftLifecycle, {
|
|
4427
|
-
adapter: draftAdapter,
|
|
4428
|
-
scope,
|
|
4429
|
-
draftKey,
|
|
4430
|
-
generation,
|
|
4431
|
-
value,
|
|
4432
|
-
attachments: attachments.controller,
|
|
4433
|
-
onDocumentChange,
|
|
4434
|
-
disabled: disabled || runtime.status === "read_only"
|
|
4435
|
-
}, generation) : null,
|
|
4436
4538
|
attachmentsCurrent && attachments.rejections.length ? /* @__PURE__ */ jsxs10("div", {
|
|
4437
4539
|
role: "alert",
|
|
4438
4540
|
className: "chat-composer-status",
|
|
@@ -4445,58 +4547,80 @@ var SemanticComposer = forwardRef8(({
|
|
|
4445
4547
|
item.error.message
|
|
4446
4548
|
]
|
|
4447
4549
|
}, `${index}-${item.metadata.name}`)),
|
|
4448
|
-
/* @__PURE__ */
|
|
4550
|
+
/* @__PURE__ */ jsx11("button", {
|
|
4449
4551
|
type: "button",
|
|
4450
4552
|
onClick: () => attachments.controller.clearRejections(),
|
|
4451
4553
|
children: "Dismiss attachment errors"
|
|
4452
4554
|
})
|
|
4453
4555
|
]
|
|
4454
4556
|
}) : null,
|
|
4455
|
-
recovery.filter((attempt) => sameComposerScope(attempt.snapshot.scope, scope) && (attempt.status === "unknown" || attempt.status === "pending")).map((attempt) => /* @__PURE__ */
|
|
4557
|
+
recovery.filter((attempt) => sameComposerScope(attempt.snapshot.scope, scope) && (attempt.status === "unknown" || attempt.status === "pending")).map((attempt) => compact && attempt.status === "pending" ? /* @__PURE__ */ jsx11("p", {
|
|
4558
|
+
role: "status",
|
|
4559
|
+
className: "sr-only",
|
|
4560
|
+
"data-state": "pending",
|
|
4561
|
+
children: "Awaiting admission"
|
|
4562
|
+
}, attempt.snapshot.clientSubmissionId) : /* @__PURE__ */ jsxs10("details", {
|
|
4456
4563
|
className: "chat-composer-status",
|
|
4457
4564
|
"data-state": attempt.status,
|
|
4458
4565
|
children: [
|
|
4459
|
-
/* @__PURE__ */
|
|
4566
|
+
/* @__PURE__ */ jsx11("summary", {
|
|
4460
4567
|
children: attempt.status === "unknown" ? "Submission outcome unknown — draft retained" : "Awaiting admission"
|
|
4461
4568
|
}),
|
|
4462
|
-
/* @__PURE__ */
|
|
4569
|
+
/* @__PURE__ */ jsx11("p", {
|
|
4463
4570
|
children: attempt.snapshot.clientSubmissionId
|
|
4464
4571
|
}),
|
|
4465
|
-
attempt.receipt?.outcome === "unknown" ? /* @__PURE__ */
|
|
4572
|
+
attempt.receipt?.outcome === "unknown" ? /* @__PURE__ */ jsx11("p", {
|
|
4466
4573
|
children: attempt.receipt.error.message
|
|
4467
4574
|
}) : null,
|
|
4468
|
-
host.reconcile ? /* @__PURE__ */
|
|
4575
|
+
host.reconcile ? /* @__PURE__ */ jsx11("button", {
|
|
4469
4576
|
type: "button",
|
|
4470
4577
|
onClick: () => {
|
|
4471
4578
|
session.controller.reconcile(attempt.snapshot.clientSubmissionId).catch((cause) => setLocalError(String(cause), generation));
|
|
4472
4579
|
},
|
|
4473
4580
|
children: "Check submission status"
|
|
4474
4581
|
}) : null,
|
|
4475
|
-
attempt.status === "unknown" && host.authorizeRetry ? /* @__PURE__ */
|
|
4582
|
+
attempt.status === "unknown" && host.authorizeRetry ? /* @__PURE__ */ jsx11("button", {
|
|
4476
4583
|
type: "button",
|
|
4477
4584
|
onClick: () => {
|
|
4478
4585
|
session.controller.retry(attempt.snapshot.clientSubmissionId).catch((cause) => setLocalError(String(cause), generation));
|
|
4479
4586
|
},
|
|
4480
4587
|
children: "Request authorized retry"
|
|
4481
4588
|
}) : null,
|
|
4482
|
-
/* @__PURE__ */
|
|
4589
|
+
/* @__PURE__ */ jsx11(PreservedDraft, {
|
|
4483
4590
|
input: attempt.snapshot.document,
|
|
4484
4591
|
reason: "Submitted snapshot",
|
|
4485
4592
|
state: attempt.status === "unknown" ? "unknown" : "pending"
|
|
4486
4593
|
})
|
|
4487
4594
|
]
|
|
4488
4595
|
}, attempt.snapshot.clientSubmissionId)),
|
|
4489
|
-
session.snapshot.recoveryFailures?.map((attempt) => /* @__PURE__ */
|
|
4596
|
+
session.snapshot.recoveryFailures?.map((attempt) => /* @__PURE__ */ jsx11(PreservedDraft, {
|
|
4490
4597
|
input: attempt,
|
|
4491
4598
|
reason: "The host could not retain this submission. Export its recovery record before leaving."
|
|
4492
4599
|
}, attempt.snapshot.clientSubmissionId)),
|
|
4493
|
-
session.snapshot.lastReceipt?.outcome === "accepted" ? /* @__PURE__ */
|
|
4600
|
+
session.snapshot.lastReceipt?.outcome === "accepted" ? /* @__PURE__ */ jsx11("div", {
|
|
4494
4601
|
role: "status",
|
|
4495
|
-
className: "chat-composer-status",
|
|
4602
|
+
className: compact ? "sr-only" : "chat-composer-status",
|
|
4496
4603
|
children: session.snapshot.lastReceipt.operation === "command" ? "Command completed" : `Admitted: ${session.snapshot.lastReceipt.delivery} (${session.snapshot.lastReceipt.persistence})`
|
|
4497
4604
|
}) : null
|
|
4498
4605
|
]
|
|
4499
4606
|
}),
|
|
4607
|
+
renderFooter: (renderToolbar) => draftAdapter && attachmentsCurrent && read.status === "compatible" ? /* @__PURE__ */ jsx11(DraftLifecycle, {
|
|
4608
|
+
compact,
|
|
4609
|
+
adapter: draftAdapter,
|
|
4610
|
+
scope,
|
|
4611
|
+
draftKey,
|
|
4612
|
+
generation,
|
|
4613
|
+
value,
|
|
4614
|
+
attachments: attachments.controller,
|
|
4615
|
+
onDocumentChange,
|
|
4616
|
+
disabled: disabled || runtime.status === "read_only",
|
|
4617
|
+
children: (feedback, actions) => /* @__PURE__ */ jsxs10(Fragment7, {
|
|
4618
|
+
children: [
|
|
4619
|
+
feedback,
|
|
4620
|
+
renderToolbar(actions)
|
|
4621
|
+
]
|
|
4622
|
+
})
|
|
4623
|
+
}, `draft-${generation}`) : renderToolbar(),
|
|
4500
4624
|
attachLabel,
|
|
4501
4625
|
sendLabel: action.label,
|
|
4502
4626
|
stopLabel,
|
|
@@ -4506,7 +4630,7 @@ var SemanticComposer = forwardRef8(({
|
|
|
4506
4630
|
},
|
|
4507
4631
|
submit,
|
|
4508
4632
|
onStop,
|
|
4509
|
-
editor: editAvailable ? /* @__PURE__ */
|
|
4633
|
+
editor: editAvailable ? /* @__PURE__ */ jsx11(Editor, {
|
|
4510
4634
|
ref: editor,
|
|
4511
4635
|
value,
|
|
4512
4636
|
instanceGeneration: generation,
|
|
@@ -4559,7 +4683,7 @@ var SemanticComposer = forwardRef8(({
|
|
|
4559
4683
|
submit();
|
|
4560
4684
|
}
|
|
4561
4685
|
}
|
|
4562
|
-
}, generation) : /* @__PURE__ */
|
|
4686
|
+
}, generation) : /* @__PURE__ */ jsx11(PreservedDraft, {
|
|
4563
4687
|
input: value.document,
|
|
4564
4688
|
reason: editorError?.message ?? (read.status === "incompatible" ? read.reason : "This draft requires the optional rich editor.")
|
|
4565
4689
|
}),
|
|
@@ -4569,8 +4693,8 @@ var SemanticComposer = forwardRef8(({
|
|
|
4569
4693
|
SemanticComposer.displayName = "SemanticComposer";
|
|
4570
4694
|
|
|
4571
4695
|
// src/components/chat/ChatSessionComposer.tsx
|
|
4572
|
-
import { jsx as
|
|
4573
|
-
var ChatSessionComposer =
|
|
4696
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
4697
|
+
var ChatSessionComposer = forwardRef8((props, ref) => /* @__PURE__ */ jsx12(SemanticComposer, {
|
|
4574
4698
|
...props,
|
|
4575
4699
|
ref,
|
|
4576
4700
|
Editor: PlainSemanticEditor,
|
|
@@ -4578,14 +4702,40 @@ var ChatSessionComposer = forwardRef9((props, ref) => /* @__PURE__ */ jsx13(Sema
|
|
|
4578
4702
|
}));
|
|
4579
4703
|
ChatSessionComposer.displayName = "ChatSessionComposer";
|
|
4580
4704
|
// src/components/chat/ChatAuthoritativeQueue.tsx
|
|
4581
|
-
import { useId as useId8, useLayoutEffect as
|
|
4582
|
-
import { jsx as
|
|
4705
|
+
import { useId as useId8, useLayoutEffect as useLayoutEffect11, useRef as useRef8, useState as useState9 } from "react";
|
|
4706
|
+
import { jsx as jsx13, jsxs as jsxs11, Fragment as Fragment8 } from "react/jsx-runtime";
|
|
4583
4707
|
function scopeKey(projection) {
|
|
4584
4708
|
return JSON.stringify([
|
|
4585
4709
|
projection.scope.contextKey,
|
|
4586
4710
|
projection.scope.conversationId
|
|
4587
4711
|
]);
|
|
4588
4712
|
}
|
|
4713
|
+
function QueueActionIcon({
|
|
4714
|
+
action
|
|
4715
|
+
}) {
|
|
4716
|
+
const paths = {
|
|
4717
|
+
edit: "m15 4 5 5-11 11H4v-5ZM13 6l5 5",
|
|
4718
|
+
steer: "m15 4 5 5-5 5M20 9h-9a6 6 0 0 0-6 6v4",
|
|
4719
|
+
remove: "M3 6h18M9 6V3h6v3M5 6l1 15h12l1-15M10 10v7m4-7v7",
|
|
4720
|
+
save: "m5 12 4 4L19 6",
|
|
4721
|
+
cancel: "m6 6 12 12M6 18 18 6"
|
|
4722
|
+
};
|
|
4723
|
+
return /* @__PURE__ */ jsx13("svg", {
|
|
4724
|
+
width: "16",
|
|
4725
|
+
height: "16",
|
|
4726
|
+
viewBox: "0 0 24 24",
|
|
4727
|
+
fill: "none",
|
|
4728
|
+
stroke: "currentColor",
|
|
4729
|
+
strokeWidth: "2",
|
|
4730
|
+
strokeLinecap: "round",
|
|
4731
|
+
strokeLinejoin: "round",
|
|
4732
|
+
"aria-hidden": "true",
|
|
4733
|
+
focusable: "false",
|
|
4734
|
+
children: /* @__PURE__ */ jsx13("path", {
|
|
4735
|
+
d: paths[action]
|
|
4736
|
+
})
|
|
4737
|
+
});
|
|
4738
|
+
}
|
|
4589
4739
|
function safeText(item) {
|
|
4590
4740
|
return !item.document.command && !item.attachments.length && item.document.content.every((node) => node.type === "text");
|
|
4591
4741
|
}
|
|
@@ -4596,19 +4746,19 @@ function DocumentEditorSlot({
|
|
|
4596
4746
|
renderEditor,
|
|
4597
4747
|
...editor
|
|
4598
4748
|
}) {
|
|
4599
|
-
return /* @__PURE__ */
|
|
4749
|
+
return /* @__PURE__ */ jsx13(Fragment8, {
|
|
4600
4750
|
children: renderEditor(editor)
|
|
4601
4751
|
});
|
|
4602
4752
|
}
|
|
4603
4753
|
function ChatAuthoritativeQueue(props) {
|
|
4604
|
-
return /* @__PURE__ */
|
|
4754
|
+
return /* @__PURE__ */ jsx13(QueueSession, {
|
|
4605
4755
|
...props
|
|
4606
4756
|
}, scopeKey(props.projection));
|
|
4607
4757
|
}
|
|
4608
4758
|
function QueueSession(props) {
|
|
4609
4759
|
const latest = useRef8(props);
|
|
4610
4760
|
const watermark = useRef8(props.projection.revision);
|
|
4611
|
-
|
|
4761
|
+
useLayoutEffect11(() => {
|
|
4612
4762
|
latest.current = props;
|
|
4613
4763
|
watermark.current = Math.max(watermark.current, props.projection.revision);
|
|
4614
4764
|
});
|
|
@@ -4618,7 +4768,7 @@ function QueueSession(props) {
|
|
|
4618
4768
|
const [pending, setPending] = useState9([]);
|
|
4619
4769
|
const [message, setMessage] = useState9();
|
|
4620
4770
|
const [edit, setEdit] = useState9();
|
|
4621
|
-
|
|
4771
|
+
useLayoutEffect11(() => {
|
|
4622
4772
|
const active = requests.current;
|
|
4623
4773
|
return () => {
|
|
4624
4774
|
for (const controller of active.values())
|
|
@@ -4690,7 +4840,7 @@ function QueueSession(props) {
|
|
|
4690
4840
|
return /* @__PURE__ */ jsxs11("div", {
|
|
4691
4841
|
className: props.className,
|
|
4692
4842
|
children: [
|
|
4693
|
-
/* @__PURE__ */
|
|
4843
|
+
/* @__PURE__ */ jsx13(ChatQueue, {
|
|
4694
4844
|
label: props.label,
|
|
4695
4845
|
items: props.projection.items.map((item) => ({
|
|
4696
4846
|
id: item.id,
|
|
@@ -4702,26 +4852,30 @@ function QueueSession(props) {
|
|
|
4702
4852
|
renderItemActions: (row, index, busy) => {
|
|
4703
4853
|
const item = props.projection.items[index];
|
|
4704
4854
|
const editable = canEdit(item, props);
|
|
4705
|
-
return /* @__PURE__ */ jsxs11(
|
|
4855
|
+
return /* @__PURE__ */ jsxs11(Fragment8, {
|
|
4706
4856
|
children: [
|
|
4707
|
-
editable ? /* @__PURE__ */
|
|
4857
|
+
editable ? /* @__PURE__ */ jsx13("button", {
|
|
4708
4858
|
type: "button",
|
|
4709
|
-
className: "btn btn-ghost btn-sm",
|
|
4859
|
+
className: "btn btn-ghost btn-sm btn-square",
|
|
4710
4860
|
disabled: busy,
|
|
4711
4861
|
"aria-label": `Edit waiting message ${index + 1}`,
|
|
4862
|
+
title: `Edit waiting message ${index + 1}`,
|
|
4712
4863
|
onClick: () => setEdit({
|
|
4713
4864
|
item,
|
|
4714
4865
|
revision: props.projection.revision,
|
|
4715
4866
|
document: snapshotComposerDocument(item.document),
|
|
4716
4867
|
text: safeText(item)
|
|
4717
4868
|
}),
|
|
4718
|
-
children:
|
|
4869
|
+
children: /* @__PURE__ */ jsx13(QueueActionIcon, {
|
|
4870
|
+
action: "edit"
|
|
4871
|
+
})
|
|
4719
4872
|
}) : null,
|
|
4720
|
-
props.capabilities.promote && item.capabilities.promote ? /* @__PURE__ */
|
|
4873
|
+
props.capabilities.promote && item.capabilities.promote ? /* @__PURE__ */ jsx13("button", {
|
|
4721
4874
|
type: "button",
|
|
4722
|
-
className: "btn btn-ghost btn-sm chat-queue-steer",
|
|
4875
|
+
className: "btn btn-ghost btn-sm btn-square chat-queue-steer",
|
|
4723
4876
|
disabled: busy || !props.targetTurnId,
|
|
4724
4877
|
"aria-label": `Steer waiting message ${index + 1}`,
|
|
4878
|
+
title: `Steer waiting message ${index + 1}`,
|
|
4725
4879
|
onClick: () => {
|
|
4726
4880
|
if (props.targetTurnId)
|
|
4727
4881
|
mutate({
|
|
@@ -4729,27 +4883,32 @@ function QueueSession(props) {
|
|
|
4729
4883
|
targetTurnId: props.targetTurnId
|
|
4730
4884
|
}, row.id);
|
|
4731
4885
|
},
|
|
4732
|
-
children:
|
|
4886
|
+
children: /* @__PURE__ */ jsx13(QueueActionIcon, {
|
|
4887
|
+
action: "steer"
|
|
4888
|
+
})
|
|
4733
4889
|
}) : null,
|
|
4734
|
-
props.capabilities.remove && item.capabilities.remove ? /* @__PURE__ */
|
|
4890
|
+
props.capabilities.remove && item.capabilities.remove ? /* @__PURE__ */ jsx13("button", {
|
|
4735
4891
|
type: "button",
|
|
4736
|
-
className: "btn btn-ghost btn-sm chat-queue-remove",
|
|
4892
|
+
className: "btn btn-ghost btn-sm btn-square chat-queue-remove",
|
|
4737
4893
|
disabled: busy,
|
|
4738
4894
|
"aria-label": `Remove waiting message ${index + 1}`,
|
|
4895
|
+
title: `Remove waiting message ${index + 1}`,
|
|
4739
4896
|
onClick: () => void mutate({ operation: "remove" }, row.id),
|
|
4740
|
-
children:
|
|
4897
|
+
children: /* @__PURE__ */ jsx13(QueueActionIcon, {
|
|
4898
|
+
action: "remove"
|
|
4899
|
+
})
|
|
4741
4900
|
}) : null
|
|
4742
4901
|
]
|
|
4743
4902
|
});
|
|
4744
4903
|
}
|
|
4745
4904
|
}),
|
|
4746
|
-
edit ? /* @__PURE__ */
|
|
4905
|
+
edit ? /* @__PURE__ */ jsx13("div", {
|
|
4747
4906
|
className: "chat-composer",
|
|
4748
4907
|
role: "group",
|
|
4749
4908
|
"aria-label": "Edit queued message",
|
|
4750
|
-
children: edit.text ? /* @__PURE__ */ jsxs11(
|
|
4909
|
+
children: edit.text ? /* @__PURE__ */ jsxs11(Fragment8, {
|
|
4751
4910
|
children: [
|
|
4752
|
-
/* @__PURE__ */
|
|
4911
|
+
/* @__PURE__ */ jsx13("textarea", {
|
|
4753
4912
|
className: "chat-composer-input",
|
|
4754
4913
|
"aria-label": "Queued message",
|
|
4755
4914
|
value: exportComposerText(edit.document),
|
|
@@ -4767,24 +4926,32 @@ function QueueSession(props) {
|
|
|
4767
4926
|
/* @__PURE__ */ jsxs11("div", {
|
|
4768
4927
|
className: "chat-composer-actions",
|
|
4769
4928
|
children: [
|
|
4770
|
-
/* @__PURE__ */
|
|
4771
|
-
className: "btn btn-sm",
|
|
4929
|
+
/* @__PURE__ */ jsx13("button", {
|
|
4930
|
+
className: "btn btn-sm btn-square",
|
|
4772
4931
|
type: "button",
|
|
4932
|
+
"aria-label": "Save queued message",
|
|
4933
|
+
title: "Save queued message",
|
|
4773
4934
|
disabled: pending.includes(edit.item.id) || !editAllowed,
|
|
4774
4935
|
onClick: () => void mutate({ operation: "edit", document: edit.document }, edit.item.id, edit.revision),
|
|
4775
|
-
children:
|
|
4936
|
+
children: /* @__PURE__ */ jsx13(QueueActionIcon, {
|
|
4937
|
+
action: "save"
|
|
4938
|
+
})
|
|
4776
4939
|
}),
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
className: "btn btn-ghost btn-sm",
|
|
4940
|
+
/* @__PURE__ */ jsx13("button", {
|
|
4941
|
+
className: "btn btn-ghost btn-sm btn-square",
|
|
4779
4942
|
type: "button",
|
|
4943
|
+
"aria-label": "Cancel",
|
|
4944
|
+
title: "Cancel",
|
|
4780
4945
|
disabled: pending.includes(edit.item.id),
|
|
4781
4946
|
onClick: () => setEdit(undefined),
|
|
4782
|
-
children:
|
|
4947
|
+
children: /* @__PURE__ */ jsx13(QueueActionIcon, {
|
|
4948
|
+
action: "cancel"
|
|
4949
|
+
})
|
|
4783
4950
|
})
|
|
4784
4951
|
]
|
|
4785
4952
|
})
|
|
4786
4953
|
]
|
|
4787
|
-
}) : props.renderDocumentEditor && editAllowed ? /* @__PURE__ */
|
|
4954
|
+
}) : props.renderDocumentEditor && editAllowed ? /* @__PURE__ */ jsx13(DocumentEditorSlot, {
|
|
4788
4955
|
renderEditor: props.renderDocumentEditor,
|
|
4789
4956
|
item: edit.item,
|
|
4790
4957
|
value: edit.document,
|
|
@@ -4795,14 +4962,14 @@ function QueueSession(props) {
|
|
|
4795
4962
|
onSave: () => void mutate({ operation: "edit", document: edit.document }, edit.item.id, edit.revision),
|
|
4796
4963
|
onCancel: () => setEdit(undefined),
|
|
4797
4964
|
pending: pending.includes(edit.item.id)
|
|
4798
|
-
}) : /* @__PURE__ */ jsxs11(
|
|
4965
|
+
}) : /* @__PURE__ */ jsxs11(Fragment8, {
|
|
4799
4966
|
children: [
|
|
4800
|
-
/* @__PURE__ */
|
|
4967
|
+
/* @__PURE__ */ jsx13(PreservedDraft, {
|
|
4801
4968
|
input: edit.document,
|
|
4802
4969
|
reason: "This queued message is no longer editable. Your replacement draft is preserved.",
|
|
4803
4970
|
state: "pending"
|
|
4804
4971
|
}),
|
|
4805
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsx13("button", {
|
|
4806
4973
|
type: "button",
|
|
4807
4974
|
onClick: () => setEdit(undefined),
|
|
4808
4975
|
children: "Discard queued edit"
|
|
@@ -4810,7 +4977,7 @@ function QueueSession(props) {
|
|
|
4810
4977
|
]
|
|
4811
4978
|
})
|
|
4812
4979
|
}) : null,
|
|
4813
|
-
message ? /* @__PURE__ */
|
|
4980
|
+
message ? /* @__PURE__ */ jsx13("p", {
|
|
4814
4981
|
className: message.error ? "chat-composer-error" : "chat-composer-status",
|
|
4815
4982
|
role: message.error ? "alert" : "status",
|
|
4816
4983
|
children: message.text
|
|
@@ -4819,11 +4986,11 @@ function QueueSession(props) {
|
|
|
4819
4986
|
});
|
|
4820
4987
|
}
|
|
4821
4988
|
// src/components/chat/ComposerSettings.tsx
|
|
4822
|
-
import { useId as useId10, useLayoutEffect as
|
|
4989
|
+
import { useId as useId10, useLayoutEffect as useLayoutEffect12, useRef as useRef10, useState as useState11 } from "react";
|
|
4823
4990
|
|
|
4824
4991
|
// src/components/select/Select.tsx
|
|
4825
|
-
import
|
|
4826
|
-
forwardRef as
|
|
4992
|
+
import React13, {
|
|
4993
|
+
forwardRef as forwardRef9,
|
|
4827
4994
|
useCallback as useCallback3,
|
|
4828
4995
|
useEffect as useEffect3,
|
|
4829
4996
|
useId as useId9,
|
|
@@ -4886,7 +5053,7 @@ function getSelectOptionClasses({
|
|
|
4886
5053
|
}
|
|
4887
5054
|
|
|
4888
5055
|
// src/components/select/Select.tsx
|
|
4889
|
-
import { jsx as
|
|
5056
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4890
5057
|
function isGroup(option) {
|
|
4891
5058
|
return "options" in option;
|
|
4892
5059
|
}
|
|
@@ -4911,8 +5078,8 @@ function normalizeMultiValue(value) {
|
|
|
4911
5078
|
}
|
|
4912
5079
|
function optionsFromChildren(children) {
|
|
4913
5080
|
const result = [];
|
|
4914
|
-
|
|
4915
|
-
if (!
|
|
5081
|
+
React13.Children.forEach(children, (child) => {
|
|
5082
|
+
if (!React13.isValidElement(child)) {
|
|
4916
5083
|
return;
|
|
4917
5084
|
}
|
|
4918
5085
|
if (child.type === Option) {
|
|
@@ -4962,19 +5129,19 @@ function filterOptions(options, searchValue, filterOption) {
|
|
|
4962
5129
|
function renderValue(option) {
|
|
4963
5130
|
return option ? optionLabel(option) : null;
|
|
4964
5131
|
}
|
|
4965
|
-
var Option =
|
|
5132
|
+
var Option = forwardRef9(({ children, ...props }, ref) => /* @__PURE__ */ jsx14("div", {
|
|
4966
5133
|
...props,
|
|
4967
5134
|
ref,
|
|
4968
5135
|
children
|
|
4969
5136
|
}));
|
|
4970
5137
|
Option.displayName = "Select.Option";
|
|
4971
|
-
var OptGroup =
|
|
5138
|
+
var OptGroup = forwardRef9(({ children, ...props }, ref) => /* @__PURE__ */ jsx14("div", {
|
|
4972
5139
|
...props,
|
|
4973
5140
|
ref,
|
|
4974
5141
|
children
|
|
4975
5142
|
}));
|
|
4976
5143
|
OptGroup.displayName = "Select.OptGroup";
|
|
4977
|
-
var SelectRoot =
|
|
5144
|
+
var SelectRoot = forwardRef9(({
|
|
4978
5145
|
allowClear,
|
|
4979
5146
|
"aria-describedby": ariaDescribedBy,
|
|
4980
5147
|
"aria-errormessage": ariaErrorMessage,
|
|
@@ -5115,7 +5282,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5115
5282
|
}
|
|
5116
5283
|
function renderOption(option) {
|
|
5117
5284
|
const selected = selectedKeys.has(valueKey(option.value));
|
|
5118
|
-
return /* @__PURE__ */
|
|
5285
|
+
return /* @__PURE__ */ jsx14("button", {
|
|
5119
5286
|
type: "button",
|
|
5120
5287
|
role: "option",
|
|
5121
5288
|
"aria-selected": selected,
|
|
@@ -5138,7 +5305,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5138
5305
|
className: cn(selectGroupClass, option.className),
|
|
5139
5306
|
role: "group",
|
|
5140
5307
|
children: [
|
|
5141
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx14("div", {
|
|
5142
5309
|
className: selectGroupLabelClass,
|
|
5143
5310
|
children: option.label
|
|
5144
5311
|
}),
|
|
@@ -5155,7 +5322,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5155
5322
|
ref.current = node;
|
|
5156
5323
|
}
|
|
5157
5324
|
};
|
|
5158
|
-
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */
|
|
5325
|
+
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx14("span", {
|
|
5159
5326
|
className: selectTagClass,
|
|
5160
5327
|
children: renderValue(option)
|
|
5161
5328
|
}, valueKey(option.value))) : renderValue(selectedOptions[0]);
|
|
@@ -5191,17 +5358,17 @@ var SelectRoot = forwardRef10(({
|
|
|
5191
5358
|
setOpenState(!isOpen);
|
|
5192
5359
|
},
|
|
5193
5360
|
children: [
|
|
5194
|
-
/* @__PURE__ */
|
|
5361
|
+
/* @__PURE__ */ jsx14("span", {
|
|
5195
5362
|
className: selectSelectionClass,
|
|
5196
|
-
children: hasValue ? selection : /* @__PURE__ */
|
|
5363
|
+
children: hasValue ? selection : /* @__PURE__ */ jsx14("span", {
|
|
5197
5364
|
className: selectPlaceholderClass,
|
|
5198
5365
|
children: placeholder
|
|
5199
5366
|
})
|
|
5200
5367
|
}),
|
|
5201
|
-
/* @__PURE__ */
|
|
5368
|
+
/* @__PURE__ */ jsx14("span", {
|
|
5202
5369
|
className: selectIconClass,
|
|
5203
5370
|
"aria-hidden": "true",
|
|
5204
|
-
children: /* @__PURE__ */
|
|
5371
|
+
children: /* @__PURE__ */ jsx14("svg", {
|
|
5205
5372
|
width: "16",
|
|
5206
5373
|
height: "16",
|
|
5207
5374
|
viewBox: "0 0 24 24",
|
|
@@ -5211,19 +5378,19 @@ var SelectRoot = forwardRef10(({
|
|
|
5211
5378
|
strokeLinecap: "round",
|
|
5212
5379
|
strokeLinejoin: "round",
|
|
5213
5380
|
"aria-hidden": "true",
|
|
5214
|
-
children: /* @__PURE__ */
|
|
5381
|
+
children: /* @__PURE__ */ jsx14("path", {
|
|
5215
5382
|
d: "m6 9 6 6 6-6"
|
|
5216
5383
|
})
|
|
5217
5384
|
})
|
|
5218
5385
|
})
|
|
5219
5386
|
]
|
|
5220
5387
|
}),
|
|
5221
|
-
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */
|
|
5388
|
+
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx14("button", {
|
|
5222
5389
|
type: "button",
|
|
5223
5390
|
className: selectClearClass,
|
|
5224
5391
|
"aria-label": "Clear selection",
|
|
5225
5392
|
onClick: clearValue,
|
|
5226
|
-
children: /* @__PURE__ */
|
|
5393
|
+
children: /* @__PURE__ */ jsx14("svg", {
|
|
5227
5394
|
width: "14",
|
|
5228
5395
|
height: "14",
|
|
5229
5396
|
viewBox: "0 0 24 24",
|
|
@@ -5232,7 +5399,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5232
5399
|
strokeWidth: "2",
|
|
5233
5400
|
strokeLinecap: "round",
|
|
5234
5401
|
"aria-hidden": "true",
|
|
5235
|
-
children: /* @__PURE__ */
|
|
5402
|
+
children: /* @__PURE__ */ jsx14("path", {
|
|
5236
5403
|
d: "m6 6 12 12M6 18 18 6"
|
|
5237
5404
|
})
|
|
5238
5405
|
})
|
|
@@ -5254,7 +5421,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5254
5421
|
}
|
|
5255
5422
|
},
|
|
5256
5423
|
children: [
|
|
5257
|
-
searchable ? /* @__PURE__ */
|
|
5424
|
+
searchable ? /* @__PURE__ */ jsx14("input", {
|
|
5258
5425
|
className: selectSearchClass,
|
|
5259
5426
|
value: searchValue,
|
|
5260
5427
|
placeholder: typeof placeholder === "string" ? placeholder : undefined,
|
|
@@ -5266,7 +5433,7 @@ var SelectRoot = forwardRef10(({
|
|
|
5266
5433
|
}
|
|
5267
5434
|
}
|
|
5268
5435
|
}) : null,
|
|
5269
|
-
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */
|
|
5436
|
+
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx14("div", {
|
|
5270
5437
|
className: selectEmptyClass,
|
|
5271
5438
|
children: "No data"
|
|
5272
5439
|
})
|
|
@@ -5281,16 +5448,16 @@ Select.Option = Option;
|
|
|
5281
5448
|
Select.OptGroup = OptGroup;
|
|
5282
5449
|
|
|
5283
5450
|
// src/components/chat/ComposerSettings.tsx
|
|
5284
|
-
import { jsx as
|
|
5451
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5285
5452
|
function ComposerSettings(props) {
|
|
5286
|
-
return /* @__PURE__ */
|
|
5453
|
+
return /* @__PURE__ */ jsx15(SettingsSession, {
|
|
5287
5454
|
...props
|
|
5288
5455
|
}, props.scopeKey);
|
|
5289
5456
|
}
|
|
5290
5457
|
function SettingsSession(props) {
|
|
5291
5458
|
const latest = useRef10(props);
|
|
5292
5459
|
const watermark = useRef10(props.revision);
|
|
5293
|
-
|
|
5460
|
+
useLayoutEffect12(() => {
|
|
5294
5461
|
latest.current = props;
|
|
5295
5462
|
watermark.current = Math.max(watermark.current, props.revision);
|
|
5296
5463
|
});
|
|
@@ -5299,7 +5466,7 @@ function SettingsSession(props) {
|
|
|
5299
5466
|
const instanceId = useId10();
|
|
5300
5467
|
const [pending, setPending] = useState11([]);
|
|
5301
5468
|
const [feedback, setFeedback] = useState11({});
|
|
5302
|
-
|
|
5469
|
+
useLayoutEffect12(() => {
|
|
5303
5470
|
const active = requests.current;
|
|
5304
5471
|
return () => {
|
|
5305
5472
|
for (const controller of active.values())
|
|
@@ -5359,7 +5526,7 @@ function SettingsSession(props) {
|
|
|
5359
5526
|
}
|
|
5360
5527
|
}
|
|
5361
5528
|
}
|
|
5362
|
-
return /* @__PURE__ */
|
|
5529
|
+
return /* @__PURE__ */ jsx15("div", {
|
|
5363
5530
|
className: cn("chat-composer-toolbar", props.className),
|
|
5364
5531
|
role: "group",
|
|
5365
5532
|
"aria-label": props.label ?? "Composer settings",
|
|
@@ -5369,7 +5536,7 @@ function SettingsSession(props) {
|
|
|
5369
5536
|
const description = busy ? "Change pending" : feedback[setting.id] || setting.unavailableReason;
|
|
5370
5537
|
return /* @__PURE__ */ jsxs13("div", {
|
|
5371
5538
|
children: [
|
|
5372
|
-
/* @__PURE__ */
|
|
5539
|
+
/* @__PURE__ */ jsx15(Select, {
|
|
5373
5540
|
"aria-label": setting.label,
|
|
5374
5541
|
"aria-describedby": description ? descriptionId : undefined,
|
|
5375
5542
|
value: setting.value,
|
|
@@ -5385,7 +5552,7 @@ function SettingsSession(props) {
|
|
|
5385
5552
|
request(setting.id, value);
|
|
5386
5553
|
}
|
|
5387
5554
|
}),
|
|
5388
|
-
description ? /* @__PURE__ */
|
|
5555
|
+
description ? /* @__PURE__ */ jsx15("p", {
|
|
5389
5556
|
id: descriptionId,
|
|
5390
5557
|
className: "chat-composer-status",
|
|
5391
5558
|
role: "status",
|