@anvia/react-ui 1.2.2 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attachment/index.d.ts +3 -21
- package/dist/attachment/index.js +3 -12
- package/dist/attachment-DsKTPumt.js +89 -0
- package/dist/attachment-DsKTPumt.js.map +1 -0
- package/dist/chat/index.d.ts +3 -144
- package/dist/chat/index.js +3 -25
- package/dist/chat-CAnvUEAv.js +1210 -0
- package/dist/chat-CAnvUEAv.js.map +1 -0
- package/dist/completion/index.d.ts +3 -29
- package/dist/completion/index.js +3 -16
- package/dist/completion-DDTKoZRJ.js +124 -0
- package/dist/completion-DDTKoZRJ.js.map +1 -0
- package/dist/connection-DeNq8wHS.js +203 -0
- package/dist/connection-DeNq8wHS.js.map +1 -0
- package/dist/contexts-B4ijG24z.js +212 -0
- package/dist/contexts-B4ijG24z.js.map +1 -0
- package/dist/elements-D4vmkkF8.js +19 -0
- package/dist/elements-D4vmkkF8.js.map +1 -0
- package/dist/graph-explorer/index.d.ts +54 -73
- package/dist/graph-explorer/index.d.ts.map +1 -0
- package/dist/graph-explorer/index.js +181 -248
- package/dist/graph-explorer/index.js.map +1 -1
- package/dist/human-input/index.d.ts +3 -78
- package/dist/human-input/index.js +3 -21
- package/dist/human-input-CsCbZomZ.js +314 -0
- package/dist/human-input-CsCbZomZ.js.map +1 -0
- package/dist/image/index.d.ts +3 -40
- package/dist/image/index.js +3 -12
- package/dist/image-D_7vaQCR.js +302 -0
- package/dist/image-D_7vaQCR.js.map +1 -0
- package/dist/index-B1Qs2Cjv.d.ts +145 -0
- package/dist/index-B1Qs2Cjv.d.ts.map +1 -0
- package/dist/index-BCBVcl0D.d.ts +277 -0
- package/dist/index-BCBVcl0D.d.ts.map +1 -0
- package/dist/index-CE22tsua.d.ts +20 -0
- package/dist/index-CE22tsua.d.ts.map +1 -0
- package/dist/index-CGqtpc6b.d.ts +25 -0
- package/dist/index-CGqtpc6b.d.ts.map +1 -0
- package/dist/index-DqdyM0Jm.d.ts +7 -0
- package/dist/index-DqdyM0Jm.d.ts.map +1 -0
- package/dist/index-Mw3ltwSG.d.ts +318 -0
- package/dist/index-Mw3ltwSG.d.ts.map +1 -0
- package/dist/index.d.ts +7 -40
- package/dist/index.js +34 -118
- package/dist/index.js.map +1 -1
- package/dist/message/index.d.ts +3 -105
- package/dist/message/index.js +3 -20
- package/dist/message-Dn3wW6yy.js +783 -0
- package/dist/message-Dn3wW6yy.js.map +1 -0
- package/dist/primitives-xfE7zfwJ.js +15 -0
- package/dist/primitives-xfE7zfwJ.js.map +1 -0
- package/dist/refs-Djj9rSvB.js +10 -0
- package/dist/refs-Djj9rSvB.js.map +1 -0
- package/dist/sandbox-desktop/index.d.ts +100 -104
- package/dist/sandbox-desktop/index.d.ts.map +1 -0
- package/dist/sandbox-desktop/index.js +344 -342
- package/dist/sandbox-desktop/index.js.map +1 -1
- package/dist/sandbox-terminal/index.d.ts +52 -56
- package/dist/sandbox-terminal/index.d.ts.map +1 -0
- package/dist/sandbox-terminal/index.js +217 -208
- package/dist/sandbox-terminal/index.js.map +1 -1
- package/dist/selection-toolbar/index.d.ts +3 -21
- package/dist/selection-toolbar/index.js +3 -13
- package/dist/selection-toolbar-CIkOoM-7.js +171 -0
- package/dist/selection-toolbar-CIkOoM-7.js.map +1 -0
- package/dist/shared-BSYElFU2.d.ts +2 -0
- package/dist/shared.d.ts +4 -14
- package/dist/shared.js +1 -43
- package/dist/stream/index.d.ts +2 -22
- package/dist/stream/index.js +1 -8
- package/dist/stream-CAO0x8_1.js +298 -0
- package/dist/stream-CAO0x8_1.js.map +1 -0
- package/dist/thread-list/index.d.ts +3 -47
- package/dist/thread-list/index.js +3 -18
- package/dist/thread-list-xJbGXFrE.js +228 -0
- package/dist/thread-list-xJbGXFrE.js.map +1 -0
- package/dist/ticket-CoJHBpdF.d.ts +32 -0
- package/dist/ticket-CoJHBpdF.d.ts.map +1 -0
- package/dist/value-BGGrx72L.js +13 -0
- package/dist/value-BGGrx72L.js.map +1 -0
- package/package.json +22 -22
- package/dist/attachment/index.js.map +0 -1
- package/dist/attachment-mbjsroli.d.ts +0 -9
- package/dist/chat/index.js.map +0 -1
- package/dist/chat-PSj1Fo4W.d.ts +0 -88
- package/dist/chunk-22EZJUPM.js +0 -120
- package/dist/chunk-22EZJUPM.js.map +0 -1
- package/dist/chunk-5FZKTDZR.js +0 -201
- package/dist/chunk-5FZKTDZR.js.map +0 -1
- package/dist/chunk-6XOJFLX4.js +0 -22
- package/dist/chunk-6XOJFLX4.js.map +0 -1
- package/dist/chunk-CKA4CE26.js +0 -25
- package/dist/chunk-CKA4CE26.js.map +0 -1
- package/dist/chunk-DLBNFBXQ.js +0 -425
- package/dist/chunk-DLBNFBXQ.js.map +0 -1
- package/dist/chunk-E73S3SOF.js +0 -404
- package/dist/chunk-E73S3SOF.js.map +0 -1
- package/dist/chunk-F6AKBUO3.js +0 -380
- package/dist/chunk-F6AKBUO3.js.map +0 -1
- package/dist/chunk-HGOPGZNQ.js +0 -195
- package/dist/chunk-HGOPGZNQ.js.map +0 -1
- package/dist/chunk-KHB5CHAU.js +0 -220
- package/dist/chunk-KHB5CHAU.js.map +0 -1
- package/dist/chunk-LHABOAOP.js +0 -316
- package/dist/chunk-LHABOAOP.js.map +0 -1
- package/dist/chunk-N5XQU36W.js +0 -410
- package/dist/chunk-N5XQU36W.js.map +0 -1
- package/dist/chunk-T3ZFZ3NP.js +0 -30
- package/dist/chunk-T3ZFZ3NP.js.map +0 -1
- package/dist/chunk-W2AHKMRS.js +0 -1092
- package/dist/chunk-W2AHKMRS.js.map +0 -1
- package/dist/chunk-Y2KAMPVJ.js +0 -1582
- package/dist/chunk-Y2KAMPVJ.js.map +0 -1
- package/dist/completion/index.js.map +0 -1
- package/dist/completion-input-DHlwrhxB.d.ts +0 -24
- package/dist/composer-6iCSIq6L.d.ts +0 -111
- package/dist/human-input/index.js.map +0 -1
- package/dist/human-input-CkLrZ8IC.d.ts +0 -27
- package/dist/image/index.js.map +0 -1
- package/dist/image-VZv6Ddsn.d.ts +0 -14
- package/dist/message/index.js.map +0 -1
- package/dist/message-CNRnZQwU.d.ts +0 -14
- package/dist/render-CRKWam2v.d.ts +0 -8
- package/dist/selection-toolbar/index.js.map +0 -1
- package/dist/selection-toolbar-Cwjbuv5S.d.ts +0 -14
- package/dist/shared.js.map +0 -1
- package/dist/stream/index.js.map +0 -1
- package/dist/thread-Bz6-1zaJ.d.ts +0 -12
- package/dist/thread-list/index.js.map +0 -1
- package/dist/thread-list-On8db4XL.d.ts +0 -34
- package/dist/ticket-pexI1zIa.d.ts +0 -33
package/dist/chunk-E73S3SOF.js
DELETED
|
@@ -1,404 +0,0 @@
|
|
|
1
|
-
// src/contexts/attachment.tsx
|
|
2
|
-
import { createContext, createElement, useContext } from "react";
|
|
3
|
-
var AttachmentContext = createContext(void 0);
|
|
4
|
-
function InternalAttachmentProvider({
|
|
5
|
-
value,
|
|
6
|
-
children
|
|
7
|
-
}) {
|
|
8
|
-
return createElement(AttachmentContext.Provider, { value }, children);
|
|
9
|
-
}
|
|
10
|
-
function useAttachment() {
|
|
11
|
-
const value = useContext(AttachmentContext);
|
|
12
|
-
if (value === void 0) {
|
|
13
|
-
throw new Error("Attachment primitives must be used inside AttachmentPrimitive.Root.");
|
|
14
|
-
}
|
|
15
|
-
return value;
|
|
16
|
-
}
|
|
17
|
-
function useOptionalAttachment() {
|
|
18
|
-
return useContext(AttachmentContext);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// src/contexts/chat.tsx
|
|
22
|
-
import { createContext as createContext2, createElement as createElement2, useContext as useContext2 } from "react";
|
|
23
|
-
var ChatContext = createContext2(void 0);
|
|
24
|
-
function ChatProvider({ controller, children }) {
|
|
25
|
-
return createElement2(
|
|
26
|
-
ChatContext.Provider,
|
|
27
|
-
{ value: controller },
|
|
28
|
-
children
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function useChatContext() {
|
|
32
|
-
const value = useContext2(ChatContext);
|
|
33
|
-
if (value === void 0) {
|
|
34
|
-
throw new Error("Anvia chat primitives must be used inside ChatProvider.");
|
|
35
|
-
}
|
|
36
|
-
return value;
|
|
37
|
-
}
|
|
38
|
-
function useHumanInput() {
|
|
39
|
-
const interactions = useChatContext().interactions;
|
|
40
|
-
const approvals = interactions.all.filter(
|
|
41
|
-
(item) => item.request.type === "tool-approval"
|
|
42
|
-
);
|
|
43
|
-
const questions = interactions.all.filter(
|
|
44
|
-
(item) => item.request.type === "tool-question"
|
|
45
|
-
);
|
|
46
|
-
return {
|
|
47
|
-
approvals: {
|
|
48
|
-
all: approvals,
|
|
49
|
-
pending: approvals.filter((item) => item.status === "pending")
|
|
50
|
-
},
|
|
51
|
-
questions: {
|
|
52
|
-
all: questions,
|
|
53
|
-
pending: questions.filter((item) => item.status === "pending")
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// src/contexts/completion.tsx
|
|
59
|
-
import { createContext as createContext3, createElement as createElement3, useContext as useContext3 } from "react";
|
|
60
|
-
var CompletionContext = createContext3(void 0);
|
|
61
|
-
function CompletionProvider({ controller, children }) {
|
|
62
|
-
return createElement3(
|
|
63
|
-
CompletionContext.Provider,
|
|
64
|
-
{ value: controller },
|
|
65
|
-
children
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
function useCompletionContext() {
|
|
69
|
-
const value = useContext3(CompletionContext);
|
|
70
|
-
if (value === void 0) {
|
|
71
|
-
throw new Error("Anvia completion primitives must be used inside CompletionProvider.");
|
|
72
|
-
}
|
|
73
|
-
return value;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// src/contexts/graph-explorer.tsx
|
|
77
|
-
import { createContext as createContext4, createElement as createElement4, useContext as useContext4 } from "react";
|
|
78
|
-
var GraphExplorerContext = createContext4(void 0);
|
|
79
|
-
var GraphExplorerNodeContext = createContext4(
|
|
80
|
-
void 0
|
|
81
|
-
);
|
|
82
|
-
function GraphExplorerProvider({
|
|
83
|
-
controller,
|
|
84
|
-
children
|
|
85
|
-
}) {
|
|
86
|
-
return createElement4(
|
|
87
|
-
GraphExplorerContext.Provider,
|
|
88
|
-
{ value: controller },
|
|
89
|
-
children
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
function InternalGraphExplorerNodeProvider({
|
|
93
|
-
value,
|
|
94
|
-
children
|
|
95
|
-
}) {
|
|
96
|
-
return createElement4(GraphExplorerNodeContext.Provider, { value }, children);
|
|
97
|
-
}
|
|
98
|
-
function useGraphExplorerContext() {
|
|
99
|
-
const value = useContext4(GraphExplorerContext);
|
|
100
|
-
if (value === void 0) {
|
|
101
|
-
throw new Error("Graph explorer primitives must be used inside GraphExplorerProvider.");
|
|
102
|
-
}
|
|
103
|
-
return value;
|
|
104
|
-
}
|
|
105
|
-
function useGraphExplorerNode() {
|
|
106
|
-
const value = useContext4(GraphExplorerNodeContext);
|
|
107
|
-
if (value === void 0) {
|
|
108
|
-
throw new Error(
|
|
109
|
-
"Graph explorer node primitives must be used inside GraphExplorerNodePrimitive.Root or GraphExplorerPrimitive.Nodes."
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
return value;
|
|
113
|
-
}
|
|
114
|
-
function useOptionalGraphExplorerNode() {
|
|
115
|
-
return useContext4(GraphExplorerNodeContext);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/contexts/completion-input.tsx
|
|
119
|
-
import { createContext as createContext5, createElement as createElement5, useContext as useContext5 } from "react";
|
|
120
|
-
var CompletionInputContext = createContext5(void 0);
|
|
121
|
-
function InternalCompletionInputProvider({
|
|
122
|
-
value,
|
|
123
|
-
children
|
|
124
|
-
}) {
|
|
125
|
-
return createElement5(CompletionInputContext.Provider, { value }, children);
|
|
126
|
-
}
|
|
127
|
-
function useCompletionInput() {
|
|
128
|
-
const value = useContext5(CompletionInputContext);
|
|
129
|
-
if (value === void 0) {
|
|
130
|
-
throw new Error("Completion input primitives must be used inside CompletionPrimitive.Form.");
|
|
131
|
-
}
|
|
132
|
-
return value;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// src/contexts/composer.tsx
|
|
136
|
-
import { createContext as createContext6, createElement as createElement6, useContext as useContext6 } from "react";
|
|
137
|
-
var ComposerContext = createContext6(void 0);
|
|
138
|
-
function InternalComposerProvider({
|
|
139
|
-
value,
|
|
140
|
-
children
|
|
141
|
-
}) {
|
|
142
|
-
return createElement6(ComposerContext.Provider, { value }, children);
|
|
143
|
-
}
|
|
144
|
-
function useComposer() {
|
|
145
|
-
const value = useContext6(ComposerContext);
|
|
146
|
-
if (value === void 0) {
|
|
147
|
-
throw new Error("Composer primitives must be used inside ComposerPrimitive.Root.");
|
|
148
|
-
}
|
|
149
|
-
return value;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// src/contexts/human-input.tsx
|
|
153
|
-
import {
|
|
154
|
-
createContext as createContext7,
|
|
155
|
-
createElement as createElement7,
|
|
156
|
-
useContext as useContext7,
|
|
157
|
-
useMemo,
|
|
158
|
-
useState
|
|
159
|
-
} from "react";
|
|
160
|
-
var ApprovalContext = createContext7(void 0);
|
|
161
|
-
var QuestionContext = createContext7(void 0);
|
|
162
|
-
var QuestionPromptContext = createContext7(void 0);
|
|
163
|
-
function InternalApprovalProvider({
|
|
164
|
-
approval,
|
|
165
|
-
children
|
|
166
|
-
}) {
|
|
167
|
-
const [reason, setReason] = useState("");
|
|
168
|
-
const value = useMemo(
|
|
169
|
-
() => ({ approval, reason, setReason }),
|
|
170
|
-
[approval, reason]
|
|
171
|
-
);
|
|
172
|
-
return createElement7(ApprovalContext.Provider, { value }, children);
|
|
173
|
-
}
|
|
174
|
-
function InternalQuestionProvider({
|
|
175
|
-
value,
|
|
176
|
-
children
|
|
177
|
-
}) {
|
|
178
|
-
return createElement7(QuestionContext.Provider, { value }, children);
|
|
179
|
-
}
|
|
180
|
-
function InternalQuestionPromptProvider({
|
|
181
|
-
prompt,
|
|
182
|
-
children
|
|
183
|
-
}) {
|
|
184
|
-
return createElement7(QuestionPromptContext.Provider, { value: { prompt } }, children);
|
|
185
|
-
}
|
|
186
|
-
function useApproval() {
|
|
187
|
-
const value = useContext7(ApprovalContext);
|
|
188
|
-
if (value === void 0) {
|
|
189
|
-
throw new Error("Approval primitives must be used inside HumanInputPrimitive.Approval.");
|
|
190
|
-
}
|
|
191
|
-
return value;
|
|
192
|
-
}
|
|
193
|
-
function useQuestion() {
|
|
194
|
-
const value = useContext7(QuestionContext);
|
|
195
|
-
if (value === void 0) {
|
|
196
|
-
throw new Error("Question primitives must be used inside HumanInputPrimitive.Question.");
|
|
197
|
-
}
|
|
198
|
-
return value;
|
|
199
|
-
}
|
|
200
|
-
function useQuestionPrompt() {
|
|
201
|
-
const value = useContext7(QuestionPromptContext);
|
|
202
|
-
if (value === void 0) {
|
|
203
|
-
throw new Error(
|
|
204
|
-
"Question choice primitives must be used inside HumanInputPrimitive.QuestionPrompt."
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
return value;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// src/contexts/image.tsx
|
|
211
|
-
import { createContext as createContext8, createElement as createElement8, useContext as useContext8 } from "react";
|
|
212
|
-
var ImageContext = createContext8(void 0);
|
|
213
|
-
function InternalImageProvider({
|
|
214
|
-
value,
|
|
215
|
-
children
|
|
216
|
-
}) {
|
|
217
|
-
return createElement8(ImageContext.Provider, { value }, children);
|
|
218
|
-
}
|
|
219
|
-
function useImage() {
|
|
220
|
-
const value = useContext8(ImageContext);
|
|
221
|
-
if (value === void 0) {
|
|
222
|
-
throw new Error("Image primitives must be used inside ImagePrimitive.Root.");
|
|
223
|
-
}
|
|
224
|
-
return value;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// src/contexts/message.tsx
|
|
228
|
-
import { createContext as createContext9, createElement as createElement9, useContext as useContext9 } from "react";
|
|
229
|
-
var MessageContext = createContext9(void 0);
|
|
230
|
-
var MessagePartContext = createContext9(void 0);
|
|
231
|
-
function InternalMessageProvider({
|
|
232
|
-
message,
|
|
233
|
-
children
|
|
234
|
-
}) {
|
|
235
|
-
return createElement9(MessageContext.Provider, { value: { message } }, children);
|
|
236
|
-
}
|
|
237
|
-
function InternalMessagePartProvider({
|
|
238
|
-
part,
|
|
239
|
-
isLive = false,
|
|
240
|
-
streamControlled = false,
|
|
241
|
-
children
|
|
242
|
-
}) {
|
|
243
|
-
return createElement9(
|
|
244
|
-
MessagePartContext.Provider,
|
|
245
|
-
{ value: { isLive, part, streamControlled } },
|
|
246
|
-
children
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
function useMessage() {
|
|
250
|
-
const value = useContext9(MessageContext);
|
|
251
|
-
if (value === void 0) {
|
|
252
|
-
throw new Error(
|
|
253
|
-
"Message primitives must be used inside MessagePrimitive.Root or ThreadPrimitive.Messages."
|
|
254
|
-
);
|
|
255
|
-
}
|
|
256
|
-
return value;
|
|
257
|
-
}
|
|
258
|
-
function useMessagePart() {
|
|
259
|
-
const value = useContext9(MessagePartContext);
|
|
260
|
-
if (value === void 0) {
|
|
261
|
-
throw new Error(
|
|
262
|
-
"Message part primitives must be used inside MessagePrimitive.Parts or MessagePrimitive.Part."
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
return value;
|
|
266
|
-
}
|
|
267
|
-
function useOptionalMessagePart() {
|
|
268
|
-
return useContext9(MessagePartContext);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
// src/contexts/selection-toolbar.tsx
|
|
272
|
-
import { createContext as createContext10, createElement as createElement10, useContext as useContext10 } from "react";
|
|
273
|
-
var SelectionToolbarContext = createContext10(void 0);
|
|
274
|
-
function InternalSelectionToolbarProvider({
|
|
275
|
-
value,
|
|
276
|
-
children
|
|
277
|
-
}) {
|
|
278
|
-
return createElement10(SelectionToolbarContext.Provider, { value }, children);
|
|
279
|
-
}
|
|
280
|
-
function useSelectionToolbar() {
|
|
281
|
-
const value = useContext10(SelectionToolbarContext);
|
|
282
|
-
if (value === void 0) {
|
|
283
|
-
throw new Error(
|
|
284
|
-
"SelectionToolbar primitives must be used inside SelectionToolbarPrimitive.Root."
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
return value;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
// src/contexts/thread.tsx
|
|
291
|
-
import {
|
|
292
|
-
createContext as createContext11,
|
|
293
|
-
createElement as createElement11,
|
|
294
|
-
useContext as useContext11
|
|
295
|
-
} from "react";
|
|
296
|
-
var ThreadContext = createContext11(void 0);
|
|
297
|
-
function InternalThreadProvider({
|
|
298
|
-
value,
|
|
299
|
-
children
|
|
300
|
-
}) {
|
|
301
|
-
return createElement11(ThreadContext.Provider, { value }, children);
|
|
302
|
-
}
|
|
303
|
-
function useThread() {
|
|
304
|
-
const value = useContext11(ThreadContext);
|
|
305
|
-
if (value === void 0) {
|
|
306
|
-
throw new Error("Thread primitives must be used inside ThreadPrimitive.Root.");
|
|
307
|
-
}
|
|
308
|
-
return value;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
// src/contexts/thread-list.tsx
|
|
312
|
-
import {
|
|
313
|
-
createContext as createContext12,
|
|
314
|
-
createElement as createElement12,
|
|
315
|
-
useContext as useContext12
|
|
316
|
-
} from "react";
|
|
317
|
-
var ThreadListContext = createContext12(void 0);
|
|
318
|
-
var ThreadListItemContext = createContext12(void 0);
|
|
319
|
-
var ThreadListRootContext = createContext12(
|
|
320
|
-
void 0
|
|
321
|
-
);
|
|
322
|
-
function ThreadListProvider({
|
|
323
|
-
controller,
|
|
324
|
-
children
|
|
325
|
-
}) {
|
|
326
|
-
return createElement12(ThreadListContext.Provider, { value: controller }, children);
|
|
327
|
-
}
|
|
328
|
-
function InternalThreadListItemProvider({
|
|
329
|
-
value,
|
|
330
|
-
children
|
|
331
|
-
}) {
|
|
332
|
-
return createElement12(ThreadListItemContext.Provider, { value }, children);
|
|
333
|
-
}
|
|
334
|
-
function InternalThreadListRootProvider({
|
|
335
|
-
value,
|
|
336
|
-
children
|
|
337
|
-
}) {
|
|
338
|
-
return createElement12(ThreadListRootContext.Provider, { value }, children);
|
|
339
|
-
}
|
|
340
|
-
function useThreadList() {
|
|
341
|
-
const value = useContext12(ThreadListContext);
|
|
342
|
-
if (value === void 0) {
|
|
343
|
-
throw new Error("ThreadList primitives must be used inside ThreadListProvider.");
|
|
344
|
-
}
|
|
345
|
-
return value;
|
|
346
|
-
}
|
|
347
|
-
function useThreadListItem() {
|
|
348
|
-
const value = useContext12(ThreadListItemContext);
|
|
349
|
-
if (value === void 0) {
|
|
350
|
-
throw new Error("ThreadListItem primitives must be used inside ThreadListPrimitive.Items.");
|
|
351
|
-
}
|
|
352
|
-
return value;
|
|
353
|
-
}
|
|
354
|
-
function useInternalThreadListRoot() {
|
|
355
|
-
const value = useContext12(ThreadListRootContext);
|
|
356
|
-
if (value === void 0) {
|
|
357
|
-
throw new Error("Thread-list primitives must be used inside ThreadListPrimitive.Root.");
|
|
358
|
-
}
|
|
359
|
-
return value;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
export {
|
|
363
|
-
InternalAttachmentProvider,
|
|
364
|
-
useAttachment,
|
|
365
|
-
useOptionalAttachment,
|
|
366
|
-
ChatProvider,
|
|
367
|
-
useChatContext,
|
|
368
|
-
useHumanInput,
|
|
369
|
-
CompletionProvider,
|
|
370
|
-
useCompletionContext,
|
|
371
|
-
GraphExplorerProvider,
|
|
372
|
-
InternalGraphExplorerNodeProvider,
|
|
373
|
-
useGraphExplorerContext,
|
|
374
|
-
useGraphExplorerNode,
|
|
375
|
-
useOptionalGraphExplorerNode,
|
|
376
|
-
InternalCompletionInputProvider,
|
|
377
|
-
useCompletionInput,
|
|
378
|
-
InternalComposerProvider,
|
|
379
|
-
useComposer,
|
|
380
|
-
InternalApprovalProvider,
|
|
381
|
-
InternalQuestionProvider,
|
|
382
|
-
InternalQuestionPromptProvider,
|
|
383
|
-
useApproval,
|
|
384
|
-
useQuestion,
|
|
385
|
-
useQuestionPrompt,
|
|
386
|
-
InternalImageProvider,
|
|
387
|
-
useImage,
|
|
388
|
-
InternalMessageProvider,
|
|
389
|
-
InternalMessagePartProvider,
|
|
390
|
-
useMessage,
|
|
391
|
-
useMessagePart,
|
|
392
|
-
useOptionalMessagePart,
|
|
393
|
-
InternalSelectionToolbarProvider,
|
|
394
|
-
useSelectionToolbar,
|
|
395
|
-
InternalThreadProvider,
|
|
396
|
-
useThread,
|
|
397
|
-
ThreadListProvider,
|
|
398
|
-
InternalThreadListItemProvider,
|
|
399
|
-
InternalThreadListRootProvider,
|
|
400
|
-
useThreadList,
|
|
401
|
-
useThreadListItem,
|
|
402
|
-
useInternalThreadListRoot
|
|
403
|
-
};
|
|
404
|
-
//# sourceMappingURL=chunk-E73S3SOF.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/attachment.tsx","../src/contexts/chat.tsx","../src/contexts/completion.tsx","../src/contexts/graph-explorer.tsx","../src/contexts/completion-input.tsx","../src/contexts/composer.tsx","../src/contexts/human-input.tsx","../src/contexts/image.tsx","../src/contexts/message.tsx","../src/contexts/selection-toolbar.tsx","../src/contexts/thread.tsx","../src/contexts/thread-list.tsx"],"sourcesContent":["import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type AttachmentContextValue = {\n attachment: UIAttachment;\n remove?(): void;\n};\n\nconst AttachmentContext = createContext<AttachmentContextValue | undefined>(undefined);\n\nexport function InternalAttachmentProvider({\n value,\n children,\n}: {\n value: AttachmentContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(AttachmentContext.Provider, { value }, children);\n}\n\nexport function useAttachment(): AttachmentContextValue {\n const value = useContext(AttachmentContext);\n if (value === undefined) {\n throw new Error(\"Attachment primitives must be used inside AttachmentPrimitive.Root.\");\n }\n return value;\n}\n\nexport function useOptionalAttachment(): AttachmentContextValue | undefined {\n return useContext(AttachmentContext);\n}\n","import type {\n ClientDataMap,\n ClientMetadata,\n ClientStreamRequest,\n ClientTransport,\n} from \"@anvia/client\";\nimport type {\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport type { UseChatResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ChatController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseChatResult<ClientTransport<ClientStreamRequest, Data, Metadata>>;\n\nexport type ChatProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: ChatController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst ChatContext = createContext<ChatController | undefined>(undefined);\n\nexport function ChatProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: ChatProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n ChatContext.Provider,\n { value: controller as unknown as ChatController },\n children,\n );\n}\n\nexport function useChatContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): ChatController<Metadata, Data> {\n const value = useContext(ChatContext);\n if (value === undefined) {\n throw new Error(\"Anvia chat primitives must be used inside ChatProvider.\");\n }\n return value as unknown as ChatController<Metadata, Data>;\n}\n\nexport function useHumanInput() {\n const interactions = useChatContext().interactions;\n const approvals = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolApprovalRequest } =>\n item.request.type === \"tool-approval\",\n );\n const questions = interactions.all.filter(\n (item): item is typeof item & { request: AgentToolQuestionRequest } =>\n item.request.type === \"tool-question\",\n );\n return {\n approvals: {\n all: approvals,\n pending: approvals.filter((item) => item.status === \"pending\"),\n },\n questions: {\n all: questions,\n pending: questions.filter((item) => item.status === \"pending\"),\n },\n };\n}\n","import type { ClientDataMap, ClientMetadata } from \"@anvia/client\";\nimport type { UseCompletionResult } from \"@anvia/react\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type CompletionController<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = UseCompletionResult<Metadata, Data>;\n\nexport type CompletionProviderProps<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n> = {\n controller: CompletionController<Metadata, Data>;\n children?: ReactNode;\n};\n\nconst CompletionContext = createContext<CompletionController | undefined>(undefined);\n\nexport function CompletionProvider<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>({ controller, children }: CompletionProviderProps<Metadata, Data>): ReactElement {\n return createElement(\n CompletionContext.Provider,\n { value: controller as unknown as CompletionController },\n children,\n );\n}\n\nexport function useCompletionContext<\n Metadata extends ClientMetadata = ClientMetadata,\n Data extends ClientDataMap = ClientDataMap,\n>(): CompletionController<Metadata, Data> {\n const value = useContext(CompletionContext);\n if (value === undefined) {\n throw new Error(\"Anvia completion primitives must be used inside CompletionProvider.\");\n }\n return value as unknown as CompletionController<Metadata, Data>;\n}\n","import type { GraphExploreNode, GraphSchemaLike } from \"@anvia/graph\";\nimport type {\n GraphExplorerController,\n GraphExplorerExpandNodeOptions,\n GraphExplorerStatus,\n} from \"@anvia/react/graph-explorer\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type { GraphExplorerController, GraphExplorerExpandNodeOptions, GraphExplorerStatus };\n\nexport type GraphExplorerProviderProps<Schema extends GraphSchemaLike = GraphSchemaLike> = {\n controller: GraphExplorerController<Schema>;\n children?: ReactNode;\n};\n\nexport type GraphExplorerNodeContextValue = {\n node: GraphExploreNode;\n selected: boolean;\n matched: boolean;\n};\n\nconst GraphExplorerContext = createContext<GraphExplorerController | undefined>(undefined);\nconst GraphExplorerNodeContext = createContext<GraphExplorerNodeContextValue | undefined>(\n undefined,\n);\n\nexport function GraphExplorerProvider<Schema extends GraphSchemaLike = GraphSchemaLike>({\n controller,\n children,\n}: GraphExplorerProviderProps<Schema>): ReactElement {\n return createElement(\n GraphExplorerContext.Provider,\n { value: controller as unknown as GraphExplorerController },\n children,\n );\n}\n\nexport function InternalGraphExplorerNodeProvider({\n value,\n children,\n}: {\n value: GraphExplorerNodeContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(GraphExplorerNodeContext.Provider, { value }, children);\n}\n\nexport function useGraphExplorerContext<\n Schema extends GraphSchemaLike = GraphSchemaLike,\n>(): GraphExplorerController<Schema> {\n const value = useContext(GraphExplorerContext);\n if (value === undefined) {\n throw new Error(\"Graph explorer primitives must be used inside GraphExplorerProvider.\");\n }\n return value as unknown as GraphExplorerController<Schema>;\n}\n\nexport function useGraphExplorerNode(): GraphExplorerNodeContextValue {\n const value = useContext(GraphExplorerNodeContext);\n if (value === undefined) {\n throw new Error(\n \"Graph explorer node primitives must be used inside GraphExplorerNodePrimitive.Root or GraphExplorerPrimitive.Nodes.\",\n );\n }\n return value;\n}\n\nexport function useOptionalGraphExplorerNode(): GraphExplorerNodeContextValue | undefined {\n return useContext(GraphExplorerNodeContext);\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nimport type { CompletionController } from \"./completion\";\n\nexport type CompletionInputContextValue = {\n input: string;\n setInput(input: string): void;\n submit(): Promise<void>;\n stop(): void;\n status: CompletionController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst CompletionInputContext = createContext<CompletionInputContextValue | undefined>(undefined);\n\nexport function InternalCompletionInputProvider({\n value,\n children,\n}: {\n value: CompletionInputContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(CompletionInputContext.Provider, { value }, children);\n}\n\nexport function useCompletionInput(): CompletionInputContextValue {\n const value = useContext(CompletionInputContext);\n if (value === undefined) {\n throw new Error(\"Completion input primitives must be used inside CompletionPrimitive.Form.\");\n }\n return value;\n}\n","import type { ClientMetadata, CreateUIAttachment, UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\nimport type { ChatController } from \"./chat\";\n\nexport type ComposerEntityData =\n | string\n | number\n | boolean\n | null\n | readonly ComposerEntityData[]\n | { [key: string]: ComposerEntityData };\n\nexport type ComposerAttachmentInput = File | CreateUIAttachment;\nexport type ComposerAttachmentsUpdate =\n | UIAttachment[]\n | ((attachments: UIAttachment[]) => UIAttachment[]);\nexport type ComposerEntitiesUpdate =\n | ComposerEntity[]\n | ((entities: ComposerEntity[]) => ComposerEntity[]);\nexport type ComposerQuote = {\n text: string;\n messageId: string;\n};\nexport type ComposerTriggerItem = {\n id: string;\n label: string;\n text?: string | undefined;\n detail?: ReactNode | undefined;\n data?: ComposerEntityData | undefined;\n disabled?: boolean | undefined;\n};\nexport type ComposerTriggerItemsArgs = {\n trigger: ComposerTriggerDefinition;\n query: string;\n input: string;\n entities: ComposerEntity[];\n signal: AbortSignal;\n};\nexport type ComposerTriggerItems =\n | ComposerTriggerItem[]\n | ((args: ComposerTriggerItemsArgs) => ComposerTriggerItem[] | Promise<ComposerTriggerItem[]>);\nexport type ComposerTriggerDefinition = {\n id: string;\n char: string;\n items: ComposerTriggerItems;\n minQueryLength?: number | undefined;\n allowedPrefixes?: string[] | null | undefined;\n startOfLine?: boolean | undefined;\n allowSpaces?: boolean | undefined;\n};\nexport type ComposerEntity = {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\ntype ComposerMessageEntity = ClientMetadata & {\n id: string;\n triggerId: string;\n trigger: string;\n label: string;\n text: string;\n range: ClientMetadata & {\n from: number;\n to: number;\n };\n data?: ComposerEntityData | undefined;\n};\nexport type ComposerMessageMetadata = ClientMetadata & {\n composer: ClientMetadata & {\n entities: readonly ComposerMessageEntity[];\n };\n};\nexport type ComposerTriggerState = {\n trigger: ComposerTriggerDefinition;\n query: string;\n items: ComposerTriggerItem[];\n loading: boolean;\n selectedIndex: number;\n rect?: {\n top: number;\n right: number;\n bottom: number;\n left: number;\n width: number;\n height: number;\n };\n selectItem(item: ComposerTriggerItem): void;\n setSelectedIndex(index: number): void;\n};\nexport type ComposerTriggerStateUpdate =\n | ComposerTriggerState\n | undefined\n | ((state: ComposerTriggerState | undefined) => ComposerTriggerState | undefined);\n\nexport type ComposerContextValue = {\n input: string;\n setInput(input: string): void;\n attachments: UIAttachment[];\n setAttachments(update: ComposerAttachmentsUpdate): void;\n addAttachment(attachment: ComposerAttachmentInput): Promise<void>;\n removeAttachment(id: string): void;\n clearAttachments(): void;\n entities: ComposerEntity[];\n setEntities(update: ComposerEntitiesUpdate): void;\n quote?: ComposerQuote | undefined;\n setQuote(quote: ComposerQuote | undefined): void;\n clearQuote(): void;\n triggers: ComposerTriggerDefinition[];\n activeTrigger?: ComposerTriggerState | undefined;\n setActiveTrigger(update: ComposerTriggerStateUpdate): void;\n submit(): Promise<void>;\n stop(): void;\n status: ChatController[\"status\"];\n canSubmit: boolean;\n canStop: boolean;\n};\n\nconst ComposerContext = createContext<ComposerContextValue | undefined>(undefined);\n\nexport function InternalComposerProvider({\n value,\n children,\n}: {\n value: ComposerContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ComposerContext.Provider, { value }, children);\n}\n\nexport function useComposer(): ComposerContextValue {\n const value = useContext(ComposerContext);\n if (value === undefined) {\n throw new Error(\"Composer primitives must be used inside ComposerPrimitive.Root.\");\n }\n return value;\n}\n","import type { ClientInteraction } from \"@anvia/client\";\nimport type {\n AgentQuestionAnswer,\n AgentQuestionPrompt,\n AgentToolApprovalRequest,\n AgentToolQuestionRequest,\n} from \"@anvia/core/agent/interactions\";\nimport {\n createContext,\n createElement,\n type ReactElement,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\n\nexport type ApprovalContextValue = {\n approval: ApprovalInteraction;\n reason: string;\n setReason(reason: string): void;\n};\n\nexport type QuestionContextValue = {\n question: QuestionInteraction;\n answers: Record<string, AgentQuestionAnswer>;\n setAnswer(prompt: AgentQuestionPrompt, answer: AgentQuestionAnswer): void;\n};\n\nexport type QuestionPromptContextValue = {\n prompt: AgentQuestionPrompt;\n};\n\nexport type ApprovalInteraction = ClientInteraction & { request: AgentToolApprovalRequest };\nexport type QuestionInteraction = ClientInteraction & { request: AgentToolQuestionRequest };\n\nconst ApprovalContext = createContext<ApprovalContextValue | undefined>(undefined);\nconst QuestionContext = createContext<QuestionContextValue | undefined>(undefined);\nconst QuestionPromptContext = createContext<QuestionPromptContextValue | undefined>(undefined);\n\nexport function InternalApprovalProvider({\n approval,\n children,\n}: {\n approval: ApprovalInteraction;\n children?: ReactNode;\n}): ReactElement {\n const [reason, setReason] = useState(\"\");\n const value = useMemo<ApprovalContextValue>(\n () => ({ approval, reason, setReason }),\n [approval, reason],\n );\n\n return createElement(ApprovalContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionProvider({\n value,\n children,\n}: {\n value: QuestionContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionContext.Provider, { value }, children);\n}\n\nexport function InternalQuestionPromptProvider({\n prompt,\n children,\n}: {\n prompt: AgentQuestionPrompt;\n children?: ReactNode;\n}): ReactElement {\n return createElement(QuestionPromptContext.Provider, { value: { prompt } }, children);\n}\n\nexport function useApproval(): ApprovalContextValue {\n const value = useContext(ApprovalContext);\n if (value === undefined) {\n throw new Error(\"Approval primitives must be used inside HumanInputPrimitive.Approval.\");\n }\n return value;\n}\n\nexport function useQuestion(): QuestionContextValue {\n const value = useContext(QuestionContext);\n if (value === undefined) {\n throw new Error(\"Question primitives must be used inside HumanInputPrimitive.Question.\");\n }\n return value;\n}\n\nexport function useQuestionPrompt(): QuestionPromptContextValue {\n const value = useContext(QuestionPromptContext);\n if (value === undefined) {\n throw new Error(\n \"Question choice primitives must be used inside HumanInputPrimitive.QuestionPrompt.\",\n );\n }\n return value;\n}\n","import type { UIAttachment } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type ImageContextValue = {\n attachment: UIAttachment;\n src?: string;\n name?: string;\n mediaType?: string;\n isImage: boolean;\n zoomOpen: boolean;\n setZoomOpen(open: boolean): void;\n};\n\nconst ImageContext = createContext<ImageContextValue | undefined>(undefined);\n\nexport function InternalImageProvider({\n value,\n children,\n}: {\n value: ImageContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ImageContext.Provider, { value }, children);\n}\n\nexport function useImage(): ImageContextValue {\n const value = useContext(ImageContext);\n if (value === undefined) {\n throw new Error(\"Image primitives must be used inside ImagePrimitive.Root.\");\n }\n return value;\n}\n","import type { UIMessage, UIMessagePart } from \"@anvia/client\";\nimport { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type MessageContextValue = {\n message: UIMessage;\n};\n\nexport type MessagePartContextValue = {\n isLive: boolean;\n part: UIMessagePart;\n streamControlled: boolean;\n};\n\nconst MessageContext = createContext<MessageContextValue | undefined>(undefined);\nconst MessagePartContext = createContext<MessagePartContextValue | undefined>(undefined);\n\nexport function InternalMessageProvider({\n message,\n children,\n}: {\n message: UIMessage;\n children?: ReactNode;\n}): ReactElement {\n return createElement(MessageContext.Provider, { value: { message } }, children);\n}\n\nexport function InternalMessagePartProvider({\n part,\n isLive = false,\n streamControlled = false,\n children,\n}: {\n part: UIMessagePart;\n isLive?: boolean;\n streamControlled?: boolean;\n children?: ReactNode;\n}): ReactElement {\n return createElement(\n MessagePartContext.Provider,\n { value: { isLive, part, streamControlled } },\n children,\n );\n}\n\nexport function useMessage(): MessageContextValue {\n const value = useContext(MessageContext);\n if (value === undefined) {\n throw new Error(\n \"Message primitives must be used inside MessagePrimitive.Root or ThreadPrimitive.Messages.\",\n );\n }\n return value;\n}\n\nexport function useMessagePart(): MessagePartContextValue {\n const value = useContext(MessagePartContext);\n if (value === undefined) {\n throw new Error(\n \"Message part primitives must be used inside MessagePrimitive.Parts or MessagePrimitive.Part.\",\n );\n }\n return value;\n}\n\nexport function useOptionalMessagePart(): MessagePartContextValue | undefined {\n return useContext(MessagePartContext);\n}\n","import { createContext, createElement, type ReactElement, type ReactNode, useContext } from \"react\";\n\nexport type SelectionToolbarSelection = {\n text: string;\n messageId: string;\n rect: DOMRect;\n};\n\nexport type SelectionToolbarContextValue = {\n selection?: SelectionToolbarSelection;\n quote(): void;\n copy(): Promise<void>;\n clear(): void;\n};\n\nconst SelectionToolbarContext = createContext<SelectionToolbarContextValue | undefined>(undefined);\n\nexport function InternalSelectionToolbarProvider({\n value,\n children,\n}: {\n value: SelectionToolbarContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(SelectionToolbarContext.Provider, { value }, children);\n}\n\nexport function useSelectionToolbar(): SelectionToolbarContextValue {\n const value = useContext(SelectionToolbarContext);\n if (value === undefined) {\n throw new Error(\n \"SelectionToolbar primitives must be used inside SelectionToolbarPrimitive.Root.\",\n );\n }\n return value;\n}\n","import {\n createContext,\n createElement,\n type MutableRefObject,\n type ReactElement,\n type ReactNode,\n useContext,\n} from \"react\";\n\nexport type ThreadContextValue = {\n viewportRef: MutableRefObject<HTMLElement | null>;\n messagesRef: MutableRefObject<HTMLElement | null>;\n atBottom: boolean;\n setAtBottom(atBottom: boolean): void;\n scrollToBottom(behavior?: ScrollBehavior): void;\n};\n\nconst ThreadContext = createContext<ThreadContextValue | undefined>(undefined);\n\nexport function InternalThreadProvider({\n value,\n children,\n}: {\n value: ThreadContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadContext.Provider, { value }, children);\n}\n\nexport function useThread(): ThreadContextValue {\n const value = useContext(ThreadContext);\n if (value === undefined) {\n throw new Error(\"Thread primitives must be used inside ThreadPrimitive.Root.\");\n }\n return value;\n}\n","import {\n createContext,\n createElement,\n type MutableRefObject,\n type ReactElement,\n type ReactNode,\n useContext,\n} from \"react\";\n\nexport type ThreadListRecord = {\n id: string;\n title?: string;\n createdAt?: string | Date;\n updatedAt?: string | Date;\n archived?: boolean;\n metadata?: unknown;\n};\n\nexport type ThreadListController = {\n threads: ThreadListRecord[];\n activeThreadId?: string;\n status?: \"idle\" | \"loading\" | \"error\";\n error?: unknown;\n createThread(): Promise<void> | void;\n switchThread(threadId: string): Promise<void> | void;\n archiveThread?(threadId: string): Promise<void> | void;\n unarchiveThread?(threadId: string): Promise<void> | void;\n deleteThread?(threadId: string): Promise<void> | void;\n};\n\nexport type ThreadListItemContextValue = {\n thread: ThreadListRecord;\n active: boolean;\n};\n\nexport type ThreadListProviderProps = {\n controller: ThreadListController;\n children?: ReactNode;\n};\n\nexport type InternalThreadListRootContextValue = {\n rootRef: MutableRefObject<HTMLDivElement | null>;\n newButtonRef: MutableRefObject<HTMLButtonElement | null>;\n itemElements: MutableRefObject<Map<string, HTMLDivElement>>;\n triggerElements: MutableRefObject<Map<string, HTMLButtonElement>>;\n registerItem(threadId: string, element: HTMLDivElement | null): void;\n registerTrigger(threadId: string, element: HTMLButtonElement | null): void;\n};\n\nconst ThreadListContext = createContext<ThreadListController | undefined>(undefined);\nconst ThreadListItemContext = createContext<ThreadListItemContextValue | undefined>(undefined);\nconst ThreadListRootContext = createContext<InternalThreadListRootContextValue | undefined>(\n undefined,\n);\n\nexport function ThreadListProvider({\n controller,\n children,\n}: ThreadListProviderProps): ReactElement {\n return createElement(ThreadListContext.Provider, { value: controller }, children);\n}\n\nexport function InternalThreadListItemProvider({\n value,\n children,\n}: {\n value: ThreadListItemContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadListItemContext.Provider, { value }, children);\n}\n\nexport function InternalThreadListRootProvider({\n value,\n children,\n}: {\n value: InternalThreadListRootContextValue;\n children?: ReactNode;\n}): ReactElement {\n return createElement(ThreadListRootContext.Provider, { value }, children);\n}\n\nexport function useThreadList(): ThreadListController {\n const value = useContext(ThreadListContext);\n if (value === undefined) {\n throw new Error(\"ThreadList primitives must be used inside ThreadListProvider.\");\n }\n return value;\n}\n\nexport function useThreadListItem(): ThreadListItemContextValue {\n const value = useContext(ThreadListItemContext);\n if (value === undefined) {\n throw new Error(\"ThreadListItem primitives must be used inside ThreadListPrimitive.Items.\");\n }\n return value;\n}\n\nexport function useInternalThreadListRoot(): InternalThreadListRootContextValue {\n const value = useContext(ThreadListRootContext);\n if (value === undefined) {\n throw new Error(\"Thread-list primitives must be used inside ThreadListPrimitive.Root.\");\n }\n return value;\n}\n"],"mappings":";AACA,SAAS,eAAe,eAAkD,kBAAkB;AAO5F,IAAM,oBAAoB,cAAkD,MAAS;AAE9E,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AACF,GAGiB;AACf,SAAO,cAAc,kBAAkB,UAAU,EAAE,MAAM,GAAG,QAAQ;AACtE;AAEO,SAAS,gBAAwC;AACtD,QAAM,QAAQ,WAAW,iBAAiB;AAC1C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,SAAO;AACT;AAEO,SAAS,wBAA4D;AAC1E,SAAO,WAAW,iBAAiB;AACrC;;;ACnBA,SAAS,iBAAAA,gBAAe,iBAAAC,gBAAkD,cAAAC,mBAAkB;AAe5F,IAAM,cAAcF,eAA0C,MAAS;AAEhE,SAAS,aAGd,EAAE,YAAY,SAAS,GAAoD;AAC3E,SAAOC;AAAA,IACL,YAAY;AAAA,IACZ,EAAE,OAAO,WAAwC;AAAA,IACjD;AAAA,EACF;AACF;AAEO,SAAS,iBAGoB;AAClC,QAAM,QAAQC,YAAW,WAAW;AACpC,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,yDAAyD;AAAA,EAC3E;AACA,SAAO;AACT;AAEO,SAAS,gBAAgB;AAC9B,QAAM,eAAe,eAAe,EAAE;AACtC,QAAM,YAAY,aAAa,IAAI;AAAA,IACjC,CAAC,SACC,KAAK,QAAQ,SAAS;AAAA,EAC1B;AACA,QAAM,YAAY,aAAa,IAAI;AAAA,IACjC,CAAC,SACC,KAAK,QAAQ,SAAS;AAAA,EAC1B;AACA,SAAO;AAAA,IACL,WAAW;AAAA,MACT,KAAK;AAAA,MACL,SAA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E,MAAM,GAAG,QAAQ;AAClE;AAEO,SAAS,YAAgC;AAC9C,QAAM,QAAQC,aAAW,aAAa;AACtC,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,6DAA6D;AAAA,EAC/E;AACA,SAAO;AACT;;;ACnCA;AAAA,EACE,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EAIA,cAAAC;AAAA,OACK;AA0CP,IAAM,oBAAoBF,gBAAgD,MAAS;AACnF,IAAM,wBAAwBA,gBAAsD,MAAS;AAC7F,IAAM,wBAAwBA;AAAA,EAC5B;AACF;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AACF,GAA0C;AACxC,SAAOC,gBAAc,kBAAkB,UAAU,EAAE,OAAO,WAAW,GAAG,QAAQ;AAClF;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGiB;AACf,SAAOA,gBAAc,sBAAsB,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC1E;AAEO,SAAS,+BAA+B;AAAA,EAC7C;AAAA,EACA;AACF,GAGiB;AACf,SAAOA,gBAAc,sBAAsB,UAAU,EAAE,MAAM,GAAG,QAAQ;AAC1E;AAEO,SAAS,gBAAsC;AACpD,QAAM,QAAQC,aAAW,iBAAiB;AAC1C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,+DAA+D;AAAA,EACjF;AACA,SAAO;AACT;AAEO,SAAS,oBAAgD;AAC9D,QAAM,QAAQA,aAAW,qBAAqB;AAC9C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,0EAA0E;AAAA,EAC5F;AACA,SAAO;AACT;AAEO,SAAS,4BAAgE;AAC9E,QAAM,QAAQA,aAAW,qBAAqB;AAC9C,MAAI,UAAU,QAAW;AACvB,UAAM,IAAI,MAAM,sEAAsE;AAAA,EACxF;AACA,SAAO;AACT;","names":["createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext","createContext","createElement","useContext"]}
|