@adecore/agents-react 0.37.2 → 0.37.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat-client.d.ts +1 -0
- package/dist/chat/chat-client.js +2 -1
- package/dist/chat/chat-references.d.ts +16 -1
- package/dist/chat/chat-references.js +29 -3
- package/dist/chat/drafts.d.ts +2 -0
- package/dist/chat/drafts.js +21 -5
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/mentions.d.ts +31 -14
- package/dist/chat/mentions.js +186 -41
- package/dist/chat/stash.d.ts +1 -0
- package/dist/chat/stash.js +4 -2
- package/dist/chat/ui/Composer.js +438 -429
- package/dist/chat/ui/ComposerInput.d.ts +1 -0
- package/dist/chat/ui/ComposerInput.js +2 -0
- package/dist/chat/ui/Markdown.d.ts +3 -1
- package/dist/chat/ui/Markdown.js +194 -120
- package/dist/chat/ui/MessageActions.js +70 -66
- package/dist/chat/ui/ReferenceChip.d.ts +15 -0
- package/dist/chat/ui/ReferenceChip.js +255 -0
- package/dist/chat/ui/Timeline.js +52 -29
- package/dist/chat/ui/TimelineMenu.js +84 -78
- package/dist/chat/ui/chip-clipboard.d.ts +9 -0
- package/dist/chat/ui/chip-clipboard.js +105 -0
- package/dist/chat/ui/chips.d.ts +5 -0
- package/dist/chat/ui/chips.js +15 -1
- package/dist/chat/ui/composer/ComposerMenu.js +140 -79
- package/dist/chat/ui/composer/DraftParts.d.ts +0 -4
- package/dist/chat/ui/composer/DraftParts.js +0 -41
- package/dist/chat/ui/composer/chip-paste.d.ts +15 -0
- package/dist/chat/ui/composer/chip-paste.js +104 -0
- package/dist/chat/ui/composer/chips.d.ts +5 -0
- package/dist/chat/ui/composer/chips.js +59 -9
- package/dist/chat/ui/composer/key-handler.js +9 -0
- package/dist/chat/ui/composer/use-composer-draft.d.ts +0 -1
- package/dist/chat/ui/composer/use-composer-draft.js +2 -10
- package/dist/chat/ui/composer/use-composer-menus.d.ts +12 -2
- package/dist/chat/ui/composer/use-composer-menus.js +192 -149
- package/dist/chat/ui/composer/use-composer-submit.js +17 -12
- package/dist/chat/ui/composer/use-draft-files.d.ts +7 -1
- package/dist/chat/ui/composer/use-draft-files.js +90 -58
- package/dist/chat/ui/composer/use-take-back.js +2 -1
- package/dist/chat/ui/index.d.ts +0 -1
- package/dist/chat/ui/index.js +0 -1
- package/dist/chat/ui/reference-icons.d.ts +3 -0
- package/dist/chat/ui/reference-icons.js +15 -0
- package/dist/chat/ui/reference-lookup.d.ts +7 -0
- package/dist/chat/ui/reference-lookup.js +6 -0
- package/dist/chat/ui/rehype-chips.d.ts +8 -1
- package/dist/chat/ui/rehype-chips.js +35 -11
- package/dist/chat/ui/rows/MessageRows.js +218 -158
- package/dist/chat/ui/thread-references.d.ts +4 -0
- package/dist/chat/ui/thread-references.js +78 -0
- package/dist/host-hooks.d.ts +2 -0
- package/dist/host-hooks.js +7 -0
- package/dist/host.d.ts +3 -0
- package/dist/locales/en/agent-chat.d.ts +20 -3
- package/dist/locales/en/agent-chat.js +24 -7
- package/dist/locales/nl/agent-chat.d.ts +20 -3
- package/dist/locales/nl/agent-chat.js +24 -7
- package/package.json +8 -8
- package/src/chat/chat-client.ts +4 -1
- package/src/chat/chat-references.ts +44 -3
- package/src/chat/drafts.ts +24 -6
- package/src/chat/index.ts +1 -1
- package/src/chat/mentions.ts +202 -36
- package/src/chat/stash.ts +6 -2
- package/src/chat/ui/Composer.tsx +14 -4
- package/src/chat/ui/ComposerInput.tsx +4 -0
- package/src/chat/ui/Markdown.tsx +57 -25
- package/src/chat/ui/MessageActions.tsx +5 -2
- package/src/chat/ui/ReferenceChip.tsx +74 -0
- package/src/chat/ui/Timeline.tsx +24 -2
- package/src/chat/ui/TimelineMenu.tsx +7 -3
- package/src/chat/ui/chip-clipboard.ts +115 -0
- package/src/chat/ui/chips.ts +20 -1
- package/src/chat/ui/composer/ComposerMenu.tsx +53 -37
- package/src/chat/ui/composer/DraftParts.tsx +0 -12
- package/src/chat/ui/composer/chip-paste.ts +122 -0
- package/src/chat/ui/composer/chips.ts +60 -10
- package/src/chat/ui/composer/key-handler.ts +9 -0
- package/src/chat/ui/composer/use-composer-draft.ts +1 -7
- package/src/chat/ui/composer/use-composer-menus.ts +68 -29
- package/src/chat/ui/composer/use-composer-submit.ts +13 -6
- package/src/chat/ui/composer/use-draft-files.ts +39 -5
- package/src/chat/ui/composer/use-take-back.ts +2 -1
- package/src/chat/ui/index.ts +0 -1
- package/src/chat/ui/reference-icons.ts +17 -0
- package/src/chat/ui/reference-lookup.ts +13 -0
- package/src/chat/ui/rehype-chips.ts +38 -13
- package/src/chat/ui/rows/MessageRows.tsx +88 -64
- package/src/chat/ui/thread-references.ts +47 -0
- package/src/host-hooks.ts +9 -0
- package/src/host.ts +6 -1
- package/src/locales/en/agent-chat.ts +24 -7
- package/src/locales/nl/agent-chat.ts +24 -7
- package/dist/chat/ui/ChatReferenceChip.d.ts +0 -4
- package/dist/chat/ui/ChatReferenceChip.js +0 -110
- package/src/chat/ui/ChatReferenceChip.tsx +0 -26
|
@@ -9,14 +9,16 @@ import { markdownOf, messageTextOf } from '../logic/timeline-copy.js';
|
|
|
9
9
|
import { useChatHost } from '../../host.js';
|
|
10
10
|
import { useChatScope } from '../../scope.js';
|
|
11
11
|
import { useChatRow, useChats } from '../../state/chats.js';
|
|
12
|
-
import { ButtonGroup,
|
|
12
|
+
import { ButtonGroup, IconButton, Tooltip } from '@adecore/ui';
|
|
13
13
|
import { formatClock, formatDateTime, useFormatLocale } from '@adecore/ui/format';
|
|
14
|
+
import { copyWithChips, messageClipboardChips } from './chip-clipboard.js';
|
|
15
|
+
import { useReferenceLookup } from './thread-references.js';
|
|
14
16
|
import { TIMESTAMP_FORMAT } from './timestamp-format.js';
|
|
15
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
18
|
const COPIED_MS = 1500;
|
|
17
19
|
/* Hidden actions keep their height, so hovering never forces the virtualizer to remeasure. */
|
|
18
20
|
export function MessageActions(t0) {
|
|
19
|
-
const $ = _c(
|
|
21
|
+
const $ = _c(59);
|
|
20
22
|
const {
|
|
21
23
|
chatId,
|
|
22
24
|
row
|
|
@@ -88,6 +90,7 @@ export function MessageActions(t0) {
|
|
|
88
90
|
}
|
|
89
91
|
const canFork = t5;
|
|
90
92
|
const [copied, setCopied] = useState(false);
|
|
93
|
+
const lookup = useReferenceLookup(chatId);
|
|
91
94
|
let t6;
|
|
92
95
|
let t7;
|
|
93
96
|
if ($[13] !== copied) {
|
|
@@ -108,7 +111,7 @@ export function MessageActions(t0) {
|
|
|
108
111
|
}
|
|
109
112
|
useEffect(t6, t7);
|
|
110
113
|
let t8;
|
|
111
|
-
if ($[16] !== chatId || $[17] !==
|
|
114
|
+
if ($[16] !== chatId || $[17] !== lookup || $[18] !== row || $[19] !== scope) {
|
|
112
115
|
t8 = plain => {
|
|
113
116
|
const item_1 = useChats.getState().byKey[scope.keyOf(chatId)]?.items[row.id];
|
|
114
117
|
const current = item_1?.kind === row.kind ? {
|
|
@@ -117,37 +120,38 @@ export function MessageActions(t0) {
|
|
|
117
120
|
} : row;
|
|
118
121
|
const text = (plain ? null : markdownOf(current)) ?? messageTextOf(current);
|
|
119
122
|
if (text !== null) {
|
|
120
|
-
|
|
123
|
+
copyWithChips(messageClipboardChips(current.item, text, lookup));
|
|
121
124
|
setCopied(true);
|
|
122
125
|
}
|
|
123
126
|
};
|
|
124
127
|
$[16] = chatId;
|
|
125
|
-
$[17] =
|
|
126
|
-
$[18] =
|
|
127
|
-
$[19] =
|
|
128
|
+
$[17] = lookup;
|
|
129
|
+
$[18] = row;
|
|
130
|
+
$[19] = scope;
|
|
131
|
+
$[20] = t8;
|
|
128
132
|
} else {
|
|
129
|
-
t8 = $[
|
|
133
|
+
t8 = $[20];
|
|
130
134
|
}
|
|
131
135
|
const copy = t8;
|
|
132
136
|
let t9;
|
|
133
|
-
if ($[
|
|
137
|
+
if ($[21] !== t) {
|
|
134
138
|
t9 = t("timeline.actions.label");
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
139
|
+
$[21] = t;
|
|
140
|
+
$[22] = t9;
|
|
137
141
|
} else {
|
|
138
|
-
t9 = $[
|
|
142
|
+
t9 = $[22];
|
|
139
143
|
}
|
|
140
144
|
const t10 = row.kind === "user" && "mt-1.5 justify-end";
|
|
141
145
|
let t11;
|
|
142
|
-
if ($[
|
|
146
|
+
if ($[23] !== t10) {
|
|
143
147
|
t11 = clsx("flex h-7 items-center gap-2 opacity-0 transition-opacity group-has-focus-visible/message:opacity-100 group-hover/message:opacity-100", t10);
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
148
|
+
$[23] = t10;
|
|
149
|
+
$[24] = t11;
|
|
146
150
|
} else {
|
|
147
|
-
t11 = $[
|
|
151
|
+
t11 = $[24];
|
|
148
152
|
}
|
|
149
153
|
let t12;
|
|
150
|
-
if ($[
|
|
154
|
+
if ($[25] !== bookmarked || $[26] !== canFork || $[27] !== chatId || $[28] !== copied || $[29] !== copy || $[30] !== fork || $[31] !== hasText || $[32] !== host || $[33] !== row.id || $[34] !== scope || $[35] !== streaming || $[36] !== t || $[37] !== turnId) {
|
|
151
155
|
t12 = !streaming && /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
152
156
|
render: /*#__PURE__*/_jsx("span", {}),
|
|
153
157
|
children: [!bookmarked && /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -167,97 +171,97 @@ export function MessageActions(t0) {
|
|
|
167
171
|
onClick: e => copy(e.shiftKey)
|
|
168
172
|
})]
|
|
169
173
|
});
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
174
|
+
$[25] = bookmarked;
|
|
175
|
+
$[26] = canFork;
|
|
176
|
+
$[27] = chatId;
|
|
177
|
+
$[28] = copied;
|
|
178
|
+
$[29] = copy;
|
|
179
|
+
$[30] = fork;
|
|
180
|
+
$[31] = hasText;
|
|
181
|
+
$[32] = host;
|
|
182
|
+
$[33] = row.id;
|
|
183
|
+
$[34] = scope;
|
|
184
|
+
$[35] = streaming;
|
|
185
|
+
$[36] = t;
|
|
186
|
+
$[37] = turnId;
|
|
187
|
+
$[38] = t12;
|
|
184
188
|
} else {
|
|
185
|
-
t12 = $[
|
|
189
|
+
t12 = $[38];
|
|
186
190
|
}
|
|
187
191
|
let t13;
|
|
188
|
-
if ($[
|
|
192
|
+
if ($[39] !== row.item.createdAt) {
|
|
189
193
|
t13 = formatDateTime(row.item.createdAt, TIMESTAMP_FORMAT);
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
194
|
+
$[39] = row.item.createdAt;
|
|
195
|
+
$[40] = t13;
|
|
192
196
|
} else {
|
|
193
|
-
t13 = $[
|
|
197
|
+
t13 = $[40];
|
|
194
198
|
}
|
|
195
199
|
let t14;
|
|
196
|
-
if ($[
|
|
200
|
+
if ($[41] !== row.item.createdAt) {
|
|
197
201
|
t14 = new Date(row.item.createdAt).toISOString();
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
202
|
+
$[41] = row.item.createdAt;
|
|
203
|
+
$[42] = t14;
|
|
200
204
|
} else {
|
|
201
|
-
t14 = $[
|
|
205
|
+
t14 = $[42];
|
|
202
206
|
}
|
|
203
207
|
const t15 = row.kind === "assistant" && "order-first";
|
|
204
208
|
let t16;
|
|
205
|
-
if ($[
|
|
209
|
+
if ($[43] !== t15) {
|
|
206
210
|
t16 = clsx("shrink-0 text-xs text-text-faint tabular-nums select-none", t15);
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
211
|
+
$[43] = t15;
|
|
212
|
+
$[44] = t16;
|
|
209
213
|
} else {
|
|
210
|
-
t16 = $[
|
|
214
|
+
t16 = $[44];
|
|
211
215
|
}
|
|
212
216
|
let t17;
|
|
213
|
-
if ($[
|
|
217
|
+
if ($[45] !== row.item.createdAt) {
|
|
214
218
|
t17 = formatClock(row.item.createdAt);
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
219
|
+
$[45] = row.item.createdAt;
|
|
220
|
+
$[46] = t17;
|
|
217
221
|
} else {
|
|
218
|
-
t17 = $[
|
|
222
|
+
t17 = $[46];
|
|
219
223
|
}
|
|
220
224
|
let t18;
|
|
221
|
-
if ($[
|
|
225
|
+
if ($[47] !== t14 || $[48] !== t16 || $[49] !== t17) {
|
|
222
226
|
t18 = /*#__PURE__*/_jsx("time", {
|
|
223
227
|
dateTime: t14,
|
|
224
228
|
className: t16,
|
|
225
229
|
children: t17
|
|
226
230
|
});
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
+
$[47] = t14;
|
|
232
|
+
$[48] = t16;
|
|
233
|
+
$[49] = t17;
|
|
234
|
+
$[50] = t18;
|
|
231
235
|
} else {
|
|
232
|
-
t18 = $[
|
|
236
|
+
t18 = $[50];
|
|
233
237
|
}
|
|
234
238
|
let t19;
|
|
235
|
-
if ($[
|
|
239
|
+
if ($[51] !== t13 || $[52] !== t18) {
|
|
236
240
|
t19 = /*#__PURE__*/_jsx(Tooltip, {
|
|
237
241
|
label: t13,
|
|
238
242
|
children: t18
|
|
239
243
|
});
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
244
|
+
$[51] = t13;
|
|
245
|
+
$[52] = t18;
|
|
246
|
+
$[53] = t19;
|
|
243
247
|
} else {
|
|
244
|
-
t19 = $[
|
|
248
|
+
t19 = $[53];
|
|
245
249
|
}
|
|
246
250
|
let t20;
|
|
247
|
-
if ($[
|
|
251
|
+
if ($[54] !== t11 || $[55] !== t12 || $[56] !== t19 || $[57] !== t9) {
|
|
248
252
|
t20 = /*#__PURE__*/_jsxs("div", {
|
|
249
253
|
role: "toolbar",
|
|
250
254
|
"aria-label": t9,
|
|
251
255
|
className: t11,
|
|
252
256
|
children: [t12, t19]
|
|
253
257
|
});
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
258
|
+
$[54] = t11;
|
|
259
|
+
$[55] = t12;
|
|
260
|
+
$[56] = t19;
|
|
261
|
+
$[57] = t9;
|
|
262
|
+
$[58] = t20;
|
|
259
263
|
} else {
|
|
260
|
-
t20 = $[
|
|
264
|
+
t20 = $[58];
|
|
261
265
|
}
|
|
262
266
|
return t20;
|
|
263
267
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
interface TokenChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
3
|
+
kind: 'mention' | 'skill' | 'reference' | 'gone';
|
|
4
|
+
value?: string;
|
|
5
|
+
sigil?: string;
|
|
6
|
+
icon: ReactNode;
|
|
7
|
+
label: string;
|
|
8
|
+
tone: string;
|
|
9
|
+
onOpen?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function TokenChip({ kind, value, sigil, icon, label, tone, onOpen, className, ...rest }: TokenChipProps): import("react").JSX.Element;
|
|
12
|
+
export declare function ReferenceChip({ id }: {
|
|
13
|
+
id: string;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { CircleOff } from 'lucide-react';
|
|
6
|
+
import { Icon } from '@adecore/ui';
|
|
7
|
+
import { REFERENCE_GONE_TONE, REFERENCE_TONE, TOKEN_ICON, TOKEN_IN_MESSAGE } from './chips.js';
|
|
8
|
+
import { REFERENCE_ICONS } from './reference-icons.js';
|
|
9
|
+
import { ReferenceLookupContext } from './reference-lookup.js';
|
|
10
|
+
/*
|
|
11
|
+
* One token in the transcript. One that opens is a span with a button's role rather than a button,
|
|
12
|
+
* since a button is a box with a baseline of its own and would not sit on the line the others sit on.
|
|
13
|
+
*/
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
export function TokenChip(t0) {
|
|
16
|
+
const $ = _c(30);
|
|
17
|
+
let className;
|
|
18
|
+
let icon;
|
|
19
|
+
let kind;
|
|
20
|
+
let label;
|
|
21
|
+
let onOpen;
|
|
22
|
+
let rest;
|
|
23
|
+
let sigil;
|
|
24
|
+
let t1;
|
|
25
|
+
let tone;
|
|
26
|
+
let value;
|
|
27
|
+
if ($[0] !== t0) {
|
|
28
|
+
({
|
|
29
|
+
kind,
|
|
30
|
+
value,
|
|
31
|
+
sigil,
|
|
32
|
+
icon,
|
|
33
|
+
label,
|
|
34
|
+
tone,
|
|
35
|
+
onOpen,
|
|
36
|
+
className,
|
|
37
|
+
...rest
|
|
38
|
+
} = t0);
|
|
39
|
+
t1 = e => {
|
|
40
|
+
if (onOpen !== undefined && (e.key === "Enter" || e.key === " ")) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
onOpen();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
$[0] = t0;
|
|
46
|
+
$[1] = className;
|
|
47
|
+
$[2] = icon;
|
|
48
|
+
$[3] = kind;
|
|
49
|
+
$[4] = label;
|
|
50
|
+
$[5] = onOpen;
|
|
51
|
+
$[6] = rest;
|
|
52
|
+
$[7] = sigil;
|
|
53
|
+
$[8] = t1;
|
|
54
|
+
$[9] = tone;
|
|
55
|
+
$[10] = value;
|
|
56
|
+
} else {
|
|
57
|
+
className = $[1];
|
|
58
|
+
icon = $[2];
|
|
59
|
+
kind = $[3];
|
|
60
|
+
label = $[4];
|
|
61
|
+
onOpen = $[5];
|
|
62
|
+
rest = $[6];
|
|
63
|
+
sigil = $[7];
|
|
64
|
+
t1 = $[8];
|
|
65
|
+
tone = $[9];
|
|
66
|
+
value = $[10];
|
|
67
|
+
}
|
|
68
|
+
const onKeyDown = t1;
|
|
69
|
+
const t2 = onOpen !== undefined && "cursor-pointer focus-visible:outline-2 focus-visible:outline-accent";
|
|
70
|
+
let t3;
|
|
71
|
+
if ($[11] !== className || $[12] !== t2 || $[13] !== tone) {
|
|
72
|
+
t3 = clsx(TOKEN_IN_MESSAGE, tone, t2, className);
|
|
73
|
+
$[11] = className;
|
|
74
|
+
$[12] = t2;
|
|
75
|
+
$[13] = tone;
|
|
76
|
+
$[14] = t3;
|
|
77
|
+
} else {
|
|
78
|
+
t3 = $[14];
|
|
79
|
+
}
|
|
80
|
+
const t4 = kind === "reference" ? label : undefined;
|
|
81
|
+
const t5 = onOpen === undefined ? undefined : "button";
|
|
82
|
+
const t6 = onOpen === undefined ? undefined : 0;
|
|
83
|
+
const t7 = onOpen === undefined ? undefined : onKeyDown;
|
|
84
|
+
let t8;
|
|
85
|
+
if ($[15] !== sigil) {
|
|
86
|
+
t8 = sigil !== undefined && /*#__PURE__*/_jsx("span", {
|
|
87
|
+
className: "sr-only",
|
|
88
|
+
children: sigil
|
|
89
|
+
});
|
|
90
|
+
$[15] = sigil;
|
|
91
|
+
$[16] = t8;
|
|
92
|
+
} else {
|
|
93
|
+
t8 = $[16];
|
|
94
|
+
}
|
|
95
|
+
let t9;
|
|
96
|
+
if ($[17] !== icon || $[18] !== kind || $[19] !== label || $[20] !== onOpen || $[21] !== rest || $[22] !== t3 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6 || $[26] !== t7 || $[27] !== t8 || $[28] !== value) {
|
|
97
|
+
t9 = /*#__PURE__*/_jsxs("span", {
|
|
98
|
+
...rest,
|
|
99
|
+
className: t3,
|
|
100
|
+
"data-chip": kind,
|
|
101
|
+
"data-chip-value": value,
|
|
102
|
+
"data-chip-name": t4,
|
|
103
|
+
role: t5,
|
|
104
|
+
tabIndex: t6,
|
|
105
|
+
onClick: onOpen,
|
|
106
|
+
onKeyDown: t7,
|
|
107
|
+
children: [icon, t8, label]
|
|
108
|
+
});
|
|
109
|
+
$[17] = icon;
|
|
110
|
+
$[18] = kind;
|
|
111
|
+
$[19] = label;
|
|
112
|
+
$[20] = onOpen;
|
|
113
|
+
$[21] = rest;
|
|
114
|
+
$[22] = t3;
|
|
115
|
+
$[23] = t4;
|
|
116
|
+
$[24] = t5;
|
|
117
|
+
$[25] = t6;
|
|
118
|
+
$[26] = t7;
|
|
119
|
+
$[27] = t8;
|
|
120
|
+
$[28] = value;
|
|
121
|
+
$[29] = t9;
|
|
122
|
+
} else {
|
|
123
|
+
t9 = $[29];
|
|
124
|
+
}
|
|
125
|
+
return t9;
|
|
126
|
+
}
|
|
127
|
+
/* A view, node or chat a message points at, under the name it has now; one that went says so. */
|
|
128
|
+
export function ReferenceChip(t0) {
|
|
129
|
+
const $ = _c(26);
|
|
130
|
+
const {
|
|
131
|
+
id
|
|
132
|
+
} = t0;
|
|
133
|
+
const {
|
|
134
|
+
t
|
|
135
|
+
} = useTranslation("agent-chat");
|
|
136
|
+
const {
|
|
137
|
+
items,
|
|
138
|
+
open
|
|
139
|
+
} = useContext(ReferenceLookupContext);
|
|
140
|
+
let t1;
|
|
141
|
+
if ($[0] !== id || $[1] !== items) {
|
|
142
|
+
let t2;
|
|
143
|
+
if ($[3] !== id) {
|
|
144
|
+
t2 = candidate => candidate.id === id;
|
|
145
|
+
$[3] = id;
|
|
146
|
+
$[4] = t2;
|
|
147
|
+
} else {
|
|
148
|
+
t2 = $[4];
|
|
149
|
+
}
|
|
150
|
+
t1 = items.find(t2);
|
|
151
|
+
$[0] = id;
|
|
152
|
+
$[1] = items;
|
|
153
|
+
$[2] = t1;
|
|
154
|
+
} else {
|
|
155
|
+
t1 = $[2];
|
|
156
|
+
}
|
|
157
|
+
const item = t1;
|
|
158
|
+
if (item === undefined) {
|
|
159
|
+
let t2;
|
|
160
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
161
|
+
t2 = /*#__PURE__*/_jsx(Icon, {
|
|
162
|
+
icon: CircleOff,
|
|
163
|
+
size: 14,
|
|
164
|
+
className: TOKEN_ICON
|
|
165
|
+
});
|
|
166
|
+
$[5] = t2;
|
|
167
|
+
} else {
|
|
168
|
+
t2 = $[5];
|
|
169
|
+
}
|
|
170
|
+
let t3;
|
|
171
|
+
if ($[6] !== t) {
|
|
172
|
+
t3 = t("references.gone");
|
|
173
|
+
$[6] = t;
|
|
174
|
+
$[7] = t3;
|
|
175
|
+
} else {
|
|
176
|
+
t3 = $[7];
|
|
177
|
+
}
|
|
178
|
+
let t4;
|
|
179
|
+
if ($[8] !== t3) {
|
|
180
|
+
t4 = /*#__PURE__*/_jsx(TokenChip, {
|
|
181
|
+
kind: "gone",
|
|
182
|
+
icon: t2,
|
|
183
|
+
label: t3,
|
|
184
|
+
tone: REFERENCE_GONE_TONE
|
|
185
|
+
});
|
|
186
|
+
$[8] = t3;
|
|
187
|
+
$[9] = t4;
|
|
188
|
+
} else {
|
|
189
|
+
t4 = $[9];
|
|
190
|
+
}
|
|
191
|
+
return t4;
|
|
192
|
+
}
|
|
193
|
+
const t2 = item.id;
|
|
194
|
+
const t3 = REFERENCE_ICONS[item.kind];
|
|
195
|
+
let t4;
|
|
196
|
+
if ($[10] !== t3) {
|
|
197
|
+
t4 = /*#__PURE__*/_jsx(Icon, {
|
|
198
|
+
icon: t3,
|
|
199
|
+
size: 14,
|
|
200
|
+
className: TOKEN_ICON
|
|
201
|
+
});
|
|
202
|
+
$[10] = t3;
|
|
203
|
+
$[11] = t4;
|
|
204
|
+
} else {
|
|
205
|
+
t4 = $[11];
|
|
206
|
+
}
|
|
207
|
+
let t5;
|
|
208
|
+
if ($[12] !== item.name || $[13] !== t) {
|
|
209
|
+
t5 = item.name || t("references.untitled");
|
|
210
|
+
$[12] = item.name;
|
|
211
|
+
$[13] = t;
|
|
212
|
+
$[14] = t5;
|
|
213
|
+
} else {
|
|
214
|
+
t5 = $[14];
|
|
215
|
+
}
|
|
216
|
+
const t6 = open !== null && "hover:bg-text/12";
|
|
217
|
+
let t7;
|
|
218
|
+
if ($[15] !== t6) {
|
|
219
|
+
t7 = clsx(REFERENCE_TONE, t6);
|
|
220
|
+
$[15] = t6;
|
|
221
|
+
$[16] = t7;
|
|
222
|
+
} else {
|
|
223
|
+
t7 = $[16];
|
|
224
|
+
}
|
|
225
|
+
let t8;
|
|
226
|
+
if ($[17] !== item.id || $[18] !== open) {
|
|
227
|
+
t8 = open === null ? undefined : () => open(item.id);
|
|
228
|
+
$[17] = item.id;
|
|
229
|
+
$[18] = open;
|
|
230
|
+
$[19] = t8;
|
|
231
|
+
} else {
|
|
232
|
+
t8 = $[19];
|
|
233
|
+
}
|
|
234
|
+
let t9;
|
|
235
|
+
if ($[20] !== item.id || $[21] !== t4 || $[22] !== t5 || $[23] !== t7 || $[24] !== t8) {
|
|
236
|
+
t9 = /*#__PURE__*/_jsx(TokenChip, {
|
|
237
|
+
kind: "reference",
|
|
238
|
+
value: t2,
|
|
239
|
+
sigil: "#",
|
|
240
|
+
icon: t4,
|
|
241
|
+
label: t5,
|
|
242
|
+
tone: t7,
|
|
243
|
+
onOpen: t8
|
|
244
|
+
});
|
|
245
|
+
$[20] = item.id;
|
|
246
|
+
$[21] = t4;
|
|
247
|
+
$[22] = t5;
|
|
248
|
+
$[23] = t7;
|
|
249
|
+
$[24] = t8;
|
|
250
|
+
$[25] = t9;
|
|
251
|
+
} else {
|
|
252
|
+
t9 = $[25];
|
|
253
|
+
}
|
|
254
|
+
return t9;
|
|
255
|
+
}
|