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