@assistant-ui/react 0.15.25 → 0.15.26
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/hooks/useToolCallElapsed.d.ts.map +1 -1
- package/dist/hooks/useToolCallElapsed.js +3 -2
- package/dist/hooks/useToolCallElapsed.js.map +1 -1
- package/dist/index.d.ts +30 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.d.ts.map +1 -1
- package/dist/mcp-apps/McpAppRenderer.js +3 -2
- package/dist/mcp-apps/McpAppRenderer.js.map +1 -1
- package/dist/mcp-apps/app-frame.d.ts.map +1 -1
- package/dist/mcp-apps/app-frame.js +56 -46
- package/dist/mcp-apps/app-frame.js.map +1 -1
- package/dist/mcp-apps/csp.d.ts +4 -0
- package/dist/mcp-apps/csp.d.ts.map +1 -0
- package/dist/mcp-apps/csp.js +93 -0
- package/dist/mcp-apps/csp.js.map +1 -0
- package/dist/mcp-apps/types.d.ts +1 -0
- package/dist/mcp-apps/types.d.ts.map +1 -1
- package/dist/mcp-apps/types.js.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts +1 -0
- package/dist/primitives/assistantModal/AssistantModalRoot.d.ts.map +1 -1
- package/dist/primitives/assistantModal/AssistantModalRoot.js.map +1 -1
- package/dist/primitives/attachment.d.ts +3 -1
- package/dist/primitives/attachment.d.ts.map +1 -1
- package/dist/primitives/attachment.js.map +1 -1
- package/dist/primitives/composer/ComposerCancel.d.ts +5 -1
- package/dist/primitives/composer/ComposerCancel.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerCancel.js +14 -1
- package/dist/primitives/composer/ComposerCancel.js.map +1 -1
- package/dist/primitives/composer/ComposerInput.d.ts +14 -0
- package/dist/primitives/composer/ComposerInput.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerInput.js +4 -3
- package/dist/primitives/composer/ComposerInput.js.map +1 -1
- package/dist/primitives/composer/ComposerRoot.d.ts.map +1 -1
- package/dist/primitives/composer/ComposerRoot.js +24 -19
- package/dist/primitives/composer/ComposerRoot.js.map +1 -1
- package/dist/primitives/composer/composerInputSelector.d.ts +3 -0
- package/dist/primitives/composer/composerInputSelector.d.ts.map +1 -0
- package/dist/primitives/composer/composerInputSelector.js +7 -0
- package/dist/primitives/composer/composerInputSelector.js.map +1 -0
- package/dist/primitives/composer/useComposerCancelWithFocus.d.ts +2 -0
- package/dist/primitives/composer/useComposerCancelWithFocus.d.ts.map +1 -0
- package/dist/primitives/composer/useComposerCancelWithFocus.js +42 -0
- package/dist/primitives/composer/useComposerCancelWithFocus.js.map +1 -0
- package/dist/primitives/composer.d.ts +35 -14
- package/dist/primitives/composer.d.ts.map +1 -1
- package/dist/primitives/composer.js.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts +8 -1
- package/dist/primitives/message/MessagePartsGrouped.d.ts.map +1 -1
- package/dist/primitives/message/MessagePartsGrouped.js +58 -278
- package/dist/primitives/message/MessagePartsGrouped.js.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.d.ts.map +1 -1
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js +5 -2
- package/dist/primitives/selectionToolbar/SelectionToolbarRoot.js.map +1 -1
- package/dist/primitives/thread/ThreadViewport.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadViewport.js +4 -3
- package/dist/primitives/thread/ThreadViewport.js.map +1 -1
- package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js +2 -2
- package/dist/primitives/thread/topAnchor/useTopAnchorReserve.js.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.d.ts.map +1 -1
- package/dist/primitives/thread/useThreadViewportAutoScroll.js +90 -21
- package/dist/primitives/thread/useThreadViewportAutoScroll.js.map +1 -1
- package/dist/sandbox-host/SandboxHost.d.ts.map +1 -1
- package/dist/sandbox-host/SandboxHost.js +3 -2
- package/dist/sandbox-host/SandboxHost.js.map +1 -1
- package/dist/unstable/useComposerInput.d.ts +7 -4
- package/dist/unstable/useComposerInput.d.ts.map +1 -1
- package/dist/unstable/useComposerInput.js +4 -4
- package/dist/unstable/useComposerInput.js.map +1 -1
- package/dist/unstable/useComposerInputHistory.d.ts +3 -2
- package/dist/unstable/useComposerInputHistory.d.ts.map +1 -1
- package/dist/unstable/useComposerInputHistory.js +2 -2
- package/dist/unstable/useComposerInputHistory.js.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.d.ts +3 -2
- package/dist/unstable/useLiveCompletionAdapter.d.ts.map +1 -1
- package/dist/unstable/useLiveCompletionAdapter.js +8 -7
- package/dist/unstable/useLiveCompletionAdapter.js.map +1 -1
- package/dist/unstable/useMentionAdapter.d.ts +12 -3
- package/dist/unstable/useMentionAdapter.d.ts.map +1 -1
- package/dist/unstable/useMentionAdapter.js +2 -2
- package/dist/unstable/useMentionAdapter.js.map +1 -1
- package/dist/unstable/useMessageStallDetection.d.ts +4 -2
- package/dist/unstable/useMessageStallDetection.d.ts.map +1 -1
- package/dist/unstable/useMessageStallDetection.js +2 -2
- package/dist/unstable/useMessageStallDetection.js.map +1 -1
- package/dist/unstable/useSlashCommandAdapter.d.ts +5 -2
- package/dist/unstable/useSlashCommandAdapter.d.ts.map +1 -1
- package/dist/unstable/useSlashCommandAdapter.js +5 -4
- package/dist/unstable/useSlashCommandAdapter.js.map +1 -1
- package/dist/unstable/webmcp/useWebMcpProvider.d.ts +4 -0
- package/dist/unstable/webmcp/useWebMcpProvider.d.ts.map +1 -1
- package/dist/unstable/webmcp/useWebMcpProvider.js +2 -0
- package/dist/unstable/webmcp/useWebMcpProvider.js.map +1 -1
- package/dist/utils/getSelectionMessageId.d.ts.map +1 -1
- package/dist/utils/getSelectionMessageId.js +31 -8
- package/dist/utils/getSelectionMessageId.js.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.d.ts.map +1 -1
- package/dist/utils/hooks/useOnResizeContent.js +2 -22
- package/dist/utils/hooks/useOnResizeContent.js.map +1 -1
- package/dist/utils/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/utils/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/utils/useIsomorphicLayoutEffect.js +6 -0
- package/dist/utils/useIsomorphicLayoutEffect.js.map +1 -0
- package/package.json +10 -10
- package/src/hooks/useToolCallElapsed.test.tsx +4 -2
- package/src/hooks/useToolCallElapsed.ts +3 -2
- package/src/index.ts +19 -2
- package/src/mcp-apps/McpAppRenderer.tsx +3 -9
- package/src/mcp-apps/app-frame.test.tsx +38 -0
- package/src/mcp-apps/app-frame.tsx +5 -8
- package/src/mcp-apps/csp.test.ts +112 -0
- package/src/mcp-apps/csp.ts +124 -0
- package/src/mcp-apps/types.ts +1 -0
- package/src/model-context/frame/AssistantFrame.test.ts +45 -0
- package/src/model-context/frame/SPEC_AssistantFrame.md +1 -0
- package/src/primitives/assistantModal/AssistantModalRoot.tsx +1 -0
- package/src/primitives/attachment.ts +4 -1
- package/src/primitives/composer/ComposerCancel.focus.test.tsx +307 -0
- package/src/primitives/composer/ComposerCancel.ts +8 -1
- package/src/primitives/composer/ComposerInput.tsx +19 -1
- package/src/primitives/composer/ComposerRoot.tsx +6 -5
- package/src/primitives/composer/composerInputSelector.ts +4 -0
- package/src/primitives/composer/useComposerCancelWithFocus.ts +57 -0
- package/src/primitives/composer.ts +56 -21
- package/src/primitives/message/MessagePartsGrouped.test.tsx +106 -2
- package/src/primitives/message/MessagePartsGrouped.tsx +36 -134
- package/src/primitives/selectionToolbar/SelectionToolbarRoot.test.tsx +20 -12
- package/src/primitives/selectionToolbar/SelectionToolbarRoot.tsx +6 -2
- package/src/primitives/thread/ThreadViewport.tsx +3 -3
- package/src/primitives/thread/topAnchor/useTopAnchorReserve.ts +2 -2
- package/src/primitives/thread/useThreadViewportAutoScroll.test.tsx +666 -63
- package/src/primitives/thread/useThreadViewportAutoScroll.ts +201 -73
- package/src/sandbox-host/SandboxHost.tsx +3 -8
- package/src/unstable/useComposerInput.ts +7 -4
- package/src/unstable/useComposerInputHistory.ts +3 -2
- package/src/unstable/useLiveCompletionAdapter.ts +9 -14
- package/src/unstable/useMentionAdapter.ts +12 -3
- package/src/unstable/useMessageStallDetection.ts +4 -2
- package/src/unstable/useSlashCommandAdapter.ts +8 -4
- package/src/unstable/webmcp/useWebMcpProvider.ts +4 -0
- package/src/utils/getSelectionMessageId.test.ts +231 -0
- package/src/utils/getSelectionMessageId.ts +45 -7
- package/src/utils/hooks/useOnResizeContent.ts +2 -29
- package/src/utils/useIsomorphicLayoutEffect.test.tsx +21 -0
- package/src/utils/useIsomorphicLayoutEffect.ts +9 -0
|
@@ -5,8 +5,9 @@ import { MessagePartPrimitiveText } from "../messagePart/MessagePartText.js";
|
|
|
5
5
|
import { MessagePartPrimitiveImage } from "../messagePart/MessagePartImage.js";
|
|
6
6
|
import { MessagePartPrimitiveInProgress } from "../messagePart/MessagePartInProgress.js";
|
|
7
7
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
8
|
+
import { MessagePartComponent } from "@assistant-ui/core/react";
|
|
8
9
|
import { memo } from "@assistant-ui/tap/react-shim";
|
|
9
|
-
import {
|
|
10
|
+
import { useAuiState } from "@assistant-ui/store";
|
|
10
11
|
import { getMessagePartKeys } from "@assistant-ui/core/internal";
|
|
11
12
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
//#region src/primitives/message/MessagePartsGrouped.tsx
|
|
@@ -75,72 +76,6 @@ const useMessagePartsGrouped = (groupingFunction) => {
|
|
|
75
76
|
} else t2 = $[8];
|
|
76
77
|
return t2;
|
|
77
78
|
};
|
|
78
|
-
const ToolUIDisplay = (t0) => {
|
|
79
|
-
const $ = c(9);
|
|
80
|
-
let Fallback;
|
|
81
|
-
let props;
|
|
82
|
-
if ($[0] !== t0) {
|
|
83
|
-
({Fallback, ...props} = t0);
|
|
84
|
-
$[0] = t0;
|
|
85
|
-
$[1] = Fallback;
|
|
86
|
-
$[2] = props;
|
|
87
|
-
} else {
|
|
88
|
-
Fallback = $[1];
|
|
89
|
-
props = $[2];
|
|
90
|
-
}
|
|
91
|
-
let t1;
|
|
92
|
-
if ($[3] !== Fallback || $[4] !== props.toolName) {
|
|
93
|
-
t1 = (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback;
|
|
94
|
-
$[3] = Fallback;
|
|
95
|
-
$[4] = props.toolName;
|
|
96
|
-
$[5] = t1;
|
|
97
|
-
} else t1 = $[5];
|
|
98
|
-
const Render = useAuiState(t1);
|
|
99
|
-
if (!Render) return null;
|
|
100
|
-
let t2;
|
|
101
|
-
if ($[6] !== Render || $[7] !== props) {
|
|
102
|
-
t2 = /* @__PURE__ */ jsx(Render, { ...props });
|
|
103
|
-
$[6] = Render;
|
|
104
|
-
$[7] = props;
|
|
105
|
-
$[8] = t2;
|
|
106
|
-
} else t2 = $[8];
|
|
107
|
-
return t2;
|
|
108
|
-
};
|
|
109
|
-
const DataUIDisplay = (t0) => {
|
|
110
|
-
const $ = c(9);
|
|
111
|
-
let Fallback;
|
|
112
|
-
let props;
|
|
113
|
-
if ($[0] !== t0) {
|
|
114
|
-
({Fallback, ...props} = t0);
|
|
115
|
-
$[0] = t0;
|
|
116
|
-
$[1] = Fallback;
|
|
117
|
-
$[2] = props;
|
|
118
|
-
} else {
|
|
119
|
-
Fallback = $[1];
|
|
120
|
-
props = $[2];
|
|
121
|
-
}
|
|
122
|
-
let t1;
|
|
123
|
-
if ($[3] !== Fallback || $[4] !== props.name) {
|
|
124
|
-
t1 = (s) => {
|
|
125
|
-
const named = s.dataRenderers.renderers[props.name]?.[0];
|
|
126
|
-
if (named) return named;
|
|
127
|
-
return s.dataRenderers.fallbacks[0] ?? Fallback;
|
|
128
|
-
};
|
|
129
|
-
$[3] = Fallback;
|
|
130
|
-
$[4] = props.name;
|
|
131
|
-
$[5] = t1;
|
|
132
|
-
} else t1 = $[5];
|
|
133
|
-
const Render = useAuiState(t1);
|
|
134
|
-
if (!Render) return null;
|
|
135
|
-
let t2;
|
|
136
|
-
if ($[6] !== Render || $[7] !== props) {
|
|
137
|
-
t2 = /* @__PURE__ */ jsx(Render, { ...props });
|
|
138
|
-
$[6] = Render;
|
|
139
|
-
$[7] = props;
|
|
140
|
-
$[8] = t2;
|
|
141
|
-
} else t2 = $[8];
|
|
142
|
-
return t2;
|
|
143
|
-
};
|
|
144
79
|
const defaultComponents = {
|
|
145
80
|
Text: () => /* @__PURE__ */ jsxs("p", {
|
|
146
81
|
style: { whiteSpace: "pre-line" },
|
|
@@ -156,187 +91,7 @@ const defaultComponents = {
|
|
|
156
91
|
Unstable_Audio: () => null,
|
|
157
92
|
Group: ({ children }) => children
|
|
158
93
|
};
|
|
159
|
-
const
|
|
160
|
-
const $ = c(50);
|
|
161
|
-
const { components: t1 } = t0;
|
|
162
|
-
let t2;
|
|
163
|
-
if ($[0] !== t1) {
|
|
164
|
-
t2 = t1 === void 0 ? {} : t1;
|
|
165
|
-
$[0] = t1;
|
|
166
|
-
$[1] = t2;
|
|
167
|
-
} else t2 = $[1];
|
|
168
|
-
const { Text: t3, Reasoning: t4, Image: t5, Source: t6, File: t7, Unstable_Audio: t8, tools: t9, data } = t2;
|
|
169
|
-
const Text = t3 === void 0 ? defaultComponents.Text : t3;
|
|
170
|
-
const Reasoning = t4 === void 0 ? defaultComponents.Reasoning : t4;
|
|
171
|
-
const Image = t5 === void 0 ? defaultComponents.Image : t5;
|
|
172
|
-
const Source = t6 === void 0 ? defaultComponents.Source : t6;
|
|
173
|
-
const File = t7 === void 0 ? defaultComponents.File : t7;
|
|
174
|
-
const Audio = t8 === void 0 ? defaultComponents.Unstable_Audio : t8;
|
|
175
|
-
let t10;
|
|
176
|
-
if ($[2] !== t9) {
|
|
177
|
-
t10 = t9 === void 0 ? {} : t9;
|
|
178
|
-
$[2] = t9;
|
|
179
|
-
$[3] = t10;
|
|
180
|
-
} else t10 = $[3];
|
|
181
|
-
const tools = t10;
|
|
182
|
-
const aui = useAui();
|
|
183
|
-
const part = useAuiState(_temp2);
|
|
184
|
-
const type = part.type;
|
|
185
|
-
if (type === "tool-call") {
|
|
186
|
-
const addResult = aui.part.addToolResult;
|
|
187
|
-
const resume = aui.part.resumeToolCall;
|
|
188
|
-
const respondToApproval = aui.part.respondToToolApproval;
|
|
189
|
-
const unstable_recordInteraction = aui.part.unstable_recordInteraction;
|
|
190
|
-
if ("Override" in tools) {
|
|
191
|
-
let t11;
|
|
192
|
-
if ($[4] !== unstable_recordInteraction) {
|
|
193
|
-
t11 = unstable_recordInteraction && { unstable_recordInteraction };
|
|
194
|
-
$[4] = unstable_recordInteraction;
|
|
195
|
-
$[5] = t11;
|
|
196
|
-
} else t11 = $[5];
|
|
197
|
-
let t12;
|
|
198
|
-
if ($[6] !== addResult || $[7] !== part || $[8] !== respondToApproval || $[9] !== resume || $[10] !== t11 || $[11] !== tools.Override) {
|
|
199
|
-
t12 = /* @__PURE__ */ jsx(tools.Override, {
|
|
200
|
-
...part,
|
|
201
|
-
addResult,
|
|
202
|
-
resume,
|
|
203
|
-
respondToApproval,
|
|
204
|
-
...t11
|
|
205
|
-
});
|
|
206
|
-
$[6] = addResult;
|
|
207
|
-
$[7] = part;
|
|
208
|
-
$[8] = respondToApproval;
|
|
209
|
-
$[9] = resume;
|
|
210
|
-
$[10] = t11;
|
|
211
|
-
$[11] = tools.Override;
|
|
212
|
-
$[12] = t12;
|
|
213
|
-
} else t12 = $[12];
|
|
214
|
-
return t12;
|
|
215
|
-
}
|
|
216
|
-
let t11;
|
|
217
|
-
if ($[13] !== part.toolName || $[14] !== tools.Fallback || $[15] !== tools.by_name) {
|
|
218
|
-
t11 = (tools.by_name && Object.hasOwn(tools.by_name, part.toolName) ? tools.by_name[part.toolName] : void 0) ?? tools.Fallback;
|
|
219
|
-
$[13] = part.toolName;
|
|
220
|
-
$[14] = tools.Fallback;
|
|
221
|
-
$[15] = tools.by_name;
|
|
222
|
-
$[16] = t11;
|
|
223
|
-
} else t11 = $[16];
|
|
224
|
-
const Tool = t11;
|
|
225
|
-
let t12;
|
|
226
|
-
if ($[17] !== unstable_recordInteraction) {
|
|
227
|
-
t12 = unstable_recordInteraction && { unstable_recordInteraction };
|
|
228
|
-
$[17] = unstable_recordInteraction;
|
|
229
|
-
$[18] = t12;
|
|
230
|
-
} else t12 = $[18];
|
|
231
|
-
let t13;
|
|
232
|
-
if ($[19] !== Tool || $[20] !== addResult || $[21] !== part || $[22] !== respondToApproval || $[23] !== resume || $[24] !== t12) {
|
|
233
|
-
t13 = /* @__PURE__ */ jsx(ToolUIDisplay, {
|
|
234
|
-
...part,
|
|
235
|
-
Fallback: Tool,
|
|
236
|
-
addResult,
|
|
237
|
-
resume,
|
|
238
|
-
respondToApproval,
|
|
239
|
-
...t12
|
|
240
|
-
});
|
|
241
|
-
$[19] = Tool;
|
|
242
|
-
$[20] = addResult;
|
|
243
|
-
$[21] = part;
|
|
244
|
-
$[22] = respondToApproval;
|
|
245
|
-
$[23] = resume;
|
|
246
|
-
$[24] = t12;
|
|
247
|
-
$[25] = t13;
|
|
248
|
-
} else t13 = $[25];
|
|
249
|
-
return t13;
|
|
250
|
-
}
|
|
251
|
-
if (part.status?.type === "requires-action") throw new Error("Encountered unexpected requires-action status");
|
|
252
|
-
switch (type) {
|
|
253
|
-
case "text": {
|
|
254
|
-
let t11;
|
|
255
|
-
if ($[26] !== Text || $[27] !== part) {
|
|
256
|
-
t11 = /* @__PURE__ */ jsx(Text, { ...part });
|
|
257
|
-
$[26] = Text;
|
|
258
|
-
$[27] = part;
|
|
259
|
-
$[28] = t11;
|
|
260
|
-
} else t11 = $[28];
|
|
261
|
-
return t11;
|
|
262
|
-
}
|
|
263
|
-
case "reasoning": {
|
|
264
|
-
let t11;
|
|
265
|
-
if ($[29] !== Reasoning || $[30] !== part) {
|
|
266
|
-
t11 = /* @__PURE__ */ jsx(Reasoning, { ...part });
|
|
267
|
-
$[29] = Reasoning;
|
|
268
|
-
$[30] = part;
|
|
269
|
-
$[31] = t11;
|
|
270
|
-
} else t11 = $[31];
|
|
271
|
-
return t11;
|
|
272
|
-
}
|
|
273
|
-
case "source": {
|
|
274
|
-
let t11;
|
|
275
|
-
if ($[32] !== Source || $[33] !== part) {
|
|
276
|
-
t11 = /* @__PURE__ */ jsx(Source, { ...part });
|
|
277
|
-
$[32] = Source;
|
|
278
|
-
$[33] = part;
|
|
279
|
-
$[34] = t11;
|
|
280
|
-
} else t11 = $[34];
|
|
281
|
-
return t11;
|
|
282
|
-
}
|
|
283
|
-
case "image": {
|
|
284
|
-
let t11;
|
|
285
|
-
if ($[35] !== Image || $[36] !== part) {
|
|
286
|
-
t11 = /* @__PURE__ */ jsx(Image, { ...part });
|
|
287
|
-
$[35] = Image;
|
|
288
|
-
$[36] = part;
|
|
289
|
-
$[37] = t11;
|
|
290
|
-
} else t11 = $[37];
|
|
291
|
-
return t11;
|
|
292
|
-
}
|
|
293
|
-
case "file": {
|
|
294
|
-
let t11;
|
|
295
|
-
if ($[38] !== File || $[39] !== part) {
|
|
296
|
-
t11 = /* @__PURE__ */ jsx(File, { ...part });
|
|
297
|
-
$[38] = File;
|
|
298
|
-
$[39] = part;
|
|
299
|
-
$[40] = t11;
|
|
300
|
-
} else t11 = $[40];
|
|
301
|
-
return t11;
|
|
302
|
-
}
|
|
303
|
-
case "audio": {
|
|
304
|
-
let t11;
|
|
305
|
-
if ($[41] !== Audio || $[42] !== part) {
|
|
306
|
-
t11 = /* @__PURE__ */ jsx(Audio, { ...part });
|
|
307
|
-
$[41] = Audio;
|
|
308
|
-
$[42] = part;
|
|
309
|
-
$[43] = t11;
|
|
310
|
-
} else t11 = $[43];
|
|
311
|
-
return t11;
|
|
312
|
-
}
|
|
313
|
-
case "data": {
|
|
314
|
-
let t11;
|
|
315
|
-
if ($[44] !== data || $[45] !== part.name) {
|
|
316
|
-
t11 = (data?.by_name && Object.hasOwn(data.by_name, part.name) ? data.by_name[part.name] : void 0) ?? data?.Fallback;
|
|
317
|
-
$[44] = data;
|
|
318
|
-
$[45] = part.name;
|
|
319
|
-
$[46] = t11;
|
|
320
|
-
} else t11 = $[46];
|
|
321
|
-
const Data = t11;
|
|
322
|
-
let t12;
|
|
323
|
-
if ($[47] !== Data || $[48] !== part) {
|
|
324
|
-
t12 = /* @__PURE__ */ jsx(DataUIDisplay, {
|
|
325
|
-
...part,
|
|
326
|
-
Fallback: Data
|
|
327
|
-
});
|
|
328
|
-
$[47] = Data;
|
|
329
|
-
$[48] = part;
|
|
330
|
-
$[49] = t12;
|
|
331
|
-
} else t12 = $[49];
|
|
332
|
-
return t12;
|
|
333
|
-
}
|
|
334
|
-
default:
|
|
335
|
-
console.warn(`Unknown message part type: ${type}`);
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
const MessagePartImpl = (t0) => {
|
|
94
|
+
const MessagePart = memo((t0) => {
|
|
340
95
|
const $ = c(5);
|
|
341
96
|
const { partIndex, components } = t0;
|
|
342
97
|
let t1;
|
|
@@ -356,8 +111,7 @@ const MessagePartImpl = (t0) => {
|
|
|
356
111
|
$[4] = t2;
|
|
357
112
|
} else t2 = $[4];
|
|
358
113
|
return t2;
|
|
359
|
-
};
|
|
360
|
-
const MessagePart = memo(MessagePartImpl, (prev, next) => prev.partIndex === next.partIndex && prev.components?.Text === next.components?.Text && prev.components?.Reasoning === next.components?.Reasoning && prev.components?.Source === next.components?.Source && prev.components?.Image === next.components?.Image && prev.components?.File === next.components?.File && prev.components?.Unstable_Audio === next.components?.Unstable_Audio && prev.components?.tools === next.components?.tools && prev.components?.data === next.components?.data && prev.components?.Group === next.components?.Group);
|
|
114
|
+
}, (prev, next) => prev.partIndex === next.partIndex && prev.components?.Text === next.components?.Text && prev.components?.Reasoning === next.components?.Reasoning && prev.components?.Source === next.components?.Source && prev.components?.Image === next.components?.Image && prev.components?.File === next.components?.File && prev.components?.Unstable_Audio === next.components?.Unstable_Audio && prev.components?.tools === next.components?.tools && prev.components?.data === next.components?.data);
|
|
361
115
|
const EmptyPartFallback = (t0) => {
|
|
362
116
|
const $ = c(6);
|
|
363
117
|
const { status, component: Component } = t0;
|
|
@@ -390,7 +144,7 @@ const COMPLETE_STATUS = Object.freeze({ type: "complete" });
|
|
|
390
144
|
const EmptyPartsImpl = (t0) => {
|
|
391
145
|
const $ = c(6);
|
|
392
146
|
const { components } = t0;
|
|
393
|
-
const status = useAuiState(
|
|
147
|
+
const status = useAuiState(_temp2);
|
|
394
148
|
if (components?.Empty) {
|
|
395
149
|
let t1;
|
|
396
150
|
if ($[0] !== components.Empty || $[1] !== status) {
|
|
@@ -449,9 +203,9 @@ const EmptyParts = memo(EmptyPartsImpl, (prev, next) => prev.components?.Empty =
|
|
|
449
203
|
* ```
|
|
450
204
|
*/
|
|
451
205
|
const MessagePrimitiveUnstable_PartsGrouped = (t0) => {
|
|
452
|
-
const $ = c(
|
|
206
|
+
const $ = c(21);
|
|
453
207
|
const { groupingFunction, components } = t0;
|
|
454
|
-
const contentLength = useAuiState(
|
|
208
|
+
const contentLength = useAuiState(_temp3);
|
|
455
209
|
const { groups: messageGroups, partKeys } = useMessagePartsGrouped(groupingFunction);
|
|
456
210
|
let t1;
|
|
457
211
|
bb0: {
|
|
@@ -465,11 +219,38 @@ const MessagePrimitiveUnstable_PartsGrouped = (t0) => {
|
|
|
465
219
|
t1 = t2;
|
|
466
220
|
break bb0;
|
|
467
221
|
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
222
|
+
const t2 = components?.Text ?? defaultComponents.Text;
|
|
223
|
+
const t3 = components?.Reasoning ?? defaultComponents.Reasoning;
|
|
224
|
+
const t4 = components?.Image ?? defaultComponents.Image;
|
|
225
|
+
const t5 = components?.Source ?? defaultComponents.Source;
|
|
226
|
+
const t6 = components?.File ?? defaultComponents.File;
|
|
227
|
+
const t7 = components?.Unstable_Audio ?? defaultComponents.Unstable_Audio;
|
|
228
|
+
let t8;
|
|
229
|
+
if ($[2] !== components || $[3] !== t2 || $[4] !== t3 || $[5] !== t4 || $[6] !== t5 || $[7] !== t6 || $[8] !== t7) {
|
|
230
|
+
t8 = {
|
|
231
|
+
...components,
|
|
232
|
+
Text: t2,
|
|
233
|
+
Reasoning: t3,
|
|
234
|
+
Image: t4,
|
|
235
|
+
Source: t5,
|
|
236
|
+
File: t6,
|
|
237
|
+
Unstable_Audio: t7
|
|
238
|
+
};
|
|
239
|
+
$[2] = components;
|
|
240
|
+
$[3] = t2;
|
|
241
|
+
$[4] = t3;
|
|
242
|
+
$[5] = t4;
|
|
243
|
+
$[6] = t5;
|
|
244
|
+
$[7] = t6;
|
|
245
|
+
$[8] = t7;
|
|
246
|
+
$[9] = t8;
|
|
247
|
+
} else t8 = $[9];
|
|
248
|
+
const leafComponents = t8;
|
|
249
|
+
let t9;
|
|
250
|
+
if ($[10] !== components?.Group || $[11] !== leafComponents || $[12] !== messageGroups || $[13] !== partKeys) {
|
|
251
|
+
let t10;
|
|
252
|
+
if ($[15] !== components?.Group || $[16] !== leafComponents || $[17] !== partKeys) {
|
|
253
|
+
t10 = (group, groupIndex) => {
|
|
473
254
|
const GroupComponent = components?.Group ?? defaultComponents.Group;
|
|
474
255
|
const identity = partKeys[group.indices[0]];
|
|
475
256
|
return /* @__PURE__ */ jsx(GroupComponent, {
|
|
@@ -477,7 +258,7 @@ const MessagePrimitiveUnstable_PartsGrouped = (t0) => {
|
|
|
477
258
|
indices: group.indices,
|
|
478
259
|
children: group.indices.map((partIndex) => /* @__PURE__ */ jsx(MessagePart, {
|
|
479
260
|
partIndex,
|
|
480
|
-
components
|
|
261
|
+
components: leafComponents
|
|
481
262
|
}, partKeys[partIndex]))
|
|
482
263
|
}, JSON.stringify([
|
|
483
264
|
"group",
|
|
@@ -485,25 +266,27 @@ const MessagePrimitiveUnstable_PartsGrouped = (t0) => {
|
|
|
485
266
|
identity?.includes(":") ? `id:${identity}` : groupIndex
|
|
486
267
|
]));
|
|
487
268
|
};
|
|
488
|
-
$[
|
|
489
|
-
$[
|
|
490
|
-
$[
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
$[
|
|
495
|
-
$[
|
|
496
|
-
$[
|
|
497
|
-
|
|
498
|
-
|
|
269
|
+
$[15] = components?.Group;
|
|
270
|
+
$[16] = leafComponents;
|
|
271
|
+
$[17] = partKeys;
|
|
272
|
+
$[18] = t10;
|
|
273
|
+
} else t10 = $[18];
|
|
274
|
+
t9 = messageGroups.map(t10);
|
|
275
|
+
$[10] = components?.Group;
|
|
276
|
+
$[11] = leafComponents;
|
|
277
|
+
$[12] = messageGroups;
|
|
278
|
+
$[13] = partKeys;
|
|
279
|
+
$[14] = t9;
|
|
280
|
+
} else t9 = $[14];
|
|
281
|
+
t1 = t9;
|
|
499
282
|
}
|
|
500
283
|
const partsElements = t1;
|
|
501
284
|
let t2;
|
|
502
|
-
if ($[
|
|
285
|
+
if ($[19] !== partsElements) {
|
|
503
286
|
t2 = /* @__PURE__ */ jsx(Fragment, { children: partsElements });
|
|
504
|
-
$[
|
|
505
|
-
$[
|
|
506
|
-
} else t2 = $[
|
|
287
|
+
$[19] = partsElements;
|
|
288
|
+
$[20] = t2;
|
|
289
|
+
} else t2 = $[20];
|
|
507
290
|
return t2;
|
|
508
291
|
};
|
|
509
292
|
MessagePrimitiveUnstable_PartsGrouped.displayName = "MessagePrimitive.Unstable_PartsGrouped";
|
|
@@ -544,12 +327,9 @@ function _temp(s) {
|
|
|
544
327
|
return s.message.parts;
|
|
545
328
|
}
|
|
546
329
|
function _temp2(s) {
|
|
547
|
-
return s.part;
|
|
548
|
-
}
|
|
549
|
-
function _temp3(s) {
|
|
550
330
|
return s.message.status ?? COMPLETE_STATUS;
|
|
551
331
|
}
|
|
552
|
-
function
|
|
332
|
+
function _temp3(s) {
|
|
553
333
|
return s.message.parts.length;
|
|
554
334
|
}
|
|
555
335
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagePartsGrouped.js","names":["c","_c","ComponentType","FC","memo","PropsWithChildren","useMemo","useAuiState","useAui","PartByIndexProvider","TextMessagePartProvider","MessagePartPrimitiveText","MessagePartPrimitiveImage","Unstable_AudioMessagePartComponent","DataMessagePartComponent","DataMessagePartProps","EmptyMessagePartComponent","TextMessagePartComponent","ImageMessagePartComponent","SourceMessagePartComponent","ToolCallMessagePartComponent","ToolCallMessagePartProps","FileMessagePartComponent","ReasoningMessagePartComponent","MessagePartPrimitiveInProgress","MessagePartStatus","getMessagePartKeys","MessagePartGroup","groupKey","indices","GroupingFunction","parts","groupMessagePartsByParentId","groupMap","Map","i","length","part","parentId","groupId","get","push","set","groups","undefined","useMessagePartsGrouped","groupingFunction","$","_temp","t0","bb0","t1","Symbol","for","t2","partKeys","MessagePrimitiveUnstable_PartsGrouped","Props","components","Empty","Text","Reasoning","Source","Image","File","Unstable_Audio","data","by_name","Record","Fallback","tools","Override","Group","ToolUIDisplay","props","toolName","s","toolUIs","render","Render","DataUIDisplay","name","named","dataRenderers","renderers","fallbacks","defaultComponents","whiteSpace","fontFamily","children","MessagePartComponentProps","MessagePartComponent","t3","t4","t5","t6","t7","t8","t9","Audio","t10","aui","_temp2","type","addResult","addToolResult","resume","resumeToolCall","respondToApproval","respondToToolApproval","unstable_recordInteraction","t11","t12","Object","hasOwn","Tool","t13","status","Error","Data","console","warn","MessagePartProps","partIndex","MessagePartImpl","MessagePart","prev","next","EmptyPartFallback","component","Component","COMPLETE_STATUS","freeze","EmptyPartsImpl","_temp3","EmptyParts","contentLength","_temp4","messageGroups","group","groupIndex","GroupComponent","identity","JSON","stringify","includes","map","partsElements","displayName","MessagePrimitiveUnstable_PartsGroupedByParentId","Omit","message","_c"],"sources":["../../../src/primitives/message/MessagePartsGrouped.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentType,\n type FC,\n memo,\n type PropsWithChildren,\n useMemo,\n} from \"react\";\nimport { useAuiState, useAui } from \"@assistant-ui/store\";\nimport { PartByIndexProvider } from \"../../context/providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../context/providers/TextMessagePartProvider\";\nimport { MessagePartPrimitiveText } from \"../messagePart/MessagePartText\";\nimport { MessagePartPrimitiveImage } from \"../messagePart/MessagePartImage\";\nimport type {\n Unstable_AudioMessagePartComponent,\n DataMessagePartComponent,\n DataMessagePartProps,\n EmptyMessagePartComponent,\n TextMessagePartComponent,\n ImageMessagePartComponent,\n SourceMessagePartComponent,\n ToolCallMessagePartComponent,\n ToolCallMessagePartProps,\n FileMessagePartComponent,\n ReasoningMessagePartComponent,\n} from \"@assistant-ui/core/react\";\nimport { MessagePartPrimitiveInProgress } from \"../messagePart/MessagePartInProgress\";\nimport type { MessagePartStatus } from \"@assistant-ui/core\";\nimport { getMessagePartKeys } from \"@assistant-ui/core/internal\";\n\ntype MessagePartGroup = {\n groupKey: string | undefined;\n indices: number[];\n};\n\nexport type GroupingFunction = (parts: readonly any[]) => MessagePartGroup[];\n\n/**\n * Groups message parts by their parent ID.\n * Parts without a parent ID appear in their chronological position as individual groups.\n * Parts with the same parent ID are grouped together at the position of their first occurrence.\n */\nconst groupMessagePartsByParentId: GroupingFunction = (\n parts: readonly any[],\n): MessagePartGroup[] => {\n // Map maintains insertion order, so groups appear in order of first occurrence\n const groupMap = new Map<string | number, number[]>();\n\n // Process each part in order\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n const parentId = part?.parentId as string | undefined;\n\n // For parts without parentId, assign a unique group ID to maintain their position\n const groupId = parentId ?? i;\n\n // Get or create the indices array for this group\n const indices = groupMap.get(groupId) ?? [];\n indices.push(i);\n groupMap.set(groupId, indices);\n }\n\n // Convert map to array of groups\n const groups: MessagePartGroup[] = [];\n for (const [groupId, indices] of groupMap) {\n // Extract parentId (undefined for ungrouped parts)\n const groupKey = typeof groupId === \"string\" ? groupId : undefined;\n groups.push({ groupKey, indices });\n }\n\n return groups;\n};\n\nconst useMessagePartsGrouped = (\n groupingFunction: GroupingFunction,\n): { groups: MessagePartGroup[]; partKeys: string[] } => {\n const parts = useAuiState((s) => s.message.parts);\n\n const groups = useMemo(() => {\n if (parts.length === 0) {\n return [];\n }\n return groupingFunction(parts);\n }, [parts, groupingFunction]);\n return { groups, partKeys: getMessagePartKeys(parts) };\n};\n\nexport namespace MessagePrimitiveUnstable_PartsGrouped {\n export type Props = {\n /**\n * Function that takes an array of message parts and returns an array of groups.\n * Each group contains a key (for identification) and an array of indices.\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * groupingFunction={(parts) => {\n * const groups = new Map<string | number, number[]>();\n * parts.forEach((part, i) => {\n * const key = part.parentId ?? i;\n * const indices = groups.get(key) ?? [];\n * indices.push(i);\n * groups.set(key, indices);\n * });\n * return Array.from(groups.entries()).map(([key, indices]) => ({\n * groupKey: typeof key === \"string\" ? key : undefined,\n * indices\n * }));\n * }}\n * ```\n *\n * @example\n * ```tsx\n * // Group by tool name\n * import { groupMessagePartsByToolName } from \"@assistant-ui/react\";\n *\n * <MessagePrimitive.Unstable_PartsGrouped\n * groupingFunction={groupMessagePartsByToolName}\n * components={{\n * Group: ({ key, indices, children }) => {\n * if (!key) return <>{children}</>;\n * return (\n * <div className=\"tool-group\">\n * <h4>Tool: {key}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\n groupingFunction: GroupingFunction;\n\n /**\n * Component configuration for rendering different types of message content.\n *\n * You can provide custom components for each content type (text, image, file, etc.)\n * and configure tool rendering behavior. If not provided, default components will be used.\n */\n components:\n | {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /**\n * Component for rendering audio content.\n *\n * @deprecated Render audio through the `File` slot instead, branching\n * on an `audio/*` mime type.\n */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?:\n | {\n /** Map data event names to specific components */\n by_name?:\n | Record<string, DataMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n }\n | undefined;\n /** Configuration for tool call rendering */\n tools?:\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n }\n | undefined;\n\n /**\n * Component for rendering grouped message parts.\n *\n * When provided, this component will automatically wrap message parts that share\n * the same group key as determined by the groupingFunction.\n *\n * The component receives:\n * - `groupKey`: The group key (or undefined for ungrouped parts)\n * - `indices`: Array of indices for the parts in this group\n * - `children`: The rendered message part components\n *\n * @example\n * ```tsx\n * // Collapsible group\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <details className=\"message-group\">\n * <summary>\n * Group {groupKey} ({indices.length} parts)\n * </summary>\n * <div className=\"group-content\">\n * {children}\n * </div>\n * </details>\n * );\n * }\n * ```\n *\n * @param groupKey - The group key (undefined for ungrouped parts)\n * @param indices - Array of indices for the parts in this group\n * @param children - Rendered message part components to display within the group\n */\n Group?: ComponentType<\n PropsWithChildren<{\n groupKey: string | undefined;\n indices: number[];\n }>\n >;\n }\n | undefined;\n };\n}\n\nconst ToolUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: ToolCallMessagePartComponent | undefined;\n} & ToolCallMessagePartProps) => {\n const Render = useAuiState(\n (s) => s.tools.toolUIs[props.toolName]?.[0]?.render ?? Fallback,\n );\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst DataUIDisplay = ({\n Fallback,\n ...props\n}: {\n Fallback: DataMessagePartComponent | undefined;\n} & DataMessagePartProps) => {\n const Render = useAuiState((s) => {\n const named = s.dataRenderers.renderers[props.name]?.[0];\n if (named) return named;\n return s.dataRenderers.fallbacks[0] ?? Fallback;\n });\n if (!Render) return null;\n return <Render {...props} />;\n};\n\nconst defaultComponents = {\n Text: () => (\n <p style={{ whiteSpace: \"pre-line\" }}>\n <MessagePartPrimitiveText />\n <MessagePartPrimitiveInProgress>\n <span style={{ fontFamily: \"revert\" }}>{\" \\u25CF\"}</span>\n </MessagePartPrimitiveInProgress>\n </p>\n ),\n Reasoning: () => null,\n Source: () => null,\n Image: () => <MessagePartPrimitiveImage />,\n File: () => null,\n Unstable_Audio: () => null,\n Group: ({ children }) => children,\n} satisfies MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\nconst MessagePartComponent: FC<MessagePartComponentProps> = ({\n components: {\n Text = defaultComponents.Text,\n Reasoning = defaultComponents.Reasoning,\n Image = defaultComponents.Image,\n Source = defaultComponents.Source,\n File = defaultComponents.File,\n Unstable_Audio: Audio = defaultComponents.Unstable_Audio,\n tools = {},\n data,\n } = {},\n}) => {\n const aui = useAui();\n const part = useAuiState((s) => s.part);\n\n const type = part.type;\n if (type === \"tool-call\") {\n const addResult = aui.part.addToolResult;\n const resume = aui.part.resumeToolCall;\n const respondToApproval = aui.part.respondToToolApproval;\n const unstable_recordInteraction = aui.part.unstable_recordInteraction;\n if (\"Override\" in tools)\n return (\n <tools.Override\n {...part}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n {...(unstable_recordInteraction && { unstable_recordInteraction })}\n />\n );\n const Tool =\n (tools.by_name && Object.hasOwn(tools.by_name, part.toolName)\n ? tools.by_name[part.toolName]\n : undefined) ?? tools.Fallback;\n return (\n <ToolUIDisplay\n {...part}\n Fallback={Tool}\n addResult={addResult}\n resume={resume}\n respondToApproval={respondToApproval}\n {...(unstable_recordInteraction && { unstable_recordInteraction })}\n />\n );\n }\n\n if (part.status?.type === \"requires-action\")\n throw new Error(\"Encountered unexpected requires-action status\");\n\n switch (type) {\n case \"text\":\n return <Text {...part} />;\n\n case \"reasoning\":\n return <Reasoning {...part} />;\n\n case \"source\":\n return <Source {...part} />;\n\n case \"image\":\n return <Image {...part} />;\n\n case \"file\":\n return <File {...part} />;\n\n case \"audio\":\n return <Audio {...part} />;\n\n case \"data\": {\n const Data =\n (data?.by_name && Object.hasOwn(data.by_name, part.name)\n ? data.by_name[part.name]\n : undefined) ?? data?.Fallback;\n return <DataUIDisplay {...part} Fallback={Data} />;\n }\n\n default:\n console.warn(`Unknown message part type: ${type}`);\n return null;\n }\n};\n\ntype MessagePartProps = {\n partIndex: number;\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\nconst MessagePartImpl: FC<MessagePartProps> = ({ partIndex, components }) => {\n return (\n <PartByIndexProvider index={partIndex}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n );\n};\n\nconst MessagePart = memo(\n MessagePartImpl,\n (prev, next) =>\n prev.partIndex === next.partIndex &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data &&\n prev.components?.Group === next.components?.Group,\n);\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\n/**\n * Renders the parts of a message grouped by a custom grouping function.\n *\n * This component allows you to group message parts based on any criteria you define.\n * The grouping function receives all message parts and returns an array of groups,\n * where each group has a key and an array of part indices.\n *\n * @deprecated Prefer `<MessagePrimitive.GroupedParts>` for adjacent\n * grouping — it dispatches all rendering through one `switch (part.type)`\n * and supports nested group paths. Keep this primitive only for\n * non-adjacent clustering (e.g., gathering parts with the same parent-id\n * across the message).\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * <MessagePrimitive.Unstable_PartsGrouped\n * components={{\n * Text: ({ text }) => <p className=\"message-text\">{text}</p>,\n * Image: ({ image }) => <img src={image} alt=\"Message image\" />,\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <div className=\"parent-group border rounded p-4\">\n * <h4>Parent ID: {groupKey}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\nexport const MessagePrimitiveUnstable_PartsGrouped: FC<\n MessagePrimitiveUnstable_PartsGrouped.Props\n> = ({ groupingFunction, components }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const { groups: messageGroups, partKeys } =\n useMessagePartsGrouped(groupingFunction);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n return messageGroups.map((group, groupIndex) => {\n const GroupComponent = components?.Group ?? defaultComponents.Group;\n const identity = partKeys[group.indices[0]!];\n\n return (\n <GroupComponent\n key={JSON.stringify([\n \"group\",\n group.groupKey ?? null,\n identity?.includes(\":\") ? `id:${identity}` : groupIndex,\n ])}\n groupKey={group.groupKey}\n indices={group.indices}\n >\n {group.indices.map((partIndex) => (\n <MessagePart\n key={partKeys[partIndex]}\n partIndex={partIndex}\n components={components}\n />\n ))}\n </GroupComponent>\n );\n });\n }, [messageGroups, components, contentLength, partKeys]);\n\n return <>{partsElements}</>;\n};\n\nMessagePrimitiveUnstable_PartsGrouped.displayName =\n \"MessagePrimitive.Unstable_PartsGrouped\";\n\n/**\n * Renders the parts of a message grouped by their parent ID.\n * This is a convenience wrapper around Unstable_PartsGrouped with parent ID grouping.\n *\n * @deprecated Use MessagePrimitive.Unstable_PartsGrouped instead for more flexibility\n */\nexport const MessagePrimitiveUnstable_PartsGroupedByParentId: FC<\n Omit<MessagePrimitiveUnstable_PartsGrouped.Props, \"groupingFunction\">\n> = ({ components, ...props }) => {\n return (\n <MessagePrimitiveUnstable_PartsGrouped\n {...props}\n components={components}\n groupingFunction={groupMessagePartsByParentId}\n />\n );\n};\n\nMessagePrimitiveUnstable_PartsGroupedByParentId.displayName =\n \"MessagePrimitive.Unstable_PartsGroupedByParentId\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA2CA,MAAMgC,+BACJD,UACuB;CAEvB,MAAME,2BAAW,IAAIC,IAA+B;CAGpD,KAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;EAKrC,MAAMI,UAJOR,MAAMI,EACE,EAAEG,YAGKH;EAG5B,MAAMN,UAAUI,SAASO,IAAID,OAAO,KAAK,CAAA;EACzCV,QAAQY,KAAKN,CAAC;EACdF,SAASS,IAAIH,SAASV,OAAO;CAC/B;CAGA,MAAMc,SAA6B,CAAA;CACnC,KAAK,MAAM,CAACJ,SAASV,YAAYI,UAAU;EAEzC,MAAML,WAAW,OAAOW,YAAY,WAAWA,UAAUK,KAAAA;EACzDD,OAAOF,KAAK;GAAEb;GAAUC;EAAQ,CAAC;CACnC;CAEA,OAAOc;AACT;AAEA,MAAME,0BAAyBC,qBAAA;CAAA,MAAAC,IAAA9C,EAAA,CAAA;CAG7B,MAAA8B,QAAcxB,YAAYyC,KAAsB;CAAE,I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6BmC,IAAAG;CAAA,IAAAP,EAAA,OAAAoG,eAAA;EAElD7F,KAAA,oBAAA,UAAA,EAAA,UAAG6F,cAAa,CAAA;EAAIpG,EAAA,KAAAoG;EAAApG,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OAApBO;AAAoB;AAG7BE,sCAAsC4F,cACpC;;;;;;;AAQF,MAAaC,mDAETpG,OAAA;CAAA,MAAAF,IAAA9C,EAAA,CAAA;CAAA,IAAAyD;CAAA,IAAAgB;CAAA,IAAA3B,EAAA,OAAAE,IAAA;EAAC,CAAA,CAAAS,YAAA,GAAAgB,SAAAzB;EAAwBF,EAAA,KAAAE;EAAAF,EAAA,KAAAW;EAAAX,EAAA,KAAA2B;CAAA,OAAA;EAAAhB,aAAAX,EAAA;EAAA2B,QAAA3B,EAAA;CAAA;CAAA,IAAAI;CAAA,IAAAJ,EAAA,OAAAW,cAAAX,EAAA,OAAA2B,OAAA;EAEzBvB,KAAA,oBAAC,uCAAD;GAAsC,GAChCuB;GACQhB;GACM1B,kBAAAA;EAA2B,CAAA;EAC7Ce,EAAA,KAAAW;EAAAX,EAAA,KAAA2B;EAAA3B,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,OAJFI;AAIE;AAINkG,gDAAgDD,cAC9C;AApc6B,SAAApG,MAAA4B,GAAA;CAAA,OAGIA,EAAC2E,QAAQxH;AAAM;AA6MU,SAAAuE,OAAA1B,GAAA;CAAA,OAa1BA,EAACvC;AAAK;AAiHc,SAAAiG,OAAA1D,GAAA;CAAA,OAE1CA,EAAC2E,QAAQlC,UAATc;AAAyD;AAuDjE,SAAAM,OAAA7D,GAAA;CAAA,OACuCA,EAAC2E,QAAQxH,MAAMK;AAAO"}
|
|
1
|
+
{"version":3,"file":"MessagePartsGrouped.js","names":["c","_c","ComponentType","FC","memo","PropsWithChildren","useMemo","useAuiState","PartByIndexProvider","TextMessagePartProvider","MessagePartPrimitiveText","MessagePartPrimitiveImage","MessagePartComponent","Unstable_AudioMessagePartComponent","DataMessagePartComponent","EmptyMessagePartComponent","TextMessagePartComponent","ImageMessagePartComponent","SourceMessagePartComponent","ToolCallMessagePartComponent","ToolCallMessagePartProps","FileMessagePartComponent","ReasoningMessagePartComponent","MessagePartPrimitiveInProgress","MessagePartStatus","getMessagePartKeys","MessagePartGroup","groupKey","indices","GroupingFunction","parts","groupMessagePartsByParentId","groupMap","Map","i","length","part","parentId","groupId","get","push","set","groups","undefined","useMessagePartsGrouped","groupingFunction","$","_temp","t0","bb0","t1","Symbol","for","t2","partKeys","MessagePrimitiveUnstable_PartsGrouped","Props","components","Empty","Text","Reasoning","Source","Image","File","Unstable_Audio","data","by_name","Record","Fallback","tools","Override","Group","defaultComponents","whiteSpace","fontFamily","children","MessagePartComponentProps","MessagePartProps","partIndex","MessagePart","prev","next","EmptyPartFallback","status","component","Component","type","t3","COMPLETE_STATUS","Object","freeze","EmptyPartsImpl","_temp2","EmptyParts","contentLength","_temp3","messageGroups","t4","t5","t6","t7","t8","leafComponents","t9","t10","group","groupIndex","GroupComponent","identity","JSON","stringify","includes","map","partsElements","displayName","MessagePrimitiveUnstable_PartsGroupedByParentId","Omit","props","s","message","_c"],"sources":["../../../src/primitives/message/MessagePartsGrouped.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentType,\n type FC,\n memo,\n type PropsWithChildren,\n useMemo,\n} from \"react\";\nimport { useAuiState } from \"@assistant-ui/store\";\nimport { PartByIndexProvider } from \"../../context/providers/PartByIndexProvider\";\nimport { TextMessagePartProvider } from \"../../context/providers/TextMessagePartProvider\";\nimport { MessagePartPrimitiveText } from \"../messagePart/MessagePartText\";\nimport { MessagePartPrimitiveImage } from \"../messagePart/MessagePartImage\";\nimport {\n MessagePartComponent,\n type Unstable_AudioMessagePartComponent,\n type DataMessagePartComponent,\n type EmptyMessagePartComponent,\n type TextMessagePartComponent,\n type ImageMessagePartComponent,\n type SourceMessagePartComponent,\n type ToolCallMessagePartComponent,\n type ToolCallMessagePartProps,\n type FileMessagePartComponent,\n type ReasoningMessagePartComponent,\n} from \"@assistant-ui/core/react\";\nimport { MessagePartPrimitiveInProgress } from \"../messagePart/MessagePartInProgress\";\nimport type { MessagePartStatus } from \"@assistant-ui/core\";\nimport { getMessagePartKeys } from \"@assistant-ui/core/internal\";\n\ntype MessagePartGroup = {\n groupKey: string | undefined;\n indices: number[];\n};\n\nexport type GroupingFunction = (parts: readonly any[]) => MessagePartGroup[];\n\n/**\n * Groups message parts by their parent ID.\n * Parts without a parent ID appear in their chronological position as individual groups.\n * Parts with the same parent ID are grouped together at the position of their first occurrence.\n */\nconst groupMessagePartsByParentId: GroupingFunction = (\n parts: readonly any[],\n): MessagePartGroup[] => {\n // Map maintains insertion order, so groups appear in order of first occurrence\n const groupMap = new Map<string | number, number[]>();\n\n // Process each part in order\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n const parentId = part?.parentId as string | undefined;\n\n // For parts without parentId, assign a unique group ID to maintain their position\n const groupId = parentId ?? i;\n\n // Get or create the indices array for this group\n const indices = groupMap.get(groupId) ?? [];\n indices.push(i);\n groupMap.set(groupId, indices);\n }\n\n // Convert map to array of groups\n const groups: MessagePartGroup[] = [];\n for (const [groupId, indices] of groupMap) {\n // Extract parentId (undefined for ungrouped parts)\n const groupKey = typeof groupId === \"string\" ? groupId : undefined;\n groups.push({ groupKey, indices });\n }\n\n return groups;\n};\n\nconst useMessagePartsGrouped = (\n groupingFunction: GroupingFunction,\n): { groups: MessagePartGroup[]; partKeys: string[] } => {\n const parts = useAuiState((s) => s.message.parts);\n\n const groups = useMemo(() => {\n if (parts.length === 0) {\n return [];\n }\n return groupingFunction(parts);\n }, [parts, groupingFunction]);\n return { groups, partKeys: getMessagePartKeys(parts) };\n};\n\n/**\n * @deprecated Prefer `<MessagePrimitive.GroupedParts>` for adjacent\n * grouping — it dispatches all rendering through one `switch (part.type)`\n * and supports nested group paths. Keep this primitive only for\n * non-adjacent clustering (e.g., gathering parts with the same parent-id\n * across the message).\n */\nexport namespace MessagePrimitiveUnstable_PartsGrouped {\n export type Props = {\n /**\n * Function that takes an array of message parts and returns an array of groups.\n * Each group contains a key (for identification) and an array of indices.\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * groupingFunction={(parts) => {\n * const groups = new Map<string | number, number[]>();\n * parts.forEach((part, i) => {\n * const key = part.parentId ?? i;\n * const indices = groups.get(key) ?? [];\n * indices.push(i);\n * groups.set(key, indices);\n * });\n * return Array.from(groups.entries()).map(([key, indices]) => ({\n * groupKey: typeof key === \"string\" ? key : undefined,\n * indices\n * }));\n * }}\n * ```\n *\n * @example\n * ```tsx\n * // Group by tool name\n * import { groupMessagePartsByToolName } from \"@assistant-ui/react\";\n *\n * <MessagePrimitive.Unstable_PartsGrouped\n * groupingFunction={groupMessagePartsByToolName}\n * components={{\n * Group: ({ key, indices, children }) => {\n * if (!key) return <>{children}</>;\n * return (\n * <div className=\"tool-group\">\n * <h4>Tool: {key}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\n groupingFunction: GroupingFunction;\n\n /**\n * Component configuration for rendering different types of message content.\n *\n * You can provide custom components for each content type (text, image, file, etc.)\n * and configure tool rendering behavior. If not provided, default components will be used.\n */\n components:\n | {\n /** Component for rendering empty messages */\n Empty?: EmptyMessagePartComponent | undefined;\n /** Component for rendering text content */\n Text?: TextMessagePartComponent | undefined;\n /** Component for rendering reasoning content (typically hidden) */\n Reasoning?: ReasoningMessagePartComponent | undefined;\n /** Component for rendering source content */\n Source?: SourceMessagePartComponent | undefined;\n /** Component for rendering image content */\n Image?: ImageMessagePartComponent | undefined;\n /** Component for rendering file content */\n File?: FileMessagePartComponent | undefined;\n /**\n * Component for rendering audio content.\n *\n * @deprecated Render audio through the `File` slot instead, branching\n * on an `audio/*` mime type.\n */\n Unstable_Audio?: Unstable_AudioMessagePartComponent | undefined;\n /** Configuration for data part rendering */\n data?:\n | {\n /** Map data event names to specific components */\n by_name?:\n | Record<string, DataMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unmatched data events */\n Fallback?: DataMessagePartComponent | undefined;\n }\n | undefined;\n /** Configuration for tool call rendering */\n tools?:\n | {\n /** Map of tool names to their specific components */\n by_name?:\n | Record<string, ToolCallMessagePartComponent | undefined>\n | undefined;\n /** Fallback component for unregistered tools */\n Fallback?: ComponentType<ToolCallMessagePartProps> | undefined;\n }\n | {\n /** Override component that handles all tool calls */\n Override: ComponentType<ToolCallMessagePartProps>;\n }\n | undefined;\n\n /**\n * Component for rendering grouped message parts.\n *\n * When provided, this component will automatically wrap message parts that share\n * the same group key as determined by the groupingFunction.\n *\n * The component receives:\n * - `groupKey`: The group key (or undefined for ungrouped parts)\n * - `indices`: Array of indices for the parts in this group\n * - `children`: The rendered message part components\n *\n * @example\n * ```tsx\n * // Collapsible group\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <details className=\"message-group\">\n * <summary>\n * Group {groupKey} ({indices.length} parts)\n * </summary>\n * <div className=\"group-content\">\n * {children}\n * </div>\n * </details>\n * );\n * }\n * ```\n *\n * @param groupKey - The group key (undefined for ungrouped parts)\n * @param indices - Array of indices for the parts in this group\n * @param children - Rendered message part components to display within the group\n */\n Group?: ComponentType<\n PropsWithChildren<{\n groupKey: string | undefined;\n indices: number[];\n }>\n >;\n }\n | undefined;\n };\n}\n\nconst defaultComponents = {\n Text: () => (\n <p style={{ whiteSpace: \"pre-line\" }}>\n <MessagePartPrimitiveText />\n <MessagePartPrimitiveInProgress>\n <span style={{ fontFamily: \"revert\" }}>{\" \\u25CF\"}</span>\n </MessagePartPrimitiveInProgress>\n </p>\n ),\n Reasoning: () => null,\n Source: () => null,\n Image: () => <MessagePartPrimitiveImage />,\n File: () => null,\n Unstable_Audio: () => null,\n Group: ({ children }) => children,\n} satisfies MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n\ntype MessagePartComponentProps = {\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\ntype MessagePartProps = {\n partIndex: number;\n components: MessagePrimitiveUnstable_PartsGrouped.Props[\"components\"];\n};\n\nconst MessagePart = memo(\n ({ partIndex, components }: MessagePartProps) => (\n <PartByIndexProvider index={partIndex}>\n <MessagePartComponent components={components} />\n </PartByIndexProvider>\n ),\n (prev, next) =>\n prev.partIndex === next.partIndex &&\n prev.components?.Text === next.components?.Text &&\n prev.components?.Reasoning === next.components?.Reasoning &&\n prev.components?.Source === next.components?.Source &&\n prev.components?.Image === next.components?.Image &&\n prev.components?.File === next.components?.File &&\n prev.components?.Unstable_Audio === next.components?.Unstable_Audio &&\n prev.components?.tools === next.components?.tools &&\n prev.components?.data === next.components?.data,\n);\n\nconst EmptyPartFallback: FC<{\n status: MessagePartStatus;\n component: TextMessagePartComponent;\n}> = ({ status, component: Component }) => {\n return (\n <TextMessagePartProvider text=\"\" isRunning={status.type === \"running\"}>\n <Component type=\"text\" text=\"\" status={status} />\n </TextMessagePartProvider>\n );\n};\n\nconst COMPLETE_STATUS: MessagePartStatus = Object.freeze({\n type: \"complete\",\n});\n\nconst EmptyPartsImpl: FC<MessagePartComponentProps> = ({ components }) => {\n const status = useAuiState(\n (s) => (s.message.status ?? COMPLETE_STATUS) as MessagePartStatus,\n );\n\n if (components?.Empty) return <components.Empty status={status} />;\n\n return (\n <EmptyPartFallback\n status={status}\n component={components?.Text ?? defaultComponents.Text}\n />\n );\n};\n\nconst EmptyParts = memo(\n EmptyPartsImpl,\n (prev, next) =>\n prev.components?.Empty === next.components?.Empty &&\n prev.components?.Text === next.components?.Text,\n);\n\n/**\n * Renders the parts of a message grouped by a custom grouping function.\n *\n * This component allows you to group message parts based on any criteria you define.\n * The grouping function receives all message parts and returns an array of groups,\n * where each group has a key and an array of part indices.\n *\n * @deprecated Prefer `<MessagePrimitive.GroupedParts>` for adjacent\n * grouping — it dispatches all rendering through one `switch (part.type)`\n * and supports nested group paths. Keep this primitive only for\n * non-adjacent clustering (e.g., gathering parts with the same parent-id\n * across the message).\n *\n * @example\n * ```tsx\n * // Group by parent ID (default behavior)\n * <MessagePrimitive.Unstable_PartsGrouped\n * components={{\n * Text: ({ text }) => <p className=\"message-text\">{text}</p>,\n * Image: ({ image }) => <img src={image} alt=\"Message image\" />,\n * Group: ({ groupKey, indices, children }) => {\n * if (!groupKey) return <>{children}</>;\n * return (\n * <div className=\"parent-group border rounded p-4\">\n * <h4>Parent ID: {groupKey}</h4>\n * {children}\n * </div>\n * );\n * }\n * }}\n * />\n * ```\n */\nexport const MessagePrimitiveUnstable_PartsGrouped: FC<\n MessagePrimitiveUnstable_PartsGrouped.Props\n> = ({ groupingFunction, components }) => {\n const contentLength = useAuiState((s) => s.message.parts.length);\n const { groups: messageGroups, partKeys } =\n useMessagePartsGrouped(groupingFunction);\n\n const partsElements = useMemo(() => {\n if (contentLength === 0) {\n return <EmptyParts components={components} />;\n }\n\n const leafComponents = {\n ...components,\n Text: components?.Text ?? defaultComponents.Text,\n Reasoning: components?.Reasoning ?? defaultComponents.Reasoning,\n Image: components?.Image ?? defaultComponents.Image,\n Source: components?.Source ?? defaultComponents.Source,\n File: components?.File ?? defaultComponents.File,\n Unstable_Audio:\n components?.Unstable_Audio ?? defaultComponents.Unstable_Audio,\n };\n\n return messageGroups.map((group, groupIndex) => {\n const GroupComponent = components?.Group ?? defaultComponents.Group;\n const identity = partKeys[group.indices[0]!];\n\n return (\n <GroupComponent\n key={JSON.stringify([\n \"group\",\n group.groupKey ?? null,\n identity?.includes(\":\") ? `id:${identity}` : groupIndex,\n ])}\n groupKey={group.groupKey}\n indices={group.indices}\n >\n {group.indices.map((partIndex) => (\n <MessagePart\n key={partKeys[partIndex]}\n partIndex={partIndex}\n components={leafComponents}\n />\n ))}\n </GroupComponent>\n );\n });\n }, [messageGroups, components, contentLength, partKeys]);\n\n return <>{partsElements}</>;\n};\n\nMessagePrimitiveUnstable_PartsGrouped.displayName =\n \"MessagePrimitive.Unstable_PartsGrouped\";\n\n/**\n * Renders the parts of a message grouped by their parent ID.\n * This is a convenience wrapper around Unstable_PartsGrouped with parent ID grouping.\n *\n * @deprecated Use MessagePrimitive.Unstable_PartsGrouped instead for more flexibility\n */\nexport const MessagePrimitiveUnstable_PartsGroupedByParentId: FC<\n Omit<MessagePrimitiveUnstable_PartsGrouped.Props, \"groupingFunction\">\n> = ({ components, ...props }) => {\n return (\n <MessagePrimitiveUnstable_PartsGrouped\n {...props}\n components={components}\n groupingFunction={groupMessagePartsByParentId}\n />\n );\n};\n\nMessagePrimitiveUnstable_PartsGroupedByParentId.displayName =\n \"MessagePrimitive.Unstable_PartsGroupedByParentId\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAM+B,+BACJD,UACuB;CAEvB,MAAME,2BAAW,IAAIC,IAA+B;CAGpD,KAAK,IAAIC,IAAI,GAAGA,IAAIJ,MAAMK,QAAQD,KAAK;EAKrC,MAAMI,UAJOR,MAAMI,EACE,EAAEG,YAGKH;EAG5B,MAAMN,UAAUI,SAASO,IAAID,OAAO,KAAK,CAAA;EACzCV,QAAQY,KAAKN,CAAC;EACdF,SAASS,IAAIH,SAASV,OAAO;CAC/B;CAGA,MAAMc,SAA6B,CAAA;CACnC,KAAK,MAAM,CAACJ,SAASV,YAAYI,UAAU;EAEzC,MAAML,WAAW,OAAOW,YAAY,WAAWA,UAAUK,KAAAA;EACzDD,OAAOF,KAAK;GAAEb;GAAUC;EAAQ,CAAC;CACnC;CAEA,OAAOc;AACT;AAEA,MAAME,0BAAyBC,qBAAA;CAAA,MAAAC,IAAA7C,EAAA,CAAA;CAG7B,MAAA6B,QAAcvB,YAAYwC,KAAsB;CAAE,IAAAC;CAAAC,KAAA;EAGhD,IAAInB,MAAKK,WAAY,GAAC;GAAA,IAAAe;GAAA,IAAAJ,EAAA,OAAAK,OAAAC,IAAA,2BAAA,GAAA;IACbF,KAAA,CAAA;IAAEJ,EAAA,KAAAI;GAAA,OAAAA,KAAAJ,EAAA;GAATE,KAAOE;GAAP,MAAAD;EAAU;EACX,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;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B;;;;
|
|
1
|
+
{"version":3,"file":"SelectionToolbarRoot.d.ts","sourceRoot":"","sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,iCAA8B;AAElD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAOlB,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAIF,eAAO,MAAM,uBAAuB,4BACC,CAAC;AAEtC,yBAAiB,6BAA6B,CAAC;IAC7C,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;CACpE;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,6BAA6B;;;;0GA0IxC,CAAC"}
|
|
@@ -113,11 +113,14 @@ const SelectionToolbarPrimitiveRoot = forwardRef((t0, forwardedRef) => {
|
|
|
113
113
|
const handleMouseCancel = () => {
|
|
114
114
|
isMouseDragging = false;
|
|
115
115
|
};
|
|
116
|
+
const handleWindowBlur = () => {
|
|
117
|
+
if (isMouseDragging) handleMouseUp();
|
|
118
|
+
};
|
|
116
119
|
document.addEventListener("mousedown", handleMouseDown, true);
|
|
117
120
|
document.addEventListener("mouseup", handleMouseUp, true);
|
|
118
121
|
document.addEventListener("dragend", handleMouseUp, true);
|
|
119
122
|
document.addEventListener("contextmenu", handleMouseCancel, true);
|
|
120
|
-
window.addEventListener("blur",
|
|
123
|
+
window.addEventListener("blur", handleWindowBlur);
|
|
121
124
|
document.addEventListener("selectionchange", handleSelectionChange);
|
|
122
125
|
document.addEventListener("scroll", handleScroll, true);
|
|
123
126
|
return () => {
|
|
@@ -126,7 +129,7 @@ const SelectionToolbarPrimitiveRoot = forwardRef((t0, forwardedRef) => {
|
|
|
126
129
|
document.removeEventListener("mouseup", handleMouseUp, true);
|
|
127
130
|
document.removeEventListener("dragend", handleMouseUp, true);
|
|
128
131
|
document.removeEventListener("contextmenu", handleMouseCancel, true);
|
|
129
|
-
window.removeEventListener("blur",
|
|
132
|
+
window.removeEventListener("blur", handleWindowBlur);
|
|
130
133
|
document.removeEventListener("selectionchange", handleSelectionChange);
|
|
131
134
|
document.removeEventListener("scroll", handleScroll, true);
|
|
132
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionToolbarRoot.js","names":["c","_c","Primitive","composeEventHandlers","ComponentPropsWithoutRef","ComponentRef","createContext","forwardRef","useContext","useEffect","useRef","useState","createPortal","getSelectionMessageId","useThreadRootElementRef","SelectionInfo","text","messageId","rect","DOMRect","SelectionToolbarContext","useSelectionToolbarInfo","SelectionToolbarPrimitiveRoot","Element","div","Props","t0","forwardedRef","$","onMouseDown","props","style","info","setInfo","threadRootRef","warnedAboutMissingThreadRootRef","t1","t2","pendingFrame","isMouseDragging","checkSelection","cancelAnimationFrame","requestAnimationFrame","sel","window","getSelection","isCollapsed","toString","trim","current","process","env","NODE_ENV","console","warn","range","getRangeAt","getBoundingClientRect","handleSelectionChange","sel_0","handleScroll","handleMouseDown","handleMouseUp","handleMouseCancel","document","addEventListener","removeEventListener","t3","top","t4","left","width","t5","position","transform","zIndex","positionStyle","t6","_temp","t7","t8","body","displayName","e","preventDefault","_c","Primitive"],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getSelectionMessageId } from \"../../utils/getSelectionMessageId\";\nimport { useThreadRootElementRef } from \"../thread/ThreadRootElementContext\";\n\ntype SelectionInfo = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nconst SelectionToolbarContext = createContext<SelectionInfo | null>(null);\n\nexport const useSelectionToolbarInfo = () =>\n useContext(SelectionToolbarContext);\n\nexport namespace SelectionToolbarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A floating toolbar that appears when text is selected within a message.\n *\n * Listens for browser selection changes, validates that the selection is\n * within a single message, and renders a positioned portal near the\n * selection. Prevents mousedown from clearing the selection.\n *\n * @example\n * ```tsx\n * <SelectionToolbarPrimitive.Root>\n * <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>\n * </SelectionToolbarPrimitive.Root>\n * ```\n */\nexport const SelectionToolbarPrimitiveRoot = forwardRef<\n SelectionToolbarPrimitiveRoot.Element,\n SelectionToolbarPrimitiveRoot.Props\n>(({ onMouseDown, style, ...props }, forwardedRef) => {\n const [info, setInfo] = useState<SelectionInfo | null>(null);\n const threadRootRef = useThreadRootElementRef();\n const warnedAboutMissingThreadRootRef = useRef(false);\n\n useEffect(() => {\n // Read the selection on the next frame so the browser has settled it.\n let pendingFrame: number | null = null;\n let isMouseDragging = false;\n\n const checkSelection = () => {\n if (pendingFrame !== null) cancelAnimationFrame(pendingFrame);\n pendingFrame = requestAnimationFrame(() => {\n pendingFrame = null;\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n return;\n }\n\n const text = sel.toString().trim();\n if (!text) {\n setInfo(null);\n return;\n }\n\n if (threadRootRef && !threadRootRef.current) {\n if (\n process.env.NODE_ENV !== \"production\" &&\n !warnedAboutMissingThreadRootRef.current\n ) {\n warnedAboutMissingThreadRootRef.current = true;\n console.warn(\n \"[SelectionToolbarPrimitive.Root] ThreadPrimitive.Root did not provide a DOM element, so the selection cannot be scoped to its thread. Ensure a custom root child forwards its ref.\",\n );\n }\n }\n\n const messageId = getSelectionMessageId(sel, threadRootRef?.current);\n if (!messageId) {\n setInfo(null);\n return;\n }\n\n const range = sel.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n setInfo({ text, messageId, rect });\n });\n };\n\n const handleSelectionChange = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n if (pendingFrame !== null) {\n cancelAnimationFrame(pendingFrame);\n pendingFrame = null;\n }\n setInfo(null);\n return;\n }\n\n if (!isMouseDragging) checkSelection();\n };\n\n const handleScroll = () => {\n if (pendingFrame !== null) {\n cancelAnimationFrame(pendingFrame);\n pendingFrame = null;\n }\n setInfo(null);\n };\n\n const handleMouseDown = () => {\n isMouseDragging = true;\n };\n\n const handleMouseUp = () => {\n isMouseDragging = false;\n checkSelection();\n };\n\n const handleMouseCancel = () => {\n isMouseDragging = false;\n };\n\n document.addEventListener(\"mousedown\", handleMouseDown, true);\n document.addEventListener(\"mouseup\", handleMouseUp, true);\n document.addEventListener(\"dragend\", handleMouseUp, true);\n // A context menu can consume the mouseup of the press that opened it.\n document.addEventListener(\"contextmenu\", handleMouseCancel, true);\n window.addEventListener(\"blur\", handleMouseCancel);\n document.addEventListener(\"selectionchange\", handleSelectionChange);\n document.addEventListener(\"scroll\", handleScroll, true);\n\n return () => {\n if (pendingFrame !== null) cancelAnimationFrame(pendingFrame);\n document.removeEventListener(\"mousedown\", handleMouseDown, true);\n document.removeEventListener(\"mouseup\", handleMouseUp, true);\n document.removeEventListener(\"dragend\", handleMouseUp, true);\n document.removeEventListener(\"contextmenu\", handleMouseCancel, true);\n window.removeEventListener(\"blur\", handleMouseCancel);\n document.removeEventListener(\"selectionchange\", handleSelectionChange);\n document.removeEventListener(\"scroll\", handleScroll, true);\n };\n }, [threadRootRef]);\n\n if (!info) return null;\n\n const positionStyle: React.CSSProperties = {\n position: \"fixed\",\n top: `${info.rect.top - 8}px`,\n left: `${info.rect.left + info.rect.width / 2}px`,\n transform: \"translate(-50%, -100%)\",\n zIndex: 50,\n ...style,\n };\n\n return createPortal(\n <SelectionToolbarContext.Provider value={info}>\n <Primitive.div\n {...props}\n ref={forwardedRef}\n style={positionStyle}\n onMouseDown={composeEventHandlers(onMouseDown, (e) => {\n // Prevent mousedown from clearing the text selection\n e.preventDefault();\n })}\n />\n </SelectionToolbarContext.Provider>,\n document.body,\n );\n});\n\nSelectionToolbarPrimitiveRoot.displayName = \"SelectionToolbarPrimitive.Root\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAMoB,0BAA0Bd,cAAoC,IAAI;AAExE,MAAae,gCAA0B;CAAA,OACrCb,WAAWY,uBAAuB;AAAC;;;;;;;;;;;;;;;AAqBrC,MAAaE,gCAAgCf,YAG3CmB,IAAAC,iBAAA;CAAA,MAAAC,IAAA3B,EAAA,EAAA;CAAA,IAAA4B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAF,IAAA;EAAC,CAAA,CAAAG,aAAAE,OAAA,GAAAD,SAAAJ;EAAgCE,EAAA,KAAAF;EAAAE,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAF,cAAAD,EAAA;EAAAE,QAAAF,EAAA;EAAAG,QAAAH,EAAA;CAAA;CACjC,MAAA,CAAAI,MAAAC,WAAwBtB,SAA+B,IAAI;CAC3D,MAAAuB,gBAAsBpB,wBAAwB;CAC9C,MAAAqB,kCAAwCzB,OAAO,KAAK;CAAE,IAAA0B;CAAA,IAAAC;CAAA,IAAAT,EAAA,OAAAM,eAAA;EAE5CE,WAAA;GAER,IAAAE,eAAkC;GAClC,IAAAC,kBAAsB;GAEtB,MAAAC,uBAAuB;IACrB,IAAIF,iBAAiB,MAAMG,qBAAqBH,YAAY;IAC5DA,eAA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AA4C;CAAA,OAAAA,KAAA5C,EAAA;CAPD,MAAAgD,gBAA2CJ;CAOzC,IAAAK;CAAA,IAAAjD,EAAA,QAAAC,aAAA;EAQiBgD,KAAA1E,qBAAqB0B,aAAaiD,KAG9C;EAAClD,EAAA,MAAAC;EAAAD,EAAA,MAAAiD;CAAA,OAAAA,KAAAjD,EAAA;CAAA,IAAAmD;CAAA,IAAAnD,EAAA,QAAAD,gBAAAC,EAAA,QAAAgD,iBAAAhD,EAAA,QAAAE,SAAAF,EAAA,QAAAiD,IAAA;EAPJE,KAAA,oBAAAO,YAAA,KAAA;GAAA,GACMxD;GACCH,KAAAA;GACEiD,OAAAA;GACM,aAAAC;EAGX,CAAA;EACFjD,EAAA,MAAAD;EAAAC,EAAA,MAAAgD;EAAAhD,EAAA,MAAAE;EAAAF,EAAA,MAAAiD;EAAAjD,EAAA,MAAAmD;CAAA,OAAAA,KAAAnD,EAAA;CAAA,IAAAoD;CAAA,IAAApD,EAAA,QAAAI,QAAAJ,EAAA,QAAAmD,IAAA;EAVCC,KAAApE,aACL,oBAAA,wBAAA,UAAA;GAAyCoB,OAAAA;GACvC+C,UAAAA;EASF,CAAA,GACAf,SAAQiB,IACV;EAACrD,EAAA,MAAAI;EAAAJ,EAAA,MAAAmD;EAAAnD,EAAA,MAAAoD;CAAA,OAAAA,KAAApD,EAAA;CAAA,OAbMoD;AAaN,CACF;AAED1D,8BAA8B4D,cAAc;AArI1C,SAAAJ,MAAAK,GAAA;CA6HQA,EAACC,eAAgB;AAAC"}
|
|
1
|
+
{"version":3,"file":"SelectionToolbarRoot.js","names":["c","_c","Primitive","composeEventHandlers","ComponentPropsWithoutRef","ComponentRef","createContext","forwardRef","useContext","useEffect","useRef","useState","createPortal","getSelectionMessageId","useThreadRootElementRef","SelectionInfo","text","messageId","rect","DOMRect","SelectionToolbarContext","useSelectionToolbarInfo","SelectionToolbarPrimitiveRoot","Element","div","Props","t0","forwardedRef","$","onMouseDown","props","style","info","setInfo","threadRootRef","warnedAboutMissingThreadRootRef","t1","t2","pendingFrame","isMouseDragging","checkSelection","cancelAnimationFrame","requestAnimationFrame","sel","window","getSelection","isCollapsed","toString","trim","current","process","env","NODE_ENV","console","warn","range","getRangeAt","getBoundingClientRect","handleSelectionChange","sel_0","handleScroll","handleMouseDown","handleMouseUp","handleMouseCancel","handleWindowBlur","document","addEventListener","removeEventListener","t3","top","t4","left","width","t5","position","transform","zIndex","positionStyle","t6","_temp","t7","t8","body","displayName","e","preventDefault","_c","Primitive"],"sources":["../../../src/primitives/selectionToolbar/SelectionToolbarRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport { Primitive } from \"../../utils/Primitive\";\nimport { composeEventHandlers } from \"radix-ui/internal\";\nimport {\n type ComponentPropsWithoutRef,\n type ComponentRef,\n createContext,\n forwardRef,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { getSelectionMessageId } from \"../../utils/getSelectionMessageId\";\nimport { useThreadRootElementRef } from \"../thread/ThreadRootElementContext\";\n\ntype SelectionInfo = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nconst SelectionToolbarContext = createContext<SelectionInfo | null>(null);\n\nexport const useSelectionToolbarInfo = () =>\n useContext(SelectionToolbarContext);\n\nexport namespace SelectionToolbarPrimitiveRoot {\n export type Element = ComponentRef<typeof Primitive.div>;\n export type Props = ComponentPropsWithoutRef<typeof Primitive.div>;\n}\n\n/**\n * A floating toolbar that appears when text is selected within a message.\n *\n * Listens for browser selection changes, validates that the selection is\n * within a single message, and renders a positioned portal near the\n * selection. Prevents mousedown from clearing the selection.\n *\n * @example\n * ```tsx\n * <SelectionToolbarPrimitive.Root>\n * <SelectionToolbarPrimitive.Quote>Quote</SelectionToolbarPrimitive.Quote>\n * </SelectionToolbarPrimitive.Root>\n * ```\n */\nexport const SelectionToolbarPrimitiveRoot = forwardRef<\n SelectionToolbarPrimitiveRoot.Element,\n SelectionToolbarPrimitiveRoot.Props\n>(({ onMouseDown, style, ...props }, forwardedRef) => {\n const [info, setInfo] = useState<SelectionInfo | null>(null);\n const threadRootRef = useThreadRootElementRef();\n const warnedAboutMissingThreadRootRef = useRef(false);\n\n useEffect(() => {\n // Read the selection on the next frame so the browser has settled it.\n let pendingFrame: number | null = null;\n let isMouseDragging = false;\n\n const checkSelection = () => {\n if (pendingFrame !== null) cancelAnimationFrame(pendingFrame);\n pendingFrame = requestAnimationFrame(() => {\n pendingFrame = null;\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n setInfo(null);\n return;\n }\n\n const text = sel.toString().trim();\n if (!text) {\n setInfo(null);\n return;\n }\n\n if (threadRootRef && !threadRootRef.current) {\n if (\n process.env.NODE_ENV !== \"production\" &&\n !warnedAboutMissingThreadRootRef.current\n ) {\n warnedAboutMissingThreadRootRef.current = true;\n console.warn(\n \"[SelectionToolbarPrimitive.Root] ThreadPrimitive.Root did not provide a DOM element, so the selection cannot be scoped to its thread. Ensure a custom root child forwards its ref.\",\n );\n }\n }\n\n const messageId = getSelectionMessageId(sel, threadRootRef?.current);\n if (!messageId) {\n setInfo(null);\n return;\n }\n\n const range = sel.getRangeAt(0);\n const rect = range.getBoundingClientRect();\n setInfo({ text, messageId, rect });\n });\n };\n\n const handleSelectionChange = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed) {\n if (pendingFrame !== null) {\n cancelAnimationFrame(pendingFrame);\n pendingFrame = null;\n }\n setInfo(null);\n return;\n }\n\n if (!isMouseDragging) checkSelection();\n };\n\n const handleScroll = () => {\n if (pendingFrame !== null) {\n cancelAnimationFrame(pendingFrame);\n pendingFrame = null;\n }\n setInfo(null);\n };\n\n const handleMouseDown = () => {\n isMouseDragging = true;\n };\n\n const handleMouseUp = () => {\n isMouseDragging = false;\n checkSelection();\n };\n\n const handleMouseCancel = () => {\n isMouseDragging = false;\n };\n\n const handleWindowBlur = () => {\n if (isMouseDragging) handleMouseUp();\n };\n\n document.addEventListener(\"mousedown\", handleMouseDown, true);\n document.addEventListener(\"mouseup\", handleMouseUp, true);\n document.addEventListener(\"dragend\", handleMouseUp, true);\n // A context menu can consume the mouseup of the press that opened it.\n document.addEventListener(\"contextmenu\", handleMouseCancel, true);\n window.addEventListener(\"blur\", handleWindowBlur);\n document.addEventListener(\"selectionchange\", handleSelectionChange);\n document.addEventListener(\"scroll\", handleScroll, true);\n\n return () => {\n if (pendingFrame !== null) cancelAnimationFrame(pendingFrame);\n document.removeEventListener(\"mousedown\", handleMouseDown, true);\n document.removeEventListener(\"mouseup\", handleMouseUp, true);\n document.removeEventListener(\"dragend\", handleMouseUp, true);\n document.removeEventListener(\"contextmenu\", handleMouseCancel, true);\n window.removeEventListener(\"blur\", handleWindowBlur);\n document.removeEventListener(\"selectionchange\", handleSelectionChange);\n document.removeEventListener(\"scroll\", handleScroll, true);\n };\n }, [threadRootRef]);\n\n if (!info) return null;\n\n const positionStyle: React.CSSProperties = {\n position: \"fixed\",\n top: `${info.rect.top - 8}px`,\n left: `${info.rect.left + info.rect.width / 2}px`,\n transform: \"translate(-50%, -100%)\",\n zIndex: 50,\n ...style,\n };\n\n return createPortal(\n <SelectionToolbarContext.Provider value={info}>\n <Primitive.div\n {...props}\n ref={forwardedRef}\n style={positionStyle}\n onMouseDown={composeEventHandlers(onMouseDown, (e) => {\n // Prevent mousedown from clearing the text selection\n e.preventDefault();\n })}\n />\n </SelectionToolbarContext.Provider>,\n document.body,\n );\n});\n\nSelectionToolbarPrimitiveRoot.displayName = \"SelectionToolbarPrimitive.Root\";\n"],"mappings":";;;;;;;;;;AAwBA,MAAMoB,0BAA0Bd,cAAoC,IAAI;AAExE,MAAae,gCAA0B;CAAA,OACrCb,WAAWY,uBAAuB;AAAC;;;;;;;;;;;;;;;AAqBrC,MAAaE,gCAAgCf,YAG3CmB,IAAAC,iBAAA;CAAA,MAAAC,IAAA3B,EAAA,EAAA;CAAA,IAAA4B;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAF,IAAA;EAA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AAArE,aACL,oBAAA,wBAAA,UAAA;GAAyCoB,OAAAA;GACvCgD,UAAAA;EASF,CAAA,GACAf,SAAQiB,IACV;EAACtD,EAAA,MAAAI;EAAAJ,EAAA,MAAAoD;EAAApD,EAAA,MAAAqD;CAAA,OAAAA,KAAArD,EAAA;CAAA,OAbMqD;AAaN,CACF;AAED3D,8BAA8B6D,cAAc;AAzI1C,SAAAJ,MAAAK,GAAA;CAiIQA,EAACC,eAAgB;AAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,iCAA8B;AAClD,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,wBAAwB,
|
|
1
|
+
{"version":3,"file":"ThreadViewport.d.ts","sourceRoot":"","sources":["../../../src/primitives/thread/ThreadViewport.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,iCAA8B;AAClD,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,wBAAwB,EAG9B,MAAM,OAAO,CAAC;AAkBf,yBAAiB,uBAAuB,CAAC;IACvC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC;IACzD,KAAY,KAAK,GAAG,wBAAwB,CAAC,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG;QACnE;;;;;WAKG;QACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAEjC;;;;WAIG;QACH,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;QAE1C;;;;WAIG;QACH,qBAAqB,CAAC,EAAE;YACtB;;;;eAIG;YACH,UAAU,CAAC,EAAE,MAAM,CAAC;YACpB;;;;eAIG;YACH,aAAa,CAAC,EAAE,MAAM,CAAC;SACxB,CAAC;QAEF;;;;WAIG;QACH,wBAAwB,CAAC,EAAE,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