@squadico/chatbot 1.1.2 → 1.1.3
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 +10 -5
- package/dist/chatbot.global.js +7 -7
- package/dist/chatbot.global.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/client.d.ts +26 -1
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts +4 -3
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.js +1 -1
- package/dist/{src-2UbcV1gc.js → src-D6ZMGuKC.js} +377 -309
- package/dist/src-D6ZMGuKC.js.map +1 -0
- package/dist/src-DeXNeWwe.cjs +8 -0
- package/dist/src-DeXNeWwe.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/src-2UbcV1gc.js.map +0 -1
- package/dist/src-DNagSAPN.cjs +0 -8
- package/dist/src-DNagSAPN.cjs.map +0 -1
|
@@ -45,7 +45,7 @@ function w(e, t) {
|
|
|
45
45
|
function T(e) {
|
|
46
46
|
if (e.__P && e.__d) {
|
|
47
47
|
var n = e.__v, r = n.__e, i = [], a = [], o = v({}, n);
|
|
48
|
-
o.__v = n.__v + 1, t.vnode && t.vnode(o),
|
|
48
|
+
o.__v = n.__v + 1, t.vnode && t.vnode(o), I(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? w(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, R(i, o, a), n.__e = n.__ = null, o.__e != r && E(o);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function E(e) {
|
|
@@ -65,13 +65,13 @@ function O() {
|
|
|
65
65
|
}
|
|
66
66
|
function k(e, t, n, r, i, a, o, s, c, l, u) {
|
|
67
67
|
var d, f, p, g, _, v, y = r && r.__k || h, b = t.length;
|
|
68
|
-
for (c = A(n, t, y, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && y[p.__i] || m, p.__i = d, v =
|
|
68
|
+
for (c = A(n, t, y, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && y[p.__i] || m, p.__i = d, v = I(e, p, f, i, a, o, s, c, l, u), g = p.__e, p.ref && f.ref != p.ref && (f.ref && te(f.ref, null, p), u.push(p.ref, p.__c || g, p)), _ == null && g != null && (_ = g), 4 & p.__u ? (c = j(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && v !== void 0 ? c = v : g && (c = g.nextSibling), p.__u &= -7);
|
|
69
69
|
return n.__e = _, c;
|
|
70
70
|
}
|
|
71
71
|
function A(e, t, n, r, i) {
|
|
72
72
|
var a, o, s, c, l, u = n.length, d = u, f = 0;
|
|
73
73
|
for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = x(null, o, null, null, null) : _(o) ? o = e.__k[a] = x(S, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = x(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = M(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
|
|
74
|
-
if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = w(s)),
|
|
74
|
+
if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = w(s)), ne(s, s));
|
|
75
75
|
return r;
|
|
76
76
|
}
|
|
77
77
|
function j(e, t, n) {
|
|
@@ -125,7 +125,7 @@ function F(e) {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function I(e, n, r, i, a, o, s, c, l, u) {
|
|
129
129
|
var d, f, p, m, g, b, x, T, E, D, O, A, j, M, N, P, F = n.type;
|
|
130
130
|
if (n.constructor !== void 0) return null;
|
|
131
131
|
128 & r.__u && (l = !!(32 & r.__u), o = [c = n.__e = r.__e]), (d = t.__b) && d(n);
|
|
@@ -148,7 +148,7 @@ function ee(e, n, r, i, a, o, s, c, l, u) {
|
|
|
148
148
|
else do
|
|
149
149
|
p.__d = !1, j && j(n), d = p.render(p.props, p.state, p.context), p.state = p.__s;
|
|
150
150
|
while (p.__d && ++M < 25);
|
|
151
|
-
p.state = p.__s, p.getChildContext != null && (i = v(v({}, i), p.getChildContext())), D && !m && p.getSnapshotBeforeUpdate != null && (x = p.getSnapshotBeforeUpdate(g, b)), N = d != null && d.type === S && d.key == null ?
|
|
151
|
+
p.state = p.__s, p.getChildContext != null && (i = v(v({}, i), p.getChildContext())), D && !m && p.getSnapshotBeforeUpdate != null && (x = p.getSnapshotBeforeUpdate(g, b)), N = d != null && d.type === S && d.key == null ? ee(d.props.children) : d, c = k(e, _(N) ? N : [N], n, r, i, a, o, s, c, l, u), p.base = n.__e, n.__u &= -161, p.__h.length && s.push(p), T && (p.__E = p.__ = null);
|
|
152
152
|
} catch (e) {
|
|
153
153
|
if (s.length = f, n.__v = null, l || o != null) {
|
|
154
154
|
if (e.then) {
|
|
@@ -156,16 +156,16 @@ function ee(e, n, r, i, a, o, s, c, l, u) {
|
|
|
156
156
|
o != null && (o[o.indexOf(c)] = null), n.__e = c;
|
|
157
157
|
} else if (o != null) for (P = o.length; P--;) y(o[P]);
|
|
158
158
|
} else n.__e = r.__e;
|
|
159
|
-
n.__k ?? (n.__k = r.__k || []), e.then ||
|
|
159
|
+
n.__k ?? (n.__k = r.__k || []), e.then || L(n), t.__e(e, n, r);
|
|
160
160
|
}
|
|
161
|
-
} else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e =
|
|
161
|
+
} else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e = z(r.__e, n, r, i, a, o, s, l, u);
|
|
162
162
|
return (d = t.diffed) && d(n), 128 & n.__u ? void 0 : c;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(
|
|
164
|
+
function L(e) {
|
|
165
|
+
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(L));
|
|
166
166
|
}
|
|
167
|
-
function
|
|
168
|
-
for (var i = 0; i < r.length; i++)
|
|
167
|
+
function R(e, n, r) {
|
|
168
|
+
for (var i = 0; i < r.length; i++) te(r[i], r[++i], r[++i]);
|
|
169
169
|
t.__c && t.__c(n, e), e.some(function(n) {
|
|
170
170
|
try {
|
|
171
171
|
e = n.__h, n.__h = [], e.some(function(e) {
|
|
@@ -176,10 +176,10 @@ function L(e, n, r) {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
return typeof e != "object" || !e || e.__b > 0 ? e : _(e) ? e.map(
|
|
179
|
+
function ee(e) {
|
|
180
|
+
return typeof e != "object" || !e || e.__b > 0 ? e : _(e) ? e.map(ee) : e.constructor === void 0 ? v({}, e) : null;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function z(n, r, i, a, o, s, c, l, u) {
|
|
183
183
|
var d, f, p, h, g, v, b, x = i.props || m, S = r.props, C = r.type;
|
|
184
184
|
if (C == "svg" ? o = "http://www.w3.org/2000/svg" : C == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
185
185
|
for (d = 0; d < s.length; d++) if ((g = s[d]) && "setAttribute" in g == !!C && (C ? g.localName == C : g.nodeType == 3)) {
|
|
@@ -202,7 +202,7 @@ function R(n, r, i, a, o, s, c, l, u) {
|
|
|
202
202
|
}
|
|
203
203
|
return n;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function te(e, n, r) {
|
|
206
206
|
try {
|
|
207
207
|
if (typeof e == "function") {
|
|
208
208
|
var i = typeof e.__u == "function";
|
|
@@ -212,9 +212,9 @@ function ne(e, n, r) {
|
|
|
212
212
|
t.__e(e, r);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function ne(e, n, r) {
|
|
216
216
|
var i, a;
|
|
217
|
-
if (t.unmount && t.unmount(e), (i = e.ref) && (i.current && i.current != e.__e ||
|
|
217
|
+
if (t.unmount && t.unmount(e), (i = e.ref) && (i.current && i.current != e.__e || te(i, null, n)), (i = e.__c) != null) {
|
|
218
218
|
if (i.componentWillUnmount) try {
|
|
219
219
|
i.componentWillUnmount();
|
|
220
220
|
} catch (e) {
|
|
@@ -222,7 +222,7 @@ function z(e, n, r) {
|
|
|
222
222
|
}
|
|
223
223
|
i.base = i.__P = i.__n = null;
|
|
224
224
|
}
|
|
225
|
-
if (i = e.__k) for (a = 0; a < i.length; a++) i[a] &&
|
|
225
|
+
if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && ne(i[a], n, r || typeof e.type != "function");
|
|
226
226
|
r || y(e.__e), e.__c = e.__ = e.__e = void 0;
|
|
227
227
|
}
|
|
228
228
|
function re(e, t, n) {
|
|
@@ -230,7 +230,7 @@ function re(e, t, n) {
|
|
|
230
230
|
}
|
|
231
231
|
function ie(n, r, i) {
|
|
232
232
|
var a, o, s, c;
|
|
233
|
-
r == document && (r = document.documentElement), t.__ && t.__(n, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [],
|
|
233
|
+
r == document && (r = document.documentElement), t.__ && t.__(n, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [], I(r, n = (!a && i || r).__k = b(S, null, [n]), o || m, m, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? e.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), R(s, n, c), n.props.children = null;
|
|
234
234
|
}
|
|
235
235
|
e = h.slice, t = { __e: function(e, t, n, r) {
|
|
236
236
|
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
|
|
@@ -822,6 +822,22 @@ function it(e) {
|
|
|
822
822
|
};
|
|
823
823
|
}
|
|
824
824
|
async function at(e) {
|
|
825
|
+
let t = e.agent ? `?agent=${encodeURIComponent(e.agent)}` : "", n = await fetch(Je(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}${t}`), {
|
|
826
|
+
method: "GET",
|
|
827
|
+
headers: Ye(),
|
|
828
|
+
signal: e.signal
|
|
829
|
+
});
|
|
830
|
+
if (!n.ok) throw await Ze(n);
|
|
831
|
+
let r = await n.json();
|
|
832
|
+
return {
|
|
833
|
+
welcomeMessage: typeof r.welcome_message == "string" && r.welcome_message ? r.welcome_message : void 0,
|
|
834
|
+
agent: Qe(r.agent),
|
|
835
|
+
handles: $e(r.handles),
|
|
836
|
+
agentHandle: typeof r.agent_handle == "string" && r.agent_handle ? r.agent_handle : void 0,
|
|
837
|
+
branding: r.branding === !0
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
async function ot(e) {
|
|
825
841
|
let t = await fetch(Je(e.apiUrl, `/public/applications/${encodeURIComponent(e.embedKey)}/conversations`), {
|
|
826
842
|
method: "POST",
|
|
827
843
|
headers: Ye(),
|
|
@@ -848,7 +864,7 @@ async function at(e) {
|
|
|
848
864
|
branding: n.branding === !0
|
|
849
865
|
};
|
|
850
866
|
}
|
|
851
|
-
async function
|
|
867
|
+
async function st(e) {
|
|
852
868
|
let t = await fetch(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}`), {
|
|
853
869
|
method: "GET",
|
|
854
870
|
headers: Ye(e.visitorToken),
|
|
@@ -870,10 +886,10 @@ async function ot(e) {
|
|
|
870
886
|
branding: n.branding === !0
|
|
871
887
|
};
|
|
872
888
|
}
|
|
873
|
-
async function
|
|
889
|
+
async function ct(e) {
|
|
874
890
|
let t = new FormData();
|
|
875
891
|
t.append("file", e.file);
|
|
876
|
-
let n = await fetch(
|
|
892
|
+
let n = await fetch(dt(e), {
|
|
877
893
|
method: "POST",
|
|
878
894
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
879
895
|
body: t,
|
|
@@ -884,39 +900,39 @@ async function st(e) {
|
|
|
884
900
|
if (!r) throw new J("The upload could not be read", n.status);
|
|
885
901
|
return r;
|
|
886
902
|
}
|
|
887
|
-
async function
|
|
888
|
-
let t = await fetch(`${
|
|
903
|
+
async function lt(e) {
|
|
904
|
+
let t = await fetch(`${dt(e)}/${encodeURIComponent(e.attachmentId)}`, {
|
|
889
905
|
method: "DELETE",
|
|
890
906
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
891
907
|
signal: e.signal
|
|
892
908
|
});
|
|
893
909
|
if (!t.ok) throw await Ze(t);
|
|
894
910
|
}
|
|
895
|
-
async function
|
|
896
|
-
let t = await fetch(`${
|
|
911
|
+
async function ut(e) {
|
|
912
|
+
let t = await fetch(`${dt(e)}/${encodeURIComponent(e.attachmentId)}/content`, {
|
|
897
913
|
headers: { "X-Visitor-Token": e.visitorToken },
|
|
898
914
|
signal: e.signal
|
|
899
915
|
});
|
|
900
916
|
if (!t.ok) throw await Ze(t);
|
|
901
917
|
return t.blob();
|
|
902
918
|
}
|
|
903
|
-
function
|
|
919
|
+
function dt(e) {
|
|
904
920
|
return Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/attachments`);
|
|
905
921
|
}
|
|
906
|
-
async function
|
|
907
|
-
return
|
|
922
|
+
async function ft(e) {
|
|
923
|
+
return mt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/messages`), {
|
|
908
924
|
content: e.message,
|
|
909
925
|
attachment_ids: e.attachmentIds ?? [],
|
|
910
926
|
...e.context && Object.keys(e.context).length > 0 ? { context: e.context } : {}
|
|
911
927
|
}, e);
|
|
912
928
|
}
|
|
913
|
-
async function
|
|
914
|
-
return
|
|
929
|
+
async function pt(e) {
|
|
930
|
+
return mt(Je(e.apiUrl, `/public/conversations/${encodeURIComponent(e.conversationId)}/approvals`), {
|
|
915
931
|
tool_call_id: e.toolCallId,
|
|
916
932
|
approved: e.approved
|
|
917
933
|
}, e);
|
|
918
934
|
}
|
|
919
|
-
async function
|
|
935
|
+
async function mt(e, t, n) {
|
|
920
936
|
let r = await fetch(e, {
|
|
921
937
|
method: "POST",
|
|
922
938
|
headers: Ye(n.visitorToken, n.subjectToken),
|
|
@@ -964,11 +980,11 @@ async function pt(e, t, n) {
|
|
|
964
980
|
}
|
|
965
981
|
//#endregion
|
|
966
982
|
//#region src/lib/conversation.ts
|
|
967
|
-
var
|
|
968
|
-
function
|
|
983
|
+
var ht = "squadico-chatbot:conversation";
|
|
984
|
+
function gt() {
|
|
969
985
|
try {
|
|
970
986
|
if (typeof sessionStorage > "u") return;
|
|
971
|
-
let e = sessionStorage.getItem(
|
|
987
|
+
let e = sessionStorage.getItem(ht);
|
|
972
988
|
if (!e) return;
|
|
973
989
|
let t = JSON.parse(e);
|
|
974
990
|
return !t.sessionId || !t.visitorToken || !t.embedKey ? void 0 : {
|
|
@@ -981,102 +997,154 @@ function ht() {
|
|
|
981
997
|
return;
|
|
982
998
|
}
|
|
983
999
|
}
|
|
984
|
-
function
|
|
1000
|
+
function _t(e) {
|
|
985
1001
|
try {
|
|
986
1002
|
if (typeof sessionStorage > "u") return;
|
|
987
|
-
sessionStorage.setItem(
|
|
1003
|
+
sessionStorage.setItem(ht, JSON.stringify(e));
|
|
988
1004
|
} catch {}
|
|
989
1005
|
}
|
|
990
|
-
function
|
|
1006
|
+
function vt() {
|
|
991
1007
|
try {
|
|
992
1008
|
if (typeof sessionStorage > "u") return;
|
|
993
|
-
sessionStorage.removeItem(
|
|
1009
|
+
sessionStorage.removeItem(ht);
|
|
994
1010
|
} catch {}
|
|
995
1011
|
}
|
|
996
|
-
function
|
|
1012
|
+
function yt(e, { embedKey: t, user: n }) {
|
|
997
1013
|
return e.embedKey === t && e.user === n;
|
|
998
1014
|
}
|
|
999
1015
|
//#endregion
|
|
1000
1016
|
//#region src/lib/useChat.ts
|
|
1001
|
-
async function
|
|
1017
|
+
async function bt(e) {
|
|
1002
1018
|
if (e) try {
|
|
1003
1019
|
return await e() || void 0;
|
|
1004
1020
|
} catch {
|
|
1005
1021
|
return;
|
|
1006
1022
|
}
|
|
1007
1023
|
}
|
|
1008
|
-
|
|
1024
|
+
var xt = "preview-welcome";
|
|
1025
|
+
function St(e) {
|
|
1009
1026
|
let t = e instanceof J ? e.status : void 0;
|
|
1010
1027
|
return t === 415 ? "unsupported" : t === 413 ? "tooLarge" : t === 409 ? "tooMany" : t === 422 ? "unreadable" : "failed";
|
|
1011
1028
|
}
|
|
1012
|
-
var
|
|
1013
|
-
function
|
|
1029
|
+
var Ct = 5e3;
|
|
1030
|
+
function wt(e) {
|
|
1014
1031
|
return e instanceof J && e.code === "conversation_retired";
|
|
1015
1032
|
}
|
|
1016
|
-
function
|
|
1033
|
+
function Tt(e) {
|
|
1017
1034
|
let [t, n] = U([]), [r, i] = U(!1), [a, o] = U(""), [s, c] = U([]), [l, u] = U(""), [d, f] = U(null), [p, m] = U(!1), [h, g] = U(!1), [_, v] = U([]), [y, b] = U([]), [x, S] = U(null), C = G(null), w = G(e);
|
|
1018
1035
|
w.current = e;
|
|
1019
|
-
let T = G(null), E = G(null), D = G(void 0),
|
|
1036
|
+
let T = G(null), E = G(null), D = G(null), O = G(null), k = G(void 0), A = e.greeting, j = K(() => A ? {
|
|
1020
1037
|
id: "greeting",
|
|
1021
1038
|
role: "assistant",
|
|
1022
|
-
content:
|
|
1039
|
+
content: A,
|
|
1023
1040
|
createdAt: Date.now()
|
|
1024
|
-
} : null, [
|
|
1041
|
+
} : null, [A]), M = q((e) => {
|
|
1025
1042
|
w.current.onEvent?.(e);
|
|
1026
|
-
}, []),
|
|
1043
|
+
}, []), N = q((e, t) => {
|
|
1027
1044
|
n((n) => n.map((n) => n.id === e ? {
|
|
1028
1045
|
...n,
|
|
1029
1046
|
...t
|
|
1030
1047
|
} : n));
|
|
1031
|
-
}, []),
|
|
1048
|
+
}, []), P = q((e, t) => {
|
|
1032
1049
|
let n = e instanceof J ? e.status : void 0, r = e instanceof Error ? e.message : String(e), i = (w.current.locale ?? Ie(void 0)).t.error;
|
|
1033
|
-
t &&
|
|
1050
|
+
t && N(t, {
|
|
1034
1051
|
content: i,
|
|
1035
1052
|
streaming: !1,
|
|
1036
1053
|
error: !0
|
|
1037
|
-
}),
|
|
1054
|
+
}), M({
|
|
1038
1055
|
type: "chatbot-error",
|
|
1039
1056
|
message: r,
|
|
1040
1057
|
status: n,
|
|
1041
1058
|
sessionId: E.current?.sessionId ?? ""
|
|
1042
1059
|
}), typeof console < "u" && console.error("[squadico-chatbot]", r);
|
|
1043
|
-
}, [
|
|
1044
|
-
if (E.current) return E.current;
|
|
1045
|
-
if (T.current) return T.current;
|
|
1060
|
+
}, [M, N]), F = q(() => {
|
|
1046
1061
|
let e = w.current;
|
|
1047
1062
|
if (!e.embedKey) throw new J("No embed key: nothing says which application to open");
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
}).
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
})
|
|
1071
|
-
|
|
1063
|
+
return {
|
|
1064
|
+
opts: e,
|
|
1065
|
+
apiUrl: e.apiUrl ?? "https://api.squadico.com",
|
|
1066
|
+
embedKey: e.embedKey,
|
|
1067
|
+
claim: e.user
|
|
1068
|
+
};
|
|
1069
|
+
}, []), I = q((e, t) => {
|
|
1070
|
+
let r = {
|
|
1071
|
+
sessionId: t.conversationId,
|
|
1072
|
+
visitorToken: t.visitorToken
|
|
1073
|
+
};
|
|
1074
|
+
return E.current = r, k.current = e.claim?.id, _t({
|
|
1075
|
+
...r,
|
|
1076
|
+
embedKey: e.embedKey,
|
|
1077
|
+
user: e.claim?.id
|
|
1078
|
+
}), o(t.conversationId), c(t.handles), u(e.opts.agent && t.agentHandle ? t.agentHandle : ""), m(!!t.withHuman), g(t.branding), n((e) => [...t.messages, ...e.filter((e) => e.id !== xt)]), r;
|
|
1079
|
+
}, []), L = q((e) => {
|
|
1080
|
+
if (D.current) return D.current;
|
|
1081
|
+
let t = gt();
|
|
1082
|
+
if (!t || !yt(t, {
|
|
1083
|
+
embedKey: e.embedKey,
|
|
1084
|
+
user: e.claim?.id
|
|
1085
|
+
})) return Promise.resolve(null);
|
|
1086
|
+
let n = st({
|
|
1087
|
+
apiUrl: e.apiUrl,
|
|
1088
|
+
conversationId: t.sessionId,
|
|
1089
|
+
visitorToken: t.visitorToken
|
|
1090
|
+
}).then((t) => I(e, t)).catch(() => (vt(), null)).finally(() => {
|
|
1091
|
+
D.current = null;
|
|
1092
|
+
});
|
|
1093
|
+
return D.current = n, n;
|
|
1094
|
+
}, [I]), R = q(async () => {
|
|
1095
|
+
if (E.current) return E.current;
|
|
1096
|
+
if (T.current) return T.current;
|
|
1097
|
+
let e = F(), t = L(e).then((t) => t ?? ot({
|
|
1098
|
+
apiUrl: e.apiUrl,
|
|
1099
|
+
embedKey: e.embedKey,
|
|
1100
|
+
user: e.claim,
|
|
1101
|
+
agent: e.opts.agent
|
|
1102
|
+
}).then((t) => I(e, t)));
|
|
1103
|
+
T.current = t;
|
|
1072
1104
|
try {
|
|
1073
|
-
return await
|
|
1105
|
+
return await t;
|
|
1074
1106
|
} finally {
|
|
1075
1107
|
T.current = null;
|
|
1076
1108
|
}
|
|
1077
|
-
}, [
|
|
1078
|
-
|
|
1079
|
-
|
|
1109
|
+
}, [
|
|
1110
|
+
I,
|
|
1111
|
+
L,
|
|
1112
|
+
F
|
|
1113
|
+
]), ee = q(() => {
|
|
1114
|
+
if (E.current || T.current || O.current) return;
|
|
1115
|
+
let e;
|
|
1116
|
+
try {
|
|
1117
|
+
e = F();
|
|
1118
|
+
} catch (e) {
|
|
1119
|
+
P(e);
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1122
|
+
let t = L(e).then(async (t) => {
|
|
1123
|
+
if (t || E.current || T.current) return;
|
|
1124
|
+
let r = await at({
|
|
1125
|
+
apiUrl: e.apiUrl,
|
|
1126
|
+
embedKey: e.embedKey,
|
|
1127
|
+
agent: e.opts.agent
|
|
1128
|
+
});
|
|
1129
|
+
if (E.current || T.current) return;
|
|
1130
|
+
c(r.handles), u(e.opts.agent && r.agentHandle ? r.agentHandle : ""), g(r.branding);
|
|
1131
|
+
let i = r.welcomeMessage;
|
|
1132
|
+
i && n((e) => e.length > 0 ? e : [{
|
|
1133
|
+
id: xt,
|
|
1134
|
+
role: "assistant",
|
|
1135
|
+
content: i,
|
|
1136
|
+
createdAt: Date.now(),
|
|
1137
|
+
agent: r.agent
|
|
1138
|
+
}]);
|
|
1139
|
+
});
|
|
1140
|
+
O.current = t, t.catch((e) => {
|
|
1141
|
+
O.current = null, P(e);
|
|
1142
|
+
});
|
|
1143
|
+
}, [
|
|
1144
|
+
P,
|
|
1145
|
+
L,
|
|
1146
|
+
F
|
|
1147
|
+
]), z = q((e, t, { retry: r = !1, carried: a = [] } = {}) => {
|
|
1080
1148
|
if (C.current) return;
|
|
1081
1149
|
let o = new AbortController();
|
|
1082
1150
|
C.current = o, i(!0), f(null);
|
|
@@ -1098,27 +1166,27 @@ function Ct(e) {
|
|
|
1098
1166
|
streaming: !0
|
|
1099
1167
|
}
|
|
1100
1168
|
]), (async () => {
|
|
1101
|
-
let i = await
|
|
1102
|
-
|
|
1169
|
+
let i = await R();
|
|
1170
|
+
M({
|
|
1103
1171
|
type: "chatbot-message",
|
|
1104
1172
|
role: "user",
|
|
1105
1173
|
content: e,
|
|
1106
1174
|
sessionId: i.sessionId
|
|
1107
1175
|
});
|
|
1108
1176
|
let a = "", c = (e) => {
|
|
1109
|
-
a += e,
|
|
1177
|
+
a += e, N(s, { content: a });
|
|
1110
1178
|
}, l;
|
|
1111
1179
|
try {
|
|
1112
1180
|
l = await t(i, c, o.signal);
|
|
1113
1181
|
} catch (e) {
|
|
1114
|
-
if (!
|
|
1115
|
-
i = await
|
|
1182
|
+
if (!wt(e) || (vt(), E.current = null, T.current = null, !r)) throw e;
|
|
1183
|
+
i = await R(), a = "", N(s, { content: "" }), l = await t(i, c, o.signal);
|
|
1116
1184
|
}
|
|
1117
1185
|
if (l.withHuman && m(!0), l.held) {
|
|
1118
1186
|
n((e) => e.filter((e) => e.id !== s));
|
|
1119
1187
|
return;
|
|
1120
1188
|
}
|
|
1121
|
-
|
|
1189
|
+
N(s, {
|
|
1122
1190
|
content: l.answer,
|
|
1123
1191
|
streaming: !1,
|
|
1124
1192
|
agent: l.agent,
|
|
@@ -1126,7 +1194,7 @@ function Ct(e) {
|
|
|
1126
1194
|
approval: l.approval,
|
|
1127
1195
|
unknownHandle: l.unknownHandle,
|
|
1128
1196
|
offered: l.offered
|
|
1129
|
-
}), f(l.approval ?? null),
|
|
1197
|
+
}), f(l.approval ?? null), M({
|
|
1130
1198
|
type: "chatbot-message",
|
|
1131
1199
|
role: "assistant",
|
|
1132
1200
|
content: l.answer,
|
|
@@ -1135,24 +1203,24 @@ function Ct(e) {
|
|
|
1135
1203
|
});
|
|
1136
1204
|
})().catch((e) => {
|
|
1137
1205
|
if (o.signal.aborted) {
|
|
1138
|
-
|
|
1206
|
+
N(s, { streaming: !1 });
|
|
1139
1207
|
return;
|
|
1140
1208
|
}
|
|
1141
|
-
|
|
1209
|
+
P(e, s);
|
|
1142
1210
|
}).finally(() => {
|
|
1143
1211
|
C.current = null, i(!1);
|
|
1144
1212
|
});
|
|
1145
1213
|
}, [
|
|
1146
|
-
|
|
1147
|
-
A,
|
|
1214
|
+
R,
|
|
1148
1215
|
M,
|
|
1149
|
-
|
|
1150
|
-
|
|
1216
|
+
P,
|
|
1217
|
+
N
|
|
1218
|
+
]), te = q((e) => {
|
|
1151
1219
|
let t = e.trim();
|
|
1152
1220
|
if (!t && _.length === 0) return;
|
|
1153
1221
|
let n = _;
|
|
1154
|
-
v([]), S(null),
|
|
1155
|
-
subjectToken: await
|
|
1222
|
+
v([]), S(null), z(t, async (e, r, i) => ft({
|
|
1223
|
+
subjectToken: await bt(w.current.getSubjectToken),
|
|
1156
1224
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1157
1225
|
conversationId: e.sessionId,
|
|
1158
1226
|
visitorToken: e.visitorToken,
|
|
@@ -1165,38 +1233,38 @@ function Ct(e) {
|
|
|
1165
1233
|
retry: !0,
|
|
1166
1234
|
carried: n
|
|
1167
1235
|
});
|
|
1168
|
-
}, [_,
|
|
1169
|
-
S(null), b((t) => [...t, e.name]),
|
|
1236
|
+
}, [_, z]), ne = q((e) => {
|
|
1237
|
+
S(null), b((t) => [...t, e.name]), R().then((t) => ct({
|
|
1170
1238
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1171
1239
|
conversationId: t.sessionId,
|
|
1172
1240
|
visitorToken: t.visitorToken,
|
|
1173
1241
|
file: e
|
|
1174
|
-
})).then((e) => v((t) => [...t, e])).catch((e) => S(
|
|
1242
|
+
})).then((e) => v((t) => [...t, e])).catch((e) => S(St(e))).finally(() => b((t) => {
|
|
1175
1243
|
let n = t.indexOf(e.name);
|
|
1176
1244
|
return n < 0 ? t : [...t.slice(0, n), ...t.slice(n + 1)];
|
|
1177
1245
|
}));
|
|
1178
|
-
}, [
|
|
1246
|
+
}, [R]), re = q((e) => {
|
|
1179
1247
|
v((t) => t.filter((t) => t.id !== e));
|
|
1180
1248
|
let t = E.current;
|
|
1181
|
-
t &&
|
|
1249
|
+
t && lt({
|
|
1182
1250
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1183
1251
|
conversationId: t.sessionId,
|
|
1184
1252
|
visitorToken: t.visitorToken,
|
|
1185
1253
|
attachmentId: e
|
|
1186
1254
|
}).catch(() => {});
|
|
1187
|
-
}, []),
|
|
1255
|
+
}, []), ie = q(async (e) => {
|
|
1188
1256
|
let t = E.current;
|
|
1189
1257
|
if (!t) throw new J("No conversation to read that file from");
|
|
1190
|
-
return
|
|
1258
|
+
return ut({
|
|
1191
1259
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1192
1260
|
conversationId: t.sessionId,
|
|
1193
1261
|
visitorToken: t.visitorToken,
|
|
1194
1262
|
attachmentId: e
|
|
1195
1263
|
});
|
|
1196
|
-
}, []),
|
|
1264
|
+
}, []), B = q((e, t) => {
|
|
1197
1265
|
let n = d;
|
|
1198
|
-
n &&
|
|
1199
|
-
subjectToken: await
|
|
1266
|
+
n && z(t, async (t, r, i) => pt({
|
|
1267
|
+
subjectToken: await bt(w.current.getSubjectToken),
|
|
1200
1268
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1201
1269
|
conversationId: t.sessionId,
|
|
1202
1270
|
visitorToken: t.visitorToken,
|
|
@@ -1205,37 +1273,37 @@ function Ct(e) {
|
|
|
1205
1273
|
onToken: r,
|
|
1206
1274
|
signal: i
|
|
1207
1275
|
}));
|
|
1208
|
-
}, [d,
|
|
1276
|
+
}, [d, z]), V = q(() => {
|
|
1209
1277
|
C.current?.abort(), C.current = null, i(!1);
|
|
1210
|
-
}, []),
|
|
1211
|
-
C.current?.abort(), C.current = null, E.current = null, T.current = null, D.current = void 0,
|
|
1278
|
+
}, []), ae = q(() => {
|
|
1279
|
+
C.current?.abort(), C.current = null, E.current = null, T.current = null, D.current = null, O.current = null, k.current = void 0, vt(), i(!1), f(null), m(!1), o(""), u(""), n([]), M({
|
|
1212
1280
|
type: "chatbot-reset",
|
|
1213
1281
|
sessionId: ""
|
|
1214
1282
|
});
|
|
1215
|
-
}, [
|
|
1283
|
+
}, [M]), oe = e.humanPollMs ?? Ct;
|
|
1216
1284
|
W(() => {
|
|
1217
1285
|
if (!p || !a) return;
|
|
1218
1286
|
let e = setInterval(() => {
|
|
1219
1287
|
let e = E.current;
|
|
1220
|
-
!e || C.current ||
|
|
1288
|
+
!e || C.current || st({
|
|
1221
1289
|
apiUrl: w.current.apiUrl ?? "https://api.squadico.com",
|
|
1222
1290
|
conversationId: e.sessionId,
|
|
1223
1291
|
visitorToken: e.visitorToken
|
|
1224
1292
|
}).then((e) => {
|
|
1225
1293
|
n(e.messages), m(!!e.withHuman);
|
|
1226
1294
|
}).catch(() => {});
|
|
1227
|
-
},
|
|
1295
|
+
}, oe);
|
|
1228
1296
|
return () => clearInterval(e);
|
|
1229
1297
|
}, [
|
|
1230
1298
|
p,
|
|
1231
1299
|
a,
|
|
1232
|
-
|
|
1300
|
+
oe
|
|
1233
1301
|
]);
|
|
1234
|
-
let
|
|
1302
|
+
let se = e.user?.id;
|
|
1235
1303
|
return W(() => {
|
|
1236
|
-
E.current &&
|
|
1237
|
-
}, [
|
|
1238
|
-
messages: K(() => t.length === 0 &&
|
|
1304
|
+
E.current && k.current !== se && ae();
|
|
1305
|
+
}, [se, ae]), {
|
|
1306
|
+
messages: K(() => t.length === 0 && j ? [j] : t, [j, t]),
|
|
1239
1307
|
busy: r,
|
|
1240
1308
|
sessionId: a,
|
|
1241
1309
|
handles: s,
|
|
@@ -1243,22 +1311,22 @@ function Ct(e) {
|
|
|
1243
1311
|
approval: d,
|
|
1244
1312
|
withHuman: p,
|
|
1245
1313
|
branding: h,
|
|
1246
|
-
start:
|
|
1247
|
-
send:
|
|
1314
|
+
start: ee,
|
|
1315
|
+
send: te,
|
|
1248
1316
|
attachments: _,
|
|
1249
1317
|
uploading: y,
|
|
1250
1318
|
attachmentError: x,
|
|
1251
|
-
attach:
|
|
1252
|
-
detach:
|
|
1253
|
-
loadAttachment:
|
|
1254
|
-
decide:
|
|
1255
|
-
stop:
|
|
1256
|
-
reset:
|
|
1319
|
+
attach: ne,
|
|
1320
|
+
detach: re,
|
|
1321
|
+
loadAttachment: ie,
|
|
1322
|
+
decide: B,
|
|
1323
|
+
stop: V,
|
|
1324
|
+
reset: ae
|
|
1257
1325
|
};
|
|
1258
1326
|
}
|
|
1259
1327
|
//#endregion
|
|
1260
1328
|
//#region node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
1261
|
-
var
|
|
1329
|
+
var Et = 0;
|
|
1262
1330
|
Array.isArray;
|
|
1263
1331
|
function Y(e, n, r, i, a, o) {
|
|
1264
1332
|
n || (n = {});
|
|
@@ -1275,7 +1343,7 @@ function Y(e, n, r, i, a, o) {
|
|
|
1275
1343
|
__e: null,
|
|
1276
1344
|
__c: null,
|
|
1277
1345
|
constructor: void 0,
|
|
1278
|
-
__v: --
|
|
1346
|
+
__v: --Et,
|
|
1279
1347
|
__i: -1,
|
|
1280
1348
|
__u: 0,
|
|
1281
1349
|
__source: a,
|
|
@@ -1286,17 +1354,17 @@ function Y(e, n, r, i, a, o) {
|
|
|
1286
1354
|
}
|
|
1287
1355
|
//#endregion
|
|
1288
1356
|
//#region src/components/Composer.tsx
|
|
1289
|
-
var
|
|
1290
|
-
function
|
|
1357
|
+
var Dt = 132, Ot = "image/png,image/jpeg,image/gif,image/webp,application/pdf,.docx,.txt,.md,.csv,.json", kt = /^[a-zA-Z0-9_-]*$/;
|
|
1358
|
+
function At(e, t) {
|
|
1291
1359
|
let n = e.slice(0, t), r = n.lastIndexOf("@");
|
|
1292
1360
|
if (r < 0 || r > 0 && !/\s/.test(n[r - 1] ?? "")) return null;
|
|
1293
1361
|
let i = n.slice(r + 1);
|
|
1294
|
-
return
|
|
1362
|
+
return kt.test(i) ? {
|
|
1295
1363
|
start: r,
|
|
1296
1364
|
query: i
|
|
1297
1365
|
} : null;
|
|
1298
1366
|
}
|
|
1299
|
-
function
|
|
1367
|
+
function jt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addressee: a, attachments: o = [], uploading: s = [], attachmentError: c, onAttach: l, onDetach: u, onSend: d, onStop: f }) {
|
|
1300
1368
|
let [p, m] = U(""), [h, g] = U(null), [_, v] = U(0), [y, b] = U(!1), x = G(null), C = G(null), w = !!l, T = s.length > 0, E = K(() => {
|
|
1301
1369
|
if (!h || !i || i.length === 0) return [];
|
|
1302
1370
|
let e = h.query.toLowerCase();
|
|
@@ -1305,8 +1373,8 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1305
1373
|
let e = x.current;
|
|
1306
1374
|
if (!e) return;
|
|
1307
1375
|
e.style.height = "auto";
|
|
1308
|
-
let t = e.scrollHeight >
|
|
1309
|
-
e.style.height = `${Math.min(e.scrollHeight,
|
|
1376
|
+
let t = e.scrollHeight > Dt;
|
|
1377
|
+
e.style.height = `${Math.min(e.scrollHeight, Dt)}px`, e.style.overflowY = t ? "auto" : "hidden";
|
|
1310
1378
|
}, []);
|
|
1311
1379
|
W(() => {
|
|
1312
1380
|
r && x.current?.focus(), O();
|
|
@@ -1314,7 +1382,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1314
1382
|
a && (m((e) => e || `@${a} `), requestAnimationFrame(O));
|
|
1315
1383
|
}, [a, O]);
|
|
1316
1384
|
let k = q((e) => {
|
|
1317
|
-
g(
|
|
1385
|
+
g(At(e.value, e.selectionStart ?? e.value.length)), v(0);
|
|
1318
1386
|
}, []), A = q((e) => {
|
|
1319
1387
|
let t = x.current;
|
|
1320
1388
|
if (!t || !h) return;
|
|
@@ -1467,7 +1535,7 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1467
1535
|
ref: C,
|
|
1468
1536
|
type: "file",
|
|
1469
1537
|
multiple: !0,
|
|
1470
|
-
accept:
|
|
1538
|
+
accept: Ot,
|
|
1471
1539
|
class: "sqc-file-input",
|
|
1472
1540
|
onChange: (e) => {
|
|
1473
1541
|
j(e.currentTarget.files), e.currentTarget.value = "";
|
|
@@ -1529,18 +1597,18 @@ function kt({ placeholder: e, locale: t, busy: n, autoFocus: r, handles: i, addr
|
|
|
1529
1597
|
}
|
|
1530
1598
|
//#endregion
|
|
1531
1599
|
//#region src/lib/confirm.ts
|
|
1532
|
-
var
|
|
1600
|
+
var Mt = {
|
|
1533
1601
|
fr: /\br[ée]ponde?z? +«?\s*oui\b/i,
|
|
1534
1602
|
en: /\b(?:reply|answer|respond) +[“"']?\s*yes\b/i,
|
|
1535
1603
|
es: /\bresponda?e?d? +«?\s*s[íi]\b/i
|
|
1536
|
-
},
|
|
1604
|
+
}, Nt = {
|
|
1537
1605
|
fr: [
|
|
1538
1606
|
/\b(?:confirmes?[- ]tu|confirmez[- ]vous)\b/i,
|
|
1539
1607
|
/\b(?:valides?[- ]tu|validez[- ]vous)\b/i,
|
|
1540
1608
|
/\b(?:es[- ]tu s[ûu]re?|[êe]tes[- ]vous s[ûu]re?s?)\b/i,
|
|
1541
1609
|
/\b(?:dois[- ]je|puis[- ]je)\b/i,
|
|
1542
1610
|
/\b(?:je continue|on continue|on y va|je lance)\b/i,
|
|
1543
|
-
|
|
1611
|
+
Mt.fr
|
|
1544
1612
|
],
|
|
1545
1613
|
en: [
|
|
1546
1614
|
/\bdo you confirm\b/i,
|
|
@@ -1548,7 +1616,7 @@ var At = {
|
|
|
1548
1616
|
/\b(?:shall|should) I\b/i,
|
|
1549
1617
|
/\bare you sure\b/i,
|
|
1550
1618
|
/\b(?:shall we|should I) (?:proceed|continue|go ahead)\b/i,
|
|
1551
|
-
|
|
1619
|
+
Mt.en
|
|
1552
1620
|
],
|
|
1553
1621
|
es: [
|
|
1554
1622
|
/\b(?:confirmas|confirma|confirm[áa]is)\b/i,
|
|
@@ -1556,25 +1624,25 @@ var At = {
|
|
|
1556
1624
|
/\best[áa]s? seguro\b/i,
|
|
1557
1625
|
/\b(?:contin[úu]o|procedo|lo lanzo|lo hago)\b/i,
|
|
1558
1626
|
/\bquieres? que\b/i,
|
|
1559
|
-
|
|
1627
|
+
Mt.es
|
|
1560
1628
|
]
|
|
1561
|
-
},
|
|
1562
|
-
function
|
|
1563
|
-
if (
|
|
1629
|
+
}, Pt = /^\s*(?:[-*•]\s+)?\[[ xX]\]\s+/m;
|
|
1630
|
+
function Ft(e, t = "en") {
|
|
1631
|
+
if (Pt.test(e)) return !1;
|
|
1564
1632
|
let n = e.split("\n").map((e) => e.trim()).filter(Boolean), r = n[n.length - 1];
|
|
1565
|
-
return !r || !r.includes("?") && !
|
|
1633
|
+
return !r || !r.includes("?") && !Mt[t].test(r) ? !1 : Nt[t].some((e) => e.test(r));
|
|
1566
1634
|
}
|
|
1567
1635
|
//#endregion
|
|
1568
1636
|
//#region src/components/Approval.tsx
|
|
1569
|
-
var
|
|
1570
|
-
function
|
|
1571
|
-
let t = e.replace(
|
|
1637
|
+
var It = /^(?:mcp|custom|a2a)_[0-9a-f]{8}_/;
|
|
1638
|
+
function Lt(e) {
|
|
1639
|
+
let t = e.replace(It, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
1572
1640
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
1573
1641
|
}
|
|
1574
|
-
function
|
|
1642
|
+
function Rt(e, t) {
|
|
1575
1643
|
return e === !0 ? t.t.confirm.yes : e === !1 ? t.t.confirm.no : typeof e == "string" ? e : JSON.stringify(e) ?? String(e);
|
|
1576
1644
|
}
|
|
1577
|
-
function
|
|
1645
|
+
function zt({ locale: e, call: t, onDecide: n }) {
|
|
1578
1646
|
let { approval: r, confirm: i } = e.t, [a, o] = U(null), s = !!n && a === null, c = (e, t) => {
|
|
1579
1647
|
o(t), n?.(e, t);
|
|
1580
1648
|
}, l = t ? Object.entries(t.arguments) : [];
|
|
@@ -1586,7 +1654,7 @@ function Lt({ locale: e, call: t, onDecide: n }) {
|
|
|
1586
1654
|
t && /* @__PURE__ */ Y("p", {
|
|
1587
1655
|
class: "sqc-approval__request",
|
|
1588
1656
|
"data-testid": "sqc-approval-tool",
|
|
1589
|
-
children: r.request.replace("{tool}",
|
|
1657
|
+
children: r.request.replace("{tool}", Lt(t.tool))
|
|
1590
1658
|
}),
|
|
1591
1659
|
l.length > 0 && /* @__PURE__ */ Y("dl", {
|
|
1592
1660
|
class: "sqc-approval__args",
|
|
@@ -1595,10 +1663,10 @@ function Lt({ locale: e, call: t, onDecide: n }) {
|
|
|
1595
1663
|
class: "sqc-approval__arg",
|
|
1596
1664
|
children: [/* @__PURE__ */ Y("dt", {
|
|
1597
1665
|
class: "sqc-approval__arg-name",
|
|
1598
|
-
children:
|
|
1666
|
+
children: Lt(t)
|
|
1599
1667
|
}), /* @__PURE__ */ Y("dd", {
|
|
1600
1668
|
class: "sqc-approval__arg-value",
|
|
1601
|
-
children:
|
|
1669
|
+
children: Rt(n, e)
|
|
1602
1670
|
})]
|
|
1603
1671
|
}, t))
|
|
1604
1672
|
}),
|
|
@@ -1625,7 +1693,7 @@ function Lt({ locale: e, call: t, onDecide: n }) {
|
|
|
1625
1693
|
}
|
|
1626
1694
|
//#endregion
|
|
1627
1695
|
//#region src/components/Confirm.tsx
|
|
1628
|
-
function
|
|
1696
|
+
function Bt({ locale: e, onPick: t }) {
|
|
1629
1697
|
let [n, r] = U(null), i = !!t && n === null, { confirm: a } = e.t, o = [{
|
|
1630
1698
|
value: a.yesValue,
|
|
1631
1699
|
label: a.yes,
|
|
@@ -1653,7 +1721,7 @@ function Rt({ locale: e, onPick: t }) {
|
|
|
1653
1721
|
}
|
|
1654
1722
|
//#endregion
|
|
1655
1723
|
//#region src/components/Choices.tsx
|
|
1656
|
-
function
|
|
1724
|
+
function Vt() {
|
|
1657
1725
|
return /* @__PURE__ */ Y("svg", {
|
|
1658
1726
|
viewBox: "0 0 16 16",
|
|
1659
1727
|
fill: "none",
|
|
@@ -1667,7 +1735,7 @@ function zt() {
|
|
|
1667
1735
|
})
|
|
1668
1736
|
});
|
|
1669
1737
|
}
|
|
1670
|
-
function
|
|
1738
|
+
function Ht({ items: e, locale: t, onPick: n }) {
|
|
1671
1739
|
let [r, i] = U(null), a = !!n && r === null;
|
|
1672
1740
|
return /* @__PURE__ */ Y("div", {
|
|
1673
1741
|
class: "sqc-choices",
|
|
@@ -1686,7 +1754,7 @@ function Bt({ items: e, locale: t, onPick: n }) {
|
|
|
1686
1754
|
children: [/* @__PURE__ */ Y("span", {
|
|
1687
1755
|
class: `sqc-choice__box${o ? " sqc-choice__box--on" : ""}`,
|
|
1688
1756
|
"aria-hidden": "true",
|
|
1689
|
-
children: o && /* @__PURE__ */ Y(
|
|
1757
|
+
children: o && /* @__PURE__ */ Y(Vt, {})
|
|
1690
1758
|
}), /* @__PURE__ */ Y("span", {
|
|
1691
1759
|
class: "sqc-choice__label",
|
|
1692
1760
|
children: e.content
|
|
@@ -1697,38 +1765,38 @@ function Bt({ items: e, locale: t, onPick: n }) {
|
|
|
1697
1765
|
}
|
|
1698
1766
|
//#endregion
|
|
1699
1767
|
//#region src/components/RichText.tsx
|
|
1700
|
-
var
|
|
1701
|
-
function
|
|
1702
|
-
return
|
|
1768
|
+
var Ut = /(\*\*[^*\n]+\*\*|`[^`\n]+`|~~[^~\n]+~~|\[[^\]\n]+\]\([^)\s]+\)|\*[^*\n]+\*|https?:\/\/[^\s<>()]+)/g, Wt = /^\[([^\]\n]+)\]\(([^)\s]+)\)$/, Gt = /^(https?:|mailto:)/i;
|
|
1769
|
+
function Kt(e, t, n) {
|
|
1770
|
+
return Gt.test(e) ? /* @__PURE__ */ Y("a", {
|
|
1703
1771
|
href: e,
|
|
1704
1772
|
target: "_blank",
|
|
1705
1773
|
rel: "noopener noreferrer",
|
|
1706
1774
|
children: t
|
|
1707
1775
|
}, n) : t;
|
|
1708
1776
|
}
|
|
1709
|
-
function
|
|
1710
|
-
let n = e.split(
|
|
1777
|
+
function qt(e, t) {
|
|
1778
|
+
let n = e.split(Ut), r = [];
|
|
1711
1779
|
return n.forEach((e, n) => {
|
|
1712
1780
|
if (!e) return;
|
|
1713
|
-
let i = `${t}-${n}`, a =
|
|
1714
|
-
e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */ Y("strong", { children: e.slice(2, -2) }, i)) : e.startsWith("`") && e.endsWith("`") && e.length > 2 ? r.push(/* @__PURE__ */ Y("code", { children: e.slice(1, -1) }, i)) : e.startsWith("~~") && e.endsWith("~~") && e.length > 4 ? r.push(/* @__PURE__ */ Y("del", { children: e.slice(2, -2) }, i)) : a ? r.push(
|
|
1781
|
+
let i = `${t}-${n}`, a = Wt.exec(e);
|
|
1782
|
+
e.startsWith("**") && e.endsWith("**") && e.length > 4 ? r.push(/* @__PURE__ */ Y("strong", { children: e.slice(2, -2) }, i)) : e.startsWith("`") && e.endsWith("`") && e.length > 2 ? r.push(/* @__PURE__ */ Y("code", { children: e.slice(1, -1) }, i)) : e.startsWith("~~") && e.endsWith("~~") && e.length > 4 ? r.push(/* @__PURE__ */ Y("del", { children: e.slice(2, -2) }, i)) : a ? r.push(Kt(a[2], a[1], i)) : e.startsWith("*") && e.endsWith("*") && e.length > 2 ? r.push(/* @__PURE__ */ Y("em", { children: e.slice(1, -1) }, i)) : /^https?:\/\//.test(e) ? r.push(Kt(e, e, i)) : r.push(e);
|
|
1715
1783
|
}), r;
|
|
1716
1784
|
}
|
|
1717
|
-
var
|
|
1718
|
-
function
|
|
1785
|
+
var Jt = /^\s*(?:[-*•]\s+)?\[([ xX])\]\s+(.+)$/;
|
|
1786
|
+
function Yt(e) {
|
|
1719
1787
|
return e.replace(/\[([^\]\n]+)\]\([^)\s]+\)/g, "$1").replace(/\*\*|~~|`|\*/g, "").trim();
|
|
1720
1788
|
}
|
|
1721
|
-
var
|
|
1722
|
-
function
|
|
1789
|
+
var Xt = /^(\s*)[-*•]\s+/, Zt = /^(\s*)\d+[.)]\s+/, Qt = /^\s{0,3}(#{1,6})\s+(.+?)#*\s*$/, $t = /^\s*([-*_])(?:\s*\1){2,}\s*$/, en = /^\s*>\s?(.*)$/, tn = /^\s*\|.*\|\s*$/, nn = /^\s*\|(?:\s*:?-{1,}:?\s*\|)+\s*$/, rn = /^\s*```/;
|
|
1790
|
+
function an(e) {
|
|
1723
1791
|
return e.replace(/^\s*\|/, "").replace(/\|\s*$/, "").split("|").map((e) => e.trim());
|
|
1724
1792
|
}
|
|
1725
|
-
function
|
|
1793
|
+
function on(e, t, n, r) {
|
|
1726
1794
|
let i = e[t].ordered, a = [], o = t;
|
|
1727
1795
|
for (; o < e.length && e[o].depth >= n;) {
|
|
1728
1796
|
let t = e[o];
|
|
1729
1797
|
if (t.depth === n && t.ordered !== i) break;
|
|
1730
1798
|
if (t.depth > n) {
|
|
1731
|
-
let [n, i] =
|
|
1799
|
+
let [n, i] = on(e, o, t.depth, `${r}-${o}`), s = a[a.length - 1];
|
|
1732
1800
|
s ? s.nested.push(n) : a.push({
|
|
1733
1801
|
key: `${r}-${o}`,
|
|
1734
1802
|
text: null,
|
|
@@ -1742,48 +1810,48 @@ function rn(e, t, n, r) {
|
|
|
1742
1810
|
nested: []
|
|
1743
1811
|
}), o += 1;
|
|
1744
1812
|
}
|
|
1745
|
-
let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null :
|
|
1813
|
+
let s = a.map((e) => /* @__PURE__ */ Y("li", { children: [e.text === null ? null : qt(e.text, e.key), e.nested] }, e.key));
|
|
1746
1814
|
return [Y(i ? "ol" : "ul", { children: s }, r), o];
|
|
1747
1815
|
}
|
|
1748
|
-
function
|
|
1816
|
+
function sn({ text: e, locale: t, onChoice: n }) {
|
|
1749
1817
|
let r = e.split("\n"), i = [], a = [], o = [], s = [], c = () => {
|
|
1750
1818
|
if (!a.length) return;
|
|
1751
1819
|
let e = `p${i.length}`;
|
|
1752
|
-
i.push(/* @__PURE__ */ Y("p", { children:
|
|
1820
|
+
i.push(/* @__PURE__ */ Y("p", { children: qt(a.join("\n"), e) }, e)), a = [];
|
|
1753
1821
|
}, l = () => {
|
|
1754
1822
|
if (!o.length) return;
|
|
1755
1823
|
let e = 0;
|
|
1756
1824
|
for (; e < o.length;) {
|
|
1757
|
-
let t = `l${i.length}`, [n, r] =
|
|
1825
|
+
let t = `l${i.length}`, [n, r] = on(o, e, o[e].depth, t);
|
|
1758
1826
|
i.push(n), e = r;
|
|
1759
1827
|
}
|
|
1760
1828
|
o = [];
|
|
1761
1829
|
}, u = () => {
|
|
1762
1830
|
if (!s.length) return;
|
|
1763
1831
|
let e = `q${i.length}`;
|
|
1764
|
-
i.push(/* @__PURE__ */ Y("blockquote", { children:
|
|
1832
|
+
i.push(/* @__PURE__ */ Y("blockquote", { children: qt(s.join("\n"), e) }, e)), s = [];
|
|
1765
1833
|
}, d = () => {
|
|
1766
1834
|
c(), l(), u();
|
|
1767
1835
|
};
|
|
1768
1836
|
for (let e = 0; e < r.length; e += 1) {
|
|
1769
1837
|
let f = r[e];
|
|
1770
|
-
if (
|
|
1838
|
+
if (rn.test(f)) {
|
|
1771
1839
|
d();
|
|
1772
1840
|
let t = [];
|
|
1773
|
-
for (e += 1; e < r.length && !
|
|
1841
|
+
for (e += 1; e < r.length && !rn.test(r[e]);) t.push(r[e]), e += 1;
|
|
1774
1842
|
let n = `c${i.length}`;
|
|
1775
1843
|
i.push(/* @__PURE__ */ Y("pre", { children: /* @__PURE__ */ Y("code", { children: t.join("\n") }) }, n));
|
|
1776
1844
|
continue;
|
|
1777
1845
|
}
|
|
1778
|
-
if (
|
|
1846
|
+
if (tn.test(f) && e + 1 < r.length && nn.test(r[e + 1])) {
|
|
1779
1847
|
d();
|
|
1780
|
-
let t =
|
|
1781
|
-
for (e += 2; e < r.length &&
|
|
1848
|
+
let t = an(f), n = [];
|
|
1849
|
+
for (e += 2; e < r.length && tn.test(r[e]);) n.push(an(r[e])), e += 1;
|
|
1782
1850
|
--e;
|
|
1783
1851
|
let a = `t${i.length}`;
|
|
1784
1852
|
i.push(/* @__PURE__ */ Y("div", {
|
|
1785
1853
|
class: "sqc-table",
|
|
1786
|
-
children: /* @__PURE__ */ Y("table", { children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: t.map((e, t) => /* @__PURE__ */ Y("th", { children:
|
|
1854
|
+
children: /* @__PURE__ */ Y("table", { children: [/* @__PURE__ */ Y("thead", { children: /* @__PURE__ */ Y("tr", { children: t.map((e, t) => /* @__PURE__ */ Y("th", { children: qt(e, `${a}-h${t}`) }, `${a}-h${t}`)) }) }), /* @__PURE__ */ Y("tbody", { children: n.map((e, n) => /* @__PURE__ */ Y("tr", { children: t.map((t, r) => /* @__PURE__ */ Y("td", { children: qt(e[r] ?? "", `${a}-r${n}c${r}`) }, `${a}-r${n}c${r}`)) }, `${a}-r${n}`)) })] })
|
|
1787
1855
|
}, a));
|
|
1788
1856
|
continue;
|
|
1789
1857
|
}
|
|
@@ -1791,43 +1859,43 @@ function an({ text: e, locale: t, onChoice: n }) {
|
|
|
1791
1859
|
d();
|
|
1792
1860
|
continue;
|
|
1793
1861
|
}
|
|
1794
|
-
if (
|
|
1862
|
+
if (Jt.test(f)) {
|
|
1795
1863
|
d();
|
|
1796
1864
|
let a = [];
|
|
1797
1865
|
for (; e < r.length;) {
|
|
1798
|
-
let t =
|
|
1866
|
+
let t = Jt.exec(r[e]);
|
|
1799
1867
|
if (!t) break;
|
|
1800
1868
|
let n = t[2].trim(), o = `o${i.length}-${a.length}`;
|
|
1801
1869
|
a.push({
|
|
1802
|
-
label:
|
|
1870
|
+
label: Yt(n),
|
|
1803
1871
|
checked: t[1].toLowerCase() === "x",
|
|
1804
|
-
content:
|
|
1872
|
+
content: qt(n, o)
|
|
1805
1873
|
}), e += 1;
|
|
1806
1874
|
}
|
|
1807
|
-
--e, i.push(/* @__PURE__ */ Y(
|
|
1875
|
+
--e, i.push(/* @__PURE__ */ Y(Ht, {
|
|
1808
1876
|
items: a,
|
|
1809
1877
|
locale: t,
|
|
1810
1878
|
onPick: n
|
|
1811
1879
|
}, `o${i.length}`));
|
|
1812
1880
|
continue;
|
|
1813
1881
|
}
|
|
1814
|
-
let p =
|
|
1882
|
+
let p = Qt.exec(f);
|
|
1815
1883
|
if (p) {
|
|
1816
1884
|
d();
|
|
1817
1885
|
let e = p[1].length, t = e <= 2 ? "h3" : e === 3 ? "h4" : "h5", n = `h${i.length}`;
|
|
1818
|
-
i.push(/* @__PURE__ */ Y(t, { children:
|
|
1886
|
+
i.push(/* @__PURE__ */ Y(t, { children: qt(p[2], n) }, n));
|
|
1819
1887
|
continue;
|
|
1820
1888
|
}
|
|
1821
|
-
if (
|
|
1889
|
+
if ($t.test(f)) {
|
|
1822
1890
|
d(), i.push(/* @__PURE__ */ Y("hr", {}, `r${i.length}`));
|
|
1823
1891
|
continue;
|
|
1824
1892
|
}
|
|
1825
|
-
let m =
|
|
1893
|
+
let m = en.exec(f);
|
|
1826
1894
|
if (m) {
|
|
1827
1895
|
c(), l(), s.push(m[1]);
|
|
1828
1896
|
continue;
|
|
1829
1897
|
}
|
|
1830
|
-
let h =
|
|
1898
|
+
let h = Xt.exec(f), g = h ? null : Zt.exec(f), _ = h ?? g;
|
|
1831
1899
|
if (_) {
|
|
1832
1900
|
c(), u(), o.push({
|
|
1833
1901
|
depth: _[1].replace(/\t/g, " ").length,
|
|
@@ -1842,8 +1910,8 @@ function an({ text: e, locale: t, onChoice: n }) {
|
|
|
1842
1910
|
}
|
|
1843
1911
|
//#endregion
|
|
1844
1912
|
//#region src/components/MessageList.tsx
|
|
1845
|
-
var
|
|
1846
|
-
function
|
|
1913
|
+
var cn = 80;
|
|
1914
|
+
function ln({ at: e, locale: t }) {
|
|
1847
1915
|
let n = new Date(e);
|
|
1848
1916
|
return /* @__PURE__ */ Y("time", {
|
|
1849
1917
|
class: "sqc-msg__time",
|
|
@@ -1854,7 +1922,7 @@ function sn({ at: e, locale: t }) {
|
|
|
1854
1922
|
})
|
|
1855
1923
|
});
|
|
1856
1924
|
}
|
|
1857
|
-
function
|
|
1925
|
+
function un({ file: e, load: t }) {
|
|
1858
1926
|
let [n, r] = U(null);
|
|
1859
1927
|
return W(() => {
|
|
1860
1928
|
let n = null, i = !0;
|
|
@@ -1872,10 +1940,10 @@ function cn({ file: e, load: t }) {
|
|
|
1872
1940
|
children: e.filename
|
|
1873
1941
|
});
|
|
1874
1942
|
}
|
|
1875
|
-
function
|
|
1943
|
+
function dn({ files: e, load: t }) {
|
|
1876
1944
|
return e.length === 0 || !t ? null : /* @__PURE__ */ Y("div", {
|
|
1877
1945
|
class: "sqc-attachments sqc-attachments--sent",
|
|
1878
|
-
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(
|
|
1946
|
+
children: e.map((e) => e.kind === "image" ? /* @__PURE__ */ Y(un, {
|
|
1879
1947
|
file: e,
|
|
1880
1948
|
load: t
|
|
1881
1949
|
}, e.id) : /* @__PURE__ */ Y("span", {
|
|
@@ -1888,7 +1956,7 @@ function ln({ files: e, load: t }) {
|
|
|
1888
1956
|
}, e.id))
|
|
1889
1957
|
});
|
|
1890
1958
|
}
|
|
1891
|
-
function
|
|
1959
|
+
function fn({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i, onLoadAttachment: a }) {
|
|
1892
1960
|
let o = e.streaming && !e.content, s = !!e.approval;
|
|
1893
1961
|
return /* @__PURE__ */ Y("div", {
|
|
1894
1962
|
class: `sqc-msg sqc-msg--${e.role}${e.error ? " sqc-msg--error" : ""}`,
|
|
@@ -1898,7 +1966,7 @@ function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i,
|
|
|
1898
1966
|
class: "sqc-msg__emoji",
|
|
1899
1967
|
"aria-hidden": "true",
|
|
1900
1968
|
children: e.agent.avatarEmoji
|
|
1901
|
-
}) : /* @__PURE__ */ Y(
|
|
1969
|
+
}) : /* @__PURE__ */ Y(mn, {}), e.authorName ?? e.agent?.name ?? n]
|
|
1902
1970
|
}), /* @__PURE__ */ Y("div", {
|
|
1903
1971
|
class: "sqc-msg__bubble",
|
|
1904
1972
|
children: [o ? /* @__PURE__ */ Y("span", {
|
|
@@ -1912,7 +1980,7 @@ function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i,
|
|
|
1912
1980
|
}) : /* @__PURE__ */ Y("div", {
|
|
1913
1981
|
class: "sqc-msg__body",
|
|
1914
1982
|
children: [
|
|
1915
|
-
/* @__PURE__ */ Y(
|
|
1983
|
+
/* @__PURE__ */ Y(sn, {
|
|
1916
1984
|
text: e.content,
|
|
1917
1985
|
locale: t,
|
|
1918
1986
|
onChoice: r
|
|
@@ -1921,32 +1989,32 @@ function un({ message: e, locale: t, assistantName: n, onChoice: r, onDecide: i,
|
|
|
1921
1989
|
class: "sqc-caret",
|
|
1922
1990
|
"aria-hidden": "true"
|
|
1923
1991
|
}),
|
|
1924
|
-
s && /* @__PURE__ */ Y(
|
|
1992
|
+
s && /* @__PURE__ */ Y(zt, {
|
|
1925
1993
|
locale: t,
|
|
1926
1994
|
call: e.content.trim() === "" ? e.approval : void 0,
|
|
1927
1995
|
onDecide: i
|
|
1928
1996
|
}),
|
|
1929
|
-
!s && !e.streaming && !e.error &&
|
|
1997
|
+
!s && !e.streaming && !e.error && Ft(e.content, t.code) && /* @__PURE__ */ Y(Bt, {
|
|
1930
1998
|
locale: t,
|
|
1931
1999
|
onPick: r
|
|
1932
2000
|
}),
|
|
1933
|
-
e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(
|
|
2001
|
+
e.unknownHandle && !e.streaming && /* @__PURE__ */ Y(pn, {
|
|
1934
2002
|
message: e,
|
|
1935
2003
|
locale: t
|
|
1936
2004
|
}),
|
|
1937
|
-
/* @__PURE__ */ Y(
|
|
2005
|
+
/* @__PURE__ */ Y(dn, {
|
|
1938
2006
|
files: e.attachments ?? [],
|
|
1939
2007
|
load: a
|
|
1940
2008
|
})
|
|
1941
2009
|
]
|
|
1942
|
-
}), !o && /* @__PURE__ */ Y(
|
|
2010
|
+
}), !o && /* @__PURE__ */ Y(ln, {
|
|
1943
2011
|
at: e.createdAt,
|
|
1944
2012
|
locale: t
|
|
1945
2013
|
})]
|
|
1946
2014
|
})]
|
|
1947
2015
|
});
|
|
1948
2016
|
}
|
|
1949
|
-
function
|
|
2017
|
+
function pn({ message: e, locale: t }) {
|
|
1950
2018
|
let n = e.offered ?? [];
|
|
1951
2019
|
return /* @__PURE__ */ Y("p", {
|
|
1952
2020
|
class: "sqc-msg__unaddressed",
|
|
@@ -1963,7 +2031,7 @@ function dn({ message: e, locale: t }) {
|
|
|
1963
2031
|
]
|
|
1964
2032
|
});
|
|
1965
2033
|
}
|
|
1966
|
-
function
|
|
2034
|
+
function mn() {
|
|
1967
2035
|
return /* @__PURE__ */ Y("svg", {
|
|
1968
2036
|
viewBox: "0 0 24 24",
|
|
1969
2037
|
fill: "none",
|
|
@@ -1975,7 +2043,7 @@ function fn() {
|
|
|
1975
2043
|
children: /* @__PURE__ */ Y("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" })
|
|
1976
2044
|
});
|
|
1977
2045
|
}
|
|
1978
|
-
function
|
|
2046
|
+
function hn({ messages: e, locale: t, assistantName: n, suggestions: r, showSuggestions: i, busy: a, withHuman: o, onSuggestion: s, onChoice: c, onDecide: l, onLoadAttachment: u }) {
|
|
1979
2047
|
let d = G(null), f = G(!0);
|
|
1980
2048
|
return _e(() => {
|
|
1981
2049
|
let e = d.current;
|
|
@@ -1984,7 +2052,7 @@ function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
|
|
|
1984
2052
|
let e = d.current;
|
|
1985
2053
|
if (!e) return;
|
|
1986
2054
|
let t = () => {
|
|
1987
|
-
f.current = e.scrollHeight - e.scrollTop - e.clientHeight <
|
|
2055
|
+
f.current = e.scrollHeight - e.scrollTop - e.clientHeight < cn;
|
|
1988
2056
|
};
|
|
1989
2057
|
return e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
|
|
1990
2058
|
}, []), /* @__PURE__ */ Y("div", {
|
|
@@ -1994,7 +2062,7 @@ function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
|
|
|
1994
2062
|
"aria-live": "polite",
|
|
1995
2063
|
"aria-atomic": "false",
|
|
1996
2064
|
children: [
|
|
1997
|
-
e.map((r, i) => /* @__PURE__ */ Y(
|
|
2065
|
+
e.map((r, i) => /* @__PURE__ */ Y(fn, {
|
|
1998
2066
|
message: r,
|
|
1999
2067
|
locale: t,
|
|
2000
2068
|
assistantName: n,
|
|
@@ -2021,28 +2089,28 @@ function pn({ messages: e, locale: t, assistantName: n, suggestions: r, showSugg
|
|
|
2021
2089
|
}
|
|
2022
2090
|
//#endregion
|
|
2023
2091
|
//#region src/components/ChatbotWidget.tsx
|
|
2024
|
-
var
|
|
2025
|
-
function
|
|
2092
|
+
var gn = { width: "min(392px, 100vw)" }, _n = /* @__PURE__ */ new Set(["sessionId"]);
|
|
2093
|
+
function vn(e) {
|
|
2026
2094
|
let t = e.replace(/Id$|Ref$/, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]+/g, " ").trim().toLowerCase();
|
|
2027
2095
|
return t ? t.charAt(0).toUpperCase() + t.slice(1) : e;
|
|
2028
2096
|
}
|
|
2029
|
-
function
|
|
2097
|
+
function yn(e) {
|
|
2030
2098
|
if (!e) return [];
|
|
2031
2099
|
let t = [];
|
|
2032
2100
|
for (let [n, r] of Object.entries(e)) {
|
|
2033
|
-
if (
|
|
2101
|
+
if (_n.has(n) || typeof r != "string" && !Oe(r)) continue;
|
|
2034
2102
|
let e = De(r);
|
|
2035
2103
|
e && t.push({
|
|
2036
|
-
label:
|
|
2104
|
+
label: vn(n),
|
|
2037
2105
|
value: e
|
|
2038
2106
|
});
|
|
2039
2107
|
}
|
|
2040
2108
|
return t;
|
|
2041
2109
|
}
|
|
2042
|
-
function
|
|
2110
|
+
function bn(e, t) {
|
|
2043
2111
|
return e?.trim() ? e : t;
|
|
2044
2112
|
}
|
|
2045
|
-
function
|
|
2113
|
+
function xn(e) {
|
|
2046
2114
|
let [t, n] = U(!1);
|
|
2047
2115
|
return W(() => {
|
|
2048
2116
|
if (e !== "auto" || typeof matchMedia != "function") return;
|
|
@@ -2052,8 +2120,8 @@ function yn(e) {
|
|
|
2052
2120
|
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
2053
2121
|
}, [e]), e === "dark" ? "dark" : e === "light" ? "light" : t ? "dark" : "light";
|
|
2054
2122
|
}
|
|
2055
|
-
function
|
|
2056
|
-
let t = e.persistOpen ?? !0, [n, r] = U(() => Be(e.defaultOpen, t)), [i, a] = U(!1), [o, s] = U(!1), c = G(null), l = G(null), u =
|
|
2123
|
+
function Sn(e) {
|
|
2124
|
+
let t = e.persistOpen ?? !0, [n, r] = U(() => Be(e.defaultOpen, t)), [i, a] = U(!1), [o, s] = U(!1), c = G(null), l = G(null), u = xn(e.theme ?? "light"), d = K(() => Ie(e.locale), [e.locale]), f = d.t, p = bn(e.heading, f.heading), m = bn(e.assistantName, f.assistant), h = bn(e.greeting, f.greeting), g = e.onEvent, { send: _, reset: v, decide: y, stop: b, start: x, busy: S, messages: C, withHuman: w, branding: T, sessionId: E, handles: D, addressee: O, attachments: k, uploading: A, attachmentError: j, attach: M, detach: N, loadAttachment: P } = Tt({
|
|
2057
2125
|
embedKey: e.embedKey,
|
|
2058
2126
|
user: e.user,
|
|
2059
2127
|
getSubjectToken: e.getSubjectToken,
|
|
@@ -2068,7 +2136,7 @@ function bn(e) {
|
|
|
2068
2136
|
}, [C, n]);
|
|
2069
2137
|
let F = G(n);
|
|
2070
2138
|
F.current = n;
|
|
2071
|
-
let
|
|
2139
|
+
let I = q(() => {
|
|
2072
2140
|
s(!1), !F.current && (F.current = !0, r(!0), t && ze(!0), g?.({
|
|
2073
2141
|
type: "chatbot-open",
|
|
2074
2142
|
sessionId: E
|
|
@@ -2077,7 +2145,7 @@ function bn(e) {
|
|
|
2077
2145
|
g,
|
|
2078
2146
|
t,
|
|
2079
2147
|
E
|
|
2080
|
-
]),
|
|
2148
|
+
]), L = q(() => {
|
|
2081
2149
|
F.current && (F.current = !1, r(!1), t && ze(!1), g?.({
|
|
2082
2150
|
type: "chatbot-close",
|
|
2083
2151
|
sessionId: E
|
|
@@ -2090,45 +2158,45 @@ function bn(e) {
|
|
|
2090
2158
|
W(() => {
|
|
2091
2159
|
n && x();
|
|
2092
2160
|
}, [n, x]);
|
|
2093
|
-
let
|
|
2161
|
+
let R = q((e) => {
|
|
2094
2162
|
a(!0), _(e);
|
|
2095
|
-
}, [_]),
|
|
2163
|
+
}, [_]), ee = q(() => {
|
|
2096
2164
|
a(!1), s(!1), v();
|
|
2097
|
-
}, [v]),
|
|
2098
|
-
openPanel:
|
|
2099
|
-
closePanel:
|
|
2100
|
-
send:
|
|
2101
|
-
reset:
|
|
2165
|
+
}, [v]), z = G({
|
|
2166
|
+
openPanel: I,
|
|
2167
|
+
closePanel: L,
|
|
2168
|
+
send: R,
|
|
2169
|
+
reset: ee,
|
|
2102
2170
|
sessionId: E
|
|
2103
2171
|
});
|
|
2104
|
-
|
|
2105
|
-
openPanel:
|
|
2106
|
-
closePanel:
|
|
2107
|
-
send:
|
|
2108
|
-
reset:
|
|
2172
|
+
z.current = {
|
|
2173
|
+
openPanel: I,
|
|
2174
|
+
closePanel: L,
|
|
2175
|
+
send: R,
|
|
2176
|
+
reset: ee,
|
|
2109
2177
|
sessionId: E
|
|
2110
2178
|
};
|
|
2111
|
-
let
|
|
2112
|
-
open: () =>
|
|
2113
|
-
close: () =>
|
|
2114
|
-
toggle: () => F.current ?
|
|
2115
|
-
reset: () =>
|
|
2179
|
+
let te = G({
|
|
2180
|
+
open: () => z.current.openPanel(),
|
|
2181
|
+
close: () => z.current.closePanel(),
|
|
2182
|
+
toggle: () => F.current ? z.current.closePanel() : z.current.openPanel(),
|
|
2183
|
+
reset: () => z.current.reset(),
|
|
2116
2184
|
send: (e) => {
|
|
2117
|
-
|
|
2185
|
+
z.current.openPanel(), z.current.send(e);
|
|
2118
2186
|
},
|
|
2119
2187
|
isOpen: () => F.current,
|
|
2120
|
-
sessionId: () =>
|
|
2121
|
-
}),
|
|
2122
|
-
_e(() => (
|
|
2188
|
+
sessionId: () => z.current.sessionId
|
|
2189
|
+
}), ne = e.bind;
|
|
2190
|
+
_e(() => (ne?.(te.current), () => ne?.(null)), [ne]), W(() => {
|
|
2123
2191
|
if (!n) return;
|
|
2124
2192
|
let e = (e) => {
|
|
2125
|
-
e.key === "Escape" && (e.stopPropagation(),
|
|
2193
|
+
e.key === "Escape" && (e.stopPropagation(), L());
|
|
2126
2194
|
};
|
|
2127
2195
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
2128
|
-
}, [
|
|
2129
|
-
let re = K(() => C.some((e) => e.id !== "greeting"), [C]), ie = K(() =>
|
|
2196
|
+
}, [L, n]);
|
|
2197
|
+
let re = K(() => C.some((e) => e.id !== "greeting"), [C]), ie = K(() => yn(e.context), [e.context]), B = {
|
|
2130
2198
|
...e.accent ? { "--sqc-accent": e.accent } : {},
|
|
2131
|
-
"--sqc-width": e.width ??
|
|
2199
|
+
"--sqc-width": e.width ?? gn.width
|
|
2132
2200
|
};
|
|
2133
2201
|
return /* @__PURE__ */ Y("div", {
|
|
2134
2202
|
class: "sqc",
|
|
@@ -2144,13 +2212,13 @@ function bn(e) {
|
|
|
2144
2212
|
"aria-label": p,
|
|
2145
2213
|
"aria-expanded": n,
|
|
2146
2214
|
"aria-haspopup": "dialog",
|
|
2147
|
-
onClick:
|
|
2215
|
+
onClick: I,
|
|
2148
2216
|
children: [/* @__PURE__ */ Y("span", {
|
|
2149
2217
|
class: "sqc-launcher__icon",
|
|
2150
2218
|
children: /* @__PURE__ */ Y("slot", {
|
|
2151
2219
|
name: "launcher-icon",
|
|
2152
2220
|
class: "sqc-slot-icon",
|
|
2153
|
-
children: /* @__PURE__ */ Y(
|
|
2221
|
+
children: /* @__PURE__ */ Y(mn, {})
|
|
2154
2222
|
})
|
|
2155
2223
|
}), o && /* @__PURE__ */ Y("span", {
|
|
2156
2224
|
class: "sqc-launcher__badge",
|
|
@@ -2170,7 +2238,7 @@ function bn(e) {
|
|
|
2170
2238
|
/* @__PURE__ */ Y("span", {
|
|
2171
2239
|
class: "sqc-header__icon",
|
|
2172
2240
|
"aria-hidden": "true",
|
|
2173
|
-
children: /* @__PURE__ */ Y(
|
|
2241
|
+
children: /* @__PURE__ */ Y(mn, {})
|
|
2174
2242
|
}),
|
|
2175
2243
|
/* @__PURE__ */ Y("div", {
|
|
2176
2244
|
class: "sqc-header__titles",
|
|
@@ -2179,13 +2247,13 @@ function bn(e) {
|
|
|
2179
2247
|
children: p
|
|
2180
2248
|
}), /* @__PURE__ */ Y("p", {
|
|
2181
2249
|
class: "sqc-header__sub",
|
|
2182
|
-
children:
|
|
2250
|
+
children: bn(e.subheading, f.subheading)
|
|
2183
2251
|
})]
|
|
2184
2252
|
}),
|
|
2185
2253
|
/* @__PURE__ */ Y("button", {
|
|
2186
2254
|
type: "button",
|
|
2187
2255
|
class: "sqc-icon-btn",
|
|
2188
|
-
onClick:
|
|
2256
|
+
onClick: ee,
|
|
2189
2257
|
"aria-label": f.newConversation,
|
|
2190
2258
|
"data-tip": f.newConversation,
|
|
2191
2259
|
children: /* @__PURE__ */ Y("svg", {
|
|
@@ -2202,7 +2270,7 @@ function bn(e) {
|
|
|
2202
2270
|
/* @__PURE__ */ Y("button", {
|
|
2203
2271
|
type: "button",
|
|
2204
2272
|
class: "sqc-icon-btn",
|
|
2205
|
-
onClick:
|
|
2273
|
+
onClick: L,
|
|
2206
2274
|
"aria-label": f.close,
|
|
2207
2275
|
"data-tip": f.closeTitle,
|
|
2208
2276
|
children: /* @__PURE__ */ Y("svg", {
|
|
@@ -2227,7 +2295,7 @@ function bn(e) {
|
|
|
2227
2295
|
children: [/* @__PURE__ */ Y("b", { children: e.label }), e.value]
|
|
2228
2296
|
}, e.label))
|
|
2229
2297
|
}),
|
|
2230
|
-
/* @__PURE__ */ Y(
|
|
2298
|
+
/* @__PURE__ */ Y(hn, {
|
|
2231
2299
|
messages: C,
|
|
2232
2300
|
locale: d,
|
|
2233
2301
|
assistantName: m,
|
|
@@ -2235,13 +2303,13 @@ function bn(e) {
|
|
|
2235
2303
|
showSuggestions: !i && !re,
|
|
2236
2304
|
busy: S,
|
|
2237
2305
|
withHuman: w,
|
|
2238
|
-
onSuggestion:
|
|
2239
|
-
onChoice:
|
|
2306
|
+
onSuggestion: R,
|
|
2307
|
+
onChoice: R,
|
|
2240
2308
|
onDecide: y,
|
|
2241
2309
|
onLoadAttachment: P
|
|
2242
2310
|
}),
|
|
2243
|
-
/* @__PURE__ */ Y(
|
|
2244
|
-
placeholder:
|
|
2311
|
+
/* @__PURE__ */ Y(jt, {
|
|
2312
|
+
placeholder: bn(e.placeholder, f.placeholder),
|
|
2245
2313
|
locale: d,
|
|
2246
2314
|
busy: S,
|
|
2247
2315
|
autoFocus: n,
|
|
@@ -2252,7 +2320,7 @@ function bn(e) {
|
|
|
2252
2320
|
attachmentError: j ? f.attachments[j] : void 0,
|
|
2253
2321
|
onAttach: M,
|
|
2254
2322
|
onDetach: N,
|
|
2255
|
-
onSend:
|
|
2323
|
+
onSend: R,
|
|
2256
2324
|
onStop: b
|
|
2257
2325
|
}),
|
|
2258
2326
|
/* @__PURE__ */ Y("p", {
|
|
@@ -2274,21 +2342,21 @@ function bn(e) {
|
|
|
2274
2342
|
}
|
|
2275
2343
|
//#endregion
|
|
2276
2344
|
//#region src/styles.css?inline
|
|
2277
|
-
var xn = ":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[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:flex-start}.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-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-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.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-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.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}@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-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{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}";
|
|
2345
|
+
var Cn = ":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[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:flex-start}.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-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-approval{flex-direction:column;gap:8px;margin:11px 0 2px;display:flex}.sqc-approval__actions{flex-wrap:wrap;gap:8px;display:flex}.sqc-approval__request{color:var(--sqc-text);margin:0;font-size:13px}.sqc-approval__args{border:1px solid var(--sqc-border);background:var(--sqc-surface);border-radius:12px;flex-direction:column;gap:4px;margin:0;padding:8px 10px;font-size:12px;display:flex}.sqc-approval__arg{gap:8px;display:flex}.sqc-approval__arg-name{color:var(--sqc-text-muted);flex:none;font-weight:500}.sqc-approval__arg-value{overflow-wrap:anywhere;min-width:0;color:var(--sqc-text);margin:0}.sqc-approval__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:auto;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-approval__btn--yes:not(:disabled),.sqc-approval__btn--send:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-approval__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-approval__btn--yes:hover:not(:disabled),.sqc-approval__btn--send:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-approval__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-approval__btn:disabled{cursor:default}.sqc-approval__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-approval__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-approval__edit{flex-direction:column;gap:8px;display:flex}.sqc-approval__input{width:100%;font-family:var(--sqc-font-family);color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border-strong);resize:vertical;border-radius:12px;padding:8px 10px;font-size:13px;line-height:1.4}.sqc-approval__input:focus-visible{border-color:var(--sqc-text);box-shadow:var(--sqc-focus-input);outline:none}.sqc-approval__btn--send{flex:none;align-self:flex-end}.sqc-confirm{gap:8px;margin:11px 0 2px;display:flex}.sqc-confirm__btn{height:32px;font-family:var(--sqc-font-family);border:1px solid var(--sqc-border);background:var(--sqc-bg);color:var(--sqc-text);cursor:pointer;border-radius:12px;flex:1 1 0;justify-content:center;align-items:center;padding:0 12px;font-size:13px;font-weight:500;transition:border-color .12s,background .12s;display:inline-flex}.sqc-confirm__btn--yes:not(:disabled){background:var(--sqc-accent-color);color:var(--sqc-on-accent);border-color:#0000;font-weight:600}.sqc-confirm__btn:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-confirm__btn--yes:hover:not(:disabled){background:var(--sqc-accent-hover);border-color:#0000}.sqc-confirm__btn:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-confirm__btn:disabled{cursor:default}.sqc-confirm__btn:disabled[aria-pressed=false]{opacity:.45}.sqc-confirm__btn[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected);color:var(--sqc-text);font-weight:600}.sqc-choices{flex-direction:column;gap:7px;margin:10px 0 2px;display:flex}.sqc-choice{width:100%;font-family:var(--sqc-font-family);text-align:left;color:var(--sqc-text);background:var(--sqc-bg);border:1px solid var(--sqc-border);cursor:pointer;border-radius:12px;align-items:center;gap:8px;padding:8px 11px;font-size:12.5px;transition:border-color .12s,background .12s;display:flex}.sqc-choice:hover:not(:disabled){border-color:var(--sqc-border-strong);background:var(--sqc-surface)}.sqc-choice:focus-visible{box-shadow:var(--sqc-focus);outline:none}.sqc-choice:disabled{cursor:default}.sqc-choice:disabled[aria-pressed=false]{opacity:.55}.sqc-choice[aria-pressed=true]{border-color:var(--sqc-border-strong);background:var(--sqc-selected)}.sqc-choice__box{border:1.5px solid var(--sqc-border-strong);border-radius:4px;flex:none;justify-content:center;align-items:center;width:15px;height:15px;display:inline-flex}.sqc-choice__box--on{color:var(--sqc-on-accent);background:var(--sqc-accent-color);border-color:var(--sqc-accent-color)}.sqc-choice__box svg{width:11px;height:11px}.sqc-choice__label{overflow-wrap:anywhere}.sqc-choice__detail{color:var(--sqc-text-muted);margin-top:1px;font-size:11.5px;display:block}.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-table{scrollbar-width:thin;margin:0 0 8px;overflow-x:auto}.sqc-table table{border-collapse:collapse;min-width:100%;font-family:var(--sqc-font-family);white-space:nowrap;font-size:12.5px}.sqc-table th,.sqc-table td{text-align:left;vertical-align:top;border-bottom:1px solid var(--sqc-border);padding:6px 10px 6px 0}.sqc-table thead th{text-transform:uppercase;letter-spacing:.05em;color:var(--sqc-text-muted);font-size:10.5px;font-weight:600}.sqc-table tbody th{font-weight:500}.sqc-msg--user .sqc-table th,.sqc-msg--user .sqc-table td{border-bottom-color:#ffffff40}.sqc-msg--user .sqc-table thead th{color:#fffc}.sqc-table tbody tr:last-child th,.sqc-table tbody tr:last-child td{border-bottom:0}.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}@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-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{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}";
|
|
2278
2346
|
//#endregion
|
|
2279
2347
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/checkPrivateRedeclaration.js
|
|
2280
|
-
function
|
|
2348
|
+
function wn(e, t) {
|
|
2281
2349
|
if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
|
|
2282
2350
|
}
|
|
2283
2351
|
//#endregion
|
|
2284
2352
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateMethodInitSpec.js
|
|
2285
|
-
function
|
|
2286
|
-
|
|
2353
|
+
function Tn(e, t) {
|
|
2354
|
+
wn(e, t), t.add(e);
|
|
2287
2355
|
}
|
|
2288
2356
|
//#endregion
|
|
2289
2357
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/classPrivateFieldInitSpec.js
|
|
2290
2358
|
function X(e, t, n) {
|
|
2291
|
-
|
|
2359
|
+
wn(e, t), t.set(e, n);
|
|
2292
2360
|
}
|
|
2293
2361
|
//#endregion
|
|
2294
2362
|
//#region \0@oxc-project+runtime@0.147.0/helpers/esm/assertClassBrand.js
|
|
@@ -2308,7 +2376,7 @@ function $(e, t) {
|
|
|
2308
2376
|
}
|
|
2309
2377
|
//#endregion
|
|
2310
2378
|
//#region src/element.tsx
|
|
2311
|
-
var
|
|
2379
|
+
var En = "squadico-chatbot", Dn = [
|
|
2312
2380
|
"embed-key",
|
|
2313
2381
|
"context",
|
|
2314
2382
|
"user",
|
|
@@ -2327,21 +2395,21 @@ var wn = "squadico-chatbot", Tn = [
|
|
|
2327
2395
|
"open",
|
|
2328
2396
|
"persist-open",
|
|
2329
2397
|
"locale"
|
|
2330
|
-
],
|
|
2331
|
-
function
|
|
2332
|
-
if (
|
|
2398
|
+
], On;
|
|
2399
|
+
function kn() {
|
|
2400
|
+
if (On !== void 0) return On;
|
|
2333
2401
|
try {
|
|
2334
2402
|
let e = new CSSStyleSheet();
|
|
2335
|
-
e.replaceSync(
|
|
2403
|
+
e.replaceSync(Cn), On = e;
|
|
2336
2404
|
} catch {
|
|
2337
|
-
|
|
2405
|
+
On = null;
|
|
2338
2406
|
}
|
|
2339
|
-
return
|
|
2407
|
+
return On;
|
|
2340
2408
|
}
|
|
2341
|
-
function
|
|
2342
|
-
typeof console < "u" && console.warn(`[${
|
|
2409
|
+
function An(e, t) {
|
|
2410
|
+
typeof console < "u" && console.warn(`[${En}] ${e}`, t ?? "");
|
|
2343
2411
|
}
|
|
2344
|
-
function
|
|
2412
|
+
function jn(e) {
|
|
2345
2413
|
if (!(!e || !e.trim())) try {
|
|
2346
2414
|
let t = JSON.parse(e);
|
|
2347
2415
|
if (t && typeof t == "object" && !Array.isArray(t)) {
|
|
@@ -2352,56 +2420,56 @@ function kn(e) {
|
|
|
2352
2420
|
digest: typeof e.digest == "string" && e.digest ? e.digest : void 0
|
|
2353
2421
|
};
|
|
2354
2422
|
}
|
|
2355
|
-
|
|
2423
|
+
An("the \"user\" attribute needs an object with an id", e);
|
|
2356
2424
|
} catch (e) {
|
|
2357
|
-
|
|
2425
|
+
An("the \"user\" attribute is not valid JSON", e);
|
|
2358
2426
|
}
|
|
2359
2427
|
}
|
|
2360
|
-
function
|
|
2428
|
+
function Mn(e) {
|
|
2361
2429
|
if (!(!e || !e.trim())) try {
|
|
2362
2430
|
let t = JSON.parse(e);
|
|
2363
2431
|
if (t && typeof t == "object" && !Array.isArray(t)) return t;
|
|
2364
|
-
|
|
2432
|
+
An("the `context` attribute must be a JSON object", e);
|
|
2365
2433
|
} catch (e) {
|
|
2366
|
-
|
|
2434
|
+
An("the `context` attribute is not valid JSON", e);
|
|
2367
2435
|
}
|
|
2368
2436
|
}
|
|
2369
|
-
function
|
|
2437
|
+
function Nn(e) {
|
|
2370
2438
|
if (!(!e || !e.trim())) {
|
|
2371
2439
|
if (e.trim().startsWith("[")) try {
|
|
2372
2440
|
let t = JSON.parse(e);
|
|
2373
2441
|
if (Array.isArray(t)) return t.map(String);
|
|
2374
2442
|
} catch (e) {
|
|
2375
|
-
|
|
2443
|
+
An("the `suggestions` attribute is not valid JSON", e);
|
|
2376
2444
|
return;
|
|
2377
2445
|
}
|
|
2378
2446
|
return e.split("|").map((e) => e.trim()).filter(Boolean);
|
|
2379
2447
|
}
|
|
2380
2448
|
}
|
|
2381
|
-
function
|
|
2449
|
+
function Pn(e) {
|
|
2382
2450
|
if (e !== null) return e !== "false" && e !== "0";
|
|
2383
2451
|
}
|
|
2384
|
-
function
|
|
2452
|
+
function Fn(e) {
|
|
2385
2453
|
return e === "dark" || e === "light" || e === "auto" ? e : void 0;
|
|
2386
2454
|
}
|
|
2387
|
-
function
|
|
2455
|
+
function In(e) {
|
|
2388
2456
|
return e === "bottom-left" || e === "bottom-right" ? e : void 0;
|
|
2389
2457
|
}
|
|
2390
|
-
function
|
|
2458
|
+
function Ln(e) {
|
|
2391
2459
|
return e === "floating" || e === "sidebar" ? e : void 0;
|
|
2392
2460
|
}
|
|
2393
|
-
var
|
|
2461
|
+
var Rn = [
|
|
2394
2462
|
"context",
|
|
2395
2463
|
"embedKey",
|
|
2396
2464
|
"user",
|
|
2397
2465
|
"getSubjectToken",
|
|
2398
2466
|
"agent"
|
|
2399
2467
|
];
|
|
2400
|
-
function
|
|
2468
|
+
function zn() {
|
|
2401
2469
|
var e, t, n, r, i, a, o, s, c, l, u, d, f, p;
|
|
2402
2470
|
return t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakMap(), r = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakSet(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), e = class extends HTMLElement {
|
|
2403
2471
|
constructor() {
|
|
2404
|
-
super(),
|
|
2472
|
+
super(), Tn(this, d), X(this, t, void 0), X(this, n, null), X(this, r, !1), X(this, i, !1), X(this, a, ""), X(this, o, void 0), X(this, s, void 0), X(this, c, void 0), X(this, l, void 0), X(this, u, void 0), X(this, f, (e) => {
|
|
2405
2473
|
let { type: t, ...n } = e;
|
|
2406
2474
|
Q(a, this, n.sessionId), this.dispatchEvent(new CustomEvent(t, {
|
|
2407
2475
|
detail: n,
|
|
@@ -2411,14 +2479,14 @@ function Ln() {
|
|
|
2411
2479
|
}), X(this, p, (e) => {
|
|
2412
2480
|
Q(n, this, e), e && Q(a, this, e.sessionId());
|
|
2413
2481
|
});
|
|
2414
|
-
let e = this.attachShadow({ mode: "open" }), m =
|
|
2482
|
+
let e = this.attachShadow({ mode: "open" }), m = kn();
|
|
2415
2483
|
if (m) e.adoptedStyleSheets = [m];
|
|
2416
2484
|
else {
|
|
2417
2485
|
let t = document.createElement("style");
|
|
2418
|
-
t.textContent =
|
|
2486
|
+
t.textContent = Cn, e.append(t);
|
|
2419
2487
|
}
|
|
2420
2488
|
Q(t, this, document.createElement("div")), e.append($(t, this));
|
|
2421
|
-
for (let e of
|
|
2489
|
+
for (let e of Rn) {
|
|
2422
2490
|
if (!Object.hasOwn(this, e)) continue;
|
|
2423
2491
|
let t = this[e];
|
|
2424
2492
|
delete this[e], this[e] = t;
|
|
@@ -2433,14 +2501,14 @@ function Ln() {
|
|
|
2433
2501
|
attributeChangedCallback(e, t, r) {
|
|
2434
2502
|
if (t !== r) {
|
|
2435
2503
|
if (e === "open" && $(n, this)) {
|
|
2436
|
-
|
|
2504
|
+
Pn(r) ? $(n, this).open() : $(n, this).close();
|
|
2437
2505
|
return;
|
|
2438
2506
|
}
|
|
2439
2507
|
Z(d, this, m).call(this);
|
|
2440
2508
|
}
|
|
2441
2509
|
}
|
|
2442
2510
|
get context() {
|
|
2443
|
-
return $(o, this) ??
|
|
2511
|
+
return $(o, this) ?? Mn(this.getAttribute("context"));
|
|
2444
2512
|
}
|
|
2445
2513
|
set context(e) {
|
|
2446
2514
|
Q(o, this, e), Z(d, this, m).call(this);
|
|
@@ -2452,7 +2520,7 @@ function Ln() {
|
|
|
2452
2520
|
Q(u, this, e), Z(d, this, m).call(this);
|
|
2453
2521
|
}
|
|
2454
2522
|
get user() {
|
|
2455
|
-
return $(s, this) ??
|
|
2523
|
+
return $(s, this) ?? jn(this.getAttribute("user"));
|
|
2456
2524
|
}
|
|
2457
2525
|
set user(e) {
|
|
2458
2526
|
Q(s, this, e), Z(d, this, m).call(this);
|
|
@@ -2470,7 +2538,7 @@ function Ln() {
|
|
|
2470
2538
|
Q(l, this, e), Z(d, this, m).call(this);
|
|
2471
2539
|
}
|
|
2472
2540
|
get open() {
|
|
2473
|
-
return $(n, this)?.isOpen() ??
|
|
2541
|
+
return $(n, this)?.isOpen() ?? Pn(this.getAttribute("open")) ?? !1;
|
|
2474
2542
|
}
|
|
2475
2543
|
set open(e) {
|
|
2476
2544
|
e ? this.openChat() : this.closeChat();
|
|
@@ -2492,12 +2560,12 @@ function Ln() {
|
|
|
2492
2560
|
}
|
|
2493
2561
|
sendMessage(e) {
|
|
2494
2562
|
if (!$(n, this)) {
|
|
2495
|
-
|
|
2563
|
+
An("sendMessage() called before the component was mounted — ignored");
|
|
2496
2564
|
return;
|
|
2497
2565
|
}
|
|
2498
2566
|
$(n, this).send(e);
|
|
2499
2567
|
}
|
|
2500
|
-
}, Ge(e, "observedAttributes",
|
|
2568
|
+
}, Ge(e, "observedAttributes", Dn), e;
|
|
2501
2569
|
function m() {
|
|
2502
2570
|
$(r, this) || !$(i, this) || (Q(r, this, !0), queueMicrotask(() => {
|
|
2503
2571
|
Q(r, this, !1), $(i, this) && Z(d, this, h).call(this);
|
|
@@ -2505,7 +2573,7 @@ function Ln() {
|
|
|
2505
2573
|
}
|
|
2506
2574
|
function h() {
|
|
2507
2575
|
let e = (e) => this.getAttribute(e) ?? void 0;
|
|
2508
|
-
ie(/* @__PURE__ */ Y(
|
|
2576
|
+
ie(/* @__PURE__ */ Y(Sn, {
|
|
2509
2577
|
embedKey: this.embedKey,
|
|
2510
2578
|
context: this.context,
|
|
2511
2579
|
user: this.user,
|
|
@@ -2516,28 +2584,28 @@ function Ln() {
|
|
|
2516
2584
|
assistantName: e("assistant-name"),
|
|
2517
2585
|
placeholder: e("placeholder"),
|
|
2518
2586
|
greeting: e("greeting"),
|
|
2519
|
-
suggestions:
|
|
2587
|
+
suggestions: Nn(this.getAttribute("suggestions")),
|
|
2520
2588
|
width: e("width"),
|
|
2521
2589
|
accent: e("accent"),
|
|
2522
|
-
theme:
|
|
2523
|
-
position:
|
|
2524
|
-
layout:
|
|
2525
|
-
defaultOpen:
|
|
2526
|
-
persistOpen:
|
|
2590
|
+
theme: Fn(this.getAttribute("theme")),
|
|
2591
|
+
position: In(this.getAttribute("position")),
|
|
2592
|
+
layout: Ln(this.getAttribute("layout")),
|
|
2593
|
+
defaultOpen: Pn(this.getAttribute("open")) ?? !1,
|
|
2594
|
+
persistOpen: Pn(this.getAttribute("persist-open")) ?? !0,
|
|
2527
2595
|
locale: e("locale"),
|
|
2528
2596
|
onEvent: $(f, this),
|
|
2529
2597
|
bind: $(p, this)
|
|
2530
2598
|
}), $(t, this));
|
|
2531
2599
|
}
|
|
2532
2600
|
}
|
|
2533
|
-
var
|
|
2534
|
-
function
|
|
2535
|
-
typeof window > "u" || typeof HTMLElement > "u" || (
|
|
2601
|
+
var Bn;
|
|
2602
|
+
function Vn(e = En) {
|
|
2603
|
+
typeof window > "u" || typeof HTMLElement > "u" || (Bn ?? (Bn = zn()), window.customElements.get(e) || window.customElements.define(e, Bn));
|
|
2536
2604
|
}
|
|
2537
2605
|
//#endregion
|
|
2538
2606
|
//#region src/index.ts
|
|
2539
|
-
|
|
2607
|
+
Vn();
|
|
2540
2608
|
//#endregion
|
|
2541
|
-
export { qe as a, je as c, J as i,
|
|
2609
|
+
export { qe as a, je as c, J as i, Vn as n, Be as o, Ke as r, Ae as s, En as t };
|
|
2542
2610
|
|
|
2543
|
-
//# sourceMappingURL=src-
|
|
2611
|
+
//# sourceMappingURL=src-D6ZMGuKC.js.map
|