@anam-ai/agent-widget 0.1.0 → 0.1.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.
package/dist/index.js CHANGED
@@ -1,93 +1,93 @@
1
- var Fe, k, pi, _i, Ee, Wt, Ei, mi, gi, It, pt, _t, Me = {}, vi = [], cn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, it = Array.isArray;
2
- function ie(t, e) {
1
+ var Ue, k, ei, ti, pe, Dt, ii, ni, ri, mt, lt, ct, ke = {}, oi = [], Ki = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, Je = Array.isArray;
2
+ function ee(t, e) {
3
3
  for (var n in e) t[n] = e[n];
4
4
  return t;
5
5
  }
6
- function bt(t) {
6
+ function Et(t) {
7
7
  t && t.parentNode && t.parentNode.removeChild(t);
8
8
  }
9
- function Ce(t, e, n) {
10
- var o, u, a, c = {};
11
- for (a in e) a == "key" ? o = e[a] : a == "ref" ? u = e[a] : c[a] = e[a];
12
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (a in t.defaultProps) c[a] === void 0 && (c[a] = t.defaultProps[a]);
13
- return xe(t, c, o, u, null);
9
+ function Se(t, e, n) {
10
+ var o, l, s, u = {};
11
+ for (s in e) s == "key" ? o = e[s] : s == "ref" ? l = e[s] : u[s] = e[s];
12
+ if (arguments.length > 2 && (u.children = arguments.length > 3 ? Ue.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) u[s] === void 0 && (u[s] = t.defaultProps[s]);
13
+ return Ne(t, u, o, l, null);
14
14
  }
15
- function xe(t, e, n, o, u) {
16
- var a = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: u ?? ++pi, __i: -1, __u: 0 };
17
- return u == null && k.vnode != null && k.vnode(a), a;
15
+ function Ne(t, e, n, o, l) {
16
+ var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: l ?? ++ei, __i: -1, __u: 0 };
17
+ return l == null && k.vnode != null && k.vnode(s), s;
18
18
  }
19
- function _e(t) {
19
+ function fe(t) {
20
20
  return t.children;
21
21
  }
22
- function Oe(t, e) {
22
+ function we(t, e) {
23
23
  this.props = t, this.context = e;
24
24
  }
25
- function be(t, e) {
26
- if (e == null) return t.__ ? be(t.__, t.__i + 1) : null;
25
+ function Ie(t, e) {
26
+ if (e == null) return t.__ ? Ie(t.__, t.__i + 1) : null;
27
27
  for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
28
- return typeof t.type == "function" ? be(t) : null;
28
+ return typeof t.type == "function" ? Ie(t) : null;
29
29
  }
30
- function yi(t) {
30
+ function si(t) {
31
31
  var e, n;
32
32
  if ((t = t.__) != null && t.__c != null) {
33
33
  for (t.__e = t.__c.base = null, e = 0; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) {
34
34
  t.__e = t.__c.base = n.__e;
35
35
  break;
36
36
  }
37
- return yi(t);
37
+ return si(t);
38
38
  }
39
39
  }
40
- function zt(t) {
41
- (!t.__d && (t.__d = !0) && Ee.push(t) && !Ke.__r++ || Wt != k.debounceRendering) && ((Wt = k.debounceRendering) || Ei)(Ke);
40
+ function Mt(t) {
41
+ (!t.__d && (t.__d = !0) && pe.push(t) && !He.__r++ || Dt != k.debounceRendering) && ((Dt = k.debounceRendering) || ii)(He);
42
42
  }
43
- function Ke() {
44
- for (var t, e, n, o, u, a, c, l = 1; Ee.length; ) Ee.length > l && Ee.sort(mi), t = Ee.shift(), l = Ee.length, t.__d && (n = void 0, o = void 0, u = (o = (e = t).__v).__e, a = [], c = [], e.__P && ((n = ie({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n), At(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [u] : null, a, u ?? be(o), !!(32 & o.__u), c), n.__v = o.__v, n.__.__k[n.__i] = n, Ci(a, n, c), o.__e = o.__ = null, n.__e != u && yi(n)));
45
- Ke.__r = 0;
43
+ function He() {
44
+ for (var t, e, n, o, l, s, u, c = 1; pe.length; ) pe.length > c && pe.sort(ni), t = pe.shift(), c = pe.length, t.__d && (n = void 0, o = void 0, l = (o = (e = t).__v).__e, s = [], u = [], e.__P && ((n = ee({}, o)).__v = o.__v + 1, k.vnode && k.vnode(n), gt(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [l] : null, s, l ?? Ie(o), !!(32 & o.__u), u), n.__v = o.__v, n.__.__k[n.__i] = n, ci(s, n, u), o.__e = o.__ = null, n.__e != l && si(n)));
45
+ He.__r = 0;
46
46
  }
47
- function Si(t, e, n, o, u, a, c, l, m, p, _) {
48
- var d, S, g, y, C, A, I, b = o && o.__k || vi, R = e.length;
49
- for (m = un(n, e, b, m, R), d = 0; d < R; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? Me : b[g.__i] || Me, g.__i = d, A = At(t, g, S, u, a, c, l, m, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && Tt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), C == null && y != null && (C = y), (I = !!(4 & g.__u)) || S.__k === g.__k ? m = wi(g, m, t, I) : typeof g.type == "function" && A !== void 0 ? m = A : y && (m = y.nextSibling), g.__u &= -7);
50
- return n.__e = C, m;
47
+ function ai(t, e, n, o, l, s, u, c, E, p, _) {
48
+ var d, S, g, y, C, A, I, b = o && o.__k || oi, R = e.length;
49
+ for (E = Ji(n, e, b, E, R), d = 0; d < R; d++) (g = n.__k[d]) != null && (S = g.__i == -1 ? ke : b[g.__i] || ke, g.__i = d, A = gt(t, g, S, l, s, u, c, E, p, _), y = g.__e, g.ref && S.ref != g.ref && (S.ref && vt(S.ref, null, g), _.push(g.ref, g.__c || y, g)), C == null && y != null && (C = y), (I = !!(4 & g.__u)) || S.__k === g.__k ? E = li(g, E, t, I) : typeof g.type == "function" && A !== void 0 ? E = A : y && (E = y.nextSibling), g.__u &= -7);
50
+ return n.__e = C, E;
51
51
  }
52
- function un(t, e, n, o, u) {
53
- var a, c, l, m, p, _ = n.length, d = _, S = 0;
54
- for (t.__k = new Array(u), a = 0; a < u; a++) (c = e[a]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[a] = xe(null, c, null, null, null) : it(c) ? c = t.__k[a] = xe(_e, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[a] = xe(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[a] = c, m = a + S, c.__ = t, c.__b = t.__b + 1, l = null, (p = c.__i = dn(c, n, m, d)) != -1 && (d--, (l = n[p]) && (l.__u |= 2)), l == null || l.__v == null ? (p == -1 && (u > _ ? S-- : u < _ && S++), typeof c.type != "function" && (c.__u |= 4)) : p != m && (p == m - 1 ? S-- : p == m + 1 ? S++ : (p > m ? S-- : S++, c.__u |= 4))) : t.__k[a] = null;
55
- if (d) for (a = 0; a < _; a++) (l = n[a]) != null && (2 & l.__u) == 0 && (l.__e == o && (o = be(l)), bi(l, l));
52
+ function Ji(t, e, n, o, l) {
53
+ var s, u, c, E, p, _ = n.length, d = _, S = 0;
54
+ for (t.__k = new Array(l), s = 0; s < l; s++) (u = e[s]) != null && typeof u != "boolean" && typeof u != "function" ? (typeof u == "string" || typeof u == "number" || typeof u == "bigint" || u.constructor == String ? u = t.__k[s] = Ne(null, u, null, null, null) : Je(u) ? u = t.__k[s] = Ne(fe, { children: u }, null, null, null) : u.constructor === void 0 && u.__b > 0 ? u = t.__k[s] = Ne(u.type, u.props, u.key, u.ref ? u.ref : null, u.__v) : t.__k[s] = u, E = s + S, u.__ = t, u.__b = t.__b + 1, c = null, (p = u.__i = Xi(u, n, E, d)) != -1 && (d--, (c = n[p]) && (c.__u |= 2)), c == null || c.__v == null ? (p == -1 && (l > _ ? S-- : l < _ && S++), typeof u.type != "function" && (u.__u |= 4)) : p != E && (p == E - 1 ? S-- : p == E + 1 ? S++ : (p > E ? S-- : S++, u.__u |= 4))) : t.__k[s] = null;
55
+ if (d) for (s = 0; s < _; s++) (c = n[s]) != null && (2 & c.__u) == 0 && (c.__e == o && (o = Ie(c)), di(c, c));
56
56
  return o;
57
57
  }
58
- function wi(t, e, n, o) {
59
- var u, a;
58
+ function li(t, e, n, o) {
59
+ var l, s;
60
60
  if (typeof t.type == "function") {
61
- for (u = t.__k, a = 0; u && a < u.length; a++) u[a] && (u[a].__ = t, e = wi(u[a], e, n, o));
61
+ for (l = t.__k, s = 0; l && s < l.length; s++) l[s] && (l[s].__ = t, e = li(l[s], e, n, o));
62
62
  return e;
63
63
  }
64
- t.__e != e && (o && (e && t.type && !e.parentNode && (e = be(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
64
+ t.__e != e && (o && (e && t.type && !e.parentNode && (e = Ie(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
65
65
  do
66
66
  e = e && e.nextSibling;
67
67
  while (e != null && e.nodeType == 8);
68
68
  return e;
69
69
  }
70
- function dn(t, e, n, o) {
71
- var u, a, c, l = t.key, m = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
72
- if (p === null && l == null || _ && l == p.key && m == p.type) return n;
70
+ function Xi(t, e, n, o) {
71
+ var l, s, u, c = t.key, E = t.type, p = e[n], _ = p != null && (2 & p.__u) == 0;
72
+ if (p === null && c == null || _ && c == p.key && E == p.type) return n;
73
73
  if (o > (_ ? 1 : 0)) {
74
- for (u = n - 1, a = n + 1; u >= 0 || a < e.length; ) if ((p = e[c = u >= 0 ? u-- : a++]) != null && (2 & p.__u) == 0 && l == p.key && m == p.type) return c;
74
+ for (l = n - 1, s = n + 1; l >= 0 || s < e.length; ) if ((p = e[u = l >= 0 ? l-- : s++]) != null && (2 & p.__u) == 0 && c == p.key && E == p.type) return u;
75
75
  }
76
76
  return -1;
77
77
  }
78
- function qt(t, e, n) {
79
- e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || cn.test(e) ? n : n + "px";
78
+ function Ut(t, e, n) {
79
+ e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || Ki.test(e) ? n : n + "px";
80
80
  }
81
- function Ge(t, e, n, o, u) {
82
- var a, c;
81
+ function Pe(t, e, n, o, l) {
82
+ var s, u;
83
83
  e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
84
84
  else {
85
- if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || qt(t.style, e, "");
86
- if (n) for (e in n) o && n[e] == o[e] || qt(t.style, e, n[e]);
85
+ if (typeof o == "string" && (t.style.cssText = o = ""), o) for (e in o) n && e in n || Ut(t.style, e, "");
86
+ if (n) for (e in n) o && n[e] == o[e] || Ut(t.style, e, n[e]);
87
87
  }
88
- else if (e[0] == "o" && e[1] == "n") a = e != (e = e.replace(gi, "$1")), c = e.toLowerCase(), e = c in t || e == "onFocusOut" || e == "onFocusIn" ? c.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + a] = n, n ? o ? n.u = o.u : (n.u = It, t.addEventListener(e, a ? _t : pt, a)) : t.removeEventListener(e, a ? _t : pt, a);
88
+ else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(ri, "$1")), u = e.toLowerCase(), e = u in t || e == "onFocusOut" || e == "onFocusIn" ? u.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? o ? n.u = o.u : (n.u = mt, t.addEventListener(e, s ? ct : lt, s)) : t.removeEventListener(e, s ? ct : lt, s);
89
89
  else {
90
- if (u == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
90
+ if (l == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
91
91
  else if (e != "width" && e != "height" && e != "href" && e != "list" && e != "form" && e != "tabIndex" && e != "download" && e != "rowSpan" && e != "colSpan" && e != "role" && e != "popover" && e in t) try {
92
92
  t[e] = n ?? "";
93
93
  break e;
@@ -96,405 +96,405 @@ function Ge(t, e, n, o, u) {
96
96
  typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
97
97
  }
98
98
  }
99
- function Yt(t) {
99
+ function Lt(t) {
100
100
  return function(e) {
101
101
  if (this.l) {
102
102
  var n = this.l[e.type + t];
103
- if (e.t == null) e.t = It++;
103
+ if (e.t == null) e.t = mt++;
104
104
  else if (e.t < n.u) return;
105
105
  return n(k.event ? k.event(e) : e);
106
106
  }
107
107
  };
108
108
  }
109
- function At(t, e, n, o, u, a, c, l, m, p) {
110
- var _, d, S, g, y, C, A, I, b, R, M, x, Y, ne, $, re, oe, Q = e.type;
109
+ function gt(t, e, n, o, l, s, u, c, E, p) {
110
+ var _, d, S, g, y, C, A, I, b, R, M, x, Y, te, $, ie, ne, Z = e.type;
111
111
  if (e.constructor !== void 0) return null;
112
- 128 & n.__u && (m = !!(32 & n.__u), a = [l = e.__e = n.__e]), (_ = k.__b) && _(e);
113
- e: if (typeof Q == "function") try {
114
- if (I = e.props, b = "prototype" in Q && Q.prototype.render, R = (_ = Q.contextType) && o[_.__c], M = _ ? R ? R.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Q(I, M) : (e.__c = d = new Oe(I, M), d.constructor = Q, d.render = fn), R && R.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Q.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ie({}, d.__s)), ie(d.__s, Q.getDerivedStateFromProps(I, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Q.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
112
+ 128 & n.__u && (E = !!(32 & n.__u), s = [c = e.__e = n.__e]), (_ = k.__b) && _(e);
113
+ e: if (typeof Z == "function") try {
114
+ if (I = e.props, b = "prototype" in Z && Z.prototype.render, R = (_ = Z.contextType) && o[_.__c], M = _ ? R ? R.props.value : _.__ : o, n.__c ? A = (d = e.__c = n.__c).__ = d.__E : (b ? e.__c = d = new Z(I, M) : (e.__c = d = new we(I, M), d.constructor = Z, d.render = Qi), R && R.sub(d), d.state || (d.state = {}), d.__n = o, S = d.__d = !0, d.__h = [], d._sb = []), b && d.__s == null && (d.__s = d.state), b && Z.getDerivedStateFromProps != null && (d.__s == d.state && (d.__s = ee({}, d.__s)), ee(d.__s, Z.getDerivedStateFromProps(I, d.__s))), g = d.props, y = d.state, d.__v = e, S) b && Z.getDerivedStateFromProps == null && d.componentWillMount != null && d.componentWillMount(), b && d.componentDidMount != null && d.__h.push(d.componentDidMount);
115
115
  else {
116
- if (b && Q.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, M), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, M) === !1) {
117
- for (e.__v != n.__v && (d.props = I, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(ae) {
118
- ae && (ae.__ = e);
116
+ if (b && Z.getDerivedStateFromProps == null && I !== g && d.componentWillReceiveProps != null && d.componentWillReceiveProps(I, M), e.__v == n.__v || !d.__e && d.shouldComponentUpdate != null && d.shouldComponentUpdate(I, d.__s, M) === !1) {
117
+ for (e.__v != n.__v && (d.props = I, d.state = d.__s, d.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(oe) {
118
+ oe && (oe.__ = e);
119
119
  }), x = 0; x < d._sb.length; x++) d.__h.push(d._sb[x]);
120
- d._sb = [], d.__h.length && c.push(d);
120
+ d._sb = [], d.__h.length && u.push(d);
121
121
  break e;
122
122
  }
123
123
  d.componentWillUpdate != null && d.componentWillUpdate(I, d.__s, M), b && d.componentDidUpdate != null && d.__h.push(function() {
124
124
  d.componentDidUpdate(g, y, C);
125
125
  });
126
126
  }
127
- if (d.context = M, d.props = I, d.__P = t, d.__e = !1, Y = k.__r, ne = 0, b) {
127
+ if (d.context = M, d.props = I, d.__P = t, d.__e = !1, Y = k.__r, te = 0, b) {
128
128
  for (d.state = d.__s, d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), $ = 0; $ < d._sb.length; $++) d.__h.push(d._sb[$]);
129
129
  d._sb = [];
130
130
  } else do
131
131
  d.__d = !1, Y && Y(e), _ = d.render(d.props, d.state, d.context), d.state = d.__s;
132
- while (d.__d && ++ne < 25);
133
- d.state = d.__s, d.getChildContext != null && (o = ie(ie({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, y)), re = _, _ != null && _.type === _e && _.key == null && (re = Ii(_.props.children)), l = Si(t, it(re) ? re : [re], 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
- } catch (ae) {
135
- if (e.__v = null, m || a != null) if (ae.then) {
136
- for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
137
- a[a.indexOf(l)] = null, e.__e = l;
132
+ while (d.__d && ++te < 25);
133
+ d.state = d.__s, d.getChildContext != null && (o = ee(ee({}, o), d.getChildContext())), b && !S && d.getSnapshotBeforeUpdate != null && (C = d.getSnapshotBeforeUpdate(g, y)), ie = _, _ != null && _.type === fe && _.key == null && (ie = ui(_.props.children)), c = ai(t, Je(ie) ? ie : [ie], e, n, o, l, s, u, c, E, p), d.base = e.__e, e.__u &= -161, d.__h.length && u.push(d), A && (d.__E = d.__ = null);
134
+ } catch (oe) {
135
+ if (e.__v = null, E || s != null) if (oe.then) {
136
+ for (e.__u |= E ? 160 : 128; c && c.nodeType == 8 && c.nextSibling; ) c = c.nextSibling;
137
+ s[s.indexOf(c)] = null, e.__e = c;
138
138
  } else {
139
- for (oe = a.length; oe--; ) bt(a[oe]);
140
- Et(e);
139
+ for (ne = s.length; ne--; ) Et(s[ne]);
140
+ ut(e);
141
141
  }
142
- else e.__e = n.__e, e.__k = n.__k, ae.then || Et(e);
143
- k.__e(ae, e, n);
142
+ else e.__e = n.__e, e.__k = n.__k, oe.then || ut(e);
143
+ k.__e(oe, e, n);
144
144
  }
145
- else a == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = hn(n.__e, e, n, o, u, a, c, m, p);
146
- return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : l;
145
+ else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : c = e.__e = Zi(n.__e, e, n, o, l, s, u, E, p);
146
+ return (_ = k.diffed) && _(e), 128 & e.__u ? void 0 : c;
147
147
  }
148
- function Et(t) {
149
- t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(Et);
148
+ function ut(t) {
149
+ t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(ut);
150
150
  }
151
- function Ci(t, e, n) {
152
- for (var o = 0; o < n.length; o++) Tt(n[o], n[++o], n[++o]);
153
- k.__c && k.__c(e, t), t.some(function(u) {
151
+ function ci(t, e, n) {
152
+ for (var o = 0; o < n.length; o++) vt(n[o], n[++o], n[++o]);
153
+ k.__c && k.__c(e, t), t.some(function(l) {
154
154
  try {
155
- t = u.__h, u.__h = [], t.some(function(a) {
156
- a.call(u);
155
+ t = l.__h, l.__h = [], t.some(function(s) {
156
+ s.call(l);
157
157
  });
158
- } catch (a) {
159
- k.__e(a, u.__v);
158
+ } catch (s) {
159
+ k.__e(s, l.__v);
160
160
  }
161
161
  });
162
162
  }
163
- function Ii(t) {
164
- return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : it(t) ? t.map(Ii) : ie({}, t);
163
+ function ui(t) {
164
+ return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : Je(t) ? t.map(ui) : ee({}, t);
165
165
  }
166
- function hn(t, e, n, o, u, a, c, l, m) {
167
- var p, _, d, S, g, y, C, A = n.props || Me, I = e.props, b = e.type;
168
- if (b == "svg" ? u = "http://www.w3.org/2000/svg" : b == "math" ? u = "http://www.w3.org/1998/Math/MathML" : u || (u = "http://www.w3.org/1999/xhtml"), a != null) {
169
- for (p = 0; p < a.length; p++) if ((g = a[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
170
- t = g, a[p] = null;
166
+ function Zi(t, e, n, o, l, s, u, c, E) {
167
+ var p, _, d, S, g, y, C, A = n.props || ke, I = e.props, b = e.type;
168
+ if (b == "svg" ? l = "http://www.w3.org/2000/svg" : b == "math" ? l = "http://www.w3.org/1998/Math/MathML" : l || (l = "http://www.w3.org/1999/xhtml"), s != null) {
169
+ for (p = 0; p < s.length; p++) if ((g = s[p]) && "setAttribute" in g == !!b && (b ? g.localName == b : g.nodeType == 3)) {
170
+ t = g, s[p] = null;
171
171
  break;
172
172
  }
173
173
  }
174
174
  if (t == null) {
175
175
  if (b == null) return document.createTextNode(I);
176
- t = document.createElementNS(u, b, I.is && I), l && (k.__m && k.__m(e, a), l = !1), a = null;
176
+ t = document.createElementNS(l, b, I.is && I), c && (k.__m && k.__m(e, s), c = !1), s = null;
177
177
  }
178
- if (b == null) A === I || l && t.data == I || (t.data = I);
178
+ if (b == null) A === I || c && t.data == I || (t.data = I);
179
179
  else {
180
- if (a = a && Fe.call(t.childNodes), !l && a != null) for (A = {}, p = 0; p < t.attributes.length; p++) A[(g = t.attributes[p]).name] = g.value;
180
+ if (s = s && Ue.call(t.childNodes), !c && s != null) for (A = {}, p = 0; p < t.attributes.length; p++) A[(g = t.attributes[p]).name] = g.value;
181
181
  for (p in A) if (g = A[p], p != "children") {
182
182
  if (p == "dangerouslySetInnerHTML") d = g;
183
183
  else if (!(p in I)) {
184
184
  if (p == "value" && "defaultValue" in I || p == "checked" && "defaultChecked" in I) continue;
185
- Ge(t, p, null, g, u);
185
+ Pe(t, p, null, g, l);
186
186
  }
187
187
  }
188
- for (p in I) g = I[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? C = g : l && typeof g != "function" || A[p] === g || Ge(t, p, g, A[p], u);
189
- if (_) l || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
190
- else if (d && (t.innerHTML = ""), Si(e.type == "template" ? t.content : t, it(S) ? S : [S], e, n, o, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : u, a, c, a ? a[0] : n.__k && be(n, 0), l, m), a != null) for (p = a.length; p--; ) bt(a[p]);
191
- l || (p = "value", b == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || b == "progress" && !y || b == "option" && y != A[p]) && Ge(t, p, y, A[p], u), p = "checked", C != null && C != t[p] && Ge(t, p, C, A[p], u));
188
+ for (p in I) g = I[p], p == "children" ? S = g : p == "dangerouslySetInnerHTML" ? _ = g : p == "value" ? y = g : p == "checked" ? C = g : c && typeof g != "function" || A[p] === g || Pe(t, p, g, A[p], l);
189
+ if (_) c || d && (_.__html == d.__html || _.__html == t.innerHTML) || (t.innerHTML = _.__html), e.__k = [];
190
+ else if (d && (t.innerHTML = ""), ai(e.type == "template" ? t.content : t, Je(S) ? S : [S], e, n, o, b == "foreignObject" ? "http://www.w3.org/1999/xhtml" : l, s, u, s ? s[0] : n.__k && Ie(n, 0), c, E), s != null) for (p = s.length; p--; ) Et(s[p]);
191
+ c || (p = "value", b == "progress" && y == null ? t.removeAttribute("value") : y != null && (y !== t[p] || b == "progress" && !y || b == "option" && y != A[p]) && Pe(t, p, y, A[p], l), p = "checked", C != null && C != t[p] && Pe(t, p, C, A[p], l));
192
192
  }
193
193
  return t;
194
194
  }
195
- function Tt(t, e, n) {
195
+ function vt(t, e, n) {
196
196
  try {
197
197
  if (typeof t == "function") {
198
198
  var o = typeof t.__u == "function";
199
199
  o && t.__u(), o && e == null || (t.__u = t(e));
200
200
  } else t.current = e;
201
- } catch (u) {
202
- k.__e(u, n);
201
+ } catch (l) {
202
+ k.__e(l, n);
203
203
  }
204
204
  }
205
- function bi(t, e, n) {
206
- var o, u;
207
- if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || Tt(o, null, e)), (o = t.__c) != null) {
205
+ function di(t, e, n) {
206
+ var o, l;
207
+ if (k.unmount && k.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || vt(o, null, e)), (o = t.__c) != null) {
208
208
  if (o.componentWillUnmount) try {
209
209
  o.componentWillUnmount();
210
- } catch (a) {
211
- k.__e(a, e);
210
+ } catch (s) {
211
+ k.__e(s, e);
212
212
  }
213
213
  o.base = o.__P = null;
214
214
  }
215
- if (o = t.__k) for (u = 0; u < o.length; u++) o[u] && bi(o[u], e, n || typeof t.type != "function");
216
- n || bt(t.__e), t.__c = t.__ = t.__e = void 0;
215
+ if (o = t.__k) for (l = 0; l < o.length; l++) o[l] && di(o[l], e, n || typeof t.type != "function");
216
+ n || Et(t.__e), t.__c = t.__ = t.__e = void 0;
217
217
  }
218
- function fn(t, e, n) {
218
+ function Qi(t, e, n) {
219
219
  return this.constructor(t, n);
220
220
  }
221
- function nt(t, e, n) {
222
- var o, u, a, c;
223
- e == document && (e = document.documentElement), k.__ && k.__(t, e), u = (o = typeof n == "function") ? null : n && n.__k || e.__k, a = [], c = [], At(e, t = (!o && n || e).__k = Ce(_e, null, [t]), u || Me, Me, e.namespaceURI, !o && n ? [n] : u ? null : e.firstChild ? Fe.call(e.childNodes) : null, a, !o && n ? n : u ? u.__e : e.firstChild, o, c), Ci(a, t, c);
221
+ function Xe(t, e, n) {
222
+ var o, l, s, u;
223
+ e == document && (e = document.documentElement), k.__ && k.__(t, e), l = (o = typeof n == "function") ? null : n && n.__k || e.__k, s = [], u = [], gt(e, t = (!o && n || e).__k = Se(fe, null, [t]), l || ke, ke, e.namespaceURI, !o && n ? [n] : l ? null : e.firstChild ? Ue.call(e.childNodes) : null, s, !o && n ? n : l ? l.__e : e.firstChild, o, u), ci(s, t, u);
224
224
  }
225
- function Ai(t, e) {
226
- nt(t, e, Ai);
225
+ function hi(t, e) {
226
+ Xe(t, e, hi);
227
227
  }
228
- function Ti(t, e, n) {
229
- var o, u, a, c, l = ie({}, t.props);
230
- for (a in t.type && t.type.defaultProps && (c = t.type.defaultProps), e) a == "key" ? o = e[a] : a == "ref" ? u = e[a] : l[a] = e[a] === void 0 && c != null ? c[a] : e[a];
231
- return arguments.length > 2 && (l.children = arguments.length > 3 ? Fe.call(arguments, 2) : n), xe(t.type, l, o || t.key, u || t.ref, null);
228
+ function fi(t, e, n) {
229
+ var o, l, s, u, c = ee({}, t.props);
230
+ for (s in t.type && t.type.defaultProps && (u = t.type.defaultProps), e) s == "key" ? o = e[s] : s == "ref" ? l = e[s] : c[s] = e[s] === void 0 && u != null ? u[s] : e[s];
231
+ return arguments.length > 2 && (c.children = arguments.length > 3 ? Ue.call(arguments, 2) : n), Ne(t.type, c, o || t.key, l || t.ref, null);
232
232
  }
233
- Fe = vi.slice, k = { __e: function(t, e, n, o) {
234
- for (var u, a, c; e = e.__; ) if ((u = e.__c) && !u.__) try {
235
- if ((a = u.constructor) && a.getDerivedStateFromError != null && (u.setState(a.getDerivedStateFromError(t)), c = u.__d), u.componentDidCatch != null && (u.componentDidCatch(t, o || {}), c = u.__d), c) return u.__E = u;
236
- } catch (l) {
237
- t = l;
233
+ Ue = oi.slice, k = { __e: function(t, e, n, o) {
234
+ for (var l, s, u; e = e.__; ) if ((l = e.__c) && !l.__) try {
235
+ if ((s = l.constructor) && s.getDerivedStateFromError != null && (l.setState(s.getDerivedStateFromError(t)), u = l.__d), l.componentDidCatch != null && (l.componentDidCatch(t, o || {}), u = l.__d), u) return l.__E = l;
236
+ } catch (c) {
237
+ t = c;
238
238
  }
239
239
  throw t;
240
- } }, pi = 0, _i = function(t) {
240
+ } }, ei = 0, ti = function(t) {
241
241
  return t != null && t.constructor === void 0;
242
- }, Oe.prototype.setState = function(t, e) {
242
+ }, we.prototype.setState = function(t, e) {
243
243
  var n;
244
- n = this.__s != null && this.__s != this.state ? this.__s : this.__s = ie({}, this.state), typeof t == "function" && (t = t(ie({}, n), this.props)), t && ie(n, t), t != null && this.__v && (e && this._sb.push(e), zt(this));
245
- }, Oe.prototype.forceUpdate = function(t) {
246
- this.__v && (this.__e = !0, t && this.__h.push(t), zt(this));
247
- }, Oe.prototype.render = _e, Ee = [], Ei = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, mi = function(t, e) {
244
+ n = this.__s != null && this.__s != this.state ? this.__s : this.__s = ee({}, this.state), typeof t == "function" && (t = t(ee({}, n), this.props)), t && ee(n, t), t != null && this.__v && (e && this._sb.push(e), Mt(this));
245
+ }, we.prototype.forceUpdate = function(t) {
246
+ this.__v && (this.__e = !0, t && this.__h.push(t), Mt(this));
247
+ }, we.prototype.render = fe, pe = [], ii = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, ni = function(t, e) {
248
248
  return t.__v.__b - e.__v.__b;
249
- }, Ke.__r = 0, gi = /(PointerCapture)$|Capture$/i, It = 0, pt = Yt(!1), _t = Yt(!0);
250
- function Je() {
251
- return Je = Object.assign ? Object.assign.bind() : function(t) {
249
+ }, He.__r = 0, ri = /(PointerCapture)$|Capture$/i, mt = 0, lt = Lt(!1), ct = Lt(!0);
250
+ function We() {
251
+ return We = Object.assign ? Object.assign.bind() : function(t) {
252
252
  for (var e = 1; e < arguments.length; e++) {
253
253
  var n = arguments[e];
254
254
  for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
255
255
  }
256
256
  return t;
257
- }, Je.apply(this, arguments);
257
+ }, We.apply(this, arguments);
258
258
  }
259
- function Ri(t, e) {
259
+ function pi(t, e) {
260
260
  if (t == null) return {};
261
- var n, o, u = {}, a = Object.keys(t);
262
- for (o = 0; o < a.length; o++) e.indexOf(n = a[o]) >= 0 || (u[n] = t[n]);
263
- return u;
264
- }
265
- var pn = ["context", "children"], _n = ["useFragment"];
266
- function En(t, e, n, o) {
267
- function u() {
268
- var a, c = Reflect.construct(HTMLElement, [], u);
269
- return c._vdomComponent = t, o && o.shadow ? (c._root = c.attachShadow({ mode: o.mode || "open", serializable: (a = o.serializable) != null && a }), o.adoptedStyleSheets && (c._root.adoptedStyleSheets = o.adoptedStyleSheets)) : c._root = c, c;
270
- }
271
- return (u.prototype = Object.create(HTMLElement.prototype)).constructor = u, u.prototype.connectedCallback = function() {
272
- gn.call(this, o);
273
- }, u.prototype.attributeChangedCallback = vn, u.prototype.disconnectedCallback = yn, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), u.observedAttributes = n, t.formAssociated && (u.formAssociated = !0), n.forEach(function(a) {
274
- Object.defineProperty(u.prototype, a, { get: function() {
275
- return this._vdom ? this._vdom.props[a] : this._props[a];
276
- }, set: function(c) {
277
- this._vdom ? this.attributeChangedCallback(a, null, c) : (this._props || (this._props = {}), this._props[a] = c);
278
- var l = typeof c;
279
- c != null && l !== "string" && l !== "boolean" && l !== "number" || this.setAttribute(a, c);
261
+ var n, o, l = {}, s = Object.keys(t);
262
+ for (o = 0; o < s.length; o++) e.indexOf(n = s[o]) >= 0 || (l[n] = t[n]);
263
+ return l;
264
+ }
265
+ var en = ["context", "children"], tn = ["useFragment"];
266
+ function nn(t, e, n, o) {
267
+ function l() {
268
+ var s, u = Reflect.construct(HTMLElement, [], l);
269
+ return u._vdomComponent = t, o && o.shadow ? (u._root = u.attachShadow({ mode: o.mode || "open", serializable: (s = o.serializable) != null && s }), o.adoptedStyleSheets && (u._root.adoptedStyleSheets = o.adoptedStyleSheets)) : u._root = u, u;
270
+ }
271
+ return (l.prototype = Object.create(HTMLElement.prototype)).constructor = l, l.prototype.connectedCallback = function() {
272
+ on.call(this, o);
273
+ }, l.prototype.attributeChangedCallback = sn, l.prototype.disconnectedCallback = an, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), l.observedAttributes = n, t.formAssociated && (l.formAssociated = !0), n.forEach(function(s) {
274
+ Object.defineProperty(l.prototype, s, { get: function() {
275
+ return this._vdom ? this._vdom.props[s] : this._props[s];
276
+ }, set: function(u) {
277
+ this._vdom ? this.attributeChangedCallback(s, null, u) : (this._props || (this._props = {}), this._props[s] = u);
278
+ var c = typeof u;
279
+ u != null && c !== "string" && c !== "boolean" && c !== "number" || this.setAttribute(s, u);
280
280
  } });
281
- }), customElements.define(e || t.tagName || t.displayName || t.name, u), u;
281
+ }), customElements.define(e || t.tagName || t.displayName || t.name, l), l;
282
282
  }
283
- function mn(t) {
283
+ function rn(t) {
284
284
  this.getChildContext = function() {
285
285
  return t.context;
286
286
  };
287
- var e = t.children, n = Ri(t, pn);
288
- return Ti(e, n);
287
+ var e = t.children, n = pi(t, en);
288
+ return fi(e, n);
289
289
  }
290
- function gn(t) {
290
+ function on(t) {
291
291
  var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
292
- this.dispatchEvent(e), this._vdom = Ce(mn, Je({}, this._props, { context: e.detail.context }), xi(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? Ai : nt)(this._vdom, this._root);
292
+ this.dispatchEvent(e), this._vdom = Se(rn, We({}, this._props, { context: e.detail.context }), mi(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? hi : Xe)(this._vdom, this._root);
293
293
  }
294
- function Ni(t) {
294
+ function _i(t) {
295
295
  return t.replace(/-(\w)/g, function(e, n) {
296
296
  return n ? n.toUpperCase() : "";
297
297
  });
298
298
  }
299
- function vn(t, e, n) {
299
+ function sn(t, e, n) {
300
300
  if (this._vdom) {
301
301
  var o = {};
302
- o[t] = n = n ?? void 0, o[Ni(t)] = n, this._vdom = Ti(this._vdom, o), nt(this._vdom, this._root);
302
+ o[t] = n = n ?? void 0, o[_i(t)] = n, this._vdom = fi(this._vdom, o), Xe(this._vdom, this._root);
303
303
  }
304
304
  }
305
- function yn() {
306
- nt(this._vdom = null, this._root);
305
+ function an() {
306
+ Xe(this._vdom = null, this._root);
307
307
  }
308
- function Kt(t, e) {
309
- var n = this, o = t.useFragment, u = Ri(t, _n);
310
- return Ce(o ? _e : "slot", Je({}, u, { ref: function(a) {
311
- a ? (n.ref = a, n._listener || (n._listener = function(c) {
312
- c.stopPropagation(), c.detail.context = e;
313
- }, a.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
308
+ function Bt(t, e) {
309
+ var n = this, o = t.useFragment, l = pi(t, tn);
310
+ return Se(o ? fe : "slot", We({}, l, { ref: function(s) {
311
+ s ? (n.ref = s, n._listener || (n._listener = function(u) {
312
+ u.stopPropagation(), u.detail.context = e;
313
+ }, s.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
314
314
  } }));
315
315
  }
316
- function xi(t, e, n) {
316
+ function mi(t, e, n) {
317
317
  if (t.nodeType === 3) return t.data;
318
318
  if (t.nodeType !== 1) return null;
319
- var o = [], u = {}, a = 0, c = t.attributes, l = t.childNodes;
320
- for (a = c.length; a--; ) c[a].name !== "slot" && (u[c[a].name] = c[a].value, u[Ni(c[a].name)] = c[a].value);
321
- for (a = l.length; a--; ) {
322
- var m = xi(l[a], null, n), p = l[a].slot;
323
- p ? u[p] = Ce(Kt, { name: p }, m) : o[a] = m;
319
+ var o = [], l = {}, s = 0, u = t.attributes, c = t.childNodes;
320
+ for (s = u.length; s--; ) u[s].name !== "slot" && (l[u[s].name] = u[s].value, l[_i(u[s].name)] = u[s].value);
321
+ for (s = c.length; s--; ) {
322
+ var E = mi(c[s], null, n), p = c[s].slot;
323
+ p ? l[p] = Se(Bt, { name: p }, E) : o[s] = E;
324
324
  }
325
- var _ = !(!n || !n.shadow), d = e ? Ce(Kt, { useFragment: !_ }, o) : o;
326
- return !_ && e && (t.innerHTML = ""), Ce(e || t.nodeName.toLowerCase(), u, d);
325
+ var _ = !(!n || !n.shadow), d = e ? Se(Bt, { useFragment: !_ }, o) : o;
326
+ return !_ && e && (t.innerHTML = ""), Se(e || t.nodeName.toLowerCase(), l, d);
327
327
  }
328
- var Sn = 0;
329
- function w(t, e, n, o, u, a) {
328
+ var ln = 0;
329
+ function w(t, e, n, o, l, s) {
330
330
  e || (e = {});
331
- var c, l, m = e;
332
- if ("ref" in m) for (l in m = {}, e) l == "ref" ? c = e[l] : m[l] = e[l];
333
- var p = { type: t, props: m, key: n, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --Sn, __i: -1, __u: 0, __source: u, __self: a };
334
- if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
331
+ var u, c, E = e;
332
+ if ("ref" in E) for (c in E = {}, e) c == "ref" ? u = e[c] : E[c] = e[c];
333
+ var p = { type: t, props: E, key: n, ref: u, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --ln, __i: -1, __u: 0, __source: l, __self: s };
334
+ if (typeof t == "function" && (u = t.defaultProps)) for (c in u) E[c] === void 0 && (E[c] = u[c]);
335
335
  return k.vnode && k.vnode(p), p;
336
336
  }
337
- var Ue, P, ct, Jt, Le = 0, Oi = [], F = k, Xt = F.__b, Zt = F.__r, Qt = F.diffed, ei = F.__c, ti = F.unmount, ii = F.__;
338
- function Rt(t, e) {
339
- F.__h && F.__h(P, t, Le || e), Le = 0;
337
+ var De, P, it, Pt, Me = 0, Ei = [], F = k, Ft = F.__b, $t = F.__r, Vt = F.diffed, Gt = F.__c, jt = F.unmount, Ht = F.__;
338
+ function yt(t, e) {
339
+ F.__h && F.__h(P, t, Me || e), Me = 0;
340
340
  var n = P.__H || (P.__H = { __: [], __h: [] });
341
341
  return t >= n.__.length && n.__.push({}), n.__[t];
342
342
  }
343
- function ze(t) {
344
- return Le = 1, wn(Di, t);
343
+ function Ve(t) {
344
+ return Me = 1, cn(vi, t);
345
345
  }
346
- function wn(t, e, n) {
347
- var o = Rt(Ue++, 2);
348
- if (o.t = t, !o.__c && (o.__ = [Di(void 0, e), function(l) {
349
- var m = o.__N ? o.__N[0] : o.__[0], p = o.t(m, l);
350
- m !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
346
+ function cn(t, e, n) {
347
+ var o = yt(De++, 2);
348
+ if (o.t = t, !o.__c && (o.__ = [vi(void 0, e), function(c) {
349
+ var E = o.__N ? o.__N[0] : o.__[0], p = o.t(E, c);
350
+ E !== p && (o.__N = [p, o.__[1]], o.__c.setState({}));
351
351
  }], o.__c = P, !P.__f)) {
352
- var u = function(l, m, p) {
352
+ var l = function(c, E, p) {
353
353
  if (!o.__c.__H) return !0;
354
354
  var _ = o.__c.__H.__.filter(function(S) {
355
355
  return !!S.__c;
356
356
  });
357
357
  if (_.every(function(S) {
358
358
  return !S.__N;
359
- })) return !a || a.call(this, l, m, p);
360
- var d = o.__c.props !== l;
359
+ })) return !s || s.call(this, c, E, p);
360
+ var d = o.__c.props !== c;
361
361
  return _.forEach(function(S) {
362
362
  if (S.__N) {
363
363
  var g = S.__[0];
364
364
  S.__ = S.__N, S.__N = void 0, g !== S.__[0] && (d = !0);
365
365
  }
366
- }), a && a.call(this, l, m, p) || d;
366
+ }), s && s.call(this, c, E, p) || d;
367
367
  };
368
368
  P.__f = !0;
369
- var a = P.shouldComponentUpdate, c = P.componentWillUpdate;
370
- P.componentWillUpdate = function(l, m, p) {
369
+ var s = P.shouldComponentUpdate, u = P.componentWillUpdate;
370
+ P.componentWillUpdate = function(c, E, p) {
371
371
  if (this.__e) {
372
- var _ = a;
373
- a = void 0, u(l, m, p), a = _;
372
+ var _ = s;
373
+ s = void 0, l(c, E, p), s = _;
374
374
  }
375
- c && c.call(this, l, m, p);
376
- }, P.shouldComponentUpdate = u;
375
+ u && u.call(this, c, E, p);
376
+ }, P.shouldComponentUpdate = l;
377
377
  }
378
378
  return o.__N || o.__;
379
379
  }
380
- function mt(t, e) {
381
- var n = Rt(Ue++, 3);
382
- !F.__s && ki(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
380
+ function Ge(t, e) {
381
+ var n = yt(De++, 3);
382
+ !F.__s && gi(n.__H, e) && (n.__ = t, n.u = e, P.__H.__h.push(n));
383
383
  }
384
- function gt(t) {
385
- return Le = 5, Ie(function() {
384
+ function ze(t) {
385
+ return Me = 5, Ce(function() {
386
386
  return { current: t };
387
387
  }, []);
388
388
  }
389
- function Ie(t, e) {
390
- var n = Rt(Ue++, 7);
391
- return ki(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
389
+ function Ce(t, e) {
390
+ var n = yt(De++, 7);
391
+ return gi(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
392
392
  }
393
- function je(t, e) {
394
- return Le = 8, Ie(function() {
393
+ function nt(t, e) {
394
+ return Me = 8, Ce(function() {
395
395
  return t;
396
396
  }, e);
397
397
  }
398
- function Cn() {
399
- for (var t; t = Oi.shift(); ) if (t.__P && t.__H) try {
400
- t.__H.__h.forEach(qe), t.__H.__h.forEach(vt), t.__H.__h = [];
398
+ function un() {
399
+ for (var t; t = Ei.shift(); ) if (t.__P && t.__H) try {
400
+ t.__H.__h.forEach(je), t.__H.__h.forEach(dt), t.__H.__h = [];
401
401
  } catch (e) {
402
402
  t.__H.__h = [], F.__e(e, t.__v);
403
403
  }
404
404
  }
405
405
  F.__b = function(t) {
406
- P = null, Xt && Xt(t);
406
+ P = null, Ft && Ft(t);
407
407
  }, F.__ = function(t, e) {
408
- t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ii && ii(t, e);
408
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Ht && Ht(t, e);
409
409
  }, F.__r = function(t) {
410
- Zt && Zt(t), Ue = 0;
410
+ $t && $t(t), De = 0;
411
411
  var e = (P = t.__c).__H;
412
- e && (ct === P ? (e.__h = [], P.__h = [], e.__.forEach(function(n) {
412
+ e && (it === P ? (e.__h = [], P.__h = [], e.__.forEach(function(n) {
413
413
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
414
- })) : (e.__h.forEach(qe), e.__h.forEach(vt), e.__h = [], Ue = 0)), ct = P;
414
+ })) : (e.__h.forEach(je), e.__h.forEach(dt), e.__h = [], De = 0)), it = P;
415
415
  }, F.diffed = function(t) {
416
- Qt && Qt(t);
416
+ Vt && Vt(t);
417
417
  var e = t.__c;
418
- e && e.__H && (e.__H.__h.length && (Oi.push(e) !== 1 && Jt === F.requestAnimationFrame || ((Jt = F.requestAnimationFrame) || In)(Cn)), e.__H.__.forEach(function(n) {
418
+ e && e.__H && (e.__H.__h.length && (Ei.push(e) !== 1 && Pt === F.requestAnimationFrame || ((Pt = F.requestAnimationFrame) || dn)(un)), e.__H.__.forEach(function(n) {
419
419
  n.u && (n.__H = n.u), n.u = void 0;
420
- })), ct = P = null;
420
+ })), it = P = null;
421
421
  }, F.__c = function(t, e) {
422
422
  e.some(function(n) {
423
423
  try {
424
- n.__h.forEach(qe), n.__h = n.__h.filter(function(o) {
425
- return !o.__ || vt(o);
424
+ n.__h.forEach(je), n.__h = n.__h.filter(function(o) {
425
+ return !o.__ || dt(o);
426
426
  });
427
427
  } catch (o) {
428
- e.some(function(u) {
429
- u.__h && (u.__h = []);
428
+ e.some(function(l) {
429
+ l.__h && (l.__h = []);
430
430
  }), e = [], F.__e(o, n.__v);
431
431
  }
432
- }), ei && ei(t, e);
432
+ }), Gt && Gt(t, e);
433
433
  }, F.unmount = function(t) {
434
- ti && ti(t);
434
+ jt && jt(t);
435
435
  var e, n = t.__c;
436
436
  n && n.__H && (n.__H.__.forEach(function(o) {
437
437
  try {
438
- qe(o);
439
- } catch (u) {
440
- e = u;
438
+ je(o);
439
+ } catch (l) {
440
+ e = l;
441
441
  }
442
442
  }), n.__H = void 0, e && F.__e(e, n.__v));
443
443
  };
444
- var ni = typeof requestAnimationFrame == "function";
445
- function In(t) {
444
+ var Wt = typeof requestAnimationFrame == "function";
445
+ function dn(t) {
446
446
  var e, n = function() {
447
- clearTimeout(o), ni && cancelAnimationFrame(e), setTimeout(t);
447
+ clearTimeout(o), Wt && cancelAnimationFrame(e), setTimeout(t);
448
448
  }, o = setTimeout(n, 35);
449
- ni && (e = requestAnimationFrame(n));
449
+ Wt && (e = requestAnimationFrame(n));
450
450
  }
451
- function qe(t) {
451
+ function je(t) {
452
452
  var e = P, n = t.__c;
453
453
  typeof n == "function" && (t.__c = void 0, n()), P = e;
454
454
  }
455
- function vt(t) {
455
+ function dt(t) {
456
456
  var e = P;
457
457
  t.__c = t.__(), P = e;
458
458
  }
459
- function ki(t, e) {
459
+ function gi(t, e) {
460
460
  return !t || t.length !== e.length || e.some(function(n, o) {
461
461
  return n !== t[o];
462
462
  });
463
463
  }
464
- function Di(t, e) {
464
+ function vi(t, e) {
465
465
  return typeof e == "function" ? e(t) : e;
466
466
  }
467
- var bn = /* @__PURE__ */ Symbol.for("preact-signals");
468
- function rt() {
469
- if (fe > 1)
470
- fe--;
467
+ var hn = /* @__PURE__ */ Symbol.for("preact-signals");
468
+ function Ze() {
469
+ if (de > 1)
470
+ de--;
471
471
  else {
472
- for (var t, e = !1; ke !== void 0; ) {
473
- var n = ke;
474
- for (ke = void 0, yt++; n !== void 0; ) {
472
+ for (var t, e = !1; xe !== void 0; ) {
473
+ var n = xe;
474
+ for (xe = void 0, ht++; n !== void 0; ) {
475
475
  var o = n.o;
476
- if (n.o = void 0, n.f &= -3, !(8 & n.f) && Li(n)) try {
476
+ if (n.o = void 0, n.f &= -3, !(8 & n.f) && wi(n)) try {
477
477
  n.c();
478
- } catch (u) {
479
- e || (t = u, e = !0);
478
+ } catch (l) {
479
+ e || (t = l, e = !0);
480
480
  }
481
481
  n = o;
482
482
  }
483
483
  }
484
- if (yt = 0, fe--, e) throw t;
484
+ if (ht = 0, de--, e) throw t;
485
485
  }
486
486
  }
487
- function An(t) {
488
- if (fe > 0) return t();
489
- fe++;
487
+ function fn(t) {
488
+ if (de > 0) return t();
489
+ de++;
490
490
  try {
491
491
  return t();
492
492
  } finally {
493
- rt();
493
+ Ze();
494
494
  }
495
495
  }
496
496
  var O = void 0;
497
- function Mi(t) {
497
+ function yi(t) {
498
498
  var e = O;
499
499
  O = void 0;
500
500
  try {
@@ -503,8 +503,8 @@ function Mi(t) {
503
503
  O = e;
504
504
  }
505
505
  }
506
- var ke = void 0, fe = 0, yt = 0, Xe = 0;
507
- function Ui(t) {
506
+ var xe = void 0, de = 0, ht = 0, qe = 0;
507
+ function Si(t) {
508
508
  if (O !== void 0) {
509
509
  var e = t.n;
510
510
  if (e === void 0 || e.t !== O)
@@ -516,13 +516,13 @@ function Ui(t) {
516
516
  function H(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 = bn;
519
+ H.prototype.brand = hn;
520
520
  H.prototype.h = function() {
521
521
  return !0;
522
522
  };
523
523
  H.prototype.S = function(t) {
524
524
  var e = this, n = this.t;
525
- n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : Mi(function() {
525
+ n !== t && t.e === void 0 && (t.x = n, this.t = t, n !== void 0 ? n.e = t : yi(function() {
526
526
  var o;
527
527
  (o = e.W) == null || o.call(e);
528
528
  }));
@@ -531,15 +531,15 @@ H.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;
534
- n !== void 0 && (n.x = o, t.e = void 0), o !== void 0 && (o.e = n, t.x = void 0), t === this.t && (this.t = o, o === void 0 && Mi(function() {
535
- var u;
536
- (u = e.Z) == null || u.call(e);
534
+ n !== void 0 && (n.x = o, t.e = void 0), o !== void 0 && (o.e = n, t.x = void 0), t === this.t && (this.t = o, o === void 0 && yi(function() {
535
+ var l;
536
+ (l = e.Z) == null || l.call(e);
537
537
  }));
538
538
  }
539
539
  };
540
540
  H.prototype.subscribe = function(t) {
541
541
  var e = this;
542
- return $e(function() {
542
+ return Le(function() {
543
543
  var n = e.value, o = O;
544
544
  O = void 0;
545
545
  try {
@@ -568,27 +568,27 @@ H.prototype.peek = function() {
568
568
  }
569
569
  };
570
570
  Object.defineProperty(H.prototype, "value", { get: function() {
571
- var t = Ui(this);
571
+ var t = Si(this);
572
572
  return t !== void 0 && (t.i = this.i), this.v;
573
573
  }, set: function(t) {
574
574
  if (t !== this.v) {
575
- if (yt > 100) throw new Error("Cycle detected");
576
- this.v = t, this.i++, Xe++, fe++;
575
+ if (ht > 100) throw new Error("Cycle detected");
576
+ this.v = t, this.i++, qe++, de++;
577
577
  try {
578
578
  for (var e = this.t; e !== void 0; e = e.x) e.t.N();
579
579
  } finally {
580
- rt();
580
+ Ze();
581
581
  }
582
582
  }
583
583
  } });
584
- function q(t, e) {
584
+ function z(t, e) {
585
585
  return new H(t, e);
586
586
  }
587
- function Li(t) {
587
+ function wi(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;
589
589
  return !1;
590
590
  }
591
- function Bi(t) {
591
+ function Ci(t) {
592
592
  for (var e = t.s; e !== void 0; e = e.n) {
593
593
  var n = e.S.n;
594
594
  if (n !== void 0 && (e.r = n), e.S.n = e, e.i = -1, e.n === void 0) {
@@ -597,87 +597,87 @@ function Bi(t) {
597
597
  }
598
598
  }
599
599
  }
600
- function Pi(t) {
600
+ function Ii(t) {
601
601
  for (var e = t.s, n = void 0; e !== void 0; ) {
602
602
  var o = e.p;
603
603
  e.i === -1 ? (e.S.U(e), o !== void 0 && (o.n = e.n), e.n !== void 0 && (e.n.p = o)) : n = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = o;
604
604
  }
605
605
  t.s = n;
606
606
  }
607
- function ge(t, e) {
608
- H.call(this, void 0), this.x = t, this.s = void 0, this.g = Xe - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
607
+ function me(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;
609
609
  }
610
- ge.prototype = new H();
611
- ge.prototype.h = function() {
610
+ me.prototype = new H();
611
+ me.prototype.h = function() {
612
612
  if (this.f &= -3, 1 & this.f) return !1;
613
- if ((36 & this.f) == 32 || (this.f &= -5, this.g === Xe)) return !0;
614
- if (this.g = Xe, this.f |= 1, this.i > 0 && !Li(this))
613
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === qe)) return !0;
614
+ if (this.g = qe, this.f |= 1, this.i > 0 && !wi(this))
615
615
  return this.f &= -2, !0;
616
616
  var t = O;
617
617
  try {
618
- Bi(this), O = this;
618
+ Ci(this), O = this;
619
619
  var e = this.x();
620
620
  (16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
621
621
  } catch (n) {
622
622
  this.v = n, this.f |= 16, this.i++;
623
623
  }
624
- return O = t, Pi(this), this.f &= -2, !0;
624
+ return O = t, Ii(this), this.f &= -2, !0;
625
625
  };
626
- ge.prototype.S = function(t) {
626
+ me.prototype.S = function(t) {
627
627
  if (this.t === void 0) {
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
631
  H.prototype.S.call(this, t);
632
632
  };
633
- ge.prototype.U = function(t) {
633
+ me.prototype.U = function(t) {
634
634
  if (this.t !== void 0 && (H.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
  }
638
638
  };
639
- ge.prototype.N = function() {
639
+ me.prototype.N = function() {
640
640
  if (!(2 & this.f)) {
641
641
  this.f |= 6;
642
642
  for (var t = this.t; t !== void 0; t = t.x) t.t.N();
643
643
  }
644
644
  };
645
- Object.defineProperty(ge.prototype, "value", { get: function() {
645
+ Object.defineProperty(me.prototype, "value", { get: function() {
646
646
  if (1 & this.f) throw new Error("Cycle detected");
647
- var t = Ui(this);
647
+ var t = Si(this);
648
648
  if (this.h(), t !== void 0 && (t.i = this.i), 16 & this.f) throw this.v;
649
649
  return this.v;
650
650
  } });
651
- function ri(t, e) {
652
- return new ge(t, e);
651
+ function zt(t, e) {
652
+ return new me(t, e);
653
653
  }
654
- function Fi(t) {
654
+ function bi(t) {
655
655
  var e = t.u;
656
656
  if (t.u = void 0, typeof e == "function") {
657
- fe++;
657
+ de++;
658
658
  var n = O;
659
659
  O = void 0;
660
660
  try {
661
661
  e();
662
662
  } catch (o) {
663
- throw t.f &= -2, t.f |= 8, Nt(t), o;
663
+ throw t.f &= -2, t.f |= 8, St(t), o;
664
664
  } finally {
665
- O = n, rt();
665
+ O = n, Ze();
666
666
  }
667
667
  }
668
668
  }
669
- function Nt(t) {
669
+ function St(t) {
670
670
  for (var e = t.s; e !== void 0; e = e.n) e.S.U(e);
671
- t.x = void 0, t.s = void 0, Fi(t);
671
+ t.x = void 0, t.s = void 0, bi(t);
672
672
  }
673
- function Tn(t) {
673
+ function pn(t) {
674
674
  if (O !== this) throw new Error("Out-of-order effect");
675
- Pi(this), O = t, this.f &= -2, 8 & this.f && Nt(this), rt();
675
+ Ii(this), O = t, this.f &= -2, 8 & this.f && St(this), Ze();
676
676
  }
677
- function Ae(t, e) {
677
+ function be(t, e) {
678
678
  this.x = t, this.u = void 0, this.s = void 0, this.o = void 0, this.f = 32, this.name = e?.name;
679
679
  }
680
- Ae.prototype.c = function() {
680
+ be.prototype.c = function() {
681
681
  var t = this.S();
682
682
  try {
683
683
  if (8 & this.f || this.x === void 0) return;
@@ -687,187 +687,187 @@ Ae.prototype.c = function() {
687
687
  t();
688
688
  }
689
689
  };
690
- Ae.prototype.S = function() {
690
+ be.prototype.S = function() {
691
691
  if (1 & this.f) throw new Error("Cycle detected");
692
- this.f |= 1, this.f &= -9, Fi(this), Bi(this), fe++;
692
+ this.f |= 1, this.f &= -9, bi(this), Ci(this), de++;
693
693
  var t = O;
694
- return O = this, Tn.bind(this, t);
694
+ return O = this, pn.bind(this, t);
695
695
  };
696
- Ae.prototype.N = function() {
697
- 2 & this.f || (this.f |= 2, this.o = ke, ke = this);
696
+ be.prototype.N = function() {
697
+ 2 & this.f || (this.f |= 2, this.o = xe, xe = this);
698
698
  };
699
- Ae.prototype.d = function() {
700
- this.f |= 8, 1 & this.f || Nt(this);
699
+ be.prototype.d = function() {
700
+ this.f |= 8, 1 & this.f || St(this);
701
701
  };
702
- Ae.prototype.dispose = function() {
702
+ be.prototype.dispose = function() {
703
703
  this.d();
704
704
  };
705
- function $e(t, e) {
706
- var n = new Ae(t, e);
705
+ function Le(t, e) {
706
+ var n = new be(t, e);
707
707
  try {
708
708
  n.c();
709
- } catch (u) {
710
- throw n.d(), u;
709
+ } catch (l) {
710
+ throw n.d(), l;
711
711
  }
712
712
  var o = n.d.bind(n);
713
713
  return o[Symbol.dispose] = o, o;
714
714
  }
715
- var $i, ut, Rn = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Vi = [];
716
- $e(function() {
717
- $i = this.N;
715
+ var Ai, rt, _n = typeof window < "u" && !!window.__PREACT_SIGNALS_DEVTOOLS__, Ti = [];
716
+ Le(function() {
717
+ Ai = this.N;
718
718
  })();
719
- function Te(t, e) {
719
+ function Ae(t, e) {
720
720
  k[t] = e.bind(null, k[t] || function() {
721
721
  });
722
722
  }
723
- function Ze(t) {
724
- ut && ut(), ut = t && t.S();
723
+ function Ye(t) {
724
+ rt && rt(), rt = t && t.S();
725
725
  }
726
- function Gi(t) {
727
- var e = this, n = t.data, o = ji(n);
726
+ function Ri(t) {
727
+ var e = this, n = t.data, o = Ni(n);
728
728
  o.value = n;
729
- var u = Ie(function() {
730
- for (var l = e, m = e.__v; m = m.__; ) if (m.__c) {
731
- m.__c.__$f |= 4;
729
+ var l = Ce(function() {
730
+ for (var c = e, E = e.__v; E = E.__; ) if (E.__c) {
731
+ E.__c.__$f |= 4;
732
732
  break;
733
733
  }
734
- var p = ri(function() {
734
+ var p = zt(function() {
735
735
  var g = o.value.value;
736
736
  return g === 0 ? 0 : g === !0 ? "" : g || "";
737
- }), _ = ri(function() {
738
- return !Array.isArray(p.value) && !_i(p.value);
739
- }), d = $e(function() {
740
- if (this.N = Hi, _.value) {
737
+ }), _ = zt(function() {
738
+ return !Array.isArray(p.value) && !ti(p.value);
739
+ }), d = Le(function() {
740
+ if (this.N = xi, _.value) {
741
741
  var g = p.value;
742
- l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = g);
742
+ c.__v && c.__v.__e && c.__v.__e.nodeType === 3 && (c.__v.__e.data = g);
743
743
  }
744
744
  }), S = e.__$u.d;
745
745
  return e.__$u.d = function() {
746
746
  d(), S.call(this);
747
747
  }, [_, p];
748
- }, []), a = u[0], c = u[1];
749
- return a.value ? c.peek() : c.value;
748
+ }, []), s = l[0], u = l[1];
749
+ return s.value ? u.peek() : u.value;
750
750
  }
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() {
751
+ Ri.displayName = "ReactiveTextNode";
752
+ Object.defineProperties(H.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Ri }, props: { configurable: !0, get: function() {
753
753
  return { data: this };
754
754
  } }, __b: { configurable: !0, value: 1 } });
755
- Te("__b", function(t, e) {
755
+ Ae("__b", function(t, e) {
756
756
  if (typeof e.type == "string") {
757
757
  var n, o = e.props;
758
- for (var u in o) if (u !== "children") {
759
- var a = o[u];
760
- a instanceof H && (n || (e.__np = n = {}), n[u] = a, o[u] = a.peek());
758
+ for (var l in o) if (l !== "children") {
759
+ var s = o[l];
760
+ s instanceof H && (n || (e.__np = n = {}), n[l] = s, o[l] = s.peek());
761
761
  }
762
762
  }
763
763
  t(e);
764
764
  });
765
- Te("__r", function(t, e) {
766
- if (e.type !== _e) {
767
- Ze();
765
+ Ae("__r", function(t, e) {
766
+ if (e.type !== fe) {
767
+ Ye();
768
768
  var n, o = e.__c;
769
- o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(u, a) {
770
- var c;
771
- return $e(function() {
772
- c = this;
773
- }, { name: a }), c.c = u, c;
774
- })(function() {
769
+ o && (o.__$f &= -2, (n = o.__$u) === void 0 && (o.__$u = n = (function(l, s) {
775
770
  var u;
776
- Rn && ((u = n.y) == null || u.call(n)), o.__$f |= 1, o.setState({});
777
- }, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), Ze(n);
771
+ return Le(function() {
772
+ u = this;
773
+ }, { name: s }), u.c = l, u;
774
+ })(function() {
775
+ var l;
776
+ _n && ((l = n.y) == null || l.call(n)), o.__$f |= 1, o.setState({});
777
+ }, typeof e.type == "function" ? e.type.displayName || e.type.name : ""))), Ye(n);
778
778
  }
779
779
  t(e);
780
780
  });
781
- Te("__e", function(t, e, n, o) {
782
- Ze(), t(e, n, o);
781
+ Ae("__e", function(t, e, n, o) {
782
+ Ye(), t(e, n, o);
783
783
  });
784
- Te("diffed", function(t, e) {
785
- Ze();
784
+ Ae("diffed", function(t, e) {
785
+ Ye();
786
786
  var n;
787
787
  if (typeof e.type == "string" && (n = e.__e)) {
788
- var o = e.__np, u = e.props;
788
+ var o = e.__np, l = e.props;
789
789
  if (o) {
790
- var a = n.U;
791
- if (a) for (var c in a) {
792
- var l = a[c];
793
- l !== void 0 && !(c in o) && (l.d(), a[c] = void 0);
790
+ var s = n.U;
791
+ if (s) for (var u in s) {
792
+ var c = s[u];
793
+ c !== void 0 && !(u in o) && (c.d(), s[u] = void 0);
794
794
  }
795
795
  else
796
- a = {}, n.U = a;
797
- for (var m in o) {
798
- var p = a[m], _ = o[m];
799
- p === void 0 ? (p = Nn(n, m, _, u), a[m] = p) : p.o(_, u);
796
+ s = {}, n.U = s;
797
+ for (var E in o) {
798
+ var p = s[E], _ = o[E];
799
+ p === void 0 ? (p = mn(n, E, _, l), s[E] = p) : p.o(_, l);
800
800
  }
801
801
  }
802
802
  }
803
803
  t(e);
804
804
  });
805
- function Nn(t, e, n, o) {
806
- var u = e in t && t.ownerSVGElement === void 0, a = q(n);
807
- return { o: function(c, l) {
808
- a.value = c, o = l;
809
- }, d: $e(function() {
810
- this.N = Hi;
811
- var c = a.value.value;
812
- o[e] !== c && (o[e] = c, u ? t[e] = c : c != null && (c !== !1 || e[4] === "-") ? t.setAttribute(e, c) : t.removeAttribute(e));
805
+ function mn(t, e, n, o) {
806
+ var l = e in t && t.ownerSVGElement === void 0, s = z(n);
807
+ return { o: function(u, c) {
808
+ s.value = u, o = c;
809
+ }, d: Le(function() {
810
+ this.N = xi;
811
+ var u = s.value.value;
812
+ o[e] !== u && (o[e] = u, l ? t[e] = u : u != null && (u !== !1 || e[4] === "-") ? t.setAttribute(e, u) : t.removeAttribute(e));
813
813
  }) };
814
814
  }
815
- Te("unmount", function(t, e) {
815
+ Ae("unmount", function(t, e) {
816
816
  if (typeof e.type == "string") {
817
817
  var n = e.__e;
818
818
  if (n) {
819
819
  var o = n.U;
820
820
  if (o) {
821
821
  n.U = void 0;
822
- for (var u in o) {
823
- var a = o[u];
824
- a && a.d();
822
+ for (var l in o) {
823
+ var s = o[l];
824
+ s && s.d();
825
825
  }
826
826
  }
827
827
  }
828
828
  } else {
829
- var c = e.__c;
830
- if (c) {
831
- var l = c.__$u;
832
- l && (c.__$u = void 0, l.d());
829
+ var u = e.__c;
830
+ if (u) {
831
+ var c = u.__$u;
832
+ c && (u.__$u = void 0, c.d());
833
833
  }
834
834
  }
835
835
  t(e);
836
836
  });
837
- Te("__h", function(t, e, n, o) {
837
+ Ae("__h", function(t, e, n, o) {
838
838
  (o < 3 || o === 9) && (e.__$f |= 2), t(e, n, o);
839
839
  });
840
- Oe.prototype.shouldComponentUpdate = function(t, e) {
840
+ we.prototype.shouldComponentUpdate = function(t, e) {
841
841
  if (this.__R) return !0;
842
842
  var n = this.__$u, o = n && n.s !== void 0;
843
- for (var u in e) return !0;
843
+ for (var l in e) return !0;
844
844
  if (this.__f || typeof this.u == "boolean" && this.u === !0) {
845
- var a = 2 & this.__$f;
846
- if (!(o || a || 4 & this.__$f) || 1 & this.__$f) return !0;
845
+ var s = 2 & this.__$f;
846
+ if (!(o || s || 4 & this.__$f) || 1 & this.__$f) return !0;
847
847
  } else if (!(o || 4 & this.__$f) || 3 & this.__$f) return !0;
848
- for (var c in t) if (c !== "__source" && t[c] !== this.props[c]) return !0;
849
- for (var l in this.props) if (!(l in t)) return !0;
848
+ for (var u in t) if (u !== "__source" && t[u] !== this.props[u]) return !0;
849
+ for (var c in this.props) if (!(c in t)) return !0;
850
850
  return !1;
851
851
  };
852
- function ji(t, e) {
853
- return ze(function() {
854
- return q(t, e);
852
+ function Ni(t, e) {
853
+ return Ve(function() {
854
+ return z(t, e);
855
855
  })[0];
856
856
  }
857
- var xn = function(t) {
857
+ var En = function(t) {
858
858
  queueMicrotask(function() {
859
859
  queueMicrotask(t);
860
860
  });
861
861
  };
862
- function On() {
863
- An(function() {
864
- for (var t; t = Vi.shift(); ) $i.call(t);
862
+ function gn() {
863
+ fn(function() {
864
+ for (var t; t = Ti.shift(); ) Ai.call(t);
865
865
  });
866
866
  }
867
- function Hi() {
868
- Vi.push(this) === 1 && (k.requestAnimationFrame || xn)(On);
867
+ function xi() {
868
+ Ti.push(this) === 1 && (k.requestAnimationFrame || En)(gn);
869
869
  }
870
- const oi = {
870
+ const qt = {
871
871
  layout: "floating",
872
872
  initialState: "expanded",
873
873
  position: "bottom-right",
@@ -876,34 +876,46 @@ const oi = {
876
876
  showMuteButton: !0,
877
877
  removeWatermark: !1,
878
878
  callToAction: "Talk to our assistant"
879
- }, He = {
879
+ }, Fe = {
880
880
  "bottom-right": { bottom: "24px", right: "24px" },
881
881
  "bottom-left": { bottom: "24px", left: "24px" },
882
882
  "top-right": { top: "24px", right: "24px" },
883
883
  "top-left": { top: "24px", left: "24px" }
884
- };
885
- function kn(t) {
886
- if (He[t])
887
- return He[t];
884
+ }, vn = /* @__PURE__ */ new Set([
885
+ "top",
886
+ "right",
887
+ "bottom",
888
+ "left",
889
+ "margin",
890
+ "margin-top",
891
+ "margin-right",
892
+ "margin-bottom",
893
+ "margin-left"
894
+ ]);
895
+ function yn(t) {
896
+ if (Fe[t])
897
+ return Fe[t];
888
898
  const e = t.match(/^\[(.+)\]$/);
889
- if (!e) return He["bottom-right"];
899
+ if (!e) return Fe["bottom-right"];
890
900
  const n = {};
891
901
  for (const o of e[1].split(",")) {
892
- const u = o.trim(), a = u.lastIndexOf("-");
893
- if (a <= 0) continue;
894
- const c = u.slice(0, a), l = u.slice(a + 1);
895
- n[c] = /^\d+$/.test(l) ? `${l}px` : l;
896
- }
897
- return Object.keys(n).length > 0 ? n : He["bottom-right"];
898
- }
899
- var dt = {}, Ne = {}, si;
900
- function Dn() {
901
- if (si) return Ne;
902
- si = 1, Ne.byteLength = l, Ne.toByteArray = p, Ne.fromByteArray = S;
903
- for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = 0, a = o.length; u < a; ++u)
904
- t[u] = o[u], e[o.charCodeAt(u)] = u;
902
+ const l = o.trim(), s = l.lastIndexOf("-");
903
+ if (s <= 0) continue;
904
+ const u = l.slice(0, s);
905
+ if (!vn.has(u)) continue;
906
+ const c = l.slice(s + 1);
907
+ /^[\w.%-]+$/.test(c) && (n[u] = /^\d+$/.test(c) ? `${c}px` : c);
908
+ }
909
+ return Object.keys(n).length > 0 ? n : Fe["bottom-right"];
910
+ }
911
+ var ot = {}, Re = {}, Yt;
912
+ function Sn() {
913
+ if (Yt) return Re;
914
+ Yt = 1, Re.byteLength = c, Re.toByteArray = p, Re.fromByteArray = S;
915
+ for (var t = [], e = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", l = 0, s = o.length; l < s; ++l)
916
+ t[l] = o[l], e[o.charCodeAt(l)] = l;
905
917
  e[45] = 62, e[95] = 63;
906
- function c(g) {
918
+ function u(g) {
907
919
  var y = g.length;
908
920
  if (y % 4 > 0)
909
921
  throw new Error("Invalid string. Length must be a multiple of 4");
@@ -912,15 +924,15 @@ function Dn() {
912
924
  var A = C === y ? 0 : 4 - C % 4;
913
925
  return [C, A];
914
926
  }
915
- function l(g) {
916
- var y = c(g), C = y[0], A = y[1];
927
+ function c(g) {
928
+ var y = u(g), C = y[0], A = y[1];
917
929
  return (C + A) * 3 / 4 - A;
918
930
  }
919
- function m(g, y, C) {
931
+ function E(g, y, C) {
920
932
  return (y + C) * 3 / 4 - C;
921
933
  }
922
934
  function p(g) {
923
- var y, C = c(g), A = C[0], I = C[1], b = new n(m(g, A, I)), R = 0, M = I > 0 ? A - 4 : A, x;
935
+ var y, C = u(g), A = C[0], I = C[1], b = new n(E(g, A, I)), R = 0, M = I > 0 ? A - 4 : A, x;
924
936
  for (x = 0; x < M; x += 4)
925
937
  y = e[g.charCodeAt(x)] << 18 | e[g.charCodeAt(x + 1)] << 12 | e[g.charCodeAt(x + 2)] << 6 | e[g.charCodeAt(x + 3)], b[R++] = y >> 16 & 255, b[R++] = y >> 8 & 255, b[R++] = y & 255;
926
938
  return I === 2 && (y = e[g.charCodeAt(x)] << 2 | e[g.charCodeAt(x + 1)] >> 4, b[R++] = y & 255), I === 1 && (y = e[g.charCodeAt(x)] << 10 | e[g.charCodeAt(x + 1)] << 4 | e[g.charCodeAt(x + 2)] >> 2, b[R++] = y >> 8 & 255, b[R++] = y & 255), b;
@@ -942,195 +954,195 @@ function Dn() {
942
954
  t[y >> 10] + t[y >> 4 & 63] + t[y << 2 & 63] + "="
943
955
  )), I.join("");
944
956
  }
945
- return Ne;
957
+ return Re;
946
958
  }
947
- var We = {};
948
- var ai;
949
- function Mn() {
950
- return ai || (ai = 1, We.read = function(t, e, n, o, u) {
951
- 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];
952
- for (d += S, a = g & (1 << -_) - 1, g >>= -_, _ += l; _ > 0; a = a * 256 + t[e + d], d += S, _ -= 8)
959
+ var $e = {};
960
+ var Kt;
961
+ function wn() {
962
+ return Kt || (Kt = 1, $e.read = function(t, e, n, o, l) {
963
+ var s, u, c = l * 8 - o - 1, E = (1 << c) - 1, p = E >> 1, _ = -7, d = n ? l - 1 : 0, S = n ? -1 : 1, g = t[e + d];
964
+ for (d += S, s = g & (1 << -_) - 1, g >>= -_, _ += c; _ > 0; s = s * 256 + t[e + d], d += S, _ -= 8)
953
965
  ;
954
- for (c = a & (1 << -_) - 1, a >>= -_, _ += o; _ > 0; c = c * 256 + t[e + d], d += S, _ -= 8)
966
+ for (u = s & (1 << -_) - 1, s >>= -_, _ += o; _ > 0; u = u * 256 + t[e + d], d += S, _ -= 8)
955
967
  ;
956
- if (a === 0)
957
- a = 1 - p;
968
+ if (s === 0)
969
+ s = 1 - p;
958
970
  else {
959
- if (a === m)
960
- return c ? NaN : (g ? -1 : 1) * (1 / 0);
961
- c = c + Math.pow(2, o), a = a - p;
962
- }
963
- return (g ? -1 : 1) * c * Math.pow(2, a - o);
964
- }, We.write = function(t, e, n, o, u, a) {
965
- var c, l, m, p = a * 8 - u - 1, _ = (1 << p) - 1, d = _ >> 1, S = u === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : a - 1, y = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
966
- for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = _) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + d >= 1 ? e += S / m : e += S * Math.pow(2, 1 - d), e * m >= 2 && (c++, m /= 2), c + d >= _ ? (l = 0, c = _) : c + d >= 1 ? (l = (e * m - 1) * Math.pow(2, u), c = c + d) : (l = e * Math.pow(2, d - 1) * Math.pow(2, u), c = 0)); u >= 8; t[n + g] = l & 255, g += y, l /= 256, u -= 8)
971
+ if (s === E)
972
+ return u ? NaN : (g ? -1 : 1) * (1 / 0);
973
+ u = u + Math.pow(2, o), s = s - p;
974
+ }
975
+ return (g ? -1 : 1) * u * Math.pow(2, s - o);
976
+ }, $e.write = function(t, e, n, o, l, s) {
977
+ var u, c, E, p = s * 8 - l - 1, _ = (1 << p) - 1, d = _ >> 1, S = l === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, g = o ? 0 : s - 1, y = o ? 1 : -1, C = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
978
+ for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (c = isNaN(e) ? 1 : 0, u = _) : (u = Math.floor(Math.log(e) / Math.LN2), e * (E = Math.pow(2, -u)) < 1 && (u--, E *= 2), u + d >= 1 ? e += S / E : e += S * Math.pow(2, 1 - d), e * E >= 2 && (u++, E /= 2), u + d >= _ ? (c = 0, u = _) : u + d >= 1 ? (c = (e * E - 1) * Math.pow(2, l), u = u + d) : (c = e * Math.pow(2, d - 1) * Math.pow(2, l), u = 0)); l >= 8; t[n + g] = c & 255, g += y, c /= 256, l -= 8)
967
979
  ;
968
- for (c = c << u | l, p += u; p > 0; t[n + g] = c & 255, g += y, c /= 256, p -= 8)
980
+ for (u = u << l | c, p += l; p > 0; t[n + g] = u & 255, g += y, u /= 256, p -= 8)
969
981
  ;
970
982
  t[n + g - y] |= C * 128;
971
- }), We;
972
- }
973
- var li;
974
- function Un() {
975
- return li || (li = 1, (function(t) {
976
- const e = Dn(), n = Mn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
977
- t.Buffer = l, t.SlowBuffer = b, t.INSPECT_MAX_BYTES = 50;
978
- const u = 2147483647;
979
- t.kMaxLength = u, l.TYPED_ARRAY_SUPPORT = a(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
983
+ }), $e;
984
+ }
985
+ var Jt;
986
+ function Cn() {
987
+ return Jt || (Jt = 1, (function(t) {
988
+ const e = Sn(), n = wn(), o = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
989
+ t.Buffer = c, t.SlowBuffer = b, t.INSPECT_MAX_BYTES = 50;
990
+ const l = 2147483647;
991
+ t.kMaxLength = l, c.TYPED_ARRAY_SUPPORT = s(), !c.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
980
992
  "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
981
993
  );
982
- function a() {
994
+ function s() {
983
995
  try {
984
- const s = new Uint8Array(1), i = { foo: function() {
996
+ const a = new Uint8Array(1), i = { foo: function() {
985
997
  return 42;
986
998
  } };
987
- return Object.setPrototypeOf(i, Uint8Array.prototype), Object.setPrototypeOf(s, i), s.foo() === 42;
999
+ return Object.setPrototypeOf(i, Uint8Array.prototype), Object.setPrototypeOf(a, i), a.foo() === 42;
988
1000
  } catch {
989
1001
  return !1;
990
1002
  }
991
1003
  }
992
- Object.defineProperty(l.prototype, "parent", {
1004
+ Object.defineProperty(c.prototype, "parent", {
993
1005
  enumerable: !0,
994
1006
  get: function() {
995
- if (l.isBuffer(this))
1007
+ if (c.isBuffer(this))
996
1008
  return this.buffer;
997
1009
  }
998
- }), Object.defineProperty(l.prototype, "offset", {
1010
+ }), Object.defineProperty(c.prototype, "offset", {
999
1011
  enumerable: !0,
1000
1012
  get: function() {
1001
- if (l.isBuffer(this))
1013
+ if (c.isBuffer(this))
1002
1014
  return this.byteOffset;
1003
1015
  }
1004
1016
  });
1005
- function c(s) {
1006
- if (s > u)
1007
- throw new RangeError('The value "' + s + '" is invalid for option "size"');
1008
- const i = new Uint8Array(s);
1009
- return Object.setPrototypeOf(i, l.prototype), i;
1010
- }
1011
- function l(s, i, r) {
1012
- if (typeof s == "number") {
1017
+ function u(a) {
1018
+ if (a > l)
1019
+ throw new RangeError('The value "' + a + '" is invalid for option "size"');
1020
+ const i = new Uint8Array(a);
1021
+ return Object.setPrototypeOf(i, c.prototype), i;
1022
+ }
1023
+ function c(a, i, r) {
1024
+ if (typeof a == "number") {
1013
1025
  if (typeof i == "string")
1014
1026
  throw new TypeError(
1015
1027
  'The "string" argument must be of type string. Received type number'
1016
1028
  );
1017
- return d(s);
1029
+ return d(a);
1018
1030
  }
1019
- return m(s, i, r);
1031
+ return E(a, i, r);
1020
1032
  }
1021
- l.poolSize = 8192;
1022
- function m(s, i, r) {
1023
- if (typeof s == "string")
1024
- return S(s, i);
1025
- if (ArrayBuffer.isView(s))
1026
- return y(s);
1027
- if (s == null)
1033
+ c.poolSize = 8192;
1034
+ function E(a, i, r) {
1035
+ if (typeof a == "string")
1036
+ return S(a, i);
1037
+ if (ArrayBuffer.isView(a))
1038
+ return y(a);
1039
+ if (a == null)
1028
1040
  throw new TypeError(
1029
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
1041
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a
1030
1042
  );
1031
- if (ee(s, ArrayBuffer) || s && ee(s.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ee(s, SharedArrayBuffer) || s && ee(s.buffer, SharedArrayBuffer)))
1032
- return C(s, i, r);
1033
- if (typeof s == "number")
1043
+ if (Q(a, ArrayBuffer) || a && Q(a.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (Q(a, SharedArrayBuffer) || a && Q(a.buffer, SharedArrayBuffer)))
1044
+ return C(a, i, r);
1045
+ if (typeof a == "number")
1034
1046
  throw new TypeError(
1035
1047
  'The "value" argument must not be of type number. Received type number'
1036
1048
  );
1037
- const h = s.valueOf && s.valueOf();
1038
- if (h != null && h !== s)
1039
- return l.from(h, i, r);
1040
- const f = A(s);
1049
+ const h = a.valueOf && a.valueOf();
1050
+ if (h != null && h !== a)
1051
+ return c.from(h, i, r);
1052
+ const f = A(a);
1041
1053
  if (f) return f;
1042
- if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function")
1043
- return l.from(s[Symbol.toPrimitive]("string"), i, r);
1054
+ if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof a[Symbol.toPrimitive] == "function")
1055
+ return c.from(a[Symbol.toPrimitive]("string"), i, r);
1044
1056
  throw new TypeError(
1045
- "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s
1057
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof a
1046
1058
  );
1047
1059
  }
1048
- l.from = function(s, i, r) {
1049
- return m(s, i, r);
1050
- }, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
1051
- function p(s) {
1052
- if (typeof s != "number")
1060
+ c.from = function(a, i, r) {
1061
+ return E(a, i, r);
1062
+ }, Object.setPrototypeOf(c.prototype, Uint8Array.prototype), Object.setPrototypeOf(c, Uint8Array);
1063
+ function p(a) {
1064
+ if (typeof a != "number")
1053
1065
  throw new TypeError('"size" argument must be of type number');
1054
- if (s < 0)
1055
- throw new RangeError('The value "' + s + '" is invalid for option "size"');
1066
+ if (a < 0)
1067
+ throw new RangeError('The value "' + a + '" is invalid for option "size"');
1056
1068
  }
1057
- function _(s, i, r) {
1058
- return p(s), s <= 0 ? c(s) : i !== void 0 ? typeof r == "string" ? c(s).fill(i, r) : c(s).fill(i) : c(s);
1069
+ function _(a, i, r) {
1070
+ return p(a), a <= 0 ? u(a) : i !== void 0 ? typeof r == "string" ? u(a).fill(i, r) : u(a).fill(i) : u(a);
1059
1071
  }
1060
- l.alloc = function(s, i, r) {
1061
- return _(s, i, r);
1072
+ c.alloc = function(a, i, r) {
1073
+ return _(a, i, r);
1062
1074
  };
1063
- function d(s) {
1064
- return p(s), c(s < 0 ? 0 : I(s) | 0);
1075
+ function d(a) {
1076
+ return p(a), u(a < 0 ? 0 : I(a) | 0);
1065
1077
  }
1066
- l.allocUnsafe = function(s) {
1067
- return d(s);
1068
- }, l.allocUnsafeSlow = function(s) {
1069
- return d(s);
1078
+ c.allocUnsafe = function(a) {
1079
+ return d(a);
1080
+ }, c.allocUnsafeSlow = function(a) {
1081
+ return d(a);
1070
1082
  };
1071
- function S(s, i) {
1072
- if ((typeof i != "string" || i === "") && (i = "utf8"), !l.isEncoding(i))
1083
+ function S(a, i) {
1084
+ if ((typeof i != "string" || i === "") && (i = "utf8"), !c.isEncoding(i))
1073
1085
  throw new TypeError("Unknown encoding: " + i);
1074
- const r = R(s, i) | 0;
1075
- let h = c(r);
1076
- const f = h.write(s, i);
1086
+ const r = R(a, i) | 0;
1087
+ let h = u(r);
1088
+ const f = h.write(a, i);
1077
1089
  return f !== r && (h = h.slice(0, f)), h;
1078
1090
  }
1079
- function g(s) {
1080
- const i = s.length < 0 ? 0 : I(s.length) | 0, r = c(i);
1091
+ function g(a) {
1092
+ const i = a.length < 0 ? 0 : I(a.length) | 0, r = u(i);
1081
1093
  for (let h = 0; h < i; h += 1)
1082
- r[h] = s[h] & 255;
1094
+ r[h] = a[h] & 255;
1083
1095
  return r;
1084
1096
  }
1085
- function y(s) {
1086
- if (ee(s, Uint8Array)) {
1087
- const i = new Uint8Array(s);
1097
+ function y(a) {
1098
+ if (Q(a, Uint8Array)) {
1099
+ const i = new Uint8Array(a);
1088
1100
  return C(i.buffer, i.byteOffset, i.byteLength);
1089
1101
  }
1090
- return g(s);
1102
+ return g(a);
1091
1103
  }
1092
- function C(s, i, r) {
1093
- if (i < 0 || s.byteLength < i)
1104
+ function C(a, i, r) {
1105
+ if (i < 0 || a.byteLength < i)
1094
1106
  throw new RangeError('"offset" is outside of buffer bounds');
1095
- if (s.byteLength < i + (r || 0))
1107
+ if (a.byteLength < i + (r || 0))
1096
1108
  throw new RangeError('"length" is outside of buffer bounds');
1097
1109
  let h;
1098
- return i === void 0 && r === void 0 ? h = new Uint8Array(s) : r === void 0 ? h = new Uint8Array(s, i) : h = new Uint8Array(s, i, r), Object.setPrototypeOf(h, l.prototype), h;
1099
- }
1100
- function A(s) {
1101
- if (l.isBuffer(s)) {
1102
- const i = I(s.length) | 0, r = c(i);
1103
- return r.length === 0 || s.copy(r, 0, 0, i), r;
1104
- }
1105
- if (s.length !== void 0)
1106
- return typeof s.length != "number" || lt(s.length) ? c(0) : g(s);
1107
- if (s.type === "Buffer" && Array.isArray(s.data))
1108
- return g(s.data);
1109
- }
1110
- function I(s) {
1111
- if (s >= u)
1112
- throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + u.toString(16) + " bytes");
1113
- return s | 0;
1114
- }
1115
- function b(s) {
1116
- return +s != s && (s = 0), l.alloc(+s);
1117
- }
1118
- l.isBuffer = function(i) {
1119
- return i != null && i._isBuffer === !0 && i !== l.prototype;
1120
- }, l.compare = function(i, r) {
1121
- if (ee(i, Uint8Array) && (i = l.from(i, i.offset, i.byteLength)), ee(r, Uint8Array) && (r = l.from(r, r.offset, r.byteLength)), !l.isBuffer(i) || !l.isBuffer(r))
1110
+ return i === void 0 && r === void 0 ? h = new Uint8Array(a) : r === void 0 ? h = new Uint8Array(a, i) : h = new Uint8Array(a, i, r), Object.setPrototypeOf(h, c.prototype), h;
1111
+ }
1112
+ function A(a) {
1113
+ if (c.isBuffer(a)) {
1114
+ const i = I(a.length) | 0, r = u(i);
1115
+ return r.length === 0 || a.copy(r, 0, 0, i), r;
1116
+ }
1117
+ if (a.length !== void 0)
1118
+ return typeof a.length != "number" || tt(a.length) ? u(0) : g(a);
1119
+ if (a.type === "Buffer" && Array.isArray(a.data))
1120
+ return g(a.data);
1121
+ }
1122
+ function I(a) {
1123
+ if (a >= l)
1124
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + l.toString(16) + " bytes");
1125
+ return a | 0;
1126
+ }
1127
+ function b(a) {
1128
+ return +a != a && (a = 0), c.alloc(+a);
1129
+ }
1130
+ c.isBuffer = function(i) {
1131
+ return i != null && i._isBuffer === !0 && i !== c.prototype;
1132
+ }, c.compare = function(i, r) {
1133
+ if (Q(i, Uint8Array) && (i = c.from(i, i.offset, i.byteLength)), Q(r, Uint8Array) && (r = c.from(r, r.offset, r.byteLength)), !c.isBuffer(i) || !c.isBuffer(r))
1122
1134
  throw new TypeError(
1123
1135
  'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
1124
1136
  );
1125
1137
  if (i === r) return 0;
1126
1138
  let h = i.length, f = r.length;
1127
- for (let E = 0, v = Math.min(h, f); E < v; ++E)
1128
- if (i[E] !== r[E]) {
1129
- h = i[E], f = r[E];
1139
+ for (let m = 0, v = Math.min(h, f); m < v; ++m)
1140
+ if (i[m] !== r[m]) {
1141
+ h = i[m], f = r[m];
1130
1142
  break;
1131
1143
  }
1132
1144
  return h < f ? -1 : f < h ? 1 : 0;
1133
- }, l.isEncoding = function(i) {
1145
+ }, c.isEncoding = function(i) {
1134
1146
  switch (String(i).toLowerCase()) {
1135
1147
  case "hex":
1136
1148
  case "utf8":
@@ -1147,43 +1159,43 @@ function Un() {
1147
1159
  default:
1148
1160
  return !1;
1149
1161
  }
1150
- }, l.concat = function(i, r) {
1162
+ }, c.concat = function(i, r) {
1151
1163
  if (!Array.isArray(i))
1152
1164
  throw new TypeError('"list" argument must be an Array of Buffers');
1153
1165
  if (i.length === 0)
1154
- return l.alloc(0);
1166
+ return c.alloc(0);
1155
1167
  let h;
1156
1168
  if (r === void 0)
1157
1169
  for (r = 0, h = 0; h < i.length; ++h)
1158
1170
  r += i[h].length;
1159
- const f = l.allocUnsafe(r);
1160
- let E = 0;
1171
+ const f = c.allocUnsafe(r);
1172
+ let m = 0;
1161
1173
  for (h = 0; h < i.length; ++h) {
1162
1174
  let v = i[h];
1163
- if (ee(v, Uint8Array))
1164
- E + v.length > f.length ? (l.isBuffer(v) || (v = l.from(v)), v.copy(f, E)) : Uint8Array.prototype.set.call(
1175
+ if (Q(v, Uint8Array))
1176
+ m + v.length > f.length ? (c.isBuffer(v) || (v = c.from(v)), v.copy(f, m)) : Uint8Array.prototype.set.call(
1165
1177
  f,
1166
1178
  v,
1167
- E
1179
+ m
1168
1180
  );
1169
- else if (l.isBuffer(v))
1170
- v.copy(f, E);
1181
+ else if (c.isBuffer(v))
1182
+ v.copy(f, m);
1171
1183
  else
1172
1184
  throw new TypeError('"list" argument must be an Array of Buffers');
1173
- E += v.length;
1185
+ m += v.length;
1174
1186
  }
1175
1187
  return f;
1176
1188
  };
1177
- function R(s, i) {
1178
- if (l.isBuffer(s))
1179
- return s.length;
1180
- if (ArrayBuffer.isView(s) || ee(s, ArrayBuffer))
1181
- return s.byteLength;
1182
- if (typeof s != "string")
1189
+ function R(a, i) {
1190
+ if (c.isBuffer(a))
1191
+ return a.length;
1192
+ if (ArrayBuffer.isView(a) || Q(a, ArrayBuffer))
1193
+ return a.byteLength;
1194
+ if (typeof a != "string")
1183
1195
  throw new TypeError(
1184
- 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof s
1196
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof a
1185
1197
  );
1186
- const r = s.length, h = arguments.length > 2 && arguments[2] === !0;
1198
+ const r = a.length, h = arguments.length > 2 && arguments[2] === !0;
1187
1199
  if (!h && r === 0) return 0;
1188
1200
  let f = !1;
1189
1201
  for (; ; )
@@ -1194,7 +1206,7 @@ function Un() {
1194
1206
  return r;
1195
1207
  case "utf8":
1196
1208
  case "utf-8":
1197
- return at(s).length;
1209
+ return et(a).length;
1198
1210
  case "ucs2":
1199
1211
  case "ucs-2":
1200
1212
  case "utf16le":
@@ -1203,94 +1215,94 @@ function Un() {
1203
1215
  case "hex":
1204
1216
  return r >>> 1;
1205
1217
  case "base64":
1206
- return Ht(s).length;
1218
+ return kt(a).length;
1207
1219
  default:
1208
1220
  if (f)
1209
- return h ? -1 : at(s).length;
1221
+ return h ? -1 : et(a).length;
1210
1222
  i = ("" + i).toLowerCase(), f = !0;
1211
1223
  }
1212
1224
  }
1213
- l.byteLength = R;
1214
- function M(s, i, r) {
1225
+ c.byteLength = R;
1226
+ function M(a, i, r) {
1215
1227
  let h = !1;
1216
1228
  if ((i === void 0 || i < 0) && (i = 0), i > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, i >>>= 0, r <= i))
1217
1229
  return "";
1218
- for (s || (s = "utf8"); ; )
1219
- switch (s) {
1230
+ for (a || (a = "utf8"); ; )
1231
+ switch (a) {
1220
1232
  case "hex":
1221
- return Qi(this, i, r);
1233
+ return $i(this, i, r);
1222
1234
  case "utf8":
1223
1235
  case "utf-8":
1224
- return Ut(this, i, r);
1236
+ return Ct(this, i, r);
1225
1237
  case "ascii":
1226
- return Xi(this, i, r);
1238
+ return Pi(this, i, r);
1227
1239
  case "latin1":
1228
1240
  case "binary":
1229
- return Zi(this, i, r);
1241
+ return Fi(this, i, r);
1230
1242
  case "base64":
1231
- return Ki(this, i, r);
1243
+ return Li(this, i, r);
1232
1244
  case "ucs2":
1233
1245
  case "ucs-2":
1234
1246
  case "utf16le":
1235
1247
  case "utf-16le":
1236
- return en(this, i, r);
1248
+ return Vi(this, i, r);
1237
1249
  default:
1238
- if (h) throw new TypeError("Unknown encoding: " + s);
1239
- s = (s + "").toLowerCase(), h = !0;
1250
+ if (h) throw new TypeError("Unknown encoding: " + a);
1251
+ a = (a + "").toLowerCase(), h = !0;
1240
1252
  }
1241
1253
  }
1242
- l.prototype._isBuffer = !0;
1243
- function x(s, i, r) {
1244
- const h = s[i];
1245
- s[i] = s[r], s[r] = h;
1254
+ c.prototype._isBuffer = !0;
1255
+ function x(a, i, r) {
1256
+ const h = a[i];
1257
+ a[i] = a[r], a[r] = h;
1246
1258
  }
1247
- l.prototype.swap16 = function() {
1259
+ c.prototype.swap16 = function() {
1248
1260
  const i = this.length;
1249
1261
  if (i % 2 !== 0)
1250
1262
  throw new RangeError("Buffer size must be a multiple of 16-bits");
1251
1263
  for (let r = 0; r < i; r += 2)
1252
1264
  x(this, r, r + 1);
1253
1265
  return this;
1254
- }, l.prototype.swap32 = function() {
1266
+ }, c.prototype.swap32 = function() {
1255
1267
  const i = this.length;
1256
1268
  if (i % 4 !== 0)
1257
1269
  throw new RangeError("Buffer size must be a multiple of 32-bits");
1258
1270
  for (let r = 0; r < i; r += 4)
1259
1271
  x(this, r, r + 3), x(this, r + 1, r + 2);
1260
1272
  return this;
1261
- }, l.prototype.swap64 = function() {
1273
+ }, c.prototype.swap64 = function() {
1262
1274
  const i = this.length;
1263
1275
  if (i % 8 !== 0)
1264
1276
  throw new RangeError("Buffer size must be a multiple of 64-bits");
1265
1277
  for (let r = 0; r < i; r += 8)
1266
1278
  x(this, r, r + 7), x(this, r + 1, r + 6), x(this, r + 2, r + 5), x(this, r + 3, r + 4);
1267
1279
  return this;
1268
- }, l.prototype.toString = function() {
1280
+ }, c.prototype.toString = function() {
1269
1281
  const i = this.length;
1270
- return i === 0 ? "" : arguments.length === 0 ? Ut(this, 0, i) : M.apply(this, arguments);
1271
- }, l.prototype.toLocaleString = l.prototype.toString, l.prototype.equals = function(i) {
1272
- if (!l.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
1273
- return this === i ? !0 : l.compare(this, i) === 0;
1274
- }, l.prototype.inspect = function() {
1282
+ return i === 0 ? "" : arguments.length === 0 ? Ct(this, 0, i) : M.apply(this, arguments);
1283
+ }, c.prototype.toLocaleString = c.prototype.toString, c.prototype.equals = function(i) {
1284
+ if (!c.isBuffer(i)) throw new TypeError("Argument must be a Buffer");
1285
+ return this === i ? !0 : c.compare(this, i) === 0;
1286
+ }, c.prototype.inspect = function() {
1275
1287
  let i = "";
1276
1288
  const r = t.INSPECT_MAX_BYTES;
1277
1289
  return i = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (i += " ... "), "<Buffer " + i + ">";
1278
- }, o && (l.prototype[o] = l.prototype.inspect), l.prototype.compare = function(i, r, h, f, E) {
1279
- if (ee(i, Uint8Array) && (i = l.from(i, i.offset, i.byteLength)), !l.isBuffer(i))
1290
+ }, o && (c.prototype[o] = c.prototype.inspect), c.prototype.compare = function(i, r, h, f, m) {
1291
+ if (Q(i, Uint8Array) && (i = c.from(i, i.offset, i.byteLength)), !c.isBuffer(i))
1280
1292
  throw new TypeError(
1281
1293
  'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof i
1282
1294
  );
1283
- if (r === void 0 && (r = 0), h === void 0 && (h = i ? i.length : 0), f === void 0 && (f = 0), E === void 0 && (E = this.length), r < 0 || h > i.length || f < 0 || E > this.length)
1295
+ if (r === void 0 && (r = 0), h === void 0 && (h = i ? i.length : 0), f === void 0 && (f = 0), m === void 0 && (m = this.length), r < 0 || h > i.length || f < 0 || m > this.length)
1284
1296
  throw new RangeError("out of range index");
1285
- if (f >= E && r >= h)
1297
+ if (f >= m && r >= h)
1286
1298
  return 0;
1287
- if (f >= E)
1299
+ if (f >= m)
1288
1300
  return -1;
1289
1301
  if (r >= h)
1290
1302
  return 1;
1291
- if (r >>>= 0, h >>>= 0, f >>>= 0, E >>>= 0, this === i) return 0;
1292
- let v = E - f, T = h - r;
1293
- const L = Math.min(v, T), U = this.slice(f, E), B = i.slice(r, h);
1303
+ if (r >>>= 0, h >>>= 0, f >>>= 0, m >>>= 0, this === i) return 0;
1304
+ let v = m - f, T = h - r;
1305
+ const L = Math.min(v, T), U = this.slice(f, m), B = i.slice(r, h);
1294
1306
  for (let D = 0; D < L; ++D)
1295
1307
  if (U[D] !== B[D]) {
1296
1308
  v = U[D], T = B[D];
@@ -1298,43 +1310,43 @@ function Un() {
1298
1310
  }
1299
1311
  return v < T ? -1 : T < v ? 1 : 0;
1300
1312
  };
1301
- function Y(s, i, r, h, f) {
1302
- if (s.length === 0) return -1;
1303
- if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, lt(r) && (r = f ? 0 : s.length - 1), r < 0 && (r = s.length + r), r >= s.length) {
1313
+ function Y(a, i, r, h, f) {
1314
+ if (a.length === 0) return -1;
1315
+ if (typeof r == "string" ? (h = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, tt(r) && (r = f ? 0 : a.length - 1), r < 0 && (r = a.length + r), r >= a.length) {
1304
1316
  if (f) return -1;
1305
- r = s.length - 1;
1317
+ r = a.length - 1;
1306
1318
  } else if (r < 0)
1307
1319
  if (f) r = 0;
1308
1320
  else return -1;
1309
- if (typeof i == "string" && (i = l.from(i, h)), l.isBuffer(i))
1310
- return i.length === 0 ? -1 : ne(s, i, r, h, f);
1321
+ if (typeof i == "string" && (i = c.from(i, h)), c.isBuffer(i))
1322
+ return i.length === 0 ? -1 : te(a, i, r, h, f);
1311
1323
  if (typeof i == "number")
1312
- return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(s, i, r) : Uint8Array.prototype.lastIndexOf.call(s, i, r) : ne(s, [i], r, h, f);
1324
+ return i = i & 255, typeof Uint8Array.prototype.indexOf == "function" ? f ? Uint8Array.prototype.indexOf.call(a, i, r) : Uint8Array.prototype.lastIndexOf.call(a, i, r) : te(a, [i], r, h, f);
1313
1325
  throw new TypeError("val must be string, number or Buffer");
1314
1326
  }
1315
- function ne(s, i, r, h, f) {
1316
- let E = 1, v = s.length, T = i.length;
1327
+ function te(a, i, r, h, f) {
1328
+ let m = 1, v = a.length, T = i.length;
1317
1329
  if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
1318
- if (s.length < 2 || i.length < 2)
1330
+ if (a.length < 2 || i.length < 2)
1319
1331
  return -1;
1320
- E = 2, v /= 2, T /= 2, r /= 2;
1332
+ m = 2, v /= 2, T /= 2, r /= 2;
1321
1333
  }
1322
1334
  function L(B, D) {
1323
- return E === 1 ? B[D] : B.readUInt16BE(D * E);
1335
+ return m === 1 ? B[D] : B.readUInt16BE(D * m);
1324
1336
  }
1325
1337
  let U;
1326
1338
  if (f) {
1327
1339
  let B = -1;
1328
1340
  for (U = r; U < v; U++)
1329
- if (L(s, U) === L(i, B === -1 ? 0 : U - B)) {
1330
- if (B === -1 && (B = U), U - B + 1 === T) return B * E;
1341
+ if (L(a, U) === L(i, B === -1 ? 0 : U - B)) {
1342
+ if (B === -1 && (B = U), U - B + 1 === T) return B * m;
1331
1343
  } else
1332
1344
  B !== -1 && (U -= U - B), B = -1;
1333
1345
  } else
1334
1346
  for (r + T > v && (r = v - T), U = r; U >= 0; U--) {
1335
1347
  let B = !0;
1336
1348
  for (let D = 0; D < T; D++)
1337
- if (L(s, U + D) !== L(i, D)) {
1349
+ if (L(a, U + D) !== L(i, D)) {
1338
1350
  B = !1;
1339
1351
  break;
1340
1352
  }
@@ -1342,40 +1354,40 @@ function Un() {
1342
1354
  }
1343
1355
  return -1;
1344
1356
  }
1345
- l.prototype.includes = function(i, r, h) {
1357
+ c.prototype.includes = function(i, r, h) {
1346
1358
  return this.indexOf(i, r, h) !== -1;
1347
- }, l.prototype.indexOf = function(i, r, h) {
1359
+ }, c.prototype.indexOf = function(i, r, h) {
1348
1360
  return Y(this, i, r, h, !0);
1349
- }, l.prototype.lastIndexOf = function(i, r, h) {
1361
+ }, c.prototype.lastIndexOf = function(i, r, h) {
1350
1362
  return Y(this, i, r, h, !1);
1351
1363
  };
1352
- function $(s, i, r, h) {
1364
+ function $(a, i, r, h) {
1353
1365
  r = Number(r) || 0;
1354
- const f = s.length - r;
1366
+ const f = a.length - r;
1355
1367
  h ? (h = Number(h), h > f && (h = f)) : h = f;
1356
- const E = i.length;
1357
- h > E / 2 && (h = E / 2);
1368
+ const m = i.length;
1369
+ h > m / 2 && (h = m / 2);
1358
1370
  let v;
1359
1371
  for (v = 0; v < h; ++v) {
1360
1372
  const T = parseInt(i.substr(v * 2, 2), 16);
1361
- if (lt(T)) return v;
1362
- s[r + v] = T;
1373
+ if (tt(T)) return v;
1374
+ a[r + v] = T;
1363
1375
  }
1364
1376
  return v;
1365
1377
  }
1366
- function re(s, i, r, h) {
1367
- return Ve(at(i, s.length - r), s, r, h);
1378
+ function ie(a, i, r, h) {
1379
+ return Be(et(i, a.length - r), a, r, h);
1368
1380
  }
1369
- function oe(s, i, r, h) {
1370
- return Ve(on(i), s, r, h);
1381
+ function ne(a, i, r, h) {
1382
+ return Be(Wi(i), a, r, h);
1371
1383
  }
1372
- function Q(s, i, r, h) {
1373
- return Ve(Ht(i), s, r, h);
1384
+ function Z(a, i, r, h) {
1385
+ return Be(kt(i), a, r, h);
1374
1386
  }
1375
- function ae(s, i, r, h) {
1376
- return Ve(sn(i, s.length - r), s, r, h);
1387
+ function oe(a, i, r, h) {
1388
+ return Be(zi(i, a.length - r), a, r, h);
1377
1389
  }
1378
- l.prototype.write = function(i, r, h, f) {
1390
+ c.prototype.write = function(i, r, h, f) {
1379
1391
  if (r === void 0)
1380
1392
  f = "utf8", h = this.length, r = 0;
1381
1393
  else if (h === void 0 && typeof r == "string")
@@ -1386,8 +1398,8 @@ function Un() {
1386
1398
  throw new Error(
1387
1399
  "Buffer.write(string, encoding, offset[, length]) is no longer supported"
1388
1400
  );
1389
- const E = this.length - r;
1390
- if ((h === void 0 || h > E) && (h = E), i.length > 0 && (h < 0 || r < 0) || r > this.length)
1401
+ const m = this.length - r;
1402
+ if ((h === void 0 || h > m) && (h = m), i.length > 0 && (h < 0 || r < 0) || r > this.length)
1391
1403
  throw new RangeError("Attempt to write outside buffer bounds");
1392
1404
  f || (f = "utf8");
1393
1405
  let v = !1;
@@ -1397,315 +1409,315 @@ function Un() {
1397
1409
  return $(this, i, r, h);
1398
1410
  case "utf8":
1399
1411
  case "utf-8":
1400
- return re(this, i, r, h);
1412
+ return ie(this, i, r, h);
1401
1413
  case "ascii":
1402
1414
  case "latin1":
1403
1415
  case "binary":
1404
- return oe(this, i, r, h);
1416
+ return ne(this, i, r, h);
1405
1417
  case "base64":
1406
- return Q(this, i, r, h);
1418
+ return Z(this, i, r, h);
1407
1419
  case "ucs2":
1408
1420
  case "ucs-2":
1409
1421
  case "utf16le":
1410
1422
  case "utf-16le":
1411
- return ae(this, i, r, h);
1423
+ return oe(this, i, r, h);
1412
1424
  default:
1413
1425
  if (v) throw new TypeError("Unknown encoding: " + f);
1414
1426
  f = ("" + f).toLowerCase(), v = !0;
1415
1427
  }
1416
- }, l.prototype.toJSON = function() {
1428
+ }, c.prototype.toJSON = function() {
1417
1429
  return {
1418
1430
  type: "Buffer",
1419
1431
  data: Array.prototype.slice.call(this._arr || this, 0)
1420
1432
  };
1421
1433
  };
1422
- function Ki(s, i, r) {
1423
- return i === 0 && r === s.length ? e.fromByteArray(s) : e.fromByteArray(s.slice(i, r));
1434
+ function Li(a, i, r) {
1435
+ return i === 0 && r === a.length ? e.fromByteArray(a) : e.fromByteArray(a.slice(i, r));
1424
1436
  }
1425
- function Ut(s, i, r) {
1426
- r = Math.min(s.length, r);
1437
+ function Ct(a, i, r) {
1438
+ r = Math.min(a.length, r);
1427
1439
  const h = [];
1428
1440
  let f = i;
1429
1441
  for (; f < r; ) {
1430
- const E = s[f];
1431
- let v = null, T = E > 239 ? 4 : E > 223 ? 3 : E > 191 ? 2 : 1;
1442
+ const m = a[f];
1443
+ let v = null, T = m > 239 ? 4 : m > 223 ? 3 : m > 191 ? 2 : 1;
1432
1444
  if (f + T <= r) {
1433
1445
  let L, U, B, D;
1434
1446
  switch (T) {
1435
1447
  case 1:
1436
- E < 128 && (v = E);
1448
+ m < 128 && (v = m);
1437
1449
  break;
1438
1450
  case 2:
1439
- L = s[f + 1], (L & 192) === 128 && (D = (E & 31) << 6 | L & 63, D > 127 && (v = D));
1451
+ L = a[f + 1], (L & 192) === 128 && (D = (m & 31) << 6 | L & 63, D > 127 && (v = D));
1440
1452
  break;
1441
1453
  case 3:
1442
- L = s[f + 1], U = s[f + 2], (L & 192) === 128 && (U & 192) === 128 && (D = (E & 15) << 12 | (L & 63) << 6 | U & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
1454
+ L = a[f + 1], U = a[f + 2], (L & 192) === 128 && (U & 192) === 128 && (D = (m & 15) << 12 | (L & 63) << 6 | U & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
1443
1455
  break;
1444
1456
  case 4:
1445
- L = s[f + 1], U = s[f + 2], B = s[f + 3], (L & 192) === 128 && (U & 192) === 128 && (B & 192) === 128 && (D = (E & 15) << 18 | (L & 63) << 12 | (U & 63) << 6 | B & 63, D > 65535 && D < 1114112 && (v = D));
1457
+ L = a[f + 1], U = a[f + 2], B = a[f + 3], (L & 192) === 128 && (U & 192) === 128 && (B & 192) === 128 && (D = (m & 15) << 18 | (L & 63) << 12 | (U & 63) << 6 | B & 63, D > 65535 && D < 1114112 && (v = D));
1446
1458
  }
1447
1459
  }
1448
1460
  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;
1449
1461
  }
1450
- return Ji(h);
1462
+ return Bi(h);
1451
1463
  }
1452
- const Lt = 4096;
1453
- function Ji(s) {
1454
- const i = s.length;
1455
- if (i <= Lt)
1456
- return String.fromCharCode.apply(String, s);
1464
+ const It = 4096;
1465
+ function Bi(a) {
1466
+ const i = a.length;
1467
+ if (i <= It)
1468
+ return String.fromCharCode.apply(String, a);
1457
1469
  let r = "", h = 0;
1458
1470
  for (; h < i; )
1459
1471
  r += String.fromCharCode.apply(
1460
1472
  String,
1461
- s.slice(h, h += Lt)
1473
+ a.slice(h, h += It)
1462
1474
  );
1463
1475
  return r;
1464
1476
  }
1465
- function Xi(s, i, r) {
1477
+ function Pi(a, i, r) {
1466
1478
  let h = "";
1467
- r = Math.min(s.length, r);
1479
+ r = Math.min(a.length, r);
1468
1480
  for (let f = i; f < r; ++f)
1469
- h += String.fromCharCode(s[f] & 127);
1481
+ h += String.fromCharCode(a[f] & 127);
1470
1482
  return h;
1471
1483
  }
1472
- function Zi(s, i, r) {
1484
+ function Fi(a, i, r) {
1473
1485
  let h = "";
1474
- r = Math.min(s.length, r);
1486
+ r = Math.min(a.length, r);
1475
1487
  for (let f = i; f < r; ++f)
1476
- h += String.fromCharCode(s[f]);
1488
+ h += String.fromCharCode(a[f]);
1477
1489
  return h;
1478
1490
  }
1479
- function Qi(s, i, r) {
1480
- const h = s.length;
1491
+ function $i(a, i, r) {
1492
+ const h = a.length;
1481
1493
  (!i || i < 0) && (i = 0), (!r || r < 0 || r > h) && (r = h);
1482
1494
  let f = "";
1483
- for (let E = i; E < r; ++E)
1484
- f += an[s[E]];
1495
+ for (let m = i; m < r; ++m)
1496
+ f += qi[a[m]];
1485
1497
  return f;
1486
1498
  }
1487
- function en(s, i, r) {
1488
- const h = s.slice(i, r);
1499
+ function Vi(a, i, r) {
1500
+ const h = a.slice(i, r);
1489
1501
  let f = "";
1490
- for (let E = 0; E < h.length - 1; E += 2)
1491
- f += String.fromCharCode(h[E] + h[E + 1] * 256);
1502
+ for (let m = 0; m < h.length - 1; m += 2)
1503
+ f += String.fromCharCode(h[m] + h[m + 1] * 256);
1492
1504
  return f;
1493
1505
  }
1494
- l.prototype.slice = function(i, r) {
1506
+ c.prototype.slice = function(i, r) {
1495
1507
  const h = this.length;
1496
1508
  i = ~~i, r = r === void 0 ? h : ~~r, i < 0 ? (i += h, i < 0 && (i = 0)) : i > h && (i = h), r < 0 ? (r += h, r < 0 && (r = 0)) : r > h && (r = h), r < i && (r = i);
1497
1509
  const f = this.subarray(i, r);
1498
- return Object.setPrototypeOf(f, l.prototype), f;
1510
+ return Object.setPrototypeOf(f, c.prototype), f;
1499
1511
  };
1500
- function G(s, i, r) {
1501
- if (s % 1 !== 0 || s < 0) throw new RangeError("offset is not uint");
1502
- if (s + i > r) throw new RangeError("Trying to access beyond buffer length");
1512
+ function G(a, i, r) {
1513
+ if (a % 1 !== 0 || a < 0) throw new RangeError("offset is not uint");
1514
+ if (a + i > r) throw new RangeError("Trying to access beyond buffer length");
1503
1515
  }
1504
- l.prototype.readUintLE = l.prototype.readUIntLE = function(i, r, h) {
1516
+ c.prototype.readUintLE = c.prototype.readUIntLE = function(i, r, h) {
1505
1517
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1506
- let f = this[i], E = 1, v = 0;
1507
- for (; ++v < r && (E *= 256); )
1508
- f += this[i + v] * E;
1518
+ let f = this[i], m = 1, v = 0;
1519
+ for (; ++v < r && (m *= 256); )
1520
+ f += this[i + v] * m;
1509
1521
  return f;
1510
- }, l.prototype.readUintBE = l.prototype.readUIntBE = function(i, r, h) {
1522
+ }, c.prototype.readUintBE = c.prototype.readUIntBE = function(i, r, h) {
1511
1523
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1512
- let f = this[i + --r], E = 1;
1513
- for (; r > 0 && (E *= 256); )
1514
- f += this[i + --r] * E;
1524
+ let f = this[i + --r], m = 1;
1525
+ for (; r > 0 && (m *= 256); )
1526
+ f += this[i + --r] * m;
1515
1527
  return f;
1516
- }, l.prototype.readUint8 = l.prototype.readUInt8 = function(i, r) {
1528
+ }, c.prototype.readUint8 = c.prototype.readUInt8 = function(i, r) {
1517
1529
  return i = i >>> 0, r || G(i, 1, this.length), this[i];
1518
- }, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(i, r) {
1530
+ }, c.prototype.readUint16LE = c.prototype.readUInt16LE = function(i, r) {
1519
1531
  return i = i >>> 0, r || G(i, 2, this.length), this[i] | this[i + 1] << 8;
1520
- }, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(i, r) {
1532
+ }, c.prototype.readUint16BE = c.prototype.readUInt16BE = function(i, r) {
1521
1533
  return i = i >>> 0, r || G(i, 2, this.length), this[i] << 8 | this[i + 1];
1522
- }, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(i, r) {
1534
+ }, c.prototype.readUint32LE = c.prototype.readUInt32LE = function(i, r) {
1523
1535
  return i = i >>> 0, r || G(i, 4, this.length), (this[i] | this[i + 1] << 8 | this[i + 2] << 16) + this[i + 3] * 16777216;
1524
- }, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(i, r) {
1536
+ }, c.prototype.readUint32BE = c.prototype.readUInt32BE = function(i, r) {
1525
1537
  return i = i >>> 0, r || G(i, 4, this.length), this[i] * 16777216 + (this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3]);
1526
- }, l.prototype.readBigUInt64LE = le(function(i) {
1527
- i = i >>> 0, ye(i, "offset");
1538
+ }, c.prototype.readBigUInt64LE = se(function(i) {
1539
+ i = i >>> 0, ge(i, "offset");
1528
1540
  const r = this[i], h = this[i + 7];
1529
- (r === void 0 || h === void 0) && Re(i, this.length - 8);
1530
- const f = r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24, E = this[++i] + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + h * 2 ** 24;
1531
- return BigInt(f) + (BigInt(E) << BigInt(32));
1532
- }), l.prototype.readBigUInt64BE = le(function(i) {
1533
- i = i >>> 0, ye(i, "offset");
1541
+ (r === void 0 || h === void 0) && Te(i, this.length - 8);
1542
+ const f = r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24, m = this[++i] + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + h * 2 ** 24;
1543
+ return BigInt(f) + (BigInt(m) << BigInt(32));
1544
+ }), c.prototype.readBigUInt64BE = se(function(i) {
1545
+ i = i >>> 0, ge(i, "offset");
1534
1546
  const r = this[i], h = this[i + 7];
1535
- (r === void 0 || h === void 0) && Re(i, this.length - 8);
1536
- 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;
1537
- return (BigInt(f) << BigInt(32)) + BigInt(E);
1538
- }), l.prototype.readIntLE = function(i, r, h) {
1547
+ (r === void 0 || h === void 0) && Te(i, this.length - 8);
1548
+ const f = r * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i], m = this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h;
1549
+ return (BigInt(f) << BigInt(32)) + BigInt(m);
1550
+ }), c.prototype.readIntLE = function(i, r, h) {
1539
1551
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1540
- let f = this[i], E = 1, v = 0;
1541
- for (; ++v < r && (E *= 256); )
1542
- f += this[i + v] * E;
1543
- return E *= 128, f >= E && (f -= Math.pow(2, 8 * r)), f;
1544
- }, l.prototype.readIntBE = function(i, r, h) {
1552
+ let f = this[i], m = 1, v = 0;
1553
+ for (; ++v < r && (m *= 256); )
1554
+ f += this[i + v] * m;
1555
+ return m *= 128, f >= m && (f -= Math.pow(2, 8 * r)), f;
1556
+ }, c.prototype.readIntBE = function(i, r, h) {
1545
1557
  i = i >>> 0, r = r >>> 0, h || G(i, r, this.length);
1546
- let f = r, E = 1, v = this[i + --f];
1547
- for (; f > 0 && (E *= 256); )
1548
- v += this[i + --f] * E;
1549
- return E *= 128, v >= E && (v -= Math.pow(2, 8 * r)), v;
1550
- }, l.prototype.readInt8 = function(i, r) {
1558
+ let f = r, m = 1, v = this[i + --f];
1559
+ for (; f > 0 && (m *= 256); )
1560
+ v += this[i + --f] * m;
1561
+ return m *= 128, v >= m && (v -= Math.pow(2, 8 * r)), v;
1562
+ }, c.prototype.readInt8 = function(i, r) {
1551
1563
  return i = i >>> 0, r || G(i, 1, this.length), this[i] & 128 ? (255 - this[i] + 1) * -1 : this[i];
1552
- }, l.prototype.readInt16LE = function(i, r) {
1564
+ }, c.prototype.readInt16LE = function(i, r) {
1553
1565
  i = i >>> 0, r || G(i, 2, this.length);
1554
1566
  const h = this[i] | this[i + 1] << 8;
1555
1567
  return h & 32768 ? h | 4294901760 : h;
1556
- }, l.prototype.readInt16BE = function(i, r) {
1568
+ }, c.prototype.readInt16BE = function(i, r) {
1557
1569
  i = i >>> 0, r || G(i, 2, this.length);
1558
1570
  const h = this[i + 1] | this[i] << 8;
1559
1571
  return h & 32768 ? h | 4294901760 : h;
1560
- }, l.prototype.readInt32LE = function(i, r) {
1572
+ }, c.prototype.readInt32LE = function(i, r) {
1561
1573
  return i = i >>> 0, r || G(i, 4, this.length), this[i] | this[i + 1] << 8 | this[i + 2] << 16 | this[i + 3] << 24;
1562
- }, l.prototype.readInt32BE = function(i, r) {
1574
+ }, c.prototype.readInt32BE = function(i, r) {
1563
1575
  return i = i >>> 0, r || G(i, 4, this.length), this[i] << 24 | this[i + 1] << 16 | this[i + 2] << 8 | this[i + 3];
1564
- }, l.prototype.readBigInt64LE = le(function(i) {
1565
- i = i >>> 0, ye(i, "offset");
1576
+ }, c.prototype.readBigInt64LE = se(function(i) {
1577
+ i = i >>> 0, ge(i, "offset");
1566
1578
  const r = this[i], h = this[i + 7];
1567
- (r === void 0 || h === void 0) && Re(i, this.length - 8);
1579
+ (r === void 0 || h === void 0) && Te(i, this.length - 8);
1568
1580
  const f = this[i + 4] + this[i + 5] * 2 ** 8 + this[i + 6] * 2 ** 16 + (h << 24);
1569
1581
  return (BigInt(f) << BigInt(32)) + BigInt(r + this[++i] * 2 ** 8 + this[++i] * 2 ** 16 + this[++i] * 2 ** 24);
1570
- }), l.prototype.readBigInt64BE = le(function(i) {
1571
- i = i >>> 0, ye(i, "offset");
1582
+ }), c.prototype.readBigInt64BE = se(function(i) {
1583
+ i = i >>> 0, ge(i, "offset");
1572
1584
  const r = this[i], h = this[i + 7];
1573
- (r === void 0 || h === void 0) && Re(i, this.length - 8);
1585
+ (r === void 0 || h === void 0) && Te(i, this.length - 8);
1574
1586
  const f = (r << 24) + // Overflow
1575
1587
  this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + this[++i];
1576
1588
  return (BigInt(f) << BigInt(32)) + BigInt(this[++i] * 2 ** 24 + this[++i] * 2 ** 16 + this[++i] * 2 ** 8 + h);
1577
- }), l.prototype.readFloatLE = function(i, r) {
1589
+ }), c.prototype.readFloatLE = function(i, r) {
1578
1590
  return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !0, 23, 4);
1579
- }, l.prototype.readFloatBE = function(i, r) {
1591
+ }, c.prototype.readFloatBE = function(i, r) {
1580
1592
  return i = i >>> 0, r || G(i, 4, this.length), n.read(this, i, !1, 23, 4);
1581
- }, l.prototype.readDoubleLE = function(i, r) {
1593
+ }, c.prototype.readDoubleLE = function(i, r) {
1582
1594
  return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !0, 52, 8);
1583
- }, l.prototype.readDoubleBE = function(i, r) {
1595
+ }, c.prototype.readDoubleBE = function(i, r) {
1584
1596
  return i = i >>> 0, r || G(i, 8, this.length), n.read(this, i, !1, 52, 8);
1585
1597
  };
1586
- function K(s, i, r, h, f, E) {
1587
- if (!l.isBuffer(s)) throw new TypeError('"buffer" argument must be a Buffer instance');
1588
- if (i > f || i < E) throw new RangeError('"value" argument is out of bounds');
1589
- if (r + h > s.length) throw new RangeError("Index out of range");
1598
+ function K(a, i, r, h, f, m) {
1599
+ if (!c.isBuffer(a)) throw new TypeError('"buffer" argument must be a Buffer instance');
1600
+ if (i > f || i < m) throw new RangeError('"value" argument is out of bounds');
1601
+ if (r + h > a.length) throw new RangeError("Index out of range");
1590
1602
  }
1591
- l.prototype.writeUintLE = l.prototype.writeUIntLE = function(i, r, h, f) {
1603
+ c.prototype.writeUintLE = c.prototype.writeUIntLE = function(i, r, h, f) {
1592
1604
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1593
1605
  const T = Math.pow(2, 8 * h) - 1;
1594
1606
  K(this, i, r, h, T, 0);
1595
1607
  }
1596
- let E = 1, v = 0;
1597
- for (this[r] = i & 255; ++v < h && (E *= 256); )
1598
- this[r + v] = i / E & 255;
1608
+ let m = 1, v = 0;
1609
+ for (this[r] = i & 255; ++v < h && (m *= 256); )
1610
+ this[r + v] = i / m & 255;
1599
1611
  return r + h;
1600
- }, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(i, r, h, f) {
1612
+ }, c.prototype.writeUintBE = c.prototype.writeUIntBE = function(i, r, h, f) {
1601
1613
  if (i = +i, r = r >>> 0, h = h >>> 0, !f) {
1602
1614
  const T = Math.pow(2, 8 * h) - 1;
1603
1615
  K(this, i, r, h, T, 0);
1604
1616
  }
1605
- let E = h - 1, v = 1;
1606
- for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1607
- this[r + E] = i / v & 255;
1617
+ let m = h - 1, v = 1;
1618
+ for (this[r + m] = i & 255; --m >= 0 && (v *= 256); )
1619
+ this[r + m] = i / v & 255;
1608
1620
  return r + h;
1609
- }, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(i, r, h) {
1621
+ }, c.prototype.writeUint8 = c.prototype.writeUInt8 = function(i, r, h) {
1610
1622
  return i = +i, r = r >>> 0, h || K(this, i, r, 1, 255, 0), this[r] = i & 255, r + 1;
1611
- }, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(i, r, h) {
1623
+ }, c.prototype.writeUint16LE = c.prototype.writeUInt16LE = function(i, r, h) {
1612
1624
  return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1613
- }, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(i, r, h) {
1625
+ }, c.prototype.writeUint16BE = c.prototype.writeUInt16BE = function(i, r, h) {
1614
1626
  return i = +i, r = r >>> 0, h || K(this, i, r, 2, 65535, 0), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1615
- }, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(i, r, h) {
1627
+ }, c.prototype.writeUint32LE = c.prototype.writeUInt32LE = function(i, r, h) {
1616
1628
  return i = +i, r = r >>> 0, h || K(this, i, r, 4, 4294967295, 0), this[r + 3] = i >>> 24, this[r + 2] = i >>> 16, this[r + 1] = i >>> 8, this[r] = i & 255, r + 4;
1617
- }, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(i, r, h) {
1629
+ }, c.prototype.writeUint32BE = c.prototype.writeUInt32BE = function(i, r, h) {
1618
1630
  return i = +i, r = r >>> 0, h || K(this, i, r, 4, 4294967295, 0), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1619
1631
  };
1620
- function Bt(s, i, r, h, f) {
1621
- jt(i, h, f, s, r, 7);
1622
- let E = Number(i & BigInt(4294967295));
1623
- s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E, E = E >> 8, s[r++] = E;
1632
+ function bt(a, i, r, h, f) {
1633
+ Ot(i, h, f, a, r, 7);
1634
+ let m = Number(i & BigInt(4294967295));
1635
+ a[r++] = m, m = m >> 8, a[r++] = m, m = m >> 8, a[r++] = m, m = m >> 8, a[r++] = m;
1624
1636
  let v = Number(i >> BigInt(32) & BigInt(4294967295));
1625
- return s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, v = v >> 8, s[r++] = v, r;
1637
+ return a[r++] = v, v = v >> 8, a[r++] = v, v = v >> 8, a[r++] = v, v = v >> 8, a[r++] = v, r;
1626
1638
  }
1627
- function Pt(s, i, r, h, f) {
1628
- jt(i, h, f, s, r, 7);
1629
- let E = Number(i & BigInt(4294967295));
1630
- s[r + 7] = E, E = E >> 8, s[r + 6] = E, E = E >> 8, s[r + 5] = E, E = E >> 8, s[r + 4] = E;
1639
+ function At(a, i, r, h, f) {
1640
+ Ot(i, h, f, a, r, 7);
1641
+ let m = Number(i & BigInt(4294967295));
1642
+ a[r + 7] = m, m = m >> 8, a[r + 6] = m, m = m >> 8, a[r + 5] = m, m = m >> 8, a[r + 4] = m;
1631
1643
  let v = Number(i >> BigInt(32) & BigInt(4294967295));
1632
- return s[r + 3] = v, v = v >> 8, s[r + 2] = v, v = v >> 8, s[r + 1] = v, v = v >> 8, s[r] = v, r + 8;
1644
+ return a[r + 3] = v, v = v >> 8, a[r + 2] = v, v = v >> 8, a[r + 1] = v, v = v >> 8, a[r] = v, r + 8;
1633
1645
  }
1634
- l.prototype.writeBigUInt64LE = le(function(i, r = 0) {
1635
- return Bt(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
1636
- }), l.prototype.writeBigUInt64BE = le(function(i, r = 0) {
1637
- return Pt(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
1638
- }), l.prototype.writeIntLE = function(i, r, h, f) {
1646
+ c.prototype.writeBigUInt64LE = se(function(i, r = 0) {
1647
+ return bt(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
1648
+ }), c.prototype.writeBigUInt64BE = se(function(i, r = 0) {
1649
+ return At(this, i, r, BigInt(0), BigInt("0xffffffffffffffff"));
1650
+ }), c.prototype.writeIntLE = function(i, r, h, f) {
1639
1651
  if (i = +i, r = r >>> 0, !f) {
1640
1652
  const L = Math.pow(2, 8 * h - 1);
1641
1653
  K(this, i, r, h, L - 1, -L);
1642
1654
  }
1643
- let E = 0, v = 1, T = 0;
1644
- for (this[r] = i & 255; ++E < h && (v *= 256); )
1645
- i < 0 && T === 0 && this[r + E - 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1655
+ let m = 0, v = 1, T = 0;
1656
+ for (this[r] = i & 255; ++m < h && (v *= 256); )
1657
+ i < 0 && T === 0 && this[r + m - 1] !== 0 && (T = 1), this[r + m] = (i / v >> 0) - T & 255;
1646
1658
  return r + h;
1647
- }, l.prototype.writeIntBE = function(i, r, h, f) {
1659
+ }, c.prototype.writeIntBE = function(i, r, h, f) {
1648
1660
  if (i = +i, r = r >>> 0, !f) {
1649
1661
  const L = Math.pow(2, 8 * h - 1);
1650
1662
  K(this, i, r, h, L - 1, -L);
1651
1663
  }
1652
- let E = h - 1, v = 1, T = 0;
1653
- for (this[r + E] = i & 255; --E >= 0 && (v *= 256); )
1654
- i < 0 && T === 0 && this[r + E + 1] !== 0 && (T = 1), this[r + E] = (i / v >> 0) - T & 255;
1664
+ let m = h - 1, v = 1, T = 0;
1665
+ for (this[r + m] = i & 255; --m >= 0 && (v *= 256); )
1666
+ i < 0 && T === 0 && this[r + m + 1] !== 0 && (T = 1), this[r + m] = (i / v >> 0) - T & 255;
1655
1667
  return r + h;
1656
- }, l.prototype.writeInt8 = function(i, r, h) {
1668
+ }, c.prototype.writeInt8 = function(i, r, h) {
1657
1669
  return i = +i, r = r >>> 0, h || K(this, i, r, 1, 127, -128), i < 0 && (i = 255 + i + 1), this[r] = i & 255, r + 1;
1658
- }, l.prototype.writeInt16LE = function(i, r, h) {
1670
+ }, c.prototype.writeInt16LE = function(i, r, h) {
1659
1671
  return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i & 255, this[r + 1] = i >>> 8, r + 2;
1660
- }, l.prototype.writeInt16BE = function(i, r, h) {
1672
+ }, c.prototype.writeInt16BE = function(i, r, h) {
1661
1673
  return i = +i, r = r >>> 0, h || K(this, i, r, 2, 32767, -32768), this[r] = i >>> 8, this[r + 1] = i & 255, r + 2;
1662
- }, l.prototype.writeInt32LE = function(i, r, h) {
1674
+ }, c.prototype.writeInt32LE = function(i, r, h) {
1663
1675
  return i = +i, r = r >>> 0, h || K(this, i, r, 4, 2147483647, -2147483648), this[r] = i & 255, this[r + 1] = i >>> 8, this[r + 2] = i >>> 16, this[r + 3] = i >>> 24, r + 4;
1664
- }, l.prototype.writeInt32BE = function(i, r, h) {
1676
+ }, c.prototype.writeInt32BE = function(i, r, h) {
1665
1677
  return i = +i, r = r >>> 0, h || K(this, i, r, 4, 2147483647, -2147483648), i < 0 && (i = 4294967295 + i + 1), this[r] = i >>> 24, this[r + 1] = i >>> 16, this[r + 2] = i >>> 8, this[r + 3] = i & 255, r + 4;
1666
- }, l.prototype.writeBigInt64LE = le(function(i, r = 0) {
1667
- return Bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1668
- }), l.prototype.writeBigInt64BE = le(function(i, r = 0) {
1669
- return Pt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1678
+ }, c.prototype.writeBigInt64LE = se(function(i, r = 0) {
1679
+ return bt(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1680
+ }), c.prototype.writeBigInt64BE = se(function(i, r = 0) {
1681
+ return At(this, i, r, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1670
1682
  });
1671
- function Ft(s, i, r, h, f, E) {
1672
- if (r + h > s.length) throw new RangeError("Index out of range");
1683
+ function Tt(a, i, r, h, f, m) {
1684
+ if (r + h > a.length) throw new RangeError("Index out of range");
1673
1685
  if (r < 0) throw new RangeError("Index out of range");
1674
1686
  }
1675
- function $t(s, i, r, h, f) {
1676
- return i = +i, r = r >>> 0, f || Ft(s, i, r, 4), n.write(s, i, r, h, 23, 4), r + 4;
1687
+ function Rt(a, i, r, h, f) {
1688
+ return i = +i, r = r >>> 0, f || Tt(a, i, r, 4), n.write(a, i, r, h, 23, 4), r + 4;
1677
1689
  }
1678
- l.prototype.writeFloatLE = function(i, r, h) {
1679
- return $t(this, i, r, !0, h);
1680
- }, l.prototype.writeFloatBE = function(i, r, h) {
1681
- return $t(this, i, r, !1, h);
1690
+ c.prototype.writeFloatLE = function(i, r, h) {
1691
+ return Rt(this, i, r, !0, h);
1692
+ }, c.prototype.writeFloatBE = function(i, r, h) {
1693
+ return Rt(this, i, r, !1, h);
1682
1694
  };
1683
- function Vt(s, i, r, h, f) {
1684
- return i = +i, r = r >>> 0, f || Ft(s, i, r, 8), n.write(s, i, r, h, 52, 8), r + 8;
1685
- }
1686
- l.prototype.writeDoubleLE = function(i, r, h) {
1687
- return Vt(this, i, r, !0, h);
1688
- }, l.prototype.writeDoubleBE = function(i, r, h) {
1689
- return Vt(this, i, r, !1, h);
1690
- }, l.prototype.copy = function(i, r, h, f) {
1691
- if (!l.isBuffer(i)) throw new TypeError("argument should be a Buffer");
1695
+ function Nt(a, i, r, h, f) {
1696
+ return i = +i, r = r >>> 0, f || Tt(a, i, r, 8), n.write(a, i, r, h, 52, 8), r + 8;
1697
+ }
1698
+ c.prototype.writeDoubleLE = function(i, r, h) {
1699
+ return Nt(this, i, r, !0, h);
1700
+ }, c.prototype.writeDoubleBE = function(i, r, h) {
1701
+ return Nt(this, i, r, !1, h);
1702
+ }, c.prototype.copy = function(i, r, h, f) {
1703
+ if (!c.isBuffer(i)) throw new TypeError("argument should be a Buffer");
1692
1704
  if (h || (h = 0), !f && f !== 0 && (f = this.length), r >= i.length && (r = i.length), r || (r = 0), f > 0 && f < h && (f = h), f === h || i.length === 0 || this.length === 0) return 0;
1693
1705
  if (r < 0)
1694
1706
  throw new RangeError("targetStart out of bounds");
1695
1707
  if (h < 0 || h >= this.length) throw new RangeError("Index out of range");
1696
1708
  if (f < 0) throw new RangeError("sourceEnd out of bounds");
1697
1709
  f > this.length && (f = this.length), i.length - r < f - h && (f = i.length - r + h);
1698
- const E = f - h;
1710
+ const m = f - h;
1699
1711
  return this === i && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(r, h, f) : Uint8Array.prototype.set.call(
1700
1712
  i,
1701
1713
  this.subarray(h, f),
1702
1714
  r
1703
- ), E;
1704
- }, l.prototype.fill = function(i, r, h, f) {
1715
+ ), m;
1716
+ }, c.prototype.fill = function(i, r, h, f) {
1705
1717
  if (typeof i == "string") {
1706
1718
  if (typeof r == "string" ? (f = r, r = 0, h = this.length) : typeof h == "string" && (f = h, h = this.length), f !== void 0 && typeof f != "string")
1707
1719
  throw new TypeError("encoding must be a string");
1708
- if (typeof f == "string" && !l.isEncoding(f))
1720
+ if (typeof f == "string" && !c.isEncoding(f))
1709
1721
  throw new TypeError("Unknown encoding: " + f);
1710
1722
  if (i.length === 1) {
1711
1723
  const v = i.charCodeAt(0);
@@ -1717,31 +1729,31 @@ function Un() {
1717
1729
  if (h <= r)
1718
1730
  return this;
1719
1731
  r = r >>> 0, h = h === void 0 ? this.length : h >>> 0, i || (i = 0);
1720
- let E;
1732
+ let m;
1721
1733
  if (typeof i == "number")
1722
- for (E = r; E < h; ++E)
1723
- this[E] = i;
1734
+ for (m = r; m < h; ++m)
1735
+ this[m] = i;
1724
1736
  else {
1725
- const v = l.isBuffer(i) ? i : l.from(i, f), T = v.length;
1737
+ const v = c.isBuffer(i) ? i : c.from(i, f), T = v.length;
1726
1738
  if (T === 0)
1727
1739
  throw new TypeError('The value "' + i + '" is invalid for argument "value"');
1728
- for (E = 0; E < h - r; ++E)
1729
- this[E + r] = v[E % T];
1740
+ for (m = 0; m < h - r; ++m)
1741
+ this[m + r] = v[m % T];
1730
1742
  }
1731
1743
  return this;
1732
1744
  };
1733
- const ve = {};
1734
- function st(s, i, r) {
1735
- ve[s] = class extends r {
1745
+ const Ee = {};
1746
+ function Qe(a, i, r) {
1747
+ Ee[a] = class extends r {
1736
1748
  constructor() {
1737
1749
  super(), Object.defineProperty(this, "message", {
1738
1750
  value: i.apply(this, arguments),
1739
1751
  writable: !0,
1740
1752
  configurable: !0
1741
- }), this.name = `${this.name} [${s}]`, this.stack, delete this.name;
1753
+ }), this.name = `${this.name} [${a}]`, this.stack, delete this.name;
1742
1754
  }
1743
1755
  get code() {
1744
- return s;
1756
+ return a;
1745
1757
  }
1746
1758
  set code(f) {
1747
1759
  Object.defineProperty(this, "code", {
@@ -1752,110 +1764,110 @@ function Un() {
1752
1764
  });
1753
1765
  }
1754
1766
  toString() {
1755
- return `${this.name} [${s}]: ${this.message}`;
1767
+ return `${this.name} [${a}]: ${this.message}`;
1756
1768
  }
1757
1769
  };
1758
1770
  }
1759
- st(
1771
+ Qe(
1760
1772
  "ERR_BUFFER_OUT_OF_BOUNDS",
1761
- function(s) {
1762
- return s ? `${s} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
1773
+ function(a) {
1774
+ return a ? `${a} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
1763
1775
  },
1764
1776
  RangeError
1765
- ), st(
1777
+ ), Qe(
1766
1778
  "ERR_INVALID_ARG_TYPE",
1767
- function(s, i) {
1768
- return `The "${s}" argument must be of type number. Received type ${typeof i}`;
1779
+ function(a, i) {
1780
+ return `The "${a}" argument must be of type number. Received type ${typeof i}`;
1769
1781
  },
1770
1782
  TypeError
1771
- ), st(
1783
+ ), Qe(
1772
1784
  "ERR_OUT_OF_RANGE",
1773
- function(s, i, r) {
1774
- let h = `The value of "${s}" is out of range.`, f = r;
1775
- return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? f = Gt(String(r)) : typeof r == "bigint" && (f = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (f = Gt(f)), f += "n"), h += ` It must be ${i}. Received ${f}`, h;
1785
+ function(a, i, r) {
1786
+ let h = `The value of "${a}" is out of range.`, f = r;
1787
+ return Number.isInteger(r) && Math.abs(r) > 2 ** 32 ? f = xt(String(r)) : typeof r == "bigint" && (f = String(r), (r > BigInt(2) ** BigInt(32) || r < -(BigInt(2) ** BigInt(32))) && (f = xt(f)), f += "n"), h += ` It must be ${i}. Received ${f}`, h;
1776
1788
  },
1777
1789
  RangeError
1778
1790
  );
1779
- function Gt(s) {
1780
- let i = "", r = s.length;
1781
- const h = s[0] === "-" ? 1 : 0;
1791
+ function xt(a) {
1792
+ let i = "", r = a.length;
1793
+ const h = a[0] === "-" ? 1 : 0;
1782
1794
  for (; r >= h + 4; r -= 3)
1783
- i = `_${s.slice(r - 3, r)}${i}`;
1784
- return `${s.slice(0, r)}${i}`;
1795
+ i = `_${a.slice(r - 3, r)}${i}`;
1796
+ return `${a.slice(0, r)}${i}`;
1785
1797
  }
1786
- function tn(s, i, r) {
1787
- ye(i, "offset"), (s[i] === void 0 || s[i + r] === void 0) && Re(i, s.length - (r + 1));
1798
+ function Gi(a, i, r) {
1799
+ ge(i, "offset"), (a[i] === void 0 || a[i + r] === void 0) && Te(i, a.length - (r + 1));
1788
1800
  }
1789
- function jt(s, i, r, h, f, E) {
1790
- if (s > r || s < i) {
1801
+ function Ot(a, i, r, h, f, m) {
1802
+ if (a > r || a < i) {
1791
1803
  const v = typeof i == "bigint" ? "n" : "";
1792
1804
  let T;
1793
- 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 ve.ERR_OUT_OF_RANGE("value", T, s);
1805
+ throw i === 0 || i === BigInt(0) ? T = `>= 0${v} and < 2${v} ** ${(m + 1) * 8}${v}` : T = `>= -(2${v} ** ${(m + 1) * 8 - 1}${v}) and < 2 ** ${(m + 1) * 8 - 1}${v}`, new Ee.ERR_OUT_OF_RANGE("value", T, a);
1794
1806
  }
1795
- tn(h, f, E);
1807
+ Gi(h, f, m);
1796
1808
  }
1797
- function ye(s, i) {
1798
- if (typeof s != "number")
1799
- throw new ve.ERR_INVALID_ARG_TYPE(i, "number", s);
1809
+ function ge(a, i) {
1810
+ if (typeof a != "number")
1811
+ throw new Ee.ERR_INVALID_ARG_TYPE(i, "number", a);
1800
1812
  }
1801
- function Re(s, i, r) {
1802
- throw Math.floor(s) !== s ? (ye(s, r), new ve.ERR_OUT_OF_RANGE("offset", "an integer", s)) : i < 0 ? new ve.ERR_BUFFER_OUT_OF_BOUNDS() : new ve.ERR_OUT_OF_RANGE(
1813
+ function Te(a, i, r) {
1814
+ throw Math.floor(a) !== a ? (ge(a, r), new Ee.ERR_OUT_OF_RANGE("offset", "an integer", a)) : i < 0 ? new Ee.ERR_BUFFER_OUT_OF_BOUNDS() : new Ee.ERR_OUT_OF_RANGE(
1803
1815
  "offset",
1804
1816
  `>= 0 and <= ${i}`,
1805
- s
1817
+ a
1806
1818
  );
1807
1819
  }
1808
- const nn = /[^+/0-9A-Za-z-_]/g;
1809
- function rn(s) {
1810
- if (s = s.split("=")[0], s = s.trim().replace(nn, ""), s.length < 2) return "";
1811
- for (; s.length % 4 !== 0; )
1812
- s = s + "=";
1813
- return s;
1820
+ const ji = /[^+/0-9A-Za-z-_]/g;
1821
+ function Hi(a) {
1822
+ if (a = a.split("=")[0], a = a.trim().replace(ji, ""), a.length < 2) return "";
1823
+ for (; a.length % 4 !== 0; )
1824
+ a = a + "=";
1825
+ return a;
1814
1826
  }
1815
- function at(s, i) {
1827
+ function et(a, i) {
1816
1828
  i = i || 1 / 0;
1817
1829
  let r;
1818
- const h = s.length;
1830
+ const h = a.length;
1819
1831
  let f = null;
1820
- const E = [];
1832
+ const m = [];
1821
1833
  for (let v = 0; v < h; ++v) {
1822
- if (r = s.charCodeAt(v), r > 55295 && r < 57344) {
1834
+ if (r = a.charCodeAt(v), r > 55295 && r < 57344) {
1823
1835
  if (!f) {
1824
1836
  if (r > 56319) {
1825
- (i -= 3) > -1 && E.push(239, 191, 189);
1837
+ (i -= 3) > -1 && m.push(239, 191, 189);
1826
1838
  continue;
1827
1839
  } else if (v + 1 === h) {
1828
- (i -= 3) > -1 && E.push(239, 191, 189);
1840
+ (i -= 3) > -1 && m.push(239, 191, 189);
1829
1841
  continue;
1830
1842
  }
1831
1843
  f = r;
1832
1844
  continue;
1833
1845
  }
1834
1846
  if (r < 56320) {
1835
- (i -= 3) > -1 && E.push(239, 191, 189), f = r;
1847
+ (i -= 3) > -1 && m.push(239, 191, 189), f = r;
1836
1848
  continue;
1837
1849
  }
1838
1850
  r = (f - 55296 << 10 | r - 56320) + 65536;
1839
- } else f && (i -= 3) > -1 && E.push(239, 191, 189);
1851
+ } else f && (i -= 3) > -1 && m.push(239, 191, 189);
1840
1852
  if (f = null, r < 128) {
1841
1853
  if ((i -= 1) < 0) break;
1842
- E.push(r);
1854
+ m.push(r);
1843
1855
  } else if (r < 2048) {
1844
1856
  if ((i -= 2) < 0) break;
1845
- E.push(
1857
+ m.push(
1846
1858
  r >> 6 | 192,
1847
1859
  r & 63 | 128
1848
1860
  );
1849
1861
  } else if (r < 65536) {
1850
1862
  if ((i -= 3) < 0) break;
1851
- E.push(
1863
+ m.push(
1852
1864
  r >> 12 | 224,
1853
1865
  r >> 6 & 63 | 128,
1854
1866
  r & 63 | 128
1855
1867
  );
1856
1868
  } else if (r < 1114112) {
1857
1869
  if ((i -= 4) < 0) break;
1858
- E.push(
1870
+ m.push(
1859
1871
  r >> 18 | 240,
1860
1872
  r >> 12 & 63 | 128,
1861
1873
  r >> 6 & 63 | 128,
@@ -1864,117 +1876,117 @@ function Un() {
1864
1876
  } else
1865
1877
  throw new Error("Invalid code point");
1866
1878
  }
1867
- return E;
1879
+ return m;
1868
1880
  }
1869
- function on(s) {
1881
+ function Wi(a) {
1870
1882
  const i = [];
1871
- for (let r = 0; r < s.length; ++r)
1872
- i.push(s.charCodeAt(r) & 255);
1883
+ for (let r = 0; r < a.length; ++r)
1884
+ i.push(a.charCodeAt(r) & 255);
1873
1885
  return i;
1874
1886
  }
1875
- function sn(s, i) {
1887
+ function zi(a, i) {
1876
1888
  let r, h, f;
1877
- const E = [];
1878
- for (let v = 0; v < s.length && !((i -= 2) < 0); ++v)
1879
- r = s.charCodeAt(v), h = r >> 8, f = r % 256, E.push(f), E.push(h);
1880
- return E;
1889
+ const m = [];
1890
+ for (let v = 0; v < a.length && !((i -= 2) < 0); ++v)
1891
+ r = a.charCodeAt(v), h = r >> 8, f = r % 256, m.push(f), m.push(h);
1892
+ return m;
1881
1893
  }
1882
- function Ht(s) {
1883
- return e.toByteArray(rn(s));
1894
+ function kt(a) {
1895
+ return e.toByteArray(Hi(a));
1884
1896
  }
1885
- function Ve(s, i, r, h) {
1897
+ function Be(a, i, r, h) {
1886
1898
  let f;
1887
- for (f = 0; f < h && !(f + r >= i.length || f >= s.length); ++f)
1888
- i[f + r] = s[f];
1899
+ for (f = 0; f < h && !(f + r >= i.length || f >= a.length); ++f)
1900
+ i[f + r] = a[f];
1889
1901
  return f;
1890
1902
  }
1891
- function ee(s, i) {
1892
- return s instanceof i || s != null && s.constructor != null && s.constructor.name != null && s.constructor.name === i.name;
1903
+ function Q(a, i) {
1904
+ return a instanceof i || a != null && a.constructor != null && a.constructor.name != null && a.constructor.name === i.name;
1893
1905
  }
1894
- function lt(s) {
1895
- return s !== s;
1906
+ function tt(a) {
1907
+ return a !== a;
1896
1908
  }
1897
- const an = (function() {
1898
- const s = "0123456789abcdef", i = new Array(256);
1909
+ const qi = (function() {
1910
+ const a = "0123456789abcdef", i = new Array(256);
1899
1911
  for (let r = 0; r < 16; ++r) {
1900
1912
  const h = r * 16;
1901
1913
  for (let f = 0; f < 16; ++f)
1902
- i[h + f] = s[r] + s[f];
1914
+ i[h + f] = a[r] + a[f];
1903
1915
  }
1904
1916
  return i;
1905
1917
  })();
1906
- function le(s) {
1907
- return typeof BigInt > "u" ? ln : s;
1918
+ function se(a) {
1919
+ return typeof BigInt > "u" ? Yi : a;
1908
1920
  }
1909
- function ln() {
1921
+ function Yi() {
1910
1922
  throw new Error("BigInt not supported");
1911
1923
  }
1912
- })(dt)), dt;
1924
+ })(ot)), ot;
1913
1925
  }
1914
- var Ln = Un();
1915
- const Bn = "https://api.anam.ai", Pn = "/v1", Wi = {
1926
+ var In = Cn();
1927
+ const bn = "https://api.anam.ai", An = "/v1", Oi = {
1916
1928
  client: "js-sdk",
1917
1929
  version: "4.8.0"
1918
1930
  };
1919
- var Fn = function(t, e, n, o) {
1920
- function u(a) {
1921
- return a instanceof n ? a : new n(function(c) {
1922
- c(a);
1931
+ var Tn = function(t, e, n, o) {
1932
+ function l(s) {
1933
+ return s instanceof n ? s : new n(function(u) {
1934
+ u(s);
1923
1935
  });
1924
1936
  }
1925
- return new (n || (n = Promise))(function(a, c) {
1926
- function l(_) {
1937
+ return new (n || (n = Promise))(function(s, u) {
1938
+ function c(_) {
1927
1939
  try {
1928
1940
  p(o.next(_));
1929
1941
  } catch (d) {
1930
- c(d);
1942
+ u(d);
1931
1943
  }
1932
1944
  }
1933
- function m(_) {
1945
+ function E(_) {
1934
1946
  try {
1935
1947
  p(o.throw(_));
1936
1948
  } catch (d) {
1937
- c(d);
1949
+ u(d);
1938
1950
  }
1939
1951
  }
1940
1952
  function p(_) {
1941
- _.done ? a(_.value) : u(_.value).then(l, m);
1953
+ _.done ? s(_.value) : l(_.value).then(c, E);
1942
1954
  }
1943
1955
  p((o = o.apply(t, e || [])).next());
1944
1956
  });
1945
1957
  };
1946
- const zi = "https://api.anam.ai", xt = "/v1";
1947
- var se;
1958
+ const ki = "https://api.anam.ai", wt = "/v1";
1959
+ var re;
1948
1960
  (function(t) {
1949
1961
  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";
1950
- })(se || (se = {}));
1951
- let St = zi, qi = xt, ue, Yi = !1;
1952
- const $n = (t, e = xt) => {
1953
- St = t, qi = e;
1954
- }, Vn = (t) => {
1955
- ue = t;
1956
- }, Gn = (t) => {
1957
- Yi = t;
1962
+ })(re || (re = {}));
1963
+ let ft = ki, Di = wt, le, Mi = !1;
1964
+ const Rn = (t, e = wt) => {
1965
+ ft = t, Di = e;
1966
+ }, Nn = (t) => {
1967
+ le = t;
1968
+ }, xn = (t) => {
1969
+ Mi = t;
1958
1970
  };
1959
- let de = {
1971
+ let ce = {
1960
1972
  sessionId: null,
1961
1973
  organizationId: null,
1962
1974
  attemptCorrelationId: null
1963
1975
  };
1964
- const Se = (t) => {
1965
- de = Object.assign(Object.assign({}, de), t);
1966
- }, me = (t, e, n) => Fn(void 0, void 0, void 0, function* () {
1967
- if (!Yi)
1976
+ const ve = (t) => {
1977
+ ce = Object.assign(Object.assign({}, ce), t);
1978
+ }, _e = (t, e, n) => Tn(void 0, void 0, void 0, function* () {
1979
+ if (!Mi)
1968
1980
  try {
1969
- const o = Object.assign(Object.assign({}, Wi), n);
1970
- de.sessionId && (o.sessionId = de.sessionId), de.organizationId && (o.organizationId = de.organizationId), de.attemptCorrelationId && (o.attemptCorrelationId = de.attemptCorrelationId);
1971
- const u = `${qi}/metrics/client`;
1972
- let a, c = {
1981
+ const o = Object.assign(Object.assign({}, Oi), n);
1982
+ ce.sessionId && (o.sessionId = ce.sessionId), ce.organizationId && (o.organizationId = ce.organizationId), ce.attemptCorrelationId && (o.attemptCorrelationId = ce.attemptCorrelationId);
1983
+ const l = `${Di}/metrics/client`;
1984
+ let s, u = {
1973
1985
  "Content-Type": "application/json"
1974
1986
  };
1975
- ue?.enabled && ue?.baseUrl ? (a = `${ue.baseUrl}${u}`, c["X-Anam-Target-Url"] = `${St}${u}`) : a = `${St}${u}`, yield fetch(a, {
1987
+ le?.enabled && le?.baseUrl ? (s = `${le.baseUrl}${l}`, u["X-Anam-Target-Url"] = `${ft}${l}`) : s = `${ft}${l}`, yield fetch(s, {
1976
1988
  method: "POST",
1977
- headers: c,
1989
+ headers: u,
1978
1990
  body: JSON.stringify({
1979
1991
  name: t,
1980
1992
  value: e,
@@ -1984,16 +1996,16 @@ const Se = (t) => {
1984
1996
  } catch (o) {
1985
1997
  console.error("Failed to send error metric:", o);
1986
1998
  }
1987
- }), jn = (t, e = "console") => {
1988
- var n, o, u;
1989
- const a = {};
1999
+ }), On = (t, e = "console") => {
2000
+ var n, o, l;
2001
+ const s = {};
1990
2002
  t.forEach((d) => {
1991
- a[d.type] || (a[d.type] = []), a[d.type].push(d);
2003
+ s[d.type] || (s[d.type] = []), s[d.type].push(d);
1992
2004
  });
1993
- const c = {
2005
+ const u = {
1994
2006
  issues: []
1995
- }, l = ((n = a["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
1996
- l.length > 0 && (c.personaVideoStream = [], l.forEach((d) => {
2007
+ }, c = ((n = s["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((d) => d.kind === "video")) || [];
2008
+ c.length > 0 && (u.personaVideoStream = [], c.forEach((d) => {
1997
2009
  var S, g, y, C, A;
1998
2010
  const I = {
1999
2011
  framesReceived: (S = d.framesReceived) !== null && S !== void 0 ? S : "unknown",
@@ -2004,10 +2016,10 @@ const Se = (t) => {
2004
2016
  resolution: d.frameWidth && d.frameHeight ? `${d.frameWidth}x${d.frameHeight}` : void 0,
2005
2017
  jitter: d.jitter !== void 0 ? d.jitter : void 0
2006
2018
  };
2007
- c.personaVideoStream.push(I);
2019
+ u.personaVideoStream.push(I);
2008
2020
  }));
2009
- const m = ((o = a["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2010
- m.length > 0 && (c.personaAudioStream = [], m.forEach((d) => {
2021
+ const E = ((o = s["inbound-rtp"]) === null || o === void 0 ? void 0 : o.filter((d) => d.kind === "audio")) || [];
2022
+ E.length > 0 && (u.personaAudioStream = [], E.forEach((d) => {
2011
2023
  var S, g, y;
2012
2024
  const C = {
2013
2025
  packetsReceived: (S = d.packetsReceived) !== null && S !== void 0 ? S : "unknown",
@@ -2016,18 +2028,18 @@ const Se = (t) => {
2016
2028
  jitter: d.jitter !== void 0 ? d.jitter : void 0,
2017
2029
  totalAudioEnergy: d.totalAudioEnergy !== void 0 ? d.totalAudioEnergy : void 0
2018
2030
  };
2019
- c.personaAudioStream.push(C);
2031
+ u.personaAudioStream.push(C);
2020
2032
  }));
2021
- const p = ((u = a["outbound-rtp"]) === null || u === void 0 ? void 0 : u.filter((d) => d.kind === "audio")) || [];
2022
- p.length > 0 && (c.userAudioInput = [], p.forEach((d) => {
2033
+ const p = ((l = s["outbound-rtp"]) === null || l === void 0 ? void 0 : l.filter((d) => d.kind === "audio")) || [];
2034
+ p.length > 0 && (u.userAudioInput = [], p.forEach((d) => {
2023
2035
  var S, g;
2024
2036
  const y = {
2025
2037
  packetsSent: (S = d.packetsSent) !== null && S !== void 0 ? S : "unknown",
2026
2038
  retransmittedPackets: (g = d.retransmittedPacketsSent) !== null && g !== void 0 ? g : void 0,
2027
2039
  avgPacketSendDelay: d.totalPacketSendDelay !== void 0 ? d.totalPacketSendDelay / (d.packetsSent || 1) * 1e3 : void 0
2028
2040
  };
2029
- c.userAudioInput.push(y);
2030
- })), a.codec && (c.codecs = [], a.codec.forEach((d) => {
2041
+ u.userAudioInput.push(y);
2042
+ })), s.codec && (u.codecs = [], s.codec.forEach((d) => {
2031
2043
  const S = {
2032
2044
  status: d.payloadType ? "Active" : "Available",
2033
2045
  mimeType: d.mimeType || "Unknown",
@@ -2035,51 +2047,51 @@ const Se = (t) => {
2035
2047
  clockRate: d.clockRate || void 0,
2036
2048
  channels: d.channels || void 0
2037
2049
  };
2038
- c.codecs.push(S);
2039
- })), a.transport && (c.transportLayer = [], a.transport.forEach((d) => {
2050
+ u.codecs.push(S);
2051
+ })), s.transport && (u.transportLayer = [], s.transport.forEach((d) => {
2040
2052
  const S = {
2041
2053
  dtlsState: d.dtlsState || "unknown",
2042
2054
  iceState: d.iceState || "unknown",
2043
2055
  bytesSent: d.bytesSent || void 0,
2044
2056
  bytesReceived: d.bytesReceived || void 0
2045
2057
  };
2046
- c.transportLayer.push(S);
2058
+ u.transportLayer.push(S);
2047
2059
  }));
2048
2060
  const _ = [];
2049
- if (l.forEach((d) => {
2061
+ if (c.forEach((d) => {
2050
2062
  typeof d.framesDropped == "number" && d.framesDropped > 0 && _.push(`Video: ${d.framesDropped} frames dropped`), typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Video: ${d.packetsLost} packets lost`), typeof d.framesPerSecond == "number" && d.framesPerSecond < 23 && _.push(`Video: Low frame rate (${d.framesPerSecond} fps)`);
2051
- }), m.forEach((d) => {
2063
+ }), E.forEach((d) => {
2052
2064
  typeof d.packetsLost == "number" && d.packetsLost > 0 && _.push(`Audio: ${d.packetsLost} packets lost`), typeof d.jitter == "number" && d.jitter > 0.1 && _.push(`Audio: High jitter (${(d.jitter * 1e3).toFixed(1)}ms)`);
2053
- }), c.issues = _, e === "json")
2054
- return c;
2055
- console.group("📊 WebRTC Session Statistics Report"), c.personaVideoStream && c.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), c.personaVideoStream.forEach((d) => {
2065
+ }), u.issues = _, e === "json")
2066
+ return u;
2067
+ console.group("📊 WebRTC Session Statistics Report"), u.personaVideoStream && u.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), u.personaVideoStream.forEach((d) => {
2056
2068
  console.log(`Frames Received: ${d.framesReceived}`), console.log(`Frames Dropped: ${d.framesDropped}`), console.log(`Frames Per Second: ${d.framesPerSecond}`), console.log(`Packets Received: ${typeof d.packetsReceived == "number" ? d.packetsReceived.toLocaleString() : d.packetsReceived}`), console.log(`Packets Lost: ${d.packetsLost}`), d.resolution && console.log(`Resolution: ${d.resolution}`), d.jitter !== void 0 && console.log(`Jitter: ${d.jitter.toFixed(5)}ms`);
2057
- }), console.groupEnd()), c.personaAudioStream && c.personaAudioStream.length > 0 && (console.group("🔊 Persona Audio Stream (Inbound)"), c.personaAudioStream.forEach((d) => {
2069
+ }), console.groupEnd()), u.personaAudioStream && u.personaAudioStream.length > 0 && (console.group("🔊 Persona Audio Stream (Inbound)"), u.personaAudioStream.forEach((d) => {
2058
2070
  console.log(`Packets Received: ${typeof d.packetsReceived == "number" ? d.packetsReceived.toLocaleString() : d.packetsReceived}`), console.log(`Packets Lost: ${d.packetsLost}`), console.log(`Audio Level: ${d.audioLevel}`), d.jitter !== void 0 && console.log(`Jitter: ${d.jitter.toFixed(5)}ms`), d.totalAudioEnergy !== void 0 && console.log(`Total Audio Energy: ${d.totalAudioEnergy.toFixed(6)}`);
2059
- }), console.groupEnd()), c.userAudioInput && c.userAudioInput.length > 0 && (console.group("🎤 User Audio Input (Outbound)"), c.userAudioInput.forEach((d) => {
2071
+ }), console.groupEnd()), u.userAudioInput && u.userAudioInput.length > 0 && (console.group("🎤 User Audio Input (Outbound)"), u.userAudioInput.forEach((d) => {
2060
2072
  console.log(`Packets Sent: ${typeof d.packetsSent == "number" ? d.packetsSent.toLocaleString() : d.packetsSent}`), d.retransmittedPackets && console.log(`Retransmitted Packets: ${d.retransmittedPackets}`), d.avgPacketSendDelay !== void 0 && console.log(`Avg Packet Send Delay: ${d.avgPacketSendDelay.toFixed(5)}ms`);
2061
- }), console.groupEnd()), c.codecs && c.codecs.length > 0 && (console.group("🔧 Codecs Used"), c.codecs.forEach((d) => {
2073
+ }), console.groupEnd()), u.codecs && u.codecs.length > 0 && (console.group("🔧 Codecs Used"), u.codecs.forEach((d) => {
2062
2074
  console.log(`${d.status} ${d.mimeType} - Payload Type: ${d.payloadType}`), d.clockRate && console.log(` Clock Rate: ${d.clockRate}Hz`), d.channels && console.log(` Channels: ${d.channels}`);
2063
- }), console.groupEnd()), c.transportLayer && c.transportLayer.length > 0 && (console.group("🚚 Transport Layer"), c.transportLayer.forEach((d) => {
2075
+ }), console.groupEnd()), u.transportLayer && u.transportLayer.length > 0 && (console.group("🚚 Transport Layer"), u.transportLayer.forEach((d) => {
2064
2076
  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()}`);
2065
- }), 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();
2077
+ }), console.groupEnd()), u.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), u.issues.forEach((d) => console.warn(d)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
2066
2078
  };
2067
2079
  var j;
2068
2080
  (function(t) {
2069
2081
  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";
2070
2082
  })(j || (j = {}));
2071
2083
  class V extends Error {
2072
- constructor(e, n, o = 500, u) {
2073
- super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = u, Object.setPrototypeOf(this, V.prototype), me(se.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
2074
- details: u,
2084
+ constructor(e, n, o = 500, l) {
2085
+ super(e), this.name = "ClientError", this.code = n, this.statusCode = o, this.details = l, Object.setPrototypeOf(this, V.prototype), _e(re.CLIENT_METRIC_MEASUREMENT_ERROR, n, {
2086
+ details: l,
2075
2087
  statusCode: o
2076
2088
  });
2077
2089
  }
2078
2090
  }
2079
- function ci() {
2091
+ function Xt() {
2080
2092
  return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).substr(2, 9);
2081
2093
  }
2082
- function Hn(t) {
2094
+ function kn(t) {
2083
2095
  if (!(!t || !t.enabled)) {
2084
2096
  if (!t.baseUrl)
2085
2097
  return "API Gateway baseUrl is required when enabled";
@@ -2098,18 +2110,18 @@ var W;
2098
2110
  (function(t) {
2099
2111
  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";
2100
2112
  })(W || (W = {}));
2101
- var De;
2113
+ var Oe;
2102
2114
  (function(t) {
2103
2115
  t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.REASONING_TEXT = "reasoningText";
2104
- })(De || (De = {}));
2105
- var he;
2116
+ })(Oe || (Oe = {}));
2117
+ var ue;
2106
2118
  (function(t) {
2107
2119
  t.PENDING = "pending", t.GRANTED = "granted", t.DENIED = "denied", t.NOT_REQUESTED = "not_requested";
2108
- })(he || (he = {}));
2109
- var Qe;
2120
+ })(ue || (ue = {}));
2121
+ var Ke;
2110
2122
  (function(t) {
2111
2123
  t.USER = "user", t.PERSONA = "persona";
2112
- })(Qe || (Qe = {}));
2124
+ })(Ke || (Ke = {}));
2113
2125
  var N;
2114
2126
  (function(t) {
2115
2127
  t.MESSAGE_HISTORY_UPDATED = "MESSAGE_HISTORY_UPDATED", t.MESSAGE_STREAM_EVENT_RECEIVED = "MESSAGE_STREAM_EVENT_RECEIVED", t.CONNECTION_ESTABLISHED = "CONNECTION_ESTABLISHED", t.CONNECTION_CLOSED = "CONNECTION_CLOSED", t.INPUT_AUDIO_STREAM_STARTED = "INPUT_AUDIO_STREAM_STARTED", t.VIDEO_STREAM_STARTED = "VIDEO_STREAM_STARTED", t.VIDEO_PLAY_STARTED = "VIDEO_PLAY_STARTED", t.AUDIO_STREAM_STARTED = "AUDIO_STREAM_STARTED", t.TALK_STREAM_INTERRUPTED = "TALK_STREAM_INTERRUPTED", t.SESSION_READY = "SESSION_READY", t.SERVER_WARNING = "SERVER_WARNING", t.MIC_PERMISSION_PENDING = "MIC_PERMISSION_PENDING", t.MIC_PERMISSION_GRANTED = "MIC_PERMISSION_GRANTED", t.MIC_PERMISSION_DENIED = "MIC_PERMISSION_DENIED", t.INPUT_AUDIO_DEVICE_CHANGED = "INPUT_AUDIO_DEVICE_CHANGED", t.CLIENT_TOOL_EVENT_RECEIVED = "CLIENT_TOOL_EVENT_RECEIVED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED";
@@ -2118,11 +2130,11 @@ var X;
2118
2130
  (function(t) {
2119
2131
  t.WEB_SOCKET_OPEN = "WEB_SOCKET_OPEN", t.SIGNAL_MESSAGE_RECEIVED = "SIGNAL_MESSAGE_RECEIVED", t.WEBRTC_CHAT_MESSAGE_RECEIVED = "WEBRTC_CHAT_MESSAGE_RECEIVED", t.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED = "WEBRTC_CLIENT_TOOL_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED";
2120
2132
  })(X || (X = {}));
2121
- var pe;
2133
+ var he;
2122
2134
  (function(t) {
2123
2135
  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";
2124
- })(pe || (pe = {}));
2125
- class Wn {
2136
+ })(he || (he = {}));
2137
+ class Dn {
2126
2138
  constructor(e, n) {
2127
2139
  this.sequenceNumber = 0, this.config = e, this.signallingClient = n;
2128
2140
  }
@@ -2160,49 +2172,49 @@ class Wn {
2160
2172
  return this.config;
2161
2173
  }
2162
2174
  arrayBufferToBase64(e) {
2163
- const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (u) => String.fromCharCode(u)).join("");
2175
+ const n = e instanceof Uint8Array ? e : new Uint8Array(e), o = Array.from(n, (l) => String.fromCharCode(l)).join("");
2164
2176
  return btoa(o);
2165
2177
  }
2166
2178
  }
2167
- var we = function(t, e, n, o) {
2168
- function u(a) {
2169
- return a instanceof n ? a : new n(function(c) {
2170
- c(a);
2179
+ var ye = function(t, e, n, o) {
2180
+ function l(s) {
2181
+ return s instanceof n ? s : new n(function(u) {
2182
+ u(s);
2171
2183
  });
2172
2184
  }
2173
- return new (n || (n = Promise))(function(a, c) {
2174
- function l(_) {
2185
+ return new (n || (n = Promise))(function(s, u) {
2186
+ function c(_) {
2175
2187
  try {
2176
2188
  p(o.next(_));
2177
2189
  } catch (d) {
2178
- c(d);
2190
+ u(d);
2179
2191
  }
2180
2192
  }
2181
- function m(_) {
2193
+ function E(_) {
2182
2194
  try {
2183
2195
  p(o.throw(_));
2184
2196
  } catch (d) {
2185
- c(d);
2197
+ u(d);
2186
2198
  }
2187
2199
  }
2188
2200
  function p(_) {
2189
- _.done ? a(_.value) : u(_.value).then(l, m);
2201
+ _.done ? s(_.value) : l(_.value).then(c, E);
2190
2202
  }
2191
2203
  p((o = o.apply(t, e || [])).next());
2192
2204
  });
2193
2205
  };
2194
- const zn = 5, qn = 5;
2195
- class Yn {
2196
- constructor(e, n, o, u, a) {
2197
- var c, l, m, p, _;
2198
- 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)
2206
+ const Mn = 5, Un = 5;
2207
+ class Ln {
2208
+ constructor(e, n, o, l, s) {
2209
+ var u, c, E, p, _;
2210
+ if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.heartBeatIntervalRef = null, this.publicEventEmitter = o, this.internalEventEmitter = l, this.apiGatewayConfig = s, !e)
2199
2211
  throw new Error("Signalling Client: sessionId is required");
2200
2212
  this.sessionId = e;
2201
2213
  const { heartbeatIntervalSeconds: d, maxWsReconnectionAttempts: S, url: g } = n;
2202
- if (this.heartbeatIntervalSeconds = d || zn, this.maxWsReconnectionAttempts = S || qn, !g.baseUrl)
2214
+ if (this.heartbeatIntervalSeconds = d || Mn, this.maxWsReconnectionAttempts = S || Un, !g.baseUrl)
2203
2215
  throw new Error("Signalling Client: baseUrl is required");
2204
- if (!((c = this.apiGatewayConfig) === null || c === void 0) && c.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
2205
- const y = new URL(this.apiGatewayConfig.baseUrl), C = (m = this.apiGatewayConfig.wsPath) !== null && m !== void 0 ? m : "/ws";
2216
+ if (!((u = this.apiGatewayConfig) === null || u === void 0) && u.enabled && (!((c = this.apiGatewayConfig) === null || c === void 0) && c.baseUrl)) {
2217
+ const y = new URL(this.apiGatewayConfig.baseUrl), C = (E = this.apiGatewayConfig.wsPath) !== null && E !== void 0 ? E : "/ws";
2206
2218
  y.protocol = y.protocol.replace("http", "ws"), y.pathname = C, this.url = y;
2207
2219
  const A = g.protocol || "https", I = A === "http" ? "ws" : "wss", b = `${A}://${g.baseUrl}`, R = (p = g.signallingPath) !== null && p !== void 0 ? p : "/ws", M = new URL(b);
2208
2220
  M.protocol = I === "ws" ? "ws:" : "wss:", g.port && (M.port = g.port), M.pathname = R, M.searchParams.append("session_id", e), this.url.searchParams.append("target_url", M.href);
@@ -2218,7 +2230,7 @@ class Yn {
2218
2230
  return this.socket = new WebSocket(this.url.href), this.socket.onopen = this.onOpen.bind(this), this.socket.onclose = this.onClose.bind(this), this.socket.onerror = this.onError.bind(this), this.socket;
2219
2231
  }
2220
2232
  sendOffer(e) {
2221
- return we(this, void 0, void 0, function* () {
2233
+ return ye(this, void 0, void 0, function* () {
2222
2234
  const n = {
2223
2235
  connectionDescription: e,
2224
2236
  userUid: this.sessionId
@@ -2232,7 +2244,7 @@ class Yn {
2232
2244
  });
2233
2245
  }
2234
2246
  sendIceCandidate(e) {
2235
- return we(this, void 0, void 0, function* () {
2247
+ return ye(this, void 0, void 0, function* () {
2236
2248
  const n = {
2237
2249
  actionType: W.ICE_CANDIDATE,
2238
2250
  sessionId: this.sessionId,
@@ -2253,7 +2265,7 @@ class Yn {
2253
2265
  this.sendingBuffer.push(e);
2254
2266
  }
2255
2267
  sendTalkMessage(e) {
2256
- return we(this, void 0, void 0, function* () {
2268
+ return ye(this, void 0, void 0, function* () {
2257
2269
  const n = {
2258
2270
  actionType: W.TALK_STREAM_INPUT,
2259
2271
  sessionId: this.sessionId,
@@ -2282,21 +2294,21 @@ class Yn {
2282
2294
  this.socket && (this.socket.close(), this.socket = null), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null);
2283
2295
  }
2284
2296
  onOpen() {
2285
- return we(this, void 0, void 0, function* () {
2297
+ return ye(this, void 0, void 0, function* () {
2286
2298
  if (!this.socket)
2287
2299
  throw new Error("SignallingClient - onOpen: socket is null");
2288
2300
  try {
2289
2301
  this.wsConnectionAttempts = 0, this.flushSendingBuffer(), this.socket.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(X.WEB_SOCKET_OPEN);
2290
2302
  } catch (e) {
2291
- console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE);
2303
+ console.error("SignallingClient - onOpen: error in onOpen", e), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SIGNALLING_CLIENT_CONNECTION_FAILURE);
2292
2304
  }
2293
2305
  });
2294
2306
  }
2295
2307
  onClose() {
2296
- return we(this, void 0, void 0, function* () {
2308
+ return ye(this, void 0, void 0, function* () {
2297
2309
  this.wsConnectionAttempts += 1, !this.stopSignal && (this.wsConnectionAttempts <= this.maxWsReconnectionAttempts ? (this.socket = null, setTimeout(() => {
2298
2310
  this.connect();
2299
- }, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
2311
+ }, 100 * this.wsConnectionAttempts)) : (this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SIGNALLING_CLIENT_CONNECTION_FAILURE)));
2300
2312
  });
2301
2313
  }
2302
2314
  onError(e) {
@@ -2310,7 +2322,7 @@ class Yn {
2310
2322
  }), this.sendingBuffer = e;
2311
2323
  }
2312
2324
  onMessage(e) {
2313
- return we(this, void 0, void 0, function* () {
2325
+ return ye(this, void 0, void 0, function* () {
2314
2326
  const n = JSON.parse(e.data);
2315
2327
  this.internalEventEmitter.emit(X.SIGNAL_MESSAGE_RECEIVED, n);
2316
2328
  });
@@ -2325,55 +2337,55 @@ class Yn {
2325
2337
  payload: ""
2326
2338
  }, o = JSON.stringify(n);
2327
2339
  this.heartBeatIntervalRef = setInterval(() => {
2328
- var u;
2329
- this.stopSignal || ((u = this.socket) === null || u === void 0 ? void 0 : u.readyState) === WebSocket.OPEN && this.socket.send(o);
2340
+ var l;
2341
+ this.stopSignal || ((l = this.socket) === null || l === void 0 ? void 0 : l.readyState) === WebSocket.OPEN && this.socket.send(o);
2330
2342
  }, e);
2331
2343
  }
2332
2344
  }
2333
- function Kn(t) {
2345
+ function Bn(t) {
2334
2346
  return "brainType" in t || "llmId" in t;
2335
2347
  }
2336
- var ui = function(t, e, n, o) {
2337
- function u(a) {
2338
- return a instanceof n ? a : new n(function(c) {
2339
- c(a);
2348
+ var Zt = function(t, e, n, o) {
2349
+ function l(s) {
2350
+ return s instanceof n ? s : new n(function(u) {
2351
+ u(s);
2340
2352
  });
2341
2353
  }
2342
- return new (n || (n = Promise))(function(a, c) {
2343
- function l(_) {
2354
+ return new (n || (n = Promise))(function(s, u) {
2355
+ function c(_) {
2344
2356
  try {
2345
2357
  p(o.next(_));
2346
2358
  } catch (d) {
2347
- c(d);
2359
+ u(d);
2348
2360
  }
2349
2361
  }
2350
- function m(_) {
2362
+ function E(_) {
2351
2363
  try {
2352
2364
  p(o.throw(_));
2353
2365
  } catch (d) {
2354
- c(d);
2366
+ u(d);
2355
2367
  }
2356
2368
  }
2357
2369
  function p(_) {
2358
- _.done ? a(_.value) : u(_.value).then(l, m);
2370
+ _.done ? s(_.value) : l(_.value).then(c, E);
2359
2371
  }
2360
2372
  p((o = o.apply(t, e || [])).next());
2361
2373
  });
2362
2374
  };
2363
- class Jn {
2375
+ class Pn {
2364
2376
  constructor(e, n, o) {
2365
2377
  if (!e && !n)
2366
2378
  throw new Error("Either sessionToken or apiKey must be provided");
2367
- this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || Bn, this.apiVersion = o?.apiVersion || Pn, this.apiGatewayConfig = o?.apiGateway || void 0;
2379
+ this.sessionToken = e || null, this.apiKey = n || null, this.baseUrl = o?.baseUrl || bn, this.apiVersion = o?.apiVersion || An, this.apiGatewayConfig = o?.apiGateway || void 0;
2368
2380
  }
2369
2381
  /**
2370
2382
  * Builds URL and headers for a request, applying API Gateway configuration if enabled
2371
2383
  */
2372
2384
  buildGatewayUrlAndHeaders(e, n) {
2373
- var o, u;
2374
- if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((u = this.apiGatewayConfig) === null || u === void 0) && u.baseUrl)) {
2375
- const a = `${this.apiGatewayConfig.baseUrl}${e}`, c = new URL(`${this.baseUrl}${e}`), l = Object.assign(Object.assign({}, n), { "X-Anam-Target-Url": c.href });
2376
- return { url: a, headers: l };
2385
+ var o, l;
2386
+ if (!((o = this.apiGatewayConfig) === null || o === void 0) && o.enabled && (!((l = this.apiGatewayConfig) === null || l === void 0) && l.baseUrl)) {
2387
+ const s = `${this.apiGatewayConfig.baseUrl}${e}`, u = new URL(`${this.baseUrl}${e}`), c = Object.assign(Object.assign({}, n), { "X-Anam-Target-Url": u.href });
2388
+ return { url: s, headers: c };
2377
2389
  } else
2378
2390
  return {
2379
2391
  url: `${this.baseUrl}${e}`,
@@ -2381,7 +2393,7 @@ class Jn {
2381
2393
  };
2382
2394
  }
2383
2395
  startSession(e, n) {
2384
- return ui(this, void 0, void 0, function* () {
2396
+ return Zt(this, void 0, void 0, function* () {
2385
2397
  if (!this.sessionToken) {
2386
2398
  if (!e)
2387
2399
  throw new V("Persona configuration must be provided when using apiKey", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
@@ -2389,36 +2401,36 @@ class Jn {
2389
2401
  }
2390
2402
  e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
2391
2403
  try {
2392
- const o = `${this.apiVersion}/engine/session`, { url: u, headers: a } = this.buildGatewayUrlAndHeaders(o, {
2404
+ const o = `${this.apiVersion}/engine/session`, { url: l, headers: s } = this.buildGatewayUrlAndHeaders(o, {
2393
2405
  "Content-Type": "application/json",
2394
2406
  Authorization: `Bearer ${this.sessionToken}`
2395
- }), c = yield fetch(u, {
2407
+ }), u = yield fetch(l, {
2396
2408
  method: "POST",
2397
- headers: a,
2409
+ headers: s,
2398
2410
  body: JSON.stringify({
2399
2411
  personaConfig: e,
2400
2412
  sessionOptions: n,
2401
- clientMetadata: Wi
2413
+ clientMetadata: Oi
2402
2414
  })
2403
- }), l = yield c.json(), m = l.error;
2404
- switch (c.status) {
2415
+ }), c = yield u.json(), E = c.error;
2416
+ switch (u.status) {
2405
2417
  case 200:
2406
2418
  case 201:
2407
- return l;
2419
+ return c;
2408
2420
  case 400:
2409
- throw new V("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: l.message });
2421
+ throw new V("Invalid request to start session", j.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: c.message });
2410
2422
  case 401:
2411
- throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: l.message });
2423
+ throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: c.message });
2412
2424
  case 402:
2413
- throw new V("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: l.message });
2425
+ throw new V("Please sign up for a plan to start a session", j.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: c.message });
2414
2426
  case 403:
2415
- throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: l.message });
2427
+ throw new V("Authentication failed when starting session", j.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: c.message });
2416
2428
  case 429:
2417
- throw m === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: l.message }) : m === "Spend cap reached" ? new V("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: l.message }) : new V("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: l.message });
2429
+ throw E === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: c.message }) : E === "Spend cap reached" ? new V("Spend cap reached, please upgrade your plan", j.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: c.message }) : new V("Usage limit reached, please upgrade your plan", j.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: c.message });
2418
2430
  case 503:
2419
- throw new V("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: l.message });
2431
+ throw new V("There are no available personas, please try again later", j.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: c.message });
2420
2432
  default:
2421
- throw new V("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: l.message });
2433
+ throw new V("Unknown error when starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: c.message });
2422
2434
  }
2423
2435
  } catch (o) {
2424
2436
  throw o instanceof V ? o : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: o instanceof Error ? o.message : String(o) });
@@ -2426,22 +2438,22 @@ class Jn {
2426
2438
  });
2427
2439
  }
2428
2440
  unsafe_getSessionToken(e) {
2429
- return ui(this, void 0, void 0, function* () {
2441
+ return Zt(this, void 0, void 0, function* () {
2430
2442
  if (console.warn("Using unsecure method. This method should not be used in production."), !this.apiKey)
2431
2443
  throw new Error("No apiKey provided");
2432
2444
  e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
2433
2445
  let n = {
2434
2446
  clientLabel: "js-sdk-api-key"
2435
2447
  };
2436
- Kn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
2448
+ Bn(e) && (n = Object.assign(Object.assign({}, n), { personaConfig: e }));
2437
2449
  try {
2438
- const o = `${this.apiVersion}/auth/session-token`, { url: u, headers: a } = this.buildGatewayUrlAndHeaders(o, {
2450
+ const o = `${this.apiVersion}/auth/session-token`, { url: l, headers: s } = this.buildGatewayUrlAndHeaders(o, {
2439
2451
  "Content-Type": "application/json",
2440
2452
  Authorization: `Bearer ${this.apiKey}`
2441
2453
  });
2442
- return (yield (yield fetch(u, {
2454
+ return (yield (yield fetch(l, {
2443
2455
  method: "POST",
2444
- headers: a,
2456
+ headers: s,
2445
2457
  body: JSON.stringify(n)
2446
2458
  })).json()).sessionToken;
2447
2459
  } catch {
@@ -2453,67 +2465,67 @@ class Jn {
2453
2465
  return `${this.baseUrl}${this.apiVersion}`;
2454
2466
  }
2455
2467
  }
2456
- var Xn = function(t, e, n, o) {
2457
- function u(a) {
2458
- return a instanceof n ? a : new n(function(c) {
2459
- c(a);
2468
+ var Fn = function(t, e, n, o) {
2469
+ function l(s) {
2470
+ return s instanceof n ? s : new n(function(u) {
2471
+ u(s);
2460
2472
  });
2461
2473
  }
2462
- return new (n || (n = Promise))(function(a, c) {
2463
- function l(_) {
2474
+ return new (n || (n = Promise))(function(s, u) {
2475
+ function c(_) {
2464
2476
  try {
2465
2477
  p(o.next(_));
2466
2478
  } catch (d) {
2467
- c(d);
2479
+ u(d);
2468
2480
  }
2469
2481
  }
2470
- function m(_) {
2482
+ function E(_) {
2471
2483
  try {
2472
2484
  p(o.throw(_));
2473
2485
  } catch (d) {
2474
- c(d);
2486
+ u(d);
2475
2487
  }
2476
2488
  }
2477
2489
  function p(_) {
2478
- _.done ? a(_.value) : u(_.value).then(l, m);
2490
+ _.done ? s(_.value) : l(_.value).then(c, E);
2479
2491
  }
2480
2492
  p((o = o.apply(t, e || [])).next());
2481
2493
  });
2482
2494
  };
2483
- class Zn {
2495
+ class $n {
2484
2496
  constructor(e, n, o) {
2485
2497
  this.baseUrl = e, this.sessionId = n, this.apiGatewayConfig = o;
2486
2498
  }
2487
2499
  sendTalkCommand(e) {
2488
- return Xn(this, void 0, void 0, function* () {
2500
+ return Fn(this, void 0, void 0, function* () {
2489
2501
  var n, o;
2490
2502
  try {
2491
- let u, a = {
2503
+ let l, s = {
2492
2504
  "Content-Type": "application/json"
2493
2505
  };
2494
- const c = "/talk", l = `?session_id=${this.sessionId}`;
2506
+ const u = "/talk", c = `?session_id=${this.sessionId}`;
2495
2507
  if (!((n = this.apiGatewayConfig) === null || n === void 0) && n.enabled && (!((o = this.apiGatewayConfig) === null || o === void 0) && o.baseUrl)) {
2496
- u = `${this.apiGatewayConfig.baseUrl}${c}${l}`;
2497
- const p = new URL(`${this.baseUrl}${c}${l}`);
2498
- a["X-Anam-Target-Url"] = p.href;
2508
+ l = `${this.apiGatewayConfig.baseUrl}${u}${c}`;
2509
+ const p = new URL(`${this.baseUrl}${u}${c}`);
2510
+ s["X-Anam-Target-Url"] = p.href;
2499
2511
  } else
2500
- u = `${this.baseUrl}${c}${l}`;
2501
- const m = yield fetch(u, {
2512
+ l = `${this.baseUrl}${u}${c}`;
2513
+ const E = yield fetch(l, {
2502
2514
  method: "POST",
2503
- headers: a,
2515
+ headers: s,
2504
2516
  body: JSON.stringify({
2505
2517
  content: e
2506
2518
  })
2507
2519
  });
2508
- if (!m.ok)
2509
- throw new Error(`Failed to send talk command: ${m.status} ${m.statusText}`);
2510
- } catch (u) {
2511
- throw console.error(u), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
2520
+ if (!E.ok)
2521
+ throw new Error(`Failed to send talk command: ${E.status} ${E.statusText}`);
2522
+ } catch (l) {
2523
+ throw console.error(l), new Error("EngineApiRestClient - sendTalkCommand: Failed to send talk command");
2512
2524
  }
2513
2525
  });
2514
2526
  }
2515
2527
  }
2516
- class Qn {
2528
+ class Vn {
2517
2529
  constructor() {
2518
2530
  this.listeners = {};
2519
2531
  }
@@ -2529,7 +2541,7 @@ class Qn {
2529
2541
  });
2530
2542
  }
2531
2543
  }
2532
- class er {
2544
+ class Gn {
2533
2545
  constructor(e, n) {
2534
2546
  this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
2535
2547
  }
@@ -2557,27 +2569,27 @@ class er {
2557
2569
  content: e.content,
2558
2570
  role: e.role,
2559
2571
  interrupted: e.interrupted
2560
- }, o = this.messages.findIndex((u) => u.id === n.id);
2572
+ }, o = this.messages.findIndex((l) => l.id === n.id);
2561
2573
  if (o !== -1) {
2562
- const u = this.messages[o];
2563
- this.messages[o] = Object.assign(Object.assign({}, u), { content: u.content + n.content, interrupted: u.interrupted || n.interrupted });
2574
+ const l = this.messages[o];
2575
+ this.messages[o] = Object.assign(Object.assign({}, l), { content: l.content + n.content, interrupted: l.interrupted || n.interrupted });
2564
2576
  } else
2565
2577
  this.messages.push(n);
2566
2578
  }
2567
2579
  processWebRtcTextMessageEvent(e) {
2568
2580
  const n = this.webRtcTextMessageEventToMessageStreamEvent(e);
2569
2581
  switch (this.publicEventEmitter.emit(N.MESSAGE_STREAM_EVENT_RECEIVED, n), n.role) {
2570
- case Qe.USER:
2582
+ case Ke.USER:
2571
2583
  this.processUserMessage(n);
2572
2584
  break;
2573
- case Qe.PERSONA:
2585
+ case Ke.PERSONA:
2574
2586
  this.processPersonaMessage(n);
2575
2587
  break;
2576
2588
  }
2577
2589
  n.endOfSpeech && this.publicEventEmitter.emit(N.MESSAGE_HISTORY_UPDATED, this.messages);
2578
2590
  }
2579
2591
  }
2580
- class tr {
2592
+ class jn {
2581
2593
  constructor() {
2582
2594
  this.listeners = {};
2583
2595
  }
@@ -2588,65 +2600,65 @@ class tr {
2588
2600
  this.listeners[e] && this.listeners[e].delete(n);
2589
2601
  }
2590
2602
  emit(e, ...n) {
2591
- if (e === N.CONNECTION_ESTABLISHED && me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
2592
- const [o, u] = n;
2593
- me(se.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, u ? { details: u } : void 0);
2603
+ if (e === N.CONNECTION_ESTABLISHED && _e(re.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === N.CONNECTION_CLOSED) {
2604
+ const [o, l] = n;
2605
+ _e(re.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, o, l ? { details: l } : void 0);
2594
2606
  }
2595
2607
  this.listeners[e] && this.listeners[e].forEach((o) => {
2596
2608
  o(...n);
2597
2609
  });
2598
2610
  }
2599
2611
  }
2600
- var z;
2612
+ var q;
2601
2613
  (function(t) {
2602
2614
  t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
2603
- })(z || (z = {}));
2604
- var ht = function(t, e, n, o) {
2605
- function u(a) {
2606
- return a instanceof n ? a : new n(function(c) {
2607
- c(a);
2615
+ })(q || (q = {}));
2616
+ var st = function(t, e, n, o) {
2617
+ function l(s) {
2618
+ return s instanceof n ? s : new n(function(u) {
2619
+ u(s);
2608
2620
  });
2609
2621
  }
2610
- return new (n || (n = Promise))(function(a, c) {
2611
- function l(_) {
2622
+ return new (n || (n = Promise))(function(s, u) {
2623
+ function c(_) {
2612
2624
  try {
2613
2625
  p(o.next(_));
2614
2626
  } catch (d) {
2615
- c(d);
2627
+ u(d);
2616
2628
  }
2617
2629
  }
2618
- function m(_) {
2630
+ function E(_) {
2619
2631
  try {
2620
2632
  p(o.throw(_));
2621
2633
  } catch (d) {
2622
- c(d);
2634
+ u(d);
2623
2635
  }
2624
2636
  }
2625
2637
  function p(_) {
2626
- _.done ? a(_.value) : u(_.value).then(l, m);
2638
+ _.done ? s(_.value) : l(_.value).then(c, E);
2627
2639
  }
2628
2640
  p((o = o.apply(t, e || [])).next());
2629
2641
  });
2630
2642
  };
2631
- class ir {
2643
+ class Hn {
2632
2644
  constructor(e, n, o) {
2633
- this.state = z.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2645
+ this.state = q.UNSTARTED, this.correlationId = e, this.internalEventEmitter = n, this.signallingClient = o, this.internalEventEmitter.addListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2634
2646
  }
2635
2647
  onDeactivate() {
2636
2648
  this.internalEventEmitter.removeListener(X.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
2637
2649
  }
2638
2650
  onSignalMessage(e) {
2639
- return ht(this, void 0, void 0, function* () {
2640
- e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = z.INTERRUPTED, this.onDeactivate());
2651
+ return st(this, void 0, void 0, function* () {
2652
+ e.actionType === W.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = q.INTERRUPTED, this.onDeactivate());
2641
2653
  });
2642
2654
  }
2643
2655
  endMessage() {
2644
- return ht(this, void 0, void 0, function* () {
2645
- if (this.state === z.ENDED) {
2656
+ return st(this, void 0, void 0, function* () {
2657
+ if (this.state === q.ENDED) {
2646
2658
  console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
2647
2659
  return;
2648
2660
  }
2649
- if (this.state !== z.STREAMING) {
2661
+ if (this.state !== q.STREAMING) {
2650
2662
  console.warn("Talk stream is not active state: " + this.state);
2651
2663
  return;
2652
2664
  }
@@ -2656,69 +2668,69 @@ class ir {
2656
2668
  endOfSpeech: !0,
2657
2669
  correlationId: this.correlationId
2658
2670
  };
2659
- yield this.signallingClient.sendTalkMessage(e), this.state = z.ENDED, this.onDeactivate();
2671
+ yield this.signallingClient.sendTalkMessage(e), this.state = q.ENDED, this.onDeactivate();
2660
2672
  });
2661
2673
  }
2662
2674
  streamMessageChunk(e, n) {
2663
- return ht(this, void 0, void 0, function* () {
2664
- if (this.state !== z.STREAMING && this.state !== z.UNSTARTED)
2675
+ return st(this, void 0, void 0, function* () {
2676
+ if (this.state !== q.STREAMING && this.state !== q.UNSTARTED)
2665
2677
  throw new Error("Talk stream is not in an active state: " + this.state);
2666
2678
  const o = {
2667
2679
  content: e,
2668
- startOfSpeech: this.state === z.UNSTARTED,
2680
+ startOfSpeech: this.state === q.UNSTARTED,
2669
2681
  endOfSpeech: n,
2670
2682
  correlationId: this.correlationId
2671
2683
  };
2672
- this.state = n ? z.ENDED : z.STREAMING, this.state === z.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
2684
+ this.state = n ? q.ENDED : q.STREAMING, this.state === q.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(o);
2673
2685
  });
2674
2686
  }
2675
2687
  getCorrelationId() {
2676
2688
  return this.correlationId;
2677
2689
  }
2678
2690
  isActive() {
2679
- return this.state === z.STREAMING || this.state === z.UNSTARTED;
2691
+ return this.state === q.STREAMING || this.state === q.UNSTARTED;
2680
2692
  }
2681
2693
  getState() {
2682
2694
  return this.state;
2683
2695
  }
2684
2696
  }
2685
2697
  var J = function(t, e, n, o) {
2686
- function u(a) {
2687
- return a instanceof n ? a : new n(function(c) {
2688
- c(a);
2698
+ function l(s) {
2699
+ return s instanceof n ? s : new n(function(u) {
2700
+ u(s);
2689
2701
  });
2690
2702
  }
2691
- return new (n || (n = Promise))(function(a, c) {
2692
- function l(_) {
2703
+ return new (n || (n = Promise))(function(s, u) {
2704
+ function c(_) {
2693
2705
  try {
2694
2706
  p(o.next(_));
2695
2707
  } catch (d) {
2696
- c(d);
2708
+ u(d);
2697
2709
  }
2698
2710
  }
2699
- function m(_) {
2711
+ function E(_) {
2700
2712
  try {
2701
2713
  p(o.throw(_));
2702
2714
  } catch (d) {
2703
- c(d);
2715
+ u(d);
2704
2716
  }
2705
2717
  }
2706
2718
  function p(_) {
2707
- _.done ? a(_.value) : u(_.value).then(l, m);
2719
+ _.done ? s(_.value) : l(_.value).then(c, E);
2708
2720
  }
2709
2721
  p((o = o.apply(t, e || [])).next());
2710
2722
  });
2711
2723
  };
2712
- const nr = 15e3, rr = 5e3, or = 2;
2713
- class sr {
2714
- constructor(e, n, o, u) {
2715
- var a, c, l, m;
2724
+ const Wn = 15e3, zn = 5e3, qn = 2;
2725
+ class Yn {
2726
+ constructor(e, n, o, l) {
2727
+ var s, u, c, E;
2716
2728
  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 = {
2717
2729
  isMuted: !1,
2718
- permissionState: he.NOT_REQUESTED
2719
- }, 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;
2730
+ permissionState: ue.NOT_REQUESTED
2731
+ }, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.publicEventEmitter = o, this.internalEventEmitter = l, this.apiGatewayConfig = n.apiGateway;
2720
2732
  const { inputAudio: p } = n;
2721
- 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";
2733
+ 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 Ln(e, n.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig), this.engineApiRestClient = new $n(n.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = n.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (u = (s = n.metrics) === null || s === void 0 ? void 0 : s.showPeerConnectionStatsReport) !== null && u !== void 0 ? u : !1, this.peerConnectionStatsReportOutputFormat = (E = (c = n.metrics) === null || c === void 0 ? void 0 : c.peerConnectionStatsReportOutputFormat) !== null && E !== void 0 ? E : "console";
2722
2734
  }
2723
2735
  onInputAudioStateChange(e, n) {
2724
2736
  e.isMuted !== n.isMuted && (n.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
@@ -2744,7 +2756,7 @@ class sr {
2744
2756
  } catch (e) {
2745
2757
  console.error("Failed to collect and send stats:", e);
2746
2758
  }
2747
- }), rr));
2759
+ }), zn));
2748
2760
  }
2749
2761
  sendClientSideMetrics(e) {
2750
2762
  e.forEach((n) => {
@@ -2762,7 +2774,7 @@ class sr {
2762
2774
  return;
2763
2775
  const e = setTimeout(() => {
2764
2776
  this.successMetricPoller && (console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
2765
- }, nr);
2777
+ }, Wn);
2766
2778
  this.successMetricPoller = setInterval(() => J(this, void 0, void 0, function* () {
2767
2779
  if (!this.peerConnection || this.successMetricFired) {
2768
2780
  this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
@@ -2770,11 +2782,11 @@ class sr {
2770
2782
  }
2771
2783
  try {
2772
2784
  const n = yield this.peerConnection.getStats();
2773
- let o = !1, u = null;
2774
- n.forEach((a) => {
2775
- a.type === "inbound-rtp" && a.kind === "video" && (a.framesDecoded !== void 0 && a.framesDecoded > 0 ? (o = !0, u = "framesDecoded") : a.framesReceived !== void 0 && a.framesReceived > 0 ? (o = !0, u = "framesReceived") : a.bytesReceived > 0 && a.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
2776
- a.bytesReceived > 1e5 && (o = !0, u = "bytesReceived"));
2777
- }), o && !this.successMetricFired && (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", u ? { detectionMethod: u } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
2785
+ let o = !1, l = null;
2786
+ n.forEach((s) => {
2787
+ s.type === "inbound-rtp" && s.kind === "video" && (s.framesDecoded !== void 0 && s.framesDecoded > 0 ? (o = !0, l = "framesDecoded") : s.framesReceived !== void 0 && s.framesReceived > 0 ? (o = !0, l = "framesReceived") : s.bytesReceived > 0 && s.packetsReceived > 0 && // Additional check: ensure we've received enough data for actual video
2788
+ s.bytesReceived > 1e5 && (o = !0, l = "bytesReceived"));
2789
+ }), o && !this.successMetricFired && (this.successMetricFired = !0, _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", l ? { detectionMethod: l } : void 0), this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e), this.successMetricPoller = null);
2778
2790
  } catch {
2779
2791
  }
2780
2792
  }), 500);
@@ -2801,8 +2813,8 @@ class sr {
2801
2813
  throw new Error("StreamingClient - changeAudioInputDevice: deviceId is required");
2802
2814
  const n = this.inputAudioState.isMuted;
2803
2815
  try {
2804
- this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((u) => {
2805
- u.stop();
2816
+ this.inputAudioStream && this.inputAudioStream.getAudioTracks().forEach((l) => {
2817
+ l.stop();
2806
2818
  });
2807
2819
  const o = {
2808
2820
  echoCancellation: !0,
@@ -2862,10 +2874,10 @@ class sr {
2862
2874
  });
2863
2875
  }
2864
2876
  startTalkMessageStream(e) {
2865
- return e || (e = Math.random().toString(36).substring(2, 15)), new ir(e, this.internalEventEmitter, this.signallingClient);
2877
+ return e || (e = Math.random().toString(36).substring(2, 15)), new Hn(e, this.internalEventEmitter, this.signallingClient);
2866
2878
  }
2867
2879
  createAgentAudioInputStream(e) {
2868
- return this.agentAudioInputStream = new Wn(e, this.signallingClient), this.agentAudioInputStream;
2880
+ return this.agentAudioInputStream = new Dn(e, this.signallingClient), this.agentAudioInputStream;
2869
2881
  }
2870
2882
  getAgentAudioInputStream() {
2871
2883
  return this.agentAudioInputStream;
@@ -2874,7 +2886,7 @@ class sr {
2874
2886
  return J(this, void 0, void 0, function* () {
2875
2887
  this.peerConnection = new RTCPeerConnection({
2876
2888
  iceServers: this.iceServers,
2877
- iceCandidatePoolSize: or
2889
+ iceCandidatePoolSize: qn
2878
2890
  }), 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) => {
2879
2891
  console.error("Async microphone permission request failed:", e);
2880
2892
  }));
@@ -2892,24 +2904,24 @@ class sr {
2892
2904
  yield this.peerConnection.setRemoteDescription(n), this.connectionReceivedAnswer = !0, this.flushRemoteIceCandidateBuffer();
2893
2905
  break;
2894
2906
  case W.ICE_CANDIDATE:
2895
- const o = e.payload, u = new RTCIceCandidate(o);
2896
- this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(u) : this.remoteIceCandidateBuffer.push(u);
2907
+ const o = e.payload, l = new RTCIceCandidate(o);
2908
+ this.connectionReceivedAnswer ? yield this.peerConnection.addIceCandidate(l) : this.remoteIceCandidateBuffer.push(l);
2897
2909
  break;
2898
2910
  case W.END_SESSION:
2899
- const a = e.payload;
2900
- this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.SERVER_CLOSED_CONNECTION, a), this.shutdown();
2911
+ const s = e.payload;
2912
+ this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.SERVER_CLOSED_CONNECTION, s), this.shutdown();
2901
2913
  break;
2902
2914
  case W.WARNING:
2903
- const c = e.payload;
2904
- console.warn("Warning received from server: " + c), this.publicEventEmitter.emit(N.SERVER_WARNING, c);
2915
+ const u = e.payload;
2916
+ console.warn("Warning received from server: " + u), this.publicEventEmitter.emit(N.SERVER_WARNING, u);
2905
2917
  break;
2906
2918
  case W.TALK_STREAM_INTERRUPTED:
2907
- const l = e.payload;
2908
- this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, l.correlationId);
2919
+ const c = e.payload;
2920
+ this.publicEventEmitter.emit(N.TALK_STREAM_INTERRUPTED, c.correlationId);
2909
2921
  break;
2910
2922
  case W.SESSION_READY:
2911
- const m = e.sessionId;
2912
- this.publicEventEmitter.emit(N.SESSION_READY, m);
2923
+ const E = e.sessionId;
2924
+ this.publicEventEmitter.emit(N.SESSION_READY, E);
2913
2925
  break;
2914
2926
  case W.HEARTBEAT:
2915
2927
  break;
@@ -2951,7 +2963,7 @@ class sr {
2951
2963
  ((e = this.peerConnection) === null || e === void 0 ? void 0 : e.connectionState) === "closed" && (console.error("StreamingClient - onConnectionStateChange: Connection closed"), this.handleWebrtcFailure("The connection to our servers was lost. Please try again."));
2952
2964
  }
2953
2965
  handleWebrtcFailure(e) {
2954
- console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.WEBRTC_FAILURE);
2966
+ console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.WEBRTC_FAILURE);
2955
2967
  try {
2956
2968
  this.stopConnection();
2957
2969
  } catch (n) {
@@ -2964,7 +2976,7 @@ class sr {
2964
2976
  this.videoElement.srcObject = this.videoStream;
2965
2977
  const n = this.videoElement.requestVideoFrameCallback(() => {
2966
2978
  var o;
2967
- (o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, me(se.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
2979
+ (o = this.videoElement) === null || o === void 0 || o.cancelVideoFrameCallback(n), this.publicEventEmitter.emit(N.VIDEO_PLAY_STARTED), this.successMetricFired || (this.successMetricFired = !0, _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_SUCCESS, "1", { detectionMethod: "videoElement" }));
2968
2980
  });
2969
2981
  }
2970
2982
  } else e.track.kind === "audio" && (this.audioStream = e.streams[0], this.publicEventEmitter.emit(N.AUDIO_STREAM_STARTED, this.audioStream));
@@ -2990,16 +3002,16 @@ class sr {
2990
3002
  try {
2991
3003
  const o = JSON.parse(n.data);
2992
3004
  switch (o.messageType) {
2993
- case De.SPEECH_TEXT:
3005
+ case Oe.SPEECH_TEXT:
2994
3006
  this.internalEventEmitter.emit(X.WEBRTC_CHAT_MESSAGE_RECEIVED, o.data);
2995
3007
  break;
2996
- case De.CLIENT_TOOL_EVENT:
2997
- const u = o.data;
2998
- this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
2999
- const a = ar.WebRTCClientToolEventToClientToolEvent(u);
3000
- this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, a);
3008
+ case Oe.CLIENT_TOOL_EVENT:
3009
+ const l = o.data;
3010
+ this.internalEventEmitter.emit(X.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, l);
3011
+ const s = Kn.WebRTCClientToolEventToClientToolEvent(l);
3012
+ this.publicEventEmitter.emit(N.CLIENT_TOOL_EVENT_RECEIVED, s);
3001
3013
  break;
3002
- case De.REASONING_TEXT:
3014
+ case Oe.REASONING_TEXT:
3003
3015
  this.internalEventEmitter.emit(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, o.data);
3004
3016
  break;
3005
3017
  // Unknown message types are silently ignored to maintain forward compatibility
@@ -3017,8 +3029,8 @@ class sr {
3017
3029
  */
3018
3030
  requestMicrophonePermissionAsync() {
3019
3031
  return J(this, void 0, void 0, function* () {
3020
- if (this.inputAudioState.permissionState !== he.PENDING) {
3021
- this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
3032
+ if (this.inputAudioState.permissionState !== ue.PENDING) {
3033
+ this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.PENDING }), this.publicEventEmitter.emit(N.MIC_PERMISSION_PENDING);
3022
3034
  try {
3023
3035
  const e = {
3024
3036
  echoCancellation: !0
@@ -3027,9 +3039,9 @@ class sr {
3027
3039
  exact: this.audioDeviceId
3028
3040
  }), this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
3029
3041
  audio: e
3030
- }), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.GRANTED }), this.publicEventEmitter.emit(N.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
3042
+ }), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.GRANTED }), this.publicEventEmitter.emit(N.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
3031
3043
  } catch (e) {
3032
- console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: he.DENIED });
3044
+ console.error("Failed to get microphone permission:", e), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: ue.DENIED });
3033
3045
  const n = e instanceof Error ? e.message : String(e);
3034
3046
  this.publicEventEmitter.emit(N.MIC_PERMISSION_DENIED, n);
3035
3047
  }
@@ -3048,15 +3060,15 @@ class sr {
3048
3060
  return;
3049
3061
  }
3050
3062
  this.inputAudioState.isMuted && this.muteAllAudioTracks();
3051
- const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((u) => {
3052
- var a;
3053
- return ((a = u.track) === null || a === void 0 ? void 0 : a.kind) === "audio" || u.track === null && u.dtmf !== null;
3063
+ const e = this.inputAudioStream.getAudioTracks()[0], o = this.peerConnection.getSenders().find((l) => {
3064
+ var s;
3065
+ return ((s = l.track) === null || s === void 0 ? void 0 : s.kind) === "audio" || l.track === null && l.dtmf !== null;
3054
3066
  });
3055
3067
  if (o)
3056
3068
  try {
3057
3069
  yield o.replaceTrack(e);
3058
- } catch (u) {
3059
- console.error("Failed to replace audio track:", u), this.peerConnection.addTrack(e, this.inputAudioStream);
3070
+ } catch (l) {
3071
+ console.error("Failed to replace audio track:", l), this.peerConnection.addTrack(e, this.inputAudioStream);
3060
3072
  }
3061
3073
  else
3062
3074
  this.peerConnection.addTrack(e, this.inputAudioStream);
@@ -3086,7 +3098,7 @@ class sr {
3086
3098
  if (this.showPeerConnectionStatsReport) {
3087
3099
  const n = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
3088
3100
  if (n) {
3089
- const o = jn(n, this.peerConnectionStatsReportOutputFormat);
3101
+ const o = On(n, this.peerConnectionStatsReportOutputFormat);
3090
3102
  o && console.log(o, void 0, 2);
3091
3103
  }
3092
3104
  }
@@ -3111,7 +3123,7 @@ class sr {
3111
3123
  });
3112
3124
  }
3113
3125
  }
3114
- class ar {
3126
+ class Kn {
3115
3127
  /**
3116
3128
  * Converts a WebRtcClientToolEvent to a ClientToolEvent
3117
3129
  */
@@ -3127,7 +3139,7 @@ class ar {
3127
3139
  };
3128
3140
  }
3129
3141
  }
3130
- class lr {
3142
+ class Jn {
3131
3143
  constructor(e, n) {
3132
3144
  this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = n, this.internalEventEmitter.addListener(X.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
3133
3145
  }
@@ -3146,80 +3158,80 @@ class lr {
3146
3158
  id: n.id,
3147
3159
  content: n.content,
3148
3160
  role: n.role
3149
- }, u = this.reasoning_messages.findIndex((a) => a.id === o.id);
3150
- if (u !== -1) {
3151
- const a = this.reasoning_messages[u];
3152
- a.content += o.content, this.reasoning_messages[u] = a;
3161
+ }, l = this.reasoning_messages.findIndex((s) => s.id === o.id);
3162
+ if (l !== -1) {
3163
+ const s = this.reasoning_messages[l];
3164
+ s.content += o.content, this.reasoning_messages[l] = s;
3153
3165
  } else
3154
3166
  this.reasoning_messages.push(o);
3155
3167
  n.endOfThought && this.publicEventEmitter.emit(N.REASONING_HISTORY_UPDATED, this.reasoning_messages);
3156
3168
  }
3157
3169
  }
3158
- var ce = function(t, e, n, o) {
3159
- function u(a) {
3160
- return a instanceof n ? a : new n(function(c) {
3161
- c(a);
3170
+ var ae = function(t, e, n, o) {
3171
+ function l(s) {
3172
+ return s instanceof n ? s : new n(function(u) {
3173
+ u(s);
3162
3174
  });
3163
3175
  }
3164
- return new (n || (n = Promise))(function(a, c) {
3165
- function l(_) {
3176
+ return new (n || (n = Promise))(function(s, u) {
3177
+ function c(_) {
3166
3178
  try {
3167
3179
  p(o.next(_));
3168
3180
  } catch (d) {
3169
- c(d);
3181
+ u(d);
3170
3182
  }
3171
3183
  }
3172
- function m(_) {
3184
+ function E(_) {
3173
3185
  try {
3174
3186
  p(o.throw(_));
3175
3187
  } catch (d) {
3176
- c(d);
3188
+ u(d);
3177
3189
  }
3178
3190
  }
3179
3191
  function p(_) {
3180
- _.done ? a(_.value) : u(_.value).then(l, m);
3192
+ _.done ? s(_.value) : l(_.value).then(c, E);
3181
3193
  }
3182
3194
  p((o = o.apply(t, e || [])).next());
3183
3195
  });
3184
3196
  };
3185
- class cr {
3197
+ class Xn {
3186
3198
  constructor(e, n, o) {
3187
- var u, a, c, l, m;
3199
+ var l, s, u, c, E;
3188
3200
  this.inputAudioState = {
3189
3201
  isMuted: !1,
3190
- permissionState: he.NOT_REQUESTED
3202
+ permissionState: ue.NOT_REQUESTED
3191
3203
  }, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
3192
3204
  const p = this.validateClientConfig(e, n, o);
3193
3205
  if (p)
3194
3206
  throw new V(p, j.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
3195
- 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 || zi, o.api.apiVersion || xt), !((l = (c = o?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && Vn(o.api.apiGateway), !((m = o?.metrics) === null || m === void 0) && m.disableClientMetrics && Gn(!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
+ this.personaConfig = n, this.clientOptions = o, (!((l = o?.api) === null || l === void 0) && l.baseUrl || !((s = o?.api) === null || s === void 0) && s.apiVersion) && Rn(o.api.baseUrl || ki, o.api.apiVersion || wt), !((c = (u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway) === null || c === void 0) && c.enabled && Nn(o.api.apiGateway), !((E = o?.metrics) === null || E === void 0) && E.disableClientMetrics && xn(!0), this.publicEventEmitter = new jn(), this.internalEventEmitter = new Vn(), this.apiClient = new Pn(e, o?.apiKey, o?.api), this.messageHistoryClient = new Gn(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new Jn(this.publicEventEmitter, this.internalEventEmitter);
3196
3208
  }
3197
3209
  decodeJwt(e) {
3198
3210
  try {
3199
- const n = e.split(".")[1], o = Ln.Buffer.from(n, "base64").toString("utf8");
3211
+ const n = e.split(".")[1], o = In.Buffer.from(n, "base64").toString("utf8");
3200
3212
  return JSON.parse(o);
3201
3213
  } catch {
3202
3214
  throw new Error("Invalid session token format");
3203
3215
  }
3204
3216
  }
3205
3217
  validateClientConfig(e, n, o) {
3206
- var u, a;
3218
+ var l, s;
3207
3219
  if (!e && !o?.apiKey)
3208
3220
  return "Either sessionToken or apiKey must be provided";
3209
3221
  if (o?.apiKey && e)
3210
3222
  return "Only one of sessionToken or apiKey should be used";
3211
- const c = Hn((u = o?.api) === null || u === void 0 ? void 0 : u.apiGateway);
3212
- if (c)
3213
- return c;
3223
+ const u = kn((l = o?.api) === null || l === void 0 ? void 0 : l.apiGateway);
3224
+ if (u)
3225
+ return u;
3214
3226
  if (e) {
3215
- const l = this.decodeJwt(e);
3216
- this.organizationId = l.accountId, Se({
3227
+ const c = this.decodeJwt(e);
3228
+ this.organizationId = c.accountId, ve({
3217
3229
  organizationId: this.organizationId
3218
3230
  });
3219
- const m = (a = l.type) === null || a === void 0 ? void 0 : a.toLowerCase();
3220
- if (m === "legacy")
3231
+ const E = (s = c.type) === null || s === void 0 ? void 0 : s.toLowerCase();
3232
+ if (E === "legacy")
3221
3233
  return "Legacy session tokens are no longer supported. Please define your persona when creating your session token. See https://docs.anam.ai/resources/migrating-legacy for more information.";
3222
- if ((m === "ephemeral" || m === "stateful") && n)
3234
+ if ((E === "ephemeral" || E === "stateful") && n)
3223
3235
  return "This session token already contains a persona configuration. Please remove the personaConfig parameter.";
3224
3236
  } else if (!n)
3225
3237
  return "Missing persona config. Persona configuration must be provided when using apiKey";
@@ -3241,45 +3253,45 @@ class cr {
3241
3253
  return n;
3242
3254
  }
3243
3255
  startSession(e) {
3244
- return ce(this, void 0, void 0, function* () {
3245
- var n, o, u, a, c, l, m, p, _, d, S, g;
3246
- const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: R, engineProtocol: M, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Y, maxWsReconnectionAttempts: ne, iceServers: $ } = b;
3247
- this.sessionId = I, Se({
3256
+ return ae(this, void 0, void 0, function* () {
3257
+ var n, o, l, s, u, c, E, p, _, d, S, g;
3258
+ const y = this.personaConfig, C = this.buildStartSessionOptionsForClient(), A = yield this.apiClient.startSession(y, C), { sessionId: I, clientConfig: b, engineHost: R, engineProtocol: M, signallingEndpoint: x } = A, { heartbeatIntervalSeconds: Y, maxWsReconnectionAttempts: te, iceServers: $ } = b;
3259
+ this.sessionId = I, ve({
3248
3260
  sessionId: this.sessionId
3249
3261
  });
3250
- const re = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : $;
3262
+ const ie = !((n = this.clientOptions) === null || n === void 0) && n.iceServers ? this.clientOptions.iceServers : $;
3251
3263
  try {
3252
- this.streamingClient = new sr(I, {
3264
+ this.streamingClient = new Yn(I, {
3253
3265
  engine: {
3254
3266
  baseUrl: `${M}://${R}`
3255
3267
  },
3256
3268
  signalling: {
3257
3269
  heartbeatIntervalSeconds: Y,
3258
- maxWsReconnectionAttempts: ne,
3270
+ maxWsReconnectionAttempts: te,
3259
3271
  url: {
3260
3272
  baseUrl: R,
3261
3273
  protocol: M,
3262
3274
  signallingPath: x
3263
3275
  }
3264
3276
  },
3265
- iceServers: re,
3277
+ iceServers: ie,
3266
3278
  inputAudio: {
3267
3279
  inputAudioState: this.inputAudioState,
3268
3280
  userProvidedMediaStream: !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio ? void 0 : e,
3269
- audioDeviceId: (u = this.clientOptions) === null || u === void 0 ? void 0 : u.audioDeviceId,
3270
- disableInputAudio: (a = this.clientOptions) === null || a === void 0 ? void 0 : a.disableInputAudio
3281
+ audioDeviceId: (l = this.clientOptions) === null || l === void 0 ? void 0 : l.audioDeviceId,
3282
+ disableInputAudio: (s = this.clientOptions) === null || s === void 0 ? void 0 : s.disableInputAudio
3271
3283
  },
3272
- apiGateway: (l = (c = this.clientOptions) === null || c === void 0 ? void 0 : c.api) === null || l === void 0 ? void 0 : l.apiGateway,
3284
+ apiGateway: (c = (u = this.clientOptions) === null || u === void 0 ? void 0 : u.api) === null || c === void 0 ? void 0 : c.apiGateway,
3273
3285
  metrics: {
3274
- showPeerConnectionStatsReport: (_ = (p = (m = this.clientOptions) === null || m === void 0 ? void 0 : m.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
3286
+ showPeerConnectionStatsReport: (_ = (p = (E = this.clientOptions) === null || E === void 0 ? void 0 : E.metrics) === null || p === void 0 ? void 0 : p.showPeerConnectionStatsReport) !== null && _ !== void 0 ? _ : !1,
3275
3287
  peerConnectionStatsReportOutputFormat: (g = (S = (d = this.clientOptions) === null || d === void 0 ? void 0 : d.metrics) === null || S === void 0 ? void 0 : S.peerConnectionStatsReportOutputFormat) !== null && g !== void 0 ? g : "console"
3276
3288
  }
3277
3289
  }, this.publicEventEmitter, this.internalEventEmitter);
3278
- } catch (oe) {
3279
- throw Se({
3290
+ } catch (ne) {
3291
+ throw ve({
3280
3292
  sessionId: null
3281
3293
  }), new V("Failed to initialize streaming client", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3282
- cause: oe instanceof Error ? oe.message : String(oe),
3294
+ cause: ne instanceof Error ? ne.message : String(ne),
3283
3295
  sessionId: I
3284
3296
  });
3285
3297
  }
@@ -3287,7 +3299,7 @@ class cr {
3287
3299
  });
3288
3300
  }
3289
3301
  startSessionIfNeeded(e) {
3290
- return ce(this, void 0, void 0, function* () {
3302
+ return ae(this, void 0, void 0, function* () {
3291
3303
  if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e), !this.sessionId || !this.streamingClient))
3292
3304
  throw new V("Session ID or streaming client is not available after starting session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3293
3305
  cause: "Failed to initialize session properly"
@@ -3295,24 +3307,24 @@ class cr {
3295
3307
  });
3296
3308
  }
3297
3309
  stream(e) {
3298
- return ce(this, void 0, void 0, function* () {
3310
+ return ae(this, void 0, void 0, function* () {
3299
3311
  var n;
3300
3312
  if (this._isStreaming)
3301
3313
  throw new Error("Already streaming");
3302
- const o = ci();
3303
- return Se({
3314
+ const o = Xt();
3315
+ return ve({
3304
3316
  attemptCorrelationId: o,
3305
3317
  sessionId: null
3306
3318
  // reset sessionId
3307
- }), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio && e && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored."), yield this.startSessionIfNeeded(e), this._isStreaming = !0, new Promise((u) => {
3308
- var a;
3309
- const c = [];
3310
- let l = !1, m = !1;
3319
+ }), _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio && e && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored."), yield this.startSessionIfNeeded(e), this._isStreaming = !0, new Promise((l) => {
3320
+ var s;
3321
+ const u = [];
3322
+ let c = !1, E = !1;
3311
3323
  this.publicEventEmitter.addListener(N.VIDEO_STREAM_STARTED, (p) => {
3312
- c.push(p), l = !0, m && u(c);
3324
+ u.push(p), c = !0, E && l(u);
3313
3325
  }), this.publicEventEmitter.addListener(N.AUDIO_STREAM_STARTED, (p) => {
3314
- c.push(p), m = !0, l && u(c);
3315
- }), (a = this.streamingClient) === null || a === void 0 || a.startConnection();
3326
+ u.push(p), E = !0, c && l(u);
3327
+ }), (s = this.streamingClient) === null || s === void 0 || s.startConnection();
3316
3328
  });
3317
3329
  });
3318
3330
  }
@@ -3320,24 +3332,24 @@ class cr {
3320
3332
  * @deprecated This method is deprecated. Please use streamToVideoElement instead.
3321
3333
  */
3322
3334
  streamToVideoAndAudioElements(e, n, o) {
3323
- return ce(this, void 0, void 0, function* () {
3335
+ return ae(this, void 0, void 0, function* () {
3324
3336
  console.warn("AnamClient: streamToVideoAndAudioElements is deprecated. To avoid possible audio issues, please use streamToVideoElement instead."), yield this.streamToVideoElement(e, o);
3325
3337
  });
3326
3338
  }
3327
3339
  streamToVideoElement(e, n) {
3328
- return ce(this, void 0, void 0, function* () {
3340
+ return ae(this, void 0, void 0, function* () {
3329
3341
  var o;
3330
- const u = ci();
3331
- Se({
3332
- attemptCorrelationId: u,
3342
+ const l = Xt();
3343
+ ve({
3344
+ attemptCorrelationId: l,
3333
3345
  sessionId: null
3334
3346
  // reset sessionId
3335
- }), me(se.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio && n && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored.");
3347
+ }), _e(re.CLIENT_METRIC_MEASUREMENT_SESSION_ATTEMPT, "1"), !((o = this.clientOptions) === null || o === void 0) && o.disableInputAudio && n && console.warn("AnamClient:Input audio is disabled. User provided audio stream will be ignored.");
3336
3348
  try {
3337
3349
  yield this.startSessionIfNeeded(n);
3338
- } catch (a) {
3339
- throw a instanceof V ? a : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3340
- cause: a instanceof Error ? a.message : String(a),
3350
+ } catch (s) {
3351
+ throw s instanceof V ? s : new V("Failed to start session", j.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
3352
+ cause: s instanceof Error ? s.message : String(s),
3341
3353
  sessionId: this.sessionId
3342
3354
  });
3343
3355
  }
@@ -3354,7 +3366,7 @@ class cr {
3354
3366
  * @throws Error if session is not started or not currently streaming
3355
3367
  */
3356
3368
  talk(e) {
3357
- return ce(this, void 0, void 0, function* () {
3369
+ return ae(this, void 0, void 0, function* () {
3358
3370
  if (!this.streamingClient)
3359
3371
  throw new Error("Failed to send talk command: session is not started. Have you called startSession?");
3360
3372
  if (!this._isStreaming)
@@ -3384,13 +3396,13 @@ class cr {
3384
3396
  const n = this.getActiveSessionId();
3385
3397
  if (!n)
3386
3398
  throw new Error("Failed to send user message: no active session");
3387
- const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""), u = JSON.stringify({
3399
+ const o = (/* @__PURE__ */ new Date()).toISOString().replace("Z", ""), l = JSON.stringify({
3388
3400
  content: e,
3389
3401
  timestamp: o,
3390
3402
  session_id: n,
3391
3403
  message_type: "speech"
3392
3404
  });
3393
- this.sendDataMessage(u);
3405
+ this.sendDataMessage(l);
3394
3406
  }
3395
3407
  interruptPersona() {
3396
3408
  if (!this._isStreaming)
@@ -3407,8 +3419,8 @@ class cr {
3407
3419
  this.sendDataMessage(n);
3408
3420
  }
3409
3421
  stopStreaming() {
3410
- return ce(this, void 0, void 0, function* () {
3411
- this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, pe.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Se({
3422
+ return ae(this, void 0, void 0, function* () {
3423
+ this.streamingClient && (this.publicEventEmitter.emit(N.CONNECTION_CLOSED, he.NORMAL), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, ve({
3412
3424
  attemptCorrelationId: null,
3413
3425
  sessionId: null,
3414
3426
  organizationId: this.organizationId
@@ -3437,7 +3449,7 @@ class cr {
3437
3449
  return !((e = this.clientOptions) === null || e === void 0) && e.disableInputAudio && console.warn("AnamClient: Input audio is disabled. Unmuting input audio will have no effect."), this.streamingClient && !(!((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio) ? this.inputAudioState = this.streamingClient.unmuteInputAudio() : this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { isMuted: !1 }), this.inputAudioState;
3438
3450
  }
3439
3451
  changeAudioInputDevice(e) {
3440
- return ce(this, void 0, void 0, function* () {
3452
+ return ae(this, void 0, void 0, function* () {
3441
3453
  var n;
3442
3454
  if (!((n = this.clientOptions) === null || n === void 0) && n.disableInputAudio)
3443
3455
  throw new Error("AnamClient: Cannot change audio input device because input audio is disabled.");
@@ -3473,8 +3485,11 @@ class cr {
3473
3485
  return this.sessionId;
3474
3486
  }
3475
3487
  }
3476
- const ur = (t, e) => new cr(t, void 0, e), dr = "https://api.anam.ai";
3477
- function hr(t) {
3488
+ const Zn = (t, e) => new Xn(t, void 0, e), Qn = "https://api.anam.ai";
3489
+ function Ui(t) {
3490
+ return /^[a-zA-Z0-9_-]{1,128}$/.test(t);
3491
+ }
3492
+ function er(t) {
3478
3493
  try {
3479
3494
  const e = t.split(".")[1];
3480
3495
  return JSON.parse(atob(e));
@@ -3482,189 +3497,235 @@ function hr(t) {
3482
3497
  return {};
3483
3498
  }
3484
3499
  }
3485
- const Z = q(null), te = q("idle"), Be = q(!1), Ye = q(!1), ot = q([]), Pe = q(null), et = q(null), Ot = q(null), kt = q(null), Dt = q(null), Mt = q(null), di = q(!1), tt = q(!1);
3486
- function fr(t, e) {
3500
+ function tr(t, e) {
3487
3501
  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.";
3488
3502
  }
3489
- async function pr(t, e) {
3490
- tt.value = !1;
3503
+ function ir() {
3504
+ return {
3505
+ client: z(null),
3506
+ connectionStatus: z("idle"),
3507
+ isStreaming: z(!1),
3508
+ isMuted: z(!1),
3509
+ messages: z([]),
3510
+ error: z(null),
3511
+ sessionId: z(null),
3512
+ avatarThumbnailUrl: z(null),
3513
+ avatarVideoUrl: z(null),
3514
+ personaName: z(null),
3515
+ serverConfig: z(null),
3516
+ isConfigured: z(!1),
3517
+ isReady: z(!1),
3518
+ generation: 0
3519
+ };
3520
+ }
3521
+ async function nr(t, e, n) {
3522
+ if (t.isReady.value = !1, !Ui(e)) {
3523
+ console.error("[AnamWidget] Invalid agent ID format:", e);
3524
+ return;
3525
+ }
3491
3526
  try {
3492
- const n = await fetch(`${e}/v1/personas/${t}/widget`);
3493
- if (!n.ok) return;
3494
- const o = await n.json();
3495
- Ot.value = o.persona?.avatarImageUrl || null, kt.value = o.persona?.avatarVideoUrl || null, Dt.value = o.persona?.name || null, Mt.value = o.widgetConfig || null;
3496
- } catch {
3497
- } finally {
3498
- tt.value = !0;
3527
+ const o = await fetch(`${n}/v1/personas/${e}/widget`);
3528
+ if (!o.ok) {
3529
+ const s = o.status === 404 ? "Agent not found. Check your agent ID." : o.status === 401 || o.status === 403 ? "Not authorized. Check your agent ID." : "Server error. Please try again later.";
3530
+ console.error(`[AnamWidget] Failed to load widget config: ${s}`);
3531
+ return;
3532
+ }
3533
+ const l = await o.json();
3534
+ t.avatarThumbnailUrl.value = l.persona?.avatarImageUrl || null, t.avatarVideoUrl.value = l.persona?.avatarVideoUrl || null, t.personaName.value = l.persona?.name || null, t.serverConfig.value = l.widgetConfig || null, t.isReady.value = !0;
3535
+ } catch (o) {
3536
+ console.error("[AnamWidget] Failed to load widget config:", o);
3499
3537
  }
3500
3538
  }
3501
- async function _r(t, e, n, o) {
3502
- if (te.value === "connecting" || te.value === "connected")
3539
+ async function rr(t, e, n, o, l) {
3540
+ if (t.connectionStatus.value === "connecting" || t.connectionStatus.value === "connected")
3503
3541
  return;
3504
- te.value = "connecting", Pe.value = null;
3542
+ const s = ++t.generation;
3543
+ t.connectionStatus.value = "connecting", t.error.value = null;
3505
3544
  let u;
3506
3545
  try {
3507
- let a;
3508
- if (o)
3509
- console.log("[AnamWidget] Using pre-created session token"), a = o;
3546
+ let c;
3547
+ if (l)
3548
+ console.log("[AnamWidget] Using pre-created session token"), c = l;
3510
3549
  else {
3511
- console.log("[AnamWidget] Fetching session for agent:", t);
3512
- const m = await fetch(`${e}/v1/auth/widget`, {
3550
+ if (!Ui(e))
3551
+ throw new Error("Invalid agent ID format");
3552
+ console.log("[AnamWidget] Fetching session for agent:", e);
3553
+ const _ = await fetch(`${n}/v1/auth/widget`, {
3513
3554
  method: "POST",
3514
3555
  headers: { "Content-Type": "application/json" },
3515
- body: JSON.stringify({ agentId: t })
3556
+ body: JSON.stringify({ agentId: e })
3516
3557
  });
3517
- if (u = m.status, !m.ok) {
3518
- const _ = await m.json().catch(() => ({}));
3519
- throw new Error(_.error || `HTTP ${m.status}`);
3558
+ if (s !== t.generation) return;
3559
+ if (u = _.status, !_.ok) {
3560
+ const S = await _.json().catch(() => ({}));
3561
+ throw new Error(S.error || `HTTP ${_.status}`);
3520
3562
  }
3521
- const p = await m.json();
3563
+ const d = await _.json();
3522
3564
  console.log("[AnamWidget] Got session from agent-id:", {
3523
- hasToken: !!p.sessionToken
3524
- }), a = p.sessionToken;
3565
+ hasToken: !!d.sessionToken
3566
+ }), c = d.sessionToken;
3525
3567
  }
3526
- const c = ur(a, {
3527
- api: e ? { baseUrl: e } : void 0,
3568
+ if (s !== t.generation) return;
3569
+ const E = Zn(c, {
3570
+ api: n ? { baseUrl: n } : void 0,
3528
3571
  metrics: { disableClientMetrics: !0 }
3529
3572
  });
3530
- c.addListener(N.CONNECTION_ESTABLISHED, () => {
3531
- console.log("[AnamWidget] Connection established"), te.value = "connected";
3532
- }), c.addListener(N.VIDEO_STREAM_STARTED, () => {
3533
- console.log("[AnamWidget] Video stream started"), Be.value = !0;
3534
- }), c.addListener(N.AUDIO_STREAM_STARTED, () => {
3573
+ E.addListener(N.CONNECTION_ESTABLISHED, () => {
3574
+ s === t.generation && (console.log("[AnamWidget] Connection established"), t.connectionStatus.value = "connected");
3575
+ }), E.addListener(N.VIDEO_STREAM_STARTED, () => {
3576
+ s === t.generation && (console.log("[AnamWidget] Video stream started"), t.isStreaming.value = !0);
3577
+ }), E.addListener(N.AUDIO_STREAM_STARTED, () => {
3535
3578
  console.log("[AnamWidget] Audio stream started");
3536
- }), c.addListener(N.MESSAGE_HISTORY_UPDATED, (m) => {
3537
- ot.value = [...m];
3538
- }), c.addListener(N.CONNECTION_CLOSED, (m, p) => {
3539
- console.log("[AnamWidget] Connection closed:", m, p), te.value = "idle", Be.value = !1, et.value = null;
3540
- }), c.addListener(N.SESSION_READY, (m) => {
3541
- console.log("[AnamWidget] Session ready:", m), et.value = m;
3542
- }), Z.value = c;
3543
- const l = await c.stream();
3544
- if (n && l.length > 0) {
3545
- const m = l.find((p) => p.getVideoTracks().length > 0);
3546
- m && (n.srcObject = m);
3547
- }
3548
- } catch (a) {
3549
- console.error("[AnamWidget] Failed to start session:", a), Pe.value = fr(a, u), te.value = "error", Z.value = null;
3550
- }
3551
- }
3552
- async function Er() {
3553
- if (Z.value)
3579
+ }), E.addListener(N.MESSAGE_HISTORY_UPDATED, (_) => {
3580
+ s === t.generation && (t.messages.value = [..._]);
3581
+ }), E.addListener(N.CONNECTION_CLOSED, (_, d) => {
3582
+ s === t.generation && (console.log("[AnamWidget] Connection closed:", _, d), t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.sessionId.value = null);
3583
+ }), E.addListener(N.SESSION_READY, (_) => {
3584
+ s === t.generation && (console.log("[AnamWidget] Session ready:", _), t.sessionId.value = _);
3585
+ });
3586
+ const p = await E.stream();
3587
+ if (s !== t.generation) {
3588
+ try {
3589
+ await E.stopStreaming();
3590
+ } catch {
3591
+ }
3592
+ return;
3593
+ }
3594
+ if (t.client.value = E, o && p.length > 0) {
3595
+ const _ = p.find((d) => d.getVideoTracks().length > 0);
3596
+ _ && (o.srcObject = _);
3597
+ }
3598
+ } catch (c) {
3599
+ if (s !== t.generation) return;
3600
+ console.error("[AnamWidget] Failed to start session:", c), t.error.value = tr(c, u), t.connectionStatus.value = "error", t.client.value = null;
3601
+ }
3602
+ }
3603
+ async function or(t) {
3604
+ if (t.generation++, t.client.value)
3554
3605
  try {
3555
- await Z.value.stopStreaming();
3556
- } catch (t) {
3557
- console.error("[AnamWidget] Failed to stop session:", t);
3606
+ await t.client.value.stopStreaming();
3607
+ } catch (e) {
3608
+ console.error("[AnamWidget] Failed to stop session:", e);
3558
3609
  }
3559
- Z.value = null, te.value = "idle", Be.value = !1, ot.value = [];
3610
+ t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, t.messages.value = [];
3560
3611
  }
3561
- function mr(t) {
3562
- !Z.value || te.value !== "connected" || Z.value.sendUserMessage(t);
3612
+ function sr(t, e) {
3613
+ !t.client.value || t.connectionStatus.value !== "connected" || t.client.value.sendUserMessage(e);
3563
3614
  }
3564
- function gr() {
3565
- Z.value && (Ye.value ? (Z.value.unmuteInputAudio(), Ye.value = !1) : (Z.value.muteInputAudio(), Ye.value = !0));
3615
+ function ar(t) {
3616
+ t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1) : (t.client.value.muteInputAudio(), t.isMuted.value = !0));
3566
3617
  }
3567
- function vr() {
3568
- Z.value?.isStreaming() && Z.value.stopStreaming(), Z.value = null, te.value = "idle", Be.value = !1, ot.value = [], Pe.value = null, et.value = null, Ot.value = null, kt.value = null, Dt.value = null, Mt.value = null;
3618
+ function lr(t) {
3619
+ t.generation++, t.client.value?.isStreaming() && t.client.value.stopStreaming(), t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, t.messages.value = [], t.error.value = null, t.sessionId.value = null, t.avatarThumbnailUrl.value = null, t.avatarVideoUrl.value = null, t.personaName.value = null, t.serverConfig.value = null;
3569
3620
  }
3570
- function yr(t, e, n) {
3571
- const o = t || (n ? hr(n).personaId : void 0);
3572
- di.value = !!o || !!n;
3573
- const u = e || dr;
3621
+ function cr(t, e, n) {
3622
+ const o = ze();
3623
+ o.current || (o.current = ir());
3624
+ const l = o.current, s = t || (n ? er(n).personaId : void 0), u = !!s || !!n;
3625
+ l.isConfigured.value !== u && (l.isConfigured.value = u);
3626
+ const c = e || Qn;
3574
3627
  return {
3575
- connectionStatus: te,
3576
- isStreaming: Be,
3577
- isMuted: Ye,
3578
- messages: ot,
3579
- error: Pe,
3580
- sessionId: et,
3581
- isConfigured: di,
3582
- isReady: tt,
3583
- avatarThumbnailUrl: Ot,
3584
- avatarVideoUrl: kt,
3585
- personaName: Dt,
3586
- serverConfig: Mt,
3628
+ connectionStatus: l.connectionStatus,
3629
+ isStreaming: l.isStreaming,
3630
+ isMuted: l.isMuted,
3631
+ messages: l.messages,
3632
+ error: l.error,
3633
+ sessionId: l.sessionId,
3634
+ isConfigured: l.isConfigured,
3635
+ isReady: l.isReady,
3636
+ avatarThumbnailUrl: l.avatarThumbnailUrl,
3637
+ avatarVideoUrl: l.avatarVideoUrl,
3638
+ personaName: l.personaName,
3639
+ serverConfig: l.serverConfig,
3587
3640
  fetchWidgetConfig: () => {
3588
- if (!o) {
3589
- tt.value = !0;
3641
+ if (!s) {
3642
+ l.isReady.value = !0;
3590
3643
  return;
3591
3644
  }
3592
- pr(o, u);
3645
+ nr(l, s, c);
3593
3646
  },
3594
- startSession: (l) => !o && !n ? (Pe.value = "No agent ID or session token configured", Promise.resolve()) : _r(o || "", u, l, n),
3595
- stopSession: Er,
3596
- sendMessage: mr,
3597
- toggleMute: gr,
3598
- cleanup: vr
3647
+ startSession: (E) => !s && !n ? (l.error.value = "No agent ID or session token configured", Promise.resolve()) : rr(l, s || "", c, E, n),
3648
+ stopSession: () => or(l),
3649
+ sendMessage: (E) => sr(l, E),
3650
+ toggleMute: () => ar(l),
3651
+ cleanup: () => lr(l)
3599
3652
  };
3600
3653
  }
3601
- const hi = '@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}.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-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:#18181b;-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-layout=floating]{position:fixed}.anam-widget[data-layout=inline]{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-layout=inline] .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-preview-video{object-fit:cover;z-index:1;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-preview-fallback{z-index:0;position:absolute;inset:0}.anam-cta-pill{z-index:2;-webkit-backdrop-filter:blur(8px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#ffffff24;border:1px solid #ffffff38;border-radius:999px;align-items:center;gap:12px;min-width:200px;padding:12px 26px;font-family:inherit;font-size:16px;font-weight:600;transition:all .2s;display:flex;position:absolute;bottom:20px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#ffffff38;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 #ffffff38;border-radius:50%;justify-content:center;align-items:center;width:44px;height:44px;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);justify-content:center;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 #ffffff38;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-input-wrap{flex:1;align-items:center;min-width:0;margin-right:56px;display:flex;position:relative}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff38;border-radius:999px;outline:none;width:100%;padding:11px 44px 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}.anam-ctl-send{color:#ffffff80;cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:color .15s;display:flex;position:absolute;right:6px}.anam-ctl-send:hover{color:#fff}.anam-ctl-send:disabled{opacity:.35;cursor:not-allowed}.anam-watermark{z-index:11;opacity:.5;line-height:0;text-decoration:none;transition:opacity .15s;position:absolute;top:16px;left:16px}.anam-watermark:hover{opacity:.8}@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}';
3602
- function wt(t, e) {
3654
+ const ur = '@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}.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-trigger-size:80px;--anam-sheet-width:400px;--anam-sheet-height:640px;all:initial;color:#18181b;-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-layout=floating]{position:fixed}.anam-widget[data-layout=inline]{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-layout=inline] .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-preview-video{object-fit:cover;z-index:1;width:100%;height:100%;display:block;position:absolute;inset:0}.anam-preview-fallback{z-index:0;position:absolute;inset:0}.anam-cta-pill{z-index:2;-webkit-backdrop-filter:blur(8px);color:#fff;letter-spacing:-.01em;cursor:pointer;white-space:nowrap;background:#ffffff24;border:1px solid #ffffff38;border-radius:999px;align-items:center;gap:12px;min-width:200px;padding:12px 26px;font-family:inherit;font-size:16px;font-weight:600;transition:all .2s;display:flex;position:absolute;bottom:20px;left:50%;transform:translate(-50%)}.anam-cta-pill:hover{background:#ffffff38;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 #ffffff38;border-radius:50%;justify-content:center;align-items:center;width:44px;height:44px;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);justify-content:center;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 #ffffff38;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-input-wrap{flex:1;align-items:center;min-width:0;margin-right:56px;display:flex;position:relative}.anam-ctl-input{-webkit-backdrop-filter:blur(8px);color:#fff;background:#ffffff1a;border:1px solid #ffffff38;border-radius:999px;outline:none;width:100%;padding:11px 44px 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}.anam-ctl-send{color:#ffffff80;cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;width:32px;height:32px;padding:0;transition:color .15s;display:flex;position:absolute;right:6px}.anam-ctl-send:hover{color:#fff}.anam-ctl-send:disabled{opacity:.35;cursor:not-allowed}.anam-watermark{z-index:11;opacity:.5;line-height:0;text-decoration:none;transition:opacity .15s;position:absolute;top:16px;left:16px}.anam-watermark:hover{opacity:.8}@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}';
3655
+ class dr extends we {
3656
+ state = { hasError: !1 };
3657
+ static getDerivedStateFromError() {
3658
+ return { hasError: !0 };
3659
+ }
3660
+ componentDidCatch(e) {
3661
+ console.error("[AnamWidget] Render error:", e);
3662
+ }
3663
+ render() {
3664
+ return this.state.hasError ? /* @__PURE__ */ w("div", { class: "anam-overlay-error", children: /* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: "Widget failed to load" }) }) : this.props.children;
3665
+ }
3666
+ }
3667
+ function pt(t, e) {
3603
3668
  const n = { ...t };
3604
3669
  for (const o of Object.keys(e)) {
3605
- const u = e[o];
3606
- u !== void 0 && (u !== null && typeof u == "object" && !Array.isArray(u) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = wt(n[o], u) : n[o] = u);
3670
+ const l = e[o];
3671
+ l !== void 0 && (l !== null && typeof l == "object" && !Array.isArray(l) && typeof n[o] == "object" && n[o] !== null && !Array.isArray(n[o]) ? n[o] = pt(n[o], l) : n[o] = l);
3607
3672
  }
3608
3673
  return n;
3609
3674
  }
3610
- function ft(t) {
3675
+ function at(t) {
3611
3676
  if (t !== void 0)
3612
3677
  return t === "true";
3613
3678
  }
3614
- function Sr(t) {
3679
+ function hr(t) {
3615
3680
  const e = {};
3616
3681
  t.layout && (e.layout = t.layout), t["initial-state"] && (e.initialState = t["initial-state"]), t.position && (e.position = t.position);
3617
- const n = ft(t["ui-mute-button"]);
3682
+ const n = at(t["ui-mute-button"]);
3618
3683
  n !== void 0 && (e.showMuteButton = n);
3619
- const o = ft(t["ui-text-input"]);
3684
+ const o = at(t["ui-text-input"]);
3620
3685
  o !== void 0 && (e.showTextInput = o);
3621
- const u = ft(t["ui-captions"]);
3622
- return u !== void 0 && (e.showCaptions = u), t["call-to-action"] && (e.callToAction = t["call-to-action"]), e;
3686
+ const l = at(t["ui-captions"]);
3687
+ return l !== void 0 && (e.showCaptions = l), t["call-to-action"] && (e.callToAction = t["call-to-action"]), e;
3623
3688
  }
3624
- const wr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", 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: "24", height: "24", 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: [
3689
+ const fr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", 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" }) }), pr = () => /* @__PURE__ */ w("svg", { width: "24", height: "24", 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" }) }), _r = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3625
3690
  /* @__PURE__ */ w("path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z" }),
3626
3691
  /* @__PURE__ */ w("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
3627
3692
  /* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3628
- ] }), br = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3693
+ ] }), mr = () => /* @__PURE__ */ w("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3629
3694
  /* @__PURE__ */ w("line", { x1: "1", y1: "1", x2: "23", y2: "23" }),
3630
3695
  /* @__PURE__ */ w("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12M15 9.34V5a3 3 0 0 0-5.94-.6" }),
3631
3696
  /* @__PURE__ */ w("path", { d: "M17 16.95A7 7 0 0 1 5 12v-2m14 0v2c0 .87-.16 1.71-.46 2.49" }),
3632
3697
  /* @__PURE__ */ w("line", { x1: "12", y1: "19", x2: "12", y2: "22" })
3633
- ] }), Ar = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3698
+ ] }), Er = () => /* @__PURE__ */ w("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", children: [
3634
3699
  /* @__PURE__ */ w("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
3635
3700
  /* @__PURE__ */ w("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
3636
- ] }), Ct = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
3701
+ ] }), _t = () => /* @__PURE__ */ w("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", style: { opacity: 0.3 }, children: [
3637
3702
  /* @__PURE__ */ w("circle", { cx: "24", cy: "18", r: "8", stroke: "white", "stroke-width": "2", fill: "none" }),
3638
3703
  /* @__PURE__ */ w("path", { d: "M8 42c0-8.837 7.163-16 16-16s16 7.163 16 16", stroke: "white", "stroke-width": "2", fill: "none" })
3639
3704
  ] });
3640
- function Tr({
3705
+ function gr({
3641
3706
  config: t,
3642
3707
  session: e,
3643
3708
  videoRef: n,
3644
3709
  avatarSrc: o,
3645
- avatarVideoSrc: u,
3646
- displayCta: a,
3647
- onCollapse: c,
3648
- onStop: l
3710
+ avatarVideoSrc: l,
3711
+ displayCta: s,
3712
+ onCollapse: u,
3713
+ onStop: c
3649
3714
  }) {
3650
- const m = gt(null), [p, _] = ze(""), [d, S] = ze(null), [g, y] = ze(!1), C = gt(null), A = e.connectionStatus.value === "connected", I = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", R = e.isStreaming.value, M = !I && !A && !b, x = je(async () => {
3715
+ const E = ze(null), [p, _] = Ve(""), [d, S] = Ve(null), [g, y] = Ve(!1), C = ze(null), A = e.connectionStatus.value === "connected", I = e.connectionStatus.value === "connecting", b = e.connectionStatus.value === "error", R = e.isStreaming.value, M = !I && !A && !b, x = nt(async () => {
3651
3716
  n.current && await e.startSession(n.current);
3652
- }, [e.startSession]);
3653
- je(async () => {
3654
- await e.stopSession();
3655
- }, [e.stopSession]);
3656
- const Y = je(() => {
3717
+ }, [e.startSession]), Y = nt(() => {
3657
3718
  if (!p.trim()) return;
3658
3719
  const $ = p.trim();
3659
- e.sendMessage($), _(""), m.current?.focus(), C.current && clearTimeout(C.current), y(!1), S($), C.current = window.setTimeout(() => {
3720
+ e.sendMessage($), _(""), E.current?.focus(), C.current && clearTimeout(C.current), y(!1), S($), C.current = window.setTimeout(() => {
3660
3721
  y(!0), C.current = window.setTimeout(() => {
3661
3722
  S(null), y(!1);
3662
3723
  }, 400);
3663
3724
  }, 2600);
3664
- }, [p]), ne = je(($) => {
3725
+ }, [p]), te = nt(($) => {
3665
3726
  $.key === "Enter" && !$.shiftKey && ($.preventDefault(), Y());
3666
3727
  }, [Y]);
3667
- return mt(() => () => {
3728
+ return Ge(() => () => {
3668
3729
  C.current && clearTimeout(C.current);
3669
3730
  }, []), /* @__PURE__ */ w("div", { class: "anam-sheet", children: [
3670
3731
  /* @__PURE__ */ w(
@@ -3680,10 +3741,10 @@ function Tr({
3680
3741
  M && (e.isConfigured.value ? (
3681
3742
  /* Has agent-id: show avatar or placeholder + CTA pill */
3682
3743
  /* @__PURE__ */ w("div", { class: "anam-overlay-idle", children: [
3683
- u ? /* @__PURE__ */ w(
3744
+ l ? /* @__PURE__ */ w(
3684
3745
  "video",
3685
3746
  {
3686
- src: u,
3747
+ src: l,
3687
3748
  autoplay: !0,
3688
3749
  loop: !0,
3689
3750
  muted: !0,
@@ -3699,18 +3760,18 @@ function Tr({
3699
3760
  {
3700
3761
  src: o,
3701
3762
  alt: "Avatar",
3702
- class: u ? "anam-preview-fallback" : void 0
3763
+ class: l ? "anam-preview-fallback" : void 0
3703
3764
  }
3704
- ) : /* @__PURE__ */ w(Ct, {}),
3765
+ ) : /* @__PURE__ */ w(_t, {}),
3705
3766
  /* @__PURE__ */ w("button", { class: "anam-cta-pill", onClick: x, children: [
3706
- /* @__PURE__ */ w(Cr, {}),
3707
- a
3767
+ /* @__PURE__ */ w(pr, {}),
3768
+ s
3708
3769
  ] })
3709
3770
  ] })
3710
3771
  ) : (
3711
3772
  /* No agent-id: unconfigured overlay */
3712
3773
  /* @__PURE__ */ w("div", { class: "anam-overlay-unconfigured", children: [
3713
- /* @__PURE__ */ w(Ct, {}),
3774
+ /* @__PURE__ */ w(_t, {}),
3714
3775
  /* @__PURE__ */ w("span", { children: "Agent not configured" })
3715
3776
  ] })
3716
3777
  )),
@@ -3722,16 +3783,16 @@ function Tr({
3722
3783
  /* @__PURE__ */ w("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
3723
3784
  /* @__PURE__ */ w("button", { class: "anam-retry-btn", onClick: x, children: "Try Again" })
3724
3785
  ] }),
3725
- (c || l && (A || I || R)) && /* @__PURE__ */ w(
3786
+ (u || c && (A || I || R)) && /* @__PURE__ */ w(
3726
3787
  "button",
3727
3788
  {
3728
3789
  class: "anam-close-btn",
3729
- onClick: c || l,
3730
- "aria-label": c ? "Close" : "End call",
3731
- children: /* @__PURE__ */ w(wr, {})
3790
+ onClick: u || c,
3791
+ "aria-label": u ? "Close" : "End call",
3792
+ children: /* @__PURE__ */ w(fr, {})
3732
3793
  }
3733
3794
  ),
3734
- (A || R) && /* @__PURE__ */ w(_e, { children: [
3795
+ (A || R) && /* @__PURE__ */ w(fe, { children: [
3735
3796
  d && /* @__PURE__ */ w("div", { class: `anam-toast ${g ? "anam-toast-out" : ""}`, children: d }),
3736
3797
  /* @__PURE__ */ w("div", { class: "anam-control-bar", children: [
3737
3798
  t.showMuteButton && /* @__PURE__ */ w(
@@ -3740,20 +3801,20 @@ function Tr({
3740
3801
  class: `anam-ctl-btn ${e.isMuted.value ? "anam-ctl-btn-muted" : ""}`,
3741
3802
  onClick: () => e.toggleMute(),
3742
3803
  "aria-label": e.isMuted.value ? "Unmute" : "Mute",
3743
- children: e.isMuted.value ? /* @__PURE__ */ w(br, {}) : /* @__PURE__ */ w(Ir, {})
3804
+ children: e.isMuted.value ? /* @__PURE__ */ w(mr, {}) : /* @__PURE__ */ w(_r, {})
3744
3805
  }
3745
3806
  ),
3746
3807
  t.showTextInput && /* @__PURE__ */ w("div", { class: "anam-ctl-input-wrap", children: [
3747
3808
  /* @__PURE__ */ w(
3748
3809
  "input",
3749
3810
  {
3750
- ref: m,
3811
+ ref: E,
3751
3812
  type: "text",
3752
3813
  class: "anam-ctl-input",
3753
3814
  placeholder: "Type a message...",
3754
3815
  value: p,
3755
3816
  onInput: ($) => _($.target.value),
3756
- onKeyDown: ne,
3817
+ onKeyDown: te,
3757
3818
  disabled: !A
3758
3819
  }
3759
3820
  ),
@@ -3764,7 +3825,7 @@ function Tr({
3764
3825
  onClick: Y,
3765
3826
  disabled: !A || !p.trim(),
3766
3827
  "aria-label": "Send message",
3767
- children: /* @__PURE__ */ w(Ar, {})
3828
+ children: /* @__PURE__ */ w(Er, {})
3768
3829
  }
3769
3830
  )
3770
3831
  ] })
@@ -3787,70 +3848,77 @@ function Tr({
3787
3848
  )
3788
3849
  ] });
3789
3850
  }
3790
- function Rr(t) {
3791
- const e = gt(null);
3851
+ function vr(t) {
3852
+ return /* @__PURE__ */ w(fe, { children: [
3853
+ /* @__PURE__ */ w("style", { children: ur }),
3854
+ /* @__PURE__ */ w(dr, { children: /* @__PURE__ */ w(yr, { ...t }) })
3855
+ ] });
3856
+ }
3857
+ function yr(t) {
3858
+ const e = ze(null);
3792
3859
  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.");
3793
- const n = t["session-token"] ? void 0 : t["agent-id"], o = yr(n, t["api-base-url"], t["session-token"]), u = Ie(
3794
- () => Sr(t),
3860
+ const n = t["session-token"] ? void 0 : t["agent-id"], o = cr(n, t["api-base-url"], t["session-token"]);
3861
+ Ge(() => () => {
3862
+ o.cleanup();
3863
+ }, []);
3864
+ const l = Ce(
3865
+ () => hr(t),
3795
3866
  [t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["call-to-action"]]
3796
- ), a = Ie(() => {
3867
+ ), s = Ce(() => {
3797
3868
  const I = o.serverConfig.value;
3798
- return wt(wt({ ...oi }, I ?? {}), u);
3799
- }, [o.serverConfig.value, u]), c = ji(
3800
- a.layout === "floating" ? a.initialState : "expanded"
3869
+ return pt(pt({ ...qt }, I ?? {}), l);
3870
+ }, [o.serverConfig.value, l]), u = Ni(
3871
+ s.layout === "floating" ? s.initialState : "expanded"
3801
3872
  );
3802
- mt(() => {
3803
- a.layout === "inline" ? c.value = "expanded" : c.value = a.initialState;
3804
- }, [a.layout, a.initialState]), mt(() => {
3873
+ Ge(() => {
3874
+ s.layout === "inline" ? u.value = "expanded" : u.value = s.initialState;
3875
+ }, [s.layout, s.initialState]), Ge(() => {
3805
3876
  o.fetchWidgetConfig();
3806
3877
  }, [n, t["api-base-url"], t["session-token"]]);
3807
- const l = t["avatar-url"] || o.avatarThumbnailUrl.value || null, m = t["avatar-video-url"] || o.avatarVideoUrl.value || null, _ = t["agent-name"] || o.personaName.value, d = a.callToAction === oi.callToAction && _ ? `Talk to ${_}` : a.callToAction, S = Ie(() => {
3808
- if (a.layout === "inline") return "";
3809
- const I = kn(a.position);
3878
+ const c = t["avatar-url"] || o.avatarThumbnailUrl.value || null, E = t["avatar-video-url"] || o.avatarVideoUrl.value || null, _ = t["agent-name"] || o.personaName.value, d = s.callToAction === qt.callToAction && _ ? `Talk to ${_}` : s.callToAction, S = Ce(() => {
3879
+ if (s.layout === "inline") return "";
3880
+ const I = yn(s.position);
3810
3881
  return Object.entries(I).map(([b, R]) => `${b}: ${R}`).join("; ");
3811
- }, [a.layout, a.position]), g = a.layout === "floating", y = () => {
3812
- c.value = "expanded";
3882
+ }, [s.layout, s.position]), g = s.layout === "floating", y = () => {
3883
+ u.value = "expanded";
3813
3884
  }, C = async () => {
3814
- o.connectionStatus.value !== "idle" && await o.stopSession(), c.value = "minimized";
3815
- }, A = g ? c.value === "expanded" : !0;
3816
- return o.isReady.value ? /* @__PURE__ */ w(_e, { children: [
3817
- /* @__PURE__ */ w("style", { children: hi }),
3818
- /* @__PURE__ */ w(
3819
- "div",
3820
- {
3821
- class: "anam-widget",
3822
- "data-layout": a.layout,
3823
- "data-state": c.value,
3824
- style: S,
3825
- children: [
3826
- g && c.value === "minimized" && /* @__PURE__ */ w(
3827
- "button",
3828
- {
3829
- class: "anam-trigger",
3830
- onClick: y,
3831
- "aria-label": d,
3832
- children: l ? /* @__PURE__ */ w("img", { src: l, alt: "Avatar" }) : /* @__PURE__ */ w(Ct, {})
3833
- }
3834
- ),
3835
- A && /* @__PURE__ */ w(
3836
- Tr,
3837
- {
3838
- config: a,
3839
- session: o,
3840
- videoRef: e,
3841
- avatarSrc: l,
3842
- avatarVideoSrc: m,
3843
- displayCta: d,
3844
- onCollapse: g ? C : null,
3845
- onStop: g ? null : () => o.stopSession()
3846
- }
3847
- )
3848
- ]
3849
- }
3850
- )
3851
- ] }) : /* @__PURE__ */ w("style", { children: hi });
3885
+ o.connectionStatus.value !== "idle" && await o.stopSession(), u.value = "minimized";
3886
+ }, A = g ? u.value === "expanded" : !0;
3887
+ return o.isReady.value ? /* @__PURE__ */ w(
3888
+ "div",
3889
+ {
3890
+ class: "anam-widget",
3891
+ "data-layout": s.layout,
3892
+ "data-state": u.value,
3893
+ style: S,
3894
+ children: [
3895
+ g && u.value === "minimized" && /* @__PURE__ */ w(
3896
+ "button",
3897
+ {
3898
+ class: "anam-trigger",
3899
+ onClick: y,
3900
+ "aria-label": d,
3901
+ children: c ? /* @__PURE__ */ w("img", { src: c, alt: "Avatar" }) : /* @__PURE__ */ w(_t, {})
3902
+ }
3903
+ ),
3904
+ A && /* @__PURE__ */ w(
3905
+ gr,
3906
+ {
3907
+ config: s,
3908
+ session: o,
3909
+ videoRef: e,
3910
+ avatarSrc: c,
3911
+ avatarVideoSrc: E,
3912
+ displayCta: d,
3913
+ onCollapse: g ? C : null,
3914
+ onStop: g ? null : () => o.stopSession()
3915
+ }
3916
+ )
3917
+ ]
3918
+ }
3919
+ ) : null;
3852
3920
  }
3853
- const Nr = [
3921
+ const Sr = [
3854
3922
  "agent-id",
3855
3923
  // Persona ID -- required for session streaming + server config fetch
3856
3924
  "api-base-url",
@@ -3877,7 +3945,7 @@ const Nr = [
3877
3945
  // Override avatar preview video (Lab preview)
3878
3946
  "agent-name"
3879
3947
  // Override persona name for CTA (Lab preview)
3880
- ], Or = {
3948
+ ], Cr = {
3881
3949
  SESSION_STARTED: "anam-agent:session-started",
3882
3950
  SESSION_ENDED: "anam-agent:session-ended",
3883
3951
  MESSAGE_RECEIVED: "anam-agent:message-received",
@@ -3888,14 +3956,14 @@ const Nr = [
3888
3956
  MIC_MUTED: "anam-agent:mic-muted",
3889
3957
  MIC_UNMUTED: "anam-agent:mic-unmuted"
3890
3958
  };
3891
- function fi(t = "anam-agent") {
3892
- En(Rr, t, [...Nr], {
3959
+ function Qt(t = "anam-agent") {
3960
+ nn(vr, t, [...Sr], {
3893
3961
  shadow: !0
3894
3962
  });
3895
3963
  }
3896
- typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => fi()) : fi());
3964
+ typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => Qt()) : Qt());
3897
3965
  export {
3898
- oi as DefaultConfig,
3899
- Or as WidgetEventNames,
3900
- fi as registerWidget
3966
+ qt as DefaultConfig,
3967
+ Cr as WidgetEventNames,
3968
+ Qt as registerWidget
3901
3969
  };