@squadico/chatbot 1.5.2 → 1.6.0

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