@anam-ai/agent-widget 0.2.0-alpha.3 → 0.3.0-alpha.1

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