vpschatbotwidget 1.1.0 → 1.2.0
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-lib/types/chatbot/api/chatbot-api.d.ts +7 -4
- package/dist-lib/types/chatbot/api/chatbot-api.test.d.ts +1 -0
- package/dist-lib/types/chatbot/api/chatbot-types.d.ts +14 -0
- package/dist-lib/types/chatbot/core/AgentReasoning.d.ts +0 -1
- package/dist-lib/types/chatbot/core/ChatContext.d.ts +4 -1
- package/dist-lib/types/chatbot/core/ChatMarkdown.d.ts +2 -1
- package/dist-lib/types/chatbot/core/ChatProvider.d.ts +2 -0
- package/dist-lib/types/chatbot/core/grounding.test.d.ts +1 -0
- package/dist-lib/types/chatbot/embedded/EmbeddedChatbot.d.ts +1 -0
- package/dist-lib/types/chatbot/index.d.ts +1 -1
- package/dist-lib/types/chatbot/widget/ChatbotWidget.d.ts +1 -0
- package/dist-lib/vps-chatbot.cjs +53 -24
- package/dist-lib/vps-chatbot.js +1181 -840
- package/package.json +1 -1
- package/src/chatbot/api/chatbot-api.test.ts +48 -0
- package/src/chatbot/api/chatbot-api.ts +141 -49
- package/src/chatbot/api/chatbot-types.ts +16 -0
- package/src/chatbot/chatbot.test.tsx +24 -1
- package/src/chatbot/core/AgentReasoning.tsx +28 -23
- package/src/chatbot/core/ChatContext.tsx +4 -0
- package/src/chatbot/core/ChatInput.tsx +14 -1
- package/src/chatbot/core/ChatMarkdown.tsx +12 -3
- package/src/chatbot/core/ChatMessage.tsx +16 -4
- package/src/chatbot/core/ChatProvider.tsx +84 -15
- package/src/chatbot/core/ChatTypingIndicator.tsx +2 -7
- package/src/chatbot/core/GroundedSources.tsx +4 -6
- package/src/chatbot/core/grounding.test.tsx +21 -0
- package/src/chatbot/embedded/EmbeddedChatbot.tsx +4 -1
- package/src/chatbot/index.ts +2 -0
- package/src/chatbot/widget/ChatbotWidget.tsx +4 -1
- package/src/index.css +38 -162
package/dist-lib/vps-chatbot.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
function
|
|
1
|
+
import { jsx as l, jsxs as w, Fragment as De } from "react/jsx-runtime";
|
|
2
|
+
import * as d from "react";
|
|
3
|
+
import oe, { createContext as Et, useContext as it, useMemo as ye, useState as U, useRef as re, useCallback as ue, forwardRef as ct, createElement as He, useEffect as ke } from "react";
|
|
4
|
+
const Rt = {};
|
|
5
|
+
function ve(e) {
|
|
6
6
|
return e != null && e.trim() !== "" ? e.trim().replace(/\/+$/, "") : String("").trim().replace(/\/+$/, "");
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const n =
|
|
8
|
+
function Pe(e, t) {
|
|
9
|
+
const n = ve(e);
|
|
10
10
|
if (!n)
|
|
11
11
|
return t;
|
|
12
12
|
if (n.endsWith("/api") && t.startsWith("/api/"))
|
|
@@ -18,22 +18,22 @@ function Se(e, t) {
|
|
|
18
18
|
const r = t.startsWith("/") ? t : `/${t}`;
|
|
19
19
|
return `${n}${r}`;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function Xe(e) {
|
|
22
22
|
return e && typeof e == "object" && "data" in e && e.success !== !1 ? e.data : e;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function Ze(e, t, n) {
|
|
25
25
|
var o, a, i;
|
|
26
26
|
const r = e, s = (o = r == null ? void 0 : r.error) == null ? void 0 : o.message;
|
|
27
|
-
return s && !
|
|
27
|
+
return s && !At(s) ? {
|
|
28
28
|
code: (a = r == null ? void 0 : r.error) == null ? void 0 : a.code,
|
|
29
29
|
message: s,
|
|
30
30
|
requestId: (i = r == null ? void 0 : r.error) == null ? void 0 : i.request_id
|
|
31
31
|
} : n >= 500 ? { message: "I couldn't process that request right now." } : n === 0 ? { message: "Something went wrong while connecting. Please try again." } : { message: t };
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function At(e) {
|
|
34
34
|
return /traceback|sql|exception|stack|api[_ ]?key|password/i.test(e);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function xe(e) {
|
|
37
37
|
return {
|
|
38
38
|
chunkId: e.chunk_id,
|
|
39
39
|
source: e.source,
|
|
@@ -42,14 +42,14 @@ function je(e) {
|
|
|
42
42
|
snippet: e.snippet
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function Le(e) {
|
|
46
46
|
return {
|
|
47
47
|
toolName: e.tool_name,
|
|
48
48
|
arguments: e.arguments ?? {},
|
|
49
49
|
result: e.result ?? {}
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
function
|
|
52
|
+
function qe(e) {
|
|
53
53
|
return {
|
|
54
54
|
model: e.model,
|
|
55
55
|
promptTokens: e.prompt_tokens,
|
|
@@ -57,7 +57,7 @@ function Je(e) {
|
|
|
57
57
|
totalTokens: e.total_tokens
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Nt(e) {
|
|
61
61
|
const t = e.role === "user" || e.role === "system" ? e.role : "assistant";
|
|
62
62
|
return {
|
|
63
63
|
id: String(e.id),
|
|
@@ -73,7 +73,7 @@ function Rt(e) {
|
|
|
73
73
|
} : void 0
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
async function
|
|
76
|
+
async function Oe(e) {
|
|
77
77
|
const t = await e.text();
|
|
78
78
|
if (!t) return {};
|
|
79
79
|
try {
|
|
@@ -82,11 +82,11 @@ async function At(e) {
|
|
|
82
82
|
return {};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
function
|
|
86
|
-
const t =
|
|
85
|
+
function ut(e) {
|
|
86
|
+
const t = ve(e);
|
|
87
87
|
async function n(r, s) {
|
|
88
88
|
let o;
|
|
89
|
-
const a =
|
|
89
|
+
const a = Pe(t, r);
|
|
90
90
|
try {
|
|
91
91
|
o = await fetch(a, {
|
|
92
92
|
...s,
|
|
@@ -100,105 +100,161 @@ function ot(e) {
|
|
|
100
100
|
}
|
|
101
101
|
if (o.status === 204)
|
|
102
102
|
return;
|
|
103
|
-
const i = await
|
|
103
|
+
const i = await Oe(o);
|
|
104
104
|
if (!o.ok)
|
|
105
|
-
throw
|
|
105
|
+
throw Ze(
|
|
106
106
|
i,
|
|
107
107
|
"I couldn't process that request right now.",
|
|
108
108
|
o.status
|
|
109
109
|
);
|
|
110
|
-
return
|
|
110
|
+
return Xe(i);
|
|
111
111
|
}
|
|
112
112
|
return {
|
|
113
113
|
apiBaseUrl: t,
|
|
114
|
-
async
|
|
115
|
-
|
|
114
|
+
async listModels() {
|
|
115
|
+
try {
|
|
116
|
+
const r = await n("/api/v1/models");
|
|
117
|
+
return { defaultModelId: r.default_model_id, complexModelId: r.complex_model_id, models: r.models || [] };
|
|
118
|
+
} catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
async createSession(r) {
|
|
123
|
+
const s = await n("/api/v1/sessions", {
|
|
116
124
|
method: "POST",
|
|
125
|
+
signal: r,
|
|
117
126
|
body: JSON.stringify({})
|
|
118
127
|
});
|
|
119
|
-
return { sessionId:
|
|
128
|
+
return { sessionId: s.session_id, createdAt: s.created_at };
|
|
120
129
|
},
|
|
121
|
-
async sendMessage(r, s, o) {
|
|
122
|
-
const
|
|
130
|
+
async sendMessage(r, s, o, a) {
|
|
131
|
+
const i = await n(
|
|
123
132
|
`/api/v1/sessions/${r}/messages`,
|
|
124
133
|
{
|
|
125
134
|
method: "POST",
|
|
135
|
+
signal: a,
|
|
126
136
|
body: JSON.stringify({
|
|
127
137
|
message: s,
|
|
128
138
|
...(o == null ? void 0 : o.roleId) !== void 0 ? { role_id: o.roleId } : {},
|
|
129
|
-
...o != null && o.client ? { client: o.client } : {}
|
|
139
|
+
...o != null && o.client ? { client: o.client } : {},
|
|
140
|
+
...o != null && o.modelId ? { model_id: o.modelId } : {}
|
|
130
141
|
})
|
|
131
142
|
}
|
|
132
143
|
);
|
|
133
144
|
return {
|
|
134
|
-
requestId:
|
|
135
|
-
sessionId:
|
|
136
|
-
answer:
|
|
137
|
-
sources: (
|
|
138
|
-
toolCalls: (
|
|
139
|
-
usage:
|
|
145
|
+
requestId: i.request_id,
|
|
146
|
+
sessionId: i.session_id,
|
|
147
|
+
answer: i.answer,
|
|
148
|
+
sources: (i.sources || []).map(xe),
|
|
149
|
+
toolCalls: (i.tool_calls || []).map(Le),
|
|
150
|
+
usage: qe(i.usage),
|
|
151
|
+
durationMs: i.duration_ms
|
|
140
152
|
};
|
|
141
153
|
},
|
|
142
|
-
async sendMessageStream(r, s, o, a) {
|
|
143
|
-
|
|
154
|
+
async sendMessageStream(r, s, o, a, i, u) {
|
|
155
|
+
var g, f;
|
|
156
|
+
const h = Pe(t, `/api/v1/sessions/${r}/messages/stream`);
|
|
144
157
|
try {
|
|
145
|
-
const c = await fetch(
|
|
158
|
+
const c = await fetch(h, {
|
|
146
159
|
method: "POST",
|
|
160
|
+
signal: u,
|
|
147
161
|
headers: {
|
|
148
162
|
"Content-Type": "application/json"
|
|
149
163
|
},
|
|
150
164
|
body: JSON.stringify({
|
|
151
165
|
message: s,
|
|
152
166
|
...(o == null ? void 0 : o.roleId) !== void 0 ? { role_id: o.roleId } : {},
|
|
153
|
-
...o != null && o.client ? { client: o.client } : {}
|
|
167
|
+
...o != null && o.client ? { client: o.client } : {},
|
|
168
|
+
...o != null && o.modelId ? { model_id: o.modelId } : {}
|
|
154
169
|
})
|
|
155
170
|
});
|
|
156
|
-
if (!c.ok
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
171
|
+
if (!c.ok) {
|
|
172
|
+
if (c.status === 404 || c.status === 405)
|
|
173
|
+
return await this.sendMessage(r, s, o, u);
|
|
174
|
+
const T = await Oe(c);
|
|
175
|
+
throw Ze(
|
|
176
|
+
T,
|
|
177
|
+
"I couldn't process that request right now.",
|
|
178
|
+
c.status
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
if (!c.body || (f = (g = c.headers) == null ? void 0 : g.get("content-type")) != null && f.includes("application/json")) {
|
|
182
|
+
const T = Xe(await Oe(c));
|
|
183
|
+
if (typeof T.answer != "string" || !T.usage)
|
|
184
|
+
throw { message: "The response stream ended unexpectedly." };
|
|
185
|
+
return {
|
|
186
|
+
requestId: T.request_id,
|
|
187
|
+
sessionId: T.session_id,
|
|
188
|
+
answer: T.answer,
|
|
189
|
+
sources: (T.sources || []).map(xe),
|
|
190
|
+
toolCalls: (T.tool_calls || []).map(Le),
|
|
191
|
+
usage: qe(T.usage),
|
|
192
|
+
durationMs: T.duration_ms
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const p = c.body.getReader(), b = new TextDecoder();
|
|
196
|
+
let k = "";
|
|
197
|
+
const v = { value: null }, m = (T) => {
|
|
198
|
+
const x = T.split(/\r?\n/).filter((N) => N.startsWith("data:")).map((N) => N.slice(5).trimStart()).join(`
|
|
166
199
|
`);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
if (!x) return;
|
|
201
|
+
let C = {};
|
|
202
|
+
try {
|
|
203
|
+
const N = JSON.parse(x);
|
|
204
|
+
if (!N || typeof N != "object") return;
|
|
205
|
+
C = N;
|
|
206
|
+
} catch {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (C.type === "progress" && typeof C.stage == "string")
|
|
210
|
+
a == null || a(C.stage);
|
|
211
|
+
else if (C.type === "token" && typeof C.text == "string")
|
|
212
|
+
i == null || i(C.text);
|
|
213
|
+
else if (C.type === "complete")
|
|
214
|
+
v.value = {
|
|
215
|
+
requestId: C.request_id || "",
|
|
216
|
+
sessionId: C.session_id || r,
|
|
217
|
+
answer: C.answer || "",
|
|
218
|
+
sources: (C.sources || []).map(xe),
|
|
219
|
+
toolCalls: (C.tool_calls || []).map(Le),
|
|
220
|
+
usage: C.usage ? qe(C.usage) : { model: "", promptTokens: 0, completionTokens: 0, totalTokens: 0 },
|
|
221
|
+
durationMs: C.duration_ms
|
|
222
|
+
};
|
|
223
|
+
else if (C.type === "error")
|
|
224
|
+
throw {
|
|
225
|
+
message: C.message || "I couldn't process that request right now.",
|
|
226
|
+
requestId: C.request_id
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
try {
|
|
230
|
+
for (; !v.value; ) {
|
|
231
|
+
const { done: T, value: x } = await p.read();
|
|
232
|
+
if (T) break;
|
|
233
|
+
if (k += b.decode(x, { stream: !0 }), k.length > 1e6)
|
|
234
|
+
throw { message: "The response stream was too large." };
|
|
235
|
+
const C = k.split(/\r?\n\r?\n/);
|
|
236
|
+
k = C.pop() || "";
|
|
237
|
+
for (const N of C)
|
|
238
|
+
if (m(N), v.value) break;
|
|
190
239
|
}
|
|
240
|
+
k += b.decode(), !v.value && k.trim() && m(k);
|
|
241
|
+
} finally {
|
|
242
|
+
await p.cancel().catch(() => {
|
|
243
|
+
}), p.releaseLock();
|
|
191
244
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
245
|
+
const B = v.value;
|
|
246
|
+
if (B)
|
|
247
|
+
return B;
|
|
248
|
+
throw { message: "The response stream ended before the answer was complete." };
|
|
249
|
+
} catch (c) {
|
|
250
|
+
throw !(c instanceof Error) && c && typeof c == "object" && "message" in c ? c : { message: "Something went wrong while connecting. Please try again." };
|
|
195
251
|
}
|
|
196
252
|
},
|
|
197
253
|
async getHistory(r) {
|
|
198
254
|
try {
|
|
199
255
|
return ((await n(
|
|
200
256
|
`/api/v1/sessions/${r}/messages`
|
|
201
|
-
)).messages || []).map(
|
|
257
|
+
)).messages || []).map(Nt);
|
|
202
258
|
} catch {
|
|
203
259
|
return [];
|
|
204
260
|
}
|
|
@@ -214,7 +270,7 @@ function ot(e) {
|
|
|
214
270
|
},
|
|
215
271
|
async checkHealth() {
|
|
216
272
|
try {
|
|
217
|
-
const r =
|
|
273
|
+
const r = Pe(t, "/health");
|
|
218
274
|
return (await fetch(r)).ok;
|
|
219
275
|
} catch {
|
|
220
276
|
return !1;
|
|
@@ -222,7 +278,7 @@ function ot(e) {
|
|
|
222
278
|
}
|
|
223
279
|
};
|
|
224
280
|
}
|
|
225
|
-
const
|
|
281
|
+
const Sn = ut(), It = [
|
|
226
282
|
{
|
|
227
283
|
label: "How do I access my reports?",
|
|
228
284
|
query: "How do I access my reports in the VPS Customer Portal?"
|
|
@@ -239,15 +295,15 @@ const fn = ot(), Bt = [
|
|
|
239
295
|
label: "How do I contact VPS Support?",
|
|
240
296
|
query: "How can I contact VPS Customer Support?"
|
|
241
297
|
}
|
|
242
|
-
],
|
|
298
|
+
], Ve = Et(null);
|
|
243
299
|
function Mt() {
|
|
244
|
-
const e =
|
|
300
|
+
const e = it(Ve);
|
|
245
301
|
if (!e)
|
|
246
302
|
throw new Error("useChatbot must be used inside ChatProvider.");
|
|
247
303
|
return e;
|
|
248
304
|
}
|
|
249
|
-
function
|
|
250
|
-
return
|
|
305
|
+
function Ge() {
|
|
306
|
+
return it(Ve);
|
|
251
307
|
}
|
|
252
308
|
const Dt = `Hello! I am your **VPS Veritas assistant**.
|
|
253
309
|
|
|
@@ -259,10 +315,10 @@ I can help you with:
|
|
|
259
315
|
- **Samplogic** sample logistics, report downloads, and support tickets
|
|
260
316
|
|
|
261
317
|
Feel free to ask a question or select one of the suggested topics below!`;
|
|
262
|
-
function
|
|
318
|
+
function et(e) {
|
|
263
319
|
return `${e}-${crypto.randomUUID()}`;
|
|
264
320
|
}
|
|
265
|
-
function
|
|
321
|
+
function Bt(e) {
|
|
266
322
|
if (e && typeof e == "object" && "message" in e) {
|
|
267
323
|
const t = String(e.message);
|
|
268
324
|
if (t && !/traceback|sql|exception|stack|api[_ ]?key|password/i.test(t))
|
|
@@ -270,169 +326,219 @@ function It(e) {
|
|
|
270
326
|
}
|
|
271
327
|
return "I couldn't process that request right now.";
|
|
272
328
|
}
|
|
273
|
-
const
|
|
329
|
+
const dt = ({
|
|
274
330
|
children: e,
|
|
275
331
|
userContext: t = {},
|
|
276
332
|
role: n,
|
|
277
333
|
roleId: r,
|
|
278
334
|
client: s,
|
|
279
335
|
welcomeMessage: o,
|
|
280
|
-
suggestions: a =
|
|
336
|
+
suggestions: a = It,
|
|
281
337
|
disableSuggestions: i = !1,
|
|
282
|
-
initialMessage:
|
|
283
|
-
apiBaseUrl:
|
|
338
|
+
initialMessage: u,
|
|
339
|
+
apiBaseUrl: h,
|
|
284
340
|
apiUrl: g,
|
|
285
|
-
proxyUrl:
|
|
286
|
-
api:
|
|
287
|
-
hideInspectSources:
|
|
288
|
-
showGroundedSources:
|
|
341
|
+
proxyUrl: f,
|
|
342
|
+
api: c,
|
|
343
|
+
hideInspectSources: p = !1,
|
|
344
|
+
showGroundedSources: b = !0,
|
|
345
|
+
modelId: k = "auto"
|
|
289
346
|
}) => {
|
|
290
|
-
const
|
|
291
|
-
() =>
|
|
292
|
-
[
|
|
293
|
-
),
|
|
347
|
+
const v = h ?? g ?? f, m = ye(
|
|
348
|
+
() => c ?? ut(v),
|
|
349
|
+
[c, v]
|
|
350
|
+
), B = ye(() => ({
|
|
294
351
|
...t,
|
|
295
352
|
...n !== void 0 ? { role: n } : {},
|
|
296
353
|
...r !== void 0 ? { roleId: r } : {},
|
|
297
354
|
...s !== void 0 ? { client: s } : {}
|
|
298
|
-
}), [t, n, r, s]),
|
|
355
|
+
}), [t, n, r, s]), T = ye(() => o === "" ? null : {
|
|
299
356
|
id: "welcome-default",
|
|
300
357
|
role: "assistant",
|
|
301
358
|
content: o || Dt,
|
|
302
359
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
303
360
|
status: "complete"
|
|
304
|
-
}, [o]), [
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
return
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
361
|
+
}, [o]), [x, C] = U(null), [N, I] = U(() => T ? [T] : []), [z, q] = U("idle"), [le, K] = U(null), y = re(null), A = re(!1), M = re(null), D = re(!1), [P, O] = U([]), [L, Y] = U(k);
|
|
362
|
+
oe.useEffect(() => Y(k), [k]), oe.useEffect(() => {
|
|
363
|
+
var S;
|
|
364
|
+
let R = !0;
|
|
365
|
+
return O([]), (S = m.listModels) == null || S.call(m).then((V) => {
|
|
366
|
+
R && O((V == null ? void 0 : V.models) || []);
|
|
367
|
+
}).catch(() => {
|
|
368
|
+
}), () => {
|
|
369
|
+
R = !1;
|
|
370
|
+
};
|
|
371
|
+
}, [m]);
|
|
372
|
+
const ee = ue((R) => {
|
|
373
|
+
!D.current && (R === "auto" || P.some((S) => S.id === R && S.configured)) && Y(R);
|
|
374
|
+
}, [P]);
|
|
375
|
+
oe.useEffect(() => () => {
|
|
376
|
+
var R;
|
|
377
|
+
return (R = M.current) == null ? void 0 : R.abort();
|
|
378
|
+
}, []);
|
|
379
|
+
const de = ue(async (R) => {
|
|
380
|
+
if (x) return x;
|
|
381
|
+
q("connecting");
|
|
382
|
+
const S = await m.createSession(R);
|
|
383
|
+
if (R.aborted) throw new DOMException("Aborted", "AbortError");
|
|
384
|
+
return C(S.sessionId), S.sessionId;
|
|
385
|
+
}, [x, m]), ne = ue(
|
|
386
|
+
async (R) => {
|
|
387
|
+
if (D.current) return;
|
|
388
|
+
D.current = !0;
|
|
389
|
+
const S = new AbortController();
|
|
390
|
+
M.current = S;
|
|
391
|
+
let V, fe = "";
|
|
392
|
+
const me = () => {
|
|
393
|
+
V !== void 0 && cancelAnimationFrame(V), V = void 0;
|
|
394
|
+
};
|
|
395
|
+
y.current = R;
|
|
396
|
+
const ie = {
|
|
397
|
+
id: et("user"),
|
|
314
398
|
role: "user",
|
|
315
|
-
content:
|
|
399
|
+
content: R,
|
|
316
400
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
317
401
|
status: "complete"
|
|
318
|
-
},
|
|
319
|
-
id:
|
|
402
|
+
}, se = et("asst"), ge = {
|
|
403
|
+
id: se,
|
|
320
404
|
role: "assistant",
|
|
321
405
|
content: "",
|
|
322
406
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
323
407
|
status: "pending",
|
|
324
|
-
progressText: "
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
(
|
|
330
|
-
(Z) => Z.id ===
|
|
408
|
+
progressText: "Preparing your answer…"
|
|
409
|
+
}, Ee = performance.now();
|
|
410
|
+
I((X) => [...X, ie, ge]), q("awaiting"), K(null);
|
|
411
|
+
const Re = (X) => {
|
|
412
|
+
S.signal.aborted || I(
|
|
413
|
+
(j) => j.map(
|
|
414
|
+
(Z) => Z.id === se ? { ...Z, progressText: X } : Z
|
|
331
415
|
)
|
|
332
416
|
);
|
|
333
417
|
};
|
|
334
418
|
try {
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
419
|
+
const X = await de(S.signal), j = m.sendMessageStream ? await m.sendMessageStream(
|
|
420
|
+
X,
|
|
421
|
+
R,
|
|
338
422
|
{
|
|
339
|
-
roleId:
|
|
340
|
-
client:
|
|
423
|
+
roleId: B.roleId,
|
|
424
|
+
client: B.client,
|
|
425
|
+
modelId: L
|
|
341
426
|
},
|
|
427
|
+
Re,
|
|
342
428
|
(Z) => {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
429
|
+
S.signal.aborted || (fe += Z, V === void 0 && (V = requestAnimationFrame(() => {
|
|
430
|
+
V = void 0, S.signal.aborted || I((Q) => Q.map((be) => be.id === se ? { ...be, content: fe } : be));
|
|
431
|
+
})));
|
|
432
|
+
},
|
|
433
|
+
S.signal
|
|
434
|
+
) : await m.sendMessage(X, R, {
|
|
435
|
+
roleId: B.roleId,
|
|
436
|
+
client: B.client,
|
|
437
|
+
modelId: L
|
|
438
|
+
}, S.signal);
|
|
439
|
+
if (me(), S.signal.aborted) return;
|
|
440
|
+
I(
|
|
350
441
|
(Z) => Z.map(
|
|
351
|
-
(
|
|
352
|
-
...
|
|
353
|
-
id:
|
|
354
|
-
content:
|
|
442
|
+
(Q) => Q.id === se ? {
|
|
443
|
+
...Q,
|
|
444
|
+
id: j.requestId || se,
|
|
445
|
+
content: j.answer,
|
|
355
446
|
status: "complete",
|
|
356
447
|
progressText: void 0,
|
|
357
|
-
sources:
|
|
358
|
-
toolCalls:
|
|
359
|
-
usage:
|
|
360
|
-
|
|
448
|
+
sources: j.sources,
|
|
449
|
+
toolCalls: j.toolCalls,
|
|
450
|
+
usage: j.usage,
|
|
451
|
+
durationMs: Math.max(
|
|
452
|
+
Math.round(performance.now() - Ee),
|
|
453
|
+
j.durationMs ?? 0
|
|
454
|
+
)
|
|
455
|
+
} : Q
|
|
361
456
|
)
|
|
362
|
-
),
|
|
363
|
-
} catch (
|
|
364
|
-
|
|
365
|
-
|
|
457
|
+
), q("idle");
|
|
458
|
+
} catch (X) {
|
|
459
|
+
if (me(), S.signal.aborted) return;
|
|
460
|
+
const j = Bt(X);
|
|
461
|
+
I(
|
|
366
462
|
(Z) => Z.map(
|
|
367
|
-
(
|
|
463
|
+
(Q) => Q.id === se ? { ...Q, content: j, status: "error", progressText: void 0 } : Q
|
|
368
464
|
)
|
|
369
|
-
),
|
|
465
|
+
), K(j), q("error");
|
|
466
|
+
} finally {
|
|
467
|
+
me(), M.current === S && (M.current = null, D.current = !1);
|
|
370
468
|
}
|
|
371
469
|
},
|
|
372
|
-
[
|
|
373
|
-
),
|
|
374
|
-
async (
|
|
375
|
-
const
|
|
376
|
-
!
|
|
470
|
+
[de, m, B.client, B.roleId, L]
|
|
471
|
+
), he = ue(
|
|
472
|
+
async (R) => {
|
|
473
|
+
const S = R.trim();
|
|
474
|
+
!S || z === "awaiting" || z === "connecting" || await ne(S);
|
|
377
475
|
},
|
|
378
|
-
[
|
|
379
|
-
),
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}, []),
|
|
384
|
-
}, []),
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
476
|
+
[ne, z]
|
|
477
|
+
), J = ue(async () => {
|
|
478
|
+
if (D.current) return;
|
|
479
|
+
const R = y.current;
|
|
480
|
+
R && (I((S) => S.filter((V) => V.status !== "error")), await ne(R));
|
|
481
|
+
}, [ne]), ae = ue(async () => {
|
|
482
|
+
}, []), $ = ue(() => {
|
|
483
|
+
}, []), pe = ue(async () => {
|
|
484
|
+
var R;
|
|
485
|
+
(R = M.current) == null || R.abort(), M.current = null, D.current = !1, C(null), I(T ? [T] : []), q("idle"), K(null), y.current = null, x && await m.closeSession(x);
|
|
486
|
+
}, [x, m, T]);
|
|
487
|
+
oe.useEffect(() => {
|
|
488
|
+
!u || A.current || (A.current = !0, he(u));
|
|
489
|
+
}, [u, he]);
|
|
490
|
+
const Te = ye(
|
|
391
491
|
() => ({
|
|
392
|
-
messages:
|
|
393
|
-
status:
|
|
394
|
-
error:
|
|
395
|
-
sessionId:
|
|
492
|
+
messages: N,
|
|
493
|
+
status: z,
|
|
494
|
+
error: le,
|
|
495
|
+
sessionId: x,
|
|
396
496
|
pendingTicket: null,
|
|
397
497
|
ticketBusy: !1,
|
|
398
498
|
lastTicket: null,
|
|
399
499
|
suggestions: a,
|
|
400
|
-
showSuggestions: !i && (
|
|
500
|
+
showSuggestions: !i && (N.length === 0 || N.length === 1 && N[0].id === "welcome-default"),
|
|
401
501
|
suggestionBadgesEnabled: !i,
|
|
402
|
-
userContext:
|
|
403
|
-
apiBaseUrl:
|
|
404
|
-
hideInspectSources:
|
|
405
|
-
showGroundedSources:
|
|
406
|
-
sendMessage:
|
|
407
|
-
retryLast:
|
|
408
|
-
confirmTicket:
|
|
409
|
-
cancelTicket:
|
|
410
|
-
resetConversation:
|
|
502
|
+
userContext: B,
|
|
503
|
+
apiBaseUrl: m.apiBaseUrl,
|
|
504
|
+
hideInspectSources: p,
|
|
505
|
+
showGroundedSources: b,
|
|
506
|
+
sendMessage: he,
|
|
507
|
+
retryLast: J,
|
|
508
|
+
confirmTicket: ae,
|
|
509
|
+
cancelTicket: $,
|
|
510
|
+
resetConversation: pe,
|
|
511
|
+
models: P,
|
|
512
|
+
selectedModelId: L,
|
|
513
|
+
selectModel: ee
|
|
411
514
|
}),
|
|
412
515
|
[
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
516
|
+
N,
|
|
517
|
+
z,
|
|
518
|
+
le,
|
|
519
|
+
x,
|
|
417
520
|
a,
|
|
418
521
|
i,
|
|
419
|
-
F,
|
|
420
|
-
b.apiBaseUrl,
|
|
421
|
-
d,
|
|
422
|
-
p,
|
|
423
522
|
B,
|
|
424
|
-
|
|
523
|
+
m.apiBaseUrl,
|
|
524
|
+
p,
|
|
525
|
+
b,
|
|
526
|
+
he,
|
|
527
|
+
J,
|
|
528
|
+
ae,
|
|
529
|
+
$,
|
|
530
|
+
pe,
|
|
425
531
|
P,
|
|
426
|
-
|
|
427
|
-
|
|
532
|
+
L,
|
|
533
|
+
ee
|
|
428
534
|
]
|
|
429
535
|
);
|
|
430
|
-
return /* @__PURE__ */ l(
|
|
536
|
+
return /* @__PURE__ */ l(Ve.Provider, { value: Te, children: e });
|
|
431
537
|
};
|
|
432
|
-
function
|
|
538
|
+
function Be() {
|
|
433
539
|
return Mt();
|
|
434
540
|
}
|
|
435
|
-
const
|
|
541
|
+
const Pt = ({ message: e, onRetry: t }) => /* @__PURE__ */ w(
|
|
436
542
|
"div",
|
|
437
543
|
{
|
|
438
544
|
className: "chat-error-banner",
|
|
@@ -457,14 +563,14 @@ const Nt = ({ message: e, onRetry: t }) => /* @__PURE__ */ T(
|
|
|
457
563
|
* This source code is licensed under the ISC license.
|
|
458
564
|
* See the LICENSE file in the root directory of this source tree.
|
|
459
565
|
*/
|
|
460
|
-
const
|
|
566
|
+
const xt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ht = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim();
|
|
461
567
|
/**
|
|
462
568
|
* @license lucide-react v0.468.0 - ISC
|
|
463
569
|
*
|
|
464
570
|
* This source code is licensed under the ISC license.
|
|
465
571
|
* See the LICENSE file in the root directory of this source tree.
|
|
466
572
|
*/
|
|
467
|
-
var
|
|
573
|
+
var Lt = {
|
|
468
574
|
xmlns: "http://www.w3.org/2000/svg",
|
|
469
575
|
width: 24,
|
|
470
576
|
height: 24,
|
|
@@ -481,7 +587,7 @@ var xt = {
|
|
|
481
587
|
* This source code is licensed under the ISC license.
|
|
482
588
|
* See the LICENSE file in the root directory of this source tree.
|
|
483
589
|
*/
|
|
484
|
-
const
|
|
590
|
+
const qt = ct(
|
|
485
591
|
({
|
|
486
592
|
color: e = "currentColor",
|
|
487
593
|
size: t = 24,
|
|
@@ -491,20 +597,20 @@ const Lt = st(
|
|
|
491
597
|
children: o,
|
|
492
598
|
iconNode: a,
|
|
493
599
|
...i
|
|
494
|
-
},
|
|
600
|
+
}, u) => He(
|
|
495
601
|
"svg",
|
|
496
602
|
{
|
|
497
|
-
ref:
|
|
498
|
-
...
|
|
603
|
+
ref: u,
|
|
604
|
+
...Lt,
|
|
499
605
|
width: t,
|
|
500
606
|
height: t,
|
|
501
607
|
stroke: e,
|
|
502
608
|
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
503
|
-
className:
|
|
609
|
+
className: ht("lucide", s),
|
|
504
610
|
...i
|
|
505
611
|
},
|
|
506
612
|
[
|
|
507
|
-
...a.map(([
|
|
613
|
+
...a.map(([h, g]) => He(h, g)),
|
|
508
614
|
...Array.isArray(o) ? o : [o]
|
|
509
615
|
]
|
|
510
616
|
)
|
|
@@ -515,12 +621,12 @@ const Lt = st(
|
|
|
515
621
|
* This source code is licensed under the ISC license.
|
|
516
622
|
* See the LICENSE file in the root directory of this source tree.
|
|
517
623
|
*/
|
|
518
|
-
const
|
|
519
|
-
const n =
|
|
520
|
-
({ className: r, ...s }, o) =>
|
|
624
|
+
const H = (e, t) => {
|
|
625
|
+
const n = ct(
|
|
626
|
+
({ className: r, ...s }, o) => He(qt, {
|
|
521
627
|
ref: o,
|
|
522
628
|
iconNode: t,
|
|
523
|
-
className:
|
|
629
|
+
className: ht(`lucide-${xt(e)}`, r),
|
|
524
630
|
...s
|
|
525
631
|
})
|
|
526
632
|
);
|
|
@@ -532,7 +638,7 @@ const z = (e, t) => {
|
|
|
532
638
|
* This source code is licensed under the ISC license.
|
|
533
639
|
* See the LICENSE file in the root directory of this source tree.
|
|
534
640
|
*/
|
|
535
|
-
const Ot =
|
|
641
|
+
const Ot = H("ArrowDown", [
|
|
536
642
|
["path", { d: "M12 5v14", key: "s699le" }],
|
|
537
643
|
["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
|
|
538
644
|
]);
|
|
@@ -542,7 +648,7 @@ const Ot = z("ArrowDown", [
|
|
|
542
648
|
* This source code is licensed under the ISC license.
|
|
543
649
|
* See the LICENSE file in the root directory of this source tree.
|
|
544
650
|
*/
|
|
545
|
-
const
|
|
651
|
+
const $t = H("ArrowLeft", [
|
|
546
652
|
["path", { d: "m12 19-7-7 7-7", key: "1l729n" }],
|
|
547
653
|
["path", { d: "M19 12H5", key: "x3x0zl" }]
|
|
548
654
|
]);
|
|
@@ -552,7 +658,7 @@ const qt = z("ArrowLeft", [
|
|
|
552
658
|
* This source code is licensed under the ISC license.
|
|
553
659
|
* See the LICENSE file in the root directory of this source tree.
|
|
554
660
|
*/
|
|
555
|
-
const
|
|
661
|
+
const Ht = H("ArrowUp", [
|
|
556
662
|
["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
|
|
557
663
|
["path", { d: "M12 19V5", key: "x0mq9r" }]
|
|
558
664
|
]);
|
|
@@ -562,7 +668,23 @@ const Wt = z("ArrowUp", [
|
|
|
562
668
|
* This source code is licensed under the ISC license.
|
|
563
669
|
* See the LICENSE file in the root directory of this source tree.
|
|
564
670
|
*/
|
|
565
|
-
const
|
|
671
|
+
const zt = H("BookOpen", [
|
|
672
|
+
["path", { d: "M12 7v14", key: "1akyts" }],
|
|
673
|
+
[
|
|
674
|
+
"path",
|
|
675
|
+
{
|
|
676
|
+
d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",
|
|
677
|
+
key: "ruj8y"
|
|
678
|
+
}
|
|
679
|
+
]
|
|
680
|
+
]);
|
|
681
|
+
/**
|
|
682
|
+
* @license lucide-react v0.468.0 - ISC
|
|
683
|
+
*
|
|
684
|
+
* This source code is licensed under the ISC license.
|
|
685
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
686
|
+
*/
|
|
687
|
+
const pt = H("BotMessageSquare", [
|
|
566
688
|
["path", { d: "M12 6V2H8", key: "1155em" }],
|
|
567
689
|
["path", { d: "m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z", key: "w2lp3e" }],
|
|
568
690
|
["path", { d: "M2 12h2", key: "1t8f8n" }],
|
|
@@ -576,28 +698,15 @@ const it = z("BotMessageSquare", [
|
|
|
576
698
|
* This source code is licensed under the ISC license.
|
|
577
699
|
* See the LICENSE file in the root directory of this source tree.
|
|
578
700
|
*/
|
|
579
|
-
const
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
[
|
|
588
|
-
"path",
|
|
589
|
-
{
|
|
590
|
-
d: "M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",
|
|
591
|
-
key: "ep3f8r"
|
|
592
|
-
}
|
|
593
|
-
],
|
|
594
|
-
["path", { d: "M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4", key: "1p4c4q" }],
|
|
595
|
-
["path", { d: "M17.599 6.5a3 3 0 0 0 .399-1.375", key: "tmeiqw" }],
|
|
596
|
-
["path", { d: "M6.003 5.125A3 3 0 0 0 6.401 6.5", key: "105sqy" }],
|
|
597
|
-
["path", { d: "M3.477 10.896a4 4 0 0 1 .585-.396", key: "ql3yin" }],
|
|
598
|
-
["path", { d: "M19.938 10.5a4 4 0 0 1 .585.396", key: "1qfode" }],
|
|
599
|
-
["path", { d: "M6 18a4 4 0 0 1-1.967-.516", key: "2e4loj" }],
|
|
600
|
-
["path", { d: "M19.967 17.484A4 4 0 0 1 18 18", key: "159ez6" }]
|
|
701
|
+
const Wt = H("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
|
|
702
|
+
/**
|
|
703
|
+
* @license lucide-react v0.468.0 - ISC
|
|
704
|
+
*
|
|
705
|
+
* This source code is licensed under the ISC license.
|
|
706
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
707
|
+
*/
|
|
708
|
+
const Vt = H("ChevronDown", [
|
|
709
|
+
["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]
|
|
601
710
|
]);
|
|
602
711
|
/**
|
|
603
712
|
* @license lucide-react v0.468.0 - ISC
|
|
@@ -605,14 +714,24 @@ const $t = z("Brain", [
|
|
|
605
714
|
* This source code is licensed under the ISC license.
|
|
606
715
|
* See the LICENSE file in the root directory of this source tree.
|
|
607
716
|
*/
|
|
608
|
-
const
|
|
717
|
+
const Gt = H("ChevronUp", [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]]);
|
|
718
|
+
/**
|
|
719
|
+
* @license lucide-react v0.468.0 - ISC
|
|
720
|
+
*
|
|
721
|
+
* This source code is licensed under the ISC license.
|
|
722
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
723
|
+
*/
|
|
724
|
+
const Ut = H("CircleCheck", [
|
|
725
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
726
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
727
|
+
]);
|
|
609
728
|
/**
|
|
610
729
|
* @license lucide-react v0.468.0 - ISC
|
|
611
730
|
*
|
|
612
731
|
* This source code is licensed under the ISC license.
|
|
613
732
|
* See the LICENSE file in the root directory of this source tree.
|
|
614
733
|
*/
|
|
615
|
-
const
|
|
734
|
+
const jt = H("ClipboardCheck", [
|
|
616
735
|
["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
|
|
617
736
|
[
|
|
618
737
|
"path",
|
|
@@ -629,7 +748,18 @@ const Vt = z("ClipboardCheck", [
|
|
|
629
748
|
* This source code is licensed under the ISC license.
|
|
630
749
|
* See the LICENSE file in the root directory of this source tree.
|
|
631
750
|
*/
|
|
632
|
-
const
|
|
751
|
+
const Yt = H("ExternalLink", [
|
|
752
|
+
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
753
|
+
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
754
|
+
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
755
|
+
]);
|
|
756
|
+
/**
|
|
757
|
+
* @license lucide-react v0.468.0 - ISC
|
|
758
|
+
*
|
|
759
|
+
* This source code is licensed under the ISC license.
|
|
760
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
761
|
+
*/
|
|
762
|
+
const Jt = H("FlaskConical", [
|
|
633
763
|
[
|
|
634
764
|
"path",
|
|
635
765
|
{
|
|
@@ -646,7 +776,16 @@ const zt = z("FlaskConical", [
|
|
|
646
776
|
* This source code is licensed under the ISC license.
|
|
647
777
|
* See the LICENSE file in the root directory of this source tree.
|
|
648
778
|
*/
|
|
649
|
-
const
|
|
779
|
+
const Kt = H("LoaderCircle", [
|
|
780
|
+
["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
|
|
781
|
+
]);
|
|
782
|
+
/**
|
|
783
|
+
* @license lucide-react v0.468.0 - ISC
|
|
784
|
+
*
|
|
785
|
+
* This source code is licensed under the ISC license.
|
|
786
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
787
|
+
*/
|
|
788
|
+
const ft = H("MessageSquare", [
|
|
650
789
|
["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }]
|
|
651
790
|
]);
|
|
652
791
|
/**
|
|
@@ -655,7 +794,7 @@ const ct = z("MessageSquare", [
|
|
|
655
794
|
* This source code is licensed under the ISC license.
|
|
656
795
|
* See the LICENSE file in the root directory of this source tree.
|
|
657
796
|
*/
|
|
658
|
-
const
|
|
797
|
+
const Qt = H("Microscope", [
|
|
659
798
|
["path", { d: "M6 18h8", key: "1borvv" }],
|
|
660
799
|
["path", { d: "M3 22h18", key: "8prr45" }],
|
|
661
800
|
["path", { d: "M14 22a7 7 0 1 0 0-14h-1", key: "1jwaiy" }],
|
|
@@ -669,14 +808,14 @@ const Gt = z("Microscope", [
|
|
|
669
808
|
* This source code is licensed under the ISC license.
|
|
670
809
|
* See the LICENSE file in the root directory of this source tree.
|
|
671
810
|
*/
|
|
672
|
-
const
|
|
811
|
+
const Xt = H("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
|
|
673
812
|
/**
|
|
674
813
|
* @license lucide-react v0.468.0 - ISC
|
|
675
814
|
*
|
|
676
815
|
* This source code is licensed under the ISC license.
|
|
677
816
|
* See the LICENSE file in the root directory of this source tree.
|
|
678
817
|
*/
|
|
679
|
-
const
|
|
818
|
+
const Zt = H("RefreshCw", [
|
|
680
819
|
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
681
820
|
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
682
821
|
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
@@ -688,7 +827,23 @@ const jt = z("RefreshCw", [
|
|
|
688
827
|
* This source code is licensed under the ISC license.
|
|
689
828
|
* See the LICENSE file in the root directory of this source tree.
|
|
690
829
|
*/
|
|
691
|
-
const
|
|
830
|
+
const er = H("ShieldCheck", [
|
|
831
|
+
[
|
|
832
|
+
"path",
|
|
833
|
+
{
|
|
834
|
+
d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
|
|
835
|
+
key: "oel41y"
|
|
836
|
+
}
|
|
837
|
+
],
|
|
838
|
+
["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
|
|
839
|
+
]);
|
|
840
|
+
/**
|
|
841
|
+
* @license lucide-react v0.468.0 - ISC
|
|
842
|
+
*
|
|
843
|
+
* This source code is licensed under the ISC license.
|
|
844
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
845
|
+
*/
|
|
846
|
+
const tr = H("TestTubeDiagonal", [
|
|
692
847
|
[
|
|
693
848
|
"path",
|
|
694
849
|
{ d: "M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3", key: "1ub6xw" }
|
|
@@ -702,42 +857,42 @@ const Yt = z("TestTubeDiagonal", [
|
|
|
702
857
|
* This source code is licensed under the ISC license.
|
|
703
858
|
* See the LICENSE file in the root directory of this source tree.
|
|
704
859
|
*/
|
|
705
|
-
const
|
|
860
|
+
const rr = H("X", [
|
|
706
861
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
707
862
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
708
|
-
]),
|
|
863
|
+
]), nr = {
|
|
709
864
|
alpha: {
|
|
710
865
|
label: "Alpha",
|
|
711
|
-
Icon:
|
|
866
|
+
Icon: Jt,
|
|
712
867
|
variant: "env-badge--alpha",
|
|
713
868
|
tooltip: "Alpha build — internal testing only"
|
|
714
869
|
},
|
|
715
870
|
beta: {
|
|
716
871
|
label: "Beta",
|
|
717
|
-
Icon:
|
|
872
|
+
Icon: tr,
|
|
718
873
|
variant: "env-badge--beta",
|
|
719
874
|
tooltip: "Beta build — public pre-release"
|
|
720
875
|
},
|
|
721
876
|
gamma: {
|
|
722
877
|
label: "Gamma",
|
|
723
|
-
Icon:
|
|
878
|
+
Icon: Qt,
|
|
724
879
|
variant: "env-badge--gamma",
|
|
725
880
|
tooltip: "Gamma / Release Candidate"
|
|
726
881
|
},
|
|
727
882
|
qa: {
|
|
728
883
|
label: "QA",
|
|
729
|
-
Icon:
|
|
884
|
+
Icon: jt,
|
|
730
885
|
variant: "env-badge--qa",
|
|
731
886
|
tooltip: "Quality Assurance build"
|
|
732
887
|
}
|
|
733
|
-
},
|
|
888
|
+
}, sr = ({
|
|
734
889
|
stage: e,
|
|
735
890
|
pulse: t = !0,
|
|
736
891
|
className: n = ""
|
|
737
892
|
}) => {
|
|
738
893
|
if (!e) return null;
|
|
739
|
-
const { label: r, Icon: s, variant: o, tooltip: a } =
|
|
740
|
-
return /* @__PURE__ */
|
|
894
|
+
const { label: r, Icon: s, variant: o, tooltip: a } = nr[e];
|
|
895
|
+
return /* @__PURE__ */ w(
|
|
741
896
|
"span",
|
|
742
897
|
{
|
|
743
898
|
className: `env-badge-inline ${o} ${n}`.trim(),
|
|
@@ -750,7 +905,7 @@ const Jt = z("X", [
|
|
|
750
905
|
]
|
|
751
906
|
}
|
|
752
907
|
);
|
|
753
|
-
},
|
|
908
|
+
}, or = (e) => /* @__PURE__ */ l(
|
|
754
909
|
"svg",
|
|
755
910
|
{
|
|
756
911
|
width: e.width || "24px",
|
|
@@ -762,7 +917,7 @@ const Jt = z("X", [
|
|
|
762
917
|
...e,
|
|
763
918
|
children: /* @__PURE__ */ l("path", { d: "M11.999 0c-2.25 0-4.5.06-6.6.21a5.57 5.57 0 0 0-5.19 5.1c-.24 3.21-.27 6.39-.06 9.6a5.644 5.644 0 0 0 5.7 5.19h3.15v-3.9h-3.15c-.93.03-1.74-.63-1.83-1.56-.18-3-.15-6 .06-9 .06-.84.72-1.47 1.56-1.53 2.04-.15 4.2-.21 6.36-.21s4.32.09 6.36.18c.81.06 1.5.69 1.56 1.53.24 3 .24 6 .06 9-.12.93-.9 1.62-1.83 1.59h-3.15l-6 3.9V24l6-3.9h3.15c2.97.03 5.46-2.25 5.7-5.19.21-3.18.18-6.39-.03-9.57a5.57 5.57 0 0 0-5.19-5.1c-2.13-.18-4.38-.24-6.63-.24zm-5.04 8.76c-.36 0-.66.3-.66.66v2.34c0 .33.18.63.48.78 1.62.78 3.42 1.2 5.22 1.26 1.8-.06 3.6-.48 5.22-1.26.3-.15.48-.45.48-.78V9.42c0-.09-.03-.15-.09-.21a.648.648 0 0 0-.87-.36c-1.5.66-3.12 1.02-4.77 1.05-1.65-.03-3.27-.42-4.77-1.08a.566.566 0 0 0-.24-.06z" })
|
|
764
919
|
}
|
|
765
|
-
),
|
|
920
|
+
), lr = ({
|
|
766
921
|
title: e = "VPS AI Assistant",
|
|
767
922
|
subtitle: t = "Customer portal support",
|
|
768
923
|
onClose: n,
|
|
@@ -771,8 +926,8 @@ const Jt = z("X", [
|
|
|
771
926
|
showMinimize: o = !1,
|
|
772
927
|
envStage: a,
|
|
773
928
|
envPulse: i = !0
|
|
774
|
-
}) => /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
929
|
+
}) => /* @__PURE__ */ w("header", { className: "chat-header", children: [
|
|
930
|
+
/* @__PURE__ */ w("div", { className: "chat-header-left", children: [
|
|
776
931
|
s && /* @__PURE__ */ l(
|
|
777
932
|
"button",
|
|
778
933
|
{
|
|
@@ -780,7 +935,7 @@ const Jt = z("X", [
|
|
|
780
935
|
onClick: s,
|
|
781
936
|
className: "icon-btn-back",
|
|
782
937
|
"aria-label": "Back",
|
|
783
|
-
children: /* @__PURE__ */ l(
|
|
938
|
+
children: /* @__PURE__ */ l($t, { size: 16 })
|
|
784
939
|
}
|
|
785
940
|
),
|
|
786
941
|
/* @__PURE__ */ l(
|
|
@@ -788,18 +943,18 @@ const Jt = z("X", [
|
|
|
788
943
|
{
|
|
789
944
|
className: "avatar-circle",
|
|
790
945
|
"aria-hidden": "true",
|
|
791
|
-
children: /* @__PURE__ */ l(
|
|
946
|
+
children: /* @__PURE__ */ l(or, { width: "16px", height: "16px", color: "white" })
|
|
792
947
|
}
|
|
793
948
|
),
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ w("div", { children: [
|
|
950
|
+
/* @__PURE__ */ w("div", { className: "chat-header-title-row", children: [
|
|
796
951
|
/* @__PURE__ */ l("h2", { className: "chat-header-title", children: e }),
|
|
797
|
-
/* @__PURE__ */ l(
|
|
952
|
+
/* @__PURE__ */ l(sr, { stage: a, pulse: i })
|
|
798
953
|
] }),
|
|
799
954
|
/* @__PURE__ */ l("p", { className: "chat-header-subtitle", children: t || "Customer portal support" })
|
|
800
955
|
] })
|
|
801
956
|
] }),
|
|
802
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ w("div", { className: "chat-header-actions", children: [
|
|
803
958
|
r && /* @__PURE__ */ l(
|
|
804
959
|
"button",
|
|
805
960
|
{
|
|
@@ -808,7 +963,7 @@ const Jt = z("X", [
|
|
|
808
963
|
className: "icon-btn-action",
|
|
809
964
|
"aria-label": "Start a new conversation",
|
|
810
965
|
title: "New conversation",
|
|
811
|
-
children: /* @__PURE__ */ l(
|
|
966
|
+
children: /* @__PURE__ */ l(Zt, { size: 15 })
|
|
812
967
|
}
|
|
813
968
|
),
|
|
814
969
|
n && /* @__PURE__ */ l(
|
|
@@ -818,25 +973,25 @@ const Jt = z("X", [
|
|
|
818
973
|
onClick: n,
|
|
819
974
|
className: "icon-btn-action",
|
|
820
975
|
"aria-label": o ? "Minimize chat" : "Close chat",
|
|
821
|
-
children: /* @__PURE__ */ l(
|
|
976
|
+
children: /* @__PURE__ */ l(Xt, { size: 16 })
|
|
822
977
|
}
|
|
823
978
|
)
|
|
824
979
|
] })
|
|
825
980
|
] });
|
|
826
|
-
function
|
|
827
|
-
const n =
|
|
828
|
-
|
|
981
|
+
function ar(e, t) {
|
|
982
|
+
const n = re(e);
|
|
983
|
+
ke(() => {
|
|
829
984
|
var r;
|
|
830
985
|
n.current && !e && ((r = t.current) == null || r.focus()), n.current = e;
|
|
831
986
|
}, [e, t]);
|
|
832
987
|
}
|
|
833
|
-
function
|
|
988
|
+
function ir(e, t) {
|
|
834
989
|
const n = t.trim().toLowerCase();
|
|
835
990
|
return n ? e.filter(
|
|
836
991
|
(r) => r.label.toLowerCase().includes(n) || r.query.toLowerCase().includes(n)
|
|
837
992
|
) : e;
|
|
838
993
|
}
|
|
839
|
-
const
|
|
994
|
+
const cr = ({
|
|
840
995
|
suggestions: e,
|
|
841
996
|
onSelect: t,
|
|
842
997
|
disabled: n,
|
|
@@ -868,55 +1023,55 @@ const rr = ({
|
|
|
868
1023
|
children: s.label
|
|
869
1024
|
},
|
|
870
1025
|
s.query
|
|
871
|
-
)) }) : null,
|
|
1026
|
+
)) }) : null, ur = ({
|
|
872
1027
|
onSend: e,
|
|
873
1028
|
disabled: t = !1,
|
|
874
1029
|
placeholder: n = "Ask something…"
|
|
875
1030
|
}) => {
|
|
876
|
-
const { suggestions: r, showSuggestions: s, suggestionBadgesEnabled: o } =
|
|
877
|
-
|
|
1031
|
+
const { suggestions: r, showSuggestions: s, suggestionBadgesEnabled: o, models: a, selectedModelId: i, selectModel: u } = Be(), [h, g] = U(""), f = re(null), c = oe.useId(), p = (m) => {
|
|
1032
|
+
m && (m.style.height = "auto", m.style.height = `${Math.min(m.scrollHeight, 96)}px`);
|
|
878
1033
|
};
|
|
879
|
-
|
|
880
|
-
f
|
|
881
|
-
}, [
|
|
882
|
-
const
|
|
1034
|
+
ar(t, f), ke(() => {
|
|
1035
|
+
p(f.current);
|
|
1036
|
+
}, [h]);
|
|
1037
|
+
const b = ye(() => {
|
|
883
1038
|
if (!o || t) return [];
|
|
884
|
-
const
|
|
885
|
-
return
|
|
886
|
-
}, [t, s, o, r,
|
|
887
|
-
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
},
|
|
891
|
-
const
|
|
892
|
-
!
|
|
1039
|
+
const m = h.trim();
|
|
1040
|
+
return m ? ir(r, m) : s ? r : [];
|
|
1041
|
+
}, [t, s, o, r, h]), k = (m) => {
|
|
1042
|
+
g(m.query);
|
|
1043
|
+
const B = f.current;
|
|
1044
|
+
B == null || B.focus();
|
|
1045
|
+
}, v = () => {
|
|
1046
|
+
const m = h.trim();
|
|
1047
|
+
!m || t || (e(m), g(""), f.current && (f.current.style.height = "auto"));
|
|
893
1048
|
};
|
|
894
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ w("div", { className: "chat-input-wrapper", children: [
|
|
895
1050
|
/* @__PURE__ */ l(
|
|
896
|
-
|
|
1051
|
+
cr,
|
|
897
1052
|
{
|
|
898
1053
|
variant: "badge",
|
|
899
|
-
suggestions:
|
|
900
|
-
onSelect:
|
|
1054
|
+
suggestions: b,
|
|
1055
|
+
onSelect: k,
|
|
901
1056
|
disabled: t
|
|
902
1057
|
}
|
|
903
1058
|
),
|
|
904
1059
|
/* @__PURE__ */ l("label", { htmlFor: "vps-chat-input", className: "sr-only", children: "Chat message" }),
|
|
905
|
-
/* @__PURE__ */
|
|
1060
|
+
/* @__PURE__ */ w("div", { className: "chat-input-row", children: [
|
|
906
1061
|
/* @__PURE__ */ l(
|
|
907
1062
|
"textarea",
|
|
908
1063
|
{
|
|
909
1064
|
id: "vps-chat-input",
|
|
910
|
-
ref:
|
|
1065
|
+
ref: f,
|
|
911
1066
|
rows: 1,
|
|
912
|
-
value:
|
|
1067
|
+
value: h,
|
|
913
1068
|
disabled: t,
|
|
914
1069
|
placeholder: n,
|
|
915
|
-
onChange: (
|
|
916
|
-
|
|
1070
|
+
onChange: (m) => {
|
|
1071
|
+
g(m.target.value), p(m.target);
|
|
917
1072
|
},
|
|
918
|
-
onKeyDown: (
|
|
919
|
-
|
|
1073
|
+
onKeyDown: (m) => {
|
|
1074
|
+
m.key === "Enter" && !m.shiftKey && (m.preventDefault(), v());
|
|
920
1075
|
},
|
|
921
1076
|
className: "chat-textarea"
|
|
922
1077
|
}
|
|
@@ -925,29 +1080,46 @@ const rr = ({
|
|
|
925
1080
|
"button",
|
|
926
1081
|
{
|
|
927
1082
|
type: "button",
|
|
928
|
-
onClick:
|
|
929
|
-
disabled: t || !
|
|
1083
|
+
onClick: v,
|
|
1084
|
+
disabled: t || !h.trim(),
|
|
930
1085
|
"aria-label": "Send message",
|
|
931
1086
|
className: "chat-send-btn",
|
|
932
|
-
children: /* @__PURE__ */ l(
|
|
1087
|
+
children: /* @__PURE__ */ l(Ht, { size: 16 })
|
|
933
1088
|
}
|
|
934
1089
|
)
|
|
935
1090
|
] }),
|
|
936
|
-
/* @__PURE__ */
|
|
1091
|
+
a.length > 1 && /* @__PURE__ */ w("div", { className: "chat-model-picker", children: [
|
|
1092
|
+
/* @__PURE__ */ l("label", { htmlFor: c, children: "AI model" }),
|
|
1093
|
+
/* @__PURE__ */ w(
|
|
1094
|
+
"select",
|
|
1095
|
+
{
|
|
1096
|
+
id: c,
|
|
1097
|
+
"aria-label": "AI model",
|
|
1098
|
+
value: i,
|
|
1099
|
+
disabled: t,
|
|
1100
|
+
onChange: (m) => u(m.target.value),
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ l("option", { value: "auto", children: "Automatic" }),
|
|
1103
|
+
a.map((m) => /* @__PURE__ */ l("option", { value: m.id, disabled: !m.configured, children: m.label }, m.id))
|
|
1104
|
+
]
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
] }),
|
|
1108
|
+
/* @__PURE__ */ w("p", { className: "chat-input-footer", children: [
|
|
937
1109
|
"Powered by ",
|
|
938
1110
|
/* @__PURE__ */ l("span", { className: "chat-input-footer-brand", children: "VPS Veritas AI" })
|
|
939
1111
|
] })
|
|
940
1112
|
] });
|
|
941
1113
|
};
|
|
942
|
-
function
|
|
943
|
-
let o =
|
|
944
|
-
if (!n) return
|
|
1114
|
+
function dr({ defaultTagName: e, props: t, render: n, state: r = {}, stateAttributesMapping: s }) {
|
|
1115
|
+
let o = ze(hr(r, s), t);
|
|
1116
|
+
if (!n) return d.createElement(e, o);
|
|
945
1117
|
if (typeof n == "function") return n(o, r);
|
|
946
|
-
if (!
|
|
947
|
-
let a = n.props, i = { ...
|
|
948
|
-
return
|
|
1118
|
+
if (!d.isValidElement(n)) return null;
|
|
1119
|
+
let a = n.props, i = { ...ze(o, a), ref: Se(o.ref, a.ref) };
|
|
1120
|
+
return d.cloneElement(n, i);
|
|
949
1121
|
}
|
|
950
|
-
function
|
|
1122
|
+
function ze(...e) {
|
|
951
1123
|
let t = {};
|
|
952
1124
|
for (let n of e) {
|
|
953
1125
|
if (!n) continue;
|
|
@@ -956,12 +1128,12 @@ function Ee(...e) {
|
|
|
956
1128
|
let o = r[s];
|
|
957
1129
|
if (o === void 0) continue;
|
|
958
1130
|
let a = t[s];
|
|
959
|
-
s === "className" ? t[s] = [a, o].filter(Boolean).join(" ") : s === "style" ? t[s] = { ...a, ...o } : s === "ref" ? t[s] =
|
|
1131
|
+
s === "className" ? t[s] = [a, o].filter(Boolean).join(" ") : s === "style" ? t[s] = { ...a, ...o } : s === "ref" ? t[s] = Se(a, o) : fr(s) && typeof a == "function" && typeof o == "function" ? t[s] = pr(o, a) : t[s] = o;
|
|
960
1132
|
}
|
|
961
1133
|
}
|
|
962
1134
|
return t;
|
|
963
1135
|
}
|
|
964
|
-
function
|
|
1136
|
+
function hr(e, t) {
|
|
965
1137
|
var r;
|
|
966
1138
|
let n = {};
|
|
967
1139
|
for (let s of Object.keys(e)) {
|
|
@@ -974,132 +1146,132 @@ function or(e, t) {
|
|
|
974
1146
|
n["data-slot"] = o;
|
|
975
1147
|
continue;
|
|
976
1148
|
}
|
|
977
|
-
let i = `data-${String(s).replace(/[A-Z]/g, (
|
|
1149
|
+
let i = `data-${String(s).replace(/[A-Z]/g, (u) => `-${u.toLowerCase()}`)}`;
|
|
978
1150
|
typeof o == "boolean" ? n[i] = o ? "" : void 0 : o != null && (n[i] = String(o));
|
|
979
1151
|
}
|
|
980
1152
|
return n;
|
|
981
1153
|
}
|
|
982
|
-
function
|
|
1154
|
+
function pr(e, t) {
|
|
983
1155
|
return function(n) {
|
|
984
1156
|
e(n), n.defaultPrevented || t(n);
|
|
985
1157
|
};
|
|
986
1158
|
}
|
|
987
|
-
function
|
|
1159
|
+
function fr(e) {
|
|
988
1160
|
return /^on[A-Z]/.test(e);
|
|
989
1161
|
}
|
|
990
|
-
function
|
|
1162
|
+
function Se(...e) {
|
|
991
1163
|
let t = e.filter(Boolean);
|
|
992
1164
|
if (t.length !== 0) return (n) => {
|
|
993
1165
|
for (let r of t) typeof r == "function" ? r(n) : r && (r.current = n);
|
|
994
1166
|
};
|
|
995
1167
|
}
|
|
996
|
-
var
|
|
997
|
-
function
|
|
998
|
-
if (!r || !e) return
|
|
999
|
-
let s =
|
|
1168
|
+
var mr = 8, gr = 64, br = 0, Ie = 0.5, vr = 180, _r = /* @__PURE__ */ new Set(["ArrowDown", "ArrowUp", "End", "Home", "PageDown", "PageUp", " "]), mt = { start: !1, end: !1 }, wr = [], Me = { currentAnchorId: null, visibleMessageIds: wr };
|
|
1169
|
+
function yr({ content: e, scrollEdgeThreshold: t, spacer: n, viewport: r }) {
|
|
1170
|
+
if (!r || !e) return mt;
|
|
1171
|
+
let s = Ue({ content: e, spacer: n, viewport: r });
|
|
1000
1172
|
return { start: r.scrollTop > t, end: s - r.scrollTop - r.clientHeight > t };
|
|
1001
1173
|
}
|
|
1002
|
-
function
|
|
1003
|
-
if (!e || !s) return
|
|
1004
|
-
let a = s.getBoundingClientRect(), i = a.top + t + n,
|
|
1005
|
-
for (let
|
|
1006
|
-
let
|
|
1007
|
-
if (!
|
|
1008
|
-
let
|
|
1009
|
-
(
|
|
1174
|
+
function kr({ content: e, scrollMargin: t, scrollPreviousItemPeek: n, spacer: r, viewport: s, visibleMessageIds: o }) {
|
|
1175
|
+
if (!e || !s) return Me;
|
|
1176
|
+
let a = s.getBoundingClientRect(), i = a.top + t + n, u = typeof IntersectionObserver > "u", h = [], g = null;
|
|
1177
|
+
for (let f of Ce(e, r)) {
|
|
1178
|
+
let c = f.dataset.messageId;
|
|
1179
|
+
if (!c) continue;
|
|
1180
|
+
let p = f.dataset.scrollAnchor === "true", b = p || u ? f.getBoundingClientRect() : null;
|
|
1181
|
+
(u && b ? b.bottom > i && b.top < a.bottom : o.has(c)) && h.push(c), p && b && b.top <= i + Ie && (g = c);
|
|
1010
1182
|
}
|
|
1011
|
-
return
|
|
1183
|
+
return h.length === 0 && g === null ? Me : { currentAnchorId: g, visibleMessageIds: h };
|
|
1012
1184
|
}
|
|
1013
|
-
function
|
|
1185
|
+
function Ce(e, t) {
|
|
1014
1186
|
return Array.from(e.children).filter((n) => n instanceof HTMLElement && n !== t);
|
|
1015
1187
|
}
|
|
1016
|
-
function
|
|
1188
|
+
function Cr(e, t) {
|
|
1017
1189
|
for (let n = t; n < e.length; n++) {
|
|
1018
1190
|
let r = e[n];
|
|
1019
1191
|
if ((r == null ? void 0 : r.dataset.scrollAnchor) === "true") return r;
|
|
1020
1192
|
}
|
|
1021
1193
|
return null;
|
|
1022
1194
|
}
|
|
1023
|
-
function
|
|
1195
|
+
function Sr(e, t) {
|
|
1024
1196
|
for (let n of e) if (n.dataset.scrollAnchor === "true" && !t.has(n)) return n;
|
|
1025
1197
|
return null;
|
|
1026
1198
|
}
|
|
1027
|
-
function
|
|
1199
|
+
function Fr(e, t) {
|
|
1028
1200
|
var r;
|
|
1029
1201
|
let n = 0;
|
|
1030
1202
|
for (let s = t; s < e.length; s++) if (((r = e[s]) == null ? void 0 : r.dataset.scrollAnchor) === "true" && (n += 1, n > 1)) return !0;
|
|
1031
1203
|
return !1;
|
|
1032
1204
|
}
|
|
1033
|
-
function
|
|
1205
|
+
function Tr(e) {
|
|
1034
1206
|
for (let t = e.length - 1; t >= 0; t--) {
|
|
1035
1207
|
let n = e[t];
|
|
1036
1208
|
if ((n == null ? void 0 : n.dataset.scrollAnchor) === "true") return n;
|
|
1037
1209
|
}
|
|
1038
1210
|
return null;
|
|
1039
1211
|
}
|
|
1040
|
-
function
|
|
1212
|
+
function Er({ content: e, spacer: t, viewport: n }) {
|
|
1041
1213
|
let r = n.getBoundingClientRect();
|
|
1042
|
-
for (let s of
|
|
1214
|
+
for (let s of Ce(e, t)) {
|
|
1043
1215
|
if (!s.dataset.messageId) continue;
|
|
1044
1216
|
let o = s.getBoundingClientRect();
|
|
1045
1217
|
if (o.bottom > r.top && o.top < r.bottom) return s;
|
|
1046
1218
|
}
|
|
1047
1219
|
return null;
|
|
1048
1220
|
}
|
|
1049
|
-
function
|
|
1050
|
-
let o =
|
|
1221
|
+
function Rr({ align: e, element: t, scrollMargin: n, spacer: r, viewport: s }) {
|
|
1222
|
+
let o = gt(t, s), a = t.getBoundingClientRect().height, i = Ir(r);
|
|
1051
1223
|
if (e === "center") {
|
|
1052
|
-
let
|
|
1053
|
-
return o - i.start - (
|
|
1224
|
+
let u = Math.max(0, s.clientHeight - i.start - i.end);
|
|
1225
|
+
return o - i.start - (u - a) / 2 - n;
|
|
1054
1226
|
}
|
|
1055
1227
|
if (e === "end") return o - s.clientHeight + a + i.end + n;
|
|
1056
1228
|
if (e === "nearest") {
|
|
1057
|
-
let
|
|
1058
|
-
return o >=
|
|
1229
|
+
let u = o + a, h = s.scrollTop + i.start, g = s.scrollTop + s.clientHeight - i.end;
|
|
1230
|
+
return o >= h && u <= g ? s.scrollTop : o < h ? o - i.start - n : u - s.clientHeight + i.end + n;
|
|
1059
1231
|
}
|
|
1060
1232
|
return o - i.start - n;
|
|
1061
1233
|
}
|
|
1062
|
-
function
|
|
1234
|
+
function gt(e, t) {
|
|
1063
1235
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
1064
1236
|
return n.top - r.top + t.scrollTop;
|
|
1065
1237
|
}
|
|
1066
|
-
function
|
|
1238
|
+
function Ae(e, t) {
|
|
1067
1239
|
return e.getBoundingClientRect().top - t.getBoundingClientRect().top;
|
|
1068
1240
|
}
|
|
1069
|
-
function
|
|
1070
|
-
let s =
|
|
1241
|
+
function Ar({ content: e, scrollTop: t, spacer: n, viewport: r }) {
|
|
1242
|
+
let s = Ue({ content: e, spacer: n, viewport: r });
|
|
1071
1243
|
return t + r.clientHeight - s;
|
|
1072
1244
|
}
|
|
1073
|
-
function
|
|
1074
|
-
let r =
|
|
1075
|
-
for (let
|
|
1076
|
-
let
|
|
1077
|
-
i = Math.max(i,
|
|
1245
|
+
function Ue({ content: e, spacer: t, viewport: n }) {
|
|
1246
|
+
let r = Ce(e, t), s = bt(e), o = n.getBoundingClientRect(), a = n.scrollTop, i = s.start + s.end;
|
|
1247
|
+
for (let u of r) {
|
|
1248
|
+
let h = u.getBoundingClientRect();
|
|
1249
|
+
i = Math.max(i, h.bottom - o.top + a + s.end);
|
|
1078
1250
|
}
|
|
1079
1251
|
return i;
|
|
1080
1252
|
}
|
|
1081
|
-
function
|
|
1253
|
+
function Nr(e) {
|
|
1082
1254
|
return Math.max(0, e.scrollHeight - e.clientHeight);
|
|
1083
1255
|
}
|
|
1084
|
-
function
|
|
1256
|
+
function bt(e) {
|
|
1085
1257
|
let t = window.getComputedStyle(e);
|
|
1086
|
-
return { end:
|
|
1258
|
+
return { end: We(t.paddingBlockEnd || t.paddingBottom), start: We(t.paddingBlockStart || t.paddingTop) };
|
|
1087
1259
|
}
|
|
1088
|
-
function
|
|
1260
|
+
function Ir(e) {
|
|
1089
1261
|
let t = e == null ? void 0 : e.parentElement;
|
|
1090
|
-
return t ?
|
|
1262
|
+
return t ? bt(t) : { end: 0, start: 0 };
|
|
1091
1263
|
}
|
|
1092
|
-
function
|
|
1264
|
+
function Mr(e) {
|
|
1093
1265
|
if (!e) return 0;
|
|
1094
1266
|
let t = window.getComputedStyle(e), n = t.rowGap === "normal" ? t.gap : t.rowGap;
|
|
1095
|
-
return
|
|
1267
|
+
return We(n);
|
|
1096
1268
|
}
|
|
1097
|
-
function
|
|
1269
|
+
function We(e) {
|
|
1098
1270
|
if (!e) return 0;
|
|
1099
1271
|
let t = Number.parseFloat(e);
|
|
1100
1272
|
return Number.isFinite(t) ? t : 0;
|
|
1101
1273
|
}
|
|
1102
|
-
function
|
|
1274
|
+
function vt(e, t) {
|
|
1103
1275
|
let n = e, r = /* @__PURE__ */ new Set();
|
|
1104
1276
|
return { getSnapshot: () => n, hasListeners: () => r.size > 0, setSnapshot: (s) => {
|
|
1105
1277
|
t(n, s) || (n = s, r.forEach((o) => o()));
|
|
@@ -1110,409 +1282,409 @@ function ft(e, t) {
|
|
|
1110
1282
|
};
|
|
1111
1283
|
} };
|
|
1112
1284
|
}
|
|
1113
|
-
function
|
|
1114
|
-
return
|
|
1285
|
+
function tt(e, t) {
|
|
1286
|
+
return vt(e, t);
|
|
1115
1287
|
}
|
|
1116
|
-
function
|
|
1117
|
-
return
|
|
1288
|
+
function Dr() {
|
|
1289
|
+
return vt(Me, Pr);
|
|
1118
1290
|
}
|
|
1119
|
-
function
|
|
1291
|
+
function Br(e, t) {
|
|
1120
1292
|
return e.start === t.start && e.end === t.end;
|
|
1121
1293
|
}
|
|
1122
|
-
function
|
|
1294
|
+
function Pr(e, t) {
|
|
1123
1295
|
return e.currentAnchorId !== t.currentAnchorId || e.visibleMessageIds.length !== t.visibleMessageIds.length ? !1 : e.visibleMessageIds.every((n, r) => n === t.visibleMessageIds[r]);
|
|
1124
1296
|
}
|
|
1125
|
-
function
|
|
1126
|
-
let o =
|
|
1127
|
-
return
|
|
1297
|
+
function xr({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: r, scrollPreviousItemPeek: s }) {
|
|
1298
|
+
let o = d.useRef(e), a = d.useRef(!1), i = d.useRef(null), u = d.useRef(!1), h = d.useRef(n), g = d.useRef(0), f = d.useRef(null), c = d.useRef(0), p = d.useRef(e ? "following-bottom" : "free-scrolling"), b = d.useRef(/* @__PURE__ */ new Map()), k = d.useRef(null), v = d.useRef(null), m = d.useRef(null), B = d.useRef(s), T = d.useRef(!0), x = d.useRef(null), C = d.useRef(r), N = d.useRef(null), I = d.useRef(0), z = d.useRef(0), q = d.useRef(null), le = d.useRef(null), K = d.useRef(null), y = d.useRef(null), A = d.useRef(null), M = d.useRef(null), D = d.useRef(null), P = d.useRef(null), O = d.useRef(null), L = d.useRef(/* @__PURE__ */ new Set()), Y = d.useRef(/* @__PURE__ */ new WeakSet());
|
|
1299
|
+
return K.current === null && (K.current = tt(t === "end" || t === "last-anchor", (ee, de) => ee === de)), y.current === null && (y.current = tt(mt, Br)), O.current === null && (O.current = Dr()), o.current = e, h.current = n, C.current = r, B.current = s, { autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: A, streamingTurnRef: m, contentRef: i, defaultScrollPositionAppliedRef: u, firstItemRef: f, itemCountRef: g, lastScrollTopRef: c, messageElementsRef: b, modeRef: p, pendingScrollFrameRef: N, pendingScrollToMessageRef: k, prependRestoreRef: v, preserveScrollOnPrependRef: T, pendingDefaultScrollStore: K.current, rootRef: x, scrollEdgeThresholdRef: h, scrollMarginRef: C, scrollPreviousItemPeekRef: B, spacerGapRef: I, spacerHeightRef: z, spacerRef: q, stateFrameRef: le, stateStore: y.current, viewportRef: M, visibilityFrameRef: D, visibilityObserverRef: P, visibilityStore: O.current, visibleMessageIdsRef: L, handledScrollAnchorsRef: Y };
|
|
1128
1300
|
}
|
|
1129
|
-
function
|
|
1301
|
+
function _t(e) {
|
|
1130
1302
|
e.pendingDefaultScrollStore.setSnapshot(!1);
|
|
1131
1303
|
}
|
|
1132
|
-
function
|
|
1133
|
-
e.defaultScrollPositionAppliedRef.current = !0,
|
|
1304
|
+
function Ne(e) {
|
|
1305
|
+
e.defaultScrollPositionAppliedRef.current = !0, _t(e);
|
|
1134
1306
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let { streamingTurnRef: s, autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef:
|
|
1137
|
-
i.current !== null && (window.clearTimeout(i.current), i.current = null), a.current !==
|
|
1307
|
+
function Lr({ refs: e, commitScrollState: t, scheduleStateCommit: n, scheduleVisibilitySync: r }) {
|
|
1308
|
+
let { streamingTurnRef: s, autoScrollRef: o, autoscrollingRef: a, autoscrollingTimeoutRef: i, contentRef: u, itemCountRef: h, messageElementsRef: g, modeRef: f, pendingScrollToMessageRef: c, prependRestoreRef: p, scrollMarginRef: b, scrollPreviousItemPeekRef: k, spacerGapRef: v, spacerHeightRef: m, spacerRef: B, viewportRef: T } = e, x = d.useCallback((y) => {
|
|
1309
|
+
i.current !== null && (window.clearTimeout(i.current), i.current = null), a.current !== y && (a.current = y, t()), y && (i.current = window.setTimeout(() => {
|
|
1138
1310
|
i.current = null, a.current = !1, t();
|
|
1139
|
-
},
|
|
1140
|
-
}, [t]),
|
|
1141
|
-
let
|
|
1142
|
-
if (!
|
|
1143
|
-
let
|
|
1144
|
-
|
|
1145
|
-
}, []), N =
|
|
1146
|
-
let
|
|
1147
|
-
if (!
|
|
1148
|
-
let
|
|
1149
|
-
if (Math.abs(
|
|
1150
|
-
|
|
1311
|
+
}, vr));
|
|
1312
|
+
}, [t]), C = d.useCallback((y) => {
|
|
1313
|
+
let A = B.current;
|
|
1314
|
+
if (!A) return;
|
|
1315
|
+
let M = Math.max(0, Math.ceil(y));
|
|
1316
|
+
m.current !== M && (m.current = M, A.hidden = M === 0, A.style.height = `${M}px`, A.style.marginTop = M > 0 ? `${-v.current}px` : "");
|
|
1317
|
+
}, []), N = d.useCallback((y, { behavior: A = "auto", autoscrolling: M = !1 } = {}) => {
|
|
1318
|
+
let D = T.current;
|
|
1319
|
+
if (!D) return;
|
|
1320
|
+
let P = Math.max(0, y);
|
|
1321
|
+
if (Math.abs(D.scrollTop - P) <= Ie) {
|
|
1322
|
+
D.scrollTop = P, t();
|
|
1151
1323
|
return;
|
|
1152
1324
|
}
|
|
1153
|
-
|
|
1154
|
-
}, [t, n,
|
|
1155
|
-
let
|
|
1156
|
-
return
|
|
1157
|
-
}, [r, N,
|
|
1158
|
-
let
|
|
1159
|
-
if (!
|
|
1160
|
-
let
|
|
1161
|
-
return
|
|
1162
|
-
}, [r, N,
|
|
1163
|
-
let
|
|
1164
|
-
return !
|
|
1165
|
-
}, [q]),
|
|
1166
|
-
let
|
|
1167
|
-
return
|
|
1325
|
+
M && x(!0), D.scrollTo({ top: P, behavior: A }), n();
|
|
1326
|
+
}, [t, n, x]), I = d.useCallback(({ behavior: y = "auto" } = {}) => T.current ? (C(0), s.current = null, f.current = "free-scrolling", N(0, { behavior: y }), r(), !0) : !1, [r, N, C]), z = d.useCallback(({ behavior: y = "auto" } = {}) => {
|
|
1327
|
+
let A = T.current;
|
|
1328
|
+
return A ? (C(0), s.current = null, f.current = o.current ? "following-bottom" : "free-scrolling", N(Nr(A), { autoscrolling: !0, behavior: y }), r(), !0) : !1;
|
|
1329
|
+
}, [r, N, C]), q = d.useCallback((y, { align: A = "start", behavior: M = "auto", scrollMargin: D = b.current } = {}, { keepPreviousPeek: P = !1 } = {}) => {
|
|
1330
|
+
let O = u.current, L = T.current;
|
|
1331
|
+
if (!O || !L || !O.contains(y)) return !1;
|
|
1332
|
+
let Y = Rr({ align: A, element: y, scrollMargin: P ? D + k.current : D, spacer: B.current, viewport: L }), ee = Ar({ content: O, scrollTop: Y, spacer: B.current, viewport: L });
|
|
1333
|
+
return C(ee), p.current = { element: y, viewportTop: Ae(y, L) }, f.current = P ? "anchored-to-message" : "settling-jump", s.current = P ? y : null, N(Y, { behavior: M }), r(), !0;
|
|
1334
|
+
}, [r, N, C]), le = d.useCallback(() => {
|
|
1335
|
+
let y = s.current;
|
|
1336
|
+
return !y || !y.isConnected || f.current !== "anchored-to-message" ? !1 : q(y, { align: "start" }, { keepPreviousPeek: !0 });
|
|
1337
|
+
}, [q]), K = d.useCallback((y, A) => {
|
|
1338
|
+
let M = g.current.get(y);
|
|
1339
|
+
return M ? (Ne(e), q(M, A) ? (c.current = null, !0) : (c.current = { messageId: y, options: A }, !0)) : h.current === 0 ? (c.current = { messageId: y, options: A }, Ne(e), !0) : !1;
|
|
1168
1340
|
}, [q]);
|
|
1169
|
-
return { flushPendingScrollToMessage:
|
|
1170
|
-
let
|
|
1171
|
-
if (!
|
|
1172
|
-
let
|
|
1173
|
-
return !
|
|
1174
|
-
}, [q]), reanchorToAnchoredMessage:
|
|
1175
|
-
}
|
|
1176
|
-
function
|
|
1177
|
-
return
|
|
1341
|
+
return { flushPendingScrollToMessage: d.useCallback(() => {
|
|
1342
|
+
let y = c.current;
|
|
1343
|
+
if (!y) return !1;
|
|
1344
|
+
let A = g.current.get(y.messageId);
|
|
1345
|
+
return !A || !q(A, y.options) ? !1 : (c.current = null, Ne(e), !0);
|
|
1346
|
+
}, [q]), reanchorToAnchoredMessage: le, scrollToElement: q, scrollToEnd: z, scrollToMessage: K, scrollToStart: I };
|
|
1347
|
+
}
|
|
1348
|
+
function rt(e, t) {
|
|
1349
|
+
return d.useCallback((n) => {
|
|
1178
1350
|
e.current = n, n && t();
|
|
1179
1351
|
}, [e, t]);
|
|
1180
1352
|
}
|
|
1181
|
-
function
|
|
1182
|
-
let o =
|
|
1183
|
-
|
|
1184
|
-
let
|
|
1185
|
-
let
|
|
1186
|
-
for (let
|
|
1187
|
-
}, []),
|
|
1188
|
-
var
|
|
1189
|
-
let
|
|
1190
|
-
|
|
1191
|
-
}, []), J =
|
|
1192
|
-
let
|
|
1193
|
-
|
|
1194
|
-
let
|
|
1195
|
-
|
|
1196
|
-
}, [
|
|
1197
|
-
|
|
1198
|
-
|
|
1353
|
+
function qr({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: n = mr, scrollPreviousItemPeek: r = gr, scrollMargin: s = br }) {
|
|
1354
|
+
let o = xr({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: s, scrollPreviousItemPeek: r }), { streamingTurnRef: a, autoScrollRef: i, autoscrollingRef: u, autoscrollingTimeoutRef: h, contentRef: g, defaultScrollPositionAppliedRef: f, firstItemRef: c, itemCountRef: p, lastScrollTopRef: b, messageElementsRef: k, modeRef: v, pendingScrollFrameRef: m, pendingScrollToMessageRef: B, prependRestoreRef: T, preserveScrollOnPrependRef: x, pendingDefaultScrollStore: C, rootRef: N, scrollEdgeThresholdRef: I, scrollMarginRef: z, scrollPreviousItemPeekRef: q, spacerGapRef: le, spacerHeightRef: K, spacerRef: y, stateFrameRef: A, stateStore: M, viewportRef: D, visibilityFrameRef: P, visibilityObserverRef: O, visibilityStore: L, visibleMessageIdsRef: Y, handledScrollAnchorsRef: ee } = o, de = d.useRef(t);
|
|
1355
|
+
de.current !== t && (de.current = t, f.current = !1);
|
|
1356
|
+
let ne = d.useCallback((_) => {
|
|
1357
|
+
let F = N.current, E = D.current, W = [_.start && "start", _.end && "end"].filter(Boolean).join(" "), ce = u.current;
|
|
1358
|
+
for (let G of [F, E]) G && (W ? G.setAttribute("data-scrollable", W) : G.removeAttribute("data-scrollable"), G.toggleAttribute("data-autoscrolling", ce));
|
|
1359
|
+
}, []), he = d.useCallback((_) => {
|
|
1360
|
+
var W;
|
|
1361
|
+
let F = ((W = D.current) == null ? void 0 : W.scrollTop) ?? 0, E = F < b.current - Ie;
|
|
1362
|
+
b.current = F, i.current && !_.end && v.current !== "settling-jump" && v.current !== "anchored-to-message" ? v.current = "following-bottom" : v.current === "following-bottom" && _.end && E && !u.current && (v.current = "free-scrolling");
|
|
1363
|
+
}, []), J = d.useCallback(() => {
|
|
1364
|
+
let _ = yr({ content: g.current, scrollEdgeThreshold: I.current, spacer: y.current, viewport: D.current });
|
|
1365
|
+
he(_);
|
|
1366
|
+
let F = v.current === "following-bottom" ? { ..._, end: !1 } : _;
|
|
1367
|
+
ne(F), M.setSnapshot(F);
|
|
1368
|
+
}, [he, M, ne]), ae = d.useCallback(() => {
|
|
1369
|
+
A.current === null && (A.current = window.requestAnimationFrame(() => {
|
|
1370
|
+
A.current = null, J();
|
|
1199
1371
|
}));
|
|
1200
|
-
}, [J]),
|
|
1201
|
-
|
|
1202
|
-
|
|
1372
|
+
}, [J]), $ = d.useCallback(() => {
|
|
1373
|
+
L.hasListeners() && P.current === null && (P.current = window.requestAnimationFrame(() => {
|
|
1374
|
+
P.current = null, L.hasListeners() && L.setSnapshot(kr({ content: g.current, scrollMargin: z.current, scrollPreviousItemPeek: q.current, spacer: y.current, viewport: D.current, visibleMessageIds: Y.current }));
|
|
1203
1375
|
}));
|
|
1204
|
-
}, [
|
|
1205
|
-
let
|
|
1206
|
-
if (!
|
|
1207
|
-
let
|
|
1208
|
-
return Math.abs(
|
|
1209
|
-
}, [
|
|
1210
|
-
let
|
|
1211
|
-
if (!
|
|
1212
|
-
|
|
1376
|
+
}, [L]), { flushPendingScrollToMessage: pe, reanchorToAnchoredMessage: Te, scrollToElement: R, scrollToEnd: S, scrollToMessage: V, scrollToStart: fe } = Lr({ refs: o, commitScrollState: J, scheduleStateCommit: ae, scheduleVisibilitySync: $ }), me = d.useCallback(() => {
|
|
1377
|
+
let _ = T.current, F = D.current;
|
|
1378
|
+
if (!_ || !F || !_.element.isConnected) return !1;
|
|
1379
|
+
let E = Ae(_.element, F) - _.viewportTop;
|
|
1380
|
+
return Math.abs(E) <= Ie ? !1 : (F.scrollTop += E, _.viewportTop = Ae(_.element, F), ae(), $(), !0);
|
|
1381
|
+
}, [ae, $]), ie = d.useCallback(() => {
|
|
1382
|
+
let _ = g.current, F = D.current;
|
|
1383
|
+
if (!_ || !F) {
|
|
1384
|
+
T.current = null;
|
|
1213
1385
|
return;
|
|
1214
1386
|
}
|
|
1215
|
-
let
|
|
1216
|
-
|
|
1217
|
-
}, []),
|
|
1218
|
-
|
|
1219
|
-
|
|
1387
|
+
let E = Er({ content: _, spacer: y.current, viewport: F });
|
|
1388
|
+
T.current = E ? { element: E, viewportTop: Ae(E, F) } : null;
|
|
1389
|
+
}, []), se = d.useCallback(() => {
|
|
1390
|
+
m.current === null && (m.current = window.requestAnimationFrame(() => {
|
|
1391
|
+
m.current = null, pe() && ie();
|
|
1220
1392
|
}));
|
|
1221
|
-
}, [
|
|
1222
|
-
if (!t ||
|
|
1223
|
-
let
|
|
1393
|
+
}, [ie, pe]), ge = d.useCallback(() => {
|
|
1394
|
+
if (!t || f.current || p.current === 0) return !1;
|
|
1395
|
+
let _ = !1;
|
|
1224
1396
|
if (t === "last-anchor") {
|
|
1225
|
-
let
|
|
1226
|
-
if (!
|
|
1397
|
+
let F = g.current, E = D.current, W = F && E ? Tr(Ce(F, y.current)) : null;
|
|
1398
|
+
if (!F || !E || !W) _ = S({ behavior: "auto" });
|
|
1227
1399
|
else {
|
|
1228
|
-
let
|
|
1229
|
-
|
|
1400
|
+
let ce = gt(W, E);
|
|
1401
|
+
_ = Ue({ content: F, spacer: y.current, viewport: E }) - ce <= E.clientHeight ? S({ behavior: "auto" }) : R(W, { align: "start" }, { keepPreviousPeek: !0 });
|
|
1230
1402
|
}
|
|
1231
|
-
} else
|
|
1232
|
-
return
|
|
1233
|
-
}, [t,
|
|
1234
|
-
let
|
|
1235
|
-
if (!
|
|
1236
|
-
let
|
|
1237
|
-
|
|
1238
|
-
if (
|
|
1239
|
-
if (
|
|
1240
|
-
if (
|
|
1241
|
-
J(),
|
|
1403
|
+
} else _ = t === "end" ? S({ behavior: "auto" }) : fe({ behavior: "auto" });
|
|
1404
|
+
return _ ? (Ne(o), !0) : !1;
|
|
1405
|
+
}, [t, R, S, fe]), Ee = d.useCallback(() => {
|
|
1406
|
+
let _ = g.current;
|
|
1407
|
+
if (!_) return;
|
|
1408
|
+
let F = Ce(_, y.current), E = p.current, W = c.current;
|
|
1409
|
+
p.current = F.length, c.current = F[0] ?? null, (() => {
|
|
1410
|
+
if (pe()) return;
|
|
1411
|
+
if (E === 0) {
|
|
1412
|
+
if (ge() || F.length > 0 && i.current && S({ behavior: "auto" })) return;
|
|
1413
|
+
J(), $();
|
|
1242
1414
|
return;
|
|
1243
1415
|
}
|
|
1244
|
-
let
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1416
|
+
let ce = W ? F.indexOf(W) : -1;
|
|
1417
|
+
if (x.current && ce > 0) {
|
|
1418
|
+
me();
|
|
1247
1419
|
return;
|
|
1248
1420
|
}
|
|
1249
|
-
if (
|
|
1250
|
-
let
|
|
1251
|
-
if (
|
|
1252
|
-
if (i.current &&
|
|
1253
|
-
|
|
1421
|
+
if (F.length > E) {
|
|
1422
|
+
let G = Cr(F, E);
|
|
1423
|
+
if (G) {
|
|
1424
|
+
if (i.current && v.current === "following-bottom" && Fr(F, E)) {
|
|
1425
|
+
S({ behavior: "auto" });
|
|
1254
1426
|
return;
|
|
1255
1427
|
}
|
|
1256
|
-
|
|
1428
|
+
R(G, { align: "start" }, { keepPreviousPeek: !0 }), ee.current.add(G);
|
|
1257
1429
|
return;
|
|
1258
1430
|
}
|
|
1259
1431
|
}
|
|
1260
|
-
if (
|
|
1261
|
-
let
|
|
1262
|
-
if (
|
|
1263
|
-
|
|
1432
|
+
if (F.length === E) {
|
|
1433
|
+
let G = Sr(F, ee.current);
|
|
1434
|
+
if (G) {
|
|
1435
|
+
R(G, { align: "start" }, { keepPreviousPeek: !0 }), ee.current.add(G);
|
|
1264
1436
|
return;
|
|
1265
1437
|
}
|
|
1266
1438
|
}
|
|
1267
|
-
|
|
1268
|
-
})(),
|
|
1269
|
-
}, [
|
|
1270
|
-
if (
|
|
1271
|
-
|
|
1439
|
+
v.current === "following-bottom" && i.current ? S({ behavior: "auto" }) : (J(), $());
|
|
1440
|
+
})(), ie();
|
|
1441
|
+
}, [ge, ie, J, pe, me, $, R, S]), Re = d.useCallback(() => {
|
|
1442
|
+
if (v.current === "following-bottom" && i.current) {
|
|
1443
|
+
S({ behavior: "auto" });
|
|
1272
1444
|
return;
|
|
1273
1445
|
}
|
|
1274
|
-
let
|
|
1275
|
-
if (
|
|
1276
|
-
i.current &&
|
|
1446
|
+
let _ = K.current;
|
|
1447
|
+
if (Te()) {
|
|
1448
|
+
i.current && _ > 0 && K.current === 0 && S({ behavior: "auto" });
|
|
1277
1449
|
return;
|
|
1278
1450
|
}
|
|
1279
|
-
|
|
1280
|
-
}, [
|
|
1281
|
-
let
|
|
1282
|
-
if (!(!
|
|
1451
|
+
ae(), $();
|
|
1452
|
+
}, [Te, ae, $, S]), X = d.useCallback(() => {
|
|
1453
|
+
let _ = D.current;
|
|
1454
|
+
if (!(!_ || !L.hasListeners())) {
|
|
1283
1455
|
if (typeof IntersectionObserver > "u") {
|
|
1284
|
-
|
|
1456
|
+
$();
|
|
1285
1457
|
return;
|
|
1286
1458
|
}
|
|
1287
|
-
|
|
1288
|
-
for (let
|
|
1289
|
-
let
|
|
1290
|
-
|
|
1459
|
+
O.current || (O.current = new IntersectionObserver((F) => {
|
|
1460
|
+
for (let E of F) {
|
|
1461
|
+
let W = E.target.dataset.messageId;
|
|
1462
|
+
W && (E.isIntersecting ? Y.current.add(W) : Y.current.delete(W));
|
|
1291
1463
|
}
|
|
1292
|
-
|
|
1293
|
-
}, { root:
|
|
1294
|
-
var
|
|
1295
|
-
(
|
|
1296
|
-
}),
|
|
1464
|
+
$();
|
|
1465
|
+
}, { root: _, rootMargin: `${-(z.current + q.current)}px 0px 0px 0px`, threshold: [0, 0.01, 0.5, 1] })), k.current.forEach((F) => {
|
|
1466
|
+
var E;
|
|
1467
|
+
(E = O.current) == null || E.observe(F);
|
|
1468
|
+
}), $();
|
|
1297
1469
|
}
|
|
1298
|
-
}, [
|
|
1299
|
-
var
|
|
1300
|
-
|
|
1301
|
-
}, [
|
|
1302
|
-
var
|
|
1303
|
-
if (
|
|
1304
|
-
|
|
1470
|
+
}, [$, L]), j = d.useCallback(() => {
|
|
1471
|
+
var _;
|
|
1472
|
+
P.current !== null && (window.cancelAnimationFrame(P.current), P.current = null), (_ = O.current) == null || _.disconnect(), O.current = null, Y.current.clear(), L.setSnapshot(Me);
|
|
1473
|
+
}, [L]), Z = d.useCallback((_, F, E) => {
|
|
1474
|
+
var W, ce, G;
|
|
1475
|
+
if (F) {
|
|
1476
|
+
k.current.set(_, F), (W = O.current) == null || W.observe(F), $(), ((ce = B.current) == null ? void 0 : ce.messageId) === _ && se();
|
|
1305
1477
|
return;
|
|
1306
1478
|
}
|
|
1307
|
-
|
|
1308
|
-
}, [
|
|
1309
|
-
(
|
|
1310
|
-
}, []),
|
|
1311
|
-
g.current =
|
|
1312
|
-
}, []),
|
|
1313
|
-
|
|
1314
|
-
}, []),
|
|
1315
|
-
J(),
|
|
1316
|
-
}, [
|
|
1317
|
-
return
|
|
1318
|
-
|
|
1319
|
-
}, [
|
|
1320
|
-
var
|
|
1321
|
-
|
|
1322
|
-
}, []),
|
|
1323
|
-
if (e &&
|
|
1324
|
-
|
|
1479
|
+
E && k.current.get(_) === E && (k.current.delete(_), Y.current.delete(_), (G = O.current) == null || G.unobserve(E), $());
|
|
1480
|
+
}, [se, $]), Q = d.useCallback(() => {
|
|
1481
|
+
(v.current === "following-bottom" || v.current === "anchored-to-message" || v.current === "settling-jump") && (a.current = null, v.current = "free-scrolling");
|
|
1482
|
+
}, []), be = d.useCallback(() => ne(M.getSnapshot()), [M, ne]), je = rt(N, be), Ye = rt(D, be), Je = d.useCallback((_) => {
|
|
1483
|
+
g.current = _;
|
|
1484
|
+
}, []), Ke = d.useCallback((_) => {
|
|
1485
|
+
y.current = _, le.current = Mr((_ == null ? void 0 : _.parentElement) ?? null);
|
|
1486
|
+
}, []), Qe = d.useCallback(() => {
|
|
1487
|
+
J(), $(), ie();
|
|
1488
|
+
}, [ie, J, $]), Tt = d.useMemo(() => ({ handleContentChange: Ee, handleResize: Re, observeVisibility: X, pendingDefaultScrollStore: C, preserveScrollOnPrependRef: x, scrollToEnd: S, scrollToMessage: V, scrollToStart: fe, setContentElement: Je, setRootElement: je, setSpacerElement: Ke, setViewportElement: Ye, stateStore: M, syncAfterScroll: Qe, unobserveVisibility: j, userScrollIntent: Q, viewportRef: D, visibilityStore: L }), [Ee, Re, X, C, S, V, fe, Je, je, Ke, Ye, M, Qe, j, Q, L]);
|
|
1489
|
+
return d.useLayoutEffect(() => {
|
|
1490
|
+
ge() || p.current === 0 && _t(o);
|
|
1491
|
+
}, [ge]), d.useEffect(() => () => {
|
|
1492
|
+
var _;
|
|
1493
|
+
A.current !== null && (window.cancelAnimationFrame(A.current), A.current = null), P.current !== null && (window.cancelAnimationFrame(P.current), P.current = null), h.current !== null && (window.clearTimeout(h.current), h.current = null), m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null), (_ = O.current) == null || _.disconnect(), O.current = null;
|
|
1494
|
+
}, []), d.useLayoutEffect(() => {
|
|
1495
|
+
if (e && v.current === "following-bottom" && p.current > 0) {
|
|
1496
|
+
S({ behavior: "auto" });
|
|
1325
1497
|
return;
|
|
1326
1498
|
}
|
|
1327
1499
|
J();
|
|
1328
|
-
}, [e, J,
|
|
1500
|
+
}, [e, J, S]), { context: Tt, registerMessage: Z };
|
|
1329
1501
|
}
|
|
1330
|
-
function
|
|
1331
|
-
let t =
|
|
1502
|
+
function Or(e) {
|
|
1503
|
+
let t = d.useRef(e);
|
|
1332
1504
|
return t.current = e, t;
|
|
1333
1505
|
}
|
|
1334
|
-
var
|
|
1335
|
-
function
|
|
1336
|
-
let e =
|
|
1506
|
+
var wt = d.createContext(null), yt = d.createContext(null);
|
|
1507
|
+
function Fe() {
|
|
1508
|
+
let e = d.useContext(wt);
|
|
1337
1509
|
if (!e) throw new Error("useMessageScroller must be used within a MessageScroller.");
|
|
1338
1510
|
return e;
|
|
1339
1511
|
}
|
|
1340
|
-
function
|
|
1341
|
-
let e =
|
|
1512
|
+
function $r() {
|
|
1513
|
+
let e = d.useContext(yt);
|
|
1342
1514
|
if (!e) throw new Error("MessageScrollerItem must be used within a MessageScroller.");
|
|
1343
1515
|
return e;
|
|
1344
1516
|
}
|
|
1345
|
-
function
|
|
1346
|
-
let { context: a, registerMessage: i } =
|
|
1347
|
-
return l(
|
|
1517
|
+
function Hr({ autoScroll: e = !1, children: t, defaultScrollPosition: n = "end", scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o }) {
|
|
1518
|
+
let { context: a, registerMessage: i } = qr({ autoScroll: e, defaultScrollPosition: n, scrollEdgeThreshold: r, scrollPreviousItemPeek: s, scrollMargin: o });
|
|
1519
|
+
return l(wt.Provider, { value: a, children: l(yt.Provider, { value: i, children: t }) });
|
|
1348
1520
|
}
|
|
1349
|
-
function
|
|
1350
|
-
let { pendingDefaultScrollStore: e } =
|
|
1351
|
-
return
|
|
1521
|
+
function kt() {
|
|
1522
|
+
let { pendingDefaultScrollStore: e } = Fe();
|
|
1523
|
+
return d.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
1352
1524
|
}
|
|
1353
|
-
function
|
|
1354
|
-
let { setRootElement: n } =
|
|
1525
|
+
function zr({ children: e, ...t }) {
|
|
1526
|
+
let { setRootElement: n } = Fe(), r = kt();
|
|
1355
1527
|
return l("div", { ref: n, ...t, ...r ? { "data-pending-scroll": "" } : null, children: e });
|
|
1356
1528
|
}
|
|
1357
|
-
function
|
|
1358
|
-
let { handleResize:
|
|
1359
|
-
|
|
1360
|
-
let
|
|
1361
|
-
var
|
|
1362
|
-
|
|
1363
|
-
}, [i,
|
|
1364
|
-
function
|
|
1365
|
-
|
|
1529
|
+
function Wr({ "aria-label": e, children: t, onKeyDown: n, onScroll: r, onTouchMove: s, onWheel: o, preserveScrollOnPrepend: a = !0, ref: i, role: u, tabIndex: h, ...g }) {
|
|
1530
|
+
let { handleResize: f, preserveScrollOnPrependRef: c, setViewportElement: p, syncAfterScroll: b, userScrollIntent: k, viewportRef: v } = Fe(), m = kt();
|
|
1531
|
+
c.current = a;
|
|
1532
|
+
let B = d.useCallback((I) => {
|
|
1533
|
+
var z;
|
|
1534
|
+
p(I), (z = Se(i)) == null || z(I);
|
|
1535
|
+
}, [i, p]);
|
|
1536
|
+
function T(I) {
|
|
1537
|
+
b(), r == null || r(I);
|
|
1366
1538
|
}
|
|
1367
|
-
function
|
|
1368
|
-
|
|
1539
|
+
function x(I) {
|
|
1540
|
+
k(), o == null || o(I);
|
|
1369
1541
|
}
|
|
1370
|
-
function I
|
|
1371
|
-
|
|
1542
|
+
function C(I) {
|
|
1543
|
+
k(), s == null || s(I);
|
|
1372
1544
|
}
|
|
1373
|
-
function N(
|
|
1374
|
-
|
|
1545
|
+
function N(I) {
|
|
1546
|
+
_r.has(I.key) && k(), n == null || n(I);
|
|
1375
1547
|
}
|
|
1376
|
-
return
|
|
1377
|
-
let
|
|
1378
|
-
if (!
|
|
1379
|
-
let
|
|
1380
|
-
window.cancelAnimationFrame(
|
|
1548
|
+
return d.useEffect(() => {
|
|
1549
|
+
let I = v.current;
|
|
1550
|
+
if (!I || typeof ResizeObserver > "u") return;
|
|
1551
|
+
let z = 0, q = new ResizeObserver(() => {
|
|
1552
|
+
window.cancelAnimationFrame(z), z = window.requestAnimationFrame(f);
|
|
1381
1553
|
});
|
|
1382
|
-
return q.observe(
|
|
1383
|
-
window.cancelAnimationFrame(
|
|
1554
|
+
return q.observe(I), () => {
|
|
1555
|
+
window.cancelAnimationFrame(z), q.disconnect();
|
|
1384
1556
|
};
|
|
1385
|
-
}, [
|
|
1386
|
-
}
|
|
1387
|
-
function
|
|
1388
|
-
let { handleContentChange: a, handleResize: i, setContentElement:
|
|
1389
|
-
var
|
|
1390
|
-
g.current =
|
|
1391
|
-
}, [n,
|
|
1392
|
-
return
|
|
1393
|
-
let
|
|
1394
|
-
if (!
|
|
1395
|
-
let
|
|
1557
|
+
}, [f, v]), l("div", { ref: B, role: u ?? "region", "aria-label": e ?? "Messages", tabIndex: h ?? 0, onKeyDown: N, onScroll: T, onTouchMove: C, onWheel: x, ...g, ...m ? { "data-pending-scroll": "" } : null, children: t });
|
|
1558
|
+
}
|
|
1559
|
+
function Vr({ "aria-relevant": e, children: t, ref: n, role: r, spacerClassName: s, ...o }) {
|
|
1560
|
+
let { handleContentChange: a, handleResize: i, setContentElement: u, setSpacerElement: h } = Fe(), g = d.useRef(null), f = d.useCallback((c) => {
|
|
1561
|
+
var p;
|
|
1562
|
+
g.current = c, u(c), (p = Se(n)) == null || p(c);
|
|
1563
|
+
}, [n, u]);
|
|
1564
|
+
return d.useLayoutEffect(() => {
|
|
1565
|
+
let c = g.current;
|
|
1566
|
+
if (!c || (a(), typeof MutationObserver > "u")) return;
|
|
1567
|
+
let p = new MutationObserver(() => {
|
|
1396
1568
|
a();
|
|
1397
1569
|
});
|
|
1398
|
-
return
|
|
1399
|
-
}, [a]),
|
|
1400
|
-
let
|
|
1401
|
-
if (!
|
|
1402
|
-
let
|
|
1403
|
-
window.cancelAnimationFrame(
|
|
1570
|
+
return p.observe(c, { childList: !0 }), () => p.disconnect();
|
|
1571
|
+
}, [a]), d.useEffect(() => {
|
|
1572
|
+
let c = g.current;
|
|
1573
|
+
if (!c || typeof ResizeObserver > "u") return;
|
|
1574
|
+
let p = 0, b = new ResizeObserver(() => {
|
|
1575
|
+
window.cancelAnimationFrame(p), p = window.requestAnimationFrame(i);
|
|
1404
1576
|
});
|
|
1405
|
-
return
|
|
1406
|
-
window.cancelAnimationFrame(
|
|
1577
|
+
return b.observe(c), () => {
|
|
1578
|
+
window.cancelAnimationFrame(p), b.disconnect();
|
|
1407
1579
|
};
|
|
1408
|
-
}, [i]),
|
|
1580
|
+
}, [i]), w("div", { ref: f, role: r ?? "log", "aria-relevant": e ?? "additions", ...o, children: [t, l("div", { ref: h, "aria-hidden": "true", "data-message-scroller-spacer": "", hidden: !0, className: s })] });
|
|
1409
1581
|
}
|
|
1410
|
-
function
|
|
1411
|
-
let s =
|
|
1412
|
-
var
|
|
1413
|
-
let
|
|
1414
|
-
o.current = i, e && s(e, i,
|
|
1582
|
+
function Gr({ messageId: e, ref: t, scrollAnchor: n = !1, ...r }) {
|
|
1583
|
+
let s = $r(), o = d.useRef(null), a = d.useCallback((i) => {
|
|
1584
|
+
var h;
|
|
1585
|
+
let u = o.current;
|
|
1586
|
+
o.current = i, e && s(e, i, u), (h = Se(t)) == null || h(i);
|
|
1415
1587
|
}, [e, t, s]);
|
|
1416
1588
|
return l("div", { ref: a, "data-message-id": e, "data-scroll-anchor": n ? "true" : "false", ...r });
|
|
1417
1589
|
}
|
|
1418
|
-
function
|
|
1419
|
-
let { scrollToEnd:
|
|
1420
|
-
let
|
|
1421
|
-
return n === "start" ?
|
|
1422
|
-
}, [n, g]),
|
|
1423
|
-
var
|
|
1424
|
-
|
|
1425
|
-
}, [e, n,
|
|
1426
|
-
return
|
|
1427
|
-
}
|
|
1428
|
-
var
|
|
1429
|
-
function
|
|
1590
|
+
function Ur({ behavior: e = "smooth", children: t, direction: n = "end", onClick: r, render: s, tabIndex: o, type: a = "button", ...i }) {
|
|
1591
|
+
let { scrollToEnd: u, scrollToStart: h, stateStore: g } = Fe(), f = Or(r), c = d.useCallback((v) => g.subscribe(v), [g]), p = d.useCallback(() => {
|
|
1592
|
+
let v = g.getSnapshot();
|
|
1593
|
+
return n === "start" ? v.start : v.end;
|
|
1594
|
+
}, [n, g]), b = d.useSyncExternalStore(c, p, p), k = d.useCallback((v) => {
|
|
1595
|
+
var m;
|
|
1596
|
+
b && ((m = f.current) == null || m.call(f, v), v.defaultPrevented || (v.currentTarget.blur(), n === "start" ? h({ behavior: e }) : u({ behavior: e })));
|
|
1597
|
+
}, [e, n, b, f, u, h]);
|
|
1598
|
+
return dr({ defaultTagName: "button", props: ze({ type: a, inert: !b, tabIndex: b ? o : -1, children: t ?? w("span", { children: ["Scroll to ", n] }), onClick: k }, i), render: s, state: { active: b, direction: n }, stateAttributesMapping: { active: (v) => ({ "data-active": v ? "true" : "false" }) } });
|
|
1599
|
+
}
|
|
1600
|
+
var _e = { Provider: Hr, Root: zr, Viewport: Wr, Content: Vr, Item: Gr, Button: Ur };
|
|
1601
|
+
function Ct(e) {
|
|
1430
1602
|
var t, n, r = "";
|
|
1431
1603
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
1432
1604
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
1433
1605
|
var s = e.length;
|
|
1434
|
-
for (t = 0; t < s; t++) e[t] && (n =
|
|
1606
|
+
for (t = 0; t < s; t++) e[t] && (n = Ct(e[t])) && (r && (r += " "), r += n);
|
|
1435
1607
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
1436
1608
|
return r;
|
|
1437
1609
|
}
|
|
1438
|
-
function
|
|
1439
|
-
for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t =
|
|
1610
|
+
function jr() {
|
|
1611
|
+
for (var e, t, n = 0, r = "", s = arguments.length; n < s; n++) (e = arguments[n]) && (t = Ct(e)) && (r && (r += " "), r += t);
|
|
1440
1612
|
return r;
|
|
1441
1613
|
}
|
|
1442
|
-
function
|
|
1443
|
-
return
|
|
1614
|
+
function we(...e) {
|
|
1615
|
+
return jr(e);
|
|
1444
1616
|
}
|
|
1445
|
-
function
|
|
1446
|
-
return /* @__PURE__ */ l(
|
|
1617
|
+
function Yr(e) {
|
|
1618
|
+
return /* @__PURE__ */ l(_e.Provider, { ...e });
|
|
1447
1619
|
}
|
|
1448
|
-
function
|
|
1620
|
+
function Jr({
|
|
1449
1621
|
className: e,
|
|
1450
1622
|
...t
|
|
1451
1623
|
}) {
|
|
1452
1624
|
return /* @__PURE__ */ l(
|
|
1453
|
-
|
|
1625
|
+
_e.Root,
|
|
1454
1626
|
{
|
|
1455
1627
|
"data-slot": "message-scroller",
|
|
1456
|
-
className:
|
|
1628
|
+
className: we("msg-scroller-root", e),
|
|
1457
1629
|
...t
|
|
1458
1630
|
}
|
|
1459
1631
|
);
|
|
1460
1632
|
}
|
|
1461
|
-
function
|
|
1633
|
+
function Kr({
|
|
1462
1634
|
className: e,
|
|
1463
1635
|
...t
|
|
1464
1636
|
}) {
|
|
1465
1637
|
return /* @__PURE__ */ l(
|
|
1466
|
-
|
|
1638
|
+
_e.Viewport,
|
|
1467
1639
|
{
|
|
1468
1640
|
"data-slot": "message-scroller-viewport",
|
|
1469
|
-
className:
|
|
1641
|
+
className: we("msg-scroller-viewport", e),
|
|
1470
1642
|
...t
|
|
1471
1643
|
}
|
|
1472
1644
|
);
|
|
1473
1645
|
}
|
|
1474
|
-
function
|
|
1646
|
+
function Qr({
|
|
1475
1647
|
className: e,
|
|
1476
1648
|
...t
|
|
1477
1649
|
}) {
|
|
1478
1650
|
return /* @__PURE__ */ l(
|
|
1479
|
-
|
|
1651
|
+
_e.Content,
|
|
1480
1652
|
{
|
|
1481
1653
|
"data-slot": "message-scroller-content",
|
|
1482
|
-
className:
|
|
1654
|
+
className: we("msg-scroller-content", e),
|
|
1483
1655
|
...t
|
|
1484
1656
|
}
|
|
1485
1657
|
);
|
|
1486
1658
|
}
|
|
1487
|
-
function
|
|
1659
|
+
function nt({
|
|
1488
1660
|
className: e,
|
|
1489
1661
|
scrollAnchor: t = !1,
|
|
1490
1662
|
...n
|
|
1491
1663
|
}) {
|
|
1492
1664
|
return /* @__PURE__ */ l(
|
|
1493
|
-
|
|
1665
|
+
_e.Item,
|
|
1494
1666
|
{
|
|
1495
1667
|
"data-slot": "message-scroller-item",
|
|
1496
1668
|
scrollAnchor: t,
|
|
1497
|
-
className:
|
|
1669
|
+
className: we("msg-scroller-item", e),
|
|
1498
1670
|
...n
|
|
1499
1671
|
}
|
|
1500
1672
|
);
|
|
1501
1673
|
}
|
|
1502
|
-
function
|
|
1674
|
+
function Xr({
|
|
1503
1675
|
direction: e = "end",
|
|
1504
1676
|
className: t,
|
|
1505
1677
|
children: n,
|
|
1506
1678
|
...r
|
|
1507
1679
|
}) {
|
|
1508
1680
|
return /* @__PURE__ */ l(
|
|
1509
|
-
|
|
1681
|
+
_e.Button,
|
|
1510
1682
|
{
|
|
1511
1683
|
"data-slot": "message-scroller-button",
|
|
1512
1684
|
direction: e,
|
|
1513
|
-
className:
|
|
1685
|
+
className: we("msg-scroller-btn", t),
|
|
1514
1686
|
...r,
|
|
1515
|
-
children: n ?? /* @__PURE__ */
|
|
1687
|
+
children: n ?? /* @__PURE__ */ w(De, { children: [
|
|
1516
1688
|
/* @__PURE__ */ l(
|
|
1517
1689
|
Ot,
|
|
1518
1690
|
{
|
|
@@ -1526,31 +1698,38 @@ function Gr({
|
|
|
1526
1698
|
}
|
|
1527
1699
|
);
|
|
1528
1700
|
}
|
|
1529
|
-
const
|
|
1701
|
+
const Zr = () => /* @__PURE__ */ w("div", { className: "chat-empty-row", children: [
|
|
1530
1702
|
/* @__PURE__ */ l(
|
|
1531
1703
|
"div",
|
|
1532
1704
|
{
|
|
1533
1705
|
className: "avatar-circle avatar-circle--mt",
|
|
1534
1706
|
"aria-hidden": "true",
|
|
1535
|
-
children: /* @__PURE__ */ l(
|
|
1707
|
+
children: /* @__PURE__ */ l(pt, { size: 15 })
|
|
1536
1708
|
}
|
|
1537
1709
|
),
|
|
1538
1710
|
/* @__PURE__ */ l("div", { className: "chat-empty-bubble", children: /* @__PURE__ */ l("p", { children: "Hello — I am the VPS Veritas assistant. Ask about reports, sample status, registration, or support, or choose a question below the text box." }) })
|
|
1539
1711
|
] });
|
|
1540
|
-
function
|
|
1712
|
+
function en(e) {
|
|
1713
|
+
const t = e.trim();
|
|
1714
|
+
if (!/[\u0000-\u001f\u007f]/.test(t) && /^(https?:\/\/|mailto:|\/(?!\/)|#)/i.test(t))
|
|
1715
|
+
return t;
|
|
1716
|
+
}
|
|
1717
|
+
function te(e) {
|
|
1541
1718
|
if (!e) return [];
|
|
1542
1719
|
const t = /(\[[^\]]+\]\([^)]+\)|\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`|https?:\/\/[^\s]+)/g;
|
|
1543
1720
|
return e.split(t).map((r, s) => {
|
|
1544
1721
|
if (!r) return null;
|
|
1545
1722
|
const o = r.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
1546
1723
|
if (o) {
|
|
1547
|
-
const a = o[1], i = o[2],
|
|
1724
|
+
const a = o[1], i = o[2], u = en(i);
|
|
1725
|
+
if (!u) return /* @__PURE__ */ l(oe.Fragment, { children: a }, s);
|
|
1726
|
+
const h = /^https?:\/\//i.test(i);
|
|
1548
1727
|
return /* @__PURE__ */ l(
|
|
1549
1728
|
"a",
|
|
1550
1729
|
{
|
|
1551
|
-
href:
|
|
1552
|
-
target:
|
|
1553
|
-
rel:
|
|
1730
|
+
href: u,
|
|
1731
|
+
target: h ? "_blank" : void 0,
|
|
1732
|
+
rel: h ? "noopener noreferrer" : void 0,
|
|
1554
1733
|
className: "md-link",
|
|
1555
1734
|
children: a
|
|
1556
1735
|
},
|
|
@@ -1567,10 +1746,10 @@ function ee(e) {
|
|
|
1567
1746
|
children: r
|
|
1568
1747
|
},
|
|
1569
1748
|
s
|
|
1570
|
-
) : /* @__PURE__ */ l(
|
|
1749
|
+
) : /* @__PURE__ */ l(oe.Fragment, { children: r }, s);
|
|
1571
1750
|
});
|
|
1572
1751
|
}
|
|
1573
|
-
function
|
|
1752
|
+
function tn(e) {
|
|
1574
1753
|
const t = e.replace(/\r\n/g, `
|
|
1575
1754
|
`).split(`
|
|
1576
1755
|
`), n = [];
|
|
@@ -1582,10 +1761,10 @@ function jr(e) {
|
|
|
1582
1761
|
continue;
|
|
1583
1762
|
}
|
|
1584
1763
|
if (o.startsWith("```")) {
|
|
1585
|
-
const
|
|
1764
|
+
const u = o.slice(3).trim(), h = [];
|
|
1586
1765
|
for (r++; r < t.length && !t[r].trim().startsWith("```"); )
|
|
1587
|
-
|
|
1588
|
-
r < t.length && t[r].trim().startsWith("```") && r++, n.push({ type: "code", lang:
|
|
1766
|
+
h.push(t[r]), r++;
|
|
1767
|
+
r < t.length && t[r].trim().startsWith("```") && r++, n.push({ type: "code", lang: u, code: h.join(`
|
|
1589
1768
|
`) });
|
|
1590
1769
|
continue;
|
|
1591
1770
|
}
|
|
@@ -1603,33 +1782,33 @@ function jr(e) {
|
|
|
1603
1782
|
continue;
|
|
1604
1783
|
}
|
|
1605
1784
|
if (o.startsWith(">")) {
|
|
1606
|
-
const
|
|
1785
|
+
const u = [];
|
|
1607
1786
|
for (; r < t.length && t[r].trim().startsWith(">"); )
|
|
1608
|
-
|
|
1609
|
-
n.push({ type: "quote", lines:
|
|
1787
|
+
u.push(t[r].trim().replace(/^>\s?/, "")), r++;
|
|
1788
|
+
n.push({ type: "quote", lines: u });
|
|
1610
1789
|
continue;
|
|
1611
1790
|
}
|
|
1612
1791
|
if (/^[-*]\s+/.test(o)) {
|
|
1613
|
-
const
|
|
1792
|
+
const u = [];
|
|
1614
1793
|
for (; r < t.length && /^[-*]\s+/.test(t[r].trim()); )
|
|
1615
|
-
|
|
1616
|
-
n.push({ type: "ul", items:
|
|
1794
|
+
u.push(t[r].trim().replace(/^[-*]\s+/, "")), r++;
|
|
1795
|
+
n.push({ type: "ul", items: u });
|
|
1617
1796
|
continue;
|
|
1618
1797
|
}
|
|
1619
1798
|
if (/^\d+\.\s+/.test(o)) {
|
|
1620
|
-
const
|
|
1799
|
+
const u = [];
|
|
1621
1800
|
for (; r < t.length && /^\d+\.\s+/.test(t[r].trim()); )
|
|
1622
|
-
|
|
1623
|
-
n.push({ type: "ol", items:
|
|
1801
|
+
u.push(t[r].trim().replace(/^\d+\.\s+/, "")), r++;
|
|
1802
|
+
n.push({ type: "ol", items: u });
|
|
1624
1803
|
continue;
|
|
1625
1804
|
}
|
|
1626
1805
|
if (o.startsWith("|") && o.endsWith("|")) {
|
|
1627
|
-
const
|
|
1806
|
+
const u = [];
|
|
1628
1807
|
for (; r < t.length && t[r].trim().startsWith("|") && t[r].trim().endsWith("|"); )
|
|
1629
|
-
|
|
1630
|
-
if (
|
|
1631
|
-
const
|
|
1632
|
-
n.push({ type: "table", headers: g, rows:
|
|
1808
|
+
u.push(t[r].trim()), r++;
|
|
1809
|
+
if (u.length >= 2) {
|
|
1810
|
+
const h = (p) => p.slice(1, -1).split("|").map((b) => b.trim()), g = h(u[0]), f = u[1].includes("-") ? 2 : 1, c = u.slice(f).map(h);
|
|
1811
|
+
n.push({ type: "table", headers: g, rows: c });
|
|
1633
1812
|
continue;
|
|
1634
1813
|
}
|
|
1635
1814
|
}
|
|
@@ -1640,157 +1819,315 @@ function jr(e) {
|
|
|
1640
1819
|
}
|
|
1641
1820
|
return n;
|
|
1642
1821
|
}
|
|
1643
|
-
const
|
|
1644
|
-
if (!
|
|
1645
|
-
const
|
|
1646
|
-
return /* @__PURE__ */ l("div", { className: "md-content", children:
|
|
1647
|
-
switch (
|
|
1822
|
+
const rn = oe.memo(function({ text: t }) {
|
|
1823
|
+
if (!t) return null;
|
|
1824
|
+
const n = tn(t);
|
|
1825
|
+
return /* @__PURE__ */ l("div", { className: "md-content", children: n.map((r, s) => {
|
|
1826
|
+
switch (r.type) {
|
|
1648
1827
|
case "h":
|
|
1649
|
-
return
|
|
1828
|
+
return r.level === 1 ? /* @__PURE__ */ l("h2", { className: "md-h1", children: te(r.content) }, s) : r.level === 2 ? /* @__PURE__ */ l("h3", { className: "md-h2", children: te(r.content) }, s) : r.level === 3 ? /* @__PURE__ */ l("h4", { className: "md-h3", children: te(r.content) }, s) : /* @__PURE__ */ l("h5", { className: "md-h4", children: te(r.content) }, s);
|
|
1650
1829
|
case "ul":
|
|
1651
|
-
return /* @__PURE__ */ l("ul", { className: "md-ul", children:
|
|
1830
|
+
return /* @__PURE__ */ l("ul", { className: "md-ul", children: r.items.map((o, a) => /* @__PURE__ */ l("li", { className: "md-li", children: te(o) }, a)) }, s);
|
|
1652
1831
|
case "ol":
|
|
1653
|
-
return /* @__PURE__ */ l("ol", { className: "md-ol", children:
|
|
1832
|
+
return /* @__PURE__ */ l("ol", { className: "md-ol", children: r.items.map((o, a) => /* @__PURE__ */ l("li", { className: "md-li", children: te(o) }, a)) }, s);
|
|
1654
1833
|
case "code":
|
|
1655
|
-
return /* @__PURE__ */ l("pre", { className: "md-pre", children: /* @__PURE__ */ l("code", { children:
|
|
1834
|
+
return /* @__PURE__ */ l("pre", { className: "md-pre", children: /* @__PURE__ */ l("code", { children: r.code }) }, s);
|
|
1656
1835
|
case "quote":
|
|
1657
|
-
return /* @__PURE__ */ l("blockquote", { className: "md-quote", children:
|
|
1836
|
+
return /* @__PURE__ */ l("blockquote", { className: "md-quote", children: r.lines.map((o, a) => /* @__PURE__ */ l("p", { children: te(o) }, a)) }, s);
|
|
1658
1837
|
case "hr":
|
|
1659
|
-
return /* @__PURE__ */ l("hr", { className: "md-hr" },
|
|
1838
|
+
return /* @__PURE__ */ l("hr", { className: "md-hr" }, s);
|
|
1660
1839
|
case "table":
|
|
1661
|
-
return /* @__PURE__ */ l("div", { className: "md-table-wrap", children: /* @__PURE__ */
|
|
1662
|
-
/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children:
|
|
1663
|
-
/* @__PURE__ */ l("tbody", { children:
|
|
1664
|
-
] }) },
|
|
1840
|
+
return /* @__PURE__ */ l("div", { className: "md-table-wrap", children: /* @__PURE__ */ w("table", { className: "md-table", children: [
|
|
1841
|
+
/* @__PURE__ */ l("thead", { children: /* @__PURE__ */ l("tr", { children: r.headers.map((o, a) => /* @__PURE__ */ l("th", { children: te(o) }, a)) }) }),
|
|
1842
|
+
/* @__PURE__ */ l("tbody", { children: r.rows.map((o, a) => /* @__PURE__ */ l("tr", { children: o.map((i, u) => /* @__PURE__ */ l("td", { children: te(i) }, u)) }, a)) })
|
|
1843
|
+
] }) }, s);
|
|
1665
1844
|
case "p":
|
|
1666
1845
|
default:
|
|
1667
|
-
return /* @__PURE__ */ l("p", { className: "md-p", children:
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
] },
|
|
1846
|
+
return /* @__PURE__ */ l("p", { className: "md-p", children: r.lines.map((o, a) => /* @__PURE__ */ w(oe.Fragment, { children: [
|
|
1847
|
+
te(o),
|
|
1848
|
+
a < r.lines.length - 1 && /* @__PURE__ */ l("br", {})
|
|
1849
|
+
] }, a)) }, s);
|
|
1671
1850
|
}
|
|
1672
1851
|
}) });
|
|
1673
|
-
},
|
|
1852
|
+
}), nn = ({ className: e, text: t }) => /* @__PURE__ */ w(
|
|
1674
1853
|
"div",
|
|
1675
1854
|
{
|
|
1676
|
-
className:
|
|
1855
|
+
className: we("typing-indicator-container", e),
|
|
1677
1856
|
role: "status",
|
|
1678
1857
|
"aria-label": "Assistant is preparing a reply",
|
|
1679
|
-
children:
|
|
1858
|
+
children: [
|
|
1859
|
+
/* @__PURE__ */ w("div", { className: "typing-indicator", "aria-hidden": "true", children: [
|
|
1860
|
+
/* @__PURE__ */ l("span", { className: "typing-dot" }),
|
|
1861
|
+
/* @__PURE__ */ l("span", { className: "typing-dot" }),
|
|
1862
|
+
/* @__PURE__ */ l("span", { className: "typing-dot" })
|
|
1863
|
+
] }),
|
|
1864
|
+
t && /* @__PURE__ */ l("div", { className: "typing-progress-pill", children: t })
|
|
1865
|
+
]
|
|
1680
1866
|
}
|
|
1681
|
-
),
|
|
1867
|
+
), sn = ({
|
|
1682
1868
|
status: e = "complete",
|
|
1683
1869
|
progressText: t,
|
|
1684
|
-
|
|
1685
|
-
durationMs: r = 1800
|
|
1870
|
+
durationMs: n
|
|
1686
1871
|
}) => {
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
if (!
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
}, [s]);
|
|
1698
|
-
const f = s ? `${i}s` : `${(r / 1e3).toFixed(1)}s`;
|
|
1699
|
-
return /* @__PURE__ */ l("div", { className: `agent-reasoning-container${s ? " agent-reasoning--active" : ""}`, children: /* @__PURE__ */ l(
|
|
1872
|
+
const r = e === "pending", [s, o] = U(0);
|
|
1873
|
+
ke(() => {
|
|
1874
|
+
if (!r) return;
|
|
1875
|
+
const i = Date.now(), u = setInterval(() => {
|
|
1876
|
+
o(Number(((Date.now() - i) / 1e3).toFixed(1)));
|
|
1877
|
+
}, 250);
|
|
1878
|
+
return () => clearInterval(u);
|
|
1879
|
+
}, [r]);
|
|
1880
|
+
const a = r ? `${s.toFixed(1)}s` : n === void 0 ? void 0 : `${(n / 1e3).toFixed(1)}s`;
|
|
1881
|
+
return /* @__PURE__ */ l("div", { className: `agent-reasoning-container${r ? " agent-reasoning--active" : ""}`, children: /* @__PURE__ */ l(
|
|
1700
1882
|
"div",
|
|
1701
1883
|
{
|
|
1702
1884
|
className: "agent-reasoning-header",
|
|
1703
|
-
"
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1885
|
+
role: "status",
|
|
1886
|
+
"aria-live": "off",
|
|
1887
|
+
children: /* @__PURE__ */ w("div", { className: "agent-reasoning-header-left", children: [
|
|
1888
|
+
r ? /* @__PURE__ */ l(
|
|
1889
|
+
Kt,
|
|
1890
|
+
{
|
|
1891
|
+
size: 13,
|
|
1892
|
+
className: "agent-reasoning-spinner",
|
|
1893
|
+
"aria-hidden": "true"
|
|
1894
|
+
}
|
|
1895
|
+
) : /* @__PURE__ */ l(
|
|
1896
|
+
Ut,
|
|
1707
1897
|
{
|
|
1708
1898
|
size: 13,
|
|
1709
|
-
className:
|
|
1899
|
+
className: "agent-reasoning-done-icon",
|
|
1900
|
+
"aria-hidden": "true"
|
|
1710
1901
|
}
|
|
1711
1902
|
),
|
|
1712
|
-
/* @__PURE__ */ l("span", { className: "agent-reasoning-title", children:
|
|
1903
|
+
/* @__PURE__ */ l("span", { className: "agent-reasoning-title", children: r ? `${t || "Working…"} · ${a}` : a ? `Response generated in ${a}` : "Response generated" })
|
|
1713
1904
|
] })
|
|
1714
1905
|
}
|
|
1715
1906
|
) });
|
|
1907
|
+
}, on = {
|
|
1908
|
+
"fuel-defect-reporting": {
|
|
1909
|
+
label: "Fuel Defect Reporting",
|
|
1910
|
+
path: "/dashboard/fuel-Defect-Reporting"
|
|
1911
|
+
},
|
|
1912
|
+
"bunker-master": {
|
|
1913
|
+
label: "Bunker Master",
|
|
1914
|
+
path: "/dashboard/bunker-master"
|
|
1915
|
+
},
|
|
1916
|
+
"fsc-fsq-e-forms": {
|
|
1917
|
+
label: "Pre-Registration & E-Forms",
|
|
1918
|
+
path: "/dashboard/pre-registration"
|
|
1919
|
+
},
|
|
1920
|
+
"pre-registration-ship": {
|
|
1921
|
+
label: "Pre-Registration",
|
|
1922
|
+
path: "/dashboard/pre-registration"
|
|
1923
|
+
},
|
|
1924
|
+
"reports-fuel": {
|
|
1925
|
+
label: "Fuel Reports",
|
|
1926
|
+
path: "/dashboard/reports"
|
|
1927
|
+
},
|
|
1928
|
+
"sample-fuel": {
|
|
1929
|
+
label: "Sample Status",
|
|
1930
|
+
path: "/dashboard/sample-status"
|
|
1931
|
+
}
|
|
1716
1932
|
};
|
|
1717
|
-
function
|
|
1933
|
+
function ln(e) {
|
|
1934
|
+
const n = (e.split(/[/\\]/).pop() || "").replace(/\.md$/i, "").toLowerCase();
|
|
1935
|
+
for (const [r, s] of Object.entries(on))
|
|
1936
|
+
if (n.includes(r))
|
|
1937
|
+
return s;
|
|
1938
|
+
return null;
|
|
1939
|
+
}
|
|
1940
|
+
function st(e) {
|
|
1941
|
+
return e.title ? e.title : (e.source.split(/[/\\]/).pop() || e.source).replace(/\.md$/i, "").replace(/[-_]/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
|
|
1942
|
+
}
|
|
1943
|
+
const an = ({
|
|
1944
|
+
sources: e,
|
|
1945
|
+
hideInspectSources: t = !1,
|
|
1946
|
+
showInspectSources: n = !0,
|
|
1947
|
+
defaultExpanded: r = !1,
|
|
1948
|
+
maxSources: s = 5
|
|
1949
|
+
}) => {
|
|
1950
|
+
const o = t || n === !1, [a, i] = U(r && !o), [u, h] = U(null);
|
|
1951
|
+
if (!e || !e.length) return null;
|
|
1952
|
+
const g = e.slice(0, s);
|
|
1953
|
+
return /* @__PURE__ */ w("div", { className: "grounded-sources-card", children: [
|
|
1954
|
+
/* @__PURE__ */ w("div", { className: "grounded-sources-header", children: [
|
|
1955
|
+
/* @__PURE__ */ w("div", { className: "grounded-sources-badge", children: [
|
|
1956
|
+
/* @__PURE__ */ l(er, { size: 13, className: "grounded-shield-icon" }),
|
|
1957
|
+
/* @__PURE__ */ w("span", { children: [
|
|
1958
|
+
g.length,
|
|
1959
|
+
" retrieved VPS sources"
|
|
1960
|
+
] })
|
|
1961
|
+
] }),
|
|
1962
|
+
!o && /* @__PURE__ */ w(
|
|
1963
|
+
"button",
|
|
1964
|
+
{
|
|
1965
|
+
type: "button",
|
|
1966
|
+
className: "grounded-toggle-btn",
|
|
1967
|
+
onClick: () => i((f) => !f),
|
|
1968
|
+
"aria-expanded": a,
|
|
1969
|
+
children: [
|
|
1970
|
+
/* @__PURE__ */ l("span", { children: a ? "Hide Details" : "Inspect Sources" }),
|
|
1971
|
+
a ? /* @__PURE__ */ l(Gt, { size: 12 }) : /* @__PURE__ */ l(Vt, { size: 12 })
|
|
1972
|
+
]
|
|
1973
|
+
}
|
|
1974
|
+
)
|
|
1975
|
+
] }),
|
|
1976
|
+
/* @__PURE__ */ l("div", { className: "grounded-pills-row", children: g.map((f, c) => {
|
|
1977
|
+
const p = st(f), b = u === c;
|
|
1978
|
+
return /* @__PURE__ */ w(
|
|
1979
|
+
"button",
|
|
1980
|
+
{
|
|
1981
|
+
type: "button",
|
|
1982
|
+
className: `grounded-source-pill${b ? " grounded-source-pill--selected" : ""}`,
|
|
1983
|
+
onClick: () => {
|
|
1984
|
+
o || (i(!0), h(b ? null : c));
|
|
1985
|
+
},
|
|
1986
|
+
title: f.source,
|
|
1987
|
+
children: [
|
|
1988
|
+
/* @__PURE__ */ l(zt, { size: 11, className: "grounded-book-icon" }),
|
|
1989
|
+
/* @__PURE__ */ w("span", { className: "grounded-pill-title", children: [
|
|
1990
|
+
"[S",
|
|
1991
|
+
c + 1,
|
|
1992
|
+
"] ",
|
|
1993
|
+
p
|
|
1994
|
+
] }),
|
|
1995
|
+
/* @__PURE__ */ w("span", { className: "grounded-pill-score", title: "Ranking score, not a probability of correctness", children: [
|
|
1996
|
+
"Score ",
|
|
1997
|
+
f.score.toFixed(2)
|
|
1998
|
+
] })
|
|
1999
|
+
]
|
|
2000
|
+
},
|
|
2001
|
+
`${f.chunkId}-${c}`
|
|
2002
|
+
);
|
|
2003
|
+
}) }),
|
|
2004
|
+
!o && a && /* @__PURE__ */ l("div", { className: "grounded-sources-details-list", children: g.map((f, c) => {
|
|
2005
|
+
const p = st(f), b = ln(f.source);
|
|
2006
|
+
return /* @__PURE__ */ w(
|
|
2007
|
+
"div",
|
|
2008
|
+
{
|
|
2009
|
+
className: `grounded-detail-item${u === c ? " grounded-detail-item--highlighted" : ""}`,
|
|
2010
|
+
children: [
|
|
2011
|
+
/* @__PURE__ */ w("div", { className: "grounded-detail-top", children: [
|
|
2012
|
+
/* @__PURE__ */ w("div", { className: "grounded-detail-title-group", children: [
|
|
2013
|
+
/* @__PURE__ */ w("span", { className: "grounded-detail-index", children: [
|
|
2014
|
+
"[",
|
|
2015
|
+
c + 1,
|
|
2016
|
+
"]"
|
|
2017
|
+
] }),
|
|
2018
|
+
/* @__PURE__ */ l("span", { className: "grounded-detail-title", children: p })
|
|
2019
|
+
] }),
|
|
2020
|
+
/* @__PURE__ */ w("div", { className: "grounded-detail-meta", children: [
|
|
2021
|
+
/* @__PURE__ */ w("span", { className: "grounded-detail-score", children: [
|
|
2022
|
+
"Rank score ",
|
|
2023
|
+
f.score.toFixed(2)
|
|
2024
|
+
] }),
|
|
2025
|
+
b && /* @__PURE__ */ w(
|
|
2026
|
+
"a",
|
|
2027
|
+
{
|
|
2028
|
+
href: b.path,
|
|
2029
|
+
onClick: (v) => {
|
|
2030
|
+
v.preventDefault(), window.location.href = b.path;
|
|
2031
|
+
},
|
|
2032
|
+
className: "grounded-route-link",
|
|
2033
|
+
title: `Navigate to ${b.label}`,
|
|
2034
|
+
children: [
|
|
2035
|
+
/* @__PURE__ */ l("span", { children: b.label }),
|
|
2036
|
+
/* @__PURE__ */ l(Yt, { size: 10 })
|
|
2037
|
+
]
|
|
2038
|
+
}
|
|
2039
|
+
)
|
|
2040
|
+
] })
|
|
2041
|
+
] }),
|
|
2042
|
+
/* @__PURE__ */ l("div", { className: "grounded-detail-path", children: /* @__PURE__ */ l("code", { children: f.source }) }),
|
|
2043
|
+
f.snippet && /* @__PURE__ */ w("p", { className: "grounded-detail-snippet", children: [
|
|
2044
|
+
'"',
|
|
2045
|
+
f.snippet,
|
|
2046
|
+
'"'
|
|
2047
|
+
] })
|
|
2048
|
+
]
|
|
2049
|
+
},
|
|
2050
|
+
`detail-${f.chunkId}-${c}`
|
|
2051
|
+
);
|
|
2052
|
+
}) })
|
|
2053
|
+
] });
|
|
2054
|
+
};
|
|
2055
|
+
function cn(e) {
|
|
1718
2056
|
return e === "create_ticket" ? "Support ticket processed" : e === "get_customer" ? "Account verified" : e === "get_ticket" ? "Ticket status loaded" : "Information retrieved";
|
|
1719
2057
|
}
|
|
1720
|
-
function
|
|
2058
|
+
function un({ toolCalls: e }) {
|
|
1721
2059
|
return e.length ? /* @__PURE__ */ l("div", { className: "tool-badges", children: e.map((t, n) => /* @__PURE__ */ l(
|
|
1722
2060
|
"span",
|
|
1723
2061
|
{
|
|
1724
2062
|
className: "tool-badge",
|
|
1725
|
-
children:
|
|
2063
|
+
children: cn(t.toolName)
|
|
1726
2064
|
},
|
|
1727
2065
|
`${t.toolName}-${n}`
|
|
1728
2066
|
)) }) : null;
|
|
1729
2067
|
}
|
|
1730
|
-
const
|
|
1731
|
-
var
|
|
1732
|
-
const t =
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
return /* @__PURE__ */ T("div", { className: `msg-row${n ? " msg-row--user" : ""}`, children: [
|
|
1736
|
-
!n && /* @__PURE__ */ l(
|
|
2068
|
+
const dn = ({ message: e }) => {
|
|
2069
|
+
var g;
|
|
2070
|
+
const t = Ge(), n = (t == null ? void 0 : t.hideInspectSources) ?? !1, r = (t == null ? void 0 : t.showGroundedSources) ?? !0, s = e.role === "user", o = e.status === "error", a = e.status === "pending", i = e.id === "welcome-default" || e.id.startsWith("welcome") || e.id === "welcome", u = !!(a || e.durationMs !== void 0 || e.sources && e.sources.length > 0 || e.toolCalls && e.toolCalls.length > 0 || e.usage);
|
|
2071
|
+
return /* @__PURE__ */ w("div", { className: `msg-row${s ? " msg-row--user" : ""}`, children: [
|
|
2072
|
+
!s && /* @__PURE__ */ l(
|
|
1737
2073
|
"div",
|
|
1738
2074
|
{
|
|
1739
2075
|
className: "avatar-circle avatar-circle--mt",
|
|
1740
2076
|
"aria-hidden": "true",
|
|
1741
|
-
children: /* @__PURE__ */ l(
|
|
2077
|
+
children: /* @__PURE__ */ l(pt, { size: 15 })
|
|
1742
2078
|
}
|
|
1743
2079
|
),
|
|
1744
|
-
/* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ w("div", { className: `msg-col${s ? " msg-col--user" : ""}`, children: [
|
|
2081
|
+
/* @__PURE__ */ w(
|
|
1746
2082
|
"div",
|
|
1747
2083
|
{
|
|
1748
|
-
className:
|
|
2084
|
+
className: s ? "msg-bubble msg-bubble--user" : o ? "msg-bubble msg-bubble--error" : "msg-bubble msg-bubble--bot",
|
|
1749
2085
|
children: [
|
|
1750
|
-
!
|
|
1751
|
-
|
|
2086
|
+
!s && !o && !i && u && /* @__PURE__ */ l(
|
|
2087
|
+
sn,
|
|
1752
2088
|
{
|
|
1753
|
-
status:
|
|
2089
|
+
status: a ? "pending" : "complete",
|
|
1754
2090
|
progressText: e.progressText,
|
|
1755
|
-
|
|
2091
|
+
durationMs: e.durationMs
|
|
1756
2092
|
}
|
|
1757
2093
|
),
|
|
1758
|
-
|
|
1759
|
-
e.toolCalls ? /* @__PURE__ */ l(
|
|
2094
|
+
a ? e.content ? /* @__PURE__ */ l("div", { className: "msg-content-wrapper msg-content-wrapper--streaming", children: /* @__PURE__ */ l("div", { className: "msg-streaming-text", children: e.content }) }) : /* @__PURE__ */ l(nn, {}) : s ? /* @__PURE__ */ l("p", { className: "msg-user-pre", children: e.content }) : /* @__PURE__ */ l("div", { className: "msg-content-wrapper", children: /* @__PURE__ */ l(rn, { text: e.content }) }),
|
|
2095
|
+
e.toolCalls ? /* @__PURE__ */ l(un, { toolCalls: e.toolCalls }) : null,
|
|
2096
|
+
!s && !a && !o && r && ((g = e.sources) != null && g.length) ? /* @__PURE__ */ l(an, { sources: e.sources, hideInspectSources: n }) : null
|
|
1760
2097
|
]
|
|
1761
2098
|
}
|
|
1762
2099
|
),
|
|
1763
|
-
|
|
2100
|
+
s && e.status !== "error" && /* @__PURE__ */ l(Wt, { size: 13, className: "msg-tick", "aria-hidden": "true" })
|
|
1764
2101
|
] })
|
|
1765
2102
|
] });
|
|
1766
|
-
},
|
|
1767
|
-
const { messages: e, status: t, showSuggestions: n } =
|
|
2103
|
+
}, hn = () => {
|
|
2104
|
+
const { messages: e, status: t, showSuggestions: n } = Be();
|
|
1768
2105
|
return /* @__PURE__ */ l(
|
|
1769
|
-
|
|
2106
|
+
Yr,
|
|
1770
2107
|
{
|
|
1771
2108
|
autoScroll: !0,
|
|
1772
2109
|
defaultScrollPosition: "last-anchor",
|
|
1773
2110
|
scrollPreviousItemPeek: 64,
|
|
1774
|
-
children: /* @__PURE__ */
|
|
1775
|
-
/* @__PURE__ */ l(
|
|
1776
|
-
e.length === 0 && /* @__PURE__ */ l(
|
|
2111
|
+
children: /* @__PURE__ */ w(Jr, { children: [
|
|
2112
|
+
/* @__PURE__ */ l(Kr, { "aria-label": "Chat messages", children: /* @__PURE__ */ w(Qr, { "aria-busy": t === "awaiting" || t === "connecting", children: [
|
|
2113
|
+
e.length === 0 && /* @__PURE__ */ l(nt, { messageId: "welcome", children: /* @__PURE__ */ l(Zr, {}) }),
|
|
1777
2114
|
e.map((s) => /* @__PURE__ */ l(
|
|
1778
|
-
|
|
2115
|
+
nt,
|
|
1779
2116
|
{
|
|
1780
2117
|
messageId: s.id,
|
|
1781
2118
|
scrollAnchor: s.role === "user",
|
|
1782
|
-
children: /* @__PURE__ */ l(
|
|
2119
|
+
children: /* @__PURE__ */ l(dn, { message: s })
|
|
1783
2120
|
},
|
|
1784
2121
|
s.id
|
|
1785
2122
|
))
|
|
1786
2123
|
] }) }),
|
|
1787
|
-
/* @__PURE__ */ l(
|
|
2124
|
+
/* @__PURE__ */ l(Xr, {})
|
|
1788
2125
|
] })
|
|
1789
2126
|
}
|
|
1790
2127
|
);
|
|
1791
|
-
},
|
|
1792
|
-
const { pendingTicket: e, ticketBusy: t, userContext: n, confirmTicket: r, cancelTicket: s } =
|
|
1793
|
-
return e ? /* @__PURE__ */
|
|
2128
|
+
}, pn = () => {
|
|
2129
|
+
const { pendingTicket: e, ticketBusy: t, userContext: n, confirmTicket: r, cancelTicket: s } = Be(), o = !n.customerId && !n.email, [a, i] = U("");
|
|
2130
|
+
return e ? /* @__PURE__ */ w(
|
|
1794
2131
|
"div",
|
|
1795
2132
|
{
|
|
1796
2133
|
className: "ticket-card",
|
|
@@ -1800,20 +2137,20 @@ const Xr = ({ message: e }) => {
|
|
|
1800
2137
|
/* @__PURE__ */ l("h3", { className: "ticket-card-title", children: "Create support ticket?" }),
|
|
1801
2138
|
/* @__PURE__ */ l("p", { className: "ticket-card-desc", children: "I can open a support request for you. Nothing is created until you confirm." }),
|
|
1802
2139
|
/* @__PURE__ */ l("p", { className: "ticket-card-body", children: e.description }),
|
|
1803
|
-
o && /* @__PURE__ */
|
|
2140
|
+
o && /* @__PURE__ */ w("label", { className: "ticket-id-label", children: [
|
|
1804
2141
|
"Customer ID or email",
|
|
1805
2142
|
/* @__PURE__ */ l(
|
|
1806
2143
|
"input",
|
|
1807
2144
|
{
|
|
1808
2145
|
value: a,
|
|
1809
|
-
onChange: (
|
|
2146
|
+
onChange: (u) => i(u.target.value),
|
|
1810
2147
|
className: "ticket-id-input",
|
|
1811
2148
|
placeholder: "CUST-1001 or you@company.com",
|
|
1812
2149
|
autoComplete: "email"
|
|
1813
2150
|
}
|
|
1814
2151
|
)
|
|
1815
2152
|
] }),
|
|
1816
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ w("div", { className: "ticket-actions", children: [
|
|
1817
2154
|
/* @__PURE__ */ l(
|
|
1818
2155
|
"button",
|
|
1819
2156
|
{
|
|
@@ -1838,7 +2175,7 @@ const Xr = ({ message: e }) => {
|
|
|
1838
2175
|
]
|
|
1839
2176
|
}
|
|
1840
2177
|
) : null;
|
|
1841
|
-
},
|
|
2178
|
+
}, St = ({
|
|
1842
2179
|
className: e,
|
|
1843
2180
|
onClose: t,
|
|
1844
2181
|
showMinimize: n,
|
|
@@ -1847,15 +2184,15 @@ const Xr = ({ message: e }) => {
|
|
|
1847
2184
|
envStage: o,
|
|
1848
2185
|
envPulse: a = !0
|
|
1849
2186
|
}) => {
|
|
1850
|
-
const { sendMessage: i, status:
|
|
1851
|
-
return /* @__PURE__ */
|
|
2187
|
+
const { sendMessage: i, status: u, error: h, resetConversation: g, retryLast: f, pendingTicket: c } = Be(), p = u === "awaiting" || u === "connecting" || !!c;
|
|
2188
|
+
return /* @__PURE__ */ w(
|
|
1852
2189
|
"section",
|
|
1853
2190
|
{
|
|
1854
2191
|
className: `chat-panel${e ? ` ${e}` : ""}`,
|
|
1855
2192
|
"aria-label": "VPS AI Assistant",
|
|
1856
2193
|
children: [
|
|
1857
2194
|
/* @__PURE__ */ l(
|
|
1858
|
-
|
|
2195
|
+
lr,
|
|
1859
2196
|
{
|
|
1860
2197
|
title: r,
|
|
1861
2198
|
subtitle: s,
|
|
@@ -1866,20 +2203,20 @@ const Xr = ({ message: e }) => {
|
|
|
1866
2203
|
envPulse: a
|
|
1867
2204
|
}
|
|
1868
2205
|
),
|
|
1869
|
-
/* @__PURE__ */ l("div", { className: "chat-panel-body", children: /* @__PURE__ */ l(
|
|
1870
|
-
|
|
1871
|
-
/* @__PURE__ */ l(
|
|
2206
|
+
/* @__PURE__ */ l("div", { className: "chat-panel-body", children: /* @__PURE__ */ l(hn, {}) }),
|
|
2207
|
+
h && u === "error" && /* @__PURE__ */ l(Pt, { message: h, onRetry: () => void f() }),
|
|
2208
|
+
/* @__PURE__ */ l(pn, {}),
|
|
1872
2209
|
/* @__PURE__ */ l(
|
|
1873
|
-
|
|
2210
|
+
ur,
|
|
1874
2211
|
{
|
|
1875
|
-
onSend: (
|
|
1876
|
-
disabled:
|
|
2212
|
+
onSend: (b) => void i(b),
|
|
2213
|
+
disabled: p
|
|
1877
2214
|
}
|
|
1878
2215
|
)
|
|
1879
2216
|
]
|
|
1880
2217
|
}
|
|
1881
2218
|
);
|
|
1882
|
-
},
|
|
2219
|
+
}, fn = ({
|
|
1883
2220
|
open: e,
|
|
1884
2221
|
onClose: t,
|
|
1885
2222
|
envStage: n,
|
|
@@ -1890,7 +2227,7 @@ const Xr = ({ message: e }) => {
|
|
|
1890
2227
|
id: "vps-chatbot-widget-panel",
|
|
1891
2228
|
className: "widget-panel",
|
|
1892
2229
|
children: /* @__PURE__ */ l(
|
|
1893
|
-
|
|
2230
|
+
St,
|
|
1894
2231
|
{
|
|
1895
2232
|
onClose: t,
|
|
1896
2233
|
showMinimize: !0,
|
|
@@ -1900,7 +2237,7 @@ const Xr = ({ message: e }) => {
|
|
|
1900
2237
|
}
|
|
1901
2238
|
)
|
|
1902
2239
|
}
|
|
1903
|
-
) : null,
|
|
2240
|
+
) : null, mn = ({
|
|
1904
2241
|
open: e,
|
|
1905
2242
|
onToggle: t
|
|
1906
2243
|
}) => /* @__PURE__ */ l(
|
|
@@ -1912,31 +2249,31 @@ const Xr = ({ message: e }) => {
|
|
|
1912
2249
|
"aria-controls": "vps-chatbot-widget-panel",
|
|
1913
2250
|
"aria-label": e ? "Close assistant" : "Open assistant",
|
|
1914
2251
|
className: "widget-trigger-btn",
|
|
1915
|
-
children: e ? /* @__PURE__ */ l(
|
|
2252
|
+
children: e ? /* @__PURE__ */ l(rr, { size: 22 }) : /* @__PURE__ */ l(ft, { size: 24 })
|
|
1916
2253
|
}
|
|
1917
|
-
),
|
|
2254
|
+
), ot = ({
|
|
1918
2255
|
defaultOpen: e = !1,
|
|
1919
2256
|
open: t,
|
|
1920
2257
|
onOpenChange: n,
|
|
1921
2258
|
envStage: r,
|
|
1922
2259
|
envPulse: s = !0
|
|
1923
2260
|
}) => {
|
|
1924
|
-
const [o, a] =
|
|
1925
|
-
n == null || n(
|
|
2261
|
+
const [o, a] = U(e), i = t ?? o, u = (h) => {
|
|
2262
|
+
n == null || n(h), t === void 0 && a(h);
|
|
1926
2263
|
};
|
|
1927
|
-
return /* @__PURE__ */
|
|
2264
|
+
return /* @__PURE__ */ w(De, { children: [
|
|
1928
2265
|
/* @__PURE__ */ l(
|
|
1929
|
-
|
|
2266
|
+
fn,
|
|
1930
2267
|
{
|
|
1931
2268
|
open: i,
|
|
1932
|
-
onClose: () =>
|
|
2269
|
+
onClose: () => u(!1),
|
|
1933
2270
|
envStage: r,
|
|
1934
2271
|
envPulse: s
|
|
1935
2272
|
}
|
|
1936
2273
|
),
|
|
1937
|
-
/* @__PURE__ */ l(
|
|
2274
|
+
/* @__PURE__ */ l(mn, { open: i, onToggle: () => u(!i) })
|
|
1938
2275
|
] });
|
|
1939
|
-
},
|
|
2276
|
+
}, Fn = ({
|
|
1940
2277
|
apiBaseUrl: e,
|
|
1941
2278
|
apiUrl: t,
|
|
1942
2279
|
proxyUrl: n,
|
|
@@ -1945,39 +2282,41 @@ const Xr = ({ message: e }) => {
|
|
|
1945
2282
|
roleId: o,
|
|
1946
2283
|
client: a,
|
|
1947
2284
|
welcomeMessage: i,
|
|
1948
|
-
suggestions:
|
|
1949
|
-
disableSuggestions:
|
|
2285
|
+
suggestions: u,
|
|
2286
|
+
disableSuggestions: h,
|
|
1950
2287
|
initialMessage: g,
|
|
1951
|
-
hideInspectSources:
|
|
1952
|
-
showGroundedSources:
|
|
1953
|
-
|
|
2288
|
+
hideInspectSources: f,
|
|
2289
|
+
showGroundedSources: c,
|
|
2290
|
+
modelId: p,
|
|
2291
|
+
...b
|
|
1954
2292
|
}) => {
|
|
1955
|
-
const
|
|
1956
|
-
return !!
|
|
1957
|
-
|
|
2293
|
+
const k = Ge(), v = e ?? t ?? n;
|
|
2294
|
+
return !!k && (!v || ve(v) === ve(k == null ? void 0 : k.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !u && h === void 0 && !g && f === void 0 && c === void 0 && p === void 0 ? /* @__PURE__ */ l(ot, { ...b }) : /* @__PURE__ */ l(
|
|
2295
|
+
dt,
|
|
1958
2296
|
{
|
|
1959
|
-
apiBaseUrl:
|
|
2297
|
+
apiBaseUrl: v,
|
|
1960
2298
|
userContext: r,
|
|
1961
2299
|
role: s,
|
|
1962
2300
|
roleId: o,
|
|
1963
2301
|
client: a,
|
|
1964
2302
|
welcomeMessage: i,
|
|
1965
|
-
suggestions:
|
|
1966
|
-
disableSuggestions:
|
|
2303
|
+
suggestions: u,
|
|
2304
|
+
disableSuggestions: h,
|
|
1967
2305
|
initialMessage: g,
|
|
1968
|
-
hideInspectSources:
|
|
1969
|
-
showGroundedSources:
|
|
1970
|
-
|
|
2306
|
+
hideInspectSources: f,
|
|
2307
|
+
showGroundedSources: c,
|
|
2308
|
+
modelId: p,
|
|
2309
|
+
children: /* @__PURE__ */ l(ot, { ...b })
|
|
1971
2310
|
}
|
|
1972
2311
|
);
|
|
1973
|
-
},
|
|
2312
|
+
}, gn = ({
|
|
1974
2313
|
open: e,
|
|
1975
2314
|
onClose: t,
|
|
1976
2315
|
subtitle: n,
|
|
1977
2316
|
title: r,
|
|
1978
2317
|
envStage: s,
|
|
1979
2318
|
envPulse: o = !0
|
|
1980
|
-
}) => /* @__PURE__ */
|
|
2319
|
+
}) => /* @__PURE__ */ w(De, { children: [
|
|
1981
2320
|
/* @__PURE__ */ l(
|
|
1982
2321
|
"div",
|
|
1983
2322
|
{
|
|
@@ -1994,7 +2333,7 @@ const Xr = ({ message: e }) => {
|
|
|
1994
2333
|
className: `embedded-panel ${e ? "embedded-panel--open" : "embedded-panel--closed"}`,
|
|
1995
2334
|
"aria-hidden": !e,
|
|
1996
2335
|
children: e && /* @__PURE__ */ l(
|
|
1997
|
-
|
|
2336
|
+
St,
|
|
1998
2337
|
{
|
|
1999
2338
|
onClose: t,
|
|
2000
2339
|
title: r || "VPS AI Assistant",
|
|
@@ -2005,20 +2344,20 @@ const Xr = ({ message: e }) => {
|
|
|
2005
2344
|
)
|
|
2006
2345
|
}
|
|
2007
2346
|
)
|
|
2008
|
-
] }),
|
|
2009
|
-
function
|
|
2347
|
+
] }), bn = 5, $e = 8, Ft = "vps-embedded-assistant-top";
|
|
2348
|
+
function vn(e, t, n) {
|
|
2010
2349
|
return Math.min(n, Math.max(t, e));
|
|
2011
2350
|
}
|
|
2012
|
-
function
|
|
2351
|
+
function lt(e, t) {
|
|
2013
2352
|
const n = Math.max(
|
|
2014
|
-
|
|
2015
|
-
window.innerHeight - t -
|
|
2353
|
+
$e,
|
|
2354
|
+
window.innerHeight - t - $e
|
|
2016
2355
|
);
|
|
2017
|
-
return
|
|
2356
|
+
return vn(e, $e, n);
|
|
2018
2357
|
}
|
|
2019
|
-
function
|
|
2358
|
+
function _n() {
|
|
2020
2359
|
try {
|
|
2021
|
-
const e = window.localStorage.getItem(
|
|
2360
|
+
const e = window.localStorage.getItem(Ft);
|
|
2022
2361
|
if (!e) return null;
|
|
2023
2362
|
const t = Number(e);
|
|
2024
2363
|
return Number.isFinite(t) ? t : null;
|
|
@@ -2026,78 +2365,78 @@ function an() {
|
|
|
2026
2365
|
return null;
|
|
2027
2366
|
}
|
|
2028
2367
|
}
|
|
2029
|
-
function
|
|
2368
|
+
function wn(e) {
|
|
2030
2369
|
try {
|
|
2031
|
-
window.localStorage.setItem(
|
|
2370
|
+
window.localStorage.setItem(Ft, String(e));
|
|
2032
2371
|
} catch {
|
|
2033
2372
|
}
|
|
2034
2373
|
}
|
|
2035
|
-
const
|
|
2374
|
+
const yn = ({
|
|
2036
2375
|
onOpen: e
|
|
2037
2376
|
}) => {
|
|
2038
|
-
const t =
|
|
2377
|
+
const t = re(null), n = re({
|
|
2039
2378
|
pointerId: null,
|
|
2040
2379
|
startY: 0,
|
|
2041
2380
|
startTop: 0,
|
|
2042
2381
|
moved: !1
|
|
2043
|
-
}), [r, s] =
|
|
2044
|
-
() => typeof window > "u" ? null :
|
|
2045
|
-
), o =
|
|
2046
|
-
|
|
2382
|
+
}), [r, s] = U(
|
|
2383
|
+
() => typeof window > "u" ? null : _n()
|
|
2384
|
+
), o = re(r), a = re(!1), [i, u] = U(!1);
|
|
2385
|
+
ke(() => {
|
|
2047
2386
|
o.current = r;
|
|
2048
|
-
}, [r]),
|
|
2049
|
-
const
|
|
2050
|
-
if (!
|
|
2051
|
-
const
|
|
2052
|
-
s((
|
|
2053
|
-
const
|
|
2054
|
-
return o.current =
|
|
2387
|
+
}, [r]), ke(() => {
|
|
2388
|
+
const c = t.current;
|
|
2389
|
+
if (!c) return;
|
|
2390
|
+
const p = () => {
|
|
2391
|
+
s((b) => {
|
|
2392
|
+
const k = b ?? Math.round(window.innerHeight / 2 - c.offsetHeight / 2), v = lt(k, c.offsetHeight);
|
|
2393
|
+
return o.current = v, v;
|
|
2055
2394
|
});
|
|
2056
2395
|
};
|
|
2057
|
-
return
|
|
2396
|
+
return p(), window.addEventListener("resize", p), () => window.removeEventListener("resize", p);
|
|
2058
2397
|
}, []);
|
|
2059
|
-
const
|
|
2060
|
-
if (
|
|
2061
|
-
const
|
|
2398
|
+
const h = (c) => {
|
|
2399
|
+
if (c.button !== 0) return;
|
|
2400
|
+
const p = c.currentTarget, b = p.getBoundingClientRect();
|
|
2062
2401
|
n.current = {
|
|
2063
|
-
pointerId:
|
|
2064
|
-
startY:
|
|
2065
|
-
startTop:
|
|
2402
|
+
pointerId: c.pointerId,
|
|
2403
|
+
startY: c.clientY,
|
|
2404
|
+
startTop: b.top,
|
|
2066
2405
|
moved: !1
|
|
2067
2406
|
};
|
|
2068
2407
|
try {
|
|
2069
|
-
|
|
2408
|
+
p.setPointerCapture(c.pointerId);
|
|
2070
2409
|
} catch {
|
|
2071
2410
|
}
|
|
2072
|
-
}, g = (
|
|
2073
|
-
if (n.current.pointerId !==
|
|
2074
|
-
const
|
|
2075
|
-
if (!n.current.moved && Math.abs(
|
|
2076
|
-
n.current.moved = !0,
|
|
2077
|
-
const
|
|
2078
|
-
n.current.startTop +
|
|
2079
|
-
|
|
2411
|
+
}, g = (c) => {
|
|
2412
|
+
if (n.current.pointerId !== c.pointerId) return;
|
|
2413
|
+
const p = c.clientY - n.current.startY;
|
|
2414
|
+
if (!n.current.moved && Math.abs(p) < bn) return;
|
|
2415
|
+
n.current.moved = !0, u(!0);
|
|
2416
|
+
const b = lt(
|
|
2417
|
+
n.current.startTop + p,
|
|
2418
|
+
c.currentTarget.offsetHeight
|
|
2080
2419
|
);
|
|
2081
|
-
o.current =
|
|
2082
|
-
},
|
|
2083
|
-
var
|
|
2084
|
-
if (n.current.pointerId !==
|
|
2420
|
+
o.current = b, s(b);
|
|
2421
|
+
}, f = (c) => {
|
|
2422
|
+
var b, k;
|
|
2423
|
+
if (n.current.pointerId !== c.pointerId) return;
|
|
2085
2424
|
try {
|
|
2086
|
-
(
|
|
2425
|
+
(k = (b = c.currentTarget).hasPointerCapture) != null && k.call(b, c.pointerId) && c.currentTarget.releasePointerCapture(c.pointerId);
|
|
2087
2426
|
} catch {
|
|
2088
2427
|
}
|
|
2089
|
-
const
|
|
2090
|
-
n.current.pointerId = null, n.current.moved = !1,
|
|
2428
|
+
const p = n.current.moved;
|
|
2429
|
+
n.current.pointerId = null, n.current.moved = !1, u(!1), p && (a.current = !0, o.current != null && wn(o.current));
|
|
2091
2430
|
};
|
|
2092
|
-
return /* @__PURE__ */
|
|
2431
|
+
return /* @__PURE__ */ w(
|
|
2093
2432
|
"button",
|
|
2094
2433
|
{
|
|
2095
2434
|
ref: t,
|
|
2096
2435
|
type: "button",
|
|
2097
|
-
onPointerDown:
|
|
2436
|
+
onPointerDown: h,
|
|
2098
2437
|
onPointerMove: g,
|
|
2099
|
-
onPointerUp:
|
|
2100
|
-
onPointerCancel:
|
|
2438
|
+
onPointerUp: f,
|
|
2439
|
+
onPointerCancel: f,
|
|
2101
2440
|
onClick: () => {
|
|
2102
2441
|
if (a.current) {
|
|
2103
2442
|
a.current = !1;
|
|
@@ -2114,12 +2453,12 @@ const un = ({
|
|
|
2114
2453
|
transform: r == null ? "translateY(-50%)" : void 0
|
|
2115
2454
|
},
|
|
2116
2455
|
children: [
|
|
2117
|
-
/* @__PURE__ */ l(
|
|
2456
|
+
/* @__PURE__ */ l(ft, { size: 16 }),
|
|
2118
2457
|
"Assistant"
|
|
2119
2458
|
]
|
|
2120
2459
|
}
|
|
2121
2460
|
);
|
|
2122
|
-
},
|
|
2461
|
+
}, at = ({
|
|
2123
2462
|
defaultOpen: e = !1,
|
|
2124
2463
|
open: t,
|
|
2125
2464
|
onOpenChange: n,
|
|
@@ -2127,22 +2466,22 @@ const un = ({
|
|
|
2127
2466
|
envStage: s,
|
|
2128
2467
|
envPulse: o = !0
|
|
2129
2468
|
}) => {
|
|
2130
|
-
const [a, i] =
|
|
2469
|
+
const [a, i] = U(e), u = t ?? a, h = (g) => {
|
|
2131
2470
|
n == null || n(g), t === void 0 && i(g);
|
|
2132
2471
|
};
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
r && !
|
|
2472
|
+
return /* @__PURE__ */ w(De, { children: [
|
|
2473
|
+
r && !u && /* @__PURE__ */ l(yn, { onOpen: () => h(!0) }),
|
|
2135
2474
|
/* @__PURE__ */ l(
|
|
2136
|
-
|
|
2475
|
+
gn,
|
|
2137
2476
|
{
|
|
2138
|
-
open:
|
|
2139
|
-
onClose: () =>
|
|
2477
|
+
open: u,
|
|
2478
|
+
onClose: () => h(!1),
|
|
2140
2479
|
envStage: s,
|
|
2141
2480
|
envPulse: o
|
|
2142
2481
|
}
|
|
2143
2482
|
)
|
|
2144
2483
|
] });
|
|
2145
|
-
},
|
|
2484
|
+
}, Tn = ({
|
|
2146
2485
|
apiBaseUrl: e,
|
|
2147
2486
|
apiUrl: t,
|
|
2148
2487
|
proxyUrl: n,
|
|
@@ -2151,32 +2490,34 @@ const un = ({
|
|
|
2151
2490
|
roleId: o,
|
|
2152
2491
|
client: a,
|
|
2153
2492
|
welcomeMessage: i,
|
|
2154
|
-
suggestions:
|
|
2155
|
-
disableSuggestions:
|
|
2493
|
+
suggestions: u,
|
|
2494
|
+
disableSuggestions: h,
|
|
2156
2495
|
initialMessage: g,
|
|
2157
|
-
hideInspectSources:
|
|
2158
|
-
showGroundedSources:
|
|
2159
|
-
|
|
2496
|
+
hideInspectSources: f,
|
|
2497
|
+
showGroundedSources: c,
|
|
2498
|
+
modelId: p,
|
|
2499
|
+
...b
|
|
2160
2500
|
}) => {
|
|
2161
|
-
const
|
|
2162
|
-
return !!
|
|
2163
|
-
|
|
2501
|
+
const k = Ge(), v = e ?? t ?? n;
|
|
2502
|
+
return !!k && (!v || ve(v) === ve(k == null ? void 0 : k.apiBaseUrl)) && !r && s === void 0 && o === void 0 && a === void 0 && i === void 0 && !u && h === void 0 && !g && f === void 0 && c === void 0 && p === void 0 ? /* @__PURE__ */ l(at, { ...b }) : /* @__PURE__ */ l(
|
|
2503
|
+
dt,
|
|
2164
2504
|
{
|
|
2165
|
-
apiBaseUrl:
|
|
2505
|
+
apiBaseUrl: v,
|
|
2166
2506
|
userContext: r,
|
|
2167
2507
|
role: s,
|
|
2168
2508
|
roleId: o,
|
|
2169
2509
|
client: a,
|
|
2170
2510
|
welcomeMessage: i,
|
|
2171
|
-
suggestions:
|
|
2172
|
-
disableSuggestions:
|
|
2511
|
+
suggestions: u,
|
|
2512
|
+
disableSuggestions: h,
|
|
2173
2513
|
initialMessage: g,
|
|
2174
|
-
hideInspectSources:
|
|
2175
|
-
showGroundedSources:
|
|
2176
|
-
|
|
2514
|
+
hideInspectSources: f,
|
|
2515
|
+
showGroundedSources: c,
|
|
2516
|
+
modelId: p,
|
|
2517
|
+
children: /* @__PURE__ */ l(at, { ...b })
|
|
2177
2518
|
}
|
|
2178
2519
|
);
|
|
2179
|
-
},
|
|
2520
|
+
}, En = {
|
|
2180
2521
|
Colors: {
|
|
2181
2522
|
VPS_White: "#fff",
|
|
2182
2523
|
VPS_Dark_Blue: "#1A1A31",
|
|
@@ -2341,16 +2682,16 @@ const un = ({
|
|
|
2341
2682
|
}
|
|
2342
2683
|
};
|
|
2343
2684
|
export {
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2685
|
+
St as ChatPanel,
|
|
2686
|
+
dt as ChatProvider,
|
|
2687
|
+
Fn as ChatbotWidget,
|
|
2688
|
+
En as ColorPalette,
|
|
2689
|
+
Tn as EmbeddedChatbot,
|
|
2690
|
+
Pe as buildApiUrl,
|
|
2691
|
+
Sn as chatApi,
|
|
2692
|
+
ut as createChatApi,
|
|
2693
|
+
ve as resolveApiBaseUrl,
|
|
2353
2694
|
Mt as useChatContext,
|
|
2354
|
-
|
|
2355
|
-
|
|
2695
|
+
Be as useChatbot,
|
|
2696
|
+
Ge as useOptionalChatContext
|
|
2356
2697
|
};
|