@assistant-ui/react-native 0.1.30 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/primitives/actionBar/ActionBarCopy.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackNegative.js.map +1 -1
- package/dist/primitives/actionBar/ActionBarFeedbackPositive.js.map +1 -1
- package/dist/primitives/attachment/AttachmentName.js.map +1 -1
- package/dist/primitives/attachment/AttachmentRemove.js +1 -0
- package/dist/primitives/attachment/AttachmentRemove.js.map +1 -1
- package/dist/primitives/attachment/AttachmentThumb.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerCount.js.map +1 -1
- package/dist/primitives/branchPicker/BranchPickerNumber.js.map +1 -1
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js +1 -0
- package/dist/primitives/chainOfThought/ChainOfThoughtAccordionTrigger.js.map +1 -1
- package/dist/primitives/error/ErrorMessage.d.ts.map +1 -1
- package/dist/primitives/error/ErrorMessage.js.map +1 -1
- package/dist/primitives/error/ErrorRoot.d.ts.map +1 -1
- package/dist/primitives/message/MessageIf.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionDescription.js.map +1 -1
- package/dist/primitives/suggestion/SuggestionTitle.js.map +1 -1
- package/dist/primitives/thread/ThreadIf.js.map +1 -1
- package/dist/primitives/thread/ThreadMessages.d.ts +12 -3
- package/dist/primitives/thread/ThreadMessages.d.ts.map +1 -1
- package/dist/primitives/thread/ThreadMessages.js +385 -33
- package/dist/primitives/thread/ThreadMessages.js.map +1 -1
- package/dist/primitives/thread.d.ts +3 -3
- package/dist/primitives/thread.js +3 -2
- package/dist/primitives/thread.js.map +1 -1
- package/dist/primitives/threadList/ThreadListItems.js +1 -0
- package/dist/primitives/threadList/ThreadListItems.js.map +1 -1
- package/package.json +8 -8
- package/src/primitives/thread/ThreadMessages.test.tsx +645 -9
- package/src/primitives/thread/ThreadMessages.tsx +336 -28
- package/src/primitives/thread.ts +2 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { RenderChildrenWithAccessor, useAuiState } from "@assistant-ui/store";
|
|
1
|
+
import { RenderChildrenWithAccessor, useAuiEvent, useAuiState } from "@assistant-ui/store";
|
|
2
2
|
import { MessageByIndexProvider } from "@assistant-ui/core/react";
|
|
3
3
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
4
4
|
import { FlatList } from "react-native";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
import { forwardRef, memo } from "@assistant-ui/tap/react-shim";
|
|
6
|
+
import { forwardRef, memo, useEffect, useRef } from "@assistant-ui/tap/react-shim";
|
|
7
7
|
//#region src/primitives/thread/ThreadMessages.tsx
|
|
8
8
|
const DEFAULT_SYSTEM_MESSAGE = () => null;
|
|
9
|
+
const AT_BOTTOM_THRESHOLD = 4;
|
|
9
10
|
const getComponent = (components, role, isEditing) => {
|
|
10
11
|
switch (role) {
|
|
11
12
|
case "user": if (isEditing) return components.UserEditComposer ?? components.EditComposer ?? components.UserMessage ?? components.Message;
|
|
@@ -73,27 +74,271 @@ const ThreadMessageByChildren = memo(({ index, children }) => {
|
|
|
73
74
|
});
|
|
74
75
|
}, (prev, next) => prev.index === next.index && prev.children === next.children);
|
|
75
76
|
ThreadMessageByChildren.displayName = "ThreadPrimitive.MessageByChildren";
|
|
76
|
-
const
|
|
77
|
-
|
|
77
|
+
const setForwardedRef = (ref, value) => {
|
|
78
|
+
if (typeof ref === "function") ref(value);
|
|
79
|
+
else if (ref) ref.current = value;
|
|
80
|
+
};
|
|
81
|
+
const useComposedFlatListRef = (forwardedRef) => {
|
|
82
|
+
const $ = c(4);
|
|
83
|
+
const flatListRef = useRef(null);
|
|
84
|
+
let t0;
|
|
85
|
+
if ($[0] !== forwardedRef) {
|
|
86
|
+
t0 = (node) => {
|
|
87
|
+
flatListRef.current = node;
|
|
88
|
+
setForwardedRef(forwardedRef, node);
|
|
89
|
+
};
|
|
90
|
+
$[0] = forwardedRef;
|
|
91
|
+
$[1] = t0;
|
|
92
|
+
} else t0 = $[1];
|
|
93
|
+
const setFlatListRef = t0;
|
|
94
|
+
let t1;
|
|
95
|
+
if ($[2] !== setFlatListRef) {
|
|
96
|
+
t1 = [flatListRef, setFlatListRef];
|
|
97
|
+
$[2] = setFlatListRef;
|
|
98
|
+
$[3] = t1;
|
|
99
|
+
} else t1 = $[3];
|
|
100
|
+
return t1;
|
|
101
|
+
};
|
|
102
|
+
const useThreadMessagesFlatListAutoScroll = (t0) => {
|
|
103
|
+
const $ = c(25);
|
|
104
|
+
const { flatListRef, hasMessages, autoScroll: t1, scrollToBottomOnRunStart: t2, scrollToBottomOnInitialize: t3, scrollToBottomOnThreadSwitch: t4 } = t0;
|
|
105
|
+
const autoScroll = t1 === void 0 ? true : t1;
|
|
106
|
+
const scrollToBottomOnRunStart = t2 === void 0 ? true : t2;
|
|
107
|
+
const scrollToBottomOnInitialize = t3 === void 0 ? true : t3;
|
|
108
|
+
const scrollToBottomOnThreadSwitch = t4 === void 0 ? true : t4;
|
|
109
|
+
let t5;
|
|
110
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
+
t5 = {
|
|
112
|
+
contentHeight: 0,
|
|
113
|
+
viewportHeight: 0,
|
|
114
|
+
scrollY: 0
|
|
115
|
+
};
|
|
116
|
+
$[0] = t5;
|
|
117
|
+
} else t5 = $[0];
|
|
118
|
+
const metricsRef = useRef(t5);
|
|
119
|
+
const isAtBottomRef = useRef(true);
|
|
120
|
+
const lastScrollEventYRef = useRef(0);
|
|
121
|
+
const initializeScrollRequestedRef = useRef(false);
|
|
122
|
+
const pendingScrollToBottomRef = useRef(false);
|
|
123
|
+
let t6;
|
|
124
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
125
|
+
t6 = () => {
|
|
126
|
+
const { contentHeight, scrollY, viewportHeight } = metricsRef.current;
|
|
127
|
+
isAtBottomRef.current = contentHeight <= viewportHeight || contentHeight - scrollY - viewportHeight <= AT_BOTTOM_THRESHOLD;
|
|
128
|
+
};
|
|
129
|
+
$[1] = t6;
|
|
130
|
+
} else t6 = $[1];
|
|
131
|
+
const updateIsAtBottom = t6;
|
|
132
|
+
let t7;
|
|
133
|
+
if ($[2] !== flatListRef) {
|
|
134
|
+
t7 = (animated) => {
|
|
135
|
+
const { contentHeight: contentHeight_0, viewportHeight: viewportHeight_0 } = metricsRef.current;
|
|
136
|
+
metricsRef.current.scrollY = Math.max(0, contentHeight_0 - viewportHeight_0);
|
|
137
|
+
isAtBottomRef.current = true;
|
|
138
|
+
flatListRef.current?.scrollToEnd({ animated });
|
|
139
|
+
};
|
|
140
|
+
$[2] = flatListRef;
|
|
141
|
+
$[3] = t7;
|
|
142
|
+
} else t7 = $[3];
|
|
143
|
+
const scrollToBottom = t7;
|
|
144
|
+
let t8;
|
|
145
|
+
if ($[4] !== autoScroll || $[5] !== scrollToBottom) {
|
|
146
|
+
t8 = (event) => {
|
|
147
|
+
const wasAtBottom = isAtBottomRef.current;
|
|
148
|
+
const previousViewportHeight = metricsRef.current.viewportHeight;
|
|
149
|
+
const viewportHeight_1 = event.nativeEvent.layout.height;
|
|
150
|
+
metricsRef.current.viewportHeight = viewportHeight_1;
|
|
151
|
+
updateIsAtBottom();
|
|
152
|
+
if (!wasAtBottom) return;
|
|
153
|
+
if (autoScroll && previousViewportHeight !== 0 && viewportHeight_1 !== previousViewportHeight) {
|
|
154
|
+
const pending = pendingScrollToBottomRef.current;
|
|
155
|
+
scrollToBottom(pending ? pending.animated : false);
|
|
156
|
+
} else isAtBottomRef.current = true;
|
|
157
|
+
};
|
|
158
|
+
$[4] = autoScroll;
|
|
159
|
+
$[5] = scrollToBottom;
|
|
160
|
+
$[6] = t8;
|
|
161
|
+
} else t8 = $[6];
|
|
162
|
+
const handleLayout = t8;
|
|
163
|
+
let t9;
|
|
164
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
165
|
+
t9 = (event_0) => {
|
|
166
|
+
const { contentOffset, contentSize, layoutMeasurement } = event_0.nativeEvent;
|
|
167
|
+
const previousEventY = lastScrollEventYRef.current;
|
|
168
|
+
const wasPinnedToBottom = isAtBottomRef.current;
|
|
169
|
+
lastScrollEventYRef.current = contentOffset.y;
|
|
170
|
+
metricsRef.current = {
|
|
171
|
+
contentHeight: contentSize.height,
|
|
172
|
+
viewportHeight: layoutMeasurement.height,
|
|
173
|
+
scrollY: contentOffset.y
|
|
174
|
+
};
|
|
175
|
+
updateIsAtBottom();
|
|
176
|
+
const upwardMove = contentOffset.y < previousEventY;
|
|
177
|
+
if (wasPinnedToBottom && !upwardMove) isAtBottomRef.current = true;
|
|
178
|
+
if (!isAtBottomRef.current && upwardMove) pendingScrollToBottomRef.current = false;
|
|
179
|
+
};
|
|
180
|
+
$[7] = t9;
|
|
181
|
+
} else t9 = $[7];
|
|
182
|
+
const handleScroll = t9;
|
|
183
|
+
let t10;
|
|
184
|
+
if ($[8] !== autoScroll || $[9] !== scrollToBottom) {
|
|
185
|
+
t10 = (_width, height) => {
|
|
186
|
+
const metrics = metricsRef.current;
|
|
187
|
+
const previousContentHeight = metrics.contentHeight;
|
|
188
|
+
const wasAtBottom_0 = isAtBottomRef.current;
|
|
189
|
+
metrics.contentHeight = height;
|
|
190
|
+
updateIsAtBottom();
|
|
191
|
+
const pendingScroll = pendingScrollToBottomRef.current;
|
|
192
|
+
if (pendingScroll) {
|
|
193
|
+
pendingScrollToBottomRef.current = false;
|
|
194
|
+
scrollToBottom(pendingScroll.animated);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (!autoScroll) return;
|
|
198
|
+
if (!wasAtBottom_0) return;
|
|
199
|
+
if (previousContentHeight === 0) return;
|
|
200
|
+
if (height <= previousContentHeight) return;
|
|
201
|
+
scrollToBottom(false);
|
|
202
|
+
};
|
|
203
|
+
$[8] = autoScroll;
|
|
204
|
+
$[9] = scrollToBottom;
|
|
205
|
+
$[10] = t10;
|
|
206
|
+
} else t10 = $[10];
|
|
207
|
+
const handleContentSizeChange = t10;
|
|
208
|
+
let t11;
|
|
209
|
+
let t12;
|
|
210
|
+
if ($[11] !== hasMessages || $[12] !== scrollToBottom || $[13] !== scrollToBottomOnInitialize) {
|
|
211
|
+
t11 = () => {
|
|
212
|
+
if (!scrollToBottomOnInitialize) return;
|
|
213
|
+
if (!hasMessages) {
|
|
214
|
+
initializeScrollRequestedRef.current = false;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (initializeScrollRequestedRef.current) return;
|
|
218
|
+
initializeScrollRequestedRef.current = true;
|
|
219
|
+
pendingScrollToBottomRef.current = { animated: false };
|
|
220
|
+
scrollToBottom(false);
|
|
221
|
+
};
|
|
222
|
+
t12 = [
|
|
223
|
+
hasMessages,
|
|
224
|
+
scrollToBottom,
|
|
225
|
+
scrollToBottomOnInitialize
|
|
226
|
+
];
|
|
227
|
+
$[11] = hasMessages;
|
|
228
|
+
$[12] = scrollToBottom;
|
|
229
|
+
$[13] = scrollToBottomOnInitialize;
|
|
230
|
+
$[14] = t11;
|
|
231
|
+
$[15] = t12;
|
|
232
|
+
} else {
|
|
233
|
+
t11 = $[14];
|
|
234
|
+
t12 = $[15];
|
|
235
|
+
}
|
|
236
|
+
useEffect(t11, t12);
|
|
237
|
+
let t13;
|
|
238
|
+
if ($[16] !== scrollToBottom || $[17] !== scrollToBottomOnRunStart) {
|
|
239
|
+
t13 = () => {
|
|
240
|
+
if (!scrollToBottomOnRunStart) return;
|
|
241
|
+
pendingScrollToBottomRef.current = { animated: true };
|
|
242
|
+
scrollToBottom(true);
|
|
243
|
+
};
|
|
244
|
+
$[16] = scrollToBottom;
|
|
245
|
+
$[17] = scrollToBottomOnRunStart;
|
|
246
|
+
$[18] = t13;
|
|
247
|
+
} else t13 = $[18];
|
|
248
|
+
useAuiEvent("thread.runStart", t13);
|
|
249
|
+
let t14;
|
|
250
|
+
if ($[19] !== scrollToBottom || $[20] !== scrollToBottomOnThreadSwitch) {
|
|
251
|
+
t14 = () => {
|
|
252
|
+
if (!scrollToBottomOnThreadSwitch) return;
|
|
253
|
+
initializeScrollRequestedRef.current = false;
|
|
254
|
+
lastScrollEventYRef.current = 0;
|
|
255
|
+
pendingScrollToBottomRef.current = { animated: false };
|
|
256
|
+
scrollToBottom(false);
|
|
257
|
+
};
|
|
258
|
+
$[19] = scrollToBottom;
|
|
259
|
+
$[20] = scrollToBottomOnThreadSwitch;
|
|
260
|
+
$[21] = t14;
|
|
261
|
+
} else t14 = $[21];
|
|
262
|
+
useAuiEvent("threadListItem.switchedTo", t14);
|
|
263
|
+
let t15;
|
|
264
|
+
if ($[22] !== handleContentSizeChange || $[23] !== handleLayout) {
|
|
265
|
+
t15 = {
|
|
266
|
+
handleLayout,
|
|
267
|
+
handleScroll,
|
|
268
|
+
handleContentSizeChange
|
|
269
|
+
};
|
|
270
|
+
$[22] = handleContentSizeChange;
|
|
271
|
+
$[23] = handleLayout;
|
|
272
|
+
$[24] = t15;
|
|
273
|
+
} else t15 = $[24];
|
|
274
|
+
return t15;
|
|
275
|
+
};
|
|
276
|
+
const ThreadMessagesFlatList = forwardRef((t0, forwardedRef) => {
|
|
277
|
+
const $ = c(46);
|
|
278
|
+
let autoScroll;
|
|
78
279
|
let children;
|
|
79
280
|
let components;
|
|
80
281
|
let flatListProps;
|
|
282
|
+
let onContentSizeChange;
|
|
283
|
+
let onLayout;
|
|
284
|
+
let onScroll;
|
|
285
|
+
let scrollEventThrottle;
|
|
286
|
+
let scrollToBottomOnInitialize;
|
|
287
|
+
let scrollToBottomOnRunStart;
|
|
288
|
+
let scrollToBottomOnThreadSwitch;
|
|
81
289
|
if ($[0] !== t0) {
|
|
82
|
-
({components, children, ...flatListProps} = t0);
|
|
290
|
+
({autoScroll, components, children, onContentSizeChange, onLayout, onScroll, scrollEventThrottle, scrollToBottomOnInitialize, scrollToBottomOnRunStart, scrollToBottomOnThreadSwitch, ...flatListProps} = t0);
|
|
83
291
|
$[0] = t0;
|
|
84
|
-
$[1] =
|
|
85
|
-
$[2] =
|
|
86
|
-
$[3] =
|
|
292
|
+
$[1] = autoScroll;
|
|
293
|
+
$[2] = children;
|
|
294
|
+
$[3] = components;
|
|
295
|
+
$[4] = flatListProps;
|
|
296
|
+
$[5] = onContentSizeChange;
|
|
297
|
+
$[6] = onLayout;
|
|
298
|
+
$[7] = onScroll;
|
|
299
|
+
$[8] = scrollEventThrottle;
|
|
300
|
+
$[9] = scrollToBottomOnInitialize;
|
|
301
|
+
$[10] = scrollToBottomOnRunStart;
|
|
302
|
+
$[11] = scrollToBottomOnThreadSwitch;
|
|
87
303
|
} else {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
304
|
+
autoScroll = $[1];
|
|
305
|
+
children = $[2];
|
|
306
|
+
components = $[3];
|
|
307
|
+
flatListProps = $[4];
|
|
308
|
+
onContentSizeChange = $[5];
|
|
309
|
+
onLayout = $[6];
|
|
310
|
+
onScroll = $[7];
|
|
311
|
+
scrollEventThrottle = $[8];
|
|
312
|
+
scrollToBottomOnInitialize = $[9];
|
|
313
|
+
scrollToBottomOnRunStart = $[10];
|
|
314
|
+
scrollToBottomOnThreadSwitch = $[11];
|
|
91
315
|
}
|
|
92
316
|
const messages = useAuiState(_temp3);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
317
|
+
const [flatListRef, setFlatListRef] = useComposedFlatListRef(forwardedRef);
|
|
318
|
+
const t1 = messages.length > 0;
|
|
319
|
+
let t2;
|
|
320
|
+
if ($[12] !== autoScroll || $[13] !== flatListRef || $[14] !== scrollToBottomOnInitialize || $[15] !== scrollToBottomOnRunStart || $[16] !== scrollToBottomOnThreadSwitch || $[17] !== t1) {
|
|
321
|
+
t2 = {
|
|
322
|
+
flatListRef,
|
|
323
|
+
hasMessages: t1,
|
|
324
|
+
autoScroll,
|
|
325
|
+
scrollToBottomOnInitialize,
|
|
326
|
+
scrollToBottomOnRunStart,
|
|
327
|
+
scrollToBottomOnThreadSwitch
|
|
328
|
+
};
|
|
329
|
+
$[12] = autoScroll;
|
|
330
|
+
$[13] = flatListRef;
|
|
331
|
+
$[14] = scrollToBottomOnInitialize;
|
|
332
|
+
$[15] = scrollToBottomOnRunStart;
|
|
333
|
+
$[16] = scrollToBottomOnThreadSwitch;
|
|
334
|
+
$[17] = t1;
|
|
335
|
+
$[18] = t2;
|
|
336
|
+
} else t2 = $[18];
|
|
337
|
+
const { handleContentSizeChange: handleAutoScrollContentSizeChange, handleLayout: handleAutoScrollLayout, handleScroll: handleAutoScrollScroll } = useThreadMessagesFlatListAutoScroll(t2);
|
|
338
|
+
let t3;
|
|
339
|
+
if ($[19] !== children || $[20] !== components) {
|
|
340
|
+
t3 = (t4) => {
|
|
341
|
+
const { index } = t4;
|
|
97
342
|
if (children) return /* @__PURE__ */ jsx(ThreadMessageByChildren, {
|
|
98
343
|
index,
|
|
99
344
|
children
|
|
@@ -103,29 +348,136 @@ const ThreadMessages = forwardRef((t0, ref) => {
|
|
|
103
348
|
components
|
|
104
349
|
});
|
|
105
350
|
};
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
} else
|
|
110
|
-
const renderItem =
|
|
351
|
+
$[19] = children;
|
|
352
|
+
$[20] = components;
|
|
353
|
+
$[21] = t3;
|
|
354
|
+
} else t3 = $[21];
|
|
355
|
+
const renderItem = t3;
|
|
111
356
|
const keyExtractor = _temp4;
|
|
112
|
-
const
|
|
113
|
-
let
|
|
114
|
-
if ($[
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
357
|
+
const scrollTracking = (autoScroll ?? true) || (scrollToBottomOnInitialize ?? true) || (scrollToBottomOnRunStart ?? true) || (scrollToBottomOnThreadSwitch ?? true);
|
|
358
|
+
let t4;
|
|
359
|
+
if ($[22] !== handleAutoScrollLayout || $[23] !== onLayout) {
|
|
360
|
+
t4 = (event) => {
|
|
361
|
+
handleAutoScrollLayout(event);
|
|
362
|
+
onLayout?.(event);
|
|
363
|
+
};
|
|
364
|
+
$[22] = handleAutoScrollLayout;
|
|
365
|
+
$[23] = onLayout;
|
|
366
|
+
$[24] = t4;
|
|
367
|
+
} else t4 = $[24];
|
|
368
|
+
const handleLayout = t4;
|
|
369
|
+
let t5;
|
|
370
|
+
if ($[25] !== handleAutoScrollScroll || $[26] !== onScroll) {
|
|
371
|
+
t5 = (event_0) => {
|
|
372
|
+
handleAutoScrollScroll(event_0);
|
|
373
|
+
onScroll?.(event_0);
|
|
374
|
+
};
|
|
375
|
+
$[25] = handleAutoScrollScroll;
|
|
376
|
+
$[26] = onScroll;
|
|
377
|
+
$[27] = t5;
|
|
378
|
+
} else t5 = $[27];
|
|
379
|
+
const handleScroll = t5;
|
|
380
|
+
let t6;
|
|
381
|
+
if ($[28] !== handleAutoScrollContentSizeChange || $[29] !== onContentSizeChange) {
|
|
382
|
+
t6 = (width, height) => {
|
|
383
|
+
handleAutoScrollContentSizeChange(width, height);
|
|
384
|
+
onContentSizeChange?.(width, height);
|
|
385
|
+
};
|
|
386
|
+
$[28] = handleAutoScrollContentSizeChange;
|
|
387
|
+
$[29] = onContentSizeChange;
|
|
388
|
+
$[30] = t6;
|
|
389
|
+
} else t6 = $[30];
|
|
390
|
+
const handleContentSizeChange = t6;
|
|
391
|
+
const t7 = messages;
|
|
392
|
+
let t8;
|
|
393
|
+
if ($[31] !== handleContentSizeChange || $[32] !== handleLayout || $[33] !== handleScroll || $[34] !== onContentSizeChange || $[35] !== onLayout || $[36] !== onScroll || $[37] !== scrollEventThrottle || $[38] !== scrollTracking) {
|
|
394
|
+
t8 = scrollTracking ? {
|
|
395
|
+
onContentSizeChange: handleContentSizeChange,
|
|
396
|
+
onLayout: handleLayout,
|
|
397
|
+
onScroll: handleScroll,
|
|
398
|
+
scrollEventThrottle: scrollEventThrottle ?? 16
|
|
399
|
+
} : {
|
|
400
|
+
...onContentSizeChange && { onContentSizeChange },
|
|
401
|
+
...onLayout && { onLayout },
|
|
402
|
+
...onScroll && { onScroll },
|
|
403
|
+
...scrollEventThrottle !== void 0 && { scrollEventThrottle }
|
|
404
|
+
};
|
|
405
|
+
$[31] = handleContentSizeChange;
|
|
406
|
+
$[32] = handleLayout;
|
|
407
|
+
$[33] = handleScroll;
|
|
408
|
+
$[34] = onContentSizeChange;
|
|
409
|
+
$[35] = onLayout;
|
|
410
|
+
$[36] = onScroll;
|
|
411
|
+
$[37] = scrollEventThrottle;
|
|
412
|
+
$[38] = scrollTracking;
|
|
413
|
+
$[39] = t8;
|
|
414
|
+
} else t8 = $[39];
|
|
415
|
+
let t9;
|
|
416
|
+
if ($[40] !== flatListProps || $[41] !== renderItem || $[42] !== setFlatListRef || $[43] !== t7 || $[44] !== t8) {
|
|
417
|
+
t9 = /* @__PURE__ */ jsx(FlatList, {
|
|
418
|
+
ref: setFlatListRef,
|
|
419
|
+
data: t7,
|
|
118
420
|
renderItem,
|
|
119
421
|
keyExtractor,
|
|
422
|
+
...t8,
|
|
120
423
|
...flatListProps
|
|
121
424
|
});
|
|
122
|
-
$[
|
|
425
|
+
$[40] = flatListProps;
|
|
426
|
+
$[41] = renderItem;
|
|
427
|
+
$[42] = setFlatListRef;
|
|
428
|
+
$[43] = t7;
|
|
429
|
+
$[44] = t8;
|
|
430
|
+
$[45] = t9;
|
|
431
|
+
} else t9 = $[45];
|
|
432
|
+
return t9;
|
|
433
|
+
});
|
|
434
|
+
ThreadMessagesFlatList.displayName = "ThreadPrimitive.MessagesFlatList";
|
|
435
|
+
/** @deprecated Use ThreadPrimitive.MessagesFlatList instead. */
|
|
436
|
+
const ThreadMessages = forwardRef((t0, ref) => {
|
|
437
|
+
const $ = c(13);
|
|
438
|
+
let props;
|
|
439
|
+
let t1;
|
|
440
|
+
let t2;
|
|
441
|
+
let t3;
|
|
442
|
+
let t4;
|
|
443
|
+
if ($[0] !== t0) {
|
|
444
|
+
({autoScroll: t1, scrollToBottomOnInitialize: t2, scrollToBottomOnRunStart: t3, scrollToBottomOnThreadSwitch: t4, ...props} = t0);
|
|
445
|
+
$[0] = t0;
|
|
446
|
+
$[1] = props;
|
|
447
|
+
$[2] = t1;
|
|
448
|
+
$[3] = t2;
|
|
449
|
+
$[4] = t3;
|
|
450
|
+
$[5] = t4;
|
|
451
|
+
} else {
|
|
452
|
+
props = $[1];
|
|
453
|
+
t1 = $[2];
|
|
454
|
+
t2 = $[3];
|
|
455
|
+
t3 = $[4];
|
|
456
|
+
t4 = $[5];
|
|
457
|
+
}
|
|
458
|
+
const autoScroll = t1 === void 0 ? false : t1;
|
|
459
|
+
const scrollToBottomOnInitialize = t2 === void 0 ? false : t2;
|
|
460
|
+
const scrollToBottomOnRunStart = t3 === void 0 ? false : t3;
|
|
461
|
+
const scrollToBottomOnThreadSwitch = t4 === void 0 ? false : t4;
|
|
462
|
+
let t5;
|
|
463
|
+
if ($[6] !== autoScroll || $[7] !== props || $[8] !== ref || $[9] !== scrollToBottomOnInitialize || $[10] !== scrollToBottomOnRunStart || $[11] !== scrollToBottomOnThreadSwitch) {
|
|
464
|
+
t5 = /* @__PURE__ */ jsx(ThreadMessagesFlatList, {
|
|
465
|
+
ref,
|
|
466
|
+
autoScroll,
|
|
467
|
+
scrollToBottomOnInitialize,
|
|
468
|
+
scrollToBottomOnRunStart,
|
|
469
|
+
scrollToBottomOnThreadSwitch,
|
|
470
|
+
...props
|
|
471
|
+
});
|
|
472
|
+
$[6] = autoScroll;
|
|
473
|
+
$[7] = props;
|
|
123
474
|
$[8] = ref;
|
|
124
|
-
$[9] =
|
|
125
|
-
$[10] =
|
|
126
|
-
$[11] =
|
|
127
|
-
|
|
128
|
-
|
|
475
|
+
$[9] = scrollToBottomOnInitialize;
|
|
476
|
+
$[10] = scrollToBottomOnRunStart;
|
|
477
|
+
$[11] = scrollToBottomOnThreadSwitch;
|
|
478
|
+
$[12] = t5;
|
|
479
|
+
} else t5 = $[12];
|
|
480
|
+
return t5;
|
|
129
481
|
});
|
|
130
482
|
ThreadMessages.displayName = "ThreadPrimitive.Messages";
|
|
131
483
|
function _temp(s) {
|
|
@@ -141,6 +493,6 @@ function _temp4(item) {
|
|
|
141
493
|
return item.id;
|
|
142
494
|
}
|
|
143
495
|
//#endregion
|
|
144
|
-
export { ThreadMessages };
|
|
496
|
+
export { ThreadMessages, ThreadMessagesFlatList };
|
|
145
497
|
|
|
146
498
|
//# sourceMappingURL=ThreadMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ReactNode","forwardRef","memo","useCallback","FlatList","FlatListProps","MessageState","ThreadMessage","RenderChildrenWithAccessor","useAuiState","MessageByIndexProvider","MessageComponents","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","MessagesContent","components","children","value","message","ThreadMessagesProps","Omit","DEFAULT_SYSTEM_MESSAGE","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadMessageByIndex","index","prev","next","displayName","ThreadMessageByChildren","aui","thread","getState","getItem","ThreadMessages","ref","flatListProps","messages","_temp3","renderItem","keyExtractor","_temp4","t3","s","s_0","composer","item","id"],"sources":["../../../src/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ReactNode,\n forwardRef,\n memo,\n useCallback,\n} from \"react\";\nimport { FlatList, type FlatListProps } from \"react-native\";\nimport type { MessageState, ThreadMessage } from \"@assistant-ui/core\";\nimport { RenderChildrenWithAccessor, useAuiState } from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"@assistant-ui/core/react\";\n\ntype MessageComponents =\n | {\n Message: ComponentType;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n SystemMessage?: ComponentType | undefined;\n }\n | {\n Message?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage: ComponentType;\n AssistantMessage: ComponentType;\n SystemMessage?: ComponentType | undefined;\n };\n\ntype MessagesContent =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageComponents;\n children?: never;\n }\n | {\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n\nexport type ThreadMessagesProps = Omit<\n FlatListProps<ThreadMessage>,\n \"data\" | \"renderItem\" | \"children\"\n> &\n MessagesContent;\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\n\nconst getComponent = (\n components: MessageComponents,\n role: ThreadMessage[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\nconst ThreadMessageComponent: FC<{ components: MessageComponents }> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\n\nconst ThreadMessageByIndex = memo(\n ({ index, components }: { index: number; components: MessageComponents }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index && prev.components === next.components,\n);\nThreadMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nconst ThreadMessageByChildren = memo(\n ({\n index,\n children,\n }: {\n index: number;\n children: (value: { message: MessageState }) => ReactNode;\n }) => {\n return (\n <MessageByIndexProvider index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread().message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n );\n },\n (prev, next) => prev.index === next.index && prev.children === next.children,\n);\nThreadMessageByChildren.displayName = \"ThreadPrimitive.MessageByChildren\";\n\nexport const ThreadMessages = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesProps\n>(({ components, children, ...flatListProps }, ref) => {\n const messages = useAuiState((s) => s.thread.messages);\n\n const renderItem = useCallback(\n ({ index }: { item: ThreadMessage; index: number }) => {\n if (children) {\n return (\n <ThreadMessageByChildren index={index}>\n {children}\n </ThreadMessageByChildren>\n );\n }\n return <ThreadMessageByIndex index={index} components={components!} />;\n },\n [components, children],\n );\n\n const keyExtractor = useCallback((item: ThreadMessage) => item.id, []);\n\n return (\n <FlatList\n ref={ref}\n data={messages as unknown as ThreadMessage[]}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n {...flatListProps}\n />\n );\n});\nThreadMessages.displayName = \"ThreadPrimitive.Messages\";\n"],"mappings":";;;;;;;AAoDA,MAAM6B,+BAA+B;AAErC,MAAMC,gBACJP,YACAQ,MACAC,cACG;CACH,QAAQD,MAAR;EACE,KAAK,QACH,IAAIC,WACF,OACET,WAAWP,oBACXO,WAAWR,gBACXQ,WAAWJ,eACVI,WAAWT;OAGd,OAAOS,WAAWJ,eAAgBI,WAAWT;EAEjD,KAAK,aACH,IAAIkB,WACF,OACET,WAAWN,yBACXM,WAAWR,gBACX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AA;GAI3B,OACM,oBAAC,sBAAD;IAA6BqB;IAAmBtB;GAAU,CAAA;EAAK;EACvEc,EAAA,KAAAb;EAAAa,EAAA,KAAAd;EAAAc,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAVH,MAAAsB,aAAmBlB;CAcnB,MAAAmB,eAAqBC;CAKX,MAAAlB,KAAAc;CAAsC,IAAAK;CAAA,IAAAzB,EAAA,OAAAmB,iBAAAnB,EAAA,OAAAkB,OAAAlB,EAAA,OAAAsB,cAAAtB,EAAA,QAAAM,IAAA;EAF9CmB,KAAA,oBAAC,UAAD;GACOP;GACC,MAAAZ;GACMgB;GACEC;GAAY,GACtBJ;EAAa,CAAA;EACjBnB,EAAA,KAAAmB;EAAAnB,EAAA,KAAAkB;EAAAlB,EAAA,KAAAsB;EAAAtB,EAAA,MAAAM;EAAAN,EAAA,MAAAyB;CAAA,OAAAA,KAAAzB,EAAA;CAAA,OANFyB;AAME,CAEL;AACDR,eAAeN,cAAc;AAnFyC,SAAAT,MAAAwB,GAAA;CAAA,OAGpCA,EAACrC,QAAQK;AAAK;AAHsB,SAAAS,OAAAwB,KAAA;CAAA,OAI/BD,IAACrC,QAAQuC,SAASjC;AAAU;AAkDjE,SAAA0B,OAAAK,GAAA;CAAA,OACoCA,EAACZ,OAAOM;AAAS;AADrD,SAAAI,OAAAK,MAAA;CAAA,OAiB0DA,KAAIC;AAAG"}
|
|
1
|
+
{"version":3,"file":"ThreadMessages.js","names":["ComponentType","FC","ForwardedRef","ReactNode","RefObject","forwardRef","memo","useCallback","useEffect","useRef","FlatList","FlatListProps","LayoutChangeEvent","NativeScrollEvent","NativeSyntheticEvent","MessageState","ThreadMessage","RenderChildrenWithAccessor","useAuiEvent","useAuiState","MessageByIndexProvider","MessageComponents","Message","EditComposer","UserEditComposer","AssistantEditComposer","SystemEditComposer","UserMessage","AssistantMessage","SystemMessage","MessagesContent","components","children","value","message","ThreadMessagesFlatListProps","Omit","autoScroll","scrollToBottomOnRunStart","scrollToBottomOnInitialize","scrollToBottomOnThreadSwitch","ThreadMessagesProps","DEFAULT_SYSTEM_MESSAGE","AT_BOTTOM_THRESHOLD","getComponent","role","isEditing","_exhaustiveCheck","Error","ThreadMessageComponent","t0","$","_c","_temp","_temp2","t1","Component","t2","ThreadMessageByIndex","index","prev","next","displayName","ThreadMessageByChildren","aui","thread","getState","getItem","setForwardedRef","ref","T","current","useComposedFlatListRef","forwardedRef","flatListRef","node","setFlatListRef","const","useThreadMessagesFlatListAutoScroll","hasMessages","t3","t4","undefined","t5","Symbol","for","contentHeight","viewportHeight","scrollY","metricsRef","isAtBottomRef","lastScrollEventYRef","initializeScrollRequestedRef","pendingScrollToBottomRef","t6","updateIsAtBottom","t7","animated","contentHeight_0","viewportHeight_0","Math","max","scrollToEnd","scrollToBottom","t8","event","wasAtBottom","previousViewportHeight","viewportHeight_1","nativeEvent","layout","height","pending","handleLayout","t9","event_0","contentOffset","contentSize","layoutMeasurement","previousEventY","wasPinnedToBottom","y","upwardMove","handleScroll","t10","_width","metrics","previousContentHeight","wasAtBottom_0","pendingScroll","handleContentSizeChange","t11","t12","t13","t14","t15","ThreadMessagesFlatList","flatListProps","onContentSizeChange","onLayout","onScroll","scrollEventThrottle","messages","_temp3","length","handleAutoScrollContentSizeChange","handleAutoScrollLayout","handleAutoScrollScroll","renderItem","keyExtractor","_temp4","scrollTracking","width","ThreadMessages","props","s","s_0","composer","item","id"],"sources":["../../../src/primitives/thread/ThreadMessages.tsx"],"sourcesContent":["import {\n type ComponentType,\n type FC,\n type ForwardedRef,\n type ReactNode,\n type RefObject,\n forwardRef,\n memo,\n useCallback,\n useEffect,\n useRef,\n} from \"react\";\nimport {\n FlatList,\n type FlatListProps,\n type LayoutChangeEvent,\n type NativeScrollEvent,\n type NativeSyntheticEvent,\n} from \"react-native\";\nimport type { MessageState, ThreadMessage } from \"@assistant-ui/core\";\nimport {\n RenderChildrenWithAccessor,\n useAuiEvent,\n useAuiState,\n} from \"@assistant-ui/store\";\nimport { MessageByIndexProvider } from \"@assistant-ui/core/react\";\n\ntype MessageComponents =\n | {\n Message: ComponentType;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage?: ComponentType | undefined;\n AssistantMessage?: ComponentType | undefined;\n SystemMessage?: ComponentType | undefined;\n }\n | {\n Message?: ComponentType | undefined;\n EditComposer?: ComponentType | undefined;\n UserEditComposer?: ComponentType | undefined;\n AssistantEditComposer?: ComponentType | undefined;\n SystemEditComposer?: ComponentType | undefined;\n UserMessage: ComponentType;\n AssistantMessage: ComponentType;\n SystemMessage?: ComponentType | undefined;\n };\n\ntype MessagesContent =\n | {\n /** @deprecated Use the children render function instead. */\n components: MessageComponents;\n children?: never;\n }\n | {\n children: (value: { message: MessageState }) => ReactNode;\n components?: never;\n };\n\nexport type ThreadMessagesFlatListProps = Omit<\n FlatListProps<ThreadMessage>,\n \"data\" | \"renderItem\" | \"children\"\n> &\n MessagesContent & {\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n };\n\n/** @deprecated Use ThreadMessagesFlatListProps instead. */\nexport type ThreadMessagesProps = ThreadMessagesFlatListProps;\n\nconst DEFAULT_SYSTEM_MESSAGE = () => null;\nconst AT_BOTTOM_THRESHOLD = 4;\n\nconst getComponent = (\n components: MessageComponents,\n role: ThreadMessage[\"role\"],\n isEditing: boolean,\n) => {\n switch (role) {\n case \"user\":\n if (isEditing) {\n return (\n components.UserEditComposer ??\n components.EditComposer ??\n components.UserMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return components.UserMessage ?? (components.Message as ComponentType);\n }\n case \"assistant\":\n if (isEditing) {\n return (\n components.AssistantEditComposer ??\n components.EditComposer ??\n components.AssistantMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.AssistantMessage ?? (components.Message as ComponentType)\n );\n }\n case \"system\":\n if (isEditing) {\n return (\n components.SystemEditComposer ??\n components.EditComposer ??\n components.SystemMessage ??\n (components.Message as ComponentType)\n );\n } else {\n return (\n components.SystemMessage ??\n (components.Message as ComponentType) ??\n DEFAULT_SYSTEM_MESSAGE\n );\n }\n default: {\n const _exhaustiveCheck: never = role;\n throw new Error(`Unknown message role: ${_exhaustiveCheck}`);\n }\n }\n};\n\nconst ThreadMessageComponent: FC<{ components: MessageComponents }> = ({\n components,\n}) => {\n const role = useAuiState((s) => s.message.role);\n const isEditing = useAuiState((s) => s.message.composer.isEditing);\n const Component = getComponent(components, role, isEditing);\n\n return <Component />;\n};\n\nconst ThreadMessageByIndex = memo(\n ({ index, components }: { index: number; components: MessageComponents }) => {\n return (\n <MessageByIndexProvider index={index}>\n <ThreadMessageComponent components={components} />\n </MessageByIndexProvider>\n );\n },\n (prev, next) =>\n prev.index === next.index && prev.components === next.components,\n);\nThreadMessageByIndex.displayName = \"ThreadPrimitive.MessageByIndex\";\n\nconst ThreadMessageByChildren = memo(\n ({\n index,\n children,\n }: {\n index: number;\n children: (value: { message: MessageState }) => ReactNode;\n }) => {\n return (\n <MessageByIndexProvider index={index}>\n <RenderChildrenWithAccessor\n getItemState={(aui) => aui.thread().message({ index }).getState()}\n >\n {(getItem) =>\n children({\n get message() {\n return getItem();\n },\n })\n }\n </RenderChildrenWithAccessor>\n </MessageByIndexProvider>\n );\n },\n (prev, next) => prev.index === next.index && prev.children === next.children,\n);\nThreadMessageByChildren.displayName = \"ThreadPrimitive.MessageByChildren\";\n\nconst setForwardedRef = <T,>(ref: ForwardedRef<T>, value: T | null) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref) {\n ref.current = value;\n }\n};\n\nconst useComposedFlatListRef = (\n forwardedRef: ForwardedRef<FlatList<ThreadMessage>>,\n) => {\n const flatListRef = useRef<FlatList<ThreadMessage> | null>(null);\n\n const setFlatListRef = useCallback(\n (node: FlatList<ThreadMessage> | null) => {\n flatListRef.current = node;\n setForwardedRef(forwardedRef, node);\n },\n [forwardedRef],\n );\n\n return [flatListRef, setFlatListRef] as const;\n};\n\nconst useThreadMessagesFlatListAutoScroll = ({\n flatListRef,\n hasMessages,\n autoScroll = true,\n scrollToBottomOnRunStart = true,\n scrollToBottomOnInitialize = true,\n scrollToBottomOnThreadSwitch = true,\n}: {\n flatListRef: RefObject<FlatList<ThreadMessage> | null>;\n hasMessages: boolean;\n autoScroll?: boolean | undefined;\n scrollToBottomOnRunStart?: boolean | undefined;\n scrollToBottomOnInitialize?: boolean | undefined;\n scrollToBottomOnThreadSwitch?: boolean | undefined;\n}) => {\n const metricsRef = useRef({\n contentHeight: 0,\n viewportHeight: 0,\n scrollY: 0,\n });\n const isAtBottomRef = useRef(true);\n const lastScrollEventYRef = useRef(0);\n const initializeScrollRequestedRef = useRef(false);\n const pendingScrollToBottomRef = useRef<false | { animated: boolean }>(false);\n\n const updateIsAtBottom = useCallback(() => {\n const { contentHeight, scrollY, viewportHeight } = metricsRef.current;\n isAtBottomRef.current =\n contentHeight <= viewportHeight ||\n contentHeight - scrollY - viewportHeight <= AT_BOTTOM_THRESHOLD;\n }, []);\n\n // Commanding a scroll records the intended position immediately; the\n // native scroll echo is bridged and throttled, so waiting for it lets a\n // fast stream observe stale metrics and drop out of following.\n const scrollToBottom = useCallback(\n (animated: boolean) => {\n const { contentHeight, viewportHeight } = metricsRef.current;\n metricsRef.current.scrollY = Math.max(0, contentHeight - viewportHeight);\n isAtBottomRef.current = true;\n flatListRef.current?.scrollToEnd({ animated });\n },\n [flatListRef],\n );\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n const wasAtBottom = isAtBottomRef.current;\n const previousViewportHeight = metricsRef.current.viewportHeight;\n const viewportHeight = event.nativeEvent.layout.height;\n metricsRef.current.viewportHeight = viewportHeight;\n updateIsAtBottom();\n if (!wasAtBottom) return;\n // Layout changes are never user gestures, so they must not unpin. Past\n // the first measurement, a viewport change while pinned re-commands the\n // bottom position, since no content-size event follows a bare keyboard\n // open or close.\n if (\n autoScroll &&\n previousViewportHeight !== 0 &&\n viewportHeight !== previousViewportHeight\n ) {\n const pending = pendingScrollToBottomRef.current;\n scrollToBottom(pending ? pending.animated : false);\n } else {\n isAtBottomRef.current = true;\n }\n },\n [autoScroll, scrollToBottom, updateIsAtBottom],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n const { contentOffset, contentSize, layoutMeasurement } =\n event.nativeEvent;\n const previousEventY = lastScrollEventYRef.current;\n const wasPinnedToBottom = isAtBottomRef.current;\n lastScrollEventYRef.current = contentOffset.y;\n metricsRef.current = {\n contentHeight: contentSize.height,\n viewportHeight: layoutMeasurement.height,\n scrollY: contentOffset.y,\n };\n updateIsAtBottom();\n const upwardMove = contentOffset.y < previousEventY;\n // Only a deliberate upward move unpins or cancels a pending scroll.\n // Gestures are detected echo-to-echo because a commanded scroll\n // optimistically moves the tracked position ahead of its ascending\n // animation echoes, and those echoes must not unpin mid-flight.\n if (wasPinnedToBottom && !upwardMove) {\n isAtBottomRef.current = true;\n }\n if (!isAtBottomRef.current && upwardMove) {\n pendingScrollToBottomRef.current = false;\n }\n },\n [updateIsAtBottom],\n );\n\n const handleContentSizeChange = useCallback(\n (_width: number, height: number) => {\n const metrics = metricsRef.current;\n const previousContentHeight = metrics.contentHeight;\n const wasAtBottom = isAtBottomRef.current;\n metrics.contentHeight = height;\n updateIsAtBottom();\n\n // FlatList.scrollToEnd is a no-op before the list has measured, so the\n // initialize and thread-switch scrolls land on the next content-size\n // event, once real metrics exist.\n const pendingScroll = pendingScrollToBottomRef.current;\n if (pendingScroll) {\n pendingScrollToBottomRef.current = false;\n scrollToBottom(pendingScroll.animated);\n return;\n }\n\n if (!autoScroll) return;\n if (!wasAtBottom) return;\n if (previousContentHeight === 0) return;\n if (height <= previousContentHeight) return;\n\n scrollToBottom(false);\n },\n [autoScroll, scrollToBottom, updateIsAtBottom],\n );\n\n useEffect(() => {\n if (!scrollToBottomOnInitialize) return;\n if (!hasMessages) {\n initializeScrollRequestedRef.current = false;\n return;\n }\n if (initializeScrollRequestedRef.current) return;\n\n initializeScrollRequestedRef.current = true;\n pendingScrollToBottomRef.current = { animated: false };\n scrollToBottom(false);\n }, [hasMessages, scrollToBottom, scrollToBottomOnInitialize]);\n\n useAuiEvent(\"thread.runStart\", () => {\n if (!scrollToBottomOnRunStart) return;\n pendingScrollToBottomRef.current = { animated: true };\n scrollToBottom(true);\n });\n\n useAuiEvent(\"threadListItem.switchedTo\", () => {\n if (!scrollToBottomOnThreadSwitch) return;\n initializeScrollRequestedRef.current = false;\n lastScrollEventYRef.current = 0;\n pendingScrollToBottomRef.current = { animated: false };\n scrollToBottom(false);\n });\n\n return {\n handleLayout,\n handleScroll,\n handleContentSizeChange,\n };\n};\n\nexport const ThreadMessagesFlatList = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesFlatListProps\n>(\n (\n {\n autoScroll,\n components,\n children,\n onContentSizeChange,\n onLayout,\n onScroll,\n scrollEventThrottle,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n ...flatListProps\n },\n forwardedRef,\n ) => {\n const messages = useAuiState((s) => s.thread.messages);\n const [flatListRef, setFlatListRef] = useComposedFlatListRef(forwardedRef);\n const {\n handleContentSizeChange: handleAutoScrollContentSizeChange,\n handleLayout: handleAutoScrollLayout,\n handleScroll: handleAutoScrollScroll,\n } = useThreadMessagesFlatListAutoScroll({\n flatListRef,\n hasMessages: messages.length > 0,\n autoScroll,\n scrollToBottomOnInitialize,\n scrollToBottomOnRunStart,\n scrollToBottomOnThreadSwitch,\n });\n\n const renderItem = useCallback(\n ({ index }: { item: ThreadMessage; index: number }) => {\n if (children) {\n return (\n <ThreadMessageByChildren index={index}>\n {children}\n </ThreadMessageByChildren>\n );\n }\n return <ThreadMessageByIndex index={index} components={components!} />;\n },\n [components, children],\n );\n\n const keyExtractor = useCallback((item: ThreadMessage) => item.id, []);\n\n const scrollTracking =\n (autoScroll ?? true) ||\n (scrollToBottomOnInitialize ?? true) ||\n (scrollToBottomOnRunStart ?? true) ||\n (scrollToBottomOnThreadSwitch ?? true);\n\n const handleLayout = useCallback(\n (event: LayoutChangeEvent) => {\n handleAutoScrollLayout(event);\n onLayout?.(event);\n },\n [handleAutoScrollLayout, onLayout],\n );\n\n const handleScroll = useCallback(\n (event: NativeSyntheticEvent<NativeScrollEvent>) => {\n handleAutoScrollScroll(event);\n onScroll?.(event);\n },\n [handleAutoScrollScroll, onScroll],\n );\n\n const handleContentSizeChange = useCallback(\n (width: number, height: number) => {\n handleAutoScrollContentSizeChange(width, height);\n onContentSizeChange?.(width, height);\n },\n [handleAutoScrollContentSizeChange, onContentSizeChange],\n );\n\n return (\n <FlatList\n ref={setFlatListRef}\n data={messages as unknown as ThreadMessage[]}\n renderItem={renderItem}\n keyExtractor={keyExtractor}\n {...(scrollTracking\n ? {\n onContentSizeChange: handleContentSizeChange,\n onLayout: handleLayout,\n onScroll: handleScroll,\n scrollEventThrottle: scrollEventThrottle ?? 16,\n }\n : {\n ...(onContentSizeChange && { onContentSizeChange }),\n ...(onLayout && { onLayout }),\n ...(onScroll && { onScroll }),\n ...(scrollEventThrottle !== undefined && { scrollEventThrottle }),\n })}\n {...flatListProps}\n />\n );\n },\n);\nThreadMessagesFlatList.displayName = \"ThreadPrimitive.MessagesFlatList\";\n\n/** @deprecated Use ThreadPrimitive.MessagesFlatList instead. */\nexport const ThreadMessages = forwardRef<\n FlatList<ThreadMessage>,\n ThreadMessagesProps\n>(\n (\n {\n autoScroll = false,\n scrollToBottomOnInitialize = false,\n scrollToBottomOnRunStart = false,\n scrollToBottomOnThreadSwitch = false,\n ...props\n },\n ref,\n ) => (\n <ThreadMessagesFlatList\n ref={ref}\n autoScroll={autoScroll}\n scrollToBottomOnInitialize={scrollToBottomOnInitialize}\n scrollToBottomOnRunStart={scrollToBottomOnRunStart}\n scrollToBottom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AAzB;CACA,MAAAnB,2BAAA0C,OAAAE,KAAAA,IAAA,QAAAF;CACA,MAAAxC,+BAAAyC,OAAAC,KAAAA,IAAA,QAAAD;CAAoC,IAAAE;CAAA,IAAAhC,EAAA,OAAAd,cAAAc,EAAA,OAAAuG,SAAAvG,EAAA,OAAAkB,OAAAlB,EAAA,OAAAZ,8BAAAY,EAAA,QAAAb,4BAAAa,EAAA,QAAAX,8BAAA;EAKtC2C,KAAA,oBAAC,wBAAD;GACOd;GACOhC;GACgBE;GACFD;GACIE;GAA4B,GACtDkH;EAAK,CAAA;EACTvG,EAAA,KAAAd;EAAAc,EAAA,KAAAuG;EAAAvG,EAAA,KAAAkB;EAAAlB,EAAA,KAAAZ;EAAAY,EAAA,MAAAb;EAAAa,EAAA,MAAAX;EAAAW,EAAA,MAAAgC;CAAA,OAAAA,KAAAhC,EAAA;CAAA,OAPFgC;AAOE,CAEN;AACAsE,eAAe3F,cAAc;AAhXyC,SAAAT,MAAAsG,GAAA;CAAA,OAGpCA,EAACzH,QAAQW;AAAK;AAHsB,SAAAS,OAAAsG,KAAA;CAAA,OAI/BD,IAACzH,QAAQ2H,SAAS/G;AAAU;AA4OjE,SAAAiG,OAAAY,GAAA;CAAA,OAgBsCA,EAAC1F,OAAO6E;AAAS;AAhBvD,SAAAQ,OAAAQ,MAAA;CAAA,OA6C4DA,KAAIC;AAAG"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ThreadRoot, ThreadRootProps } from "./thread/ThreadRoot.js";
|
|
2
|
-
import { ThreadMessages, ThreadMessagesProps } from "./thread/ThreadMessages.js";
|
|
2
|
+
import { ThreadMessages, ThreadMessagesFlatList, ThreadMessagesFlatListProps, ThreadMessagesProps } from "./thread/ThreadMessages.js";
|
|
3
3
|
import { ThreadEmpty, ThreadEmptyProps } from "./thread/ThreadEmpty.js";
|
|
4
4
|
import { ThreadIf, ThreadIfProps } from "./thread/ThreadIf.js";
|
|
5
5
|
import { ThreadSuggestion, ThreadSuggestionProps } from "./thread/ThreadSuggestion.js";
|
|
6
6
|
import { ThreadPrimitiveMessageByIndex as MessageByIndex, ThreadPrimitiveSuggestionByIndex as SuggestionByIndex, ThreadPrimitiveSuggestions as Suggestions, ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from "@assistant-ui/core/react";
|
|
7
7
|
declare namespace thread_d_exports {
|
|
8
|
-
export { ThreadEmpty as Empty, ThreadEmptyProps as EmptyProps, ThreadIf as If, ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, ThreadMessagesProps as MessagesProps, ThreadRoot as Root, ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById };
|
|
8
|
+
export { ThreadEmpty as Empty, ThreadEmptyProps as EmptyProps, ThreadIf as If, ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, ThreadMessagesFlatList as MessagesFlatList, ThreadMessagesFlatListProps as MessagesFlatListProps, ThreadMessagesProps as MessagesProps, ThreadRoot as Root, ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById };
|
|
9
9
|
}
|
|
10
10
|
//#endregion
|
|
11
|
-
export { ThreadEmpty as Empty, type ThreadEmptyProps as EmptyProps, ThreadIf as If, type ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, type ThreadMessagesProps as MessagesProps, ThreadRoot as Root, type ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, type ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById, thread_d_exports };
|
|
11
|
+
export { ThreadEmpty as Empty, type ThreadEmptyProps as EmptyProps, ThreadIf as If, type ThreadIfProps as IfProps, MessageByIndex, ThreadMessages as Messages, ThreadMessagesFlatList as MessagesFlatList, type ThreadMessagesFlatListProps as MessagesFlatListProps, type ThreadMessagesProps as MessagesProps, ThreadRoot as Root, type ThreadRootProps as RootProps, ThreadSuggestion as Suggestion, SuggestionByIndex, type ThreadSuggestionProps as SuggestionProps, Suggestions, Unstable_MessageById, thread_d_exports };
|
|
12
12
|
//# sourceMappingURL=thread.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { ThreadRoot } from "./thread/ThreadRoot.js";
|
|
3
|
-
import { ThreadMessages } from "./thread/ThreadMessages.js";
|
|
3
|
+
import { ThreadMessages, ThreadMessagesFlatList } from "./thread/ThreadMessages.js";
|
|
4
4
|
import { ThreadEmpty } from "./thread/ThreadEmpty.js";
|
|
5
5
|
import { ThreadIf } from "./thread/ThreadIf.js";
|
|
6
6
|
import { ThreadSuggestion } from "./thread/ThreadSuggestion.js";
|
|
@@ -11,6 +11,7 @@ var thread_exports = /* @__PURE__ */ __exportAll({
|
|
|
11
11
|
If: () => ThreadIf,
|
|
12
12
|
MessageByIndex: () => MessageByIndex,
|
|
13
13
|
Messages: () => ThreadMessages,
|
|
14
|
+
MessagesFlatList: () => ThreadMessagesFlatList,
|
|
14
15
|
Root: () => ThreadRoot,
|
|
15
16
|
Suggestion: () => ThreadSuggestion,
|
|
16
17
|
SuggestionByIndex: () => SuggestionByIndex,
|
|
@@ -18,6 +19,6 @@ var thread_exports = /* @__PURE__ */ __exportAll({
|
|
|
18
19
|
Unstable_MessageById: () => Unstable_MessageById
|
|
19
20
|
});
|
|
20
21
|
//#endregion
|
|
21
|
-
export { ThreadEmpty as Empty, ThreadIf as If, MessageByIndex, ThreadMessages as Messages, ThreadRoot as Root, ThreadSuggestion as Suggestion, SuggestionByIndex, Suggestions, Unstable_MessageById, thread_exports };
|
|
22
|
+
export { ThreadEmpty as Empty, ThreadIf as If, MessageByIndex, ThreadMessages as Messages, ThreadMessagesFlatList as MessagesFlatList, ThreadRoot as Root, ThreadSuggestion as Suggestion, SuggestionByIndex, Suggestions, Unstable_MessageById, thread_exports };
|
|
22
23
|
|
|
23
24
|
//# sourceMappingURL=thread.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread.js","names":["ThreadRoot","Root","ThreadRootProps","RootProps","ThreadMessages","Messages","ThreadMessagesProps","MessagesProps","ThreadPrimitiveMessageByIndex","MessageByIndex","ThreadPrimitiveUnstable_MessageById","Unstable_MessageById","ThreadEmpty","Empty","ThreadEmptyProps","EmptyProps","ThreadIf","If","ThreadIfProps","IfProps","ThreadSuggestion","Suggestion","ThreadSuggestionProps","SuggestionProps","ThreadPrimitiveSuggestions","Suggestions","ThreadPrimitiveSuggestionByIndex","SuggestionByIndex"],"sources":["../../src/primitives/thread.ts"],"sourcesContent":["export {\n ThreadRoot as Root,\n type ThreadRootProps as RootProps,\n} from \"./thread/ThreadRoot\";\nexport {\n ThreadMessages as Messages,\n type ThreadMessagesProps as MessagesProps,\n} from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveMessageByIndex as MessageByIndex } from \"@assistant-ui/core/react\";\nexport { ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from \"@assistant-ui/core/react\";\nexport {\n ThreadEmpty as Empty,\n type ThreadEmptyProps as EmptyProps,\n} from \"./thread/ThreadEmpty\";\nexport {\n ThreadIf as If,\n type ThreadIfProps as IfProps,\n} from \"./thread/ThreadIf\";\nexport {\n ThreadSuggestion as Suggestion,\n type ThreadSuggestionProps as SuggestionProps,\n} from \"./thread/ThreadSuggestion\";\nexport {\n ThreadPrimitiveSuggestions as Suggestions,\n ThreadPrimitiveSuggestionByIndex as SuggestionByIndex,\n} from \"@assistant-ui/core/react\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"thread.js","names":["ThreadRoot","Root","ThreadRootProps","RootProps","ThreadMessagesFlatList","MessagesFlatList","ThreadMessagesFlatListProps","MessagesFlatListProps","ThreadMessages","Messages","ThreadMessagesProps","MessagesProps","ThreadPrimitiveMessageByIndex","MessageByIndex","ThreadPrimitiveUnstable_MessageById","Unstable_MessageById","ThreadEmpty","Empty","ThreadEmptyProps","EmptyProps","ThreadIf","If","ThreadIfProps","IfProps","ThreadSuggestion","Suggestion","ThreadSuggestionProps","SuggestionProps","ThreadPrimitiveSuggestions","Suggestions","ThreadPrimitiveSuggestionByIndex","SuggestionByIndex"],"sources":["../../src/primitives/thread.ts"],"sourcesContent":["export {\n ThreadRoot as Root,\n type ThreadRootProps as RootProps,\n} from \"./thread/ThreadRoot\";\nexport {\n ThreadMessagesFlatList as MessagesFlatList,\n type ThreadMessagesFlatListProps as MessagesFlatListProps,\n ThreadMessages as Messages,\n type ThreadMessagesProps as MessagesProps,\n} from \"./thread/ThreadMessages\";\nexport { ThreadPrimitiveMessageByIndex as MessageByIndex } from \"@assistant-ui/core/react\";\nexport { ThreadPrimitiveUnstable_MessageById as Unstable_MessageById } from \"@assistant-ui/core/react\";\nexport {\n ThreadEmpty as Empty,\n type ThreadEmptyProps as EmptyProps,\n} from \"./thread/ThreadEmpty\";\nexport {\n ThreadIf as If,\n type ThreadIfProps as IfProps,\n} from \"./thread/ThreadIf\";\nexport {\n ThreadSuggestion as Suggestion,\n type ThreadSuggestionProps as SuggestionProps,\n} from \"./thread/ThreadSuggestion\";\nexport {\n ThreadPrimitiveSuggestions as Suggestions,\n ThreadPrimitiveSuggestionByIndex as SuggestionByIndex,\n} from \"@assistant-ui/core/react\";\n"],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import { useAuiState } from "@assistant-ui/store";
|
|
|
2
2
|
import { c } from "@assistant-ui/tap/react-shim/compiler-runtime";
|
|
3
3
|
import { FlatList } from "react-native";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import "@assistant-ui/tap/react-shim";
|
|
5
6
|
//#region src/primitives/threadList/ThreadListItems.tsx
|
|
6
7
|
const ThreadListItems = (t0) => {
|
|
7
8
|
const $ = c(9);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadListItems.js","names":["ReactElement","useCallback","FlatList","FlatListProps","useAuiState","ThreadListItemsProps","Omit","renderItem","props","threadId","index","ThreadListItems","t0","$","_c","flatListProps","threadIds","_temp","t1","t2","item","renderFlatListItem","keyExtractor","_temp2","t3","s","threads","item_0"],"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["import { type ReactElement, useCallback } from \"react\";\nimport { FlatList, type FlatListProps } from \"react-native\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport type ThreadListItemsProps = Omit<\n FlatListProps<string>,\n \"data\" | \"renderItem\"\n> & {\n renderItem: (props: { threadId: string; index: number }) => ReactElement;\n};\n\nexport const ThreadListItems = ({\n renderItem,\n ...flatListProps\n}: ThreadListItemsProps) => {\n const threadIds = useAuiState((s) => s.threads.threadIds);\n\n const renderFlatListItem = useCallback(\n ({ item, index }: { item: string; index: number }) => {\n return renderItem({ threadId: item, index });\n },\n [renderItem],\n );\n\n const keyExtractor = useCallback((item: string) => item, []);\n\n return (\n <FlatList\n data={threadIds as string[]}\n renderItem={renderFlatListItem}\n keyExtractor={keyExtractor}\n {...flatListProps}\n />\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThreadListItems.js","names":["ReactElement","useCallback","FlatList","FlatListProps","useAuiState","ThreadListItemsProps","Omit","renderItem","props","threadId","index","ThreadListItems","t0","$","_c","flatListProps","threadIds","_temp","t1","t2","item","renderFlatListItem","keyExtractor","_temp2","t3","s","threads","item_0"],"sources":["../../../src/primitives/threadList/ThreadListItems.tsx"],"sourcesContent":["import { type ReactElement, useCallback } from \"react\";\nimport { FlatList, type FlatListProps } from \"react-native\";\nimport { useAuiState } from \"@assistant-ui/store\";\n\nexport type ThreadListItemsProps = Omit<\n FlatListProps<string>,\n \"data\" | \"renderItem\"\n> & {\n renderItem: (props: { threadId: string; index: number }) => ReactElement;\n};\n\nexport const ThreadListItems = ({\n renderItem,\n ...flatListProps\n}: ThreadListItemsProps) => {\n const threadIds = useAuiState((s) => s.threads.threadIds);\n\n const renderFlatListItem = useCallback(\n ({ item, index }: { item: string; index: number }) => {\n return renderItem({ threadId: item, index });\n },\n [renderItem],\n );\n\n const keyExtractor = useCallback((item: string) => item, []);\n\n return (\n <FlatList\n data={threadIds as string[]}\n renderItem={renderFlatListItem}\n keyExtractor={keyExtractor}\n {...flatListProps}\n />\n );\n};\n"],"mappings":";;;;;;AAWA,MAAaW,mBAAkBC,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAR;CAAA,IAAAM,EAAA,OAAAD,IAAA;EAAC,CAAA,CAAAL,eAAAQ,iBAAAH;EAGTC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAN;CAAA,OAAA;EAAAQ,gBAAAF,EAAA;EAAAN,aAAAM,EAAA;CAAA;CACrB,MAAAG,YAAkBZ,YAAYa,KAA0B;CAAE,IAAAC;CAAA,IAAAL,EAAA,OAAAN,YAAA;EAGxDW,MAAAC,OAAA;GAAC,MAAA,EAAAC,MAAAV,UAAAS;GAAgD,OACxCZ,WAAW;IAAAE,UAAYW;IAAIV;GAAQ,CAAC;EAAC;EAC7CG,EAAA,KAAAN;EAAAM,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAHH,MAAAQ,qBAA2BH;CAO3B,MAAAI,eAAqBC;CAIX,MAAAJ,KAAAH;CAAqB,IAAAQ;CAAA,IAAAX,EAAA,OAAAE,iBAAAF,EAAA,OAAAQ,sBAAAR,EAAA,OAAAM,IAAA;EAD7BK,KAAA,oBAAC,UAAD;GACQ,MAAAL;GACME,YAAAA;GACEC;GAAY,GACtBP;EAAa,CAAA;EACjBF,EAAA,KAAAE;EAAAF,EAAA,KAAAQ;EAAAR,EAAA,KAAAM;EAAAN,EAAA,KAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OALFW;AAKE;AArByB,SAAAP,MAAAQ,GAAA;CAAA,OAIQA,EAACC,QAAQV;AAAU;AAJ3B,SAAAO,OAAAI,QAAA;CAAA,OAasBP;AAAI"}
|