@useago/sdk 1.13.0 → 1.13.2

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/angular.cjs +1 -1
  3. package/dist/angular.d.cts +43 -10
  4. package/dist/angular.d.ts +43 -10
  5. package/dist/angular.js +4 -4
  6. package/dist/autoContinue-C3UsCvT5.cjs +1 -0
  7. package/dist/{autoContinue-CC8K9mBU.js → autoContinue-Cb4_iEbO.js} +1 -1
  8. package/dist/{createConversationSession-CiOXKWl0.cjs → createConversationSession-Digvn0GQ.cjs} +1 -1
  9. package/dist/{createConversationSession-BfJg0WyA.js → createConversationSession-DrmOaZdO.js} +1 -1
  10. package/dist/{createFormCollector-DnQl77Ko.cjs → createFormCollector-Cq7HWjtU.cjs} +1 -1
  11. package/dist/{createFormCollector-DN1xjAv5.js → createFormCollector-ki_GTlp9.js} +1 -1
  12. package/dist/devtools.d.cts +34 -5
  13. package/dist/devtools.d.ts +34 -5
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +34 -5
  16. package/dist/index.d.ts +34 -5
  17. package/dist/index.js +4 -4
  18. package/dist/react.cjs +3 -3
  19. package/dist/react.d.cts +40 -6
  20. package/dist/react.d.ts +40 -6
  21. package/dist/react.js +290 -284
  22. package/dist/testing.d.cts +34 -5
  23. package/dist/testing.d.ts +34 -5
  24. package/dist/{types-Q7t1peH-.js → types-D1ZrqVhr.js} +884 -776
  25. package/dist/types-DNr6XEwI.cjs +10 -0
  26. package/dist/vue.cjs +1 -1
  27. package/dist/vue.d.cts +38 -7
  28. package/dist/vue.d.ts +38 -7
  29. package/dist/vue.js +57 -57
  30. package/dist/widget.cjs +6 -6
  31. package/dist/widget.d.cts +34 -5
  32. package/dist/widget.d.ts +34 -5
  33. package/dist/widget.js +136 -136
  34. package/llms-full.txt +56 -3
  35. package/package.json +1 -1
  36. package/dist/autoContinue-CP9pJR-V.cjs +0 -1
  37. package/dist/types-a7teDBnC.cjs +0 -10
package/dist/widget.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as Bi, c as Ro, n as Di, o as zo, s as Ho, t as $i } from "./types-Q7t1peH-.js";
1
+ import { a as Bi, c as Ro, n as Di, o as zo, s as Ho, t as $i } from "./types-D1ZrqVhr.js";
2
2
  import { n as Mi } from "./errors-BLfjXnLB.js";
3
- import { t as Wi } from "./createConversationSession-BfJg0WyA.js";
4
- import { r as ji, t as Pi } from "./createFormCollector-DN1xjAv5.js";
3
+ import { t as Wi } from "./createConversationSession-DrmOaZdO.js";
4
+ import { r as ji, t as Pi } from "./createFormCollector-ki_GTlp9.js";
5
5
  import { $ as ee, A as bn, B as Ui, C as Ka, D as Y, E as Vi, F as xn, G as xo, H as Oo, I as qi, J as Gi, K as yn, L as Ki, M as Cn, N as Le, O as fe, P as Bo, Q as Mt, R as Do, S as Xa, T as wn, U as ye, V as tt, W as vn, X as Xi, Y as yo, Z as $o, _ as Yi, a as Qi, at as c, b as Ji, c as Zi, ct as er, d as Mo, dt as mn, et as tr, f as Wo, g as nr, h as or, i as ir, it as f, j as rr, k as nt, l as ar, lt as sr, m as lr, n as dr, nt as Co, o as cr, ot as pr, p as ur, q as jo, r as Fn, rt as fr, s as mr, st as gr, t as Ya, tt as hr, u as br, ut as wo, v as xr, w as ot, x as yr, y as Cr, z as jt } from "./speechToText-BV7qxqPF.js";
6
6
  var wr = 10 * 1024 * 1024;
7
7
  var vo = [
@@ -105,14 +105,14 @@ function vr(t) {
105
105
  maxHeight: `${b}px`,
106
106
  overflowY: "hidden"
107
107
  });
108
- const g = () => {
109
- const m = e ? 0 : 2;
108
+ const m = () => {
109
+ const g = e ? 0 : 2;
110
110
  l.style.height = "auto";
111
- const B = Math.min(l.scrollHeight + m, b);
112
- l.style.height = `${B}px`, l.style.overflowY = l.scrollHeight + m > b ? "auto" : "hidden";
111
+ const B = Math.min(l.scrollHeight + g, b);
112
+ l.style.height = `${B}px`, l.style.overflowY = l.scrollHeight + g > b ? "auto" : "hidden";
113
113
  };
114
114
  l.addEventListener("input", () => {
115
- g(), k();
115
+ m(), k();
116
116
  });
117
117
  const p = '<svg width="18" height="18" viewBox="0 -960 960 960" fill="currentColor" aria-hidden="true"><path d="M440-160v-487L216-423l-56-57 320-320 320 320-56 57-224-224v487h-80Z"/></svg>', y = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true" style="animation: ago-spin 0.8s linear infinite"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>', H = '<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><rect x="5" y="5" width="14" height="14" rx="2"/></svg>', E = document.createElement("button");
118
118
  E.type = "submit", E.className = "ago-chat-input__send", E.setAttribute("aria-label", "Send"), e ? f(E, {
@@ -145,7 +145,7 @@ function vr(t) {
145
145
  }));
146
146
  let u = !1, v = !1;
147
147
  const L = () => u && !!t.onStop, k = () => {
148
- const m = l.value.trim() !== "" || o.length > 0, B = L(), q = !B && (u || v || !m);
148
+ const g = l.value.trim() !== "", B = L(), q = !B && (u || v || !g);
149
149
  if (E.disabled = q, E.type = B ? "button" : "submit", E.setAttribute("aria-label", B ? "Stop generating" : "Send"), e) {
150
150
  E.replaceChildren(B ? Cr({ size: 16 }) : mr({ size: 16 }));
151
151
  const U = q && !u;
@@ -185,12 +185,12 @@ function vr(t) {
185
185
  }), w.addEventListener("click", () => {
186
186
  N.style.display = "none";
187
187
  }), N.append(P, w);
188
- const z = (m) => {
189
- P.textContent = m, N.style.display = "flex";
190
- }, C = (m, B) => m.replace(/\{(\w+)\}/g, (q, U) => B[U] ?? ""), S = (m) => {
191
- if (!e) return m;
188
+ const z = (g) => {
189
+ P.textContent = g, N.style.display = "flex";
190
+ }, C = (g, B) => g.replace(/\{(\w+)\}/g, (q, U) => B[U] ?? ""), S = (g) => {
191
+ if (!e) return g;
192
192
  const B = t.labels, q = [];
193
- for (const U of m) {
193
+ for (const U of g) {
194
194
  if (o.length + q.length >= 5) {
195
195
  z(C(B?.tooManyFiles ?? "Too many files. Maximum allowed: {max}", { max: String(5) }));
196
196
  break;
@@ -237,20 +237,20 @@ function vr(t) {
237
237
  cursor: "pointer",
238
238
  fontSize: "14px"
239
239
  })), O.addEventListener("click", () => T?.click()), T.addEventListener("change", () => {
240
- const m = Array.from(T?.files ?? []);
241
- o = [...o, ...S(m)], T && (T.value = ""), V();
240
+ const g = Array.from(T?.files ?? []);
241
+ o = [...o, ...S(g)], T && (T.value = ""), V();
242
242
  }));
243
- function G(m) {
244
- if (!e || !m.type.startsWith("image/") || typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
245
- let B = n.get(m);
246
- return B || (B = URL.createObjectURL(m), n.set(m, B)), B;
243
+ function G(g) {
244
+ if (!e || !g.type.startsWith("image/") || typeof URL > "u" || typeof URL.createObjectURL != "function") return null;
245
+ let B = n.get(g);
246
+ return B || (B = URL.createObjectURL(g), n.set(g, B)), B;
247
247
  }
248
- function M(m) {
249
- const B = n.get(m);
250
- B && (URL.revokeObjectURL(B), n.delete(m));
248
+ function M(g) {
249
+ const B = n.get(g);
250
+ B && (URL.revokeObjectURL(B), n.delete(g));
251
251
  }
252
252
  function V() {
253
- a.replaceChildren(), e && (a.style.display = o.length > 0 ? "flex" : "none"), o.forEach((m, B) => {
253
+ a.replaceChildren(), e && (a.style.display = o.length > 0 ? "flex" : "none"), o.forEach((g, B) => {
254
254
  const q = c(e ? {
255
255
  display: "flex",
256
256
  alignItems: "center",
@@ -271,7 +271,7 @@ function vr(t) {
271
271
  fontSize: "12px"
272
272
  });
273
273
  if (q.className = "ago-chat-input__file", e) {
274
- const le = G(m);
274
+ const le = G(g);
275
275
  if (le) {
276
276
  const ve = document.createElement("img");
277
277
  ve.src = le, ve.alt = "", f(ve, {
@@ -284,21 +284,21 @@ function vr(t) {
284
284
  } else q.appendChild(ur({ size: 20 }));
285
285
  }
286
286
  const U = document.createElement("span");
287
- if (U.textContent = m.name, U.title = m.name, e && f(U, {
287
+ if (U.textContent = g.name, U.title = g.name, e && f(U, {
288
288
  maxWidth: "150px",
289
289
  overflow: "hidden",
290
290
  textOverflow: "ellipsis",
291
291
  whiteSpace: "nowrap"
292
292
  }), q.appendChild(U), e) {
293
293
  const le = document.createElement("span");
294
- le.textContent = ko(m.size), f(le, {
294
+ le.textContent = ko(g.size), f(le, {
295
295
  fontSize: "12px",
296
296
  lineHeight: "16px",
297
297
  color: "#6b7280"
298
298
  }), q.appendChild(le);
299
299
  }
300
300
  const oe = document.createElement("button");
301
- oe.type = "button", oe.setAttribute("aria-label", `Remove ${m.name}`), e ? oe.appendChild(Mo({ size: 16 })) : oe.textContent = "×", f(oe, {
301
+ oe.type = "button", oe.setAttribute("aria-label", `Remove ${g.name}`), e ? oe.appendChild(Mo({ size: 16 })) : oe.textContent = "×", f(oe, {
302
302
  flexShrink: "0",
303
303
  width: "44px",
304
304
  height: "44px",
@@ -313,41 +313,41 @@ function vr(t) {
313
313
  lineHeight: "1",
314
314
  color: "inherit"
315
315
  }), oe.addEventListener("click", () => {
316
- M(m), o = o.filter((le, ve) => ve !== B), V();
316
+ M(g), o = o.filter((le, ve) => ve !== B), V();
317
317
  }), q.appendChild(oe), a.appendChild(q);
318
318
  }), k();
319
319
  }
320
320
  const x = () => {
321
321
  $?.cancel();
322
- const m = l.value, B = o;
323
- l.value = "", g(), o = [];
322
+ const g = l.value, B = o;
323
+ l.value = "", m(), o = [];
324
324
  for (const q of B) M(q);
325
325
  return V(), {
326
- content: m,
326
+ content: g,
327
327
  files: B
328
328
  };
329
329
  }, F = () => {
330
- if (u || v) return;
331
- const { content: m, files: B } = x();
332
- (m.trim() || B.length > 0) && (t.onSend(m.trim(), B.length > 0 ? B : void 0), e && typeof window < "u" && window.innerWidth < (t.blurOnSubmitBelow ?? 600) && l.blur());
330
+ if (u || v || !l.value.trim()) return;
331
+ const { content: g, files: B } = x();
332
+ t.onSend(g.trim(), B.length > 0 ? B : void 0), e && typeof window < "u" && window.innerWidth < (t.blurOnSubmitBelow ?? 600) && l.blur();
333
333
  };
334
- i.addEventListener("submit", (m) => {
335
- m.preventDefault(), F();
336
- }), l.addEventListener("keydown", (m) => {
337
- if (m.key === "Enter" && !m.shiftKey) {
338
- if (m.isComposing || m.keyCode === 229) return;
339
- m.preventDefault(), F();
334
+ i.addEventListener("submit", (g) => {
335
+ g.preventDefault(), F();
336
+ }), l.addEventListener("keydown", (g) => {
337
+ if (g.key === "Enter" && !g.shiftKey) {
338
+ if (g.isComposing || g.keyCode === 229) return;
339
+ g.preventDefault(), F();
340
340
  }
341
341
  });
342
342
  const $ = t.transcribeAudio ? dr({
343
343
  transcribe: t.transcribeAudio,
344
344
  labels: t.speechToTextLabels,
345
- onBusy: (m) => {
346
- const B = v && !m && !u && i.contains(document.activeElement);
347
- v = m, l.disabled = u || m, e ? (te.style.display = m ? "none" : "", J.style.display = m ? "none" : "flex", d.style.padding = m ? "8px" : "16px", $ && (m ? d.append($.el) : J.prepend($.el))) : (l.style.display = m ? "none" : "", E.style.display = m ? "none" : "flex", O && (O.style.display = m ? "none" : "flex")), k(), B && l.focus();
345
+ onBusy: (g) => {
346
+ const B = v && !g && !u && i.contains(document.activeElement);
347
+ v = g, l.disabled = u || g, e ? (te.style.display = g ? "none" : "", J.style.display = g ? "none" : "flex", d.style.padding = g ? "8px" : "16px", $ && (g ? d.append($.el) : J.prepend($.el))) : (l.style.display = g ? "none" : "", E.style.display = g ? "none" : "flex", O && (O.style.display = g ? "none" : "flex")), k(), B && l.focus();
348
348
  },
349
- onText: (m) => {
350
- l.value += `${l.value && !/\s$/.test(l.value) ? " " : ""}${m}`, g(), k(), l.focus();
349
+ onText: (g) => {
350
+ l.value += `${l.value && !/\s$/.test(l.value) ? " " : ""}${g}`, m(), k(), l.focus();
351
351
  },
352
352
  onError: z
353
353
  }) : void 0, te = c({
@@ -363,11 +363,11 @@ function vr(t) {
363
363
  });
364
364
  if (e) {
365
365
  te.append(N, a, l);
366
- const m = c({
366
+ const g = c({
367
367
  display: "flex",
368
368
  alignItems: "center"
369
369
  });
370
- m.className = "ago-chat-input__toolbar", O && m.appendChild(O), O && te.appendChild(m), $ && J.appendChild($.el), J.appendChild(E), d.append(te, J), T && i.appendChild(T), i.appendChild(d), i.addEventListener("click", (B) => {
370
+ g.className = "ago-chat-input__toolbar", O && g.appendChild(O), O && te.appendChild(g), $ && J.appendChild($.el), J.appendChild(E), d.append(te, J), T && i.appendChild(T), i.appendChild(d), i.addEventListener("click", (B) => {
371
371
  (B.target instanceof Element ? B.target : null)?.closest("button,a,input,textarea") || l.focus();
372
372
  });
373
373
  } else
@@ -375,22 +375,22 @@ function vr(t) {
375
375
  return k(), {
376
376
  inputRow: i,
377
377
  getValueAndClear: x,
378
- setDisabled: (m) => {
379
- u = m, $?.setDisabled(m), l.disabled = m || v, k();
378
+ setDisabled: (g) => {
379
+ u = g, $?.setDisabled(g), l.disabled = g || v, k();
380
380
  },
381
381
  focus: () => l.focus(),
382
382
  blur: () => l.blur(),
383
- restoreDraft: (m, B) => {
384
- m && !l.value.trim() && (l.value = m, g()), B?.length && (o = [...B, ...o], V()), k();
383
+ restoreDraft: (g, B) => {
384
+ g && !l.value.trim() && (l.value = g, m()), B?.length && (o = [...B, ...o], V()), k();
385
385
  },
386
- setPlaceholder: (m) => {
387
- l.placeholder = m, m && l.setAttribute("aria-label", m);
386
+ setPlaceholder: (g) => {
387
+ l.placeholder = g, g && l.setAttribute("aria-label", g);
388
388
  },
389
- setSpeechToTextEnabled: (m) => $?.setEnabled(m),
389
+ setSpeechToTextEnabled: (g) => $?.setEnabled(g),
390
390
  cancelRecording: () => $?.cancel(),
391
391
  destroy: () => {
392
392
  $?.destroy();
393
- for (const m of n.keys()) M(m);
393
+ for (const g of n.keys()) M(g);
394
394
  }
395
395
  };
396
396
  }
@@ -411,7 +411,7 @@ function kr(t) {
411
411
  });
412
412
  const n = /* @__PURE__ */ new Map();
413
413
  let i = "home";
414
- function a(l, b, g) {
414
+ function a(l, b, m) {
415
415
  const p = document.createElement("button");
416
416
  p.type = "button", p.className = "ago-chat-widget__tab", p.dataset.agoScreen = l, f(p, {
417
417
  flex: "1",
@@ -438,7 +438,7 @@ function kr(t) {
438
438
  whiteSpace: "nowrap",
439
439
  overflow: "hidden",
440
440
  textOverflow: "ellipsis"
441
- }), p.append(g, y), p.addEventListener("mouseenter", () => {
441
+ }), p.append(m, y), p.addEventListener("mouseenter", () => {
442
442
  p.style.backgroundColor = gn;
443
443
  }), p.addEventListener("mouseleave", () => {
444
444
  p.style.backgroundColor = i === l ? gn : "transparent";
@@ -447,9 +447,9 @@ function kr(t) {
447
447
  o.append(a("home", t.labels.home, or({ size: 24 })), a("history", t.labels.chats, Wo({ size: 24 }))), e.appendChild(o);
448
448
  const d = (l) => {
449
449
  i = l === "history" ? "history" : "home";
450
- for (const [b, g] of n) {
450
+ for (const [b, m] of n) {
451
451
  const p = b === i;
452
- g.style.color = p ? yn : fe, g.style.backgroundColor = p ? gn : "transparent", p ? g.setAttribute("aria-current", "page") : g.removeAttribute("aria-current");
452
+ m.style.color = p ? yn : fe, m.style.backgroundColor = p ? gn : "transparent", p ? m.setAttribute("aria-current", "page") : m.removeAttribute("aria-current");
453
453
  }
454
454
  };
455
455
  return d("home"), {
@@ -538,8 +538,8 @@ var Po = {
538
538
  function _r(t, e = Date.now(), o = Po) {
539
539
  const n = t instanceof Date ? t.getTime() : new Date(t).getTime(), i = (p, y) => p.replace("{n}", String(y));
540
540
  if (!Number.isFinite(n)) return i(o.minutes, 0);
541
- const a = Math.max(0, Math.floor((e - n) / Sr)), d = Math.floor(a / 60), l = Math.floor(d / 24), b = Math.floor(l / 7), g = Math.max(1, Math.floor(l / 30));
542
- return a < 60 ? i(o.minutes, a) : d < 24 ? i(o.hours, d) : l < 7 ? i(o.days, l) : b < 4 ? i(o.weeks, b) : i(o.months, g);
541
+ const a = Math.max(0, Math.floor((e - n) / Sr)), d = Math.floor(a / 60), l = Math.floor(d / 24), b = Math.floor(l / 7), m = Math.max(1, Math.floor(l / 30));
542
+ return a < 60 ? i(o.minutes, a) : d < 24 ? i(o.hours, d) : l < 7 ? i(o.days, l) : b < 4 ? i(o.weeks, b) : i(o.months, m);
543
543
  }
544
544
  var Eo = {
545
545
  home: "Home",
@@ -628,8 +628,8 @@ function Ko(t) {
628
628
  display: "list-item",
629
629
  margin: "2px 0",
630
630
  lineHeight: "1.6"
631
- }), g = d[3].match(/^\[([ xX])\]\s+(.*)$/);
632
- g ? (b.style.listStyleType = "none", b.style.marginLeft = "-20px", b.innerHTML = `<span style="margin-right:6px">${g[1].toLowerCase() === "x" ? "☑" : "☐"}</span>${Pe(g[2])}`) : b.innerHTML = Pe(d[3]), l.filter((p) => et.test(p)).length > 0 && b.appendChild(Ko(l.filter((p) => p.trim() !== ""))), i.appendChild(b);
631
+ }), m = d[3].match(/^\[([ xX])\]\s+(.*)$/);
632
+ m ? (b.style.listStyleType = "none", b.style.marginLeft = "-20px", b.innerHTML = `<span style="margin-right:6px">${m[1].toLowerCase() === "x" ? "☑" : "☐"}</span>${Pe(m[2])}`) : b.innerHTML = Pe(d[3]), l.filter((p) => et.test(p)).length > 0 && b.appendChild(Ko(l.filter((p) => p.trim() !== ""))), i.appendChild(b);
633
633
  }
634
634
  return i;
635
635
  }
@@ -653,10 +653,10 @@ function Nr(t) {
653
653
  const d = document.createElement("tbody");
654
654
  for (const l of t.slice(2)) {
655
655
  const b = document.createElement("tr");
656
- for (const g of e(l)) b.appendChild(ue("td", {
656
+ for (const m of e(l)) b.appendChild(ue("td", {
657
657
  border: "1px solid #dee3e8",
658
658
  padding: "6px 10px"
659
- }, Pe(g)));
659
+ }, Pe(m)));
660
660
  d.appendChild(b);
661
661
  }
662
662
  return n.appendChild(d), o.appendChild(n), o;
@@ -675,8 +675,8 @@ function it(t) {
675
675
  }
676
676
  const d = a.match(Go);
677
677
  if (d) {
678
- const g = d[1][0], p = [];
679
- for (n++; n < o.length && !new RegExp(`^ {0,3}${g === "`" ? "`{3,}" : "~{3,}"}\\s*$`).test(o[n]); )
678
+ const m = d[1][0], p = [];
679
+ for (n++; n < o.length && !new RegExp(`^ {0,3}${m === "`" ? "`{3,}" : "~{3,}"}\\s*$`).test(o[n]); )
680
680
  p.push(o[n]), n++;
681
681
  n++;
682
682
  const y = ue("pre", { margin: "0 0 8px 0" });
@@ -703,19 +703,19 @@ function it(t) {
703
703
  }
704
704
  const l = a.match(qo);
705
705
  if (l) {
706
- const g = l[1].length;
707
- e.appendChild(ue(`h${g}`, {
706
+ const m = l[1].length;
707
+ e.appendChild(ue(`h${m}`, {
708
708
  margin: "16px 0 8px 0",
709
- fontSize: Fr[g - 1],
709
+ fontSize: Fr[m - 1],
710
710
  fontWeight: "600",
711
711
  lineHeight: "1.3"
712
712
  }, Pe(l[2]))), n++;
713
713
  continue;
714
714
  }
715
715
  if (Dt.test(a)) {
716
- const g = [];
716
+ const m = [];
717
717
  for (; n < o.length && Dt.test(o[n]); )
718
- g.push(o[n].replace(Dt, "")), n++;
718
+ m.push(o[n].replace(Dt, "")), n++;
719
719
  const p = ue("blockquote", {
720
720
  borderLeft: "4px solid #dee3e8",
721
721
  paddingLeft: "12px",
@@ -723,24 +723,24 @@ function it(t) {
723
723
  fontStyle: "italic",
724
724
  color: "#6b6d6f"
725
725
  });
726
- p.appendChild(it(g.join(`
726
+ p.appendChild(it(m.join(`
727
727
  `))), e.appendChild(p);
728
728
  continue;
729
729
  }
730
730
  if (a.includes("|") && Ir(o[n + 1])) {
731
- const g = [a, o[n + 1]];
731
+ const m = [a, o[n + 1]];
732
732
  for (n += 2; n < o.length && o[n].includes("|") && o[n].trim(); )
733
- g.push(o[n]), n++;
734
- e.appendChild(Nr(g));
733
+ m.push(o[n]), n++;
734
+ e.appendChild(Nr(m));
735
735
  continue;
736
736
  }
737
737
  if (et.test(a)) {
738
- const g = [], p = kn(a);
738
+ const m = [], p = kn(a);
739
739
  for (; n < o.length && o[n].trim() !== ""; )
740
740
  if (et.test(o[n]) || kn(o[n]) > p)
741
- g.push(o[n]), n++;
741
+ m.push(o[n]), n++;
742
742
  else break;
743
- e.appendChild(Ko(g));
743
+ e.appendChild(Ko(m));
744
744
  continue;
745
745
  }
746
746
  const b = [a];
@@ -749,7 +749,7 @@ function it(t) {
749
749
  e.appendChild(ue("p", {
750
750
  margin: "0 0 8px 0",
751
751
  lineHeight: "1.6"
752
- }, b.map((g) => Pe(g)).join("<br>")));
752
+ }, b.map((m) => Pe(m)).join("<br>")));
753
753
  }
754
754
  const i = e.lastElementChild;
755
755
  return i && (i.style.marginBottom = "0"), e;
@@ -814,13 +814,13 @@ function Rr(t, e) {
814
814
  maxWidth: "160px"
815
815
  });
816
816
  b.textContent = n.name, b.title = n.name, l.appendChild(b);
817
- const g = Ho(n.fileSize);
818
- if (g) {
817
+ const m = Ho(n.fileSize);
818
+ if (m) {
819
819
  const p = c({
820
820
  fontSize: "11px",
821
821
  color: tt
822
822
  });
823
- p.textContent = g, l.appendChild(p);
823
+ p.textContent = m, l.appendChild(p);
824
824
  }
825
825
  a.append(d, l), o.appendChild(a);
826
826
  }
@@ -873,7 +873,7 @@ function Xo(t, e) {
873
873
  return n;
874
874
  }
875
875
  function zr(t, e) {
876
- const { isLast: o, isLastOfBlock: n, bubbleStyle: i, showAgentName: a, agentBubble: d, followUpEnabled: l, followUpHandler: b, isMobile: g, feedbackRow: p } = e, y = t.role === "user", H = i === "imessage", E = c({
876
+ const { isLast: o, isLastOfBlock: n, bubbleStyle: i, showAgentName: a, agentBubble: d, followUpEnabled: l, followUpHandler: b, isMobile: m, feedbackRow: p } = e, y = t.role === "user", H = i === "imessage", E = c({
877
877
  display: "flex",
878
878
  flexDirection: "column",
879
879
  alignItems: y ? "flex-end" : "flex-start",
@@ -945,7 +945,7 @@ function zr(t, e) {
945
945
  N && E.appendChild(N);
946
946
  }
947
947
  const u = y || d || H, v = !!t.content || t.status === "IN_PROGRESS" || t.status === "WAITING_CLIENT", L = c({
948
- maxWidth: u ? H || y ? g ? "88%" : "75%" : g ? "92%" : "85%" : "100%",
948
+ maxWidth: u ? H || y ? m ? "88%" : "75%" : m ? "92%" : "85%" : "100%",
949
949
  padding: u ? "10px 14px" : "2px 8px",
950
950
  borderRadius: H ? Ui : u ? jt : "0",
951
951
  backgroundColor: y ? fe : u ? wn : "transparent",
@@ -1412,13 +1412,13 @@ function Yr(t, e) {
1412
1412
  const n = [], i = [], a = (d) => {
1413
1413
  const l = d.detail;
1414
1414
  if (!l || l.token !== e) return;
1415
- const b = l.form, g = b && typeof b == "object" && "jquery" in b && b.jquery ? b[0] : b;
1416
- if (!g || typeof g.querySelectorAll != "function") return;
1417
- Wt(g, o);
1415
+ const b = l.form, m = b && typeof b == "object" && "jquery" in b && b.jquery ? b[0] : b;
1416
+ if (!m || typeof m.querySelectorAll != "function") return;
1417
+ Wt(m, o);
1418
1418
  const p = new MutationObserver(() => {
1419
- Wt(g, o);
1419
+ Wt(m, o);
1420
1420
  });
1421
- p.observe(g, {
1421
+ p.observe(m, {
1422
1422
  childList: !0,
1423
1423
  subtree: !0
1424
1424
  }), n.push(p), i.push(setTimeout(() => p.disconnect(), 1e4));
@@ -1522,9 +1522,9 @@ function ea(t, e, o, n) {
1522
1522
  v?.tagName === "FORM" && l(v);
1523
1523
  };
1524
1524
  t.addEventListener("submit", b, !0);
1525
- const g = /* @__PURE__ */ new WeakSet();
1525
+ const m = /* @__PURE__ */ new WeakSet();
1526
1526
  function p(u) {
1527
- g.has(u) || (g.add(u), u.addEventListener("submit", () => l(u)));
1527
+ m.has(u) || (m.add(u), u.addEventListener("submit", () => l(u)));
1528
1528
  }
1529
1529
  for (const u of t.querySelectorAll("form")) p(u);
1530
1530
  const y = new MutationObserver(() => {
@@ -1816,7 +1816,7 @@ function da(t) {
1816
1816
  }
1817
1817
  }
1818
1818
  }
1819
- function g(u, v) {
1819
+ function m(u, v) {
1820
1820
  const L = se(u);
1821
1821
  e.customFields[L] = v, n && Ze(n, e.customFields, e.ticket.typology), e.submittedOnce && l(), E();
1822
1822
  }
@@ -1838,7 +1838,7 @@ function da(t) {
1838
1838
  width: "16px",
1839
1839
  height: "16px",
1840
1840
  margin: "0"
1841
- }), T.addEventListener("change", () => g(u, T.checked ? "true" : "false"));
1841
+ }), T.addEventListener("change", () => m(u, T.checked ? "true" : "false"));
1842
1842
  const O = document.createElement("label");
1843
1843
  return O.htmlFor = L, O.textContent = u.title ?? "", O.style.fontWeight = "600", S.append(T, O), P && S.appendChild(we(P)), S;
1844
1844
  }
@@ -1858,7 +1858,7 @@ function da(t) {
1858
1858
  x || (x = document.createElement("optgroup"), x.label = M.group, O.set(M.group, x), S.appendChild(x)), x.appendChild(V);
1859
1859
  } else S.appendChild(V);
1860
1860
  }
1861
- S.value = k, je(S, !!P, N), S.addEventListener("change", () => g(u, S.value)), w.appendChild(S);
1861
+ S.value = k, je(S, !!P, N), S.addEventListener("change", () => m(u, S.value)), w.appendChild(S);
1862
1862
  const G = z.find((M) => (M.value ?? M.name) === k);
1863
1863
  if (P && w.appendChild(we(P)), G?.message) {
1864
1864
  const M = {
@@ -2073,7 +2073,7 @@ function da(t) {
2073
2073
  flexDirection: "column",
2074
2074
  gap: "4px"
2075
2075
  });
2076
- e.files.forEach((J, m) => {
2076
+ e.files.forEach((J, g) => {
2077
2077
  const B = c({
2078
2078
  display: "flex",
2079
2079
  alignItems: "center",
@@ -2096,7 +2096,7 @@ function da(t) {
2096
2096
  height: "44px",
2097
2097
  margin: "-10px -12px -10px 0"
2098
2098
  }), U.addEventListener("click", () => {
2099
- e.files = e.files.filter((oe, le) => le !== m), E();
2099
+ e.files = e.files.filter((oe, le) => le !== g), E();
2100
2100
  }), B.append(q, U), te.appendChild(B);
2101
2101
  }), x.appendChild(te), d.appendChild(x);
2102
2102
  }
@@ -2190,12 +2190,12 @@ function ma(t) {
2190
2190
  });
2191
2191
  a.className = "ago-embed-form__body", i.appendChild(a);
2192
2192
  const d = [];
2193
- let l, b = !1, g = e.status === "submitted", p = null;
2193
+ let l, b = !1, m = e.status === "submitted", p = null;
2194
2194
  const y = ua(t.ticket, t.email), H = (C) => {
2195
- g || b || (g = !0, l && (clearTimeout(l), l = void 0), e.status = "submitted", e.captured = C ?? null, z(), t.onSubmitted(C ?? null));
2195
+ m || b || (m = !0, l && (clearTimeout(l), l = void 0), e.status = "submitted", e.captured = C ?? null, z(), t.onSubmitted(C ?? null));
2196
2196
  }, E = () => {
2197
- g || l || (b = !1, l = setTimeout(() => {
2198
- g || (l = void 0, e.status = "timeout", z());
2197
+ m || l || (b = !1, l = setTimeout(() => {
2198
+ m || (l = void 0, e.status = "timeout", z());
2199
2199
  }, 3e4));
2200
2200
  }, u = () => {
2201
2201
  try {
@@ -2318,7 +2318,7 @@ function ma(t) {
2318
2318
  minHeight: "44px",
2319
2319
  font: "inherit"
2320
2320
  }), O.addEventListener("click", () => {
2321
- b = !0, g = !1, l = void 0, e.status = "ready", z();
2321
+ b = !0, m = !1, l = void 0, e.status = "ready", z();
2322
2322
  }), S.append(T, O), a.appendChild(S);
2323
2323
  return;
2324
2324
  }
@@ -2596,12 +2596,12 @@ function Ea(t) {
2596
2596
  maxWidth: "85%"
2597
2597
  });
2598
2598
  b.className = "ago-feedback";
2599
- const g = c({
2599
+ const m = c({
2600
2600
  display: "flex",
2601
2601
  alignItems: "center",
2602
2602
  gap: d ? "8px" : "2px"
2603
2603
  });
2604
- g.className = "ago-feedback__actions";
2604
+ m.className = "ago-feedback__actions";
2605
2605
  const p = No("up", o.helpful, e.rating === "positive", l, d);
2606
2606
  p.addEventListener("click", () => {
2607
2607
  e.rating = "positive", e.detailsOpen = !1, E(), u(), i("positive");
@@ -2609,7 +2609,7 @@ function Ea(t) {
2609
2609
  const y = No("down", o.notHelpful, e.rating === "negative", l, d);
2610
2610
  y.addEventListener("click", () => {
2611
2611
  e.rating = "negative", i("negative"), n && !e.reported && (e.detailsOpen = !0), E(), u();
2612
- }), g.append(p, y), d && b.appendChild(c({ flex: "1" })), b.appendChild(g);
2612
+ }), m.append(p, y), d && b.appendChild(c({ flex: "1" })), b.appendChild(m);
2613
2613
  const H = c();
2614
2614
  H.className = "ago-feedback__panel-slot", d && (H.style.flexBasis = "100%"), b.appendChild(H);
2615
2615
  function E() {
@@ -2666,9 +2666,9 @@ function _a(t, e, o) {
2666
2666
  marginBottom: "8px"
2667
2667
  });
2668
2668
  a.className = "ago-feedback__reasons";
2669
- for (const g of $i) {
2669
+ for (const m of $i) {
2670
2670
  const p = document.createElement("button");
2671
- p.type = "button", p.className = "ago-feedback__reason", p.textContent = e.reasons[g], f(p, {
2671
+ p.type = "button", p.className = "ago-feedback__reason", p.textContent = e.reasons[m], f(p, {
2672
2672
  minHeight: "44px",
2673
2673
  padding: "4px 12px",
2674
2674
  fontSize: "13px",
@@ -2680,11 +2680,11 @@ function _a(t, e, o) {
2680
2680
  cursor: "pointer"
2681
2681
  });
2682
2682
  const y = () => {
2683
- const H = t.reasons.has(g);
2683
+ const H = t.reasons.has(m);
2684
2684
  p.setAttribute("aria-pressed", H ? "true" : "false"), p.style.borderColor = H ? ot : Y, p.style.color = H ? ot : ee;
2685
2685
  };
2686
2686
  p.addEventListener("click", () => {
2687
- t.reasons.has(g) ? t.reasons.delete(g) : t.reasons.add(g), y(), b();
2687
+ t.reasons.has(m) ? t.reasons.delete(m) : t.reasons.add(m), y(), b();
2688
2688
  }), y(), a.appendChild(p);
2689
2689
  }
2690
2690
  n.appendChild(a);
@@ -2719,13 +2719,13 @@ function _a(t, e, o) {
2719
2719
  l.disabled || (l.disabled = !0, o({
2720
2720
  reasons: [...t.reasons],
2721
2721
  comment: t.comment.trim()
2722
- }).then((g) => {
2723
- g || b();
2722
+ }).then((m) => {
2723
+ m || b();
2724
2724
  }));
2725
2725
  }), n.appendChild(l), b(), n;
2726
2726
  function b() {
2727
- const g = t.reasons.size > 0 || t.comment.trim().length > 0;
2728
- l.disabled = !g, l.style.opacity = g ? "1" : "0.5", l.style.cursor = g ? "pointer" : "default";
2727
+ const m = t.reasons.size > 0 || t.comment.trim().length > 0;
2728
+ l.disabled = !m, l.style.opacity = m ? "1" : "0.5", l.style.cursor = m ? "pointer" : "default";
2729
2729
  }
2730
2730
  }
2731
2731
  function Ta(t) {
@@ -2875,7 +2875,7 @@ function Na(t) {
2875
2875
  margin: "0"
2876
2876
  }), p.append(y, H), o.replaceChildren(p);
2877
2877
  }
2878
- function g(p) {
2878
+ function m(p) {
2879
2879
  const y = c({
2880
2880
  flex: "1",
2881
2881
  overflowY: "auto",
@@ -2936,7 +2936,7 @@ function Na(t) {
2936
2936
  return {
2937
2937
  el: e,
2938
2938
  render: ({ threads: p, loading: y }) => {
2939
- y ? l() : p.length === 0 ? b() : g(p);
2939
+ y ? l() : p.length === 0 ? b() : m(p);
2940
2940
  }
2941
2941
  };
2942
2942
  }
@@ -3006,7 +3006,7 @@ function Ia(t) {
3006
3006
  justifyContent: "center",
3007
3007
  width: "100%",
3008
3008
  position: "relative"
3009
- }), g = c({
3009
+ }), m = c({
3010
3010
  display: "grid",
3011
3011
  gridTemplateColumns: "1fr",
3012
3012
  gap: "12px",
@@ -3016,13 +3016,13 @@ function Ia(t) {
3016
3016
  padding: "0 16px",
3017
3017
  boxSizing: "border-box"
3018
3018
  });
3019
- g.className = "ago-chat-widget__starters";
3019
+ m.className = "ago-chat-widget__starters";
3020
3020
  const p = [];
3021
3021
  let y = null;
3022
3022
  const H = (w) => {
3023
- g.replaceChildren(), p.length = 0;
3023
+ m.replaceChildren(), p.length = 0;
3024
3024
  for (const z of w) E(z);
3025
- w.length > 0 ? g.parentNode || b.insertBefore(g, u) : g.remove();
3025
+ w.length > 0 ? m.parentNode || b.insertBefore(m, u) : m.remove();
3026
3026
  };
3027
3027
  function E(w) {
3028
3028
  const z = document.createElement("button");
@@ -3067,7 +3067,7 @@ function Ia(t) {
3067
3067
  }), p.push({
3068
3068
  starter: w,
3069
3069
  btn: z
3070
- }), g.appendChild(z);
3070
+ }), m.appendChild(z);
3071
3071
  }
3072
3072
  const u = c({ width: "100%" });
3073
3073
  u.className = "ago-chat-widget__home-composer", b.appendChild(u), H(t.starters);
@@ -3075,7 +3075,7 @@ function Ia(t) {
3075
3075
  o.append(n, b, v), e.appendChild(o);
3076
3076
  const L = t.twoColumnsFrom ?? 640, k = () => {
3077
3077
  const w = typeof window < "u" && window.innerWidth >= L;
3078
- g.style.gridTemplateColumns = w ? "1fr 1fr" : "1fr";
3078
+ m.style.gridTemplateColumns = w ? "1fr 1fr" : "1fr";
3079
3079
  };
3080
3080
  k();
3081
3081
  const N = (w) => {
@@ -3197,7 +3197,7 @@ function Wa(t) {
3197
3197
  return e;
3198
3198
  }
3199
3199
  function Qa(t, e) {
3200
- const o = e.placement ?? "inline", n = o === "bubble", { welcomeMessage: i = "Hello! How can I help you today?", allowFiles: a = !1, allowStop: d = !0, autoScroll: l = !0, height: b = 500, defaultOpen: g = !1, logoUrl: p, showAgentName: y = !1, agentBubble: H = !1, bubbleStyle: E = "default", showHeader: u = !0, forms: v, formSubmittedMessage: L = Io, onFollowUpClick: k, onMessageSent: N, onMessageReceived: P, onFormSubmitted: w, onFormError: z, onOpen: C, onClose: S, icon: T, subtitle: O, conversationStarters: G = [], autoResume: M = !0, hideFooter: V = !1, loadHomeConfig: x = !1 } = e, F = e.title ?? (n ? "AGO Chatbot" : "Chat"), $ = e.width ?? (n ? 550 : 400), te = e.loadThreads ?? n, J = e.feedback ?? n, m = Tr(e.labels), B = e.placeholder ?? (n ? m.askQuestion : "Type a message..."), q = e.prompt === void 0 ? Oa : e.prompt, U = n ? {
3200
+ const o = e.placement ?? "inline", n = o === "bubble", { welcomeMessage: i = "Hello! How can I help you today?", allowFiles: a = !1, allowStop: d = !0, autoScroll: l = !0, height: b = 500, defaultOpen: m = !1, logoUrl: p, showAgentName: y = !1, agentBubble: H = !1, bubbleStyle: E = "default", showHeader: u = !0, forms: v, formSubmittedMessage: L = Io, onFollowUpClick: k, onMessageSent: N, onMessageReceived: P, onFormSubmitted: w, onFormError: z, onOpen: C, onClose: S, icon: T, subtitle: O, conversationStarters: G = [], autoResume: M = !0, hideFooter: V = !1, loadHomeConfig: x = !1 } = e, F = e.title ?? (n ? "AGO Chatbot" : "Chat"), $ = e.width ?? (n ? 550 : 400), te = e.loadThreads ?? n, J = e.feedback ?? n, g = Tr(e.labels), B = e.placeholder ?? (n ? g.askQuestion : "Type a message..."), q = e.prompt === void 0 ? Oa : e.prompt, U = n ? {
3201
3201
  ...fr(e.colors),
3202
3202
  ...e.theme
3203
3203
  } : e.theme, oe = typeof i == "string" ? {
@@ -3206,7 +3206,7 @@ function Qa(t, e) {
3206
3206
  } : i, le = oe.message, ve = oe.mode ?? "static", ri = "speed" in oe && oe.speed || 45, Nn = "followUpReplies" in oe && oe.followUpReplies || void 0;
3207
3207
  if (!e.client && !e.config?.baseUrl) throw new Mi("mountChatWidget requires either `client` or `config` (with a baseUrl).", "config_missing_base_url");
3208
3208
  const W = e.client ?? new Di(e.config), Ut = Wa(t), wt = o === "left" || o === "right", de = wt || n, ai = de && (e.launcher ?? !0);
3209
- let ie = de ? g : !0, Vt = !1;
3209
+ let ie = de ? m : !0, Vt = !1;
3210
3210
  const si = e.mobile?.breakpoint ?? (n ? 450 : 768), qt = e.mobile?.trigger ?? "tap", In = typeof window < "u" && !!window.matchMedia, re = In ? window.matchMedia(`(max-width: ${si}px), (max-height: 500px) and (orientation: landscape)`) : void 0, li = In ? window.matchMedia("(prefers-reduced-motion: reduce)") : void 0, di = !!re, rt = !de && !!re, at = /* @__PURE__ */ Symbol("ago-scroll-lock");
3211
3211
  let ne = !1;
3212
3212
  const Gt = e.persistConversation ?? (n ? !0 : void 0), Ue = Gt ? Wi(Gt === !0 ? {} : Gt) : void 0;
@@ -3339,7 +3339,7 @@ function Qa(t, e) {
3339
3339
  boxShadow: "rgba(15, 15, 15, 0.16) 0px 2px 10px 0px",
3340
3340
  cursor: "pointer",
3341
3341
  zIndex: "2"
3342
- }), n && (ae.setAttribute("aria-label", m.scrollToBottom), ae.replaceChildren(Qi({ size: 20 })), f(ae, {
3342
+ }), n && (ae.setAttribute("aria-label", g.scrollToBottom), ae.replaceChildren(Qi({ size: 20 })), f(ae, {
3343
3343
  display: "flex",
3344
3344
  width: "36px",
3345
3345
  height: "36px",
@@ -3400,11 +3400,11 @@ function Qa(t, e) {
3400
3400
  } : void 0,
3401
3401
  look: n ? "embed" : "classic",
3402
3402
  labels: n ? {
3403
- attachFiles: m.attachFiles,
3404
- dismiss: m.dismiss,
3405
- tooManyFiles: m.tooManyFiles,
3406
- invalidFileType: m.invalidFileType,
3407
- fileTooLarge: m.fileTooLarge
3403
+ attachFiles: g.attachFiles,
3404
+ dismiss: g.dismiss,
3405
+ tooManyFiles: g.tooManyFiles,
3406
+ invalidFileType: g.invalidFileType,
3407
+ fileTooLarge: g.fileTooLarge
3408
3408
  } : void 0
3409
3409
  });
3410
3410
  pr(), e.speechToText && W.getConfig().then((r) => {
@@ -3436,7 +3436,7 @@ function Qa(t, e) {
3436
3436
  }
3437
3437
  u && (en = Er({
3438
3438
  title: F,
3439
- labels: m,
3439
+ labels: g,
3440
3440
  onBack: () => Oe(_t, { byUser: !0 }),
3441
3441
  onNewChat: () => It(),
3442
3442
  onClose: () => Qe()
@@ -3447,7 +3447,7 @@ function Qa(t, e) {
3447
3447
  minHeight: "0",
3448
3448
  overflow: "hidden"
3449
3449
  }), pt.className = "ago-chat-widget__main", A.appendChild(pt), V || (Et = kr({
3450
- labels: m,
3450
+ labels: g,
3451
3451
  onNavigate: (s) => Oe(s, { byUser: !0 })
3452
3452
  }), A.appendChild(Et.el)), _e = Ia({
3453
3453
  title: F,
@@ -3459,7 +3459,7 @@ function Qa(t, e) {
3459
3459
  });
3460
3460
  const r = e.colors?.background;
3461
3461
  Ve = Na({
3462
- labels: m,
3462
+ labels: g,
3463
3463
  onSelect: (s) => {
3464
3464
  Ge = !0, _t = "history", bt(s.id);
3465
3465
  },
@@ -3778,7 +3778,7 @@ function Qa(t, e) {
3778
3778
  followUpHandler: $n,
3779
3779
  agentRowTinted: !!U?.agentBubbleBg,
3780
3780
  agentRowTextTinted: !!U?.agentBubbleText,
3781
- labels: m,
3781
+ labels: g,
3782
3782
  actionsRow: Mn(s),
3783
3783
  renderToolCall: Vn
3784
3784
  }) : zr(s, {
@@ -3850,7 +3850,7 @@ function Qa(t, e) {
3850
3850
  for (const r of st) ge.appendChild(Hr(r));
3851
3851
  if (ke) {
3852
3852
  if (n) {
3853
- ge.appendChild(jr(m.errorTitle, ke));
3853
+ ge.appendChild(jr(g.errorTitle, ke));
3854
3854
  return;
3855
3855
  }
3856
3856
  const r = c({
@@ -3942,7 +3942,7 @@ function Qa(t, e) {
3942
3942
  });
3943
3943
  async function Ye(r, s, h) {
3944
3944
  const _ = r.trim();
3945
- if (!_ && !s?.length || ce) return;
3945
+ if (!_ || ce) return;
3946
3946
  if (n && Te !== "chat" && (_t = "home", Oe("chat", { byUser: !0 })), N?.(_), ce = !0, ke = null, Ie = !0, Ne) {
3947
3947
  clearInterval(Ne), Ne = void 0;
3948
3948
  const I = R.find((K) => K.id.startsWith("ago-intro-"));