@anam-ai/agent-widget 0.1.0-alpha.10 → 0.1.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -107,7 +107,7 @@ function qt(t) {
107
107
  };
108
108
  }
109
109
  function At(t, e, n, o, u, a, c, l, m, p) {
110
- var _, d, S, g, y, b, A, C, I, x, O, R, G, W, ae, ne, re, Q = e.type;
110
+ var _, d, S, g, y, b, A, C, I, x, O, T, q, H, ae, ne, re, Q = e.type;
111
111
  if (e.constructor !== void 0) return null;
112
112
  128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = D.__b) && _(e);
113
113
  e: if (typeof Q == "function") try {
@@ -116,7 +116,7 @@ function At(t, e, n, o, u, a, c, l, m, p) {
116
116
  if (I && Q.getDerivedStateFromProps == null && C !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(C, O), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(C, d.__s, O) === !1) {
117
117
  for (e.__v != n.__v && (d.props = C, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(le) {
118
118
  le && (le.__ = e);
119
- }), R = 0; R < d._sb.length; R++) d.__h.push(d._sb[R]);
119
+ }), T = 0; T < d._sb.length; T++) d.__h.push(d._sb[T]);
120
120
  d._sb = [], d.__h.length && c.push(d);
121
121
  break e;
122
122
  }
@@ -124,12 +124,12 @@ function At(t, e, n, o, u, a, c, l, m, p) {
124
124
  d.componentDidUpdate(g, y, b);
125
125
  });
126
126
  }
127
- if (d.context = O, d.props = C, d.__P = t, d.__e = !1, G = D.__r, W = 0, I) {
128
- for (d.state = d.__s, d.__d = !1, G && G(e), _ = d.render(d.props, d.state, d.context), ae = 0; ae < d._sb.length; ae++) d.__h.push(d._sb[ae]);
127
+ if (d.context = O, d.props = C, d.__P = t, d.__e = !1, q = D.__r, H = 0, I) {
128
+ for (d.state = d.__s, d.__d = !1, q && q(e), _ = d.render(d.props, d.state, d.context), ae = 0; ae < d._sb.length; ae++) d.__h.push(d._sb[ae]);
129
129
  d._sb = [];
130
130
  } else do
131
- d.__d = !1, G && G(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
- while (d.__d && ++W < 25);
131
+ d.__d = !1, q && q(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
+ while (d.__d && ++H < 25);
133
133
  d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), I && !S && d.getSnapshotBeforeUpdate != null && (b = d.getSnapshotBeforeUpdate(g, y)), ne = _, _ != null && _.type === oe && _.key == null && (ne = Ci(_.props.children)), l = yi(t, rt(ne) ? ne : [ne], e, n, o, u, a, c, l, m, p), d.base = e.__e, e.__u &= -161, d.__h.length && c.push(d), A && (d.__E = d.__ = null);
134
134
  } catch (le) {
135
135
  if (e.__v = null, m || a != null) if (le.then) {
@@ -513,21 +513,21 @@ function Mi(t) {
513
513
  return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = k.s, e.n = void 0, k.s.n = e, k.s = e), e;
514
514
  }
515
515
  }
516
- function H(t, e) {
516
+ function j(t, e) {
517
517
  this.v = t, this.i = 0, this.n = void 0, this.t = void 0, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
518
518
  }
519
- H.prototype.brand = In;
520
- H.prototype.h = function() {
519
+ j.prototype.brand = In;
520
+ j.prototype.h = function() {
521
521
  return !0;
522
522
  };
523
- H.prototype.S = function(t) {
523
+ j.prototype.S = function(t) {
524
524
  var e = this, n = this.t;
525
525
  n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : Di(function() {
526
526
  var o;
527
527
  (o = e.W) == null || o.call(e);
528
528
  }));
529
529
  };
530
- H.prototype.U = function(t) {
530
+ j.prototype.U = function(t) {
531
531
  var e = this;
532
532
  if (this.t !== void 0) {
533
533
  var n = t.e, o = t.x;
@@ -537,7 +537,7 @@ H.prototype.U = function(t) {
537
537
  }));
538
538
  }
539
539
  };
540
- H.prototype.subscribe = function(t) {
540
+ j.prototype.subscribe = function(t) {
541
541
  var e = this;
542
542
  return $e(function() {
543
543
  var n = e.value, o = k;
@@ -549,16 +549,16 @@ H.prototype.subscribe = function(t) {
549
549
  }
550
550
  }, { name: "sub" });
551
551
  };
552
- H.prototype.valueOf = function() {
552
+ j.prototype.valueOf = function() {
553
553
  return this.value;
554
554
  };
555
- H.prototype.toString = function() {
555
+ j.prototype.toString = function() {
556
556
  return this.value + "";
557
557
  };
558
- H.prototype.toJSON = function() {
558
+ j.prototype.toJSON = function() {
559
559
  return this.value;
560
560
  };
561
- H.prototype.peek = function() {
561
+ j.prototype.peek = function() {
562
562
  var t = k;
563
563
  k = void 0;
564
564
  try {
@@ -567,7 +567,7 @@ H.prototype.peek = function() {
567
567
  k = t;
568
568
  }
569
569
  };
570
- Object.defineProperty(H.prototype, "value", { get: function() {
570
+ Object.defineProperty(j.prototype, "value", { get: function() {
571
571
  var t = Mi(this);
572
572
  return t !== void 0 && (t.i = this.i), this.v;
573
573
  }, set: function(t) {
@@ -582,7 +582,7 @@ Object.defineProperty(H.prototype, "value", { get: function() {
582
582
  }
583
583
  } });
584
584
  function K(t, e) {
585
- return new H(t, e);
585
+ return new j(t, e);
586
586
  }
587
587
  function Ui(t) {
588
588
  for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
@@ -605,9 +605,9 @@ function Li(t) {
605
605
  t.s = n;
606
606
  }
607
607
  function ve(t, e) {
608
- H.call(this, void 0), this.x = t, this.s = void 0, this.g = Qe - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
608
+ j.call(this, void 0), this.x = t, this.s = void 0, this.g = Qe - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
609
609
  }
610
- ve.prototype = new H();
610
+ ve.prototype = new j();
611
611
  ve.prototype.h = function() {
612
612
  if (this.f &= -3, 1 & this.f) return !1;
613
613
  if ((36 & this.f) == 32 || (this.f &= -5, this.g === Qe)) return !0;
@@ -628,10 +628,10 @@ ve.prototype.S = function(t) {
628
628
  this.f |= 36;
629
629
  for (var e = this.s; e !== void 0; e = e.n) e.S.S(e);
630
630
  }
631
- H.prototype.S.call(this, t);
631
+ j.prototype.S.call(this, t);
632
632
  };
633
633
  ve.prototype.U = function(t) {
634
- if (this.t !== void 0 && (H.prototype.U.call(this, t), this.t === void 0)) {
634
+ if (this.t !== void 0 && (j.prototype.U.call(this, t), this.t === void 0)) {
635
635
  this.f &= -33;
636
636
  for (var e = this.s; e !== void 0; e = e.n) e.S.U(e);
637
637
  }
@@ -749,7 +749,7 @@ function Gi(t) {
749
749
  return a.value ? c.peek() : c.value;
750
750
  }
751
751
  Gi.displayName = "ReactiveTextNode";
752
- Object.defineProperties(H.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Gi }, props: { configurable: !0, get: function() {
752
+ Object.defineProperties(j.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Gi }, props: { configurable: !0, get: function() {
753
753
  return { data: this };
754
754
  } }, __b: { configurable: !0, value: 1 } });
755
755
  Te("__b", function(t, e) {
@@ -757,7 +757,7 @@ Te("__b", function(t, e) {
757
757
  var n, o = e.props;
758
758
  for (var u in o) if (u !== "children") {
759
759
  var a = o[u];
760
- a instanceof H && (n || (e.__np = n = {}), n[u] = a, o[u] = a.peek());
760
+ a instanceof j && (n || (e.__np = n = {}), n[u] = a, o[u] = a.peek());
761
761
  }
762
762
  }
763
763
  t(e);
@@ -889,25 +889,13 @@ const ri = {
889
889
  sendMessage: "Send",
890
890
  placeholder: "Type a message..."
891
891
  }
892
- };
893
- function On(t) {
894
- if (!t) return {};
895
- const e = { ...t };
896
- if ("mode" in e && !("layout" in e))
897
- e.layout = e.mode, delete e.mode;
898
- else if ("layout" in e) {
899
- const n = e.layout;
900
- (n === "inline" || n === "fixed") && (e.inline = n === "inline", "mode" in e ? (e.layout = e.mode, delete e.mode) : delete e.layout);
901
- }
902
- return "showTranscript" in e && !("showCaptions" in e) && (e.showCaptions = e.showTranscript, delete e.showTranscript), e;
903
- }
904
- const He = {
892
+ }, He = {
905
893
  "bottom-right": { bottom: "24px", right: "24px" },
906
894
  "bottom-left": { bottom: "24px", left: "24px" },
907
895
  "top-right": { top: "24px", right: "24px" },
908
896
  "top-left": { top: "24px", left: "24px" }
909
897
  };
910
- function kn(t) {
898
+ function On(t) {
911
899
  if (He[t])
912
900
  return He[t];
913
901
  const e = t.match(/^\[(.+)\]$/);
@@ -922,7 +910,7 @@ function kn(t) {
922
910
  return Object.keys(n).length > 0 ? n : He["bottom-right"];
923
911
  }
924
912
  var ft = {}, Ne = {}, oi;
925
- function Dn() {
913
+ function kn() {
926
914
  if (oi) return Ne;
927
915
  oi = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = S;
928
916
  for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = 0, a = o.length; u < a; ++u)
@@ -945,10 +933,10 @@ function Dn() {
945
933
  return (y + b) * 3 / 4 - b;
946
934
  }
947
935
  function p(g) {
948
- var y, b = c(g), A = b[0], C = b[1], I = new n(m(g, A, C)), x = 0, O = C > 0 ? A - 4 : A, R;
949
- for (R = 0; R < O; R += 4)
950
- y = e[g.charCodeAt(R)] << 18 | e[g.charCodeAt(R + 1)] << 12 | e[g.charCodeAt(R + 2)] << 6 | e[g.charCodeAt(R + 3)], I[x++] = y >> 16 & 255, I[x++] = y >> 8 & 255, I[x++] = y & 255;
951
- return C === 2 && (y = e[g.charCodeAt(R)] << 2 | e[g.charCodeAt(R + 1)] >> 4, I[x++] = y & 255), C === 1 && (y = e[g.charCodeAt(R)] << 10 | e[g.charCodeAt(R + 1)] << 4 | e[g.charCodeAt(R + 2)] >> 2, I[x++] = y >> 8 & 255, I[x++] = y & 255), I;
936
+ var y, b = c(g), A = b[0], C = b[1], I = new n(m(g, A, C)), x = 0, O = C > 0 ? A - 4 : A, T;
937
+ for (T = 0; T < O; T += 4)
938
+ y = e[g.charCodeAt(T)] << 18 | e[g.charCodeAt(T + 1)] << 12 | e[g.charCodeAt(T + 2)] << 6 | e[g.charCodeAt(T + 3)], I[x++] = y >> 16 & 255, I[x++] = y >> 8 & 255, I[x++] = y & 255;
939
+ return C === 2 && (y = e[g.charCodeAt(T)] << 2 | e[g.charCodeAt(T + 1)] >> 4, I[x++] = y & 255), C === 1 && (y = e[g.charCodeAt(T)] << 10 | e[g.charCodeAt(T + 1)] << 4 | e[g.charCodeAt(T + 2)] >> 2, I[x++] = y >> 8 & 255, I[x++] = y & 255), I;
952
940
  }
953
941
  function _(g) {
954
942
  return t[g >> 18 & 63] + t[g >> 12 & 63] + t[g >> 6 & 63] + t[g & 63];
@@ -971,7 +959,7 @@ function Dn() {
971
959
  }
972
960
  var We = {};
973
961
  var si;
974
- function Mn() {
962
+ function Dn() {
975
963
  return si || (si = 1, We.read = function(t, e, n, o, u) {
976
964
  var a, c, l = u * 8 - o - 1, m = (1 << l) - 1, p = m >> 1, _ = -7, d = n ? u - 1 : 0, S = n ? -1 : 1, g = t[e + d];
977
965
  for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
@@ -996,9 +984,9 @@ function Mn() {
996
984
  }), We;
997
985
  }
998
986
  var ai;
999
- function Un() {
987
+ function Mn() {
1000
988
  return ai || (ai = 1, (function(t) {
1001
- const e = Dn(), n = Mn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
989
+ const e = kn(), n = Dn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
1002
990
  t.Buffer = l, t.SlowBuffer = I, t.INSPECT_MAX_BYTES = 50;
1003
991
  const u = 2147483647;
1004
992
  t.kMaxLength = u, l.TYPED_ARRAY_SUPPORT = a(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
@@ -1265,7 +1253,7 @@ function Un() {
1265
1253
  }
1266
1254
  }
1267
1255
  l.prototype._isBuffer = !0;
1268
- function R(s, i, r) {
1256
+ function T(s, i, r) {
1269
1257
  const h = s[i];
1270
1258
  s[i] = s[r], s[r] = h;
1271
1259
  }
@@ -1274,21 +1262,21 @@ function Un() {
1274
1262
  if (i % 2 !== 0)
1275
1263
  throw new RangeError("Buffer size must be a multiple of 16-bits");
1276
1264
  for (let r = 0; r < i; r += 2)
1277
- R(this, r, r + 1);
1265
+ T(this, r, r + 1);
1278
1266
  return this;
1279
1267
  }, l.prototype.swap32 = function() {
1280
1268
  const i = this.length;
1281
1269
  if (i % 4 !== 0)
1282
1270
  throw new RangeError("Buffer size must be a multiple of 32-bits");
1283
1271
  for (let r = 0; r < i; r += 4)
1284
- R(this, r, r + 3), R(this, r + 1, r + 2);
1272
+ T(this, r, r + 3), T(this, r + 1, r + 2);
1285
1273
  return this;
1286
1274
  }, l.prototype.swap64 = function() {
1287
1275
  const i = this.length;
1288
1276
  if (i % 8 !== 0)
1289
1277
  throw new RangeError("Buffer size must be a multiple of 64-bits");
1290
1278
  for (let r = 0; r < i; r += 8)
1291
- R(this, r, r + 7), R(this, r + 1, r + 6), R(this, r + 2, r + 5), R(this, r + 3, r + 4);
1279
+ T(this, r, r + 7), T(this, r + 1, r + 6), T(this, r + 2, r + 5), T(this, r + 3, r + 4);
1292
1280
  return this;
1293
1281
  }, l.prototype.toString = function() {
1294
1282
  const i = this.length;
@@ -1314,16 +1302,16 @@ function Un() {
1314
1302
  if (r >= h)
1315
1303
  return 1;
1316
1304
  if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
1317
- let v = E - f, T = h - r;
1318
- const B = Math.min(v, T), U = this.slice(f, E), L = i.slice(r, h);
1305
+ let v = E - f, R = h - r;
1306
+ const B = Math.min(v, R), U = this.slice(f, E), L = i.slice(r, h);
1319
1307
  for (let M = 0; M < B; ++M)
1320
1308
  if (U[M] !== L[M]) {
1321
- v = U[M], T = L[M];
1309
+ v = U[M], R = L[M];
1322
1310
  break;
1323
1311
  }
1324
- return v < T ? -1 : T < v ? 1 : 0;
1312
+ return v < R ? -1 : R < v ? 1 : 0;
1325
1313
  };
1326
- function G(s, i, r, h, f) {
1314
+ function q(s, i, r, h, f) {
1327
1315
  if (s.length === 0) return -1;
1328
1316
  if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, ut(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
1329
1317
  if (f) return -1;
@@ -1332,17 +1320,17 @@ function Un() {
1332
1320
  if (f) r = 0;
1333
1321
  else return -1;
1334
1322
  if (typeof i == "string" && (i = l.from(i, h)), l.isBuffer(i))
1335
- return i.length === 0 ? -1 : W(s, i, r, h, f);
1323
+ return i.length === 0 ? -1 : H(s, i, r, h, f);
1336
1324
  if (typeof i == "number")
1337
- return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : W(s, [i], r, h, f);
1325
+ return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : H(s, [i], r, h, f);
1338
1326
  throw new TypeError("val must be string, number or Buffer");
1339
1327
  }
1340
- function W(s, i, r, h, f) {
1341
- let E = 1, v = s.length, T = i.length;
1328
+ function H(s, i, r, h, f) {
1329
+ let E = 1, v = s.length, R = i.length;
1342
1330
  if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
1343
1331
  if (s.length < 2 || i.length < 2)
1344
1332
  return -1;
1345
- E = 2, v /= 2, T /= 2, r /= 2;
1333
+ E = 2, v /= 2, R /= 2, r /= 2;
1346
1334
  }
1347
1335
  function B(L, M) {
1348
1336
  return E === 1 ? L[M] : L.readUInt16BE(M * E);
@@ -1352,13 +1340,13 @@ function Un() {
1352
1340
  let L = -1;
1353
1341
  for (U = r; U < v; U++)
1354
1342
  if (B(s, U) === B(i, L === -1 ? 0 : U - L)) {
1355
- if (L === -1 && (L = U), U - L + 1 === T) return L * E;
1343
+ if (L === -1 && (L = U), U - L + 1 === R) return L * E;
1356
1344
  } else
1357
1345
  L !== -1 && (U -= U - L), L = -1;
1358
1346
  } else
1359
- for (r + T > v && (r = v - T), U = r; U >= 0; U--) {
1347
+ for (r + R > v && (r = v - R), U = r; U >= 0; U--) {
1360
1348
  let L = !0;
1361
- for (let M = 0; M < T; M++)
1349
+ for (let M = 0; M < R; M++)
1362
1350
  if (B(s, U + M) !== B(i, M)) {
1363
1351
  L = !1;
1364
1352
  break;
@@ -1370,9 +1358,9 @@ function Un() {
1370
1358
  l.prototype.includes = function(i, r, h) {
1371
1359
  return this.indexOf(i, r, h) !== -1;
1372
1360
  }, l.prototype.indexOf = function(i, r, h) {
1373
- return G(this, i, r, h, !0);
1361
+ return q(this, i, r, h, !0);
1374
1362
  }, l.prototype.lastIndexOf = function(i, r, h) {
1375
- return G(this, i, r, h, !1);
1363
+ return q(this, i, r, h, !1);
1376
1364
  };
1377
1365
  function ae(s, i, r, h) {
1378
1366
  r = Number(r) || 0;
@@ -1382,9 +1370,9 @@ function Un() {
1382
1370
  h > E / 2 && (h = E / 2);
1383
1371
  let v;
1384
1372
  for (v = 0; v < h; ++v) {
1385
- const T = parseInt(i.substr(v * 2, 2), 16);
1386
- if (ut(T)) return v;
1387
- s[r + v] = T;
1373
+ const R = parseInt(i.substr(v * 2, 2), 16);
1374
+ if (ut(R)) return v;
1375
+ s[r + v] = R;
1388
1376
  }
1389
1377
  return v;
1390
1378
  }
@@ -1453,10 +1441,10 @@ function Un() {
1453
1441
  let f = i;
1454
1442
  for (; f < r; ) {
1455
1443
  const E = s[f];
1456
- let v = null, T = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1457
- if (f + T <= r) {
1444
+ let v = null, R = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1445
+ if (f + R <= r) {
1458
1446
  let B, U, L, M;
1459
- switch (T) {
1447
+ switch (R) {
1460
1448
  case 1:
1461
1449
  E < 128 && (v = E);
1462
1450
  break;
@@ -1470,7 +1458,7 @@ function Un() {
1470
1458
  B = s[f + 1], U = s[f + 2], L = s[f + 3], (B & 192) === 128 && (U & 192) === 128 && (L & 192) === 128 && (M = (E & 15) << 18 | (B & 63) << 12 | (U & 63) << 6 | L & 63, M > 65535 && M < 1114112 && (v = M));
1471
1459
  }
1472
1460
  }
1473
- v === null ? (v = 65533, T = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += T;
1461
+ v === null ? (v = 65533, R = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), f += R;
1474
1462
  }
1475
1463
  return Ki(h);
1476
1464
  }
@@ -1522,32 +1510,32 @@ function Un() {
1522
1510
  const f = this.subarray(i, r);
1523
1511
  return Object.setPrototypeOf(f, l.prototype), f;
1524
1512
  };
1525
- function V(s, i, r) {
1513
+ function G(s, i, r) {
1526
1514
  if (s % 1 !== 0 || s < 0) throw new RangeError("offset is not uint");
1527
1515
  if (s + i > r) throw new RangeError("Trying to access beyond buffer length");
1528
1516
  }
1529
1517
  l.prototype.readUintLE = l.prototype.readUIntLE = function(i, r, h) {
1530
- i = i >>> 0, r = r >>> 0, h || V(i, r, this.length);
1518
+ i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1531
1519
  let f = this[i], E = 1, v = 0;
1532
1520
  for (; ++v < r && (E *= 256); )
1533
1521
  f += this[i + v] * E;
1534
1522
  return f;
1535
1523
  }, l.prototype.readUintBE = l.prototype.readUIntBE = function(i, r, h) {
1536
- i = i >>> 0, r = r >>> 0, h || V(i, r, this.length);
1524
+ i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1537
1525
  let f = this[i + --r], E = 1;
1538
1526
  for (; r > 0 && (E *= 256); )
1539
1527
  f += this[i + --r] * E;
1540
1528
  return f;
1541
1529
  }, l.prototype.readUint8 = l.prototype.readUInt8 = function(i, r) {
1542
- return i = i >>> 0, r || V(i, 1, this.length), this[i];
1530
+ return i = i >>> 0, r || G(i, 1, this.length), this[i];
1543
1531
  }, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(i, r) {
1544
- return i = i >>> 0, r || V(i, 2, this.length), this[i] | this[i + 1] << 8;
1532
+ return i = i >>> 0, r || G(i, 2, this.length), this[i] | this[i + 1] << 8;
1545
1533
  }, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(i, r) {
1546
- return i = i >>> 0, r || V(i, 2, this.length), this[i] << 8 | this[i + 1];
1534
+ return i = i >>> 0, r || G(i, 2, this.length), this[i] << 8 | this[i + 1];
1547
1535
  }, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(i, r) {
1548
- return i = i >>> 0, r || V(i, 4, this.length), (this[i] | this[i + 1] << 8 | this[i + 2] << 16) + this[i + 3] * 16777216;
1536
+ return i = i >>> 0, r || G(i, 4, this.length), (this[i] | this[i + 1] << 8 | this[i + 2] << 16) + this[i + 3] * 16777216;
1549
1537
  }, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(i, r) {
1550
- return i = i >>> 0, r || V(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
1538
+ return i = i >>> 0, r || G(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
1551
1539
  }, l.prototype.readBigUInt64LE = ce(function(i) {
1552
1540
  i = i >>> 0, Se(i, "offset");
1553
1541
  const r = this[i], h = this[i + 7];
@@ -1561,31 +1549,31 @@ function Un() {
1561
1549
  const f = r * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i], E = this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h;
1562
1550
  return (BigInt(f) << BigInt(32)) + BigInt(E);
1563
1551
  }), l.prototype.readIntLE = function(i, r, h) {
1564
- i = i >>> 0, r = r >>> 0, h || V(i, r, this.length);
1552
+ i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1565
1553
  let f = this[i], E = 1, v = 0;
1566
1554
  for (; ++v < r && (E *= 256); )
1567
1555
  f += this[i + v] * E;
1568
1556
  return E *= 128, f >= E && (f -= Math.pow(2, 8 * r)), f;
1569
1557
  }, l.prototype.readIntBE = function(i, r, h) {
1570
- i = i >>> 0, r = r >>> 0, h || V(i, r, this.length);
1558
+ i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1571
1559
  let f = r, E = 1, v = this[i + --f];
1572
1560
  for (; f > 0 && (E *= 256); )
1573
1561
  v += this[i + --f] * E;
1574
1562
  return E *= 128, v >= E && (v -= Math.pow(2, 8 * r)), v;
1575
1563
  }, l.prototype.readInt8 = function(i, r) {
1576
- return i = i >>> 0, r || V(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
1564
+ return i = i >>> 0, r || G(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
1577
1565
  }, l.prototype.readInt16LE = function(i, r) {
1578
- i = i >>> 0, r || V(i, 2, this.length);
1566
+ i = i >>> 0, r || G(i, 2, this.length);
1579
1567
  const h = this[i] | this[i + 1] << 8;
1580
1568
  return h & 32768 ? h | 4294901760 : h;
1581
1569
  }, l.prototype.readInt16BE = function(i, r) {
1582
- i = i >>> 0, r || V(i, 2, this.length);
1570
+ i = i >>> 0, r || G(i, 2, this.length);
1583
1571
  const h = this[i + 1] | this[i] << 8;
1584
1572
  return h & 32768 ? h | 4294901760 : h;
1585
1573
  }, l.prototype.readInt32LE = function(i, r) {
1586
- return i = i >>> 0, r || V(i, 4, this.length), this[i] | this[i + 1] << 8 | this[i + 2] << 16 | this[i + 3] << 24;
1574
+ return i = i >>> 0, r || G(i, 4, this.length), this[i] | this[i + 1] << 8 | this[i + 2] << 16 | this[i + 3] << 24;
1587
1575
  }, l.prototype.readInt32BE = function(i, r) {
1588
- return i = i >>> 0, r || V(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
1576
+ return i = i >>> 0, r || G(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
1589
1577
  }, l.prototype.readBigInt64LE = ce(function(i) {
1590
1578
  i = i >>> 0, Se(i, "offset");
1591
1579
  const r = this[i], h = this[i + 7];
@@ -1600,13 +1588,13 @@ function Un() {
1600
1588
  this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i];
1601
1589
  return (BigInt(f) << BigInt(32)) + BigInt(this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h);
1602
1590
  }), l.prototype.readFloatLE = function(i, r) {
1603
- return i = i >>> 0, r || V(i, 4, this.length), n.read(this, i, !0, 23, 4);
1591
+ return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !0, 23, 4);
1604
1592
  }, l.prototype.readFloatBE = function(i, r) {
1605
- return i = i >>> 0, r || V(i, 4, this.length), n.read(this, i, !1, 23, 4);
1593
+ return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !1, 23, 4);
1606
1594
  }, l.prototype.readDoubleLE = function(i, r) {
1607
- return i = i >>> 0, r || V(i, 8, this.length), n.read(this, i, !0, 52, 8);
1595
+ return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !0, 52, 8);
1608
1596
  }, l.prototype.readDoubleBE = function(i, r) {
1609
- return i = i >>> 0, r || V(i, 8, this.length), n.read(this, i, !1, 52, 8);
1597
+ return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
1610
1598
  };
1611
1599
  function Y(s, i, r, h, f, E) {
1612
1600
  if (!l.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
@@ -1615,8 +1603,8 @@ function Un() {
1615
1603
  }
1616
1604
  l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
1617
1605
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1618
- const T = Math.pow(2, 8 * h) - 1;
1619
- Y(this, i, r, h, T, 0);
1606
+ const R = Math.pow(2, 8 * h) - 1;
1607
+ Y(this, i, r, h, R, 0);
1620
1608
  }
1621
1609
  let E = 1, v = 0;
1622
1610
  for (this[r] = i & 255; ++v < h && (E *= 256); )
@@ -1624,8 +1612,8 @@ function Un() {
1624
1612
  return r + h;
1625
1613
  }, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
1626
1614
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1627
- const T = Math.pow(2, 8 * h) - 1;
1628
- Y(this, i, r, h, T, 0);
1615
+ const R = Math.pow(2, 8 * h) - 1;
1616
+ Y(this, i, r, h, R, 0);
1629
1617
  }
1630
1618
  let E = h - 1, v = 1;
1631
1619
  for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
@@ -1665,18 +1653,18 @@ function Un() {
1665
1653
  const B = Math.pow(2, 8 * h - 1);
1666
1654
  Y(this, i, r, h, B - 1, -B);
1667
1655
  }
1668
- let E = 0, v = 1, T = 0;
1656
+ let E = 0, v = 1, R = 0;
1669
1657
  for (this[r] = i & 255; ++E < h && (v *= 256); )
1670
- i < 0 && T === 0 && this[r + E - 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1658
+ i < 0 && R === 0 && this[r + E - 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
1671
1659
  return r + h;
1672
1660
  }, l.prototype.writeIntBE = function(i, r, h, f) {
1673
1661
  if (i = +i, r = r >>> 0, !f) {
1674
1662
  const B = Math.pow(2, 8 * h - 1);
1675
1663
  Y(this, i, r, h, B - 1, -B);
1676
1664
  }
1677
- let E = h - 1, v = 1, T = 0;
1665
+ let E = h - 1, v = 1, R = 0;
1678
1666
  for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1679
- i < 0 && T === 0 && this[r + E + 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1667
+ i < 0 && R === 0 && this[r + E + 1] !== 0 && (R = 1), this[r + E] = (i / v >> 0) - R & 255;
1680
1668
  return r + h;
1681
1669
  }, l.prototype.writeInt8 = function(i, r, h) {
1682
1670
  return i = +i, r = r >>> 0, h || Y(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
@@ -1747,11 +1735,11 @@ function Un() {
1747
1735
  for (E = r; E < h; ++E)
1748
1736
  this[E] = i;
1749
1737
  else {
1750
- const v = l.isBuffer(i) ? i : l.from(i, f), T = v.length;
1751
- if (T === 0)
1738
+ const v = l.isBuffer(i) ? i : l.from(i, f), R = v.length;
1739
+ if (R === 0)
1752
1740
  throw new TypeError('The value "' + i + '" is invalid for argument "value"');
1753
1741
  for (E = 0; E < h - r; ++E)
1754
- this[E + r] = v[E % T];
1742
+ this[E + r] = v[E % R];
1755
1743
  }
1756
1744
  return this;
1757
1745
  };
@@ -1814,8 +1802,8 @@ function Un() {
1814
1802
  function Vt(s, i, r, h, f, E) {
1815
1803
  if (s > r || s < i) {
1816
1804
  const v = typeof i == "bigint" ? "n" : "";
1817
- let T;
1818
- throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : T = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new ye.ERR_OUT_OF_RANGE("value", T, s);
1805
+ let R;
1806
+ throw i === 0 || i === BigInt(0) ? R = `>= 0${v} and < 2${v} ** ${(E + 1) * 8}${v}` : R = `>= -(2${v} ** ${(E + 1) * 8 - 1}${v}) and < 2 ** ${(E + 1) * 8 - 1}${v}`, new ye.ERR_OUT_OF_RANGE("value", R, s);
1819
1807
  }
1820
1808
  en(h, f, E);
1821
1809
  }
@@ -1936,12 +1924,12 @@ function Un() {
1936
1924
  }
1937
1925
  })(ft)), ft;
1938
1926
  }
1939
- var Bn = Un();
1940
- const Ln = "https://api.anam.ai", Pn = "/v1", Hi = {
1927
+ var Un = Mn();
1928
+ const Bn = "https://api.anam.ai", Ln = "/v1", Hi = {
1941
1929
  client: "js-sdk",
1942
1930
  version: "4.8.0"
1943
1931
  };
1944
- var Fn = function(t, e, n, o) {
1932
+ var Pn = function(t, e, n, o) {
1945
1933
  function u(a) {
1946
1934
  return a instanceof n ? a : new n(function(c) {
1947
1935
  c(a);
@@ -1974,11 +1962,11 @@ var se;
1974
1962
  t.CLIENT_METRIC_MEASUREMENT_ERROR = "client_error", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED = "client_connection_closed", t.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED = "client_connection_established", t.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT = "client_session_attempt", t.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS = "client_session_success";
1975
1963
  })(se || (se = {}));
1976
1964
  let St = Wi, zi = xt, de, qi = !1;
1977
- const $n = (t, e = xt) => {
1965
+ const Fn = (t, e = xt) => {
1978
1966
  St = t, zi = e;
1979
- }, Gn = (t) => {
1967
+ }, $n = (t) => {
1980
1968
  de = t;
1981
- }, Vn = (t) => {
1969
+ }, Gn = (t) => {
1982
1970
  qi = t;
1983
1971
  };
1984
1972
  let he = {
@@ -1988,7 +1976,7 @@ let he = {
1988
1976
  };
1989
1977
  const we = (t) => {
1990
1978
  he = Object.assign(Object.assign({}, he), t);
1991
- }, ge = (t, e, n) => Fn(void 0, void 0, void 0, function* () {
1979
+ }, ge = (t, e, n) => Pn(void 0, void 0, void 0, function* () {
1992
1980
  if (!qi)
1993
1981
  try {
1994
1982
  const o = Object.assign(Object.assign({}, Hi), n);
@@ -2009,7 +1997,7 @@ const we = (t) => {
2009
1997
  } catch (o) {
2010
1998
  console.error("Failed to send error metric:", o);
2011
1999
  }
2012
- }), jn = (t, e = "console") => {
2000
+ }), Vn = (t, e = "console") => {
2013
2001
  var n, o, u;
2014
2002
  const a = {};
2015
2003
  t.forEach((d) => {
@@ -2089,10 +2077,10 @@ const we = (t) => {
2089
2077
  console.log(`DTLS State: ${d.dtlsState}`), console.log(`ICE State: ${d.iceState}`), (d.bytesReceived || d.bytesSent) && console.log(`Data Transfer (bytes) - Sent: ${(d.bytesSent || 0).toLocaleString()}, Received: ${(d.bytesReceived || 0).toLocaleString()}`);
2090
2078
  }), console.groupEnd()), c.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), c.issues.forEach((d) => console.warn(d)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
2091
2079
  };
2092
- var j;
2080
+ var V;
2093
2081
  (function(t) {
2094
2082
  t.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED = "CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED", t.CLIENT_ERROR_CODE_SPEND_CAP_REACHED = "CLIENT_ERROR_CODE_SPEND_CAP_REACHED", t.CLIENT_ERROR_CODE_VALIDATION_ERROR = "CLIENT_ERROR_CODE_VALIDATION_ERROR", t.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR = "CLIENT_ERROR_CODE_AUTHENTICATION_ERROR", t.CLIENT_ERROR_CODE_SERVER_ERROR = "CLIENT_ERROR_CODE_SERVER_ERROR", t.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED = "CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED", t.CLIENT_ERROR_CODE_SERVICE_BUSY = "CLIENT_ERROR_CODE_SERVICE_BUSY", t.CLIENT_ERROR_CODE_NO_PLAN_FOUND = "CLIENT_ERROR_CODE_NO_PLAN_FOUND", t.CLIENT_ERROR_CODE_UNKNOWN_ERROR = "CLIENT_ERROR_CODE_UNKNOWN_ERROR", t.CLIENT_ERROR_CODE_CONFIGURATION_ERROR = "CLIENT_ERROR_CODE_CONFIGURATION_ERROR";
2095
- })(j || (j = {}));
2083
+ })(V || (V = {}));
2096
2084
  class $ extends Error {
2097
2085
  constructor(e, n, o = 500, u) {
2098
2086
  super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = u, Object.setPrototypeOf(this, $.prototype), ge(se.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
@@ -2104,7 +2092,7 @@ class $ extends Error {
2104
2092
  function li() {
2105
2093
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
2106
2094
  }
2107
- function Hn(t) {
2095
+ function jn(t) {
2108
2096
  if (!(!t || !t.enabled)) {
2109
2097
  if (!t.baseUrl)
2110
2098
  return "API Gateway baseUrl is required when enabled";
@@ -2119,10 +2107,10 @@ function Hn(t) {
2119
2107
  return "API Gateway wsPath must start with /";
2120
2108
  }
2121
2109
  }
2122
- var z;
2110
+ var W;
2123
2111
  (function(t) {
2124
2112
  t.OFFER = "offer", t.ANSWER = "answer", t.ICE_CANDIDATE = "icecandidate", t.END_SESSION = "endsession", t.HEARTBEAT = "heartbeat", t.WARNING = "warning", t.TALK_STREAM_INTERRUPTED = "talkinputstreaminterrupted", t.TALK_STREAM_INPUT = "talkstream", t.SESSION_READY = "sessionready", t.AGENT_AUDIO_INPUT = "agentaudioinput", t.AGENT_AUDIO_INPUT_END = "agentaudioinputend";
2125
- })(z || (z = {}));
2113
+ })(W || (W = {}));
2126
2114
  var De;
2127
2115
  (function(t) {
2128
2116
  t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.REASONING_TEXT = "reasoningText";
@@ -2147,7 +2135,7 @@ var _e;
2147
2135
  (function(t) {
2148
2136
  t.NORMAL = "CONNECTION_CLOSED_CODE_NORMAL", t.MICROPHONE_PERMISSION_DENIED = "CONNECTION_CLOSED_CODE_MICROPHONE_PERMISSION_DENIED", t.SIGNALLING_CLIENT_CONNECTION_FAILURE = "CONNECTION_CLOSED_CODE_SIGNALLING_CLIENT_CONNECTION_FAILURE", t.WEBRTC_FAILURE = "CONNECTION_CLOSED_CODE_WEBRTC_FAILURE", t.SERVER_CLOSED_CONNECTION = "CONNECTION_CLOSED_CODE_SERVER_CLOSED_CONNECTION";
2149
2137
  })(_e || (_e = {}));
2150
- class Wn {
2138
+ class Hn {
2151
2139
  constructor(e, n) {
2152
2140
  this.sequenceNumber = 0, this.config = e, this.signallingClient = n;
2153
2141
  }
@@ -2216,15 +2204,15 @@ var Ce = function(t, e, n, o) {
2216
2204
  p((o = o.apply(t, e || [])).next());
2217
2205
  });
2218
2206
  };
2219
- const zn = 5, qn = 5;
2220
- class Yn {
2207
+ const Wn = 5, zn = 5;
2208
+ class qn {
2221
2209
  constructor(e, n, o, u, a) {
2222
2210
  var c, l, m, p, _;
2223
2211
  if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = a, !e)
2224
2212
  throw new Error("Signalling Client: sessionId is required");
2225
2213
  this.sessionId = e;
2226
2214
  const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
2227
- if (this.heartbeatIntervalSeconds = d || zn, this.maxWsReconnectionAttempts = S || qn, !g.baseUrl)
2215
+ if (this.heartbeatIntervalSeconds = d || Wn, this.maxWsReconnectionAttempts = S || zn, !g.baseUrl)
2228
2216
  throw new Error("Signalling Client: baseUrl is required");
2229
2217
  if (!((c = this.apiGatewayConfig) === null || c === void 0) && c.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
2230
2218
  const y = new URL(this.apiGatewayConfig.baseUrl), b = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
@@ -2249,7 +2237,7 @@ class Yn {
2249
2237
  userUid: this.sessionId
2250
2238
  // TODO: this should be renamed to session Id on the server
2251
2239
  }, o = {
2252
- actionType: z.OFFER,
2240
+ actionType: W.OFFER,
2253
2241
  sessionId: this.sessionId,
2254
2242
  payload: n
2255
2243
  };
@@ -2259,7 +2247,7 @@ class Yn {
2259
2247
  sendIceCandidate(e) {
2260
2248
  return Ce(this, void 0, void 0, function* () {
2261
2249
  const n = {
2262
- actionType: z.ICE_CANDIDATE,
2250
+ actionType: W.ICE_CANDIDATE,
2263
2251
  sessionId: this.sessionId,
2264
2252
  payload: e.toJSON()
2265
2253
  };
@@ -2280,7 +2268,7 @@ class Yn {
2280
2268
  sendTalkMessage(e) {
2281
2269
  return Ce(this, void 0, void 0, function* () {
2282
2270
  const n = {
2283
- actionType: z.TALK_STREAM_INPUT,
2271
+ actionType: W.TALK_STREAM_INPUT,
2284
2272
  sessionId: this.sessionId,
2285
2273
  payload: e
2286
2274
  };
@@ -2289,7 +2277,7 @@ class Yn {
2289
2277
  }
2290
2278
  sendAgentAudioInput(e) {
2291
2279
  const n = {
2292
- actionType: z.AGENT_AUDIO_INPUT,
2280
+ actionType: W.AGENT_AUDIO_INPUT,
2293
2281
  sessionId: this.sessionId,
2294
2282
  payload: e
2295
2283
  };
@@ -2297,7 +2285,7 @@ class Yn {
2297
2285
  }
2298
2286
  sendAgentAudioInputEnd() {
2299
2287
  const e = {
2300
- actionType: z.AGENT_AUDIO_INPUT_END,
2288
+ actionType: W.AGENT_AUDIO_INPUT_END,
2301
2289
  sessionId: this.sessionId,
2302
2290
  payload: {}
2303
2291
  };
@@ -2345,7 +2333,7 @@ class Yn {
2345
2333
  throw new Error("SignallingClient - startSendingHeartBeats: socket is null");
2346
2334
  this.heartBeatIntervalRef && console.warn("SignallingClient - startSendingHeartBeats: heartbeat interval already set");
2347
2335
  const e = this.heartbeatIntervalSeconds * 1e3, n = {
2348
- actionType: z.HEARTBEAT,
2336
+ actionType: W.HEARTBEAT,
2349
2337
  sessionId: this.sessionId,
2350
2338
  payload: ""
2351
2339
  }, o = JSON.stringify(n);
@@ -2355,7 +2343,7 @@ class Yn {
2355
2343
  }, e);
2356
2344
  }
2357
2345
  }
2358
- function Kn(t) {
2346
+ function Yn(t) {
2359
2347
  return "brainType" in t || "llmId" in t;
2360
2348
  }
2361
2349
  var ci = function(t, e, n, o) {
@@ -2385,11 +2373,11 @@ var ci = function(t, e, n, o) {
2385
2373
  p((o = o.apply(t, e || [])).next());
2386
2374
  });
2387
2375
  };
2388
- class Jn {
2376
+ class Kn {
2389
2377
  constructor(e, n, o) {
2390
2378
  if (!e && !n)
2391
2379
  throw new Error("Either sessionToken or apiKey must be provided");
2392
- this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Ln, this.apiVersion = o?.apiVersion || Pn, this.apiGatewayConfig = o?.apiGateway || void 0;
2380
+ this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Bn, this.apiVersion = o?.apiVersion || Ln, this.apiGatewayConfig = o?.apiGateway || void 0;
2393
2381
  }
2394
2382
  /**
2395
2383
  * Builds URL and headers for a request, applying API Gateway configuration if enabled
@@ -2409,7 +2397,7 @@ class Jn {
2409
2397
  return ci(this, void 0, void 0, function* () {
2410
2398
  if (!this.sessionToken) {
2411
2399
  if (!e)
2412
- throw new $("Persona configuration must be provided when using apiKey", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
2400
+ throw new $("Persona configuration must be provided when using apiKey", V.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
2413
2401
  this.sessionToken = yield this.unsafe_getSessionToken(e);
2414
2402
  }
2415
2403
  e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
@@ -2431,22 +2419,22 @@ class Jn {
2431
2419
  case 201:
2432
2420
  return l;
2433
2421
  case 400:
2434
- throw new $("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
2422
+ throw new $("Invalid request to start session", V.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
2435
2423
  case 401:
2436
- throw new $("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
2424
+ throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
2437
2425
  case 402:
2438
- throw new $("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
2426
+ throw new $("Please sign up for a plan to start a session", V.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
2439
2427
  case 403:
2440
- throw new $("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2428
+ throw new $("Authentication failed when starting session", V.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2441
2429
  case 429:
2442
- throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new $("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new $("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
2430
+ throw m === "Concurrent session limit reached" ? new $("Concurrency limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new $("Spend cap reached, please upgrade your plan", V.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new $("Usage limit reached, please upgrade your plan", V.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
2443
2431
  case 503:
2444
- throw new $("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2432
+ throw new $("There are no available personas, please try again later", V.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2445
2433
  default:
2446
- throw new $("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
2434
+ throw new $("Unknown error when starting session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
2447
2435
  }
2448
2436
  } catch (o) {
2449
- throw o instanceof $ ? o : new $("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
2437
+ throw o instanceof $ ? o : new $("Failed to start session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
2450
2438
  }
2451
2439
  });
2452
2440
  }
@@ -2458,7 +2446,7 @@ class Jn {
2458
2446
  let n = {
2459
2447
  clientLabel: "js-sdk-api-key"
2460
2448
  };
2461
- Kn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
2449
+ Yn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
2462
2450
  try {
2463
2451
  const o = `${this.apiVersion}/auth/session-token`, { url: u, headers: a } = this.buildGatewayUrlAndHeaders(o, {
2464
2452
  "Content-Type": "application/json",
@@ -2478,7 +2466,7 @@ class Jn {
2478
2466
  return `${this.baseUrl}${this.apiVersion}`;
2479
2467
  }
2480
2468
  }
2481
- var Xn = function(t, e, n, o) {
2469
+ var Jn = function(t, e, n, o) {
2482
2470
  function u(a) {
2483
2471
  return a instanceof n ? a : new n(function(c) {
2484
2472
  c(a);
@@ -2505,12 +2493,12 @@ var Xn = function(t, e, n, o) {
2505
2493
  p((o = o.apply(t, e || [])).next());
2506
2494
  });
2507
2495
  };
2508
- class Zn {
2496
+ class Xn {
2509
2497
  constructor(e, n, o) {
2510
2498
  this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
2511
2499
  }
2512
2500
  sendTalkCommand(e) {
2513
- return Xn(this, void 0, void 0, function* () {
2501
+ return Jn(this, void 0, void 0, function* () {
2514
2502
  var n, o;
2515
2503
  try {
2516
2504
  let u, a = {
@@ -2538,7 +2526,7 @@ class Zn {
2538
2526
  });
2539
2527
  }
2540
2528
  }
2541
- class Qn {
2529
+ class Zn {
2542
2530
  constructor() {
2543
2531
  this.listeners = {};
2544
2532
  }
@@ -2554,7 +2542,7 @@ class Qn {
2554
2542
  });
2555
2543
  }
2556
2544
  }
2557
- class er {
2545
+ class Qn {
2558
2546
  constructor(e, n) {
2559
2547
  this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
2560
2548
  }
@@ -2602,7 +2590,7 @@ class er {
2602
2590
  n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
2603
2591
  }
2604
2592
  }
2605
- class tr {
2593
+ class er {
2606
2594
  constructor() {
2607
2595
  this.listeners = {};
2608
2596
  }
@@ -2622,10 +2610,10 @@ class tr {
2622
2610
  });
2623
2611
  }
2624
2612
  }
2625
- var q;
2613
+ var z;
2626
2614
  (function(t) {
2627
2615
  t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
2628
- })(q || (q = {}));
2616
+ })(z || (z = {}));
2629
2617
  var pt = function(t, e, n, o) {
2630
2618
  function u(a) {
2631
2619
  return a instanceof n ? a : new n(function(c) {
@@ -2653,25 +2641,25 @@ var pt = function(t, e, n, o) {
2653
2641
  p((o = o.apply(t, e || [])).next());
2654
2642
  });
2655
2643
  };
2656
- class ir {
2644
+ class tr {
2657
2645
  constructor(e, n, o) {
2658
- this.state = q.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2646
+ this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2659
2647
  }
2660
2648
  onDeactivate() {
2661
2649
  this.internalEventEmitter.removeListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2662
2650
  }
2663
2651
  onSignalMessage(e) {
2664
2652
  return pt(this, void 0, void 0, function* () {
2665
- e.actionType === z.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = q.INTERRUPTED, this.onDeactivate());
2653
+ e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
2666
2654
  });
2667
2655
  }
2668
2656
  endMessage() {
2669
2657
  return pt(this, void 0, void 0, function* () {
2670
- if (this.state === q.ENDED) {
2658
+ if (this.state === z.ENDED) {
2671
2659
  console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
2672
2660
  return;
2673
2661
  }
2674
- if (this.state !== q.STREAMING) {
2662
+ if (this.state !== z.STREAMING) {
2675
2663
  console.warn("Talk stream is not active state: " + this.state);
2676
2664
  return;
2677
2665
  }
@@ -2681,27 +2669,27 @@ class ir {
2681
2669
  endOfSpeech: !0,
2682
2670
  correlationId: this.correlationId
2683
2671
  };
2684
- yield this.signallingClient.sendTalkMessage(e), this.state = q.ENDED, this.onDeactivate();
2672
+ yield this.signallingClient.sendTalkMessage(e), this.state = z.ENDED, this.onDeactivate();
2685
2673
  });
2686
2674
  }
2687
2675
  streamMessageChunk(e, n) {
2688
2676
  return pt(this, void 0, void 0, function* () {
2689
- if (this.state !== q.STREAMING && this.state !== q.UNSTARTED)
2677
+ if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
2690
2678
  throw new Error("Talk stream is not in an active state: " + this.state);
2691
2679
  const o = {
2692
2680
  content: e,
2693
- startOfSpeech: this.state === q.UNSTARTED,
2681
+ startOfSpeech: this.state === z.UNSTARTED,
2694
2682
  endOfSpeech: n,
2695
2683
  correlationId: this.correlationId
2696
2684
  };
2697
- this.state = n ? q.ENDED : q.STREAMING, this.state === q.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
2685
+ this.state = n ? z.ENDED : z.STREAMING, this.state === z.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
2698
2686
  });
2699
2687
  }
2700
2688
  getCorrelationId() {
2701
2689
  return this.correlationId;
2702
2690
  }
2703
2691
  isActive() {
2704
- return this.state === q.STREAMING || this.state === q.UNSTARTED;
2692
+ return this.state === z.STREAMING || this.state === z.UNSTARTED;
2705
2693
  }
2706
2694
  getState() {
2707
2695
  return this.state;
@@ -2734,8 +2722,8 @@ var J = function(t, e, n, o) {
2734
2722
  p((o = o.apply(t, e || [])).next());
2735
2723
  });
2736
2724
  };
2737
- const nr = 15e3, rr = 5e3, or = 2;
2738
- class sr {
2725
+ const ir = 15e3, nr = 5e3, rr = 2;
2726
+ class or {
2739
2727
  constructor(e, n, o, u) {
2740
2728
  var a, c, l, m;
2741
2729
  this.peerConnection = null, this.connectionReceivedAnswer = !1, this.remoteIceCandidateBuffer = [], this.inputAudioStream = null, this.dataChannel = null, this.videoElement = null, this.videoStream = null, this.audioStream = null, this.inputAudioState = {
@@ -2743,7 +2731,7 @@ class sr {
2743
2731
  permissionState: fe.NOT_REQUESTED
2744
2732
  }, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = u, this.apiGatewayConfig = n.apiGateway;
2745
2733
  const { inputAudio: p } = n;
2746
- this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(X.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new Yn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Zn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (c = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && c !== void 0 ? c : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
2734
+ this.inputAudioState = p.inputAudioState, n.inputAudio.userProvidedMediaStream && (this.inputAudioStream = n.inputAudio.userProvidedMediaStream), this.disableInputAudio = n.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(X.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.iceServers = n.iceServers, this.signallingClient = new qn(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new Xn(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (c = (a = n.metrics) === null || a === void 0 ? void 0 : a.showPeerConnectionStatsReport) !== null && c !== void 0 ? c : !1, this.peerConnectionStatsReportOutputFormat = (m = (l = n.metrics) === null || l === void 0 ? void 0 : l.peerConnectionStatsReportOutputFormat) !== null && m !== void 0 ? m : "console";
2747
2735
  }
2748
2736
  onInputAudioStateChange(e, n) {
2749
2737
  e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
@@ -2769,7 +2757,7 @@ class sr {
2769
2757
  } catch (e) {
2770
2758
  console.error("Failed to collect and send stats:", e);
2771
2759
  }
2772
- }), rr));
2760
+ }), nr));
2773
2761
  }
2774
2762
  sendClientSideMetrics(e) {
2775
2763
  e.forEach((n) => {
@@ -2787,7 +2775,7 @@ class sr {
2787
2775
  return;
2788
2776
  const e = setTimeout(() => {
2789
2777
  this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
2790
- }, nr);
2778
+ }, ir);
2791
2779
  this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
2792
2780
  if (!this.peerConnection || this.successMetricFired) {
2793
2781
  this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
@@ -2887,10 +2875,10 @@ class sr {
2887
2875
  });
2888
2876
  }
2889
2877
  startTalkMessageStream(e) {
2890
- return e || (e = Math.random().toString(36).substring(2, 15)), new ir(e, this.internalEventEmitter, this.signallingClient);
2878
+ return e || (e = Math.random().toString(36).substring(2, 15)), new tr(e, this.internalEventEmitter, this.signallingClient);
2891
2879
  }
2892
2880
  createAgentAudioInputStream(e) {
2893
- return this.agentAudioInputStream = new Wn(e, this.signallingClient), this.agentAudioInputStream;
2881
+ return this.agentAudioInputStream = new Hn(e, this.signallingClient), this.agentAudioInputStream;
2894
2882
  }
2895
2883
  getAgentAudioInputStream() {
2896
2884
  return this.agentAudioInputStream;
@@ -2899,7 +2887,7 @@ class sr {
2899
2887
  return J(this, void 0, void 0, function* () {
2900
2888
  this.peerConnection = new RTCPeerConnection({
2901
2889
  iceServers: this.iceServers,
2902
- iceCandidatePoolSize: or
2890
+ iceCandidatePoolSize: rr
2903
2891
  }), this.peerConnection.onicecandidate = this.onIceCandidate.bind(this), this.peerConnection.oniceconnectionstatechange = this.onIceConnectionStateChange.bind(this), this.peerConnection.onconnectionstatechange = this.onConnectionStateChange.bind(this), this.peerConnection.addEventListener("track", this.onTrackEventHandler.bind(this)), yield this.setupDataChannels(), this.peerConnection.addTransceiver("video", { direction: "recvonly" }), this.disableInputAudio ? this.peerConnection.addTransceiver("audio", { direction: "recvonly" }) : (this.peerConnection.addTransceiver("audio", { direction: "sendrecv" }), this.inputAudioStream ? yield this.setupAudioTrack() : this.requestMicrophonePermissionAsync().catch((e) => {
2904
2892
  console.error("Async microphone permission request failed:", e);
2905
2893
  }));
@@ -2912,31 +2900,31 @@ class sr {
2912
2900
  return;
2913
2901
  }
2914
2902
  switch (e.actionType) {
2915
- case z.ANSWER:
2903
+ case W.ANSWER:
2916
2904
  const n = e.payload;
2917
2905
  yield this.peerConnection.setRemoteDescription(n), this.connectionReceivedAnswer = !0, this.flushRemoteIceCandidateBuffer();
2918
2906
  break;
2919
- case z.ICE_CANDIDATE:
2907
+ case W.ICE_CANDIDATE:
2920
2908
  const o = e.payload, u = new RTCIceCandidate(o);
2921
2909
  this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(u) : this.remoteIceCandidateBuffer.push(u);
2922
2910
  break;
2923
- case z.END_SESSION:
2911
+ case W.END_SESSION:
2924
2912
  const a = e.payload;
2925
2913
  this.publicEventEmitter.emit(N.CONNECTION_CLOSED, _e.SERVER_CLOSED_CONNECTION, a), this.shutdown();
2926
2914
  break;
2927
- case z.WARNING:
2915
+ case W.WARNING:
2928
2916
  const c = e.payload;
2929
2917
  console.warn("Warning received from server: " + c), this.publicEventEmitter.emit(N.SERVER_WARNING, c);
2930
2918
  break;
2931
- case z.TALK_STREAM_INTERRUPTED:
2919
+ case W.TALK_STREAM_INTERRUPTED:
2932
2920
  const l = e.payload;
2933
2921
  this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
2934
2922
  break;
2935
- case z.SESSION_READY:
2923
+ case W.SESSION_READY:
2936
2924
  const m = e.sessionId;
2937
2925
  this.publicEventEmitter.emit(N.SESSION_READY, m);
2938
2926
  break;
2939
- case z.HEARTBEAT:
2927
+ case W.HEARTBEAT:
2940
2928
  break;
2941
2929
  default:
2942
2930
  console.warn("StreamingClient - onSignalMessage: unknown signal message action type. Is your anam-sdk version up to date?", e);
@@ -3021,7 +3009,7 @@ class sr {
3021
3009
  case De.CLIENT_TOOL_EVENT:
3022
3010
  const u = o.data;
3023
3011
  this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
3024
- const a = ar.WebRTCClientToolEventToClientToolEvent(u);
3012
+ const a = sr.WebRTCClientToolEventToClientToolEvent(u);
3025
3013
  this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
3026
3014
  break;
3027
3015
  case De.REASONING_TEXT:
@@ -3111,7 +3099,7 @@ class sr {
3111
3099
  if (this.showPeerConnectionStatsReport) {
3112
3100
  const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
3113
3101
  if (n) {
3114
- const o = jn(n, this.peerConnectionStatsReportOutputFormat);
3102
+ const o = Vn(n, this.peerConnectionStatsReportOutputFormat);
3115
3103
  o && console.log(o, void 0, 2);
3116
3104
  }
3117
3105
  }
@@ -3136,7 +3124,7 @@ class sr {
3136
3124
  });
3137
3125
  }
3138
3126
  }
3139
- class ar {
3127
+ class sr {
3140
3128
  /**
3141
3129
  * Converts a WebRtcClientToolEvent to a ClientToolEvent
3142
3130
  */
@@ -3152,7 +3140,7 @@ class ar {
3152
3140
  };
3153
3141
  }
3154
3142
  }
3155
- class lr {
3143
+ class ar {
3156
3144
  constructor(e, n) {
3157
3145
  this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
3158
3146
  }
@@ -3207,7 +3195,7 @@ var ue = function(t, e, n, o) {
3207
3195
  p((o = o.apply(t, e || [])).next());
3208
3196
  });
3209
3197
  };
3210
- class cr {
3198
+ class lr {
3211
3199
  constructor(e, n, o) {
3212
3200
  var u, a, c, l, m;
3213
3201
  this.inputAudioState = {
@@ -3216,12 +3204,12 @@ class cr {
3216
3204
  }, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
3217
3205
  const p = this.validateClientConfig(e, n, o);
3218
3206
  if (p)
3219
- throw new $(p, j.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3220
- this.personaConfig = n, this.clientOptions = o, (!((u = o?.api) === null || u === void 0) && u.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && $n(o.api.baseUrl || Wi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && Gn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && Vn(!0), this.publicEventEmitter = new tr(), this.internalEventEmitter = new Qn(), this.apiClient = new Jn(e, o?.apiKey, o?.api), this.messageHistoryClient = new er(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new lr(this.publicEventEmitter, this.internalEventEmitter);
3207
+ throw new $(p, V.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3208
+ this.personaConfig = n, this.clientOptions = o, (!((u = o?.api) === null || u === void 0) && u.baseUrl || !((a = o?.api) === null || a === void 0) && a.apiVersion) && Fn(o.api.baseUrl || Wi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && $n(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && Gn(!0), this.publicEventEmitter = new er(), this.internalEventEmitter = new Zn(), this.apiClient = new Kn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Qn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new ar(this.publicEventEmitter, this.internalEventEmitter);
3221
3209
  }
3222
3210
  decodeJwt(e) {
3223
3211
  try {
3224
- const n = e.split(".")[1], o = Bn.Buffer.from(n, "base64").toString("utf8");
3212
+ const n = e.split(".")[1], o = Un.Buffer.from(n, "base64").toString("utf8");
3225
3213
  return JSON.parse(o);
3226
3214
  } catch {
3227
3215
  throw new Error("Invalid session token format");
@@ -3233,7 +3221,7 @@ class cr {
3233
3221
  return "Either sessionToken or apiKey must be provided";
3234
3222
  if (o?.apiKey && e)
3235
3223
  return "Only one of sessionToken or apiKey should be used";
3236
- const c = Hn((u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway);
3224
+ const c = jn((u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway);
3237
3225
  if (c)
3238
3226
  return c;
3239
3227
  if (e) {
@@ -3268,23 +3256,23 @@ class cr {
3268
3256
  startSession(e) {
3269
3257
  return ue(this, void 0, void 0, function* () {
3270
3258
  var n, o, u, a, c, l, m, p, _, d, S, g;
3271
- const y = this.personaConfig, b = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, b), { sessionId: C, clientConfig: I, engineHost: x, engineProtocol: O, signallingEndpoint: R } = A, { heartbeatIntervalSeconds: G, maxWsReconnectionAttempts: W, iceServers: ae } = I;
3259
+ const y = this.personaConfig, b = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, b), { sessionId: C, clientConfig: I, engineHost: x, engineProtocol: O, signallingEndpoint: T } = A, { heartbeatIntervalSeconds: q, maxWsReconnectionAttempts: H, iceServers: ae } = I;
3272
3260
  this.sessionId = C, we({
3273
3261
  sessionId: this.sessionId
3274
3262
  });
3275
3263
  const ne = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : ae;
3276
3264
  try {
3277
- this.streamingClient = new sr(C, {
3265
+ this.streamingClient = new or(C, {
3278
3266
  engine: {
3279
3267
  baseUrl: `${O}://${x}`
3280
3268
  },
3281
3269
  signalling: {
3282
- heartbeatIntervalSeconds: G,
3283
- maxWsReconnectionAttempts: W,
3270
+ heartbeatIntervalSeconds: q,
3271
+ maxWsReconnectionAttempts: H,
3284
3272
  url: {
3285
3273
  baseUrl: x,
3286
3274
  protocol: O,
3287
- signallingPath: R
3275
+ signallingPath: T
3288
3276
  }
3289
3277
  },
3290
3278
  iceServers: ne,
@@ -3303,7 +3291,7 @@ class cr {
3303
3291
  } catch (re) {
3304
3292
  throw we({
3305
3293
  sessionId: null
3306
- }), new $("Failed to initialize streaming client", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3294
+ }), new $("Failed to initialize streaming client", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3307
3295
  cause: re instanceof Error ? re.message : String(re),
3308
3296
  sessionId: C
3309
3297
  });
@@ -3314,7 +3302,7 @@ class cr {
3314
3302
  startSessionIfNeeded(e) {
3315
3303
  return ue(this, void 0, void 0, function* () {
3316
3304
  if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e), !this.sessionId || !this.streamingClient))
3317
- throw new $("Session ID or streaming client is not available after starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3305
+ throw new $("Session ID or streaming client is not available after starting session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3318
3306
  cause: "Failed to initialize session properly"
3319
3307
  });
3320
3308
  });
@@ -3361,7 +3349,7 @@ class cr {
3361
3349
  try {
3362
3350
  yield this.startSessionIfNeeded(n);
3363
3351
  } catch (a) {
3364
- throw a instanceof $ ? a : new $("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3352
+ throw a instanceof $ ? a : new $("Failed to start session", V.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3365
3353
  cause: a instanceof Error ? a.message : String(a),
3366
3354
  sessionId: this.sessionId
3367
3355
  });
@@ -3498,8 +3486,8 @@ class cr {
3498
3486
  return this.sessionId;
3499
3487
  }
3500
3488
  }
3501
- const ur = (t, e) => new cr(t, void 0, e), dr = "https://api.anam.ai";
3502
- function hr(t) {
3489
+ const cr = (t, e) => new lr(t, void 0, e), ur = "https://api.anam.ai";
3490
+ function dr(t) {
3503
3491
  try {
3504
3492
  const e = t.split(".")[1];
3505
3493
  return JSON.parse(atob(e));
@@ -3508,10 +3496,10 @@ function hr(t) {
3508
3496
  }
3509
3497
  }
3510
3498
  const Z = K(null), te = K("idle"), Le = K(!1), Ke = K(!1), at = K([]), Pe = K(null), it = K(null), Ot = K(null), kt = K(null), Dt = K(null), ui = K(!1), nt = K(!1);
3511
- function fr(t, e) {
3499
+ function hr(t, e) {
3512
3500
  return e === 401 || e === 403 ? "This agent is not authorized. Check your agent ID." : e === 404 ? "Agent not found. Check your agent ID." : e === 429 ? "Too many requests. Please wait a moment." : e && e >= 500 ? "Server error. Please try again later." : t instanceof TypeError && t.message === "Failed to fetch" ? "Unable to connect. Check your network connection." : t instanceof Error && t.message.length < 80 ? t.message : "Something went wrong. Please try again.";
3513
3501
  }
3514
- async function pr(t, e) {
3502
+ async function fr(t, e) {
3515
3503
  nt.value = !1;
3516
3504
  try {
3517
3505
  const n = await fetch(`${e}/v1/personas/${t}/widget`);
@@ -3523,7 +3511,7 @@ async function pr(t, e) {
3523
3511
  nt.value = !0;
3524
3512
  }
3525
3513
  }
3526
- async function _r(t, e, n, o) {
3514
+ async function pr(t, e, n, o) {
3527
3515
  if (te.value === "connecting" || te.value === "connected")
3528
3516
  return;
3529
3517
  te.value = "connecting", Pe.value = null;
@@ -3548,7 +3536,7 @@ async function _r(t, e, n, o) {
3548
3536
  hasToken: !!p.sessionToken
3549
3537
  }), a = p.sessionToken;
3550
3538
  }
3551
- const c = ur(a, {
3539
+ const c = cr(a, {
3552
3540
  api: e ? { baseUrl: e } : void 0,
3553
3541
  metrics: { disableClientMetrics: !0 }
3554
3542
  });
@@ -3571,10 +3559,10 @@ async function _r(t, e, n, o) {
3571
3559
  m && (n.srcObject = m);
3572
3560
  }
3573
3561
  } catch (a) {
3574
- console.error("[AnamWidget] Failed to start session:", a), Pe.value = fr(a, u), te.value = "error", Z.value = null;
3562
+ console.error("[AnamWidget] Failed to start session:", a), Pe.value = hr(a, u), te.value = "error", Z.value = null;
3575
3563
  }
3576
3564
  }
3577
- async function Er() {
3565
+ async function _r() {
3578
3566
  if (Z.value)
3579
3567
  try {
3580
3568
  await Z.value.stopStreaming();
@@ -3583,19 +3571,19 @@ async function Er() {
3583
3571
  }
3584
3572
  Z.value = null, te.value = "idle", Le.value = !1, at.value = [];
3585
3573
  }
3586
- function mr(t) {
3574
+ function Er(t) {
3587
3575
  !Z.value || te.value !== "connected" || Z.value.sendUserMessage(t);
3588
3576
  }
3589
- function gr() {
3577
+ function mr() {
3590
3578
  Z.value && (Ke.value ? (Z.value.unmuteInputAudio(), Ke.value = !1) : (Z.value.muteInputAudio(), Ke.value = !0));
3591
3579
  }
3592
- function vr() {
3580
+ function gr() {
3593
3581
  Z.value?.isStreaming() && Z.value.stopStreaming(), Z.value = null, te.value = "idle", Le.value = !1, at.value = [], Pe.value = null, it.value = null, Ot.value = null, kt.value = null, Dt.value = null;
3594
3582
  }
3595
- function yr(t, e, n) {
3596
- const o = t || (n ? hr(n).personaId : void 0);
3583
+ function vr(t, e, n) {
3584
+ const o = t || (n ? dr(n).personaId : void 0);
3597
3585
  ui.value = !!o || !!n;
3598
- const u = e || dr;
3586
+ const u = e || ur;
3599
3587
  return {
3600
3588
  connectionStatus: te,
3601
3589
  isStreaming: Le,
@@ -3613,13 +3601,13 @@ function yr(t, e, n) {
3613
3601
  nt.value = !0;
3614
3602
  return;
3615
3603
  }
3616
- pr(o, u);
3604
+ fr(o, u);
3617
3605
  },
3618
- startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : _r(o || "", u, l, n),
3619
- stopSession: Er,
3620
- sendMessage: mr,
3621
- toggleMute: gr,
3622
- cleanup: vr
3606
+ startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : pr(o || "", u, l, n),
3607
+ stopSession: _r,
3608
+ sendMessage: Er,
3609
+ toggleMute: mr,
3610
+ cleanup: gr
3623
3611
  };
3624
3612
  }
3625
3613
  const di = '@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.visible{visibility:visible}.fixed{position:fixed}.block{display:block}.flex{display:flex}.inline{display:inline}.flex-shrink{flex-shrink:1}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.border{border-style:var(--tw-border-style);border-width:1px}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}}:host{--anam-background:#fff;--anam-text:#18181b;--anam-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:var(--anam-text);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:DM Sans,system-ui,-apple-system,sans-serif;font-size:15px;line-height:1.5}@media(max-width:640px){:host{--anam-trigger-size:72px;--anam-sheet-width: calc(100vw - 24px) ;--anam-sheet-height: calc(100dvh - 100px) }}.anam-widget{z-index:9999;font-family:inherit}.anam-widget[data-inline=false]{position:fixed}.anam-widget[data-inline=true]{position:relative}.anam-trigger{width:var(--anam-trigger-size);height:var(--anam-trigger-size);cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;transition:all .25s cubic-bezier(.4,0,.2,1);display:flex;overflow:hidden;box-shadow:0 2px 8px #00000014,0 8px 24px -4px #0000002e}.anam-trigger:hover{transform:scale(1.06);box-shadow:0 4px 12px #0000001a,0 12px 32px -4px #00000040}.anam-trigger:active{transform:scale(.97)}.anam-trigger img{object-fit:cover;width:100%;height:100%;display:block}.anam-sheet{width:var(--anam-sheet-width);aspect-ratio:16/10;max-height:var(--anam-sheet-height);border-radius:8px;animation:.25s cubic-bezier(.16,1,.3,1) sheetIn;position:relative;overflow:hidden;box-shadow:0 32px 64px -16px #00000040,0 0 0 1px #00000014}.anam-widget[data-inline=true][data-layout=expanded] .anam-sheet{aspect-ratio:3/2;border-radius:8px;width:100%;max-height:none;animation:none}@keyframes sheetIn{0%{opacity:0;transform:translateY(8px)scale(.97)}to{opacity:1;transform:translateY(0)scale(1)}}.anam-video{object-fit:cover;background:#000;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-video[data-hidden=true]{visibility:hidden}.anam-overlay-idle{z-index:2;position:absolute;inset:0}.anam-overlay-idle img{object-fit:cover;width:100%;height:100%;display:block}.anam-cta-pill{-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#00000080;border:1px solid #ffffff1a;border-radius:999px;align-items:center;gap:10px;padding:12px 28px;font-family:inherit;font-size:15px;font-weight:500;transition:all .2s;display:flex;position:absolute;bottom:40px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#000000a6;transform:translate(-50%)scale(1.03)}.anam-cta-pill:active{transform:translate(-50%)scale(.98)}.anam-cta-pill svg{flex-shrink:0}.anam-overlay-unconfigured{z-index:2;background:#111;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-unconfigured span{color:#ffffff59;letter-spacing:-.01em;font-size:14px;font-weight:400}.anam-overlay-loading{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:20px;display:flex;position:absolute;inset:0}.anam-overlay-loading span{color:#fffc;letter-spacing:-.01em;font-size:15px;font-weight:400}.anam-overlay-error{z-index:3;background:#000;flex-direction:column;justify-content:center;align-items:center;gap:16px;display:flex;position:absolute;inset:0}.anam-overlay-error-text{color:#fff9;text-align:center;max-width:260px;font-size:14px;line-height:1.5}.anam-overlay-error .anam-retry-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff1f;border:1px solid #ffffff1a;border-radius:999px;padding:10px 24px;font-family:inherit;font-size:14px;font-weight:500;transition:background .15s}.anam-overlay-error .anam-retry-btn:hover{background:#fff3}.anam-spinner{border:2.5px solid #ffffff1f;border-top-color:#fff;border-radius:50%;width:32px;height:32px;animation:.75s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.anam-close-btn{z-index:10;-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#00000073;border:1px solid #ffffff14;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:background .15s;display:flex;position:absolute;top:12px;right:12px}.anam-close-btn:hover{background:#0009}.anam-toast{z-index:10;-webkit-backdrop-filter:blur(16px);color:#fff;letter-spacing:-.01em;white-space:nowrap;text-overflow:ellipsis;pointer-events:none;background:#0009;border:1px solid #ffffff0f;border-radius:999px;max-width:85%;padding:10px 22px;font-size:14px;font-weight:400;animation:.25s cubic-bezier(.16,1,.3,1) toastIn;position:absolute;bottom:80px;left:50%;overflow:hidden;transform:translate(-50%)}.anam-toast-out{animation:.4s forwards toastOut}@keyframes toastIn{0%{opacity:0;transform:translate(-50%)translateY(6px)}to{opacity:1;transform:translate(-50%)translateY(0)}}@keyframes toastOut{0%{opacity:1}to{opacity:0}}.anam-control-bar{z-index:10;background:linear-gradient(#0000,#00000040 40%,#0000008c);align-items:center;gap:8px;padding:48px 16px 16px;display:flex;position:absolute;bottom:0;left:0;right:0}.anam-ctl-btn{-webkit-backdrop-filter:blur(8px);color:#fff;cursor:pointer;background:#ffffff24;border:1px solid #ffffff0f;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:44px;height:44px;padding:0;transition:background .15s;display:flex}.anam-ctl-btn:hover{background:#ffffff38}.anam-ctl-btn:disabled{opacity:.35;cursor:not-allowed}.anam-ctl-btn-muted{background:#dc26268c;border-color:#dc262633}.anam-ctl-btn-muted:hover{background:#dc2626b3}.anam-ctl-end{background:#dc262699;border-color:#dc262626}.anam-ctl-end:hover{background:#dc2626cc}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff14;border-radius:999px;outline:none;flex:1;min-width:0;padding:11px 18px;font-family:inherit;font-size:14px;transition:background .15s,border-color .15s}.anam-ctl-input::placeholder{color:#fff6}.anam-ctl-input:focus{background:#ffffff26;border-color:#ffffff2e}.anam-ctl-input:disabled{opacity:.35;cursor:not-allowed}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}';
@@ -3635,7 +3623,7 @@ function ze(t) {
3635
3623
  if (t !== void 0)
3636
3624
  return t === "true";
3637
3625
  }
3638
- function Sr(t) {
3626
+ function yr(t) {
3639
3627
  const e = {}, n = ze(t.inline);
3640
3628
  n !== void 0 && (e.inline = n), t.layout && (e.layout = t.layout), t.position && (e.position = t.position);
3641
3629
  const o = ze(t["ui-mute-button"]);
@@ -3645,26 +3633,26 @@ function Sr(t) {
3645
3633
  const a = ze(t["ui-captions"]);
3646
3634
  return a !== void 0 && (e.showCaptions = a), e;
3647
3635
  }
3648
- const wr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round", children: /* @__PURE__ */ w("path", { d: "M18 6L6 18M6 6l12 12" }) }), Cr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ w("path", { d: "M8 5.14v13.72a1 1 0 0 0 1.5.86l11.04-6.86a1 1 0 0 0 0-1.72L9.5 4.28A1 1 0 0 0 8 5.14Z" }) }), Ir = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3636
+ const Sr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2.5", "stroke-linecap": "round", children: /* @__PURE__ */ w("path", { d: "M18 6L6 18M6 6l12 12" }) }), wr = () => /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ w("path", { d: "M8 5.14v13.72a1 1 0 0 0 1.5.86l11.04-6.86a1 1 0 0 0 0-1.72L9.5 4.28A1 1 0 0 0 8 5.14Z" }) }), Cr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3649
3637
  /* @__PURE__ */ w("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
3650
3638
  /* @__PURE__ */ w("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
3651
3639
  /* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3652
- ] }), br = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3640
+ ] }), Ir = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3653
3641
  /* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
3654
3642
  /* @__PURE__ */ w("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
3655
3643
  /* @__PURE__ */ w("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
3656
3644
  /* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3657
- ] }), Ar = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3645
+ ] }), br = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3658
3646
  /* @__PURE__ */ w("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
3659
3647
  /* @__PURE__ */ w("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
3660
- ] }), Tr = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3648
+ ] }), Ar = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3661
3649
  /* @__PURE__ */ w("path", { d: "M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 2.59 3.4z" }),
3662
3650
  /* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
3663
3651
  ] }), Ct = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
3664
3652
  /* @__PURE__ */ w("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
3665
3653
  /* @__PURE__ */ w("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
3666
3654
  ] });
3667
- function Rr({
3655
+ function Tr({
3668
3656
  config: t,
3669
3657
  session: e,
3670
3658
  videoRef: n,
@@ -3676,17 +3664,17 @@ function Rr({
3676
3664
  n.current && await e.startSession(n.current);
3677
3665
  }, [e.startSession]), O = je(async () => {
3678
3666
  await e.stopSession();
3679
- }, [e.stopSession]), R = je(() => {
3667
+ }, [e.stopSession]), T = je(() => {
3680
3668
  if (!l.trim()) return;
3681
- const W = l.trim();
3682
- e.sendMessage(W), m(""), c.current?.focus(), g.current && clearTimeout(g.current), S(!1), _(W), g.current = window.setTimeout(() => {
3669
+ const H = l.trim();
3670
+ e.sendMessage(H), m(""), c.current?.focus(), g.current && clearTimeout(g.current), S(!1), _(H), g.current = window.setTimeout(() => {
3683
3671
  S(!0), g.current = window.setTimeout(() => {
3684
3672
  _(null), S(!1);
3685
3673
  }, 400);
3686
3674
  }, 2600);
3687
- }, [l]), G = je((W) => {
3688
- W.key === "Enter" && !W.shiftKey && (W.preventDefault(), R());
3689
- }, [R]);
3675
+ }, [l]), q = je((H) => {
3676
+ H.key === "Enter" && !H.shiftKey && (H.preventDefault(), T());
3677
+ }, [T]);
3690
3678
  return gt(() => () => {
3691
3679
  g.current && clearTimeout(g.current);
3692
3680
  }, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
@@ -3705,7 +3693,7 @@ function Rr({
3705
3693
  /* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
3706
3694
  o ? /* @__PURE__ */ w("img", { src: o, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {}),
3707
3695
  /* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: x, children: [
3708
- /* @__PURE__ */ w(Cr, {}),
3696
+ /* @__PURE__ */ w(wr, {}),
3709
3697
  u
3710
3698
  ] })
3711
3699
  ] })
@@ -3725,7 +3713,7 @@ function Rr({
3725
3713
  /* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: x, children: "Try Again" })
3726
3714
  ] }),
3727
3715
  (y || C) && /* @__PURE__ */ w(oe, { children: [
3728
- a && /* @__PURE__ */ w("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ w(wr, {}) }),
3716
+ a && /* @__PURE__ */ w("button", { class: "anam-close-btn", onClick: a, "aria-label": "Close", children: /* @__PURE__ */ w(Sr, {}) }),
3729
3717
  p && /* @__PURE__ */ w("div", { class: `anam-toast ${d ? "anam-toast-out" : ""}`, children: p }),
3730
3718
  /* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
3731
3719
  t.showMuteButton && /* @__PURE__ */ w(
@@ -3734,7 +3722,7 @@ function Rr({
3734
3722
  class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
3735
3723
  onClick: () => e.toggleMute(),
3736
3724
  "aria-label": e.isMuted.value ? "Unmute" : "Mute",
3737
- children: e.isMuted.value ? /* @__PURE__ */ w(br, {}) : /* @__PURE__ */ w(Ir, {})
3725
+ children: e.isMuted.value ? /* @__PURE__ */ w(Ir, {}) : /* @__PURE__ */ w(Cr, {})
3738
3726
  }
3739
3727
  ),
3740
3728
  t.showTextInput && /* @__PURE__ */ w(oe, { children: [
@@ -3746,8 +3734,8 @@ function Rr({
3746
3734
  class: "anam-ctl-input",
3747
3735
  placeholder: t.textContents.placeholder,
3748
3736
  value: l,
3749
- onInput: (W) => m(W.target.value),
3750
- onKeyDown: G,
3737
+ onInput: (H) => m(H.target.value),
3738
+ onKeyDown: q,
3751
3739
  disabled: !y
3752
3740
  }
3753
3741
  ),
@@ -3755,10 +3743,10 @@ function Rr({
3755
3743
  "button",
3756
3744
  {
3757
3745
  class: "anam-ctl-btn",
3758
- onClick: R,
3746
+ onClick: T,
3759
3747
  disabled: !y || !l.trim(),
3760
3748
  "aria-label": "Send message",
3761
- children: /* @__PURE__ */ w(Ar, {})
3749
+ children: /* @__PURE__ */ w(br, {})
3762
3750
  }
3763
3751
  )
3764
3752
  ] }),
@@ -3768,22 +3756,22 @@ function Rr({
3768
3756
  class: "anam-ctl-btn anam-ctl-end",
3769
3757
  onClick: O,
3770
3758
  "aria-label": "End call",
3771
- children: /* @__PURE__ */ w(Tr, {})
3759
+ children: /* @__PURE__ */ w(Ar, {})
3772
3760
  }
3773
3761
  )
3774
3762
  ] })
3775
3763
  ] })
3776
3764
  ] });
3777
3765
  }
3778
- function Nr(t) {
3766
+ function Rr(t) {
3779
3767
  const e = Ze(null), n = Vi(!1);
3780
3768
  t["agent-id"] && t["session-token"] && console.warn("[AnamWidget] Both agent-id and session-token are set. Use one or the other. Ignoring agent-id.");
3781
- const o = t["session-token"] ? void 0 : t["agent-id"], u = yr(o, t["api-base-url"], t["session-token"]), a = me(
3782
- () => Sr(t),
3769
+ const o = t["session-token"] ? void 0 : t["agent-id"], u = vr(o, t["api-base-url"], t["session-token"]), a = me(
3770
+ () => yr(t),
3783
3771
  [t.inline, t.layout, t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"]]
3784
3772
  ), c = me(() => {
3785
- const O = u.serverConfig.value, R = On(O), G = wt(wt({ ...ri }, R), a);
3786
- return G.layout === "orb" && (G.inline = !1), G;
3773
+ const O = u.serverConfig.value, T = wt(wt({ ...ri }, O ?? {}), a);
3774
+ return T.layout === "orb" && (T.inline = !1), T;
3787
3775
  }, [u.serverConfig.value, a]);
3788
3776
  gt(() => {
3789
3777
  u.fetchWidgetConfig();
@@ -3793,8 +3781,8 @@ function Nr(t) {
3793
3781
  [c.styles.backgroundColor, c.styles.textColor]
3794
3782
  ), S = me(() => {
3795
3783
  if (c.inline) return "";
3796
- const O = kn(c.position);
3797
- return Object.entries(O).map(([R, G]) => `${R}: ${G}`).join("; ");
3784
+ const O = On(c.position);
3785
+ return Object.entries(O).map(([T, q]) => `${T}: ${q}`).join("; ");
3798
3786
  }, [c.inline, c.position]), g = [d, S].filter(Boolean).join("; "), y = Ze(!1), b = () => {
3799
3787
  n.value = !0, y.current = !1, setTimeout(() => {
3800
3788
  e.current && u.startSession(e.current);
@@ -3826,7 +3814,7 @@ function Nr(t) {
3826
3814
  }
3827
3815
  ),
3828
3816
  x && /* @__PURE__ */ w(
3829
- Rr,
3817
+ Tr,
3830
3818
  {
3831
3819
  config: c,
3832
3820
  session: u,
@@ -3841,7 +3829,7 @@ function Nr(t) {
3841
3829
  )
3842
3830
  ] }) : /* @__PURE__ */ w("style", { children: di });
3843
3831
  }
3844
- const xr = [
3832
+ const Nr = [
3845
3833
  "agent-id",
3846
3834
  // Persona ID -- required for session streaming + server config fetch
3847
3835
  "api-base-url",
@@ -3864,7 +3852,7 @@ const xr = [
3864
3852
  // Override avatar thumbnail (Lab preview)
3865
3853
  "agent-name"
3866
3854
  // Override persona name for CTA (Lab preview)
3867
- ], kr = {
3855
+ ], Or = {
3868
3856
  SESSION_STARTED: "anam-agent:session-started",
3869
3857
  SESSION_ENDED: "anam-agent:session-ended",
3870
3858
  MESSAGE_RECEIVED: "anam-agent:message-received",
@@ -3876,14 +3864,13 @@ const xr = [
3876
3864
  MIC_UNMUTED: "anam-agent:mic-unmuted"
3877
3865
  };
3878
3866
  function hi(t = "anam-agent") {
3879
- _n(Nr, t, [...xr], {
3867
+ _n(Rr, t, [...Nr], {
3880
3868
  shadow: !0
3881
3869
  });
3882
3870
  }
3883
3871
  typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => hi()) : hi());
3884
3872
  export {
3885
3873
  ri as DefaultConfig,
3886
- kr as WidgetEventNames,
3887
- On as normalizeConfig,
3874
+ Or as WidgetEventNames,
3888
3875
  hi as registerWidget
3889
3876
  };