@squadico/chatbot 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/{answer-CDGrP8YE.js → answer-BDuY6oLY.js} +242 -231
- package/dist/answer-BDuY6oLY.js.map +1 -0
- package/dist/answer-Bi8GWLyA.cjs +8 -0
- package/dist/answer-Bi8GWLyA.cjs.map +1 -0
- package/dist/chatbot.global.js +11 -11
- package/dist/chatbot.global.js.map +1 -1
- package/dist/components/ChatbotWidget.d.ts.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/{extras-lsCe4xgN.cjs → extras-BAqWS9pU.cjs} +2 -2
- package/dist/{extras-lsCe4xgN.cjs.map → extras-BAqWS9pU.cjs.map} +1 -1
- package/dist/{extras-ClIRRLqo.js → extras-BSCTuiit.js} +2 -2
- package/dist/{extras-ClIRRLqo.js.map → extras-BSCTuiit.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/conversation.d.ts +5 -1
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts +6 -0
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/{src-BjqOavOO.js → src-B7GLD1Xs.js} +489 -452
- package/dist/src-B7GLD1Xs.js.map +1 -0
- package/dist/src-DuYhMbNf.cjs +7 -0
- package/dist/src-DuYhMbNf.cjs.map +1 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/widgets/extras-loader.d.ts +1 -1
- package/dist/widgets/inline.d.ts.map +1 -1
- package/dist/widgets.cjs +1 -1
- package/dist/widgets.js +2 -2
- package/package.json +1 -1
- package/dist/answer-CDGrP8YE.js.map +0 -1
- package/dist/answer-DRaV2dVt.cjs +0 -8
- package/dist/answer-DRaV2dVt.cjs.map +0 -1
- package/dist/src-BjqOavOO.js.map +0 -1
- package/dist/src-DS8P9HdZ.cjs +0 -7
- package/dist/src-DS8P9HdZ.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as e, D as t, E as n, S as r, T as i, a, b as o, d as s, f as c, g as l, h as u, i as d, m as f, n as p, p as m, r as h, s as g, t as _, w as v, x as y, y as b } from "./answer-
|
|
1
|
+
import { C as e, D as t, E as n, S as r, T as i, a, b as o, d as s, f as c, g as l, h as u, i as d, m as f, n as p, p as m, r as h, s as g, t as _, w as v, x as y, y as b } from "./answer-BDuY6oLY.js";
|
|
2
2
|
//#region src/lib/context.ts
|
|
3
3
|
var x = /* @__PURE__ */ new Set(["sessionId"]);
|
|
4
4
|
function S(e) {
|
|
@@ -31,40 +31,40 @@ function T(e) {
|
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/lib/openState.ts
|
|
34
|
-
var
|
|
35
|
-
function
|
|
34
|
+
var ee = "squadico-chatbot:open";
|
|
35
|
+
function E() {
|
|
36
36
|
try {
|
|
37
37
|
if (typeof sessionStorage > "u") return;
|
|
38
|
-
let e = sessionStorage.getItem(
|
|
38
|
+
let e = sessionStorage.getItem(ee);
|
|
39
39
|
return e === "1" || e !== "0" && void 0;
|
|
40
40
|
} catch {
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function D(e) {
|
|
45
45
|
try {
|
|
46
46
|
if (typeof sessionStorage > "u") return;
|
|
47
|
-
sessionStorage.setItem(
|
|
47
|
+
sessionStorage.setItem(ee, e ? "1" : "0");
|
|
48
48
|
} catch {}
|
|
49
49
|
}
|
|
50
|
-
function
|
|
51
|
-
return t === !1 ? e ?? !1 :
|
|
50
|
+
function O(e, t) {
|
|
51
|
+
return t === !1 ? e ?? !1 : E() ?? e ?? !1;
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/lib/rail.ts
|
|
55
|
-
function
|
|
55
|
+
function k(e, t) {
|
|
56
56
|
for (let t = e.length - 1; t >= 0; --t) {
|
|
57
57
|
let n = e[t];
|
|
58
58
|
if (n.role === "assistant" && n.agent) return n.agent.handle;
|
|
59
59
|
}
|
|
60
60
|
return t;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function A(e, t, n) {
|
|
63
63
|
return !t || t === n || e.trimStart().startsWith("@") ? e : `@${t} ${e}`;
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/lib/uid.ts
|
|
67
|
-
function
|
|
67
|
+
function j() {
|
|
68
68
|
let e = globalThis.crypto;
|
|
69
69
|
if (e && typeof e.randomUUID == "function") return e.randomUUID();
|
|
70
70
|
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
@@ -77,36 +77,36 @@ function M() {
|
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
79
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
|
|
80
|
-
function
|
|
80
|
+
function M(e) {
|
|
81
81
|
"@babel/helpers - typeof";
|
|
82
|
-
return
|
|
82
|
+
return M = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
83
83
|
return typeof e;
|
|
84
84
|
} : function(e) {
|
|
85
85
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
86
|
-
},
|
|
86
|
+
}, M(e);
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
|
|
90
|
-
function
|
|
91
|
-
if (
|
|
90
|
+
function N(e, t) {
|
|
91
|
+
if (M(e) != "object" || !e) return e;
|
|
92
92
|
var n = e[Symbol.toPrimitive];
|
|
93
93
|
if (n !== void 0) {
|
|
94
94
|
var r = n.call(e, t || "default");
|
|
95
|
-
if (
|
|
95
|
+
if (M(r) != "object") return r;
|
|
96
96
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
97
97
|
}
|
|
98
98
|
return (t === "string" ? String : Number)(e);
|
|
99
99
|
}
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
|
|
102
|
-
function
|
|
103
|
-
var t =
|
|
104
|
-
return
|
|
102
|
+
function P(e) {
|
|
103
|
+
var t = N(e, "string");
|
|
104
|
+
return M(t) == "symbol" ? t : t + "";
|
|
105
105
|
}
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
|
|
108
|
-
function
|
|
109
|
-
return (t =
|
|
108
|
+
function F(e, t, n) {
|
|
109
|
+
return (t = P(t)) in e ? Object.defineProperty(e, t, {
|
|
110
110
|
value: n,
|
|
111
111
|
enumerable: !0,
|
|
112
112
|
configurable: !0,
|
|
@@ -115,15 +115,15 @@ function I(e, t, n) {
|
|
|
115
115
|
}
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/lib/client.ts
|
|
118
|
-
var
|
|
118
|
+
var I = "https://api.squadico.com", L = 2e4, R = class extends Error {
|
|
119
119
|
constructor(e, t, n) {
|
|
120
|
-
super(e),
|
|
120
|
+
super(e), F(this, "status", void 0), F(this, "code", void 0), this.name = "ChatHttpError", this.status = t, this.code = n;
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
|
-
function
|
|
123
|
+
function z(e, t) {
|
|
124
124
|
return `${e.replace(/\/+$/, "")}${t}`;
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function B(e, t) {
|
|
127
127
|
return {
|
|
128
128
|
"Content-Type": "application/json",
|
|
129
129
|
Accept: "text/event-stream, application/json",
|
|
@@ -131,21 +131,21 @@ function V(e, t) {
|
|
|
131
131
|
...t ? { "X-Subject-Token": t } : {}
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function te(e) {
|
|
135
135
|
if (!e || typeof e != "object") return;
|
|
136
136
|
let { loc: t, msg: n } = e;
|
|
137
137
|
if (typeof n != "string" || !n) return;
|
|
138
138
|
let r = (Array.isArray(t) ? t.filter((e) => typeof e == "string") : []).at(-1);
|
|
139
139
|
return r && r !== "body" ? `${r}: ${n}` : n;
|
|
140
140
|
}
|
|
141
|
-
async function
|
|
141
|
+
async function V(e) {
|
|
142
142
|
let t = "", n;
|
|
143
143
|
try {
|
|
144
144
|
let r = await e.text();
|
|
145
145
|
if (r) try {
|
|
146
146
|
let e = JSON.parse(r), i = e.detail ?? e.message;
|
|
147
147
|
if (Array.isArray(i)) {
|
|
148
|
-
let e = i.map((e) =>
|
|
148
|
+
let e = i.map((e) => te(e) ?? (typeof e == "string" ? e : void 0)).filter((e) => e !== void 0);
|
|
149
149
|
t = e.length > 0 ? e.join(", ") : r;
|
|
150
150
|
} else t = typeof i == "string" ? i : r;
|
|
151
151
|
n = typeof e.code == "string" ? e.code : void 0;
|
|
@@ -153,29 +153,29 @@ async function H(e) {
|
|
|
153
153
|
t = r;
|
|
154
154
|
}
|
|
155
155
|
} catch {}
|
|
156
|
-
return new
|
|
156
|
+
return new R(t || `The API answered ${e.status}`, e.status, n);
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function H(e, t) {
|
|
159
159
|
if (!e || typeof e != "object") return;
|
|
160
160
|
let n = e;
|
|
161
161
|
if (!(typeof n.handle != "string" || !n.handle)) return {
|
|
162
162
|
handle: n.handle,
|
|
163
163
|
name: typeof n.name == "string" ? n.name : n.handle,
|
|
164
|
-
avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ?
|
|
164
|
+
avatarUrl: typeof n.avatar_url == "string" && n.avatar_url ? z(t, n.avatar_url) : void 0,
|
|
165
165
|
color: typeof n.color == "string" ? n.color : void 0
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
return (Array.isArray(e) ? e : []).map((e) =>
|
|
168
|
+
function U(e, t) {
|
|
169
|
+
return (Array.isArray(e) ? e : []).map((e) => H(e, t)).filter((e) => e !== void 0);
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var W = [
|
|
172
172
|
"knowledge",
|
|
173
173
|
"skill",
|
|
174
174
|
"delegation",
|
|
175
175
|
"tool"
|
|
176
176
|
];
|
|
177
177
|
function G(e) {
|
|
178
|
-
return
|
|
178
|
+
return W.find((t) => t === e) ?? "tool";
|
|
179
179
|
}
|
|
180
180
|
function K(e) {
|
|
181
181
|
if (!e || typeof e != "object") return;
|
|
@@ -191,11 +191,11 @@ function J(e, t) {
|
|
|
191
191
|
if (typeof e.role != "string" || !q.has(e.role) || typeof e.content != "string" || !e.content) return null;
|
|
192
192
|
let n = typeof e.created_at == "string" ? Date.parse(e.created_at) : NaN;
|
|
193
193
|
return {
|
|
194
|
-
id: typeof e.id == "string" && e.id ? e.id :
|
|
194
|
+
id: typeof e.id == "string" && e.id ? e.id : j(),
|
|
195
195
|
role: e.role,
|
|
196
196
|
content: e.content,
|
|
197
197
|
createdAt: Number.isNaN(n) ? Date.now() : n,
|
|
198
|
-
agent:
|
|
198
|
+
agent: H(e.agent, t),
|
|
199
199
|
attachments: Y(e.attachments),
|
|
200
200
|
authorName: e.kind === "human" && typeof e.author_name == "string" && e.author_name ? e.author_name : void 0
|
|
201
201
|
};
|
|
@@ -216,34 +216,34 @@ function X(e) {
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
async function ne(e) {
|
|
219
|
-
let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(
|
|
219
|
+
let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(z(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
|
|
220
220
|
method: "GET",
|
|
221
|
-
headers:
|
|
221
|
+
headers: B(),
|
|
222
222
|
signal: e.signal
|
|
223
223
|
});
|
|
224
|
-
if (!n.ok) throw await
|
|
224
|
+
if (!n.ok) throw await V(n);
|
|
225
225
|
let r = await n.json();
|
|
226
226
|
return {
|
|
227
227
|
welcomeMessage: typeof r.welcome_message == "string" && r.welcome_message ? r.welcome_message : void 0,
|
|
228
|
-
agent:
|
|
229
|
-
handles:
|
|
228
|
+
agent: H(r.agent, e.apiUrl),
|
|
229
|
+
handles: U(r.handles, e.apiUrl),
|
|
230
230
|
agentHandle: typeof r.agent_handle == "string" && r.agent_handle ? r.agent_handle : void 0,
|
|
231
231
|
branding: r.branding === !0
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
234
|
async function re(e) {
|
|
235
|
-
let t = await fetch(
|
|
235
|
+
let t = await fetch(z(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
236
236
|
method: "POST",
|
|
237
|
-
headers:
|
|
237
|
+
headers: B(),
|
|
238
238
|
body: JSON.stringify({
|
|
239
239
|
...e.user ? { user: e.user } : {},
|
|
240
240
|
...e.agent ? { agent: e.agent } : {}
|
|
241
241
|
}),
|
|
242
242
|
signal: e.signal
|
|
243
243
|
});
|
|
244
|
-
if (!t.ok) throw await
|
|
244
|
+
if (!t.ok) throw await V(t);
|
|
245
245
|
let n = await t.json();
|
|
246
|
-
if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new
|
|
246
|
+
if (typeof n.id != "string" || typeof n.visitor_token != "string") throw new R("The API opened a conversation without an id or a token");
|
|
247
247
|
let r = (Array.isArray(n.messages) ? n.messages : []).map((t) => J(t, e.apiUrl)).filter((e) => e !== null);
|
|
248
248
|
return {
|
|
249
249
|
conversationId: n.id,
|
|
@@ -252,21 +252,21 @@ async function re(e) {
|
|
|
252
252
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
253
253
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
254
254
|
messages: r,
|
|
255
|
-
handles:
|
|
255
|
+
handles: U(n.handles, e.apiUrl),
|
|
256
256
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
257
257
|
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
258
258
|
branding: n.branding === !0
|
|
259
259
|
};
|
|
260
260
|
}
|
|
261
261
|
async function ie(e) {
|
|
262
|
-
let t = await fetch(
|
|
262
|
+
let t = await fetch(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
263
263
|
method: "GET",
|
|
264
|
-
headers:
|
|
264
|
+
headers: B(e.visitorToken),
|
|
265
265
|
signal: e.signal
|
|
266
266
|
});
|
|
267
|
-
if (!t.ok) throw await
|
|
267
|
+
if (!t.ok) throw await V(t);
|
|
268
268
|
let n = await t.json();
|
|
269
|
-
if (typeof n.id != "string") throw new
|
|
269
|
+
if (typeof n.id != "string") throw new R("The API replayed a conversation without an id");
|
|
270
270
|
return {
|
|
271
271
|
conversationId: n.id,
|
|
272
272
|
visitorToken: e.visitorToken,
|
|
@@ -274,7 +274,7 @@ async function ie(e) {
|
|
|
274
274
|
agentSlug: typeof n.agent_slug == "string" ? n.agent_slug : "",
|
|
275
275
|
welcomeMessage: typeof n.welcome_message == "string" && n.welcome_message ? n.welcome_message : void 0,
|
|
276
276
|
messages: (Array.isArray(n.messages) ? n.messages : []).map((t) => J(t, e.apiUrl)).filter((e) => e !== null),
|
|
277
|
-
handles:
|
|
277
|
+
handles: U(n.handles, e.apiUrl),
|
|
278
278
|
agentHandle: typeof n.agent_handle == "string" && n.agent_handle ? n.agent_handle : void 0,
|
|
279
279
|
withHuman: typeof n.handling == "string" && n.handling !== "agents",
|
|
280
280
|
branding: n.branding === !0
|
|
@@ -283,61 +283,61 @@ async function ie(e) {
|
|
|
283
283
|
async function ae(e) {
|
|
284
284
|
let t = new FormData();
|
|
285
285
|
t.append("file", e.file);
|
|
286
|
-
let n = await fetch(
|
|
286
|
+
let n = await fetch(Z(e), {
|
|
287
287
|
method: "POST",
|
|
288
288
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
289
289
|
body: t,
|
|
290
290
|
signal: e.signal
|
|
291
291
|
});
|
|
292
|
-
if (!n.ok) throw await
|
|
292
|
+
if (!n.ok) throw await V(n);
|
|
293
293
|
let r = X(await n.json());
|
|
294
|
-
if (!r) throw new
|
|
294
|
+
if (!r) throw new R("The upload could not be read", n.status);
|
|
295
295
|
return r;
|
|
296
296
|
}
|
|
297
297
|
async function oe(e) {
|
|
298
|
-
let t = await fetch(`${
|
|
298
|
+
let t = await fetch(`${Z(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
299
299
|
method: "DELETE",
|
|
300
300
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
301
301
|
signal: e.signal
|
|
302
302
|
});
|
|
303
|
-
if (!t.ok) throw await
|
|
303
|
+
if (!t.ok) throw await V(t);
|
|
304
304
|
}
|
|
305
|
-
async function
|
|
306
|
-
let t = await fetch(`${
|
|
305
|
+
async function se(e) {
|
|
306
|
+
let t = await fetch(`${Z(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
307
307
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
308
308
|
signal: e.signal
|
|
309
309
|
});
|
|
310
|
-
if (!t.ok) throw await
|
|
310
|
+
if (!t.ok) throw await V(t);
|
|
311
311
|
return t.blob();
|
|
312
312
|
}
|
|
313
|
-
function
|
|
314
|
-
return
|
|
313
|
+
function Z(e) {
|
|
314
|
+
return z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
315
315
|
}
|
|
316
|
-
async function
|
|
317
|
-
return
|
|
316
|
+
async function ce(e) {
|
|
317
|
+
return le(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
318
318
|
content: e.message,
|
|
319
319
|
attachment_ids: e.attachmentIds ?? [],
|
|
320
320
|
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
321
321
|
}, e);
|
|
322
322
|
}
|
|
323
|
-
async function
|
|
324
|
-
return
|
|
323
|
+
async function Q(e) {
|
|
324
|
+
return le(z(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
325
325
|
tool_call_id: e.toolCallId,
|
|
326
326
|
approved: e.approved
|
|
327
327
|
}, e);
|
|
328
328
|
}
|
|
329
|
-
async function
|
|
329
|
+
async function le(e, t, n) {
|
|
330
330
|
let r = await fetch(e, {
|
|
331
331
|
method: "POST",
|
|
332
|
-
headers:
|
|
332
|
+
headers: B(n.visitorToken, n.subjectToken),
|
|
333
333
|
body: JSON.stringify({
|
|
334
334
|
...t,
|
|
335
335
|
widgets: 1
|
|
336
336
|
}),
|
|
337
337
|
signal: n.signal
|
|
338
338
|
});
|
|
339
|
-
if (!r.ok) throw await
|
|
340
|
-
if (!r.body) throw new
|
|
339
|
+
if (!r.ok) throw await V(r);
|
|
340
|
+
if (!r.body) throw new R("Answer with no stream body");
|
|
341
341
|
let i = r.body.getReader(), a = new TextDecoder(), o = "", s = "", c = "", l, u, d = { answer: "" };
|
|
342
342
|
try {
|
|
343
343
|
for (;;) {
|
|
@@ -365,30 +365,31 @@ async function ce(e, t, n) {
|
|
|
365
365
|
} catch {
|
|
366
366
|
continue;
|
|
367
367
|
}
|
|
368
|
-
s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "progress" ? n.onProgress?.(G(i.activity)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent =
|
|
368
|
+
s === "token" && typeof i.text == "string" ? (c += i.text, n.onToken(i.text)) : s === "progress" ? n.onProgress?.(G(i.activity)) : s === "done" ? (d.answer = typeof i.content == "string" ? i.content : c, d.agent = H(i.agent, n.apiUrl), typeof i.unknown_handle == "string" && i.unknown_handle && (d.unknownHandle = i.unknown_handle, d.offered = U(i.handles, n.apiUrl))) : s === "handoff" ? (typeof i.to_agent_name == "string" && (u = i.to_agent_name), c = "") : s === "escalated" ? d.withHuman = !0 : s === "held" ? (d.held = !0, d.withHuman = !0) : s === "approval_required" ? d.approval = K(i) : s === "error" && (l = typeof i.detail == "string" ? i.detail : "The turn failed");
|
|
369
369
|
}
|
|
370
370
|
if (l) break;
|
|
371
371
|
}
|
|
372
372
|
} finally {
|
|
373
373
|
i.cancel().catch(() => void 0);
|
|
374
374
|
}
|
|
375
|
-
if (l) throw new
|
|
375
|
+
if (l) throw new R(l);
|
|
376
376
|
return !d.answer && !d.approval && (d.answer = c), u && !d.agent && (d.authorName = u), d;
|
|
377
377
|
}
|
|
378
378
|
//#endregion
|
|
379
379
|
//#region src/lib/conversation.ts
|
|
380
|
-
var
|
|
380
|
+
var $ = "squadico-chatbot:conversation";
|
|
381
381
|
function ue() {
|
|
382
382
|
try {
|
|
383
383
|
if (typeof sessionStorage > "u") return;
|
|
384
|
-
let e = sessionStorage.getItem(
|
|
384
|
+
let e = sessionStorage.getItem($);
|
|
385
385
|
if (!e) return;
|
|
386
386
|
let t = JSON.parse(e);
|
|
387
387
|
return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
|
|
388
388
|
sessionId: t.sessionId,
|
|
389
389
|
visitorToken: t.visitorToken,
|
|
390
390
|
embedKey: t.embedKey,
|
|
391
|
-
user: typeof t.user == "string" ? t.user : void 0
|
|
391
|
+
user: typeof t.user == "string" ? t.user : void 0,
|
|
392
|
+
scope: typeof t.scope == "string" ? t.scope : void 0
|
|
392
393
|
};
|
|
393
394
|
} catch {
|
|
394
395
|
return;
|
|
@@ -397,17 +398,17 @@ function ue() {
|
|
|
397
398
|
function de(e) {
|
|
398
399
|
try {
|
|
399
400
|
if (typeof sessionStorage > "u") return;
|
|
400
|
-
sessionStorage.setItem(
|
|
401
|
+
sessionStorage.setItem($, JSON.stringify(e));
|
|
401
402
|
} catch {}
|
|
402
403
|
}
|
|
403
404
|
function fe() {
|
|
404
405
|
try {
|
|
405
406
|
if (typeof sessionStorage > "u") return;
|
|
406
|
-
sessionStorage.removeItem(
|
|
407
|
+
sessionStorage.removeItem($);
|
|
407
408
|
} catch {}
|
|
408
409
|
}
|
|
409
|
-
function pe(e, { embedKey: t, user: n }) {
|
|
410
|
-
return e.embedKey === t && e.user === n;
|
|
410
|
+
function pe(e, { embedKey: t, user: n, scope: r }) {
|
|
411
|
+
return e.embedKey === t && e.user === n && e.scope === r;
|
|
411
412
|
}
|
|
412
413
|
//#endregion
|
|
413
414
|
//#region src/lib/useChat.ts
|
|
@@ -419,113 +420,119 @@ async function me(e) {
|
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
422
|
var he = "preview-welcome";
|
|
422
|
-
function ge(e) {
|
|
423
|
-
|
|
423
|
+
function ge(e, t) {
|
|
424
|
+
return e === void 0 && t === void 0 ? void 0 : JSON.stringify([e, t]);
|
|
425
|
+
}
|
|
426
|
+
function _e(e) {
|
|
427
|
+
let t = e instanceof R ? e.status : void 0;
|
|
424
428
|
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
425
429
|
}
|
|
426
|
-
var
|
|
427
|
-
function
|
|
428
|
-
return e instanceof
|
|
430
|
+
var ve = 5e3;
|
|
431
|
+
function ye(e) {
|
|
432
|
+
return e instanceof R && e.code === "conversation_retired";
|
|
429
433
|
}
|
|
430
|
-
function
|
|
431
|
-
let [n, r] = e([]), [a, s] = e(!1), [c, l] = e(""), [u, d] = e(
|
|
432
|
-
|
|
433
|
-
let
|
|
434
|
+
function be(t) {
|
|
435
|
+
let [n, r] = e([]), [a, s] = e(!1), [c, l] = e(""), [u, d] = e(0), [f, p] = e([]), [m, h] = e(""), [g, _] = e(""), [x, S] = e(null), [C, w] = e(!1), [ee, E] = e(!1), [D, O] = e([]), [k, A] = e([]), [M, N] = e(null), P = o(null), F = o(t);
|
|
436
|
+
F.current = t;
|
|
437
|
+
let I = o(null), L = o(null), z = o(null), B = o(null), te = o(void 0), V = t.greeting, H = y(() => V ? {
|
|
434
438
|
id: "greeting",
|
|
435
439
|
role: "assistant",
|
|
436
440
|
content: V,
|
|
437
441
|
createdAt: Date.now()
|
|
438
|
-
} : null, [V]),
|
|
439
|
-
|
|
440
|
-
}, []),
|
|
442
|
+
} : null, [V]), U = i((e) => {
|
|
443
|
+
F.current.onEvent?.(e);
|
|
444
|
+
}, []), W = i((e, t) => {
|
|
441
445
|
r((n) => n.map((n) => n.id === e ? {
|
|
442
446
|
...n,
|
|
443
447
|
...t
|
|
444
448
|
} : n));
|
|
445
|
-
}, []),
|
|
446
|
-
let n = e instanceof
|
|
447
|
-
t &&
|
|
449
|
+
}, []), G = i((e, t) => {
|
|
450
|
+
let n = e instanceof R ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (F.current.locale ?? b(void 0)).t.error;
|
|
451
|
+
t && W(t, {
|
|
448
452
|
content: i,
|
|
449
453
|
streaming: !1,
|
|
450
454
|
error: !0,
|
|
451
455
|
activity: void 0
|
|
452
|
-
}),
|
|
456
|
+
}), U({
|
|
453
457
|
type: "chatbot-error",
|
|
454
458
|
message: r,
|
|
455
459
|
status: n,
|
|
456
|
-
sessionId:
|
|
460
|
+
sessionId: L.current?.sessionId ?? ""
|
|
457
461
|
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
458
|
-
}, [
|
|
459
|
-
let e =
|
|
460
|
-
if (!e.embedKey) throw new
|
|
462
|
+
}, [U, W]), K = i(() => {
|
|
463
|
+
let e = F.current;
|
|
464
|
+
if (!e.embedKey) throw new R("No embed key: nothing says which application to open");
|
|
461
465
|
return {
|
|
462
466
|
opts: e,
|
|
463
467
|
apiUrl: e.apiUrl ?? "https://api.squadico.com",
|
|
464
468
|
embedKey: e.embedKey,
|
|
465
|
-
claim: e.user
|
|
469
|
+
claim: e.user,
|
|
470
|
+
scope: e.scope
|
|
466
471
|
};
|
|
467
|
-
}, []),
|
|
472
|
+
}, []), q = i((e, t) => {
|
|
468
473
|
let n = {
|
|
469
474
|
sessionId: t.conversationId,
|
|
470
475
|
visitorToken: t.visitorToken
|
|
471
476
|
};
|
|
472
|
-
return
|
|
477
|
+
return L.current = n, te.current = ge(e.claim?.id, e.scope), de({
|
|
473
478
|
...n,
|
|
474
479
|
embedKey: e.embedKey,
|
|
475
|
-
user: e.claim?.id
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
480
|
+
user: e.claim?.id,
|
|
481
|
+
scope: e.scope
|
|
482
|
+
}), l(t.conversationId), p(t.handles), h(e.opts.agent && t.agentHandle ? t.agentHandle : ""), _(t.agentHandle ?? ""), w(!!t.withHuman), E(t.branding), r((e) => [...t.messages, ...e.filter((e) => e.id !== he)]), n;
|
|
483
|
+
}, []), J = i((e) => {
|
|
484
|
+
if (z.current) return z.current;
|
|
479
485
|
let t = ue();
|
|
480
486
|
if (!t || !pe(t, {
|
|
481
487
|
embedKey: e.embedKey,
|
|
482
|
-
user: e.claim?.id
|
|
488
|
+
user: e.claim?.id,
|
|
489
|
+
scope: e.scope
|
|
483
490
|
})) return Promise.resolve(null);
|
|
484
491
|
let n = ie({
|
|
485
492
|
apiUrl: e.apiUrl,
|
|
486
493
|
conversationId: t.sessionId,
|
|
487
494
|
visitorToken: t.visitorToken
|
|
488
|
-
}).then((t) =>
|
|
489
|
-
|
|
495
|
+
}).then((t) => q(e, t)).catch(() => (fe(), null)).finally(() => {
|
|
496
|
+
z.current = null;
|
|
490
497
|
});
|
|
491
|
-
return
|
|
492
|
-
}, [
|
|
498
|
+
return z.current = n, n;
|
|
499
|
+
}, [q]), Y = i(async () => {
|
|
500
|
+
if (L.current) return L.current;
|
|
493
501
|
if (I.current) return I.current;
|
|
494
|
-
|
|
495
|
-
let e = te(), t = K(e).then((t) => t ?? re({
|
|
502
|
+
let e = K(), t = J(e).then((t) => t ?? re({
|
|
496
503
|
apiUrl: e.apiUrl,
|
|
497
504
|
embedKey: e.embedKey,
|
|
498
505
|
user: e.claim,
|
|
499
506
|
agent: e.opts.agent
|
|
500
|
-
}).then((t) =>
|
|
501
|
-
|
|
507
|
+
}).then((t) => q(e, t)));
|
|
508
|
+
I.current = t;
|
|
502
509
|
try {
|
|
503
510
|
return await t;
|
|
504
511
|
} finally {
|
|
505
|
-
|
|
512
|
+
I.current = null;
|
|
506
513
|
}
|
|
507
514
|
}, [
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
]),
|
|
512
|
-
if (
|
|
515
|
+
q,
|
|
516
|
+
J,
|
|
517
|
+
K
|
|
518
|
+
]), X = i(() => {
|
|
519
|
+
if (L.current || I.current || B.current) return;
|
|
513
520
|
let e;
|
|
514
521
|
try {
|
|
515
|
-
e =
|
|
522
|
+
e = K();
|
|
516
523
|
} catch (e) {
|
|
517
|
-
|
|
524
|
+
G(e);
|
|
518
525
|
return;
|
|
519
526
|
}
|
|
520
|
-
let t =
|
|
521
|
-
if (t ||
|
|
527
|
+
let t = J(e).then(async (t) => {
|
|
528
|
+
if (t || L.current || I.current) return;
|
|
522
529
|
let n = await ne({
|
|
523
530
|
apiUrl: e.apiUrl,
|
|
524
531
|
embedKey: e.embedKey,
|
|
525
532
|
agent: e.opts.agent
|
|
526
533
|
});
|
|
527
|
-
if (
|
|
528
|
-
|
|
534
|
+
if (L.current || I.current) return;
|
|
535
|
+
p(n.handles), h(e.opts.agent && n.agentHandle ? n.agentHandle : ""), _(n.agentHandle ?? ""), E(n.branding);
|
|
529
536
|
let i = n.welcomeMessage;
|
|
530
537
|
i && r((e) => e.length > 0 ? e : [{
|
|
531
538
|
id: he,
|
|
@@ -535,22 +542,22 @@ function ye(t) {
|
|
|
535
542
|
agent: n.agent
|
|
536
543
|
}]);
|
|
537
544
|
});
|
|
538
|
-
|
|
539
|
-
|
|
545
|
+
B.current = t, t.catch((e) => {
|
|
546
|
+
B.current = null, G(e);
|
|
540
547
|
});
|
|
541
548
|
}, [
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
]),
|
|
546
|
-
if (
|
|
549
|
+
G,
|
|
550
|
+
J,
|
|
551
|
+
K
|
|
552
|
+
]), Z = i((e, t, { retry: n = !1, carried: i = [] } = {}) => {
|
|
553
|
+
if (P.current) return;
|
|
547
554
|
let a = new AbortController();
|
|
548
|
-
|
|
549
|
-
let o =
|
|
555
|
+
P.current = a, s(!0), S(null);
|
|
556
|
+
let o = j();
|
|
550
557
|
r((t) => [
|
|
551
558
|
...t,
|
|
552
559
|
{
|
|
553
|
-
id:
|
|
560
|
+
id: j(),
|
|
554
561
|
role: "user",
|
|
555
562
|
content: e,
|
|
556
563
|
createdAt: Date.now(),
|
|
@@ -564,35 +571,35 @@ function ye(t) {
|
|
|
564
571
|
streaming: !0
|
|
565
572
|
}
|
|
566
573
|
]), (async () => {
|
|
567
|
-
let i = await
|
|
568
|
-
|
|
574
|
+
let i = await Y();
|
|
575
|
+
U({
|
|
569
576
|
type: "chatbot-message",
|
|
570
577
|
role: "user",
|
|
571
578
|
content: e,
|
|
572
579
|
sessionId: i.sessionId
|
|
573
580
|
});
|
|
574
581
|
let s = "", c = (e) => {
|
|
575
|
-
s += e,
|
|
582
|
+
s += e, W(o, {
|
|
576
583
|
content: s,
|
|
577
584
|
activity: void 0
|
|
578
585
|
});
|
|
579
586
|
}, l = (e) => {
|
|
580
|
-
s ||
|
|
587
|
+
s || W(o, { activity: e });
|
|
581
588
|
}, u;
|
|
582
589
|
try {
|
|
583
590
|
u = await t(i, c, a.signal, l);
|
|
584
591
|
} catch (e) {
|
|
585
|
-
if (!
|
|
586
|
-
i = await
|
|
592
|
+
if (!ye(e) || (fe(), L.current = null, I.current = null, !n)) throw e;
|
|
593
|
+
i = await Y(), s = "", W(o, {
|
|
587
594
|
content: "",
|
|
588
595
|
activity: void 0
|
|
589
596
|
}), u = await t(i, c, a.signal, l);
|
|
590
597
|
}
|
|
591
|
-
if (u.withHuman &&
|
|
598
|
+
if (u.withHuman && w(!0), u.held) {
|
|
592
599
|
r((e) => e.filter((e) => e.id !== o));
|
|
593
600
|
return;
|
|
594
601
|
}
|
|
595
|
-
|
|
602
|
+
W(o, {
|
|
596
603
|
content: u.answer,
|
|
597
604
|
streaming: !1,
|
|
598
605
|
activity: void 0,
|
|
@@ -601,7 +608,7 @@ function ye(t) {
|
|
|
601
608
|
approval: u.approval,
|
|
602
609
|
unknownHandle: u.unknownHandle,
|
|
603
610
|
offered: u.offered
|
|
604
|
-
}),
|
|
611
|
+
}), S(u.approval ?? null), U({
|
|
605
612
|
type: "chatbot-message",
|
|
606
613
|
role: "assistant",
|
|
607
614
|
content: u.answer,
|
|
@@ -610,33 +617,33 @@ function ye(t) {
|
|
|
610
617
|
});
|
|
611
618
|
})().catch((e) => {
|
|
612
619
|
if (a.signal.aborted) {
|
|
613
|
-
|
|
620
|
+
W(o, {
|
|
614
621
|
streaming: !1,
|
|
615
622
|
activity: void 0
|
|
616
623
|
});
|
|
617
624
|
return;
|
|
618
625
|
}
|
|
619
|
-
|
|
626
|
+
G(e, o);
|
|
620
627
|
}).finally(() => {
|
|
621
|
-
|
|
628
|
+
P.current = null, s(!1);
|
|
622
629
|
});
|
|
623
630
|
}, [
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
]),
|
|
631
|
+
Y,
|
|
632
|
+
U,
|
|
633
|
+
G,
|
|
634
|
+
W
|
|
635
|
+
]), le = i((e) => {
|
|
629
636
|
let t = e.trim();
|
|
630
|
-
if (!t &&
|
|
631
|
-
let n =
|
|
632
|
-
|
|
633
|
-
subjectToken: await me(
|
|
634
|
-
apiUrl:
|
|
637
|
+
if (!t && D.length === 0) return;
|
|
638
|
+
let n = D;
|
|
639
|
+
O([]), N(null), Z(t, async (e, r, i, a) => ce({
|
|
640
|
+
subjectToken: await me(F.current.getSubjectToken),
|
|
641
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
635
642
|
conversationId: e.sessionId,
|
|
636
643
|
visitorToken: e.visitorToken,
|
|
637
644
|
message: t,
|
|
638
645
|
attachmentIds: n.map((e) => e.id),
|
|
639
|
-
context:
|
|
646
|
+
context: F.current.context ? T(F.current.context) : void 0,
|
|
640
647
|
onToken: r,
|
|
641
648
|
onProgress: a,
|
|
642
649
|
signal: i
|
|
@@ -644,39 +651,39 @@ function ye(t) {
|
|
|
644
651
|
retry: !0,
|
|
645
652
|
carried: n
|
|
646
653
|
});
|
|
647
|
-
}, [
|
|
648
|
-
|
|
649
|
-
apiUrl:
|
|
654
|
+
}, [D, Z]), $ = i((e) => {
|
|
655
|
+
N(null), A((t) => [...t, e.name]), Y().then((t) => ae({
|
|
656
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
650
657
|
conversationId: t.sessionId,
|
|
651
658
|
visitorToken: t.visitorToken,
|
|
652
659
|
file: e
|
|
653
|
-
})).then((e) =>
|
|
660
|
+
})).then((e) => O((t) => [...t, e])).catch((e) => N(_e(e))).finally(() => A((t) => {
|
|
654
661
|
let n = t.indexOf(e.name);
|
|
655
662
|
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
656
663
|
}));
|
|
657
|
-
}, [
|
|
658
|
-
|
|
659
|
-
let t =
|
|
664
|
+
}, [Y]), be = i((e) => {
|
|
665
|
+
O((t) => t.filter((t) => t.id !== e));
|
|
666
|
+
let t = L.current;
|
|
660
667
|
t && oe({
|
|
661
|
-
apiUrl:
|
|
668
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
662
669
|
conversationId: t.sessionId,
|
|
663
670
|
visitorToken: t.visitorToken,
|
|
664
671
|
attachmentId: e
|
|
665
672
|
}).catch(() => {});
|
|
666
|
-
}, []),
|
|
667
|
-
let t =
|
|
668
|
-
if (!t) throw new
|
|
669
|
-
return
|
|
670
|
-
apiUrl:
|
|
673
|
+
}, []), xe = i(async (e) => {
|
|
674
|
+
let t = L.current;
|
|
675
|
+
if (!t) throw new R("No conversation to read that file from");
|
|
676
|
+
return se({
|
|
677
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
671
678
|
conversationId: t.sessionId,
|
|
672
679
|
visitorToken: t.visitorToken,
|
|
673
680
|
attachmentId: e
|
|
674
681
|
});
|
|
675
|
-
}, []),
|
|
676
|
-
let n =
|
|
677
|
-
n &&
|
|
678
|
-
subjectToken: await me(
|
|
679
|
-
apiUrl:
|
|
682
|
+
}, []), Se = i((e, t) => {
|
|
683
|
+
let n = x;
|
|
684
|
+
n && Z(t, async (t, r, i, a) => Q({
|
|
685
|
+
subjectToken: await me(F.current.getSubjectToken),
|
|
686
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
680
687
|
conversationId: t.sessionId,
|
|
681
688
|
visitorToken: t.visitorToken,
|
|
682
689
|
toolCallId: n.toolCallId,
|
|
@@ -685,61 +692,78 @@ function ye(t) {
|
|
|
685
692
|
onProgress: a,
|
|
686
693
|
signal: i
|
|
687
694
|
}));
|
|
688
|
-
}, [
|
|
689
|
-
|
|
690
|
-
}, []),
|
|
691
|
-
|
|
695
|
+
}, [x, Z]), Ce = i(() => {
|
|
696
|
+
P.current?.abort(), P.current = null, s(!1);
|
|
697
|
+
}, []), we = i(() => {
|
|
698
|
+
P.current?.abort(), P.current = null, L.current = null, I.current = null, z.current = null, B.current = null, te.current = void 0, fe(), s(!1), S(null), w(!1), l(""), d((e) => e + 1), h(""), _(""), r([]), U({
|
|
692
699
|
type: "chatbot-reset",
|
|
693
700
|
sessionId: ""
|
|
694
701
|
});
|
|
695
|
-
}, [
|
|
702
|
+
}, [U]), Te = t.humanPollMs ?? ve;
|
|
696
703
|
v(() => {
|
|
697
|
-
if (!
|
|
704
|
+
if (!C || !c) return;
|
|
698
705
|
let e = setInterval(() => {
|
|
699
|
-
let e =
|
|
700
|
-
!e ||
|
|
701
|
-
apiUrl:
|
|
706
|
+
let e = L.current;
|
|
707
|
+
!e || P.current || ie({
|
|
708
|
+
apiUrl: F.current.apiUrl ?? "https://api.squadico.com",
|
|
702
709
|
conversationId: e.sessionId,
|
|
703
710
|
visitorToken: e.visitorToken
|
|
704
711
|
}).then((e) => {
|
|
705
|
-
r(e.messages),
|
|
712
|
+
r(e.messages), w(!!e.withHuman);
|
|
706
713
|
}).catch(() => {});
|
|
707
|
-
},
|
|
714
|
+
}, Te);
|
|
708
715
|
return () => clearInterval(e);
|
|
709
716
|
}, [
|
|
710
|
-
|
|
717
|
+
C,
|
|
711
718
|
c,
|
|
712
|
-
|
|
719
|
+
Te
|
|
713
720
|
]);
|
|
714
|
-
let
|
|
721
|
+
let Ee = ge(t.user?.id, t.scope);
|
|
715
722
|
return v(() => {
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
723
|
+
if (L.current) {
|
|
724
|
+
te.current !== Ee && we();
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
if (!B.current || I.current) return;
|
|
728
|
+
let e;
|
|
729
|
+
try {
|
|
730
|
+
e = K();
|
|
731
|
+
} catch {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
J(e);
|
|
735
|
+
}, [
|
|
736
|
+
Ee,
|
|
737
|
+
we,
|
|
738
|
+
J,
|
|
739
|
+
K
|
|
740
|
+
]), {
|
|
741
|
+
messages: y(() => n.length === 0 && H ? [H] : n, [H, n]),
|
|
719
742
|
busy: a,
|
|
720
743
|
sessionId: c,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
744
|
+
resets: u,
|
|
745
|
+
handles: f,
|
|
746
|
+
addressee: m,
|
|
747
|
+
agentHandle: g,
|
|
748
|
+
approval: x,
|
|
749
|
+
withHuman: C,
|
|
750
|
+
branding: ee,
|
|
751
|
+
start: X,
|
|
752
|
+
send: le,
|
|
753
|
+
attachments: D,
|
|
754
|
+
uploading: k,
|
|
755
|
+
attachmentError: M,
|
|
756
|
+
attach: $,
|
|
757
|
+
detach: be,
|
|
758
|
+
loadAttachment: xe,
|
|
759
|
+
decide: Se,
|
|
760
|
+
stop: Ce,
|
|
761
|
+
reset: we
|
|
738
762
|
};
|
|
739
763
|
}
|
|
740
764
|
//#endregion
|
|
741
765
|
//#region src/components/Avatar.tsx
|
|
742
|
-
function
|
|
766
|
+
function xe({ name: t, color: n, url: r, size: i = 16 }) {
|
|
743
767
|
let [a, o] = e(void 0), s = !!r && a !== r;
|
|
744
768
|
return /* @__PURE__ */ l("span", {
|
|
745
769
|
class: "sqc-avatar",
|
|
@@ -755,16 +779,16 @@ function be({ name: t, color: n, url: r, size: i = 16 }) {
|
|
|
755
779
|
src: r,
|
|
756
780
|
alt: "",
|
|
757
781
|
onError: () => o(r)
|
|
758
|
-
}) :
|
|
782
|
+
}) : Se(t)
|
|
759
783
|
});
|
|
760
784
|
}
|
|
761
|
-
function
|
|
785
|
+
function Se(e) {
|
|
762
786
|
let t = Array.from(e.trim())[0];
|
|
763
787
|
return t ? t.toLocaleUpperCase() : "?";
|
|
764
788
|
}
|
|
765
789
|
//#endregion
|
|
766
790
|
//#region src/components/AgentRail.tsx
|
|
767
|
-
function
|
|
791
|
+
function Ce({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
768
792
|
return /* @__PURE__ */ l("nav", {
|
|
769
793
|
class: "sqc-rail",
|
|
770
794
|
"aria-label": i,
|
|
@@ -776,7 +800,7 @@ function Se({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
776
800
|
"data-tip": e.name,
|
|
777
801
|
disabled: n,
|
|
778
802
|
onClick: () => r(e.handle),
|
|
779
|
-
children: [/* @__PURE__ */ l(
|
|
803
|
+
children: [/* @__PURE__ */ l(xe, {
|
|
780
804
|
name: e.name,
|
|
781
805
|
color: e.color,
|
|
782
806
|
url: e.avatarUrl,
|
|
@@ -784,79 +808,79 @@ function Se({ handles: e, active: t, disabled: n, onPick: r, label: i }) {
|
|
|
784
808
|
}), /* @__PURE__ */ l("span", {
|
|
785
809
|
class: "sqc-rail__label",
|
|
786
810
|
"aria-hidden": "true",
|
|
787
|
-
children:
|
|
811
|
+
children: we(e.handle)
|
|
788
812
|
})]
|
|
789
813
|
}, e.handle))
|
|
790
814
|
});
|
|
791
815
|
}
|
|
792
|
-
function
|
|
816
|
+
function we(e) {
|
|
793
817
|
let t = e.split(/[-_]/)[0] ?? e;
|
|
794
818
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
795
819
|
}
|
|
796
820
|
//#endregion
|
|
797
821
|
//#region src/components/Composer.tsx
|
|
798
|
-
var
|
|
799
|
-
function
|
|
822
|
+
var Te = 132, Ee = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", De = /^[a-zA-Z0-9_-]*$/;
|
|
823
|
+
function Oe(e, t) {
|
|
800
824
|
let n = e.slice(0, t), r = n.lastIndexOf("@");
|
|
801
825
|
if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
|
|
802
826
|
let i = n.slice(r + 1);
|
|
803
|
-
return
|
|
827
|
+
return De.test(i) ? {
|
|
804
828
|
start: r,
|
|
805
829
|
query: i
|
|
806
830
|
} : null;
|
|
807
831
|
}
|
|
808
|
-
function
|
|
809
|
-
let [b, x] = e(""), [S, C] = e(null), [w, T] = e(0), [
|
|
832
|
+
function ke({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addressee: u, attachments: d = [], uploading: f = [], attachmentError: p, onAttach: m, onDetach: h, onSend: g, onStop: _ }) {
|
|
833
|
+
let [b, x] = e(""), [S, C] = e(null), [w, T] = e(0), [ee, E] = e(!1), D = o(null), O = o(null), k = !!m, A = f.length > 0, j = y(() => {
|
|
810
834
|
if (!S || !c || c.length === 0) return [];
|
|
811
835
|
let e = S.query.toLowerCase();
|
|
812
836
|
return c.filter((t) => t.handle.startsWith(e));
|
|
813
|
-
}, [c, S]),
|
|
814
|
-
let e =
|
|
837
|
+
}, [c, S]), M = j.length > 0, N = i(() => {
|
|
838
|
+
let e = D.current;
|
|
815
839
|
if (!e) return;
|
|
816
840
|
e.style.height = "auto";
|
|
817
|
-
let t = e.scrollHeight >
|
|
818
|
-
e.style.height = `${Math.min(e.scrollHeight,
|
|
841
|
+
let t = e.scrollHeight > Te;
|
|
842
|
+
e.style.height = `${Math.min(e.scrollHeight, Te)}px`, e.style.overflowY = t ? "auto" : "hidden";
|
|
819
843
|
}, []);
|
|
820
844
|
v(() => {
|
|
821
|
-
s &&
|
|
822
|
-
}, [s,
|
|
823
|
-
u && (x((e) => e || `@${u} `), requestAnimationFrame(
|
|
824
|
-
}, [u,
|
|
825
|
-
let
|
|
826
|
-
C(
|
|
827
|
-
}, []),
|
|
828
|
-
let t =
|
|
845
|
+
s && D.current?.focus(), N();
|
|
846
|
+
}, [s, N]), v(() => {
|
|
847
|
+
u && (x((e) => e || `@${u} `), requestAnimationFrame(N));
|
|
848
|
+
}, [u, N]);
|
|
849
|
+
let P = i((e) => {
|
|
850
|
+
C(Oe(e.value, e.selectionStart ?? e.value.length)), T(0);
|
|
851
|
+
}, []), F = i((e) => {
|
|
852
|
+
let t = D.current;
|
|
829
853
|
if (!t || !S) return;
|
|
830
854
|
let n = t.selectionStart ?? t.value.length, r = `${b.slice(0, S.start)}@${e} ${b.slice(n)}`, i = S.start + e.length + 2;
|
|
831
855
|
x(r), C(null), requestAnimationFrame(() => {
|
|
832
|
-
t.focus(), t.setSelectionRange(i, i),
|
|
856
|
+
t.focus(), t.setSelectionRange(i, i), N();
|
|
833
857
|
});
|
|
834
858
|
}, [
|
|
835
|
-
|
|
859
|
+
N,
|
|
836
860
|
S,
|
|
837
861
|
b
|
|
838
|
-
]),
|
|
862
|
+
]), I = i((e) => {
|
|
839
863
|
if (!(!m || !e)) for (let t of Array.from(e)) m(t);
|
|
840
|
-
}, [m]),
|
|
864
|
+
}, [m]), R = i(() => {
|
|
841
865
|
let e = b.trim();
|
|
842
|
-
!e && d.length === 0 || a ||
|
|
866
|
+
!e && d.length === 0 || a || A || (g(e), x(""), C(null), requestAnimationFrame(N));
|
|
843
867
|
}, [
|
|
844
868
|
d.length,
|
|
845
869
|
a,
|
|
846
|
-
|
|
870
|
+
N,
|
|
847
871
|
g,
|
|
848
872
|
b,
|
|
849
|
-
|
|
850
|
-
]),
|
|
851
|
-
if (
|
|
873
|
+
A
|
|
874
|
+
]), z = i((e) => {
|
|
875
|
+
if (M && !e.isComposing) {
|
|
852
876
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
853
877
|
e.preventDefault();
|
|
854
|
-
let t = e.key === "ArrowDown" ? 1 :
|
|
855
|
-
T((e) => (e + t) %
|
|
878
|
+
let t = e.key === "ArrowDown" ? 1 : j.length - 1;
|
|
879
|
+
T((e) => (e + t) % j.length);
|
|
856
880
|
return;
|
|
857
881
|
}
|
|
858
882
|
if (e.key === "Enter" || e.key === "Tab") {
|
|
859
|
-
e.preventDefault(),
|
|
883
|
+
e.preventDefault(), F((j[w] ?? j[0]).handle);
|
|
860
884
|
return;
|
|
861
885
|
}
|
|
862
886
|
if (e.key === "Escape") {
|
|
@@ -864,28 +888,28 @@ function Oe({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
864
888
|
return;
|
|
865
889
|
}
|
|
866
890
|
}
|
|
867
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(),
|
|
891
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), R());
|
|
868
892
|
}, [
|
|
869
893
|
w,
|
|
894
|
+
j,
|
|
895
|
+
F,
|
|
870
896
|
M,
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
z
|
|
874
|
-
]), V = R - b.length;
|
|
897
|
+
R
|
|
898
|
+
]), B = L - b.length;
|
|
875
899
|
return /* @__PURE__ */ l("form", {
|
|
876
|
-
class: `sqc-composer${
|
|
900
|
+
class: `sqc-composer${ee ? " sqc-composer--dropping" : ""}`,
|
|
877
901
|
onSubmit: (e) => {
|
|
878
|
-
e.preventDefault(),
|
|
902
|
+
e.preventDefault(), R();
|
|
879
903
|
},
|
|
880
904
|
onDragOver: (e) => {
|
|
881
|
-
|
|
905
|
+
k && (e.preventDefault(), E(!0));
|
|
882
906
|
},
|
|
883
|
-
onDragLeave: () =>
|
|
907
|
+
onDragLeave: () => E(!1),
|
|
884
908
|
onDrop: (e) => {
|
|
885
|
-
|
|
909
|
+
k && (e.preventDefault(), E(!1), I(e.dataTransfer?.files ?? null));
|
|
886
910
|
},
|
|
887
911
|
children: [
|
|
888
|
-
(d.length > 0 ||
|
|
912
|
+
(d.length > 0 || A || p) && /* @__PURE__ */ l("div", {
|
|
889
913
|
class: "sqc-attachments",
|
|
890
914
|
children: [
|
|
891
915
|
d.map((e) => /* @__PURE__ */ l("span", {
|
|
@@ -919,21 +943,21 @@ function Oe({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
919
943
|
/* @__PURE__ */ l("div", {
|
|
920
944
|
class: "sqc-composer__field",
|
|
921
945
|
children: [
|
|
922
|
-
|
|
946
|
+
M && /* @__PURE__ */ l("ul", {
|
|
923
947
|
class: "sqc-mentions",
|
|
924
948
|
role: "listbox",
|
|
925
949
|
"aria-label": r.t.handles.picker,
|
|
926
|
-
children:
|
|
950
|
+
children: j.map((e, t) => /* @__PURE__ */ l("li", {
|
|
927
951
|
role: "option",
|
|
928
952
|
"aria-selected": t === w,
|
|
929
953
|
class: `sqc-mention${t === w ? " sqc-mention--active" : ""}`,
|
|
930
954
|
onMouseDown: (e) => e.preventDefault(),
|
|
931
955
|
onMouseEnter: () => T(t),
|
|
932
|
-
onClick: () =>
|
|
956
|
+
onClick: () => F(e.handle),
|
|
933
957
|
children: [
|
|
934
958
|
/* @__PURE__ */ l("span", {
|
|
935
959
|
class: "sqc-mention__icon",
|
|
936
|
-
children: /* @__PURE__ */ l(
|
|
960
|
+
children: /* @__PURE__ */ l(xe, {
|
|
937
961
|
name: e.name,
|
|
938
962
|
color: e.color,
|
|
939
963
|
url: e.avatarUrl,
|
|
@@ -952,43 +976,43 @@ function Oe({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
952
976
|
}, e.handle))
|
|
953
977
|
}),
|
|
954
978
|
/* @__PURE__ */ l("textarea", {
|
|
955
|
-
ref:
|
|
979
|
+
ref: D,
|
|
956
980
|
class: "sqc-composer__input",
|
|
957
981
|
rows: 1,
|
|
958
982
|
value: b,
|
|
959
983
|
placeholder: n,
|
|
960
|
-
maxLength:
|
|
984
|
+
maxLength: L,
|
|
961
985
|
"aria-label": r.t.composer.label,
|
|
962
986
|
onInput: (e) => {
|
|
963
|
-
x(e.currentTarget.value),
|
|
987
|
+
x(e.currentTarget.value), P(e.currentTarget), N();
|
|
964
988
|
},
|
|
965
|
-
onKeyDown:
|
|
966
|
-
onClick: (e) =>
|
|
989
|
+
onKeyDown: z,
|
|
990
|
+
onClick: (e) => P(e.currentTarget),
|
|
967
991
|
onPaste: (e) => {
|
|
968
992
|
let t = e.clipboardData?.files;
|
|
969
|
-
!
|
|
993
|
+
!k || !t || t.length === 0 || (e.preventDefault(), I(t));
|
|
970
994
|
}
|
|
971
995
|
}),
|
|
972
|
-
|
|
996
|
+
B <= 200 && /* @__PURE__ */ l("span", {
|
|
973
997
|
class: "sqc-composer__count",
|
|
974
998
|
"aria-live": "polite",
|
|
975
|
-
children:
|
|
999
|
+
children: B
|
|
976
1000
|
})
|
|
977
1001
|
]
|
|
978
1002
|
}),
|
|
979
|
-
|
|
980
|
-
ref:
|
|
1003
|
+
k && /* @__PURE__ */ l(t, { children: [/* @__PURE__ */ l("input", {
|
|
1004
|
+
ref: O,
|
|
981
1005
|
type: "file",
|
|
982
1006
|
multiple: !0,
|
|
983
|
-
accept:
|
|
1007
|
+
accept: Ee,
|
|
984
1008
|
class: "sqc-file-input",
|
|
985
1009
|
onChange: (e) => {
|
|
986
|
-
|
|
1010
|
+
I(e.currentTarget.files), e.currentTarget.value = "";
|
|
987
1011
|
}
|
|
988
1012
|
}), /* @__PURE__ */ l("button", {
|
|
989
1013
|
type: "button",
|
|
990
1014
|
class: "sqc-btn sqc-btn--attach",
|
|
991
|
-
onClick: () =>
|
|
1015
|
+
onClick: () => O.current?.click(),
|
|
992
1016
|
"aria-label": r.t.composer.attach,
|
|
993
1017
|
title: r.t.composer.attachTitle,
|
|
994
1018
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1023,7 +1047,7 @@ function Oe({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1023
1047
|
}) : /* @__PURE__ */ l("button", {
|
|
1024
1048
|
type: "submit",
|
|
1025
1049
|
class: "sqc-btn sqc-btn--send",
|
|
1026
|
-
disabled: !b.trim() && d.length === 0 ||
|
|
1050
|
+
disabled: !b.trim() && d.length === 0 || A,
|
|
1027
1051
|
"aria-label": r.t.composer.send,
|
|
1028
1052
|
title: r.t.composer.sendTitle,
|
|
1029
1053
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1042,14 +1066,14 @@ function Oe({ placeholder: n, locale: r, busy: a, autoFocus: s, handles: c, addr
|
|
|
1042
1066
|
}
|
|
1043
1067
|
//#endregion
|
|
1044
1068
|
//#region src/components/RichText.tsx
|
|
1045
|
-
var
|
|
1046
|
-
function
|
|
1069
|
+
var Ae = /^(\s*)[-*•]\s+/, je = /^(\s*)\d+[.)]\s+/, Me = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, Ne = /^\s*([-*_])(?:\s*\1){2,}\s*$/, Pe = /^\s*>\s?(.*)$/, Fe = /^\s*```/;
|
|
1070
|
+
function Ie(e, t, n, r) {
|
|
1047
1071
|
let i = e[t].ordered, a = [], o = t;
|
|
1048
1072
|
for (; o < e.length && e[o].depth >= n;) {
|
|
1049
1073
|
let t = e[o];
|
|
1050
1074
|
if (t.depth === n && t.ordered !== i) break;
|
|
1051
1075
|
if (t.depth > n) {
|
|
1052
|
-
let [n, i] =
|
|
1076
|
+
let [n, i] = Ie(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1053
1077
|
s ? s.nested.push(n) : a.push({
|
|
1054
1078
|
key: `${r}-${o}`,
|
|
1055
1079
|
text: null,
|
|
@@ -1066,7 +1090,7 @@ function Fe(e, t, n, r) {
|
|
|
1066
1090
|
let s = a.map((e) => /* @__PURE__ */ l("li", { children: [e.text === null ? null : g(e.text, e.key), e.nested] }, e.key));
|
|
1067
1091
|
return [l(i ? "ol" : "ul", { children: s }, r), o];
|
|
1068
1092
|
}
|
|
1069
|
-
function
|
|
1093
|
+
function Le(e) {
|
|
1070
1094
|
let t = e.split("\n"), n = [], r = [], i = [], a = [], o = () => {
|
|
1071
1095
|
if (!r.length) return;
|
|
1072
1096
|
let e = `p${n.length}`;
|
|
@@ -1075,7 +1099,7 @@ function Ie(e) {
|
|
|
1075
1099
|
if (!i.length) return;
|
|
1076
1100
|
let e = 0;
|
|
1077
1101
|
for (; e < i.length;) {
|
|
1078
|
-
let t = `l${n.length}`, [r, a] =
|
|
1102
|
+
let t = `l${n.length}`, [r, a] = Ie(i, e, i[e].depth, t);
|
|
1079
1103
|
n.push(r), e = a;
|
|
1080
1104
|
}
|
|
1081
1105
|
i = [];
|
|
@@ -1088,10 +1112,10 @@ function Ie(e) {
|
|
|
1088
1112
|
};
|
|
1089
1113
|
for (let e = 0; e < t.length; e += 1) {
|
|
1090
1114
|
let d = t[e];
|
|
1091
|
-
if (
|
|
1115
|
+
if (Fe.test(d)) {
|
|
1092
1116
|
u();
|
|
1093
1117
|
let r = [];
|
|
1094
|
-
for (e += 1; e < t.length && !
|
|
1118
|
+
for (e += 1; e < t.length && !Fe.test(t[e]);) r.push(t[e]), e += 1;
|
|
1095
1119
|
let i = `c${n.length}`;
|
|
1096
1120
|
n.push(/* @__PURE__ */ l("pre", { children: /* @__PURE__ */ l("code", { children: r.join("\n") }) }, i));
|
|
1097
1121
|
continue;
|
|
@@ -1100,23 +1124,23 @@ function Ie(e) {
|
|
|
1100
1124
|
u();
|
|
1101
1125
|
continue;
|
|
1102
1126
|
}
|
|
1103
|
-
let f =
|
|
1127
|
+
let f = Me.exec(d);
|
|
1104
1128
|
if (f) {
|
|
1105
1129
|
u();
|
|
1106
1130
|
let e = f[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", r = `h${n.length}`;
|
|
1107
1131
|
n.push(/* @__PURE__ */ l(t, { children: g(f[2], r) }, r));
|
|
1108
1132
|
continue;
|
|
1109
1133
|
}
|
|
1110
|
-
if (
|
|
1134
|
+
if (Ne.test(d)) {
|
|
1111
1135
|
u(), n.push(/* @__PURE__ */ l("hr", {}, `r${n.length}`));
|
|
1112
1136
|
continue;
|
|
1113
1137
|
}
|
|
1114
|
-
let p =
|
|
1138
|
+
let p = Pe.exec(d);
|
|
1115
1139
|
if (p) {
|
|
1116
1140
|
o(), s(), a.push(p[1]);
|
|
1117
1141
|
continue;
|
|
1118
1142
|
}
|
|
1119
|
-
let m =
|
|
1143
|
+
let m = Ae.exec(d), h = m ? null : je.exec(d), _ = m ?? h;
|
|
1120
1144
|
if (_) {
|
|
1121
1145
|
o(), c(), i.push({
|
|
1122
1146
|
depth: _[1].replace(/\t/g, " ").length,
|
|
@@ -1129,7 +1153,7 @@ function Ie(e) {
|
|
|
1129
1153
|
}
|
|
1130
1154
|
return u(), n;
|
|
1131
1155
|
}
|
|
1132
|
-
function
|
|
1156
|
+
function Re(e) {
|
|
1133
1157
|
let t = o(null), { form: n, locked: i, language: a } = e;
|
|
1134
1158
|
return r(() => {
|
|
1135
1159
|
h();
|
|
@@ -1148,9 +1172,9 @@ function Le(e) {
|
|
|
1148
1172
|
children: n.fields.map((e) => /* @__PURE__ */ l("p", { children: e.label }, e.name))
|
|
1149
1173
|
});
|
|
1150
1174
|
}
|
|
1151
|
-
function
|
|
1175
|
+
function ze(e, n, r) {
|
|
1152
1176
|
switch (e.kind) {
|
|
1153
|
-
case "markdown": return /* @__PURE__ */ l(t, { children:
|
|
1177
|
+
case "markdown": return /* @__PURE__ */ l(t, { children: Le(e.text) });
|
|
1154
1178
|
case "table": return /* @__PURE__ */ l("sqc-table", {
|
|
1155
1179
|
table: {
|
|
1156
1180
|
header: e.header,
|
|
@@ -1166,24 +1190,24 @@ function Re(e, n, r) {
|
|
|
1166
1190
|
locked: r,
|
|
1167
1191
|
language: n.code
|
|
1168
1192
|
});
|
|
1169
|
-
case "form": return /* @__PURE__ */ l(
|
|
1193
|
+
case "form": return /* @__PURE__ */ l(Re, {
|
|
1170
1194
|
form: e.form,
|
|
1171
1195
|
locked: r,
|
|
1172
1196
|
language: n.code
|
|
1173
1197
|
});
|
|
1174
1198
|
}
|
|
1175
1199
|
}
|
|
1176
|
-
function
|
|
1200
|
+
function Be({ text: e, locale: n, live: r, confirmable: i }) {
|
|
1177
1201
|
let { blocks: a, confirm: o } = _(e, n.code, i === !0), s = !r;
|
|
1178
|
-
return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children:
|
|
1202
|
+
return /* @__PURE__ */ l(t, { children: [a.map((e, r) => /* @__PURE__ */ l(t, { children: ze(e, n, s) }, `b${r}`)), o && /* @__PURE__ */ l("sqc-confirm", {
|
|
1179
1203
|
locked: s,
|
|
1180
1204
|
language: n.code
|
|
1181
1205
|
})] });
|
|
1182
1206
|
}
|
|
1183
1207
|
//#endregion
|
|
1184
1208
|
//#region src/components/MessageList.tsx
|
|
1185
|
-
var
|
|
1186
|
-
function
|
|
1209
|
+
var Ve = 80;
|
|
1210
|
+
function He({ at: e, locale: t }) {
|
|
1187
1211
|
let n = new Date(e);
|
|
1188
1212
|
return /* @__PURE__ */ l("time", {
|
|
1189
1213
|
class: "sqc-msg__time",
|
|
@@ -1194,7 +1218,7 @@ function Ve({ at: e, locale: t }) {
|
|
|
1194
1218
|
})
|
|
1195
1219
|
});
|
|
1196
1220
|
}
|
|
1197
|
-
function
|
|
1221
|
+
function Ue(e) {
|
|
1198
1222
|
let { call: t, locked: n, locale: i } = e, a = i.code, s = o(null);
|
|
1199
1223
|
r(() => {
|
|
1200
1224
|
h();
|
|
@@ -1233,7 +1257,7 @@ function He(e) {
|
|
|
1233
1257
|
]
|
|
1234
1258
|
});
|
|
1235
1259
|
}
|
|
1236
|
-
function
|
|
1260
|
+
function We({ file: t, load: n }) {
|
|
1237
1261
|
let [r, i] = e(null);
|
|
1238
1262
|
return v(() => {
|
|
1239
1263
|
let e = null, r = !0;
|
|
@@ -1251,7 +1275,7 @@ function Ue({ file: t, load: n }) {
|
|
|
1251
1275
|
children: t.filename
|
|
1252
1276
|
});
|
|
1253
1277
|
}
|
|
1254
|
-
function
|
|
1278
|
+
function Ge(e) {
|
|
1255
1279
|
let { file: t, load: n, language: i } = e, a = o(null), s = y(() => n(t.id).then((e) => e.text()).catch(() => ""), [t.id, n]);
|
|
1256
1280
|
return r(() => {
|
|
1257
1281
|
h();
|
|
@@ -1271,13 +1295,13 @@ function We(e) {
|
|
|
1271
1295
|
children: t.filename
|
|
1272
1296
|
});
|
|
1273
1297
|
}
|
|
1274
|
-
function
|
|
1298
|
+
function Ke({ files: e, load: t, language: n }) {
|
|
1275
1299
|
return e.length === 0 || !t ? null : /* @__PURE__ */ l("div", {
|
|
1276
1300
|
class: "sqc-attachments sqc-attachments--sent",
|
|
1277
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(
|
|
1301
|
+
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ l(We, {
|
|
1278
1302
|
file: e,
|
|
1279
1303
|
load: t
|
|
1280
|
-
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(
|
|
1304
|
+
}, e.id) : e.kind === "chart" ? /* @__PURE__ */ l(Ge, {
|
|
1281
1305
|
file: e,
|
|
1282
1306
|
load: t,
|
|
1283
1307
|
language: n
|
|
@@ -1291,17 +1315,17 @@ function Ge({ files: e, load: t, language: n }) {
|
|
|
1291
1315
|
}, e.id))
|
|
1292
1316
|
});
|
|
1293
1317
|
}
|
|
1294
|
-
function
|
|
1318
|
+
function qe({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onLoadAttachment: a }) {
|
|
1295
1319
|
let o = e.streaming && !e.content, s = !!e.approval;
|
|
1296
1320
|
return /* @__PURE__ */ l("div", {
|
|
1297
1321
|
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
1298
1322
|
children: [e.role === "assistant" && /* @__PURE__ */ l("div", {
|
|
1299
1323
|
class: "sqc-msg__who",
|
|
1300
|
-
children: [e.agent ? /* @__PURE__ */ l(
|
|
1324
|
+
children: [e.agent ? /* @__PURE__ */ l(xe, {
|
|
1301
1325
|
name: e.agent.name,
|
|
1302
1326
|
color: e.agent.color,
|
|
1303
1327
|
url: e.agent.avatarUrl
|
|
1304
|
-
}) : /* @__PURE__ */ l(
|
|
1328
|
+
}) : /* @__PURE__ */ l(Ye, {}), e.authorName ?? e.agent?.name ?? n]
|
|
1305
1329
|
}), /* @__PURE__ */ l("div", {
|
|
1306
1330
|
class: "sqc-msg__bubble",
|
|
1307
1331
|
children: [o ? /* @__PURE__ */ l("span", {
|
|
@@ -1322,7 +1346,7 @@ function Ke({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1322
1346
|
}) : /* @__PURE__ */ l("div", {
|
|
1323
1347
|
class: "sqc-msg__body",
|
|
1324
1348
|
children: [
|
|
1325
|
-
/* @__PURE__ */ l(
|
|
1349
|
+
/* @__PURE__ */ l(Be, {
|
|
1326
1350
|
text: e.content,
|
|
1327
1351
|
locale: t,
|
|
1328
1352
|
live: r,
|
|
@@ -1332,29 +1356,29 @@ function Ke({ message: e, locale: t, assistantName: n, live: r, onDecide: i, onL
|
|
|
1332
1356
|
class: "sqc-caret",
|
|
1333
1357
|
"aria-hidden": "true"
|
|
1334
1358
|
}),
|
|
1335
|
-
s && /* @__PURE__ */ l(
|
|
1359
|
+
s && /* @__PURE__ */ l(Ue, {
|
|
1336
1360
|
locale: t,
|
|
1337
1361
|
call: e.content.trim() === "" ? e.approval : void 0,
|
|
1338
1362
|
locked: !i
|
|
1339
1363
|
}),
|
|
1340
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(
|
|
1364
|
+
e.unknownHandle && !e.streaming && /* @__PURE__ */ l(Je, {
|
|
1341
1365
|
message: e,
|
|
1342
1366
|
locale: t
|
|
1343
1367
|
}),
|
|
1344
|
-
/* @__PURE__ */ l(
|
|
1368
|
+
/* @__PURE__ */ l(Ke, {
|
|
1345
1369
|
files: e.attachments ?? [],
|
|
1346
1370
|
load: a,
|
|
1347
1371
|
language: t.code
|
|
1348
1372
|
})
|
|
1349
1373
|
]
|
|
1350
|
-
}), !o && /* @__PURE__ */ l(
|
|
1374
|
+
}), !o && /* @__PURE__ */ l(He, {
|
|
1351
1375
|
at: e.createdAt,
|
|
1352
1376
|
locale: t
|
|
1353
1377
|
})]
|
|
1354
1378
|
})]
|
|
1355
1379
|
});
|
|
1356
1380
|
}
|
|
1357
|
-
function
|
|
1381
|
+
function Je({ message: e, locale: n }) {
|
|
1358
1382
|
let r = e.offered ?? [];
|
|
1359
1383
|
return /* @__PURE__ */ l("p", {
|
|
1360
1384
|
class: "sqc-msg__unaddressed",
|
|
@@ -1371,7 +1395,7 @@ function qe({ message: e, locale: n }) {
|
|
|
1371
1395
|
]
|
|
1372
1396
|
});
|
|
1373
1397
|
}
|
|
1374
|
-
function
|
|
1398
|
+
function Ye() {
|
|
1375
1399
|
return /* @__PURE__ */ l("svg", {
|
|
1376
1400
|
viewBox: "0 0 24 24",
|
|
1377
1401
|
fill: "none",
|
|
@@ -1383,7 +1407,7 @@ function Je() {
|
|
|
1383
1407
|
children: /* @__PURE__ */ l("path", { d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" })
|
|
1384
1408
|
});
|
|
1385
1409
|
}
|
|
1386
|
-
function
|
|
1410
|
+
function Xe({ messages: e, locale: t, assistantName: n, suggestions: i, showSuggestions: a, busy: s, withHuman: c, onSuggestion: u, onChoice: d, onDecide: f, onCompose: m, onLoadAttachment: h }) {
|
|
1387
1411
|
let g = o(null), _ = o(!0);
|
|
1388
1412
|
r(() => {
|
|
1389
1413
|
let e = g.current;
|
|
@@ -1434,7 +1458,7 @@ function Ye({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1434
1458
|
let e = g.current;
|
|
1435
1459
|
if (!e) return;
|
|
1436
1460
|
let t = () => {
|
|
1437
|
-
_.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
1461
|
+
_.current = e.scrollHeight - e.scrollTop - e.clientHeight < Ve;
|
|
1438
1462
|
};
|
|
1439
1463
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1440
1464
|
}, []), /* @__PURE__ */ l("div", {
|
|
@@ -1444,7 +1468,7 @@ function Ye({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1444
1468
|
"aria-live": "polite",
|
|
1445
1469
|
"aria-atomic": "false",
|
|
1446
1470
|
children: [
|
|
1447
|
-
e.map((r, i) => /* @__PURE__ */ l(
|
|
1471
|
+
e.map((r, i) => /* @__PURE__ */ l(qe, {
|
|
1448
1472
|
message: r,
|
|
1449
1473
|
locale: t,
|
|
1450
1474
|
assistantName: n,
|
|
@@ -1471,28 +1495,28 @@ function Ye({ messages: e, locale: t, assistantName: n, suggestions: i, showSugg
|
|
|
1471
1495
|
}
|
|
1472
1496
|
//#endregion
|
|
1473
1497
|
//#region src/components/ChatbotWidget.tsx
|
|
1474
|
-
var
|
|
1475
|
-
function
|
|
1498
|
+
var Ze = { width: "min(392px, 100vw)" }, Qe = /* @__PURE__ */ new Set(["sessionId"]);
|
|
1499
|
+
function $e(e) {
|
|
1476
1500
|
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1477
1501
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1478
1502
|
}
|
|
1479
|
-
function
|
|
1503
|
+
function et(e) {
|
|
1480
1504
|
if (!e) return [];
|
|
1481
1505
|
let t = [];
|
|
1482
1506
|
for (let [n, r] of Object.entries(e)) {
|
|
1483
|
-
if (
|
|
1507
|
+
if (Qe.has(n) || typeof r != "string" && !w(r)) continue;
|
|
1484
1508
|
let e = C(r);
|
|
1485
1509
|
e && t.push({
|
|
1486
|
-
label:
|
|
1510
|
+
label: $e(n),
|
|
1487
1511
|
value: e
|
|
1488
1512
|
});
|
|
1489
1513
|
}
|
|
1490
1514
|
return t;
|
|
1491
1515
|
}
|
|
1492
|
-
function
|
|
1516
|
+
function tt(e, t) {
|
|
1493
1517
|
return e?.trim() ? e : t;
|
|
1494
1518
|
}
|
|
1495
|
-
function
|
|
1519
|
+
function nt(t) {
|
|
1496
1520
|
let [n, r] = e(!1);
|
|
1497
1521
|
return v(() => {
|
|
1498
1522
|
if (t !== "auto" || typeof matchMedia != "function") return;
|
|
@@ -1502,11 +1526,12 @@ function tt(t) {
|
|
|
1502
1526
|
return e.addEventListener("change", n), () => e.removeEventListener("change", n);
|
|
1503
1527
|
}, [t]), t === "dark" ? "dark" : t === "light" ? "light" : n ? "dark" : "light";
|
|
1504
1528
|
}
|
|
1505
|
-
function
|
|
1529
|
+
function rt(t) {
|
|
1506
1530
|
a();
|
|
1507
|
-
let n = t.persistOpen ?? !0, [s, c] = e(() =>
|
|
1531
|
+
let n = t.persistOpen ?? !0, [s, c] = e(() => O(t.defaultOpen, n)), [u, d] = e(!1), [f, p] = e(!1), m = o(null), h = o(null), g = nt(t.theme ?? "light"), _ = y(() => b(t.locale), [t.locale]), x = _.t, S = tt(t.heading, x.heading), C = tt(t.assistantName, x.assistant), w = tt(t.greeting, x.greeting), T = t.onEvent, { send: ee, reset: E, decide: j, stop: M, start: N, resets: P, busy: F, messages: I, withHuman: L, branding: R, sessionId: z, handles: B, addressee: te, agentHandle: V, attachments: H, uploading: U, attachmentError: W, attach: G, detach: K, loadAttachment: q } = be({
|
|
1508
1532
|
embedKey: t.embedKey,
|
|
1509
1533
|
user: t.user,
|
|
1534
|
+
scope: t.scope,
|
|
1510
1535
|
getSubjectToken: t.getSubjectToken,
|
|
1511
1536
|
agent: t.agent,
|
|
1512
1537
|
context: t.context,
|
|
@@ -1517,10 +1542,10 @@ function nt(t) {
|
|
|
1517
1542
|
v(() => {
|
|
1518
1543
|
!s && I.some((e) => e.role === "assistant" && e.id !== "greeting") && p(!0);
|
|
1519
1544
|
}, [I, s]);
|
|
1520
|
-
let
|
|
1521
|
-
|
|
1522
|
-
let
|
|
1523
|
-
p(!1), !
|
|
1545
|
+
let J = o(s);
|
|
1546
|
+
J.current = s;
|
|
1547
|
+
let Y = i(() => {
|
|
1548
|
+
p(!1), !J.current && (J.current = !0, c(!0), n && D(!0), T?.({
|
|
1524
1549
|
type: "chatbot-open",
|
|
1525
1550
|
sessionId: z
|
|
1526
1551
|
}));
|
|
@@ -1528,8 +1553,8 @@ function nt(t) {
|
|
|
1528
1553
|
T,
|
|
1529
1554
|
n,
|
|
1530
1555
|
z
|
|
1531
|
-
]),
|
|
1532
|
-
|
|
1556
|
+
]), X = i(() => {
|
|
1557
|
+
J.current && (J.current = !1, c(!1), n && D(!1), T?.({
|
|
1533
1558
|
type: "chatbot-close",
|
|
1534
1559
|
sessionId: z
|
|
1535
1560
|
}), h.current?.focus());
|
|
@@ -1539,57 +1564,61 @@ function nt(t) {
|
|
|
1539
1564
|
z
|
|
1540
1565
|
]);
|
|
1541
1566
|
v(() => {
|
|
1542
|
-
s &&
|
|
1543
|
-
}, [
|
|
1544
|
-
|
|
1545
|
-
|
|
1567
|
+
s && N();
|
|
1568
|
+
}, [
|
|
1569
|
+
s,
|
|
1570
|
+
P,
|
|
1571
|
+
N
|
|
1572
|
+
]);
|
|
1573
|
+
let ne = B.length >= 2, re = k(I, V || void 0), [ie, ae] = e(void 0), oe = o(void 0), se = i((e) => {
|
|
1574
|
+
oe.current = e, ae(e);
|
|
1546
1575
|
}, []);
|
|
1547
1576
|
v(() => {
|
|
1548
|
-
|
|
1549
|
-
}, [
|
|
1577
|
+
oe.current = void 0, ae(void 0);
|
|
1578
|
+
}, [re]);
|
|
1550
1579
|
let Z = i((e) => {
|
|
1551
|
-
d(!0),
|
|
1580
|
+
d(!0), ee(ne ? A(e, oe.current, re) : e);
|
|
1552
1581
|
}, [
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
]),
|
|
1557
|
-
d(!1), p(!1),
|
|
1558
|
-
}, [
|
|
1559
|
-
openPanel:
|
|
1560
|
-
closePanel:
|
|
1582
|
+
ee,
|
|
1583
|
+
ne,
|
|
1584
|
+
re
|
|
1585
|
+
]), ce = i(() => {
|
|
1586
|
+
d(!1), p(!1), E();
|
|
1587
|
+
}, [E]), Q = o({
|
|
1588
|
+
openPanel: Y,
|
|
1589
|
+
closePanel: X,
|
|
1561
1590
|
send: Z,
|
|
1562
|
-
reset:
|
|
1591
|
+
reset: ce,
|
|
1563
1592
|
sessionId: z
|
|
1564
1593
|
});
|
|
1565
|
-
|
|
1566
|
-
openPanel:
|
|
1567
|
-
closePanel:
|
|
1594
|
+
Q.current = {
|
|
1595
|
+
openPanel: Y,
|
|
1596
|
+
closePanel: X,
|
|
1568
1597
|
send: Z,
|
|
1569
|
-
reset:
|
|
1598
|
+
reset: ce,
|
|
1570
1599
|
sessionId: z
|
|
1571
1600
|
};
|
|
1572
|
-
let
|
|
1573
|
-
open: () =>
|
|
1574
|
-
close: () =>
|
|
1575
|
-
toggle: () =>
|
|
1576
|
-
reset: () =>
|
|
1601
|
+
let le = o({
|
|
1602
|
+
open: () => Q.current.openPanel(),
|
|
1603
|
+
close: () => Q.current.closePanel(),
|
|
1604
|
+
toggle: () => J.current ? Q.current.closePanel() : Q.current.openPanel(),
|
|
1605
|
+
reset: () => Q.current.reset(),
|
|
1577
1606
|
send: (e) => {
|
|
1578
|
-
|
|
1607
|
+
Q.current.openPanel(), Q.current.send(e);
|
|
1579
1608
|
},
|
|
1580
|
-
isOpen: () =>
|
|
1581
|
-
sessionId: () =>
|
|
1582
|
-
}),
|
|
1583
|
-
r(() => (
|
|
1609
|
+
isOpen: () => J.current,
|
|
1610
|
+
sessionId: () => Q.current.sessionId
|
|
1611
|
+
}), $ = t.bind;
|
|
1612
|
+
r(() => ($?.(le.current), () => $?.(null)), [$]), v(() => {
|
|
1584
1613
|
if (!s) return;
|
|
1585
1614
|
let e = (e) => {
|
|
1586
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
1615
|
+
e.key === "Escape" && (e.stopPropagation(), X());
|
|
1587
1616
|
};
|
|
1588
1617
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
1589
|
-
}, [
|
|
1590
|
-
let
|
|
1618
|
+
}, [X, s]);
|
|
1619
|
+
let ue = y(() => I.some((e) => e.id !== "greeting"), [I]), de = y(() => et(t.context), [t.context]), fe = {
|
|
1591
1620
|
...t.accent ? { "--sqc-accent": t.accent } : {},
|
|
1592
|
-
"--sqc-width": t.width ??
|
|
1621
|
+
"--sqc-width": t.width ?? Ze.width
|
|
1593
1622
|
};
|
|
1594
1623
|
return /* @__PURE__ */ l("div", {
|
|
1595
1624
|
class: "sqc",
|
|
@@ -1597,7 +1626,7 @@ function nt(t) {
|
|
|
1597
1626
|
"data-position": t.position ?? "bottom-right",
|
|
1598
1627
|
"data-layout": t.layout ?? "sidebar",
|
|
1599
1628
|
"data-open": s ? "true" : "false",
|
|
1600
|
-
style:
|
|
1629
|
+
style: fe,
|
|
1601
1630
|
children: [/* @__PURE__ */ l("button", {
|
|
1602
1631
|
ref: h,
|
|
1603
1632
|
type: "button",
|
|
@@ -1605,13 +1634,13 @@ function nt(t) {
|
|
|
1605
1634
|
"aria-label": S,
|
|
1606
1635
|
"aria-expanded": s,
|
|
1607
1636
|
"aria-haspopup": "dialog",
|
|
1608
|
-
onClick:
|
|
1637
|
+
onClick: Y,
|
|
1609
1638
|
children: [/* @__PURE__ */ l("span", {
|
|
1610
1639
|
class: "sqc-launcher__icon",
|
|
1611
1640
|
children: /* @__PURE__ */ l("slot", {
|
|
1612
1641
|
name: "launcher-icon",
|
|
1613
1642
|
class: "sqc-slot-icon",
|
|
1614
|
-
children: /* @__PURE__ */ l(
|
|
1643
|
+
children: /* @__PURE__ */ l(Ye, {})
|
|
1615
1644
|
})
|
|
1616
1645
|
}), f && /* @__PURE__ */ l("span", {
|
|
1617
1646
|
class: "sqc-launcher__badge",
|
|
@@ -1630,7 +1659,7 @@ function nt(t) {
|
|
|
1630
1659
|
/* @__PURE__ */ l("span", {
|
|
1631
1660
|
class: "sqc-header__icon",
|
|
1632
1661
|
"aria-hidden": "true",
|
|
1633
|
-
children: /* @__PURE__ */ l(
|
|
1662
|
+
children: /* @__PURE__ */ l(Ye, {})
|
|
1634
1663
|
}),
|
|
1635
1664
|
/* @__PURE__ */ l("div", {
|
|
1636
1665
|
class: "sqc-header__titles",
|
|
@@ -1639,13 +1668,13 @@ function nt(t) {
|
|
|
1639
1668
|
children: S
|
|
1640
1669
|
}), /* @__PURE__ */ l("p", {
|
|
1641
1670
|
class: "sqc-header__sub",
|
|
1642
|
-
children:
|
|
1671
|
+
children: tt(t.subheading, x.subheading)
|
|
1643
1672
|
})]
|
|
1644
1673
|
}),
|
|
1645
1674
|
/* @__PURE__ */ l("button", {
|
|
1646
1675
|
type: "button",
|
|
1647
1676
|
class: "sqc-icon-btn",
|
|
1648
|
-
onClick:
|
|
1677
|
+
onClick: ce,
|
|
1649
1678
|
"aria-label": x.newConversation,
|
|
1650
1679
|
"data-tip": x.newConversation,
|
|
1651
1680
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1662,7 +1691,7 @@ function nt(t) {
|
|
|
1662
1691
|
/* @__PURE__ */ l("button", {
|
|
1663
1692
|
type: "button",
|
|
1664
1693
|
class: "sqc-icon-btn",
|
|
1665
|
-
onClick:
|
|
1694
|
+
onClick: X,
|
|
1666
1695
|
"aria-label": x.close,
|
|
1667
1696
|
"data-tip": x.closeTitle,
|
|
1668
1697
|
children: /* @__PURE__ */ l("svg", {
|
|
@@ -1679,52 +1708,52 @@ function nt(t) {
|
|
|
1679
1708
|
]
|
|
1680
1709
|
}), /* @__PURE__ */ l("div", {
|
|
1681
1710
|
class: "sqc-panel__body",
|
|
1682
|
-
children: [
|
|
1711
|
+
children: [ne && /* @__PURE__ */ l(Ce, {
|
|
1683
1712
|
handles: B,
|
|
1684
|
-
active:
|
|
1713
|
+
active: ie ?? re,
|
|
1685
1714
|
disabled: L,
|
|
1686
|
-
onPick:
|
|
1715
|
+
onPick: se,
|
|
1687
1716
|
label: x.handles.rail
|
|
1688
1717
|
}), /* @__PURE__ */ l("div", {
|
|
1689
1718
|
class: "sqc-panel__main",
|
|
1690
1719
|
children: [
|
|
1691
|
-
(t.showContext ?? !0) &&
|
|
1720
|
+
(t.showContext ?? !0) && de.length > 0 && /* @__PURE__ */ l("div", {
|
|
1692
1721
|
class: "sqc-context",
|
|
1693
1722
|
"aria-label": x.context.region,
|
|
1694
|
-
children:
|
|
1723
|
+
children: de.map((e) => /* @__PURE__ */ l("span", {
|
|
1695
1724
|
class: "sqc-chip",
|
|
1696
1725
|
title: `${e.label}: ${e.value}`,
|
|
1697
1726
|
children: [/* @__PURE__ */ l("b", { children: e.label }), e.value]
|
|
1698
1727
|
}, e.label))
|
|
1699
1728
|
}),
|
|
1700
|
-
/* @__PURE__ */ l(
|
|
1729
|
+
/* @__PURE__ */ l(Xe, {
|
|
1701
1730
|
messages: I,
|
|
1702
1731
|
locale: _,
|
|
1703
1732
|
assistantName: C,
|
|
1704
1733
|
suggestions: t.suggestions,
|
|
1705
|
-
showSuggestions: !u && !
|
|
1734
|
+
showSuggestions: !u && !ue,
|
|
1706
1735
|
busy: F,
|
|
1707
1736
|
withHuman: L,
|
|
1708
1737
|
onSuggestion: Z,
|
|
1709
1738
|
onChoice: Z,
|
|
1710
|
-
onDecide:
|
|
1739
|
+
onDecide: j,
|
|
1711
1740
|
onCompose: () => m.current?.querySelector(".sqc-composer__input")?.focus(),
|
|
1712
|
-
onLoadAttachment:
|
|
1741
|
+
onLoadAttachment: q
|
|
1713
1742
|
}),
|
|
1714
|
-
/* @__PURE__ */ l(
|
|
1715
|
-
placeholder:
|
|
1743
|
+
/* @__PURE__ */ l(ke, {
|
|
1744
|
+
placeholder: tt(t.placeholder, x.placeholder),
|
|
1716
1745
|
locale: _,
|
|
1717
1746
|
busy: F,
|
|
1718
1747
|
autoFocus: s,
|
|
1719
1748
|
handles: B,
|
|
1720
|
-
addressee:
|
|
1749
|
+
addressee: te,
|
|
1721
1750
|
attachments: H,
|
|
1722
1751
|
uploading: U,
|
|
1723
1752
|
attachmentError: W ? x.attachments[W] : void 0,
|
|
1724
|
-
onAttach:
|
|
1725
|
-
onDetach:
|
|
1753
|
+
onAttach: G,
|
|
1754
|
+
onDetach: K,
|
|
1726
1755
|
onSend: Z,
|
|
1727
|
-
onStop:
|
|
1756
|
+
onStop: M
|
|
1728
1757
|
}),
|
|
1729
1758
|
/* @__PURE__ */ l("p", {
|
|
1730
1759
|
class: "sqc-hint",
|
|
@@ -1747,7 +1776,7 @@ function nt(t) {
|
|
|
1747
1776
|
}
|
|
1748
1777
|
//#endregion
|
|
1749
1778
|
//#region src/styles.css?inline
|
|
1750
|
-
var rt = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:\"Plus Jakarta Sans\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:\"\";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:\"·\";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:stretch}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}.sqc-waiting{align-items:center;gap:8px;display:inline-flex}.sqc-activity{color:var(--sqc-text-muted);font-size:12px}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:\"\";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-attachment__chart{flex-basis:100%;min-width:0}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}", it = "squadico-chatbot", at = [
|
|
1779
|
+
var it = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480000;--sqc-radius:16px;--sqc-font-family:\"Plus Jakarta Sans\", ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;--sqc-font-heading:var(--sqc-font-family);z-index:var(--sqc-z);pointer-events:none;font-family:var(--sqc-font-family);-webkit-font-smoothing:antialiased;text-align:left;font-size:14px;line-height:1.5;display:block;position:fixed;top:0;bottom:0;left:0;right:0;margin:0!important}:host([hidden]){display:none}.sqc{--sqc-neutral-50:#f8fafc;--sqc-neutral-100:#f1f5f9;--sqc-neutral-200:#e2e8f0;--sqc-neutral-300:#cbd5e1;--sqc-neutral-400:#94a3b8;--sqc-neutral-500:#64748b;--sqc-neutral-600:#475569;--sqc-neutral-900:#0f172a;--sqc-error-50:#fff1f2;--sqc-error-100:#ffe4e6;--sqc-error-600:#e11d48;--sqc-accent-default:#000;--sqc-accent-color:var(--sqc-accent,var(--sqc-accent-default));--sqc-on-accent:#fff;--sqc-accent-hover:color-mix(in oklab, var(--sqc-accent-color) 84%, var(--sqc-on-accent));--sqc-accent-fg:var(--sqc-accent,var(--sqc-text));--sqc-bg:#fff;--sqc-surface:var(--sqc-neutral-50);--sqc-selected:var(--sqc-neutral-100);--sqc-border:var(--sqc-neutral-200);--sqc-border-strong:var(--sqc-neutral-300);--sqc-text:var(--sqc-neutral-900);--sqc-text-muted:var(--sqc-neutral-500);--sqc-link:#2563eb;--sqc-bubble-user:var(--sqc-accent-color);--sqc-bubble-user-text:var(--sqc-on-accent);--sqc-code-bg:var(--sqc-neutral-100);--sqc-disabled:var(--sqc-neutral-300);--sqc-shadow:0 10px 15px -3px #0f172a1a, 0 4px 6px -4px #0f172a1a;--sqc-shadow-bottom:0 6px 8px -6px #0f172a2e;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #0f172a4d;--sqc-focus-input:0 0 0 3px #0f172a1a;--sqc-danger:var(--sqc-error-600);color:var(--sqc-text);position:absolute;top:0;bottom:0;left:0;right:0}.sqc[data-theme=dark]{--sqc-neutral-50:#172033;--sqc-neutral-100:#1e293b;--sqc-neutral-200:#334155;--sqc-neutral-300:#475569;--sqc-neutral-400:#64748b;--sqc-neutral-500:#94a3b8;--sqc-neutral-600:#cbd5e1;--sqc-neutral-900:#f8fafc;--sqc-error-50:#2a0a12;--sqc-error-100:#4c0519;--sqc-error-600:#fb7185;--sqc-accent-default:#fff;--sqc-on-accent:#0f172a;--sqc-bg:#0f172a;--sqc-link:#60a5fa;--sqc-code-bg:#020617;--sqc-shadow:0 10px 24px -4px #0000008c;--sqc-shadow-bottom:0 6px 8px -6px #0000008c;--sqc-focus:0 0 0 2px var(--sqc-bg), 0 0 0 4px #f8fafc59;--sqc-focus-input:0 0 0 3px #f8fafc1f}@supports (color:oklch(from red l c h)){.sqc{--sqc-on-accent:oklch(from var(--sqc-accent-color) clamp(.208, (.62 - l) * 1000, 1) 0 0)}}.sqc *,.sqc :before,.sqc :after{box-sizing:border-box}.sqc-launcher{background:var(--sqc-accent-color);width:56px;height:56px;color:var(--sqc-on-accent);cursor:pointer;pointer-events:auto;box-shadow:var(--sqc-shadow);border:none;border-radius:50%;place-items:center;padding:0;transition:transform .18s,opacity .18s,background .18s,box-shadow .18s;display:grid;position:absolute;bottom:24px;right:24px}.sqc[data-position=bottom-left] .sqc-launcher{left:24px;right:auto}.sqc-launcher:hover{background:var(--sqc-accent-hover);transform:scale(1.06)}.sqc-launcher:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc[data-open=true] .sqc-launcher{opacity:0;pointer-events:none;transform:scale(.5)}.sqc-launcher__icon svg{width:26px;height:26px;display:block}.sqc-slot-icon::slotted(*){justify-content:center;align-items:center;width:26px;height:26px;display:inline-flex}.sqc-launcher__badge{background:var(--sqc-error-600);border:2px solid var(--sqc-bg);border-radius:50%;width:12px;height:12px;position:absolute;top:6px;right:6px}.sqc-panel{width:var(--sqc-width);background:var(--sqc-bg);border-left:1px solid var(--sqc-border);box-shadow:var(--sqc-shadow);pointer-events:auto;visibility:hidden;flex-direction:column;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility 0s linear .26s;display:flex;position:absolute;top:0;bottom:0;right:0;transform:translate(100%)}.sqc-panel__body{flex:1;min-height:0;display:flex}.sqc-panel__main{flex-direction:column;flex:1;min-width:0;min-height:0;display:flex}.sqc-rail{border-right:1px solid var(--sqc-border);background:color-mix(in oklab, var(--sqc-accent-color) 7%, var(--sqc-bg));flex-direction:column;flex-shrink:0;align-items:stretch;gap:6px;width:72px;padding:12px 0;display:flex;overflow:visible}.sqc-rail__item{color:var(--sqc-text-muted);font:inherit;cursor:pointer;background:0 0;border:0;flex-direction:column;align-items:center;gap:4px;padding:4px 0;display:flex;position:relative}.sqc-rail__label{white-space:nowrap;text-overflow:ellipsis;max-width:64px;font-size:10.5px;font-weight:500;line-height:1.2;overflow:hidden}.sqc-rail__item:hover,.sqc-rail__item[aria-pressed=true]{color:var(--sqc-text)}.sqc-rail__item[aria-pressed=true] .sqc-rail__label{font-weight:600}.sqc-rail__item .sqc-avatar{transition:box-shadow .15s}.sqc-rail__item[aria-pressed=true] .sqc-avatar{box-shadow:0 0 0 2px var(--sqc-bg), 0 0 0 4px var(--sqc-accent-color)}.sqc-rail__item:before{content:\"\";background:var(--sqc-text);border-radius:0 4px 4px 0;width:4px;height:0;transition:height .15s;position:absolute;top:24px;left:0;transform:translateY(-50%)}.sqc-rail__item:hover:before{height:12px}.sqc-rail__item[aria-pressed=true]:before{height:32px}.sqc-rail__item:focus-visible{outline:2px solid var(--sqc-accent-color);outline-offset:-2px;border-radius:8px}.sqc-rail__item:disabled{cursor:not-allowed;opacity:.5}.sqc-rail__item[data-tip]:after{content:attr(data-tip);z-index:2;background:var(--sqc-text);color:var(--sqc-bg);white-space:nowrap;pointer-events:none;opacity:0;border-radius:6px;padding:4px 8px;font-size:12px;font-weight:500;transition:opacity .12s;position:absolute;top:24px;left:calc(100% + 6px);transform:translateY(-50%)}.sqc-rail__item[data-tip]:hover:after{opacity:1}.sqc-rail__item[data-tip]:focus-visible:after{opacity:1}.sqc[data-open=true] .sqc-panel{visibility:visible;transition:transform .26s cubic-bezier(.22,1,.36,1),visibility;transform:translate(0)}.sqc[data-layout=floating] .sqc-panel{max-width:calc(100% - 48px);height:var(--sqc-height);border:1px solid var(--sqc-border);border-radius:var(--sqc-radius);opacity:0;transform-origin:100% 100%;max-height:calc(100% - 48px);transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility 0s linear .22s;top:auto;bottom:24px;right:24px;overflow:hidden;transform:translateY(16px)scale(.96)}.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{transform-origin:0 100%;left:24px;right:auto}.sqc[data-layout=floating][data-open=true] .sqc-panel{opacity:1;transition:transform .22s cubic-bezier(.22,1,.36,1),opacity .22s,visibility;transform:none}.sqc-header{background:var(--sqc-bg);color:var(--sqc-text);border-bottom:1px solid var(--sqc-border);flex-shrink:0;align-items:center;gap:8px;padding:13px 12px 13px 16px;display:flex}.sqc-header__icon{color:var(--sqc-accent-fg);flex-shrink:0;place-items:center;display:grid}.sqc-header__icon svg{width:17px;height:17px;display:block}.sqc-header__titles{flex:1;min-width:0}.sqc-header__heading,.sqc-header__sub{text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.sqc-header__heading{font-family:var(--sqc-font-heading);letter-spacing:-.2px;font-size:15px;font-weight:700}.sqc-header__sub{color:var(--sqc-text-muted);font-size:12px}.sqc-icon-btn{width:26px;height:26px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:none;border-radius:8px;flex-shrink:0;place-items:center;transition:background .15s;display:grid}.sqc-icon-btn:hover{background:var(--sqc-surface);color:var(--sqc-text)}.sqc-icon-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-icon-btn svg{width:16px;height:16px}.sqc-icon-btn[data-tip]{position:relative}.sqc-icon-btn[data-tip]:after{content:attr(data-tip);z-index:6;background:var(--sqc-text);color:var(--sqc-bg);font-family:var(--sqc-font-family);white-space:nowrap;pointer-events:none;opacity:0;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:500;line-height:1.3;transition:opacity .12s .15s;position:absolute;top:calc(100% + 6px);right:0}.sqc-icon-btn[data-tip]:hover:after{opacity:1}.sqc-icon-btn[data-tip]:focus-visible:after{opacity:1}.sqc-history-pop{z-index:5;position:absolute;top:54px;left:0;right:0}.sqc-history{background:var(--sqc-bg);max-height:320px;box-shadow:var(--sqc-shadow-bottom);flex-direction:column;display:flex;overflow-y:auto}.sqc-history__empty{color:var(--sqc-text-muted);text-align:center;margin:0;padding:14px 16px;font-size:12px}.sqc-history__item{border:none;border-bottom:1px solid var(--sqc-border);width:100%;color:var(--sqc-text);text-align:left;cursor:pointer;background:0 0;flex-direction:column;gap:2px;padding:10px 16px;transition:background .15s;display:flex}.sqc-history__item:last-child{border-bottom:none}.sqc-history__item:hover{background:var(--sqc-surface)}.sqc-history__item:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-history__item[aria-current=true]{background:var(--sqc-selected)}.sqc-history__item[aria-current=true] .sqc-history__title{color:var(--sqc-text);font-weight:600}.sqc-history__title{text-overflow:ellipsis;white-space:nowrap;font-size:13px;overflow:hidden}.sqc-history__date{color:var(--sqc-text-muted);font-size:11px}.sqc-context{background:var(--sqc-selected);border:1px solid var(--sqc-border);color:var(--sqc-text);border-radius:12px;flex-wrap:wrap;flex-shrink:0;align-items:center;gap:8px;margin:12px 16px 4px;padding:8px 11px;font-size:12px;display:flex}.sqc-chip{text-overflow:ellipsis;white-space:nowrap;align-items:baseline;gap:4px;max-width:100%;display:inline-flex;overflow:hidden}.sqc-chip b{font-weight:600}.sqc-chip:not(:last-child):after{content:\"·\";opacity:.5;margin-left:4px}.sqc-messages{overscroll-behavior:contain;background:var(--sqc-bg);scrollbar-width:thin;scrollbar-color:var(--sqc-neutral-300) transparent;flex-direction:column;flex:1;gap:13px;min-height:0;padding:12px 16px;display:flex;overflow-y:auto}.sqc-messages::-webkit-scrollbar{width:6px}.sqc-messages::-webkit-scrollbar-thumb{background:var(--sqc-neutral-300);border-radius:99px}.sqc-msg{flex-direction:column;max-width:93%;font-size:13.5px;display:flex}.sqc-msg--assistant{align-self:stretch}.sqc-msg--user{align-self:flex-end}.sqc-msg__who{color:var(--sqc-text-muted);align-items:center;gap:6px;margin-bottom:4px;font-size:11px;font-weight:500;display:flex}.sqc-msg__who svg{width:12px;height:12px;color:var(--sqc-accent-fg);flex-shrink:0}.sqc-avatar{background:var(--sqc-accent-color);color:var(--sqc-on-accent);-webkit-user-select:none;user-select:none;flex-shrink:0;justify-content:center;align-items:center;font-weight:600;line-height:1;display:inline-flex;overflow:hidden}.sqc-avatar img{object-fit:cover;width:100%;height:100%}.sqc-msg__unaddressed{color:var(--sqc-text-muted);margin:8px 0 0;font-size:11.5px;line-height:1.5}.sqc-msg__unaddressed code{background:var(--sqc-code-bg);color:var(--sqc-text);border-radius:4px;margin-right:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px}.sqc-msg--user .sqc-msg__bubble{background:var(--sqc-bubble-user);color:var(--sqc-bubble-user-text);border-radius:var(--sqc-radius) var(--sqc-radius) 4px var(--sqc-radius);padding:9px 13px}.sqc-msg--error .sqc-msg__bubble{background:var(--sqc-error-50);color:var(--sqc-error-600);border:1px solid var(--sqc-error-100);border-radius:12px;padding:11px}.sqc-msg__body{overflow-wrap:anywhere}.sqc-msg--assistant .sqc-msg__body{font-size:14px;line-height:1.6}.sqc-msg__body>:first-child{margin-top:0}.sqc-msg__body>:last-child{margin-bottom:0}.sqc-msg__body p{white-space:pre-wrap;margin:0 0 8px}.sqc-msg__body ul,.sqc-msg__body ol{margin:0 0 8px;padding-left:20px}.sqc-msg__body li{margin-bottom:3px}.sqc-msg__body code{background:var(--sqc-code-bg);border-radius:4px;padding:1px 4px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.85em}.sqc-msg--user .sqc-msg__body code{background:#ffffff38}.sqc-msg__body pre{background:var(--sqc-code-bg);border-radius:8px;margin:0 0 8px;padding:9px 11px;overflow-x:auto}.sqc-msg__body pre code{background:0 0;padding:0}.sqc-msg__body a{color:inherit;text-underline-offset:2px;text-decoration:underline}.sqc-msg--assistant .sqc-msg__body a{color:var(--sqc-link);text-decoration:none}.sqc-msg--assistant .sqc-msg__body a:hover{text-decoration:underline}.sqc-msg__body h3,.sqc-msg__body h4,.sqc-msg__body h5,.sqc-msg__body h6{font-family:var(--sqc-font-heading);letter-spacing:-.2px;margin:12px 0 6px;font-weight:700;line-height:1.3}.sqc-msg__body h3{font-size:1.05em}.sqc-msg__body h4{font-size:1em}.sqc-msg__body h5,.sqc-msg__body h6{font-size:.94em}.sqc-msg__body ul ul,.sqc-msg__body ul ol,.sqc-msg__body ol ul,.sqc-msg__body ol ol{margin:3px 0 0}.sqc-msg__body blockquote{border-left:2px solid var(--sqc-border-strong);color:var(--sqc-text-muted);white-space:pre-wrap;margin:0 0 8px;padding:2px 0 2px 10px}.sqc-msg--user .sqc-msg__body blockquote{color:inherit;opacity:.85;border-left-color:#ffffff73}.sqc-msg__body hr{border:0;border-top:1px solid var(--sqc-border);margin:10px 0}.sqc-msg--user .sqc-msg__body hr{border-top-color:#ffffff4d}.sqc-msg__body del{opacity:.7}.sqc-selection{flex-direction:column;gap:10px;margin:2px 0;display:flex}.sqc-selection__question{flex-direction:column;gap:2px;display:flex}.sqc-selection__ask{font-family:var(--sqc-font-family);color:var(--sqc-text);margin:0;font-size:13px;font-weight:600}.sqc-selection__actions{display:flex}.sqc-selection__validate{height:32px;font-family:var(--sqc-font-family);color:var(--sqc-on-accent);background:var(--sqc-accent-color);cursor:pointer;border:1px solid #0000;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:600;transition:filter .12s,background .12s;display:inline-flex}.sqc-selection__validate:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-selection__validate:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-selection__validate:disabled{cursor:not-allowed;color:#fff;background:var(--sqc-disabled)}.sqc-selection__hint{font-family:var(--sqc-font-family);color:var(--sqc-text-muted);margin:0;font-size:11.5px}.sqc-msg__time{color:var(--sqc-text-muted);font-variant-numeric:tabular-nums;margin-top:3px;font-size:10px;display:block}.sqc-msg--user .sqc-msg__time{color:#ffffffb3;text-align:right}.sqc-caret{vertical-align:text-bottom;background:currentColor;width:2px;height:1em;margin-left:2px;animation:1s step-end infinite sqc-blink;display:inline-block}@keyframes sqc-blink{0%,to{opacity:1}50%{opacity:0}}.sqc-typing{gap:3px;padding:2px 0;display:inline-flex}.sqc-typing i{background:var(--sqc-neutral-400);border-radius:50%;width:5px;height:5px;animation:1.2s infinite sqc-pulse}.sqc-typing i:nth-child(2){animation-delay:.2s}.sqc-typing i:nth-child(3){animation-delay:.4s}.sqc-waiting{align-items:center;gap:8px;display:inline-flex}.sqc-activity{color:var(--sqc-text-muted);font-size:12px}@keyframes sqc-pulse{0%,60%,to{opacity:.25}30%{opacity:1}}.sqc-suggestions{flex-direction:column;gap:7px;display:flex}.sqc-suggestion{border:1px solid var(--sqc-border);background:var(--sqc-bg);width:100%;color:var(--sqc-text);font-family:var(--sqc-font-family);cursor:pointer;text-align:left;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:background .15s,border-color .15s;display:flex}.sqc-suggestion:before{content:\"\";background:var(--sqc-accent-fg);border-radius:50%;flex:none;width:5px;height:5px}.sqc-suggestion:hover{background:var(--sqc-surface);border-color:var(--sqc-border-strong)}.sqc-suggestion:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-composer{border-top:1px solid var(--sqc-border);background:var(--sqc-bg);flex-wrap:wrap;flex-shrink:0;align-items:flex-end;gap:8px;padding:12px 14px;display:flex}.sqc-composer--dropping{outline:2px dashed var(--sqc-accent-color);outline-offset:-4px}.sqc-attachments{flex-wrap:wrap;flex-basis:100%;gap:6px;display:flex}.sqc-attachments--sent{margin-top:8px}.sqc-chip{border:1px solid var(--sqc-border);background:var(--sqc-selected);max-width:100%;color:var(--sqc-text);border-radius:999px;align-items:center;gap:4px;padding:3px 4px 3px 10px;font-size:12px;display:inline-flex}.sqc-chip--waiting{opacity:.6;padding-right:10px}.sqc-chip__name{text-overflow:ellipsis;white-space:nowrap;max-width:180px;overflow:hidden}.sqc-chip__remove{width:18px;height:18px;color:var(--sqc-text-muted);cursor:pointer;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;padding:0;font-size:14px;line-height:1;display:inline-flex}.sqc-chip__remove:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-attachments__error{color:var(--sqc-error-600);flex-basis:100%;margin:0;font-size:12px}.sqc-attachment__image{border-radius:12px;max-width:100%;max-height:180px;display:block}.sqc-attachment__chart{flex-basis:100%;min-width:0}.sqc-file-input{display:none}.sqc-btn--attach{color:var(--sqc-text-muted);background:0 0}.sqc-btn--attach:hover{background:var(--sqc-selected);color:var(--sqc-text)}.sqc-composer__field{flex:1;min-width:0;position:relative}.sqc-composer__input{border:1px solid var(--sqc-border-strong);background:var(--sqc-bg);width:100%;min-height:38px;max-height:132px;color:var(--sqc-text);font-family:var(--sqc-font-family);resize:none;border-radius:12px;outline:none;padding:9px 12px;font-size:13.5px;line-height:1.4;transition:border-color .15s,box-shadow .15s;display:block;overflow-y:hidden}.sqc-composer__input::placeholder{color:var(--sqc-neutral-400)}.sqc-composer__input:focus{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input)}.sqc-mentions{z-index:2;border:1px solid var(--sqc-border);background:var(--sqc-bg);max-height:184px;box-shadow:var(--sqc-shadow);scrollbar-width:thin;border-radius:12px;margin:0;padding:4px;list-style:none;position:absolute;bottom:calc(100% + 6px);left:0;right:0;overflow-y:auto}.sqc-mention{cursor:pointer;color:var(--sqc-text);border-radius:8px;align-items:baseline;gap:6px;padding:6px 8px;font-size:12.5px;display:flex}.sqc-mention--active{background:var(--sqc-neutral-100)}.sqc-mention__icon{flex-shrink:0}.sqc-mention__handle{font-weight:600}.sqc-mention__name{text-overflow:ellipsis;white-space:nowrap;color:var(--sqc-text-muted);overflow:hidden}.sqc-composer__count{color:var(--sqc-text-muted);pointer-events:none;font-variant-numeric:tabular-nums;font-size:10px;position:absolute;bottom:4px;right:8px}.sqc-btn{cursor:pointer;border:none;border-radius:12px;flex-shrink:0;place-items:center;width:38px;height:38px;transition:background .15s,opacity .15s;display:grid}.sqc-btn svg{width:17px;height:17px}.sqc-btn--send{background:var(--sqc-accent-color);color:var(--sqc-on-accent)}.sqc-btn--send:hover:not(:disabled){background:var(--sqc-accent-hover)}.sqc-btn--send:disabled{background:var(--sqc-disabled);color:#fff;cursor:not-allowed}.sqc-btn--stop{background:var(--sqc-bg);color:var(--sqc-text);border:1px solid var(--sqc-border)}.sqc-btn--stop:hover{border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-hint{padding:0 16px max(9px, env(safe-area-inset-bottom));color:var(--sqc-text-muted);text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered{padding:0 16px max(9px, env(safe-area-inset-bottom));text-align:center;flex-shrink:0;margin:0;font-size:10.5px;line-height:1.35}.sqc-powered a{color:var(--sqc-text-muted);text-decoration:none}.sqc-powered a:hover{text-decoration:underline}@media (max-width:520px){.sqc{--sqc-width:100vw}.sqc-panel{border-left:none}.sqc-launcher{bottom:16px;right:16px}.sqc[data-position=bottom-left] .sqc-launcher{left:16px}.sqc[data-layout=floating] .sqc-panel,.sqc[data-layout=floating][data-position=bottom-left] .sqc-panel{border:none;border-radius:0;max-width:none;height:auto;max-height:none;top:0;bottom:0;left:0;right:0}}@media (prefers-reduced-motion:reduce){.sqc-launcher,.sqc-panel,.sqc-btn,.sqc-suggestion,.sqc-choice,.sqc-confirm__btn,.sqc-icon-btn,.sqc-icon-btn[data-tip]:after,.sqc-rail__item:before,.sqc-rail__item[data-tip]:after,.sqc-rail__item .sqc-avatar{transition:none}.sqc-typing i,.sqc-caret{animation:none}}.sqc-with-human{border:1px solid var(--sqc-border);background:var(--sqc-selected);color:var(--sqc-neutral-600);border-radius:12px;margin:8px 0 0;padding:8px 12px;font-size:13px}", at = "squadico-chatbot", ot = [
|
|
1751
1780
|
"embed-key",
|
|
1752
1781
|
"context",
|
|
1753
1782
|
"user",
|
|
@@ -1767,21 +1796,21 @@ var rt = ":host{--sqc-width:min(392px, 100vw);--sqc-height:640px;--sqc-z:2147480
|
|
|
1767
1796
|
"persist-open",
|
|
1768
1797
|
"show-context",
|
|
1769
1798
|
"locale"
|
|
1770
|
-
],
|
|
1771
|
-
function
|
|
1772
|
-
if (
|
|
1799
|
+
], st;
|
|
1800
|
+
function ct() {
|
|
1801
|
+
if (st !== void 0) return st;
|
|
1773
1802
|
try {
|
|
1774
1803
|
let e = new CSSStyleSheet();
|
|
1775
|
-
e.replaceSync(
|
|
1804
|
+
e.replaceSync(it), st = e;
|
|
1776
1805
|
} catch {
|
|
1777
|
-
|
|
1806
|
+
st = null;
|
|
1778
1807
|
}
|
|
1779
|
-
return
|
|
1808
|
+
return st;
|
|
1780
1809
|
}
|
|
1781
|
-
function
|
|
1782
|
-
typeof console < "u" && console.warn(`[${
|
|
1810
|
+
function lt(e, t) {
|
|
1811
|
+
typeof console < "u" && console.warn(`[${at}] ${e}`, t ?? "");
|
|
1783
1812
|
}
|
|
1784
|
-
function
|
|
1813
|
+
function ut(e) {
|
|
1785
1814
|
if (!(!e || !e.trim())) try {
|
|
1786
1815
|
let t = JSON.parse(e);
|
|
1787
1816
|
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
@@ -1792,80 +1821,81 @@ function lt(e) {
|
|
|
1792
1821
|
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
1793
1822
|
};
|
|
1794
1823
|
}
|
|
1795
|
-
|
|
1824
|
+
lt("the \"user\" attribute needs an object with an id", e);
|
|
1796
1825
|
} catch (e) {
|
|
1797
|
-
|
|
1826
|
+
lt("the \"user\" attribute is not valid JSON", e);
|
|
1798
1827
|
}
|
|
1799
1828
|
}
|
|
1800
|
-
function
|
|
1829
|
+
function dt(e) {
|
|
1801
1830
|
if (!(!e || !e.trim())) try {
|
|
1802
1831
|
let t = JSON.parse(e);
|
|
1803
1832
|
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
1804
|
-
|
|
1833
|
+
lt("the `context` attribute must be a JSON object", e);
|
|
1805
1834
|
} catch (e) {
|
|
1806
|
-
|
|
1835
|
+
lt("the `context` attribute is not valid JSON", e);
|
|
1807
1836
|
}
|
|
1808
1837
|
}
|
|
1809
|
-
function
|
|
1838
|
+
function ft(e) {
|
|
1810
1839
|
if (!(!e || !e.trim())) {
|
|
1811
1840
|
if (e.trim().startsWith("[")) try {
|
|
1812
1841
|
let t = JSON.parse(e);
|
|
1813
1842
|
if (Array.isArray(t)) return t.map(String);
|
|
1814
1843
|
} catch (e) {
|
|
1815
|
-
|
|
1844
|
+
lt("the `suggestions` attribute is not valid JSON", e);
|
|
1816
1845
|
return;
|
|
1817
1846
|
}
|
|
1818
1847
|
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
1819
1848
|
}
|
|
1820
1849
|
}
|
|
1821
|
-
function
|
|
1850
|
+
function pt(e) {
|
|
1822
1851
|
if (e !== null) return e !== "false" && e !== "0";
|
|
1823
1852
|
}
|
|
1824
|
-
function
|
|
1853
|
+
function mt(e) {
|
|
1825
1854
|
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
1826
1855
|
}
|
|
1827
|
-
function
|
|
1856
|
+
function ht(e) {
|
|
1828
1857
|
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
1829
1858
|
}
|
|
1830
|
-
function
|
|
1859
|
+
function gt(e) {
|
|
1831
1860
|
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
1832
1861
|
}
|
|
1833
|
-
var
|
|
1862
|
+
var _t = [
|
|
1834
1863
|
"context",
|
|
1835
1864
|
"embedKey",
|
|
1836
1865
|
"user",
|
|
1866
|
+
"scope",
|
|
1837
1867
|
"getSubjectToken",
|
|
1838
1868
|
"agent"
|
|
1839
1869
|
];
|
|
1840
|
-
function
|
|
1841
|
-
var e, t, r, i, a, o, d, p, h, g, _, v, y, b;
|
|
1842
|
-
return t = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new
|
|
1870
|
+
function vt() {
|
|
1871
|
+
var e, t, r, i, a, o, d, p, h, g, _, v, y, b, x;
|
|
1872
|
+
return t = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakSet(), b = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
|
|
1843
1873
|
constructor() {
|
|
1844
|
-
super(), u(this,
|
|
1874
|
+
super(), u(this, y), f(this, t, void 0), f(this, r, null), f(this, i, !1), f(this, a, !1), f(this, o, ""), f(this, d, void 0), f(this, p, void 0), f(this, h, void 0), f(this, g, void 0), f(this, _, void 0), f(this, v, void 0), f(this, b, (e) => {
|
|
1845
1875
|
let { type: t, ...n } = e;
|
|
1846
1876
|
s(o, this, n.sessionId), this.dispatchEvent(new CustomEvent(t, {
|
|
1847
1877
|
detail: n,
|
|
1848
1878
|
bubbles: !0,
|
|
1849
1879
|
composed: !0
|
|
1850
1880
|
}));
|
|
1851
|
-
}), f(this,
|
|
1881
|
+
}), f(this, x, (e) => {
|
|
1852
1882
|
s(r, this, e), e && s(o, this, e.sessionId());
|
|
1853
1883
|
});
|
|
1854
|
-
let e = this.attachShadow({ mode: "open" }), n =
|
|
1884
|
+
let e = this.attachShadow({ mode: "open" }), n = ct();
|
|
1855
1885
|
if (n) e.adoptedStyleSheets = [n];
|
|
1856
1886
|
else {
|
|
1857
1887
|
let t = document.createElement("style");
|
|
1858
|
-
t.textContent =
|
|
1888
|
+
t.textContent = it, e.append(t);
|
|
1859
1889
|
}
|
|
1860
1890
|
s(t, this, document.createElement("div")), e.append(c(t, this));
|
|
1861
|
-
for (let e of
|
|
1891
|
+
for (let e of _t) {
|
|
1862
1892
|
if (!Object.hasOwn(this, e)) continue;
|
|
1863
1893
|
let t = this[e];
|
|
1864
1894
|
delete this[e], this[e] = t;
|
|
1865
1895
|
}
|
|
1866
1896
|
}
|
|
1867
1897
|
connectedCallback() {
|
|
1868
|
-
s(a, this, !0), m(
|
|
1898
|
+
s(a, this, !0), m(y, this, C).call(this);
|
|
1869
1899
|
}
|
|
1870
1900
|
disconnectedCallback() {
|
|
1871
1901
|
s(a, this, !1), n(null, c(t, this)), s(r, this, null);
|
|
@@ -1873,44 +1903,50 @@ function _t() {
|
|
|
1873
1903
|
attributeChangedCallback(e, t, n) {
|
|
1874
1904
|
if (t !== n) {
|
|
1875
1905
|
if (e === "open" && c(r, this)) {
|
|
1876
|
-
|
|
1906
|
+
pt(n) ? c(r, this).open() : c(r, this).close();
|
|
1877
1907
|
return;
|
|
1878
1908
|
}
|
|
1879
|
-
m(
|
|
1909
|
+
m(y, this, S).call(this);
|
|
1880
1910
|
}
|
|
1881
1911
|
}
|
|
1882
1912
|
get context() {
|
|
1883
|
-
return c(d, this) ??
|
|
1913
|
+
return c(d, this) ?? dt(this.getAttribute("context"));
|
|
1884
1914
|
}
|
|
1885
1915
|
set context(e) {
|
|
1886
|
-
s(d, this, e), m(
|
|
1916
|
+
s(d, this, e), m(y, this, S).call(this);
|
|
1887
1917
|
}
|
|
1888
1918
|
get embedKey() {
|
|
1889
|
-
return c(
|
|
1919
|
+
return c(v, this) ?? this.getAttribute("embed-key") ?? void 0;
|
|
1890
1920
|
}
|
|
1891
1921
|
set embedKey(e) {
|
|
1892
|
-
s(
|
|
1922
|
+
s(v, this, e), m(y, this, S).call(this);
|
|
1923
|
+
}
|
|
1924
|
+
get scope() {
|
|
1925
|
+
return c(h, this);
|
|
1926
|
+
}
|
|
1927
|
+
set scope(e) {
|
|
1928
|
+
s(h, this, e), m(y, this, S).call(this);
|
|
1893
1929
|
}
|
|
1894
1930
|
get user() {
|
|
1895
|
-
return c(p, this) ??
|
|
1931
|
+
return c(p, this) ?? ut(this.getAttribute("user"));
|
|
1896
1932
|
}
|
|
1897
1933
|
set user(e) {
|
|
1898
|
-
s(p, this, e), m(
|
|
1934
|
+
s(p, this, e), m(y, this, S).call(this);
|
|
1899
1935
|
}
|
|
1900
1936
|
get getSubjectToken() {
|
|
1901
|
-
return c(
|
|
1937
|
+
return c(g, this);
|
|
1902
1938
|
}
|
|
1903
1939
|
set getSubjectToken(e) {
|
|
1904
|
-
s(
|
|
1940
|
+
s(g, this, e), m(y, this, S).call(this);
|
|
1905
1941
|
}
|
|
1906
1942
|
get agent() {
|
|
1907
|
-
return c(
|
|
1943
|
+
return c(_, this) ?? this.getAttribute("agent") ?? void 0;
|
|
1908
1944
|
}
|
|
1909
1945
|
set agent(e) {
|
|
1910
|
-
s(
|
|
1946
|
+
s(_, this, e), m(y, this, S).call(this);
|
|
1911
1947
|
}
|
|
1912
1948
|
get open() {
|
|
1913
|
-
return c(r, this)?.isOpen() ??
|
|
1949
|
+
return c(r, this)?.isOpen() ?? pt(this.getAttribute("open")) ?? !1;
|
|
1914
1950
|
}
|
|
1915
1951
|
set open(e) {
|
|
1916
1952
|
e ? this.openChat() : this.closeChat();
|
|
@@ -1932,23 +1968,24 @@ function _t() {
|
|
|
1932
1968
|
}
|
|
1933
1969
|
sendMessage(e) {
|
|
1934
1970
|
if (!c(r, this)) {
|
|
1935
|
-
|
|
1971
|
+
lt("sendMessage() called before the component was mounted — ignored");
|
|
1936
1972
|
return;
|
|
1937
1973
|
}
|
|
1938
1974
|
c(r, this).send(e);
|
|
1939
1975
|
}
|
|
1940
|
-
},
|
|
1941
|
-
function
|
|
1976
|
+
}, F(e, "observedAttributes", ot), e;
|
|
1977
|
+
function S() {
|
|
1942
1978
|
c(i, this) || !c(a, this) || (s(i, this, !0), queueMicrotask(() => {
|
|
1943
|
-
s(i, this, !1), c(a, this) && m(
|
|
1979
|
+
s(i, this, !1), c(a, this) && m(y, this, C).call(this);
|
|
1944
1980
|
}));
|
|
1945
1981
|
}
|
|
1946
|
-
function
|
|
1982
|
+
function C() {
|
|
1947
1983
|
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
1948
|
-
n(/* @__PURE__ */ l(
|
|
1984
|
+
n(/* @__PURE__ */ l(rt, {
|
|
1949
1985
|
embedKey: this.embedKey,
|
|
1950
1986
|
context: this.context,
|
|
1951
1987
|
user: this.user,
|
|
1988
|
+
scope: this.scope,
|
|
1952
1989
|
getSubjectToken: this.getSubjectToken,
|
|
1953
1990
|
agent: this.agent,
|
|
1954
1991
|
heading: e("heading"),
|
|
@@ -1956,29 +1993,29 @@ function _t() {
|
|
|
1956
1993
|
assistantName: e("assistant-name"),
|
|
1957
1994
|
placeholder: e("placeholder"),
|
|
1958
1995
|
greeting: e("greeting"),
|
|
1959
|
-
suggestions:
|
|
1996
|
+
suggestions: ft(this.getAttribute("suggestions")),
|
|
1960
1997
|
width: e("width"),
|
|
1961
1998
|
accent: e("accent"),
|
|
1962
|
-
theme:
|
|
1963
|
-
position:
|
|
1964
|
-
layout:
|
|
1965
|
-
defaultOpen:
|
|
1966
|
-
persistOpen:
|
|
1967
|
-
showContext:
|
|
1999
|
+
theme: mt(this.getAttribute("theme")),
|
|
2000
|
+
position: ht(this.getAttribute("position")),
|
|
2001
|
+
layout: gt(this.getAttribute("layout")),
|
|
2002
|
+
defaultOpen: pt(this.getAttribute("open")) ?? !1,
|
|
2003
|
+
persistOpen: pt(this.getAttribute("persist-open")) ?? !0,
|
|
2004
|
+
showContext: pt(this.getAttribute("show-context")) ?? !0,
|
|
1968
2005
|
locale: e("locale"),
|
|
1969
|
-
onEvent: c(
|
|
1970
|
-
bind: c(
|
|
2006
|
+
onEvent: c(b, this),
|
|
2007
|
+
bind: c(x, this)
|
|
1971
2008
|
}), c(t, this));
|
|
1972
2009
|
}
|
|
1973
2010
|
}
|
|
1974
|
-
var
|
|
1975
|
-
function
|
|
1976
|
-
typeof window > "u" || typeof HTMLElement > "u" || (
|
|
2011
|
+
var yt;
|
|
2012
|
+
function bt(e = at) {
|
|
2013
|
+
typeof window > "u" || typeof HTMLElement > "u" || (yt ?? (yt = vt()), window.customElements.get(e) || window.customElements.define(e, yt));
|
|
1977
2014
|
}
|
|
1978
2015
|
//#endregion
|
|
1979
2016
|
//#region src/index.ts
|
|
1980
|
-
|
|
2017
|
+
bt();
|
|
1981
2018
|
//#endregion
|
|
1982
|
-
export {
|
|
2019
|
+
export { L as a, R as i, bt as n, O as o, I as r, at as t };
|
|
1983
2020
|
|
|
1984
|
-
//# sourceMappingURL=src-
|
|
2021
|
+
//# sourceMappingURL=src-B7GLD1Xs.js.map
|