@anam-ai/agent-widget 0.6.0-alpha.1 → 0.6.1-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/README.md +29 -0
- package/dist/index.js +783 -741
- package/dist/index.umd.js +1 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ye,
|
|
1
|
+
var Ye, M, Ii, bi, ye, Jt, wi, Ri, Ai, Mt, It, bt, Ge = {}, Oi = [], Cn = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, lt = Array.isArray;
|
|
2
2
|
function le(t, e) {
|
|
3
3
|
for (var i in e) t[i] = e[i];
|
|
4
4
|
return t;
|
|
@@ -14,7 +14,7 @@ function xe(t, e, i) {
|
|
|
14
14
|
}
|
|
15
15
|
function We(t, e, i, n, a) {
|
|
16
16
|
var s = { type: t, props: e, key: i, ref: n, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: a ?? ++Ii, __i: -1, __u: 0 };
|
|
17
|
-
return a == null &&
|
|
17
|
+
return a == null && M.vnode != null && M.vnode(s), s;
|
|
18
18
|
}
|
|
19
19
|
function Ce(t) {
|
|
20
20
|
return t.children;
|
|
@@ -38,21 +38,21 @@ function xi(t) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
function Xt(t) {
|
|
41
|
-
(!t.__d && (t.__d = !0) && ye.push(t) && !rt.__r++ || Jt !=
|
|
41
|
+
(!t.__d && (t.__d = !0) && ye.push(t) && !rt.__r++ || Jt != M.debounceRendering) && ((Jt = M.debounceRendering) || wi)(rt);
|
|
42
42
|
}
|
|
43
43
|
function rt() {
|
|
44
|
-
for (var t, e, i, n, a, s, c, l = 1; ye.length; ) ye.length > l && ye.sort(Ri), t = ye.shift(), l = ye.length, t.__d && (i = void 0, n = void 0, a = (n = (e = t).__v).__e, s = [], c = [], e.__P && ((i = le({}, n)).__v = n.__v + 1,
|
|
44
|
+
for (var t, e, i, n, a, s, c, l = 1; ye.length; ) ye.length > l && ye.sort(Ri), t = ye.shift(), l = ye.length, t.__d && (i = void 0, n = void 0, a = (n = (e = t).__v).__e, s = [], c = [], e.__P && ((i = le({}, n)).__v = n.__v + 1, M.vnode && M.vnode(i), Ut(e.__P, i, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [a] : null, s, a ?? Le(n), !!(32 & n.__u), c), i.__v = n.__v, i.__.__k[i.__i] = i, Li(s, i, c), n.__e = n.__ = null, i.__e != a && xi(i)));
|
|
45
45
|
rt.__r = 0;
|
|
46
46
|
}
|
|
47
|
-
function Ni(t, e, i, n, a, s, c, l, m,
|
|
48
|
-
var u,
|
|
49
|
-
for (m = Sn(i, e,
|
|
50
|
-
return i.__e =
|
|
47
|
+
function Ni(t, e, i, n, a, s, c, l, m, f, p) {
|
|
48
|
+
var u, y, E, T, I, w, A, R = n && n.__k || Oi, b = e.length;
|
|
49
|
+
for (m = Sn(i, e, R, m, b), u = 0; u < b; u++) (E = i.__k[u]) != null && (y = E.__i == -1 ? Ge : R[E.__i] || Ge, E.__i = u, w = Ut(t, E, y, a, s, c, l, m, f, p), T = E.__e, E.ref && y.ref != E.ref && (y.ref && Pt(y.ref, null, E), p.push(E.ref, E.__c || T, E)), I == null && T != null && (I = T), (A = !!(4 & E.__u)) || y.__k === E.__k ? m = ki(E, m, t, A) : typeof E.type == "function" && w !== void 0 ? m = w : T && (m = T.nextSibling), E.__u &= -7);
|
|
50
|
+
return i.__e = I, m;
|
|
51
51
|
}
|
|
52
52
|
function Sn(t, e, i, n, a) {
|
|
53
|
-
var s, c, l, m,
|
|
54
|
-
for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = We(null, c, null, null, null) : lt(c) ? c = t.__k[s] = We(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = We(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s +
|
|
55
|
-
if (u) for (s = 0; s <
|
|
53
|
+
var s, c, l, m, f, p = i.length, u = p, y = 0;
|
|
54
|
+
for (t.__k = new Array(a), s = 0; s < a; s++) (c = e[s]) != null && typeof c != "boolean" && typeof c != "function" ? (typeof c == "string" || typeof c == "number" || typeof c == "bigint" || c.constructor == String ? c = t.__k[s] = We(null, c, null, null, null) : lt(c) ? c = t.__k[s] = We(Ce, { children: c }, null, null, null) : c.constructor === void 0 && c.__b > 0 ? c = t.__k[s] = We(c.type, c.props, c.key, c.ref ? c.ref : null, c.__v) : t.__k[s] = c, m = s + y, c.__ = t, c.__b = t.__b + 1, l = null, (f = c.__i = Tn(c, i, m, u)) != -1 && (u--, (l = i[f]) && (l.__u |= 2)), l == null || l.__v == null ? (f == -1 && (a > p ? y-- : a < p && y++), typeof c.type != "function" && (c.__u |= 4)) : f != m && (f == m - 1 ? y-- : f == m + 1 ? y++ : (f > m ? y-- : y++, c.__u |= 4))) : t.__k[s] = null;
|
|
55
|
+
if (u) for (s = 0; s < p; s++) (l = i[s]) != null && (2 & l.__u) == 0 && (l.__e == n && (n = Le(l)), Di(l, l));
|
|
56
56
|
return n;
|
|
57
57
|
}
|
|
58
58
|
function ki(t, e, i, n) {
|
|
@@ -68,10 +68,10 @@ function ki(t, e, i, n) {
|
|
|
68
68
|
return e;
|
|
69
69
|
}
|
|
70
70
|
function Tn(t, e, i, n) {
|
|
71
|
-
var a, s, c, l = t.key, m = t.type,
|
|
72
|
-
if (
|
|
73
|
-
if (n > (
|
|
74
|
-
for (a = i - 1, s = i + 1; a >= 0 || s < e.length; ) if ((
|
|
71
|
+
var a, s, c, l = t.key, m = t.type, f = e[i], p = f != null && (2 & f.__u) == 0;
|
|
72
|
+
if (f === null && l == null || p && l == f.key && m == f.type) return i;
|
|
73
|
+
if (n > (p ? 1 : 0)) {
|
|
74
|
+
for (a = i - 1, s = i + 1; a >= 0 || s < e.length; ) if ((f = e[c = a >= 0 ? a-- : s++]) != null && (2 & f.__u) == 0 && l == f.key && m == f.type) return c;
|
|
75
75
|
}
|
|
76
76
|
return -1;
|
|
77
77
|
}
|
|
@@ -102,61 +102,61 @@ function Qt(t) {
|
|
|
102
102
|
var i = this.l[e.type + t];
|
|
103
103
|
if (e.t == null) e.t = Mt++;
|
|
104
104
|
else if (e.t < i.u) return;
|
|
105
|
-
return i(
|
|
105
|
+
return i(M.event ? M.event(e) : e);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function Ut(t, e, i, n, a, s, c, l, m,
|
|
110
|
-
var
|
|
109
|
+
function Ut(t, e, i, n, a, s, c, l, m, f) {
|
|
110
|
+
var p, u, y, E, T, I, w, A, R, b, N, S, k, U, z, Y, oe, K = e.type;
|
|
111
111
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & i.__u && (m = !!(32 & i.__u), s = [l = e.__e = i.__e]), (
|
|
113
|
-
e: if (typeof
|
|
114
|
-
if (
|
|
112
|
+
128 & i.__u && (m = !!(32 & i.__u), s = [l = e.__e = i.__e]), (p = M.__b) && p(e);
|
|
113
|
+
e: if (typeof K == "function") try {
|
|
114
|
+
if (A = e.props, R = "prototype" in K && K.prototype.render, b = (p = K.contextType) && n[p.__c], N = p ? b ? b.props.value : p.__ : n, i.__c ? w = (u = e.__c = i.__c).__ = u.__E : (R ? e.__c = u = new K(A, N) : (e.__c = u = new Ne(A, N), u.constructor = K, u.render = In), b && b.sub(u), u.state || (u.state = {}), u.__n = n, y = u.__d = !0, u.__h = [], u._sb = []), R && u.__s == null && (u.__s = u.state), R && K.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = le({}, u.__s)), le(u.__s, K.getDerivedStateFromProps(A, u.__s))), E = u.props, T = u.state, u.__v = e, y) R && K.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), R && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
115
115
|
else {
|
|
116
|
-
if (
|
|
117
|
-
for (e.__v != i.__v && (u.props =
|
|
118
|
-
|
|
119
|
-
}),
|
|
116
|
+
if (R && K.getDerivedStateFromProps == null && A !== E && u.componentWillReceiveProps != null && u.componentWillReceiveProps(A, N), e.__v == i.__v || !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(A, u.__s, N) === !1) {
|
|
117
|
+
for (e.__v != i.__v && (u.props = A, u.state = u.__s, u.__d = !1), e.__e = i.__e, e.__k = i.__k, e.__k.some(function(te) {
|
|
118
|
+
te && (te.__ = e);
|
|
119
|
+
}), S = 0; S < u._sb.length; S++) u.__h.push(u._sb[S]);
|
|
120
120
|
u._sb = [], u.__h.length && c.push(u);
|
|
121
121
|
break e;
|
|
122
122
|
}
|
|
123
|
-
u.componentWillUpdate != null && u.componentWillUpdate(
|
|
124
|
-
u.componentDidUpdate(E,
|
|
123
|
+
u.componentWillUpdate != null && u.componentWillUpdate(A, u.__s, N), R && u.componentDidUpdate != null && u.__h.push(function() {
|
|
124
|
+
u.componentDidUpdate(E, T, I);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
if (u.context = N, u.props =
|
|
128
|
-
for (u.state = u.__s, u.__d = !1,
|
|
127
|
+
if (u.context = N, u.props = A, u.__P = t, u.__e = !1, k = M.__r, U = 0, R) {
|
|
128
|
+
for (u.state = u.__s, u.__d = !1, k && k(e), p = u.render(u.props, u.state, u.context), z = 0; z < u._sb.length; z++) u.__h.push(u._sb[z]);
|
|
129
129
|
u._sb = [];
|
|
130
130
|
} else do
|
|
131
|
-
u.__d = !1,
|
|
132
|
-
while (u.__d && ++
|
|
133
|
-
u.state = u.__s, u.getChildContext != null && (n = le(le({}, n), u.getChildContext())),
|
|
134
|
-
} catch (
|
|
135
|
-
if (e.__v = null, m || s != null) if (
|
|
131
|
+
u.__d = !1, k && k(e), p = u.render(u.props, u.state, u.context), u.state = u.__s;
|
|
132
|
+
while (u.__d && ++U < 25);
|
|
133
|
+
u.state = u.__s, u.getChildContext != null && (n = le(le({}, n), u.getChildContext())), R && !y && u.getSnapshotBeforeUpdate != null && (I = u.getSnapshotBeforeUpdate(E, T)), Y = p, p != null && p.type === Ce && p.key == null && (Y = Mi(p.props.children)), l = Ni(t, lt(Y) ? Y : [Y], e, i, n, a, s, c, l, m, f), u.base = e.__e, e.__u &= -161, u.__h.length && c.push(u), w && (u.__E = u.__ = null);
|
|
134
|
+
} catch (te) {
|
|
135
|
+
if (e.__v = null, m || s != null) if (te.then) {
|
|
136
136
|
for (e.__u |= m ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
|
|
137
137
|
s[s.indexOf(l)] = null, e.__e = l;
|
|
138
138
|
} else {
|
|
139
139
|
for (oe = s.length; oe--; ) Dt(s[oe]);
|
|
140
140
|
wt(e);
|
|
141
141
|
}
|
|
142
|
-
else e.__e = i.__e, e.__k = i.__k,
|
|
143
|
-
|
|
142
|
+
else e.__e = i.__e, e.__k = i.__k, te.then || wt(e);
|
|
143
|
+
M.__e(te, e, i);
|
|
144
144
|
}
|
|
145
|
-
else s == null && e.__v == i.__v ? (e.__k = i.__k, e.__e = i.__e) : l = e.__e = yn(i.__e, e, i, n, a, s, c, m,
|
|
146
|
-
return (
|
|
145
|
+
else s == null && e.__v == i.__v ? (e.__k = i.__k, e.__e = i.__e) : l = e.__e = yn(i.__e, e, i, n, a, s, c, m, f);
|
|
146
|
+
return (p = M.diffed) && p(e), 128 & e.__u ? void 0 : l;
|
|
147
147
|
}
|
|
148
148
|
function wt(t) {
|
|
149
149
|
t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(wt);
|
|
150
150
|
}
|
|
151
151
|
function Li(t, e, i) {
|
|
152
152
|
for (var n = 0; n < i.length; n++) Pt(i[n], i[++n], i[++n]);
|
|
153
|
-
|
|
153
|
+
M.__c && M.__c(e, t), t.some(function(a) {
|
|
154
154
|
try {
|
|
155
155
|
t = a.__h, a.__h = [], t.some(function(s) {
|
|
156
156
|
s.call(a);
|
|
157
157
|
});
|
|
158
158
|
} catch (s) {
|
|
159
|
-
|
|
159
|
+
M.__e(s, a.__v);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}
|
|
@@ -164,31 +164,31 @@ function Mi(t) {
|
|
|
164
164
|
return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : lt(t) ? t.map(Mi) : le({}, t);
|
|
165
165
|
}
|
|
166
166
|
function yn(t, e, i, n, a, s, c, l, m) {
|
|
167
|
-
var
|
|
168
|
-
if (
|
|
169
|
-
for (
|
|
170
|
-
t = E, s[
|
|
167
|
+
var f, p, u, y, E, T, I, w = i.props || Ge, A = e.props, R = e.type;
|
|
168
|
+
if (R == "svg" ? a = "http://www.w3.org/2000/svg" : R == "math" ? a = "http://www.w3.org/1998/Math/MathML" : a || (a = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
169
|
+
for (f = 0; f < s.length; f++) if ((E = s[f]) && "setAttribute" in E == !!R && (R ? E.localName == R : E.nodeType == 3)) {
|
|
170
|
+
t = E, s[f] = null;
|
|
171
171
|
break;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
if (t == null) {
|
|
175
|
-
if (
|
|
176
|
-
t = document.createElementNS(a,
|
|
175
|
+
if (R == null) return document.createTextNode(A);
|
|
176
|
+
t = document.createElementNS(a, R, A.is && A), l && (M.__m && M.__m(e, s), l = !1), s = null;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (R == null) w === A || l && t.data == A || (t.data = A);
|
|
179
179
|
else {
|
|
180
|
-
if (s = s && Ye.call(t.childNodes), !l && s != null) for (
|
|
181
|
-
for (
|
|
182
|
-
if (
|
|
183
|
-
else if (!(
|
|
184
|
-
if (
|
|
185
|
-
Ze(t,
|
|
180
|
+
if (s = s && Ye.call(t.childNodes), !l && s != null) for (w = {}, f = 0; f < t.attributes.length; f++) w[(E = t.attributes[f]).name] = E.value;
|
|
181
|
+
for (f in w) if (E = w[f], f != "children") {
|
|
182
|
+
if (f == "dangerouslySetInnerHTML") u = E;
|
|
183
|
+
else if (!(f in A)) {
|
|
184
|
+
if (f == "value" && "defaultValue" in A || f == "checked" && "defaultChecked" in A) continue;
|
|
185
|
+
Ze(t, f, null, E, a);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
for (
|
|
189
|
-
if (
|
|
190
|
-
else if (u && (t.innerHTML = ""), Ni(e.type == "template" ? t.content : t, lt(
|
|
191
|
-
l || (
|
|
188
|
+
for (f in A) E = A[f], f == "children" ? y = E : f == "dangerouslySetInnerHTML" ? p = E : f == "value" ? T = E : f == "checked" ? I = E : l && typeof E != "function" || w[f] === E || Ze(t, f, E, w[f], a);
|
|
189
|
+
if (p) l || u && (p.__html == u.__html || p.__html == t.innerHTML) || (t.innerHTML = p.__html), e.__k = [];
|
|
190
|
+
else if (u && (t.innerHTML = ""), Ni(e.type == "template" ? t.content : t, lt(y) ? y : [y], e, i, n, R == "foreignObject" ? "http://www.w3.org/1999/xhtml" : a, s, c, s ? s[0] : i.__k && Le(i, 0), l, m), s != null) for (f = s.length; f--; ) Dt(s[f]);
|
|
191
|
+
l || (f = "value", R == "progress" && T == null ? t.removeAttribute("value") : T != null && (T !== t[f] || R == "progress" && !T || R == "option" && T != w[f]) && Ze(t, f, T, w[f], a), f = "checked", I != null && I != t[f] && Ze(t, f, I, w[f], a));
|
|
192
192
|
}
|
|
193
193
|
return t;
|
|
194
194
|
}
|
|
@@ -199,16 +199,16 @@ function Pt(t, e, i) {
|
|
|
199
199
|
n && t.__u(), n && e == null || (t.__u = t(e));
|
|
200
200
|
} else t.current = e;
|
|
201
201
|
} catch (a) {
|
|
202
|
-
|
|
202
|
+
M.__e(a, i);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
function Di(t, e, i) {
|
|
206
206
|
var n, a;
|
|
207
|
-
if (
|
|
207
|
+
if (M.unmount && M.unmount(t), (n = t.ref) && (n.current && n.current != t.__e || Pt(n, null, e)), (n = t.__c) != null) {
|
|
208
208
|
if (n.componentWillUnmount) try {
|
|
209
209
|
n.componentWillUnmount();
|
|
210
210
|
} catch (s) {
|
|
211
|
-
|
|
211
|
+
M.__e(s, e);
|
|
212
212
|
}
|
|
213
213
|
n.base = n.__P = null;
|
|
214
214
|
}
|
|
@@ -220,7 +220,7 @@ function In(t, e, i) {
|
|
|
220
220
|
}
|
|
221
221
|
function ct(t, e, i) {
|
|
222
222
|
var n, a, s, c;
|
|
223
|
-
e == document && (e = document.documentElement),
|
|
223
|
+
e == document && (e = document.documentElement), M.__ && M.__(t, e), a = (n = typeof i == "function") ? null : i && i.__k || e.__k, s = [], c = [], Ut(e, t = (!n && i || e).__k = xe(Ce, null, [t]), a || Ge, Ge, e.namespaceURI, !n && i ? [i] : a ? null : e.firstChild ? Ye.call(e.childNodes) : null, s, !n && i ? i : a ? a.__e : e.firstChild, n, c), Li(s, t, c);
|
|
224
224
|
}
|
|
225
225
|
function Ui(t, e) {
|
|
226
226
|
ct(t, e, Ui);
|
|
@@ -230,7 +230,7 @@ function Pi(t, e, i) {
|
|
|
230
230
|
for (s in t.type && t.type.defaultProps && (c = t.type.defaultProps), e) s == "key" ? n = e[s] : s == "ref" ? a = e[s] : l[s] = e[s] === void 0 && c != null ? c[s] : e[s];
|
|
231
231
|
return arguments.length > 2 && (l.children = arguments.length > 3 ? Ye.call(arguments, 2) : i), We(t.type, l, n || t.key, a || t.ref, null);
|
|
232
232
|
}
|
|
233
|
-
Ye = Oi.slice,
|
|
233
|
+
Ye = Oi.slice, M = { __e: function(t, e, i, n) {
|
|
234
234
|
for (var a, s, c; e = e.__; ) if ((a = e.__c) && !a.__) try {
|
|
235
235
|
if ((s = a.constructor) && s.getDerivedStateFromError != null && (a.setState(s.getDerivedStateFromError(t)), c = a.__d), a.componentDidCatch != null && (a.componentDidCatch(t, n || {}), c = a.__d), c) return a.__E = a;
|
|
236
236
|
} catch (l) {
|
|
@@ -319,25 +319,25 @@ function $i(t, e, i) {
|
|
|
319
319
|
var n = [], a = {}, s = 0, c = t.attributes, l = t.childNodes;
|
|
320
320
|
for (s = c.length; s--; ) c[s].name !== "slot" && (a[c[s].name] = c[s].value, a[Fi(c[s].name)] = c[s].value);
|
|
321
321
|
for (s = l.length; s--; ) {
|
|
322
|
-
var m = $i(l[s], null, i),
|
|
323
|
-
|
|
322
|
+
var m = $i(l[s], null, i), f = l[s].slot;
|
|
323
|
+
f ? a[f] = xe(ei, { name: f }, m) : n[s] = m;
|
|
324
324
|
}
|
|
325
|
-
var
|
|
326
|
-
return !
|
|
325
|
+
var p = !(!i || !i.shadow), u = e ? xe(ei, { useFragment: !p }, n) : n;
|
|
326
|
+
return !p && e && (t.innerHTML = ""), xe(e || t.nodeName.toLowerCase(), a, u);
|
|
327
327
|
}
|
|
328
328
|
var kn = 0;
|
|
329
329
|
function C(t, e, i, n, a, s) {
|
|
330
330
|
e || (e = {});
|
|
331
331
|
var c, l, m = e;
|
|
332
332
|
if ("ref" in m) for (l in m = {}, e) l == "ref" ? c = e[l] : m[l] = e[l];
|
|
333
|
-
var
|
|
333
|
+
var f = { type: t, props: m, key: i, ref: c, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --kn, __i: -1, __u: 0, __source: a, __self: s };
|
|
334
334
|
if (typeof t == "function" && (c = t.defaultProps)) for (l in c) m[l] === void 0 && (m[l] = c[l]);
|
|
335
|
-
return
|
|
335
|
+
return M.vnode && M.vnode(f), f;
|
|
336
336
|
}
|
|
337
|
-
var He,
|
|
337
|
+
var He, W, _t, ti, ze = 0, Vi = [], j = M, ii = j.__b, ni = j.__r, ri = j.diffed, oi = j.__c, si = j.unmount, ai = j.__;
|
|
338
338
|
function Bt(t, e) {
|
|
339
|
-
|
|
340
|
-
var i =
|
|
339
|
+
j.__h && j.__h(W, t, ze || e), ze = 0;
|
|
340
|
+
var i = W.__H || (W.__H = { __: [], __h: [] });
|
|
341
341
|
return t >= i.__.length && i.__.push({}), i.__[t];
|
|
342
342
|
}
|
|
343
343
|
function Rt(t) {
|
|
@@ -346,40 +346,40 @@ function Rt(t) {
|
|
|
346
346
|
function Ln(t, e, i) {
|
|
347
347
|
var n = Bt(He++, 2);
|
|
348
348
|
if (n.t = t, !n.__c && (n.__ = [ji(void 0, e), function(l) {
|
|
349
|
-
var m = n.__N ? n.__N[0] : n.__[0],
|
|
350
|
-
m !==
|
|
351
|
-
}], n.__c =
|
|
352
|
-
var a = function(l, m,
|
|
349
|
+
var m = n.__N ? n.__N[0] : n.__[0], f = n.t(m, l);
|
|
350
|
+
m !== f && (n.__N = [f, n.__[1]], n.__c.setState({}));
|
|
351
|
+
}], n.__c = W, !W.__f)) {
|
|
352
|
+
var a = function(l, m, f) {
|
|
353
353
|
if (!n.__c.__H) return !0;
|
|
354
|
-
var
|
|
355
|
-
return !!
|
|
354
|
+
var p = n.__c.__H.__.filter(function(y) {
|
|
355
|
+
return !!y.__c;
|
|
356
356
|
});
|
|
357
|
-
if (
|
|
358
|
-
return !
|
|
359
|
-
})) return !s || s.call(this, l, m,
|
|
357
|
+
if (p.every(function(y) {
|
|
358
|
+
return !y.__N;
|
|
359
|
+
})) return !s || s.call(this, l, m, f);
|
|
360
360
|
var u = n.__c.props !== l;
|
|
361
|
-
return
|
|
362
|
-
if (
|
|
363
|
-
var E =
|
|
364
|
-
|
|
361
|
+
return p.forEach(function(y) {
|
|
362
|
+
if (y.__N) {
|
|
363
|
+
var E = y.__[0];
|
|
364
|
+
y.__ = y.__N, y.__N = void 0, E !== y.__[0] && (u = !0);
|
|
365
365
|
}
|
|
366
|
-
}), s && s.call(this, l, m,
|
|
366
|
+
}), s && s.call(this, l, m, f) || u;
|
|
367
367
|
};
|
|
368
|
-
|
|
369
|
-
var s =
|
|
370
|
-
|
|
368
|
+
W.__f = !0;
|
|
369
|
+
var s = W.shouldComponentUpdate, c = W.componentWillUpdate;
|
|
370
|
+
W.componentWillUpdate = function(l, m, f) {
|
|
371
371
|
if (this.__e) {
|
|
372
|
-
var
|
|
373
|
-
s = void 0, a(l, m,
|
|
372
|
+
var p = s;
|
|
373
|
+
s = void 0, a(l, m, f), s = p;
|
|
374
374
|
}
|
|
375
|
-
c && c.call(this, l, m,
|
|
376
|
-
},
|
|
375
|
+
c && c.call(this, l, m, f);
|
|
376
|
+
}, W.shouldComponentUpdate = a;
|
|
377
377
|
}
|
|
378
378
|
return n.__N || n.__;
|
|
379
379
|
}
|
|
380
380
|
function Ie(t, e) {
|
|
381
381
|
var i = Bt(He++, 3);
|
|
382
|
-
!
|
|
382
|
+
!j.__s && Wi(i.__H, e) && (i.__ = t, i.u = e, W.__H.__h.push(i));
|
|
383
383
|
}
|
|
384
384
|
function qe(t) {
|
|
385
385
|
return ze = 5, ke(function() {
|
|
@@ -399,26 +399,26 @@ function Mn() {
|
|
|
399
399
|
for (var t; t = Vi.shift(); ) if (t.__P && t.__H) try {
|
|
400
400
|
t.__H.__h.forEach(it), t.__H.__h.forEach(At), t.__H.__h = [];
|
|
401
401
|
} catch (e) {
|
|
402
|
-
t.__H.__h = [],
|
|
402
|
+
t.__H.__h = [], j.__e(e, t.__v);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
},
|
|
405
|
+
j.__b = function(t) {
|
|
406
|
+
W = null, ii && ii(t);
|
|
407
|
+
}, j.__ = function(t, e) {
|
|
408
408
|
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), ai && ai(t, e);
|
|
409
|
-
},
|
|
409
|
+
}, j.__r = function(t) {
|
|
410
410
|
ni && ni(t), He = 0;
|
|
411
|
-
var e = (
|
|
412
|
-
e && (_t ===
|
|
411
|
+
var e = (W = t.__c).__H;
|
|
412
|
+
e && (_t === W ? (e.__h = [], W.__h = [], e.__.forEach(function(i) {
|
|
413
413
|
i.__N && (i.__ = i.__N), i.u = i.__N = void 0;
|
|
414
|
-
})) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], He = 0)), _t =
|
|
415
|
-
},
|
|
414
|
+
})) : (e.__h.forEach(it), e.__h.forEach(At), e.__h = [], He = 0)), _t = W;
|
|
415
|
+
}, j.diffed = function(t) {
|
|
416
416
|
ri && ri(t);
|
|
417
417
|
var e = t.__c;
|
|
418
|
-
e && e.__H && (e.__H.__h.length && (Vi.push(e) !== 1 && ti ===
|
|
418
|
+
e && e.__H && (e.__H.__h.length && (Vi.push(e) !== 1 && ti === j.requestAnimationFrame || ((ti = j.requestAnimationFrame) || Dn)(Mn)), e.__H.__.forEach(function(i) {
|
|
419
419
|
i.u && (i.__H = i.u), i.u = void 0;
|
|
420
|
-
})), _t =
|
|
421
|
-
},
|
|
420
|
+
})), _t = W = null;
|
|
421
|
+
}, j.__c = function(t, e) {
|
|
422
422
|
e.some(function(i) {
|
|
423
423
|
try {
|
|
424
424
|
i.__h.forEach(it), i.__h = i.__h.filter(function(n) {
|
|
@@ -427,10 +427,10 @@ V.__b = function(t) {
|
|
|
427
427
|
} catch (n) {
|
|
428
428
|
e.some(function(a) {
|
|
429
429
|
a.__h && (a.__h = []);
|
|
430
|
-
}), e = [],
|
|
430
|
+
}), e = [], j.__e(n, i.__v);
|
|
431
431
|
}
|
|
432
432
|
}), oi && oi(t, e);
|
|
433
|
-
},
|
|
433
|
+
}, j.unmount = function(t) {
|
|
434
434
|
si && si(t);
|
|
435
435
|
var e, i = t.__c;
|
|
436
436
|
i && i.__H && (i.__H.__.forEach(function(n) {
|
|
@@ -439,7 +439,7 @@ V.__b = function(t) {
|
|
|
439
439
|
} catch (a) {
|
|
440
440
|
e = a;
|
|
441
441
|
}
|
|
442
|
-
}), i.__H = void 0, e &&
|
|
442
|
+
}), i.__H = void 0, e && j.__e(e, i.__v));
|
|
443
443
|
};
|
|
444
444
|
var li = typeof requestAnimationFrame == "function";
|
|
445
445
|
function Dn(t) {
|
|
@@ -449,12 +449,12 @@ function Dn(t) {
|
|
|
449
449
|
li && (e = requestAnimationFrame(i));
|
|
450
450
|
}
|
|
451
451
|
function it(t) {
|
|
452
|
-
var e =
|
|
453
|
-
typeof i == "function" && (t.__c = void 0, i()),
|
|
452
|
+
var e = W, i = t.__c;
|
|
453
|
+
typeof i == "function" && (t.__c = void 0, i()), W = e;
|
|
454
454
|
}
|
|
455
455
|
function At(t) {
|
|
456
|
-
var e =
|
|
457
|
-
t.__c = t.__(),
|
|
456
|
+
var e = W;
|
|
457
|
+
t.__c = t.__(), W = e;
|
|
458
458
|
}
|
|
459
459
|
function Wi(t, e) {
|
|
460
460
|
return !t || t.length !== e.length || e.some(function(i, n) {
|
|
@@ -493,41 +493,41 @@ function Pn(t) {
|
|
|
493
493
|
dt();
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
var
|
|
496
|
+
var L = void 0;
|
|
497
497
|
function Gi(t) {
|
|
498
|
-
var e =
|
|
499
|
-
|
|
498
|
+
var e = L;
|
|
499
|
+
L = void 0;
|
|
500
500
|
try {
|
|
501
501
|
return t();
|
|
502
502
|
} finally {
|
|
503
|
-
|
|
503
|
+
L = e;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
506
|
var je = void 0, ge = 0, Ot = 0, st = 0;
|
|
507
507
|
function Hi(t) {
|
|
508
|
-
if (
|
|
508
|
+
if (L !== void 0) {
|
|
509
509
|
var e = t.n;
|
|
510
|
-
if (e === void 0 || e.t !==
|
|
511
|
-
return e = { i: 0, S: t, p:
|
|
510
|
+
if (e === void 0 || e.t !== L)
|
|
511
|
+
return e = { i: 0, S: t, p: L.s, n: void 0, t: L, e: void 0, x: void 0, r: e }, L.s !== void 0 && (L.s.n = e), L.s = e, t.n = e, 32 & L.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 =
|
|
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 = L.s, e.n = void 0, L.s.n = e, L.s = e), e;
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function X(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
|
-
|
|
520
|
-
|
|
519
|
+
X.prototype.brand = Un;
|
|
520
|
+
X.prototype.h = function() {
|
|
521
521
|
return !0;
|
|
522
522
|
};
|
|
523
|
-
|
|
523
|
+
X.prototype.S = function(t) {
|
|
524
524
|
var e = this, i = this.t;
|
|
525
525
|
i !== t && t.e === void 0 && (t.x = i, this.t = t, i !== void 0 ? i.e = t : Gi(function() {
|
|
526
526
|
var n;
|
|
527
527
|
(n = e.W) == null || n.call(e);
|
|
528
528
|
}));
|
|
529
529
|
};
|
|
530
|
-
|
|
530
|
+
X.prototype.U = function(t) {
|
|
531
531
|
var e = this;
|
|
532
532
|
if (this.t !== void 0) {
|
|
533
533
|
var i = t.e, n = t.x;
|
|
@@ -537,37 +537,37 @@ Y.prototype.U = function(t) {
|
|
|
537
537
|
}));
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
X.prototype.subscribe = function(t) {
|
|
541
541
|
var e = this;
|
|
542
542
|
return Ke(function() {
|
|
543
|
-
var i = e.value, n =
|
|
544
|
-
|
|
543
|
+
var i = e.value, n = L;
|
|
544
|
+
L = void 0;
|
|
545
545
|
try {
|
|
546
546
|
t(i);
|
|
547
547
|
} finally {
|
|
548
|
-
|
|
548
|
+
L = n;
|
|
549
549
|
}
|
|
550
550
|
}, { name: "sub" });
|
|
551
551
|
};
|
|
552
|
-
|
|
552
|
+
X.prototype.valueOf = function() {
|
|
553
553
|
return this.value;
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
X.prototype.toString = function() {
|
|
556
556
|
return this.value + "";
|
|
557
557
|
};
|
|
558
|
-
|
|
558
|
+
X.prototype.toJSON = function() {
|
|
559
559
|
return this.value;
|
|
560
560
|
};
|
|
561
|
-
|
|
562
|
-
var t =
|
|
563
|
-
|
|
561
|
+
X.prototype.peek = function() {
|
|
562
|
+
var t = L;
|
|
563
|
+
L = void 0;
|
|
564
564
|
try {
|
|
565
565
|
return this.value;
|
|
566
566
|
} finally {
|
|
567
|
-
|
|
567
|
+
L = t;
|
|
568
568
|
}
|
|
569
569
|
};
|
|
570
|
-
Object.defineProperty(
|
|
570
|
+
Object.defineProperty(X.prototype, "value", { get: function() {
|
|
571
571
|
var t = Hi(this);
|
|
572
572
|
return t !== void 0 && (t.i = this.i), this.v;
|
|
573
573
|
}, set: function(t) {
|
|
@@ -581,8 +581,8 @@ Object.defineProperty(Y.prototype, "value", { get: function() {
|
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
} });
|
|
584
|
-
function
|
|
585
|
-
return new
|
|
584
|
+
function q(t, e) {
|
|
585
|
+
return new X(t, e);
|
|
586
586
|
}
|
|
587
587
|
function zi(t) {
|
|
588
588
|
for (var e = t.s; e !== void 0; e = e.n) if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i) return !0;
|
|
@@ -605,33 +605,33 @@ function Yi(t) {
|
|
|
605
605
|
t.s = i;
|
|
606
606
|
}
|
|
607
607
|
function be(t, e) {
|
|
608
|
-
|
|
608
|
+
X.call(this, void 0), this.x = t, this.s = void 0, this.g = st - 1, this.f = 4, this.W = e?.watched, this.Z = e?.unwatched, this.name = e?.name;
|
|
609
609
|
}
|
|
610
|
-
be.prototype = new
|
|
610
|
+
be.prototype = new X();
|
|
611
611
|
be.prototype.h = function() {
|
|
612
612
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
613
613
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === st)) return !0;
|
|
614
614
|
if (this.g = st, this.f |= 1, this.i > 0 && !zi(this))
|
|
615
615
|
return this.f &= -2, !0;
|
|
616
|
-
var t =
|
|
616
|
+
var t = L;
|
|
617
617
|
try {
|
|
618
|
-
qi(this),
|
|
618
|
+
qi(this), L = 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 (i) {
|
|
622
622
|
this.v = i, this.f |= 16, this.i++;
|
|
623
623
|
}
|
|
624
|
-
return
|
|
624
|
+
return L = t, Yi(this), this.f &= -2, !0;
|
|
625
625
|
};
|
|
626
626
|
be.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
|
+
X.prototype.S.call(this, t);
|
|
632
632
|
};
|
|
633
633
|
be.prototype.U = function(t) {
|
|
634
|
-
if (this.t !== void 0 && (
|
|
634
|
+
if (this.t !== void 0 && (X.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
|
}
|
|
@@ -655,14 +655,14 @@ function Ki(t) {
|
|
|
655
655
|
var e = t.u;
|
|
656
656
|
if (t.u = void 0, typeof e == "function") {
|
|
657
657
|
ge++;
|
|
658
|
-
var i =
|
|
659
|
-
|
|
658
|
+
var i = L;
|
|
659
|
+
L = void 0;
|
|
660
660
|
try {
|
|
661
661
|
e();
|
|
662
662
|
} catch (n) {
|
|
663
663
|
throw t.f &= -2, t.f |= 8, Ft(t), n;
|
|
664
664
|
} finally {
|
|
665
|
-
|
|
665
|
+
L = i, dt();
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
}
|
|
@@ -671,8 +671,8 @@ function Ft(t) {
|
|
|
671
671
|
t.x = void 0, t.s = void 0, Ki(t);
|
|
672
672
|
}
|
|
673
673
|
function Bn(t) {
|
|
674
|
-
if (
|
|
675
|
-
Yi(this),
|
|
674
|
+
if (L !== this) throw new Error("Out-of-order effect");
|
|
675
|
+
Yi(this), L = t, this.f &= -2, 8 & this.f && Ft(this), dt();
|
|
676
676
|
}
|
|
677
677
|
function De(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;
|
|
@@ -690,8 +690,8 @@ De.prototype.c = function() {
|
|
|
690
690
|
De.prototype.S = function() {
|
|
691
691
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
692
692
|
this.f |= 1, this.f &= -9, Ki(this), qi(this), ge++;
|
|
693
|
-
var t =
|
|
694
|
-
return
|
|
693
|
+
var t = L;
|
|
694
|
+
return L = this, Bn.bind(this, t);
|
|
695
695
|
};
|
|
696
696
|
De.prototype.N = function() {
|
|
697
697
|
2 & this.f || (this.f |= 2, this.o = je, je = this);
|
|
@@ -717,7 +717,7 @@ Ke(function() {
|
|
|
717
717
|
Ji = this.N;
|
|
718
718
|
})();
|
|
719
719
|
function Ue(t, e) {
|
|
720
|
-
|
|
720
|
+
M[t] = e.bind(null, M[t] || function() {
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
function at(t) {
|
|
@@ -731,25 +731,25 @@ function Zi(t) {
|
|
|
731
731
|
m.__c.__$f |= 4;
|
|
732
732
|
break;
|
|
733
733
|
}
|
|
734
|
-
var
|
|
734
|
+
var f = ci(function() {
|
|
735
735
|
var E = n.value.value;
|
|
736
736
|
return E === 0 ? 0 : E === !0 ? "" : E || "";
|
|
737
|
-
}),
|
|
738
|
-
return !Array.isArray(
|
|
737
|
+
}), p = ci(function() {
|
|
738
|
+
return !Array.isArray(f.value) && !bi(f.value);
|
|
739
739
|
}), u = Ke(function() {
|
|
740
|
-
if (this.N = en,
|
|
741
|
-
var E =
|
|
740
|
+
if (this.N = en, p.value) {
|
|
741
|
+
var E = f.value;
|
|
742
742
|
l.__v && l.__v.__e && l.__v.__e.nodeType === 3 && (l.__v.__e.data = E);
|
|
743
743
|
}
|
|
744
|
-
}),
|
|
744
|
+
}), y = e.__$u.d;
|
|
745
745
|
return e.__$u.d = function() {
|
|
746
|
-
u(),
|
|
747
|
-
}, [
|
|
746
|
+
u(), y.call(this);
|
|
747
|
+
}, [p, f];
|
|
748
748
|
}, []), s = a[0], c = a[1];
|
|
749
749
|
return s.value ? c.peek() : c.value;
|
|
750
750
|
}
|
|
751
751
|
Zi.displayName = "ReactiveTextNode";
|
|
752
|
-
Object.defineProperties(
|
|
752
|
+
Object.defineProperties(X.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Zi }, props: { configurable: !0, get: function() {
|
|
753
753
|
return { data: this };
|
|
754
754
|
} }, __b: { configurable: !0, value: 1 } });
|
|
755
755
|
Ue("__b", function(t, e) {
|
|
@@ -757,7 +757,7 @@ Ue("__b", function(t, e) {
|
|
|
757
757
|
var i, n = e.props;
|
|
758
758
|
for (var a in n) if (a !== "children") {
|
|
759
759
|
var s = n[a];
|
|
760
|
-
s instanceof
|
|
760
|
+
s instanceof X && (i || (e.__np = i = {}), i[a] = s, n[a] = s.peek());
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
t(e);
|
|
@@ -795,15 +795,15 @@ Ue("diffed", function(t, e) {
|
|
|
795
795
|
else
|
|
796
796
|
s = {}, i.U = s;
|
|
797
797
|
for (var m in n) {
|
|
798
|
-
var
|
|
799
|
-
|
|
798
|
+
var f = s[m], p = n[m];
|
|
799
|
+
f === void 0 ? (f = $n(i, m, p, a), s[m] = f) : f.o(p, a);
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
t(e);
|
|
804
804
|
});
|
|
805
805
|
function $n(t, e, i, n) {
|
|
806
|
-
var a = e in t && t.ownerSVGElement === void 0, s =
|
|
806
|
+
var a = e in t && t.ownerSVGElement === void 0, s = q(i);
|
|
807
807
|
return { o: function(c, l) {
|
|
808
808
|
s.value = c, n = l;
|
|
809
809
|
}, d: Ke(function() {
|
|
@@ -851,7 +851,7 @@ Ne.prototype.shouldComponentUpdate = function(t, e) {
|
|
|
851
851
|
};
|
|
852
852
|
function Qi(t, e) {
|
|
853
853
|
return Rt(function() {
|
|
854
|
-
return
|
|
854
|
+
return q(t, e);
|
|
855
855
|
})[0];
|
|
856
856
|
}
|
|
857
857
|
var Vn = function(t) {
|
|
@@ -865,7 +865,7 @@ function Wn() {
|
|
|
865
865
|
});
|
|
866
866
|
}
|
|
867
867
|
function en() {
|
|
868
|
-
Xi.push(this) === 1 && (
|
|
868
|
+
Xi.push(this) === 1 && (M.requestAnimationFrame || Vn)(Wn);
|
|
869
869
|
}
|
|
870
870
|
const di = {
|
|
871
871
|
layout: "floating",
|
|
@@ -912,48 +912,48 @@ function Gn(t) {
|
|
|
912
912
|
var gt = {}, Be = {}, ui;
|
|
913
913
|
function Hn() {
|
|
914
914
|
if (ui) return Be;
|
|
915
|
-
ui = 1, Be.byteLength = l, Be.toByteArray =
|
|
915
|
+
ui = 1, Be.byteLength = l, Be.toByteArray = f, Be.fromByteArray = y;
|
|
916
916
|
for (var t = [], e = [], i = typeof Uint8Array < "u" ? Uint8Array : Array, n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, s = n.length; a < s; ++a)
|
|
917
917
|
t[a] = n[a], e[n.charCodeAt(a)] = a;
|
|
918
918
|
e[45] = 62, e[95] = 63;
|
|
919
919
|
function c(E) {
|
|
920
|
-
var
|
|
921
|
-
if (
|
|
920
|
+
var T = E.length;
|
|
921
|
+
if (T % 4 > 0)
|
|
922
922
|
throw new Error("Invalid string. Length must be a multiple of 4");
|
|
923
|
-
var
|
|
924
|
-
|
|
925
|
-
var
|
|
926
|
-
return [
|
|
923
|
+
var I = E.indexOf("=");
|
|
924
|
+
I === -1 && (I = T);
|
|
925
|
+
var w = I === T ? 0 : 4 - I % 4;
|
|
926
|
+
return [I, w];
|
|
927
927
|
}
|
|
928
928
|
function l(E) {
|
|
929
|
-
var
|
|
930
|
-
return (
|
|
929
|
+
var T = c(E), I = T[0], w = T[1];
|
|
930
|
+
return (I + w) * 3 / 4 - w;
|
|
931
931
|
}
|
|
932
|
-
function m(E,
|
|
933
|
-
return (
|
|
934
|
-
}
|
|
935
|
-
function p(E) {
|
|
936
|
-
var S, y = c(E), I = y[0], w = y[1], b = new i(m(E, I, w)), O = 0, N = w > 0 ? I - 4 : I, R;
|
|
937
|
-
for (R = 0; R < N; R += 4)
|
|
938
|
-
S = e[E.charCodeAt(R)] << 18 | e[E.charCodeAt(R + 1)] << 12 | e[E.charCodeAt(R + 2)] << 6 | e[E.charCodeAt(R + 3)], b[O++] = S >> 16 & 255, b[O++] = S >> 8 & 255, b[O++] = S & 255;
|
|
939
|
-
return w === 2 && (S = e[E.charCodeAt(R)] << 2 | e[E.charCodeAt(R + 1)] >> 4, b[O++] = S & 255), w === 1 && (S = e[E.charCodeAt(R)] << 10 | e[E.charCodeAt(R + 1)] << 4 | e[E.charCodeAt(R + 2)] >> 2, b[O++] = S >> 8 & 255, b[O++] = S & 255), b;
|
|
932
|
+
function m(E, T, I) {
|
|
933
|
+
return (T + I) * 3 / 4 - I;
|
|
940
934
|
}
|
|
941
935
|
function f(E) {
|
|
936
|
+
var T, I = c(E), w = I[0], A = I[1], R = new i(m(E, w, A)), b = 0, N = A > 0 ? w - 4 : w, S;
|
|
937
|
+
for (S = 0; S < N; S += 4)
|
|
938
|
+
T = e[E.charCodeAt(S)] << 18 | e[E.charCodeAt(S + 1)] << 12 | e[E.charCodeAt(S + 2)] << 6 | e[E.charCodeAt(S + 3)], R[b++] = T >> 16 & 255, R[b++] = T >> 8 & 255, R[b++] = T & 255;
|
|
939
|
+
return A === 2 && (T = e[E.charCodeAt(S)] << 2 | e[E.charCodeAt(S + 1)] >> 4, R[b++] = T & 255), A === 1 && (T = e[E.charCodeAt(S)] << 10 | e[E.charCodeAt(S + 1)] << 4 | e[E.charCodeAt(S + 2)] >> 2, R[b++] = T >> 8 & 255, R[b++] = T & 255), R;
|
|
940
|
+
}
|
|
941
|
+
function p(E) {
|
|
942
942
|
return t[E >> 18 & 63] + t[E >> 12 & 63] + t[E >> 6 & 63] + t[E & 63];
|
|
943
943
|
}
|
|
944
|
-
function u(E,
|
|
945
|
-
for (var
|
|
946
|
-
|
|
947
|
-
return
|
|
944
|
+
function u(E, T, I) {
|
|
945
|
+
for (var w, A = [], R = T; R < I; R += 3)
|
|
946
|
+
w = (E[R] << 16 & 16711680) + (E[R + 1] << 8 & 65280) + (E[R + 2] & 255), A.push(p(w));
|
|
947
|
+
return A.join("");
|
|
948
948
|
}
|
|
949
|
-
function
|
|
950
|
-
for (var
|
|
951
|
-
|
|
952
|
-
return
|
|
953
|
-
t[
|
|
954
|
-
)) :
|
|
955
|
-
t[
|
|
956
|
-
)),
|
|
949
|
+
function y(E) {
|
|
950
|
+
for (var T, I = E.length, w = I % 3, A = [], R = 16383, b = 0, N = I - w; b < N; b += R)
|
|
951
|
+
A.push(u(E, b, b + R > N ? N : b + R));
|
|
952
|
+
return w === 1 ? (T = E[I - 1], A.push(
|
|
953
|
+
t[T >> 2] + t[T << 4 & 63] + "=="
|
|
954
|
+
)) : w === 2 && (T = (E[I - 2] << 8) + E[I - 1], A.push(
|
|
955
|
+
t[T >> 10] + t[T >> 4 & 63] + t[T << 2 & 63] + "="
|
|
956
|
+
)), A.join("");
|
|
957
957
|
}
|
|
958
958
|
return Be;
|
|
959
959
|
}
|
|
@@ -961,33 +961,33 @@ var et = {};
|
|
|
961
961
|
var hi;
|
|
962
962
|
function zn() {
|
|
963
963
|
return hi || (hi = 1, et.read = function(t, e, i, n, a) {
|
|
964
|
-
var s, c, l = a * 8 - n - 1, m = (1 << l) - 1,
|
|
965
|
-
for (u +=
|
|
964
|
+
var s, c, l = a * 8 - n - 1, m = (1 << l) - 1, f = m >> 1, p = -7, u = i ? a - 1 : 0, y = i ? -1 : 1, E = t[e + u];
|
|
965
|
+
for (u += y, s = E & (1 << -p) - 1, E >>= -p, p += l; p > 0; s = s * 256 + t[e + u], u += y, p -= 8)
|
|
966
966
|
;
|
|
967
|
-
for (c = s & (1 << -
|
|
967
|
+
for (c = s & (1 << -p) - 1, s >>= -p, p += n; p > 0; c = c * 256 + t[e + u], u += y, p -= 8)
|
|
968
968
|
;
|
|
969
969
|
if (s === 0)
|
|
970
|
-
s = 1 -
|
|
970
|
+
s = 1 - f;
|
|
971
971
|
else {
|
|
972
972
|
if (s === m)
|
|
973
973
|
return c ? NaN : (E ? -1 : 1) * (1 / 0);
|
|
974
|
-
c = c + Math.pow(2, n), s = s -
|
|
974
|
+
c = c + Math.pow(2, n), s = s - f;
|
|
975
975
|
}
|
|
976
976
|
return (E ? -1 : 1) * c * Math.pow(2, s - n);
|
|
977
977
|
}, et.write = function(t, e, i, n, a, s) {
|
|
978
|
-
var c, l, m,
|
|
979
|
-
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c =
|
|
978
|
+
var c, l, m, f = s * 8 - a - 1, p = (1 << f) - 1, u = p >> 1, y = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, E = n ? 0 : s - 1, T = n ? 1 : -1, I = e < 0 || e === 0 && 1 / e < 0 ? 1 : 0;
|
|
979
|
+
for (e = Math.abs(e), isNaN(e) || e === 1 / 0 ? (l = isNaN(e) ? 1 : 0, c = p) : (c = Math.floor(Math.log(e) / Math.LN2), e * (m = Math.pow(2, -c)) < 1 && (c--, m *= 2), c + u >= 1 ? e += y / m : e += y * Math.pow(2, 1 - u), e * m >= 2 && (c++, m /= 2), c + u >= p ? (l = 0, c = p) : c + u >= 1 ? (l = (e * m - 1) * Math.pow(2, a), c = c + u) : (l = e * Math.pow(2, u - 1) * Math.pow(2, a), c = 0)); a >= 8; t[i + E] = l & 255, E += T, l /= 256, a -= 8)
|
|
980
980
|
;
|
|
981
|
-
for (c = c << a | l,
|
|
981
|
+
for (c = c << a | l, f += a; f > 0; t[i + E] = c & 255, E += T, c /= 256, f -= 8)
|
|
982
982
|
;
|
|
983
|
-
t[i + E -
|
|
983
|
+
t[i + E - T] |= I * 128;
|
|
984
984
|
}), et;
|
|
985
985
|
}
|
|
986
986
|
var fi;
|
|
987
987
|
function qn() {
|
|
988
988
|
return fi || (fi = 1, (function(t) {
|
|
989
989
|
const e = Hn(), i = zn(), n = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
|
|
990
|
-
t.Buffer = l, t.SlowBuffer =
|
|
990
|
+
t.Buffer = l, t.SlowBuffer = R, t.INSPECT_MAX_BYTES = 50;
|
|
991
991
|
const a = 2147483647;
|
|
992
992
|
t.kMaxLength = a, l.TYPED_ARRAY_SUPPORT = s(), !l.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
|
|
993
993
|
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
|
|
@@ -1034,15 +1034,15 @@ function qn() {
|
|
|
1034
1034
|
l.poolSize = 8192;
|
|
1035
1035
|
function m(d, r, o) {
|
|
1036
1036
|
if (typeof d == "string")
|
|
1037
|
-
return
|
|
1037
|
+
return y(d, r);
|
|
1038
1038
|
if (ArrayBuffer.isView(d))
|
|
1039
|
-
return
|
|
1039
|
+
return T(d);
|
|
1040
1040
|
if (d == null)
|
|
1041
1041
|
throw new TypeError(
|
|
1042
1042
|
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof d
|
|
1043
1043
|
);
|
|
1044
1044
|
if (ae(d, ArrayBuffer) || d && ae(d.buffer, ArrayBuffer) || typeof SharedArrayBuffer < "u" && (ae(d, SharedArrayBuffer) || d && ae(d.buffer, SharedArrayBuffer)))
|
|
1045
|
-
return
|
|
1045
|
+
return I(d, r, o);
|
|
1046
1046
|
if (typeof d == "number")
|
|
1047
1047
|
throw new TypeError(
|
|
1048
1048
|
'The "value" argument must not be of type number. Received type number'
|
|
@@ -1050,7 +1050,7 @@ function qn() {
|
|
|
1050
1050
|
const h = d.valueOf && d.valueOf();
|
|
1051
1051
|
if (h != null && h !== d)
|
|
1052
1052
|
return l.from(h, r, o);
|
|
1053
|
-
const _ =
|
|
1053
|
+
const _ = w(d);
|
|
1054
1054
|
if (_) return _;
|
|
1055
1055
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof d[Symbol.toPrimitive] == "function")
|
|
1056
1056
|
return l.from(d[Symbol.toPrimitive]("string"), r, o);
|
|
@@ -1061,48 +1061,48 @@ function qn() {
|
|
|
1061
1061
|
l.from = function(d, r, o) {
|
|
1062
1062
|
return m(d, r, o);
|
|
1063
1063
|
}, Object.setPrototypeOf(l.prototype, Uint8Array.prototype), Object.setPrototypeOf(l, Uint8Array);
|
|
1064
|
-
function
|
|
1064
|
+
function f(d) {
|
|
1065
1065
|
if (typeof d != "number")
|
|
1066
1066
|
throw new TypeError('"size" argument must be of type number');
|
|
1067
1067
|
if (d < 0)
|
|
1068
1068
|
throw new RangeError('The value "' + d + '" is invalid for option "size"');
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1071
|
-
return
|
|
1070
|
+
function p(d, r, o) {
|
|
1071
|
+
return f(d), d <= 0 ? c(d) : r !== void 0 ? typeof o == "string" ? c(d).fill(r, o) : c(d).fill(r) : c(d);
|
|
1072
1072
|
}
|
|
1073
1073
|
l.alloc = function(d, r, o) {
|
|
1074
|
-
return
|
|
1074
|
+
return p(d, r, o);
|
|
1075
1075
|
};
|
|
1076
1076
|
function u(d) {
|
|
1077
|
-
return
|
|
1077
|
+
return f(d), c(d < 0 ? 0 : A(d) | 0);
|
|
1078
1078
|
}
|
|
1079
1079
|
l.allocUnsafe = function(d) {
|
|
1080
1080
|
return u(d);
|
|
1081
1081
|
}, l.allocUnsafeSlow = function(d) {
|
|
1082
1082
|
return u(d);
|
|
1083
1083
|
};
|
|
1084
|
-
function
|
|
1084
|
+
function y(d, r) {
|
|
1085
1085
|
if ((typeof r != "string" || r === "") && (r = "utf8"), !l.isEncoding(r))
|
|
1086
1086
|
throw new TypeError("Unknown encoding: " + r);
|
|
1087
|
-
const o =
|
|
1087
|
+
const o = b(d, r) | 0;
|
|
1088
1088
|
let h = c(o);
|
|
1089
1089
|
const _ = h.write(d, r);
|
|
1090
1090
|
return _ !== o && (h = h.slice(0, _)), h;
|
|
1091
1091
|
}
|
|
1092
1092
|
function E(d) {
|
|
1093
|
-
const r = d.length < 0 ? 0 :
|
|
1093
|
+
const r = d.length < 0 ? 0 : A(d.length) | 0, o = c(r);
|
|
1094
1094
|
for (let h = 0; h < r; h += 1)
|
|
1095
1095
|
o[h] = d[h] & 255;
|
|
1096
1096
|
return o;
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1098
|
+
function T(d) {
|
|
1099
1099
|
if (ae(d, Uint8Array)) {
|
|
1100
1100
|
const r = new Uint8Array(d);
|
|
1101
|
-
return
|
|
1101
|
+
return I(r.buffer, r.byteOffset, r.byteLength);
|
|
1102
1102
|
}
|
|
1103
1103
|
return E(d);
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function I(d, r, o) {
|
|
1106
1106
|
if (r < 0 || d.byteLength < r)
|
|
1107
1107
|
throw new RangeError('"offset" is outside of buffer bounds');
|
|
1108
1108
|
if (d.byteLength < r + (o || 0))
|
|
@@ -1110,9 +1110,9 @@ function qn() {
|
|
|
1110
1110
|
let h;
|
|
1111
1111
|
return r === void 0 && o === void 0 ? h = new Uint8Array(d) : o === void 0 ? h = new Uint8Array(d, r) : h = new Uint8Array(d, r, o), Object.setPrototypeOf(h, l.prototype), h;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1113
|
+
function w(d) {
|
|
1114
1114
|
if (l.isBuffer(d)) {
|
|
1115
|
-
const r =
|
|
1115
|
+
const r = A(d.length) | 0, o = c(r);
|
|
1116
1116
|
return o.length === 0 || d.copy(o, 0, 0, r), o;
|
|
1117
1117
|
}
|
|
1118
1118
|
if (d.length !== void 0)
|
|
@@ -1120,12 +1120,12 @@ function qn() {
|
|
|
1120
1120
|
if (d.type === "Buffer" && Array.isArray(d.data))
|
|
1121
1121
|
return E(d.data);
|
|
1122
1122
|
}
|
|
1123
|
-
function
|
|
1123
|
+
function A(d) {
|
|
1124
1124
|
if (d >= a)
|
|
1125
1125
|
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a.toString(16) + " bytes");
|
|
1126
1126
|
return d | 0;
|
|
1127
1127
|
}
|
|
1128
|
-
function
|
|
1128
|
+
function R(d) {
|
|
1129
1129
|
return +d != d && (d = 0), l.alloc(+d);
|
|
1130
1130
|
}
|
|
1131
1131
|
l.isBuffer = function(r) {
|
|
@@ -1187,7 +1187,7 @@ function qn() {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
return _;
|
|
1189
1189
|
};
|
|
1190
|
-
function
|
|
1190
|
+
function b(d, r) {
|
|
1191
1191
|
if (l.isBuffer(d))
|
|
1192
1192
|
return d.length;
|
|
1193
1193
|
if (ArrayBuffer.isView(d) || ae(d, ArrayBuffer))
|
|
@@ -1223,7 +1223,7 @@ function qn() {
|
|
|
1223
1223
|
r = ("" + r).toLowerCase(), _ = !0;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
l.byteLength =
|
|
1226
|
+
l.byteLength = b;
|
|
1227
1227
|
function N(d, r, o) {
|
|
1228
1228
|
let h = !1;
|
|
1229
1229
|
if ((r === void 0 || r < 0) && (r = 0), r > this.length || ((o === void 0 || o > this.length) && (o = this.length), o <= 0) || (o >>>= 0, r >>>= 0, o <= r))
|
|
@@ -1236,7 +1236,7 @@ function qn() {
|
|
|
1236
1236
|
case "utf-8":
|
|
1237
1237
|
return ue(this, r, o);
|
|
1238
1238
|
case "ascii":
|
|
1239
|
-
return
|
|
1239
|
+
return re(this, r, o);
|
|
1240
1240
|
case "latin1":
|
|
1241
1241
|
case "binary":
|
|
1242
1242
|
return ut(this, r, o);
|
|
@@ -1246,14 +1246,14 @@ function qn() {
|
|
|
1246
1246
|
case "ucs-2":
|
|
1247
1247
|
case "utf16le":
|
|
1248
1248
|
case "utf-16le":
|
|
1249
|
-
return
|
|
1249
|
+
return G(this, r, o);
|
|
1250
1250
|
default:
|
|
1251
1251
|
if (h) throw new TypeError("Unknown encoding: " + d);
|
|
1252
1252
|
d = (d + "").toLowerCase(), h = !0;
|
|
1253
1253
|
}
|
|
1254
1254
|
}
|
|
1255
1255
|
l.prototype._isBuffer = !0;
|
|
1256
|
-
function
|
|
1256
|
+
function S(d, r, o) {
|
|
1257
1257
|
const h = d[r];
|
|
1258
1258
|
d[r] = d[o], d[o] = h;
|
|
1259
1259
|
}
|
|
@@ -1262,21 +1262,21 @@ function qn() {
|
|
|
1262
1262
|
if (r % 2 !== 0)
|
|
1263
1263
|
throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
1264
1264
|
for (let o = 0; o < r; o += 2)
|
|
1265
|
-
|
|
1265
|
+
S(this, o, o + 1);
|
|
1266
1266
|
return this;
|
|
1267
1267
|
}, l.prototype.swap32 = function() {
|
|
1268
1268
|
const r = this.length;
|
|
1269
1269
|
if (r % 4 !== 0)
|
|
1270
1270
|
throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
1271
1271
|
for (let o = 0; o < r; o += 4)
|
|
1272
|
-
|
|
1272
|
+
S(this, o, o + 3), S(this, o + 1, o + 2);
|
|
1273
1273
|
return this;
|
|
1274
1274
|
}, l.prototype.swap64 = function() {
|
|
1275
1275
|
const r = this.length;
|
|
1276
1276
|
if (r % 8 !== 0)
|
|
1277
1277
|
throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
1278
1278
|
for (let o = 0; o < r; o += 8)
|
|
1279
|
-
|
|
1279
|
+
S(this, o, o + 7), S(this, o + 1, o + 6), S(this, o + 2, o + 5), S(this, o + 3, o + 4);
|
|
1280
1280
|
return this;
|
|
1281
1281
|
}, l.prototype.toString = function() {
|
|
1282
1282
|
const r = this.length;
|
|
@@ -1303,15 +1303,15 @@ function qn() {
|
|
|
1303
1303
|
return 1;
|
|
1304
1304
|
if (o >>>= 0, h >>>= 0, _ >>>= 0, g >>>= 0, this === r) return 0;
|
|
1305
1305
|
let v = g - _, x = h - o;
|
|
1306
|
-
const
|
|
1307
|
-
for (let
|
|
1308
|
-
if (D
|
|
1309
|
-
v = D
|
|
1306
|
+
const F = Math.min(v, x), P = this.slice(_, g), $ = r.slice(o, h);
|
|
1307
|
+
for (let D = 0; D < F; ++D)
|
|
1308
|
+
if (P[D] !== $[D]) {
|
|
1309
|
+
v = P[D], x = $[D];
|
|
1310
1310
|
break;
|
|
1311
1311
|
}
|
|
1312
1312
|
return v < x ? -1 : x < v ? 1 : 0;
|
|
1313
1313
|
};
|
|
1314
|
-
function
|
|
1314
|
+
function k(d, r, o, h, _) {
|
|
1315
1315
|
if (d.length === 0) return -1;
|
|
1316
1316
|
if (typeof o == "string" ? (h = o, o = 0) : o > 2147483647 ? o = 2147483647 : o < -2147483648 && (o = -2147483648), o = +o, pt(o) && (o = _ ? 0 : d.length - 1), o < 0 && (o = d.length + o), o >= d.length) {
|
|
1317
1317
|
if (_) return -1;
|
|
@@ -1320,49 +1320,49 @@ function qn() {
|
|
|
1320
1320
|
if (_) o = 0;
|
|
1321
1321
|
else return -1;
|
|
1322
1322
|
if (typeof r == "string" && (r = l.from(r, h)), l.isBuffer(r))
|
|
1323
|
-
return r.length === 0 ? -1 :
|
|
1323
|
+
return r.length === 0 ? -1 : U(d, r, o, h, _);
|
|
1324
1324
|
if (typeof r == "number")
|
|
1325
|
-
return r = r & 255, typeof Uint8Array.prototype.indexOf == "function" ? _ ? Uint8Array.prototype.indexOf.call(d, r, o) : Uint8Array.prototype.lastIndexOf.call(d, r, o) :
|
|
1325
|
+
return r = r & 255, typeof Uint8Array.prototype.indexOf == "function" ? _ ? Uint8Array.prototype.indexOf.call(d, r, o) : Uint8Array.prototype.lastIndexOf.call(d, r, o) : U(d, [r], o, h, _);
|
|
1326
1326
|
throw new TypeError("val must be string, number or Buffer");
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function U(d, r, o, h, _) {
|
|
1329
1329
|
let g = 1, v = d.length, x = r.length;
|
|
1330
1330
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
1331
1331
|
if (d.length < 2 || r.length < 2)
|
|
1332
1332
|
return -1;
|
|
1333
1333
|
g = 2, v /= 2, x /= 2, o /= 2;
|
|
1334
1334
|
}
|
|
1335
|
-
function
|
|
1336
|
-
return g === 1 ?
|
|
1335
|
+
function F($, D) {
|
|
1336
|
+
return g === 1 ? $[D] : $.readUInt16BE(D * g);
|
|
1337
1337
|
}
|
|
1338
|
-
let
|
|
1338
|
+
let P;
|
|
1339
1339
|
if (_) {
|
|
1340
|
-
let
|
|
1341
|
-
for (
|
|
1342
|
-
if (
|
|
1343
|
-
if (
|
|
1340
|
+
let $ = -1;
|
|
1341
|
+
for (P = o; P < v; P++)
|
|
1342
|
+
if (F(d, P) === F(r, $ === -1 ? 0 : P - $)) {
|
|
1343
|
+
if ($ === -1 && ($ = P), P - $ + 1 === x) return $ * g;
|
|
1344
1344
|
} else
|
|
1345
|
-
|
|
1345
|
+
$ !== -1 && (P -= P - $), $ = -1;
|
|
1346
1346
|
} else
|
|
1347
|
-
for (o + x > v && (o = v - x),
|
|
1348
|
-
let
|
|
1349
|
-
for (let
|
|
1350
|
-
if (
|
|
1351
|
-
|
|
1347
|
+
for (o + x > v && (o = v - x), P = o; P >= 0; P--) {
|
|
1348
|
+
let $ = !0;
|
|
1349
|
+
for (let D = 0; D < x; D++)
|
|
1350
|
+
if (F(d, P + D) !== F(r, D)) {
|
|
1351
|
+
$ = !1;
|
|
1352
1352
|
break;
|
|
1353
1353
|
}
|
|
1354
|
-
if (
|
|
1354
|
+
if ($) return P;
|
|
1355
1355
|
}
|
|
1356
1356
|
return -1;
|
|
1357
1357
|
}
|
|
1358
1358
|
l.prototype.includes = function(r, o, h) {
|
|
1359
1359
|
return this.indexOf(r, o, h) !== -1;
|
|
1360
1360
|
}, l.prototype.indexOf = function(r, o, h) {
|
|
1361
|
-
return
|
|
1361
|
+
return k(this, r, o, h, !0);
|
|
1362
1362
|
}, l.prototype.lastIndexOf = function(r, o, h) {
|
|
1363
|
-
return
|
|
1363
|
+
return k(this, r, o, h, !1);
|
|
1364
1364
|
};
|
|
1365
|
-
function
|
|
1365
|
+
function z(d, r, o, h) {
|
|
1366
1366
|
o = Number(o) || 0;
|
|
1367
1367
|
const _ = d.length - o;
|
|
1368
1368
|
h ? (h = Number(h), h > _ && (h = _)) : h = _;
|
|
@@ -1376,16 +1376,16 @@ function qn() {
|
|
|
1376
1376
|
}
|
|
1377
1377
|
return v;
|
|
1378
1378
|
}
|
|
1379
|
-
function
|
|
1379
|
+
function Y(d, r, o, h) {
|
|
1380
1380
|
return Xe(ft(r, d.length - o), d, o, h);
|
|
1381
1381
|
}
|
|
1382
1382
|
function oe(d, r, o, h) {
|
|
1383
1383
|
return Xe(mn(r), d, o, h);
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1385
|
+
function K(d, r, o, h) {
|
|
1386
1386
|
return Xe(Kt(r), d, o, h);
|
|
1387
1387
|
}
|
|
1388
|
-
function
|
|
1388
|
+
function te(d, r, o, h) {
|
|
1389
1389
|
return Xe(gn(r, d.length - o), d, o, h);
|
|
1390
1390
|
}
|
|
1391
1391
|
l.prototype.write = function(r, o, h, _) {
|
|
@@ -1407,21 +1407,21 @@ function qn() {
|
|
|
1407
1407
|
for (; ; )
|
|
1408
1408
|
switch (_) {
|
|
1409
1409
|
case "hex":
|
|
1410
|
-
return
|
|
1410
|
+
return z(this, r, o, h);
|
|
1411
1411
|
case "utf8":
|
|
1412
1412
|
case "utf-8":
|
|
1413
|
-
return
|
|
1413
|
+
return Y(this, r, o, h);
|
|
1414
1414
|
case "ascii":
|
|
1415
1415
|
case "latin1":
|
|
1416
1416
|
case "binary":
|
|
1417
1417
|
return oe(this, r, o, h);
|
|
1418
1418
|
case "base64":
|
|
1419
|
-
return
|
|
1419
|
+
return K(this, r, o, h);
|
|
1420
1420
|
case "ucs2":
|
|
1421
1421
|
case "ucs-2":
|
|
1422
1422
|
case "utf16le":
|
|
1423
1423
|
case "utf-16le":
|
|
1424
|
-
return
|
|
1424
|
+
return te(this, r, o, h);
|
|
1425
1425
|
default:
|
|
1426
1426
|
if (v) throw new TypeError("Unknown encoding: " + _);
|
|
1427
1427
|
_ = ("" + _).toLowerCase(), v = !0;
|
|
@@ -1443,19 +1443,19 @@ function qn() {
|
|
|
1443
1443
|
const g = d[_];
|
|
1444
1444
|
let v = null, x = g > 239 ? 4 : g > 223 ? 3 : g > 191 ? 2 : 1;
|
|
1445
1445
|
if (_ + x <= o) {
|
|
1446
|
-
let
|
|
1446
|
+
let F, P, $, D;
|
|
1447
1447
|
switch (x) {
|
|
1448
1448
|
case 1:
|
|
1449
1449
|
g < 128 && (v = g);
|
|
1450
1450
|
break;
|
|
1451
1451
|
case 2:
|
|
1452
|
-
|
|
1452
|
+
F = d[_ + 1], (F & 192) === 128 && (D = (g & 31) << 6 | F & 63, D > 127 && (v = D));
|
|
1453
1453
|
break;
|
|
1454
1454
|
case 3:
|
|
1455
|
-
|
|
1455
|
+
F = d[_ + 1], P = d[_ + 2], (F & 192) === 128 && (P & 192) === 128 && (D = (g & 15) << 12 | (F & 63) << 6 | P & 63, D > 2047 && (D < 55296 || D > 57343) && (v = D));
|
|
1456
1456
|
break;
|
|
1457
1457
|
case 4:
|
|
1458
|
-
|
|
1458
|
+
F = d[_ + 1], P = d[_ + 2], $ = d[_ + 3], (F & 192) === 128 && (P & 192) === 128 && ($ & 192) === 128 && (D = (g & 15) << 18 | (F & 63) << 12 | (P & 63) << 6 | $ & 63, D > 65535 && D < 1114112 && (v = D));
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
1461
|
v === null ? (v = 65533, x = 1) : v > 65535 && (v -= 65536, h.push(v >>> 10 & 1023 | 55296), v = 56320 | v & 1023), h.push(v), _ += x;
|
|
@@ -1475,7 +1475,7 @@ function qn() {
|
|
|
1475
1475
|
);
|
|
1476
1476
|
return o;
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function re(d, r, o) {
|
|
1479
1479
|
let h = "";
|
|
1480
1480
|
o = Math.min(d.length, o);
|
|
1481
1481
|
for (let _ = r; _ < o; ++_)
|
|
@@ -1497,7 +1497,7 @@ function qn() {
|
|
|
1497
1497
|
_ += En[d[g]];
|
|
1498
1498
|
return _;
|
|
1499
1499
|
}
|
|
1500
|
-
function
|
|
1500
|
+
function G(d, r, o) {
|
|
1501
1501
|
const h = d.slice(r, o);
|
|
1502
1502
|
let _ = "";
|
|
1503
1503
|
for (let g = 0; g < h.length - 1; g += 2)
|
|
@@ -1510,32 +1510,32 @@ function qn() {
|
|
|
1510
1510
|
const _ = this.subarray(r, o);
|
|
1511
1511
|
return Object.setPrototypeOf(_, l.prototype), _;
|
|
1512
1512
|
};
|
|
1513
|
-
function
|
|
1513
|
+
function H(d, r, o) {
|
|
1514
1514
|
if (d % 1 !== 0 || d < 0) throw new RangeError("offset is not uint");
|
|
1515
1515
|
if (d + r > o) throw new RangeError("Trying to access beyond buffer length");
|
|
1516
1516
|
}
|
|
1517
1517
|
l.prototype.readUintLE = l.prototype.readUIntLE = function(r, o, h) {
|
|
1518
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1518
|
+
r = r >>> 0, o = o >>> 0, h || H(r, o, this.length);
|
|
1519
1519
|
let _ = this[r], g = 1, v = 0;
|
|
1520
1520
|
for (; ++v < o && (g *= 256); )
|
|
1521
1521
|
_ += this[r + v] * g;
|
|
1522
1522
|
return _;
|
|
1523
1523
|
}, l.prototype.readUintBE = l.prototype.readUIntBE = function(r, o, h) {
|
|
1524
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1524
|
+
r = r >>> 0, o = o >>> 0, h || H(r, o, this.length);
|
|
1525
1525
|
let _ = this[r + --o], g = 1;
|
|
1526
1526
|
for (; o > 0 && (g *= 256); )
|
|
1527
1527
|
_ += this[r + --o] * g;
|
|
1528
1528
|
return _;
|
|
1529
1529
|
}, l.prototype.readUint8 = l.prototype.readUInt8 = function(r, o) {
|
|
1530
|
-
return r = r >>> 0, o ||
|
|
1530
|
+
return r = r >>> 0, o || H(r, 1, this.length), this[r];
|
|
1531
1531
|
}, l.prototype.readUint16LE = l.prototype.readUInt16LE = function(r, o) {
|
|
1532
|
-
return r = r >>> 0, o ||
|
|
1532
|
+
return r = r >>> 0, o || H(r, 2, this.length), this[r] | this[r + 1] << 8;
|
|
1533
1533
|
}, l.prototype.readUint16BE = l.prototype.readUInt16BE = function(r, o) {
|
|
1534
|
-
return r = r >>> 0, o ||
|
|
1534
|
+
return r = r >>> 0, o || H(r, 2, this.length), this[r] << 8 | this[r + 1];
|
|
1535
1535
|
}, l.prototype.readUint32LE = l.prototype.readUInt32LE = function(r, o) {
|
|
1536
|
-
return r = r >>> 0, o ||
|
|
1536
|
+
return r = r >>> 0, o || H(r, 4, this.length), (this[r] | this[r + 1] << 8 | this[r + 2] << 16) + this[r + 3] * 16777216;
|
|
1537
1537
|
}, l.prototype.readUint32BE = l.prototype.readUInt32BE = function(r, o) {
|
|
1538
|
-
return r = r >>> 0, o ||
|
|
1538
|
+
return r = r >>> 0, o || H(r, 4, this.length), this[r] * 16777216 + (this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3]);
|
|
1539
1539
|
}, l.prototype.readBigUInt64LE = he(function(r) {
|
|
1540
1540
|
r = r >>> 0, Re(r, "offset");
|
|
1541
1541
|
const o = this[r], h = this[r + 7];
|
|
@@ -1549,31 +1549,31 @@ function qn() {
|
|
|
1549
1549
|
const _ = o * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r], g = this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + h;
|
|
1550
1550
|
return (BigInt(_) << BigInt(32)) + BigInt(g);
|
|
1551
1551
|
}), l.prototype.readIntLE = function(r, o, h) {
|
|
1552
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1552
|
+
r = r >>> 0, o = o >>> 0, h || H(r, o, this.length);
|
|
1553
1553
|
let _ = this[r], g = 1, v = 0;
|
|
1554
1554
|
for (; ++v < o && (g *= 256); )
|
|
1555
1555
|
_ += this[r + v] * g;
|
|
1556
1556
|
return g *= 128, _ >= g && (_ -= Math.pow(2, 8 * o)), _;
|
|
1557
1557
|
}, l.prototype.readIntBE = function(r, o, h) {
|
|
1558
|
-
r = r >>> 0, o = o >>> 0, h ||
|
|
1558
|
+
r = r >>> 0, o = o >>> 0, h || H(r, o, this.length);
|
|
1559
1559
|
let _ = o, g = 1, v = this[r + --_];
|
|
1560
1560
|
for (; _ > 0 && (g *= 256); )
|
|
1561
1561
|
v += this[r + --_] * g;
|
|
1562
1562
|
return g *= 128, v >= g && (v -= Math.pow(2, 8 * o)), v;
|
|
1563
1563
|
}, l.prototype.readInt8 = function(r, o) {
|
|
1564
|
-
return r = r >>> 0, o ||
|
|
1564
|
+
return r = r >>> 0, o || H(r, 1, this.length), this[r] & 128 ? (255 - this[r] + 1) * -1 : this[r];
|
|
1565
1565
|
}, l.prototype.readInt16LE = function(r, o) {
|
|
1566
|
-
r = r >>> 0, o ||
|
|
1566
|
+
r = r >>> 0, o || H(r, 2, this.length);
|
|
1567
1567
|
const h = this[r] | this[r + 1] << 8;
|
|
1568
1568
|
return h & 32768 ? h | 4294901760 : h;
|
|
1569
1569
|
}, l.prototype.readInt16BE = function(r, o) {
|
|
1570
|
-
r = r >>> 0, o ||
|
|
1570
|
+
r = r >>> 0, o || H(r, 2, this.length);
|
|
1571
1571
|
const h = this[r + 1] | this[r] << 8;
|
|
1572
1572
|
return h & 32768 ? h | 4294901760 : h;
|
|
1573
1573
|
}, l.prototype.readInt32LE = function(r, o) {
|
|
1574
|
-
return r = r >>> 0, o ||
|
|
1574
|
+
return r = r >>> 0, o || H(r, 4, this.length), this[r] | this[r + 1] << 8 | this[r + 2] << 16 | this[r + 3] << 24;
|
|
1575
1575
|
}, l.prototype.readInt32BE = function(r, o) {
|
|
1576
|
-
return r = r >>> 0, o ||
|
|
1576
|
+
return r = r >>> 0, o || H(r, 4, this.length), this[r] << 24 | this[r + 1] << 16 | this[r + 2] << 8 | this[r + 3];
|
|
1577
1577
|
}, l.prototype.readBigInt64LE = he(function(r) {
|
|
1578
1578
|
r = r >>> 0, Re(r, "offset");
|
|
1579
1579
|
const o = this[r], h = this[r + 7];
|
|
@@ -1588,15 +1588,15 @@ function qn() {
|
|
|
1588
1588
|
this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + this[++r];
|
|
1589
1589
|
return (BigInt(_) << BigInt(32)) + BigInt(this[++r] * 2 ** 24 + this[++r] * 2 ** 16 + this[++r] * 2 ** 8 + h);
|
|
1590
1590
|
}), l.prototype.readFloatLE = function(r, o) {
|
|
1591
|
-
return r = r >>> 0, o ||
|
|
1591
|
+
return r = r >>> 0, o || H(r, 4, this.length), i.read(this, r, !0, 23, 4);
|
|
1592
1592
|
}, l.prototype.readFloatBE = function(r, o) {
|
|
1593
|
-
return r = r >>> 0, o ||
|
|
1593
|
+
return r = r >>> 0, o || H(r, 4, this.length), i.read(this, r, !1, 23, 4);
|
|
1594
1594
|
}, l.prototype.readDoubleLE = function(r, o) {
|
|
1595
|
-
return r = r >>> 0, o ||
|
|
1595
|
+
return r = r >>> 0, o || H(r, 8, this.length), i.read(this, r, !0, 52, 8);
|
|
1596
1596
|
}, l.prototype.readDoubleBE = function(r, o) {
|
|
1597
|
-
return r = r >>> 0, o ||
|
|
1597
|
+
return r = r >>> 0, o || H(r, 8, this.length), i.read(this, r, !1, 52, 8);
|
|
1598
1598
|
};
|
|
1599
|
-
function
|
|
1599
|
+
function ne(d, r, o, h, _, g) {
|
|
1600
1600
|
if (!l.isBuffer(d)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
1601
1601
|
if (r > _ || r < g) throw new RangeError('"value" argument is out of bounds');
|
|
1602
1602
|
if (o + h > d.length) throw new RangeError("Index out of range");
|
|
@@ -1604,7 +1604,7 @@ function qn() {
|
|
|
1604
1604
|
l.prototype.writeUintLE = l.prototype.writeUIntLE = function(r, o, h, _) {
|
|
1605
1605
|
if (r = +r, o = o >>> 0, h = h >>> 0, !_) {
|
|
1606
1606
|
const x = Math.pow(2, 8 * h) - 1;
|
|
1607
|
-
|
|
1607
|
+
ne(this, r, o, h, x, 0);
|
|
1608
1608
|
}
|
|
1609
1609
|
let g = 1, v = 0;
|
|
1610
1610
|
for (this[o] = r & 255; ++v < h && (g *= 256); )
|
|
@@ -1613,22 +1613,22 @@ function qn() {
|
|
|
1613
1613
|
}, l.prototype.writeUintBE = l.prototype.writeUIntBE = function(r, o, h, _) {
|
|
1614
1614
|
if (r = +r, o = o >>> 0, h = h >>> 0, !_) {
|
|
1615
1615
|
const x = Math.pow(2, 8 * h) - 1;
|
|
1616
|
-
|
|
1616
|
+
ne(this, r, o, h, x, 0);
|
|
1617
1617
|
}
|
|
1618
1618
|
let g = h - 1, v = 1;
|
|
1619
1619
|
for (this[o + g] = r & 255; --g >= 0 && (v *= 256); )
|
|
1620
1620
|
this[o + g] = r / v & 255;
|
|
1621
1621
|
return o + h;
|
|
1622
1622
|
}, l.prototype.writeUint8 = l.prototype.writeUInt8 = function(r, o, h) {
|
|
1623
|
-
return r = +r, o = o >>> 0, h ||
|
|
1623
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 1, 255, 0), this[o] = r & 255, o + 1;
|
|
1624
1624
|
}, l.prototype.writeUint16LE = l.prototype.writeUInt16LE = function(r, o, h) {
|
|
1625
|
-
return r = +r, o = o >>> 0, h ||
|
|
1625
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 2, 65535, 0), this[o] = r & 255, this[o + 1] = r >>> 8, o + 2;
|
|
1626
1626
|
}, l.prototype.writeUint16BE = l.prototype.writeUInt16BE = function(r, o, h) {
|
|
1627
|
-
return r = +r, o = o >>> 0, h ||
|
|
1627
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 2, 65535, 0), this[o] = r >>> 8, this[o + 1] = r & 255, o + 2;
|
|
1628
1628
|
}, l.prototype.writeUint32LE = l.prototype.writeUInt32LE = function(r, o, h) {
|
|
1629
|
-
return r = +r, o = o >>> 0, h ||
|
|
1629
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 4, 4294967295, 0), this[o + 3] = r >>> 24, this[o + 2] = r >>> 16, this[o + 1] = r >>> 8, this[o] = r & 255, o + 4;
|
|
1630
1630
|
}, l.prototype.writeUint32BE = l.prototype.writeUInt32BE = function(r, o, h) {
|
|
1631
|
-
return r = +r, o = o >>> 0, h ||
|
|
1631
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 4, 4294967295, 0), this[o] = r >>> 24, this[o + 1] = r >>> 16, this[o + 2] = r >>> 8, this[o + 3] = r & 255, o + 4;
|
|
1632
1632
|
};
|
|
1633
1633
|
function Wt(d, r, o, h, _) {
|
|
1634
1634
|
Yt(r, h, _, d, o, 7);
|
|
@@ -1650,8 +1650,8 @@ function qn() {
|
|
|
1650
1650
|
return jt(this, r, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
1651
1651
|
}), l.prototype.writeIntLE = function(r, o, h, _) {
|
|
1652
1652
|
if (r = +r, o = o >>> 0, !_) {
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1653
|
+
const F = Math.pow(2, 8 * h - 1);
|
|
1654
|
+
ne(this, r, o, h, F - 1, -F);
|
|
1655
1655
|
}
|
|
1656
1656
|
let g = 0, v = 1, x = 0;
|
|
1657
1657
|
for (this[o] = r & 255; ++g < h && (v *= 256); )
|
|
@@ -1659,23 +1659,23 @@ function qn() {
|
|
|
1659
1659
|
return o + h;
|
|
1660
1660
|
}, l.prototype.writeIntBE = function(r, o, h, _) {
|
|
1661
1661
|
if (r = +r, o = o >>> 0, !_) {
|
|
1662
|
-
const
|
|
1663
|
-
|
|
1662
|
+
const F = Math.pow(2, 8 * h - 1);
|
|
1663
|
+
ne(this, r, o, h, F - 1, -F);
|
|
1664
1664
|
}
|
|
1665
1665
|
let g = h - 1, v = 1, x = 0;
|
|
1666
1666
|
for (this[o + g] = r & 255; --g >= 0 && (v *= 256); )
|
|
1667
1667
|
r < 0 && x === 0 && this[o + g + 1] !== 0 && (x = 1), this[o + g] = (r / v >> 0) - x & 255;
|
|
1668
1668
|
return o + h;
|
|
1669
1669
|
}, l.prototype.writeInt8 = function(r, o, h) {
|
|
1670
|
-
return r = +r, o = o >>> 0, h ||
|
|
1670
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 1, 127, -128), r < 0 && (r = 255 + r + 1), this[o] = r & 255, o + 1;
|
|
1671
1671
|
}, l.prototype.writeInt16LE = function(r, o, h) {
|
|
1672
|
-
return r = +r, o = o >>> 0, h ||
|
|
1672
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 2, 32767, -32768), this[o] = r & 255, this[o + 1] = r >>> 8, o + 2;
|
|
1673
1673
|
}, l.prototype.writeInt16BE = function(r, o, h) {
|
|
1674
|
-
return r = +r, o = o >>> 0, h ||
|
|
1674
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 2, 32767, -32768), this[o] = r >>> 8, this[o + 1] = r & 255, o + 2;
|
|
1675
1675
|
}, l.prototype.writeInt32LE = function(r, o, h) {
|
|
1676
|
-
return r = +r, o = o >>> 0, h ||
|
|
1676
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 4, 2147483647, -2147483648), this[o] = r & 255, this[o + 1] = r >>> 8, this[o + 2] = r >>> 16, this[o + 3] = r >>> 24, o + 4;
|
|
1677
1677
|
}, l.prototype.writeInt32BE = function(r, o, h) {
|
|
1678
|
-
return r = +r, o = o >>> 0, h ||
|
|
1678
|
+
return r = +r, o = o >>> 0, h || ne(this, r, o, 4, 2147483647, -2147483648), r < 0 && (r = 4294967295 + r + 1), this[o] = r >>> 24, this[o + 1] = r >>> 16, this[o + 2] = r >>> 8, this[o + 3] = r & 255, o + 4;
|
|
1679
1679
|
}, l.prototype.writeBigInt64LE = he(function(r, o = 0) {
|
|
1680
1680
|
return Wt(this, r, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
1681
1681
|
}), l.prototype.writeBigInt64BE = he(function(r, o = 0) {
|
|
@@ -1936,24 +1936,24 @@ var nn = function(t, e, i, n) {
|
|
|
1936
1936
|
});
|
|
1937
1937
|
}
|
|
1938
1938
|
return new (i || (i = Promise))(function(s, c) {
|
|
1939
|
-
function l(
|
|
1939
|
+
function l(p) {
|
|
1940
1940
|
try {
|
|
1941
|
-
|
|
1941
|
+
f(n.next(p));
|
|
1942
1942
|
} catch (u) {
|
|
1943
1943
|
c(u);
|
|
1944
1944
|
}
|
|
1945
1945
|
}
|
|
1946
|
-
function m(
|
|
1946
|
+
function m(p) {
|
|
1947
1947
|
try {
|
|
1948
|
-
|
|
1948
|
+
f(n.throw(p));
|
|
1949
1949
|
} catch (u) {
|
|
1950
1950
|
c(u);
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
|
-
function p
|
|
1954
|
-
|
|
1953
|
+
function f(p) {
|
|
1954
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
1955
1955
|
}
|
|
1956
|
-
|
|
1956
|
+
f((n = n.apply(t, e || [])).next());
|
|
1957
1957
|
});
|
|
1958
1958
|
};
|
|
1959
1959
|
const rn = "https://api.anam.ai", $t = "/v1";
|
|
@@ -2018,63 +2018,63 @@ const Fe = (t) => {
|
|
|
2018
2018
|
issues: []
|
|
2019
2019
|
}, l = ((i = s["inbound-rtp"]) === null || i === void 0 ? void 0 : i.filter((u) => u.kind === "video")) || [];
|
|
2020
2020
|
l.length > 0 && (c.personaVideoStream = [], l.forEach((u) => {
|
|
2021
|
-
var
|
|
2022
|
-
const
|
|
2023
|
-
framesReceived: (
|
|
2021
|
+
var y, E, T, I, w;
|
|
2022
|
+
const A = {
|
|
2023
|
+
framesReceived: (y = u.framesReceived) !== null && y !== void 0 ? y : "unknown",
|
|
2024
2024
|
framesDropped: (E = u.framesDropped) !== null && E !== void 0 ? E : "unknown",
|
|
2025
|
-
framesPerSecond: (
|
|
2026
|
-
packetsReceived: (
|
|
2027
|
-
packetsLost: (
|
|
2025
|
+
framesPerSecond: (T = u.framesPerSecond) !== null && T !== void 0 ? T : "unknown",
|
|
2026
|
+
packetsReceived: (I = u.packetsReceived) !== null && I !== void 0 ? I : "unknown",
|
|
2027
|
+
packetsLost: (w = u.packetsLost) !== null && w !== void 0 ? w : "unknown",
|
|
2028
2028
|
resolution: u.frameWidth && u.frameHeight ? `${u.frameWidth}x${u.frameHeight}` : void 0,
|
|
2029
2029
|
jitter: u.jitter !== void 0 ? u.jitter : void 0
|
|
2030
2030
|
};
|
|
2031
|
-
c.personaVideoStream.push(
|
|
2031
|
+
c.personaVideoStream.push(A);
|
|
2032
2032
|
}));
|
|
2033
2033
|
const m = ((n = s["inbound-rtp"]) === null || n === void 0 ? void 0 : n.filter((u) => u.kind === "audio")) || [];
|
|
2034
2034
|
m.length > 0 && (c.personaAudioStream = [], m.forEach((u) => {
|
|
2035
|
-
var
|
|
2036
|
-
const
|
|
2037
|
-
packetsReceived: (
|
|
2035
|
+
var y, E, T;
|
|
2036
|
+
const I = {
|
|
2037
|
+
packetsReceived: (y = u.packetsReceived) !== null && y !== void 0 ? y : "unknown",
|
|
2038
2038
|
packetsLost: (E = u.packetsLost) !== null && E !== void 0 ? E : "unknown",
|
|
2039
|
-
audioLevel: (
|
|
2039
|
+
audioLevel: (T = u.audioLevel) !== null && T !== void 0 ? T : "unknown",
|
|
2040
2040
|
jitter: u.jitter !== void 0 ? u.jitter : void 0,
|
|
2041
2041
|
totalAudioEnergy: u.totalAudioEnergy !== void 0 ? u.totalAudioEnergy : void 0
|
|
2042
2042
|
};
|
|
2043
|
-
c.personaAudioStream.push(
|
|
2043
|
+
c.personaAudioStream.push(I);
|
|
2044
2044
|
}));
|
|
2045
|
-
const
|
|
2046
|
-
|
|
2047
|
-
var
|
|
2048
|
-
const
|
|
2049
|
-
packetsSent: (
|
|
2045
|
+
const f = ((a = s["outbound-rtp"]) === null || a === void 0 ? void 0 : a.filter((u) => u.kind === "audio")) || [];
|
|
2046
|
+
f.length > 0 && (c.userAudioInput = [], f.forEach((u) => {
|
|
2047
|
+
var y, E;
|
|
2048
|
+
const T = {
|
|
2049
|
+
packetsSent: (y = u.packetsSent) !== null && y !== void 0 ? y : "unknown",
|
|
2050
2050
|
retransmittedPackets: (E = u.retransmittedPacketsSent) !== null && E !== void 0 ? E : void 0,
|
|
2051
2051
|
avgPacketSendDelay: u.totalPacketSendDelay !== void 0 ? u.totalPacketSendDelay / (u.packetsSent || 1) * 1e3 : void 0
|
|
2052
2052
|
};
|
|
2053
|
-
c.userAudioInput.push(
|
|
2053
|
+
c.userAudioInput.push(T);
|
|
2054
2054
|
})), s.codec && (c.codecs = [], s.codec.forEach((u) => {
|
|
2055
|
-
const
|
|
2055
|
+
const y = {
|
|
2056
2056
|
status: u.payloadType ? "Active" : "Available",
|
|
2057
2057
|
mimeType: u.mimeType || "Unknown",
|
|
2058
2058
|
payloadType: u.payloadType || "N/A",
|
|
2059
2059
|
clockRate: u.clockRate || void 0,
|
|
2060
2060
|
channels: u.channels || void 0
|
|
2061
2061
|
};
|
|
2062
|
-
c.codecs.push(
|
|
2062
|
+
c.codecs.push(y);
|
|
2063
2063
|
})), s.transport && (c.transportLayer = [], s.transport.forEach((u) => {
|
|
2064
|
-
const
|
|
2064
|
+
const y = {
|
|
2065
2065
|
dtlsState: u.dtlsState || "unknown",
|
|
2066
2066
|
iceState: u.iceState || "unknown",
|
|
2067
2067
|
bytesSent: u.bytesSent || void 0,
|
|
2068
2068
|
bytesReceived: u.bytesReceived || void 0
|
|
2069
2069
|
};
|
|
2070
|
-
c.transportLayer.push(
|
|
2070
|
+
c.transportLayer.push(y);
|
|
2071
2071
|
}));
|
|
2072
|
-
const
|
|
2072
|
+
const p = [];
|
|
2073
2073
|
if (l.forEach((u) => {
|
|
2074
|
-
typeof u.framesDropped == "number" && u.framesDropped > 0 &&
|
|
2074
|
+
typeof u.framesDropped == "number" && u.framesDropped > 0 && p.push(`Video: ${u.framesDropped} frames dropped`), typeof u.packetsLost == "number" && u.packetsLost > 0 && p.push(`Video: ${u.packetsLost} packets lost`), typeof u.framesPerSecond == "number" && u.framesPerSecond < 23 && p.push(`Video: Low frame rate (${u.framesPerSecond} fps)`);
|
|
2075
2075
|
}), m.forEach((u) => {
|
|
2076
|
-
typeof u.packetsLost == "number" && u.packetsLost > 0 &&
|
|
2077
|
-
}), c.issues =
|
|
2076
|
+
typeof u.packetsLost == "number" && u.packetsLost > 0 && p.push(`Audio: ${u.packetsLost} packets lost`), typeof u.jitter == "number" && u.jitter > 0.1 && p.push(`Audio: High jitter (${(u.jitter * 1e3).toFixed(1)}ms)`);
|
|
2077
|
+
}), c.issues = p, e === "json")
|
|
2078
2078
|
return c;
|
|
2079
2079
|
console.group("📊 WebRTC Session Statistics Report"), c.personaVideoStream && c.personaVideoStream.length > 0 && (console.group("📹 Persona Video Stream (Inbound)"), c.personaVideoStream.forEach((u) => {
|
|
2080
2080
|
console.log(`Frames Received: ${u.framesReceived}`), console.log(`Frames Dropped: ${u.framesDropped}`), console.log(`Frames Per Second: ${u.framesPerSecond}`), console.log(`Packets Received: ${typeof u.packetsReceived == "number" ? u.packetsReceived.toLocaleString() : u.packetsReceived}`), console.log(`Packets Lost: ${u.packetsLost}`), u.resolution && console.log(`Resolution: ${u.resolution}`), u.jitter !== void 0 && console.log(`Jitter: ${u.jitter.toFixed(5)}ms`);
|
|
@@ -2088,13 +2088,13 @@ const Fe = (t) => {
|
|
|
2088
2088
|
console.log(`DTLS State: ${u.dtlsState}`), console.log(`ICE State: ${u.iceState}`), (u.bytesReceived || u.bytesSent) && console.log(`Data Transfer (bytes) - Sent: ${(u.bytesSent || 0).toLocaleString()}, Received: ${(u.bytesReceived || 0).toLocaleString()}`);
|
|
2089
2089
|
}), console.groupEnd()), c.issues.length > 0 ? (console.group("⚠️ Potential Issues Detected"), c.issues.forEach((u) => console.warn(u)), console.groupEnd()) : console.log("✅ No significant issues detected"), console.groupEnd();
|
|
2090
2090
|
};
|
|
2091
|
-
var
|
|
2091
|
+
var J;
|
|
2092
2092
|
(function(t) {
|
|
2093
2093
|
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";
|
|
2094
|
-
})(
|
|
2095
|
-
class
|
|
2094
|
+
})(J || (J = {}));
|
|
2095
|
+
class V extends Error {
|
|
2096
2096
|
constructor(e, i, n = 500, a) {
|
|
2097
|
-
super(e), this.name = "ClientError", this.code = i, this.statusCode = n, this.details = a, Object.setPrototypeOf(this,
|
|
2097
|
+
super(e), this.name = "ClientError", this.code = i, this.statusCode = n, this.details = a, Object.setPrototypeOf(this, V.prototype), Me(ce.CLIENT_METRIC_MEASUREMENT_ERROR, i, {
|
|
2098
2098
|
details: a,
|
|
2099
2099
|
statusCode: n
|
|
2100
2100
|
});
|
|
@@ -2204,10 +2204,10 @@ function ur(t) {
|
|
|
2204
2204
|
return "API Gateway wsPath must start with /";
|
|
2205
2205
|
}
|
|
2206
2206
|
}
|
|
2207
|
-
var
|
|
2207
|
+
var Q;
|
|
2208
2208
|
(function(t) {
|
|
2209
2209
|
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";
|
|
2210
|
-
})(
|
|
2210
|
+
})(Q || (Q = {}));
|
|
2211
2211
|
var se;
|
|
2212
2212
|
(function(t) {
|
|
2213
2213
|
t.SPEECH_TEXT = "speechText", t.CLIENT_TOOL_EVENT = "clientToolEvent", t.TOOL_CALL_STARTED_EVENT = "toolCallStarted", t.TOOL_CALL_COMPLETED_EVENT = "toolCallCompleted", t.TOOL_CALL_FAILED_EVENT = "toolCallFailed", t.REASONING_TEXT = "reasoningText", t.USER_SPEECH_STARTED = "userSpeechStarted", t.USER_SPEECH_ENDED = "userSpeechEnded", t.DIRECTOR_NOTE_CUE_APPLIED = "directorNoteCueApplied";
|
|
@@ -2220,14 +2220,14 @@ var ve;
|
|
|
2220
2220
|
(function(t) {
|
|
2221
2221
|
t.USER = "user", t.PERSONA = "persona";
|
|
2222
2222
|
})(ve || (ve = {}));
|
|
2223
|
-
var
|
|
2223
|
+
var O;
|
|
2224
2224
|
(function(t) {
|
|
2225
2225
|
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.TOOL_CALL_STARTED = "TOOL_CALL_STARTED", t.TOOL_CALL_COMPLETED = "TOOL_CALL_COMPLETED", t.TOOL_CALL_FAILED = "TOOL_CALL_FAILED", t.REASONING_HISTORY_UPDATED = "REASONING_HISTORY_UPDATED", t.REASONING_STREAM_EVENT_RECEIVED = "REASONING_STREAM_EVENT_RECEIVED", t.USER_SPEECH_STARTED = "USER_SPEECH_STARTED", t.USER_SPEECH_ENDED = "USER_SPEECH_ENDED", t.DIRECTOR_NOTE_CUE_APPLIED = "DIRECTOR_NOTE_CUE_APPLIED";
|
|
2226
|
-
})(
|
|
2227
|
-
var
|
|
2226
|
+
})(O || (O = {}));
|
|
2227
|
+
var B;
|
|
2228
2228
|
(function(t) {
|
|
2229
2229
|
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_TOOL_CALL_STARTED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED", t.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED", t.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED = "WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED", t.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED = "WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED", t.TOOL_CALL_RESULT_READY = "TOOL_CALL_RESULT_READY";
|
|
2230
|
-
})(
|
|
2230
|
+
})(B || (B = {}));
|
|
2231
2231
|
var Ee;
|
|
2232
2232
|
(function(t) {
|
|
2233
2233
|
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";
|
|
@@ -2281,44 +2281,44 @@ var Ae = function(t, e, i, n) {
|
|
|
2281
2281
|
});
|
|
2282
2282
|
}
|
|
2283
2283
|
return new (i || (i = Promise))(function(s, c) {
|
|
2284
|
-
function l(
|
|
2284
|
+
function l(p) {
|
|
2285
2285
|
try {
|
|
2286
|
-
|
|
2286
|
+
f(n.next(p));
|
|
2287
2287
|
} catch (u) {
|
|
2288
2288
|
c(u);
|
|
2289
2289
|
}
|
|
2290
2290
|
}
|
|
2291
|
-
function m(
|
|
2291
|
+
function m(p) {
|
|
2292
2292
|
try {
|
|
2293
|
-
|
|
2293
|
+
f(n.throw(p));
|
|
2294
2294
|
} catch (u) {
|
|
2295
2295
|
c(u);
|
|
2296
2296
|
}
|
|
2297
2297
|
}
|
|
2298
|
-
function p
|
|
2299
|
-
|
|
2298
|
+
function f(p) {
|
|
2299
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
2300
2300
|
}
|
|
2301
|
-
|
|
2301
|
+
f((n = n.apply(t, e || [])).next());
|
|
2302
2302
|
});
|
|
2303
2303
|
};
|
|
2304
2304
|
const fr = 5, pr = 5, _r = 24;
|
|
2305
2305
|
class mr {
|
|
2306
2306
|
constructor(e, i, n, a, s, c) {
|
|
2307
|
-
var l, m,
|
|
2307
|
+
var l, m, f, p, u;
|
|
2308
2308
|
if (this.stopSignal = !1, this.sendingBuffer = [], this.wsConnectionAttempts = 0, this.socket = null, this.permanentlyClosed = !1, this.iceRestartReconnectInProgress = !1, this.heartBeatIntervalRef = null, this.reconnectTimer = null, this.publicEventEmitter = n, this.internalEventEmitter = a, this.apiGatewayConfig = s, this.connectionMilestones = c, !e)
|
|
2309
2309
|
throw new Error("Signalling Client: sessionId is required");
|
|
2310
2310
|
this.sessionId = e;
|
|
2311
|
-
const { heartbeatIntervalSeconds:
|
|
2312
|
-
if (this.heartbeatIntervalSeconds =
|
|
2311
|
+
const { heartbeatIntervalSeconds: y, maxWsReconnectionAttempts: E, url: T } = i;
|
|
2312
|
+
if (this.heartbeatIntervalSeconds = y || fr, this.maxWsReconnectionAttempts = E || pr, !T.baseUrl)
|
|
2313
2313
|
throw new Error("Signalling Client: baseUrl is required");
|
|
2314
2314
|
if (!((l = this.apiGatewayConfig) === null || l === void 0) && l.enabled && (!((m = this.apiGatewayConfig) === null || m === void 0) && m.baseUrl)) {
|
|
2315
|
-
const
|
|
2316
|
-
|
|
2317
|
-
const
|
|
2318
|
-
|
|
2315
|
+
const I = new URL(this.apiGatewayConfig.baseUrl), w = (f = this.apiGatewayConfig.wsPath) !== null && f !== void 0 ? f : "/ws";
|
|
2316
|
+
I.protocol = I.protocol.replace("http", "ws"), I.pathname = w, this.url = I;
|
|
2317
|
+
const A = T.protocol || "https", R = A === "http" ? "ws" : "wss", b = `${A}://${T.baseUrl}`, N = (p = T.signallingPath) !== null && p !== void 0 ? p : "/ws", S = new URL(b);
|
|
2318
|
+
S.protocol = R === "ws" ? "ws:" : "wss:", T.port && (S.port = T.port), S.pathname = N, S.searchParams.append("session_id", e), this.url.searchParams.append("target_url", S.href);
|
|
2319
2319
|
} else {
|
|
2320
|
-
const
|
|
2321
|
-
this.url = new URL(
|
|
2320
|
+
const w = `${T.protocol || "https"}://${T.baseUrl}`;
|
|
2321
|
+
this.url = new URL(w), this.url.protocol = T.protocol === "http" ? "ws:" : "wss:", T.port && (this.url.port = T.port), this.url.pathname = (u = T.signallingPath) !== null && u !== void 0 ? u : "/ws", this.url.searchParams.append("session_id", e);
|
|
2322
2322
|
}
|
|
2323
2323
|
}
|
|
2324
2324
|
stop() {
|
|
@@ -2383,7 +2383,7 @@ class mr {
|
|
|
2383
2383
|
userUid: this.sessionId
|
|
2384
2384
|
// TODO: this should be renamed to session ID on the server
|
|
2385
2385
|
}, n = {
|
|
2386
|
-
actionType:
|
|
2386
|
+
actionType: Q.OFFER,
|
|
2387
2387
|
sessionId: this.sessionId,
|
|
2388
2388
|
payload: i
|
|
2389
2389
|
};
|
|
@@ -2393,7 +2393,7 @@ class mr {
|
|
|
2393
2393
|
sendIceCandidate(e) {
|
|
2394
2394
|
return Ae(this, void 0, void 0, function* () {
|
|
2395
2395
|
const i = {
|
|
2396
|
-
actionType:
|
|
2396
|
+
actionType: Q.ICE_CANDIDATE,
|
|
2397
2397
|
sessionId: this.sessionId,
|
|
2398
2398
|
payload: e.toJSON()
|
|
2399
2399
|
};
|
|
@@ -2414,7 +2414,7 @@ class mr {
|
|
|
2414
2414
|
sendTalkMessage(e) {
|
|
2415
2415
|
return Ae(this, void 0, void 0, function* () {
|
|
2416
2416
|
const i = {
|
|
2417
|
-
actionType:
|
|
2417
|
+
actionType: Q.TALK_STREAM_INPUT,
|
|
2418
2418
|
sessionId: this.sessionId,
|
|
2419
2419
|
payload: e
|
|
2420
2420
|
};
|
|
@@ -2423,7 +2423,7 @@ class mr {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
sendAgentAudioInput(e) {
|
|
2425
2425
|
const i = {
|
|
2426
|
-
actionType:
|
|
2426
|
+
actionType: Q.AGENT_AUDIO_INPUT,
|
|
2427
2427
|
sessionId: this.sessionId,
|
|
2428
2428
|
payload: e
|
|
2429
2429
|
};
|
|
@@ -2431,7 +2431,7 @@ class mr {
|
|
|
2431
2431
|
}
|
|
2432
2432
|
sendAgentAudioInputEnd() {
|
|
2433
2433
|
const e = {
|
|
2434
|
-
actionType:
|
|
2434
|
+
actionType: Q.AGENT_AUDIO_INPUT_END,
|
|
2435
2435
|
sessionId: this.sessionId,
|
|
2436
2436
|
payload: {}
|
|
2437
2437
|
};
|
|
@@ -2447,9 +2447,9 @@ class mr {
|
|
|
2447
2447
|
try {
|
|
2448
2448
|
(i = this.connectionMilestones) === null || i === void 0 || i.record("websocket_open", {
|
|
2449
2449
|
attemptNumber: this.wsConnectionAttempts + 1
|
|
2450
|
-
}), this.wsConnectionAttempts = 0, this.flushSendingBuffer(), e.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(
|
|
2450
|
+
}), this.wsConnectionAttempts = 0, this.flushSendingBuffer(), e.onmessage = this.onMessage.bind(this), this.startSendingHeartBeats(), this.internalEventEmitter.emit(B.WEB_SOCKET_OPEN);
|
|
2451
2451
|
} catch (n) {
|
|
2452
|
-
console.error("SignallingClient - onOpen: error in onOpen", n), this.publicEventEmitter.emit(
|
|
2452
|
+
console.error("SignallingClient - onOpen: error in onOpen", n), this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.SIGNALLING_CLIENT_CONNECTION_FAILURE), this.permanentlyClosed = !0;
|
|
2453
2453
|
}
|
|
2454
2454
|
});
|
|
2455
2455
|
}
|
|
@@ -2478,7 +2478,7 @@ class mr {
|
|
|
2478
2478
|
this.clearReconnectTimer(), this.heartBeatIntervalRef && (clearInterval(this.heartBeatIntervalRef), this.heartBeatIntervalRef = null), (s = this.connectionMilestones) === null || s === void 0 || s.publishFailure({
|
|
2479
2479
|
failureStage: "websocket",
|
|
2480
2480
|
closeCode: i?.code
|
|
2481
|
-
}), this.publicEventEmitter.emit(
|
|
2481
|
+
}), this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.SIGNALLING_CLIENT_CONNECTION_FAILURE), this.iceRestartReconnectInProgress = !1, this.permanentlyClosed = !0;
|
|
2482
2482
|
});
|
|
2483
2483
|
}
|
|
2484
2484
|
getMaxReconnectionAttempts() {
|
|
@@ -2500,7 +2500,7 @@ class mr {
|
|
|
2500
2500
|
onMessage(e) {
|
|
2501
2501
|
return Ae(this, void 0, void 0, function* () {
|
|
2502
2502
|
const i = JSON.parse(e.data);
|
|
2503
|
-
this.internalEventEmitter.emit(
|
|
2503
|
+
this.internalEventEmitter.emit(B.SIGNAL_MESSAGE_RECEIVED, i);
|
|
2504
2504
|
});
|
|
2505
2505
|
}
|
|
2506
2506
|
startSendingHeartBeats() {
|
|
@@ -2508,7 +2508,7 @@ class mr {
|
|
|
2508
2508
|
throw new Error("SignallingClient - startSendingHeartBeats: socket is null");
|
|
2509
2509
|
this.heartBeatIntervalRef && console.warn("SignallingClient - startSendingHeartBeats: heartbeat interval already set");
|
|
2510
2510
|
const e = this.heartbeatIntervalSeconds * 1e3, i = {
|
|
2511
|
-
actionType:
|
|
2511
|
+
actionType: Q.HEARTBEAT,
|
|
2512
2512
|
sessionId: this.sessionId,
|
|
2513
2513
|
payload: ""
|
|
2514
2514
|
}, n = JSON.stringify(i);
|
|
@@ -2528,24 +2528,24 @@ var Et = function(t, e, i, n) {
|
|
|
2528
2528
|
});
|
|
2529
2529
|
}
|
|
2530
2530
|
return new (i || (i = Promise))(function(s, c) {
|
|
2531
|
-
function l(
|
|
2531
|
+
function l(p) {
|
|
2532
2532
|
try {
|
|
2533
|
-
|
|
2533
|
+
f(n.next(p));
|
|
2534
2534
|
} catch (u) {
|
|
2535
2535
|
c(u);
|
|
2536
2536
|
}
|
|
2537
2537
|
}
|
|
2538
|
-
function m(
|
|
2538
|
+
function m(p) {
|
|
2539
2539
|
try {
|
|
2540
|
-
|
|
2540
|
+
f(n.throw(p));
|
|
2541
2541
|
} catch (u) {
|
|
2542
2542
|
c(u);
|
|
2543
2543
|
}
|
|
2544
2544
|
}
|
|
2545
|
-
function p
|
|
2546
|
-
|
|
2545
|
+
function f(p) {
|
|
2546
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
2547
2547
|
}
|
|
2548
|
-
|
|
2548
|
+
f((n = n.apply(t, e || [])).next());
|
|
2549
2549
|
});
|
|
2550
2550
|
};
|
|
2551
2551
|
class Er {
|
|
@@ -2572,7 +2572,7 @@ class Er {
|
|
|
2572
2572
|
return Et(this, void 0, void 0, function* () {
|
|
2573
2573
|
if (!this.sessionToken) {
|
|
2574
2574
|
if (!e)
|
|
2575
|
-
throw new
|
|
2575
|
+
throw new V("Persona configuration must be provided when using apiKey", J.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400);
|
|
2576
2576
|
this.sessionToken = yield this.unsafe_getSessionToken(e);
|
|
2577
2577
|
}
|
|
2578
2578
|
e && "brainType" in e && console.warn("Warning: brainType is deprecated and will be removed in a future version. Please use llmId instead.");
|
|
@@ -2605,28 +2605,28 @@ class Er {
|
|
|
2605
2605
|
clientMetadata: tn
|
|
2606
2606
|
}),
|
|
2607
2607
|
signal: n?.signal
|
|
2608
|
-
}),
|
|
2608
|
+
}), f = yield m.json(), p = f.error;
|
|
2609
2609
|
switch (m.status) {
|
|
2610
2610
|
case 200:
|
|
2611
2611
|
case 201:
|
|
2612
|
-
return
|
|
2612
|
+
return f;
|
|
2613
2613
|
case 400:
|
|
2614
|
-
throw new
|
|
2614
|
+
throw new V("Invalid request to start session", J.CLIENT_ERROR_CODE_VALIDATION_ERROR, 400, { cause: f.message });
|
|
2615
2615
|
case 401:
|
|
2616
|
-
throw new
|
|
2616
|
+
throw new V("Authentication failed when starting session", J.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 401, { cause: f.message });
|
|
2617
2617
|
case 402:
|
|
2618
|
-
throw new
|
|
2618
|
+
throw new V("Please sign up for a plan to start a session", J.CLIENT_ERROR_CODE_NO_PLAN_FOUND, 402, { cause: f.message });
|
|
2619
2619
|
case 403:
|
|
2620
|
-
throw new
|
|
2620
|
+
throw new V("Authentication failed when starting session", J.CLIENT_ERROR_CODE_AUTHENTICATION_ERROR, 403, { cause: f.message });
|
|
2621
2621
|
case 429:
|
|
2622
|
-
throw
|
|
2622
|
+
throw p === "Concurrent session limit reached" ? new V("Concurrency limit reached, please upgrade your plan", J.CLIENT_ERROR_CODE_MAX_CONCURRENT_SESSIONS_REACHED, 429, { cause: f.message }) : p === "Spend cap reached" ? new V("Spend cap reached, please upgrade your plan", J.CLIENT_ERROR_CODE_SPEND_CAP_REACHED, 429, { cause: f.message }) : new V("Usage limit reached, please upgrade your plan", J.CLIENT_ERROR_CODE_USAGE_LIMIT_REACHED, 429, { cause: f.message });
|
|
2623
2623
|
case 503:
|
|
2624
|
-
throw new
|
|
2624
|
+
throw new V("There are no available personas, please try again later", J.CLIENT_ERROR_CODE_SERVICE_BUSY, 503, { cause: f.message });
|
|
2625
2625
|
default:
|
|
2626
|
-
throw new
|
|
2626
|
+
throw new V("Unknown error when starting session", J.CLIENT_ERROR_CODE_SERVER_ERROR, m.status, { cause: f.message });
|
|
2627
2627
|
}
|
|
2628
2628
|
} catch (s) {
|
|
2629
|
-
throw s instanceof
|
|
2629
|
+
throw s instanceof V ? s : new V("Failed to start session", J.CLIENT_ERROR_CODE_SERVER_ERROR, 500, { cause: s instanceof Error ? s.message : String(s) });
|
|
2630
2630
|
} finally {
|
|
2631
2631
|
a !== void 0 && clearTimeout(a);
|
|
2632
2632
|
}
|
|
@@ -2672,7 +2672,7 @@ function nt(t, e) {
|
|
|
2672
2672
|
return typeof t == "number" && Number.isFinite(t) ? t : e;
|
|
2673
2673
|
}
|
|
2674
2674
|
function Cr(t) {
|
|
2675
|
-
return t instanceof
|
|
2675
|
+
return t instanceof V ? t.statusCode >= 500 && t.statusCode < 600 : !0;
|
|
2676
2676
|
}
|
|
2677
2677
|
function Sr(t) {
|
|
2678
2678
|
return new Promise((e) => setTimeout(e, t));
|
|
@@ -2684,24 +2684,24 @@ var Tr = function(t, e, i, n) {
|
|
|
2684
2684
|
});
|
|
2685
2685
|
}
|
|
2686
2686
|
return new (i || (i = Promise))(function(s, c) {
|
|
2687
|
-
function l(
|
|
2687
|
+
function l(p) {
|
|
2688
2688
|
try {
|
|
2689
|
-
|
|
2689
|
+
f(n.next(p));
|
|
2690
2690
|
} catch (u) {
|
|
2691
2691
|
c(u);
|
|
2692
2692
|
}
|
|
2693
2693
|
}
|
|
2694
|
-
function m(
|
|
2694
|
+
function m(p) {
|
|
2695
2695
|
try {
|
|
2696
|
-
|
|
2696
|
+
f(n.throw(p));
|
|
2697
2697
|
} catch (u) {
|
|
2698
2698
|
c(u);
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
|
-
function p
|
|
2702
|
-
|
|
2701
|
+
function f(p) {
|
|
2702
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
2703
2703
|
}
|
|
2704
|
-
|
|
2704
|
+
f((n = n.apply(t, e || [])).next());
|
|
2705
2705
|
});
|
|
2706
2706
|
};
|
|
2707
2707
|
class yr {
|
|
@@ -2718,8 +2718,8 @@ class yr {
|
|
|
2718
2718
|
const c = "/talk", l = `?session_id=${this.sessionId}`;
|
|
2719
2719
|
if (!((i = this.apiGatewayConfig) === null || i === void 0) && i.enabled && (!((n = this.apiGatewayConfig) === null || n === void 0) && n.baseUrl)) {
|
|
2720
2720
|
a = `${this.apiGatewayConfig.baseUrl}${c}${l}`;
|
|
2721
|
-
const
|
|
2722
|
-
s["X-Anam-Target-Url"] =
|
|
2721
|
+
const f = new URL(`${this.baseUrl}${c}${l}`);
|
|
2722
|
+
s["X-Anam-Target-Url"] = f.href;
|
|
2723
2723
|
} else
|
|
2724
2724
|
a = `${this.baseUrl}${c}${l}`;
|
|
2725
2725
|
const m = yield fetch(a, {
|
|
@@ -2755,7 +2755,7 @@ class Ir {
|
|
|
2755
2755
|
}
|
|
2756
2756
|
class br {
|
|
2757
2757
|
constructor(e, i) {
|
|
2758
|
-
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(
|
|
2758
|
+
this.messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(B.WEBRTC_CHAT_MESSAGE_RECEIVED, this.processWebRtcTextMessageEvent.bind(this));
|
|
2759
2759
|
}
|
|
2760
2760
|
webRtcTextMessageEventToMessageStreamEvent(e) {
|
|
2761
2761
|
return Object.assign({ id: `${e.role}::${e.message_id}`, content: e.content, role: e.role, endOfSpeech: e.end_of_speech, interrupted: e.interrupted }, e.cue_tag ? { cueTag: e.cue_tag } : {});
|
|
@@ -2783,7 +2783,7 @@ class br {
|
|
|
2783
2783
|
}
|
|
2784
2784
|
processWebRtcTextMessageEvent(e) {
|
|
2785
2785
|
const i = this.webRtcTextMessageEventToMessageStreamEvent(e);
|
|
2786
|
-
switch (this.publicEventEmitter.emit(
|
|
2786
|
+
switch (this.publicEventEmitter.emit(O.MESSAGE_STREAM_EVENT_RECEIVED, i), i.role) {
|
|
2787
2787
|
case ve.USER:
|
|
2788
2788
|
this.processUserMessage(i);
|
|
2789
2789
|
break;
|
|
@@ -2791,7 +2791,7 @@ class br {
|
|
|
2791
2791
|
this.processPersonaMessage(i);
|
|
2792
2792
|
break;
|
|
2793
2793
|
}
|
|
2794
|
-
i.endOfSpeech && this.publicEventEmitter.emit(
|
|
2794
|
+
i.endOfSpeech && this.publicEventEmitter.emit(O.MESSAGE_HISTORY_UPDATED, this.messages);
|
|
2795
2795
|
}
|
|
2796
2796
|
}
|
|
2797
2797
|
class wr {
|
|
@@ -2805,7 +2805,7 @@ class wr {
|
|
|
2805
2805
|
this.listeners[e] && this.listeners[e].delete(i);
|
|
2806
2806
|
}
|
|
2807
2807
|
emit(e, ...i) {
|
|
2808
|
-
if (e ===
|
|
2808
|
+
if (e === O.CONNECTION_ESTABLISHED && Me(ce.CLIENT_METRIC_MEASUREMENT_CONNECTION_ESTABLISHED, "1"), e === O.CONNECTION_CLOSED) {
|
|
2809
2809
|
const [n, a] = i;
|
|
2810
2810
|
Me(ce.CLIENT_METRIC_MEASUREMENT_CONNECTION_CLOSED, n, a ? { details: a } : void 0);
|
|
2811
2811
|
}
|
|
@@ -2814,10 +2814,10 @@ class wr {
|
|
|
2814
2814
|
});
|
|
2815
2815
|
}
|
|
2816
2816
|
}
|
|
2817
|
-
var
|
|
2817
|
+
var ie;
|
|
2818
2818
|
(function(t) {
|
|
2819
2819
|
t[t.UNSTARTED = 0] = "UNSTARTED", t[t.STREAMING = 1] = "STREAMING", t[t.INTERRUPTED = 2] = "INTERRUPTED", t[t.ENDED = 3] = "ENDED";
|
|
2820
|
-
})(
|
|
2820
|
+
})(ie || (ie = {}));
|
|
2821
2821
|
var vt = function(t, e, i, n) {
|
|
2822
2822
|
function a(s) {
|
|
2823
2823
|
return s instanceof i ? s : new i(function(c) {
|
|
@@ -2825,45 +2825,45 @@ var vt = function(t, e, i, n) {
|
|
|
2825
2825
|
});
|
|
2826
2826
|
}
|
|
2827
2827
|
return new (i || (i = Promise))(function(s, c) {
|
|
2828
|
-
function l(
|
|
2828
|
+
function l(p) {
|
|
2829
2829
|
try {
|
|
2830
|
-
|
|
2830
|
+
f(n.next(p));
|
|
2831
2831
|
} catch (u) {
|
|
2832
2832
|
c(u);
|
|
2833
2833
|
}
|
|
2834
2834
|
}
|
|
2835
|
-
function m(
|
|
2835
|
+
function m(p) {
|
|
2836
2836
|
try {
|
|
2837
|
-
|
|
2837
|
+
f(n.throw(p));
|
|
2838
2838
|
} catch (u) {
|
|
2839
2839
|
c(u);
|
|
2840
2840
|
}
|
|
2841
2841
|
}
|
|
2842
|
-
function p
|
|
2843
|
-
|
|
2842
|
+
function f(p) {
|
|
2843
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
2844
2844
|
}
|
|
2845
|
-
|
|
2845
|
+
f((n = n.apply(t, e || [])).next());
|
|
2846
2846
|
});
|
|
2847
2847
|
};
|
|
2848
2848
|
class Rr {
|
|
2849
2849
|
constructor(e, i, n) {
|
|
2850
|
-
this.state =
|
|
2850
|
+
this.state = ie.UNSTARTED, this.correlationId = e, this.internalEventEmitter = i, this.signallingClient = n, this.internalEventEmitter.addListener(B.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2851
2851
|
}
|
|
2852
2852
|
onDeactivate() {
|
|
2853
|
-
this.internalEventEmitter.removeListener(
|
|
2853
|
+
this.internalEventEmitter.removeListener(B.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this));
|
|
2854
2854
|
}
|
|
2855
2855
|
onSignalMessage(e) {
|
|
2856
2856
|
return vt(this, void 0, void 0, function* () {
|
|
2857
|
-
e.actionType ===
|
|
2857
|
+
e.actionType === Q.TALK_STREAM_INTERRUPTED && e.payload.correlationId === this.correlationId && (this.state = ie.INTERRUPTED, this.onDeactivate());
|
|
2858
2858
|
});
|
|
2859
2859
|
}
|
|
2860
2860
|
endMessage() {
|
|
2861
2861
|
return vt(this, void 0, void 0, function* () {
|
|
2862
|
-
if (this.state ===
|
|
2862
|
+
if (this.state === ie.ENDED) {
|
|
2863
2863
|
console.warn("Talk stream is already ended via end of speech. No need to call endMessage.");
|
|
2864
2864
|
return;
|
|
2865
2865
|
}
|
|
2866
|
-
if (this.state !==
|
|
2866
|
+
if (this.state !== ie.STREAMING) {
|
|
2867
2867
|
console.warn("Talk stream is not in an active state: " + this.state);
|
|
2868
2868
|
return;
|
|
2869
2869
|
}
|
|
@@ -2873,27 +2873,27 @@ class Rr {
|
|
|
2873
2873
|
endOfSpeech: !0,
|
|
2874
2874
|
correlationId: this.correlationId
|
|
2875
2875
|
};
|
|
2876
|
-
yield this.signallingClient.sendTalkMessage(e), this.state =
|
|
2876
|
+
yield this.signallingClient.sendTalkMessage(e), this.state = ie.ENDED, this.onDeactivate();
|
|
2877
2877
|
});
|
|
2878
2878
|
}
|
|
2879
2879
|
streamMessageChunk(e, i) {
|
|
2880
2880
|
return vt(this, void 0, void 0, function* () {
|
|
2881
|
-
if (this.state !==
|
|
2881
|
+
if (this.state !== ie.STREAMING && this.state !== ie.UNSTARTED)
|
|
2882
2882
|
throw new Error("Talk stream is not in an active state: " + this.state);
|
|
2883
2883
|
const n = {
|
|
2884
2884
|
content: e,
|
|
2885
|
-
startOfSpeech: this.state ===
|
|
2885
|
+
startOfSpeech: this.state === ie.UNSTARTED,
|
|
2886
2886
|
endOfSpeech: i,
|
|
2887
2887
|
correlationId: this.correlationId
|
|
2888
2888
|
};
|
|
2889
|
-
this.state = i ?
|
|
2889
|
+
this.state = i ? ie.ENDED : ie.STREAMING, this.state === ie.ENDED && this.onDeactivate(), yield this.signallingClient.sendTalkMessage(n);
|
|
2890
2890
|
});
|
|
2891
2891
|
}
|
|
2892
2892
|
getCorrelationId() {
|
|
2893
2893
|
return this.correlationId;
|
|
2894
2894
|
}
|
|
2895
2895
|
isActive() {
|
|
2896
|
-
return this.state ===
|
|
2896
|
+
return this.state === ie.STREAMING || this.state === ie.UNSTARTED;
|
|
2897
2897
|
}
|
|
2898
2898
|
getState() {
|
|
2899
2899
|
return this.state;
|
|
@@ -2906,24 +2906,24 @@ var Ct = function(t, e, i, n) {
|
|
|
2906
2906
|
});
|
|
2907
2907
|
}
|
|
2908
2908
|
return new (i || (i = Promise))(function(s, c) {
|
|
2909
|
-
function l(
|
|
2909
|
+
function l(p) {
|
|
2910
2910
|
try {
|
|
2911
|
-
|
|
2911
|
+
f(n.next(p));
|
|
2912
2912
|
} catch (u) {
|
|
2913
2913
|
c(u);
|
|
2914
2914
|
}
|
|
2915
2915
|
}
|
|
2916
|
-
function m(
|
|
2916
|
+
function m(p) {
|
|
2917
2917
|
try {
|
|
2918
|
-
|
|
2918
|
+
f(n.throw(p));
|
|
2919
2919
|
} catch (u) {
|
|
2920
2920
|
c(u);
|
|
2921
2921
|
}
|
|
2922
2922
|
}
|
|
2923
|
-
function p
|
|
2924
|
-
|
|
2923
|
+
function f(p) {
|
|
2924
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
2925
2925
|
}
|
|
2926
|
-
|
|
2926
|
+
f((n = n.apply(t, e || [])).next());
|
|
2927
2927
|
});
|
|
2928
2928
|
};
|
|
2929
2929
|
const mi = (t, e) => {
|
|
@@ -3006,7 +3006,7 @@ class un {
|
|
|
3006
3006
|
return;
|
|
3007
3007
|
const c = this.handlers[i];
|
|
3008
3008
|
if (c.onComplete) {
|
|
3009
|
-
e.tool_type === "client" && this.publicEventEmitter.emit(
|
|
3009
|
+
e.tool_type === "client" && this.publicEventEmitter.emit(O.TOOL_CALL_COMPLETED, s);
|
|
3010
3010
|
try {
|
|
3011
3011
|
yield c.onComplete(s);
|
|
3012
3012
|
} catch (l) {
|
|
@@ -3026,7 +3026,7 @@ class un {
|
|
|
3026
3026
|
return;
|
|
3027
3027
|
const c = this.handlers[i];
|
|
3028
3028
|
if (c.onFail) {
|
|
3029
|
-
e.tool_type === "client" && this.publicEventEmitter.emit(
|
|
3029
|
+
e.tool_type === "client" && this.publicEventEmitter.emit(O.TOOL_CALL_FAILED, s);
|
|
3030
3030
|
try {
|
|
3031
3031
|
yield c.onFail(s);
|
|
3032
3032
|
} catch (l) {
|
|
@@ -3049,7 +3049,7 @@ class un {
|
|
|
3049
3049
|
userActionCorrelationId: e.userActionCorrelationId,
|
|
3050
3050
|
timestampUserAction: e.timestampUserAction
|
|
3051
3051
|
};
|
|
3052
|
-
this.internalEventEmitter.emit(
|
|
3052
|
+
this.internalEventEmitter.emit(B.TOOL_CALL_RESULT_READY, i);
|
|
3053
3053
|
}
|
|
3054
3054
|
/**
|
|
3055
3055
|
* Converts a WebRtcClientToolEvent to a ClientToolEvent
|
|
@@ -3125,43 +3125,43 @@ class un {
|
|
|
3125
3125
|
};
|
|
3126
3126
|
}
|
|
3127
3127
|
}
|
|
3128
|
-
var
|
|
3128
|
+
var Z = function(t, e, i, n) {
|
|
3129
3129
|
function a(s) {
|
|
3130
3130
|
return s instanceof i ? s : new i(function(c) {
|
|
3131
3131
|
c(s);
|
|
3132
3132
|
});
|
|
3133
3133
|
}
|
|
3134
3134
|
return new (i || (i = Promise))(function(s, c) {
|
|
3135
|
-
function l(
|
|
3135
|
+
function l(p) {
|
|
3136
3136
|
try {
|
|
3137
|
-
|
|
3137
|
+
f(n.next(p));
|
|
3138
3138
|
} catch (u) {
|
|
3139
3139
|
c(u);
|
|
3140
3140
|
}
|
|
3141
3141
|
}
|
|
3142
|
-
function m(
|
|
3142
|
+
function m(p) {
|
|
3143
3143
|
try {
|
|
3144
|
-
|
|
3144
|
+
f(n.throw(p));
|
|
3145
3145
|
} catch (u) {
|
|
3146
3146
|
c(u);
|
|
3147
3147
|
}
|
|
3148
3148
|
}
|
|
3149
|
-
function p
|
|
3150
|
-
|
|
3149
|
+
function f(p) {
|
|
3150
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
3151
3151
|
}
|
|
3152
|
-
|
|
3152
|
+
f((n = n.apply(t, e || [])).next());
|
|
3153
3153
|
});
|
|
3154
3154
|
};
|
|
3155
3155
|
const St = 15e3, Ar = 5e3, gi = 2, Or = 3, xr = 2e3, Tt = 3e3, Nr = 5e3;
|
|
3156
3156
|
class kr {
|
|
3157
3157
|
constructor(e, i, n, a, s, c) {
|
|
3158
|
-
var l, m,
|
|
3158
|
+
var l, m, f, p;
|
|
3159
3159
|
this.peerConnection = null, this.connectionEstablishedEmitted = !1, this.iceRestartInProgress = !1, this.iceRestartAttempts = 0, this.iceRestartAwaitedAnswer = !1, this.iceRestartEpisodeStartMs = null, this.iceRestartEpisodeTrigger = null, this.iceRestartStopped = !1, this.iceDisconnectedGraceTimer = null, this.iceRestartWatchdogTimer = null, this.pendingWsOpenListener = null, this.pendingWsOpenTimeout = null, this.pendingWsOpenReject = null, this.connectionReceivedAnswer = !1, this.remoteIceCandidateBuffer = [], this.iceRestartCandidateBuffer = null, this.inputAudioStream = null, this.dataChannel = null, this.videoElement = null, this.videoStream = null, this.audioStream = null, this.inputAudioState = {
|
|
3160
3160
|
isMuted: !1,
|
|
3161
3161
|
permissionState: me.NOT_REQUESTED
|
|
3162
3162
|
}, this.successMetricPoller = null, this.successMetricFired = !1, this.showPeerConnectionStatsReport = !1, this.peerConnectionStatsReportOutputFormat = "console", this.statsCollectionInterval = null, this.agentAudioInputStream = null, this.firstLocalIceCandidateSent = !1, this.firstRemoteIceCandidateReceived = !1, this.firstRemoteIceCandidateApplied = !1, this.connectionEstablishedMilestoneRecorded = !1, this.publicEventEmitter = n, this.internalEventEmitter = a, this.toolCallManager = s, this.connectionMilestones = c, this.apiGatewayConfig = i.apiGateway;
|
|
3163
3163
|
const { inputAudio: u } = i;
|
|
3164
|
-
this.inputAudioState = u.inputAudioState, i.inputAudio.userProvidedMediaStream && (this.inputAudioStream = i.inputAudio.userProvidedMediaStream), this.disableInputAudio = i.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(
|
|
3164
|
+
this.inputAudioState = u.inputAudioState, i.inputAudio.userProvidedMediaStream && (this.inputAudioStream = i.inputAudio.userProvidedMediaStream), this.disableInputAudio = i.inputAudio.disableInputAudio === !0, this.internalEventEmitter.addListener(B.WEB_SOCKET_OPEN, this.onSignallingClientConnected.bind(this)), this.internalEventEmitter.addListener(B.SIGNAL_MESSAGE_RECEIVED, this.onSignalMessage.bind(this)), this.internalEventEmitter.addListener(B.WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED, this.toolCallManager.processToolCallStartedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(B.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED, this.toolCallManager.processToolCallCompletedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(B.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED, this.toolCallManager.processToolCallFailedEvent.bind(this.toolCallManager)), this.internalEventEmitter.addListener(B.TOOL_CALL_RESULT_READY, this.onToolCallResultReceived.bind(this)), this.iceServers = i.iceServers, this.iceTransportPolicy = i.iceTransportPolicy, this.rtcConfiguration = i.rtcConfiguration, this.signallingClient = new mr(e, i.signalling, this.publicEventEmitter, this.internalEventEmitter, this.apiGatewayConfig, this.connectionMilestones), this.engineApiRestClient = new yr(i.engine.baseUrl, e, this.apiGatewayConfig), this.audioDeviceId = i.inputAudio.audioDeviceId, this.showPeerConnectionStatsReport = (m = (l = i.metrics) === null || l === void 0 ? void 0 : l.showPeerConnectionStatsReport) !== null && m !== void 0 ? m : !1, this.peerConnectionStatsReportOutputFormat = (p = (f = i.metrics) === null || f === void 0 ? void 0 : f.peerConnectionStatsReportOutputFormat) !== null && p !== void 0 ? p : "console";
|
|
3165
3165
|
}
|
|
3166
3166
|
onInputAudioStateChange(e, i) {
|
|
3167
3167
|
e.isMuted !== i.isMuted && (i.isMuted ? this.muteAllAudioTracks() : this.unmuteAllAudioTracks());
|
|
@@ -3179,7 +3179,7 @@ class kr {
|
|
|
3179
3179
|
});
|
|
3180
3180
|
}
|
|
3181
3181
|
startStatsCollection() {
|
|
3182
|
-
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() =>
|
|
3182
|
+
this.statsCollectionInterval || (this.statsCollectionInterval = setInterval(() => Z(this, void 0, void 0, function* () {
|
|
3183
3183
|
if (!(!this.peerConnection || !this.dataChannel || this.dataChannel.readyState !== "open"))
|
|
3184
3184
|
try {
|
|
3185
3185
|
const e = yield this.peerConnection.getStats();
|
|
@@ -3218,7 +3218,7 @@ class kr {
|
|
|
3218
3218
|
timeoutMs: St
|
|
3219
3219
|
}), console.warn("No video frames received, there is a problem with the connection."), clearInterval(this.successMetricPoller), this.successMetricPoller = null);
|
|
3220
3220
|
}, St);
|
|
3221
|
-
this.successMetricPoller = setInterval(() =>
|
|
3221
|
+
this.successMetricPoller = setInterval(() => Z(this, void 0, void 0, function* () {
|
|
3222
3222
|
if (!this.peerConnection || this.successMetricFired) {
|
|
3223
3223
|
this.successMetricPoller && clearInterval(this.successMetricPoller), clearTimeout(e);
|
|
3224
3224
|
return;
|
|
@@ -3249,7 +3249,7 @@ class kr {
|
|
|
3249
3249
|
return this.peerConnection;
|
|
3250
3250
|
}
|
|
3251
3251
|
changeAudioInputDevice(e) {
|
|
3252
|
-
return
|
|
3252
|
+
return Z(this, void 0, void 0, function* () {
|
|
3253
3253
|
if (!this.peerConnection)
|
|
3254
3254
|
throw new Error("StreamingClient - changeAudioInputDevice: peer connection is not initialized. Start streaming first.");
|
|
3255
3255
|
if (e == null)
|
|
@@ -3267,7 +3267,7 @@ class kr {
|
|
|
3267
3267
|
};
|
|
3268
3268
|
this.inputAudioStream = yield navigator.mediaDevices.getUserMedia({
|
|
3269
3269
|
audio: n
|
|
3270
|
-
}), this.audioDeviceId = e, yield this.setupAudioTrack(), i && this.muteAllAudioTracks(), this.publicEventEmitter.emit(
|
|
3270
|
+
}), this.audioDeviceId = e, yield this.setupAudioTrack(), i && this.muteAllAudioTracks(), this.publicEventEmitter.emit(O.INPUT_AUDIO_DEVICE_CHANGED, e);
|
|
3271
3271
|
} catch (n) {
|
|
3272
3272
|
throw console.error("Failed to change audio input device:", n), new Error(`StreamingClient - changeAudioInputDevice: ${n instanceof Error ? n.message : String(n)}`);
|
|
3273
3273
|
}
|
|
@@ -3319,12 +3319,12 @@ class kr {
|
|
|
3319
3319
|
this.firstLocalIceCandidateSent = !1, this.firstRemoteIceCandidateReceived = !1, this.firstRemoteIceCandidateApplied = !1, this.connectionEstablishedMilestoneRecorded = !1;
|
|
3320
3320
|
}
|
|
3321
3321
|
stopConnection() {
|
|
3322
|
-
return
|
|
3322
|
+
return Z(this, void 0, void 0, function* () {
|
|
3323
3323
|
yield this.shutdown();
|
|
3324
3324
|
});
|
|
3325
3325
|
}
|
|
3326
3326
|
sendTalkCommand(e) {
|
|
3327
|
-
return
|
|
3327
|
+
return Z(this, void 0, void 0, function* () {
|
|
3328
3328
|
if (!this.peerConnection)
|
|
3329
3329
|
throw new Error("StreamingClient - sendTalkCommand: peer connection is null");
|
|
3330
3330
|
yield this.engineApiRestClient.sendTalkCommand(e);
|
|
@@ -3340,8 +3340,8 @@ class kr {
|
|
|
3340
3340
|
return this.agentAudioInputStream;
|
|
3341
3341
|
}
|
|
3342
3342
|
initPeerConnection() {
|
|
3343
|
-
return
|
|
3344
|
-
var e, i, n, a, s, c, l, m,
|
|
3343
|
+
return Z(this, void 0, void 0, function* () {
|
|
3344
|
+
var e, i, n, a, s, c, l, m, f, p;
|
|
3345
3345
|
(e = this.connectionMilestones) === null || e === void 0 || e.record("peer_connection_creating"), this.peerConnection = new RTCPeerConnection(Object.assign(Object.assign({
|
|
3346
3346
|
// SDK default first (caller's rtcConfiguration may override it)
|
|
3347
3347
|
iceCandidatePoolSize: gi
|
|
@@ -3353,9 +3353,9 @@ class kr {
|
|
|
3353
3353
|
iceCandidatePoolSize: gi,
|
|
3354
3354
|
iceServerCount: this.iceServers.length,
|
|
3355
3355
|
iceTransportPolicy: (m = (l = (c = this.rtcConfiguration) === null || c === void 0 ? void 0 : c.iceTransportPolicy) !== null && l !== void 0 ? l : this.iceTransportPolicy) !== null && m !== void 0 ? m : "all"
|
|
3356
|
-
}), 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 ? ((
|
|
3356
|
+
}), 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 ? ((f = this.connectionMilestones) === null || f === void 0 || f.record("microphone_permission_skipped", {
|
|
3357
3357
|
reason: "input_audio_disabled"
|
|
3358
|
-
}), this.peerConnection.addTransceiver("audio", { direction: "recvonly" })) : (this.peerConnection.addTransceiver("audio", { direction: "sendrecv" }), this.inputAudioStream ? ((
|
|
3358
|
+
}), this.peerConnection.addTransceiver("audio", { direction: "recvonly" })) : (this.peerConnection.addTransceiver("audio", { direction: "sendrecv" }), this.inputAudioStream ? ((p = this.connectionMilestones) === null || p === void 0 || p.record("input_audio_stream_provided", {
|
|
3359
3359
|
audioTrackCount: this.inputAudioStream.getAudioTracks().length
|
|
3360
3360
|
}), yield this.setupAudioTrack()) : this.requestMicrophonePermissionAsync().catch((u) => {
|
|
3361
3361
|
console.error("Async microphone permission request failed:", u);
|
|
@@ -3363,20 +3363,20 @@ class kr {
|
|
|
3363
3363
|
});
|
|
3364
3364
|
}
|
|
3365
3365
|
onSignalMessage(e) {
|
|
3366
|
-
return
|
|
3366
|
+
return Z(this, void 0, void 0, function* () {
|
|
3367
3367
|
var i, n, a, s;
|
|
3368
3368
|
if (!this.peerConnection) {
|
|
3369
3369
|
console.error("StreamingClient - onSignalMessage: peerConnection is not initialized");
|
|
3370
3370
|
return;
|
|
3371
3371
|
}
|
|
3372
3372
|
switch (e.actionType) {
|
|
3373
|
-
case
|
|
3373
|
+
case Q.ANSWER: {
|
|
3374
3374
|
(i = this.connectionMilestones) === null || i === void 0 || i.record("answer_received");
|
|
3375
|
-
const
|
|
3375
|
+
const p = e.payload;
|
|
3376
3376
|
if (this.peerConnection.signalingState !== "have-local-offer")
|
|
3377
3377
|
break;
|
|
3378
3378
|
try {
|
|
3379
|
-
yield this.peerConnection.setRemoteDescription(
|
|
3379
|
+
yield this.peerConnection.setRemoteDescription(p);
|
|
3380
3380
|
} catch (u) {
|
|
3381
3381
|
console.error("StreamingClient - setRemoteDescription(answer) failed", u), !this.connectionEstablishedEmitted && !this.isAwaitingRestartAnswer() && this.handleWebrtcFailure(u);
|
|
3382
3382
|
break;
|
|
@@ -3384,30 +3384,30 @@ class kr {
|
|
|
3384
3384
|
(n = this.connectionMilestones) === null || n === void 0 || n.record("remote_description_set"), this.connectionReceivedAnswer = !0, this.onAnswerAccepted(), yield this.flushRemoteIceCandidateBuffer();
|
|
3385
3385
|
break;
|
|
3386
3386
|
}
|
|
3387
|
-
case
|
|
3388
|
-
const
|
|
3387
|
+
case Q.ICE_CANDIDATE: {
|
|
3388
|
+
const p = e.payload, u = new RTCIceCandidate(p);
|
|
3389
3389
|
this.firstRemoteIceCandidateReceived || (this.firstRemoteIceCandidateReceived = !0, (a = this.connectionMilestones) === null || a === void 0 || a.record("first_remote_ice_candidate_received", yt(u))), this.connectionReceivedAnswer ? yield this.addRemoteIceCandidate(u) : this.remoteIceCandidateBuffer.push(u);
|
|
3390
3390
|
break;
|
|
3391
3391
|
}
|
|
3392
|
-
case
|
|
3392
|
+
case Q.END_SESSION:
|
|
3393
3393
|
const c = e.payload;
|
|
3394
3394
|
this.sendIceRestartMetric("aborted"), (s = this.connectionMilestones) === null || s === void 0 || s.publishFailure({
|
|
3395
3395
|
failureStage: "server_closed_connection"
|
|
3396
|
-
}), this.publicEventEmitter.emit(
|
|
3396
|
+
}), this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.SERVER_CLOSED_CONNECTION, c), this.shutdown();
|
|
3397
3397
|
break;
|
|
3398
|
-
case
|
|
3398
|
+
case Q.WARNING:
|
|
3399
3399
|
const l = e.payload;
|
|
3400
|
-
console.warn("Warning received from server: " + l), this.publicEventEmitter.emit(
|
|
3400
|
+
console.warn("Warning received from server: " + l), this.publicEventEmitter.emit(O.SERVER_WARNING, l);
|
|
3401
3401
|
break;
|
|
3402
|
-
case
|
|
3402
|
+
case Q.TALK_STREAM_INTERRUPTED:
|
|
3403
3403
|
const m = e.payload;
|
|
3404
|
-
this.publicEventEmitter.emit(
|
|
3404
|
+
this.publicEventEmitter.emit(O.TALK_STREAM_INTERRUPTED, m.correlationId);
|
|
3405
3405
|
break;
|
|
3406
|
-
case
|
|
3407
|
-
const
|
|
3408
|
-
this.publicEventEmitter.emit(
|
|
3406
|
+
case Q.SESSION_READY:
|
|
3407
|
+
const f = e.sessionId;
|
|
3408
|
+
this.publicEventEmitter.emit(O.SESSION_READY, f);
|
|
3409
3409
|
break;
|
|
3410
|
-
case
|
|
3410
|
+
case Q.HEARTBEAT:
|
|
3411
3411
|
break;
|
|
3412
3412
|
default:
|
|
3413
3413
|
console.warn("StreamingClient - onSignalMessage: unknown signal message action type. Is your @anam-ai/js-sdk version up to date?", e);
|
|
@@ -3415,7 +3415,7 @@ class kr {
|
|
|
3415
3415
|
});
|
|
3416
3416
|
}
|
|
3417
3417
|
onSignallingClientConnected() {
|
|
3418
|
-
return
|
|
3418
|
+
return Z(this, void 0, void 0, function* () {
|
|
3419
3419
|
if (!this.peerConnection)
|
|
3420
3420
|
try {
|
|
3421
3421
|
yield this.initPeerConnectionAndSendOffer();
|
|
@@ -3425,7 +3425,7 @@ class kr {
|
|
|
3425
3425
|
});
|
|
3426
3426
|
}
|
|
3427
3427
|
flushRemoteIceCandidateBuffer() {
|
|
3428
|
-
return
|
|
3428
|
+
return Z(this, void 0, void 0, function* () {
|
|
3429
3429
|
const e = [...this.remoteIceCandidateBuffer];
|
|
3430
3430
|
this.remoteIceCandidateBuffer = [];
|
|
3431
3431
|
for (const i of e)
|
|
@@ -3441,7 +3441,7 @@ class kr {
|
|
|
3441
3441
|
* genuine, successful add.
|
|
3442
3442
|
*/
|
|
3443
3443
|
addRemoteIceCandidate(e) {
|
|
3444
|
-
return
|
|
3444
|
+
return Z(this, void 0, void 0, function* () {
|
|
3445
3445
|
if (this.peerConnection)
|
|
3446
3446
|
try {
|
|
3447
3447
|
yield this.peerConnection.addIceCandidate(e), this.recordFirstRemoteIceCandidateApplied(e);
|
|
@@ -3480,7 +3480,7 @@ class kr {
|
|
|
3480
3480
|
case "completed":
|
|
3481
3481
|
this.clearIceDisconnectedGraceTimer(), this.clearIceRestartWatchdog(), this.iceRestartInProgress = !1, this.sendIceRestartMetric("recovered"), this.iceRestartAttempts = 0, this.signallingClient.endIceRestartReconnect(), this.connectionEstablishedMilestoneRecorded || (this.connectionEstablishedMilestoneRecorded = !0, (n = this.connectionMilestones) === null || n === void 0 || n.record("client_connection_established", {
|
|
3482
3482
|
iceConnectionState: a
|
|
3483
|
-
})), this.connectionEstablishedEmitted || (this.connectionEstablishedEmitted = !0, this.publicEventEmitter.emit(
|
|
3483
|
+
})), this.connectionEstablishedEmitted || (this.connectionEstablishedEmitted = !0, this.publicEventEmitter.emit(O.CONNECTION_ESTABLISHED)), this.startStatsCollection();
|
|
3484
3484
|
break;
|
|
3485
3485
|
case "disconnected":
|
|
3486
3486
|
this.scheduleIceRestartAfterGrace();
|
|
@@ -3526,7 +3526,7 @@ class kr {
|
|
|
3526
3526
|
}
|
|
3527
3527
|
// Clears the pending ensureSignallingConnected wait (timeout + listener).
|
|
3528
3528
|
clearPendingWsOpenWait() {
|
|
3529
|
-
this.pendingWsOpenTimeout && (clearTimeout(this.pendingWsOpenTimeout), this.pendingWsOpenTimeout = null), this.pendingWsOpenListener && (this.internalEventEmitter.removeListener(
|
|
3529
|
+
this.pendingWsOpenTimeout && (clearTimeout(this.pendingWsOpenTimeout), this.pendingWsOpenTimeout = null), this.pendingWsOpenListener && (this.internalEventEmitter.removeListener(B.WEB_SOCKET_OPEN, this.pendingWsOpenListener), this.pendingWsOpenListener = null), this.pendingWsOpenReject = null;
|
|
3530
3530
|
}
|
|
3531
3531
|
// Stops all restart activity: timers, pending WS wait, and the in-progress gate.
|
|
3532
3532
|
cancelIceRestart() {
|
|
@@ -3565,7 +3565,7 @@ class kr {
|
|
|
3565
3565
|
const n = () => {
|
|
3566
3566
|
this.clearPendingWsOpenWait(), e();
|
|
3567
3567
|
};
|
|
3568
|
-
this.pendingWsOpenListener = n, this.internalEventEmitter.addListener(
|
|
3568
|
+
this.pendingWsOpenListener = n, this.internalEventEmitter.addListener(B.WEB_SOCKET_OPEN, n);
|
|
3569
3569
|
});
|
|
3570
3570
|
}
|
|
3571
3571
|
/**
|
|
@@ -3574,7 +3574,7 @@ class kr {
|
|
|
3574
3574
|
* exhaustion or terminal signalling, falls back to the WebRTC-failure path.
|
|
3575
3575
|
*/
|
|
3576
3576
|
restartIce() {
|
|
3577
|
-
return
|
|
3577
|
+
return Z(this, void 0, void 0, function* () {
|
|
3578
3578
|
var e, i;
|
|
3579
3579
|
if (!(!this.peerConnection || this.iceRestartInProgress || this.iceRestartStopped)) {
|
|
3580
3580
|
if (this.signallingClient.isPermanentlyClosed()) {
|
|
@@ -3651,7 +3651,7 @@ class kr {
|
|
|
3651
3651
|
}
|
|
3652
3652
|
handleWebrtcFailure(e) {
|
|
3653
3653
|
var i, n;
|
|
3654
|
-
(i = this.connectionMilestones) === null || i === void 0 || i.record("webrtc_failure", $e(e)), (n = this.connectionMilestones) === null || n === void 0 || n.publishFailure(Object.assign({ failureStage: "webrtc" }, $e(e))), console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(
|
|
3654
|
+
(i = this.connectionMilestones) === null || i === void 0 || i.record("webrtc_failure", $e(e)), (n = this.connectionMilestones) === null || n === void 0 || n.publishFailure(Object.assign({ failureStage: "webrtc" }, $e(e))), console.error({ message: "StreamingClient - handleWebrtcFailure: ", err: e }), e.name === "NotAllowedError" && e.message === "Permission denied" ? this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.MICROPHONE_PERMISSION_DENIED) : this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.WEBRTC_FAILURE);
|
|
3655
3655
|
try {
|
|
3656
3656
|
this.stopConnection();
|
|
3657
3657
|
} catch (a) {
|
|
@@ -3661,20 +3661,20 @@ class kr {
|
|
|
3661
3661
|
onTrackEventHandler(e) {
|
|
3662
3662
|
var i, n;
|
|
3663
3663
|
if (e.track.kind === "video") {
|
|
3664
|
-
if ((i = this.connectionMilestones) === null || i === void 0 || i.record("video_track_received"), this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(
|
|
3664
|
+
if ((i = this.connectionMilestones) === null || i === void 0 || i.record("video_track_received"), this.startSuccessMetricPolling(), this.videoStream = e.streams[0], this.publicEventEmitter.emit(O.VIDEO_STREAM_STARTED, this.videoStream), this.videoElement) {
|
|
3665
3665
|
this.videoElement.srcObject = this.videoStream;
|
|
3666
3666
|
const a = this.videoElement.requestVideoFrameCallback(() => {
|
|
3667
3667
|
var s;
|
|
3668
|
-
(s = this.videoElement) === null || s === void 0 || s.cancelVideoFrameCallback(a), this.publicEventEmitter.emit(
|
|
3668
|
+
(s = this.videoElement) === null || s === void 0 || s.cancelVideoFrameCallback(a), this.publicEventEmitter.emit(O.VIDEO_PLAY_STARTED), this.recordSessionSuccess("videoElement");
|
|
3669
3669
|
});
|
|
3670
3670
|
}
|
|
3671
|
-
} else e.track.kind === "audio" && ((n = this.connectionMilestones) === null || n === void 0 || n.record("audio_track_received"), this.audioStream = e.streams[0], this.publicEventEmitter.emit(
|
|
3671
|
+
} else e.track.kind === "audio" && ((n = this.connectionMilestones) === null || n === void 0 || n.record("audio_track_received"), this.audioStream = e.streams[0], this.publicEventEmitter.emit(O.AUDIO_STREAM_STARTED, this.audioStream));
|
|
3672
3672
|
}
|
|
3673
3673
|
/**
|
|
3674
3674
|
* Set up the data channels for sending and receiving messages
|
|
3675
3675
|
*/
|
|
3676
3676
|
setupDataChannels() {
|
|
3677
|
-
return
|
|
3677
|
+
return Z(this, void 0, void 0, function* () {
|
|
3678
3678
|
var e;
|
|
3679
3679
|
if (!this.peerConnection) {
|
|
3680
3680
|
console.error("StreamingClient - setupDataChannels: peer connection is not initialized");
|
|
@@ -3692,53 +3692,53 @@ class kr {
|
|
|
3692
3692
|
var n;
|
|
3693
3693
|
(n = this.connectionMilestones) === null || n === void 0 || n.record("data_channel_closed");
|
|
3694
3694
|
}, i.onmessage = (n) => {
|
|
3695
|
-
var a, s, c, l, m,
|
|
3695
|
+
var a, s, c, l, m, f;
|
|
3696
3696
|
try {
|
|
3697
|
-
const
|
|
3698
|
-
switch (
|
|
3697
|
+
const p = JSON.parse(n.data);
|
|
3698
|
+
switch (p.messageType) {
|
|
3699
3699
|
case se.SPEECH_TEXT:
|
|
3700
|
-
this.internalEventEmitter.emit(
|
|
3700
|
+
this.internalEventEmitter.emit(B.WEBRTC_CHAT_MESSAGE_RECEIVED, p.data);
|
|
3701
3701
|
break;
|
|
3702
3702
|
case se.CLIENT_TOOL_EVENT:
|
|
3703
|
-
const u =
|
|
3704
|
-
this.internalEventEmitter.emit(
|
|
3705
|
-
const
|
|
3706
|
-
this.publicEventEmitter.emit(
|
|
3703
|
+
const u = p.data;
|
|
3704
|
+
this.internalEventEmitter.emit(B.WEBRTC_CLIENT_TOOL_EVENT_RECEIVED, u);
|
|
3705
|
+
const y = un.WebRTCClientToolEventToClientToolEvent(u);
|
|
3706
|
+
this.publicEventEmitter.emit(O.CLIENT_TOOL_EVENT_RECEIVED, y);
|
|
3707
3707
|
break;
|
|
3708
3708
|
case se.TOOL_CALL_STARTED_EVENT:
|
|
3709
|
-
const E =
|
|
3710
|
-
this.publicEventEmitter.emit(
|
|
3709
|
+
const E = p.data;
|
|
3710
|
+
this.publicEventEmitter.emit(O.TOOL_CALL_STARTED, this.toolCallManager.WebRTCToolCallStartedEventToToolCallStartedPayload(E)), this.internalEventEmitter.emit(B.WEBRTC_TOOL_CALL_STARTED_EVENT_RECEIVED, E);
|
|
3711
3711
|
break;
|
|
3712
3712
|
case se.TOOL_CALL_COMPLETED_EVENT:
|
|
3713
|
-
const
|
|
3714
|
-
this.publicEventEmitter.emit(
|
|
3713
|
+
const T = p.data;
|
|
3714
|
+
this.publicEventEmitter.emit(O.TOOL_CALL_COMPLETED, this.toolCallManager.webRTCToolCallCompletedEventToToolCallCompletedPayload(T)), this.internalEventEmitter.emit(B.WEBRTC_TOOL_CALL_COMPLETED_EVENT_RECEIVED, T);
|
|
3715
3715
|
break;
|
|
3716
3716
|
case se.TOOL_CALL_FAILED_EVENT:
|
|
3717
|
-
const
|
|
3718
|
-
this.publicEventEmitter.emit(
|
|
3717
|
+
const I = p.data;
|
|
3718
|
+
this.publicEventEmitter.emit(O.TOOL_CALL_FAILED, this.toolCallManager.webRTCToolCallFailedEventToToolCallFailedPayload(I)), this.internalEventEmitter.emit(B.WEBRTC_TOOL_CALL_FAILED_EVENT_RECEIVED, I);
|
|
3719
3719
|
break;
|
|
3720
3720
|
case se.REASONING_TEXT:
|
|
3721
|
-
this.internalEventEmitter.emit(
|
|
3721
|
+
this.internalEventEmitter.emit(B.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, p.data);
|
|
3722
3722
|
break;
|
|
3723
3723
|
case se.USER_SPEECH_STARTED:
|
|
3724
|
-
this.publicEventEmitter.emit(
|
|
3724
|
+
this.publicEventEmitter.emit(O.USER_SPEECH_STARTED, (s = (a = p.data) === null || a === void 0 ? void 0 : a.user_action_correlation_id) !== null && s !== void 0 ? s : "unknown");
|
|
3725
3725
|
break;
|
|
3726
3726
|
case se.USER_SPEECH_ENDED:
|
|
3727
|
-
this.publicEventEmitter.emit(
|
|
3727
|
+
this.publicEventEmitter.emit(O.USER_SPEECH_ENDED, (l = (c = p.data) === null || c === void 0 ? void 0 : c.user_action_correlation_id) !== null && l !== void 0 ? l : "unknown");
|
|
3728
3728
|
break;
|
|
3729
3729
|
case se.DIRECTOR_NOTE_CUE_APPLIED:
|
|
3730
|
-
const
|
|
3731
|
-
this.publicEventEmitter.emit(
|
|
3732
|
-
cueTag: (m =
|
|
3733
|
-
correlationId: (
|
|
3730
|
+
const w = p.data;
|
|
3731
|
+
this.publicEventEmitter.emit(O.DIRECTOR_NOTE_CUE_APPLIED, {
|
|
3732
|
+
cueTag: (m = w?.cue_tag) !== null && m !== void 0 ? m : "unknown",
|
|
3733
|
+
correlationId: (f = w?.user_action_correlation_id) !== null && f !== void 0 ? f : "unknown"
|
|
3734
3734
|
});
|
|
3735
3735
|
break;
|
|
3736
3736
|
// Unknown message types are silently ignored to maintain forward compatibility
|
|
3737
3737
|
default:
|
|
3738
3738
|
break;
|
|
3739
3739
|
}
|
|
3740
|
-
} catch (
|
|
3741
|
-
console.error("Failed to parse data channel message:",
|
|
3740
|
+
} catch (p) {
|
|
3741
|
+
console.error("Failed to parse data channel message:", p);
|
|
3742
3742
|
}
|
|
3743
3743
|
};
|
|
3744
3744
|
});
|
|
@@ -3747,23 +3747,29 @@ class kr {
|
|
|
3747
3747
|
* Request microphone permission asynchronously without blocking connection
|
|
3748
3748
|
*/
|
|
3749
3749
|
requestMicrophonePermissionAsync() {
|
|
3750
|
-
return
|
|
3750
|
+
return Z(this, void 0, void 0, function* () {
|
|
3751
3751
|
var e, i, n;
|
|
3752
3752
|
if (this.inputAudioState.permissionState !== me.PENDING) {
|
|
3753
|
-
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: me.PENDING }), (e = this.connectionMilestones) === null || e === void 0 || e.record("microphone_permission_pending"), this.publicEventEmitter.emit(
|
|
3753
|
+
this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: me.PENDING }), (e = this.connectionMilestones) === null || e === void 0 || e.record("microphone_permission_pending"), this.publicEventEmitter.emit(O.MIC_PERMISSION_PENDING);
|
|
3754
3754
|
try {
|
|
3755
3755
|
const a = {
|
|
3756
3756
|
echoCancellation: !0
|
|
3757
3757
|
};
|
|
3758
3758
|
this.audioDeviceId && (a.deviceId = {
|
|
3759
3759
|
exact: this.audioDeviceId
|
|
3760
|
-
})
|
|
3760
|
+
});
|
|
3761
|
+
const s = yield navigator.mediaDevices.getUserMedia({
|
|
3761
3762
|
audio: a
|
|
3762
|
-
})
|
|
3763
|
+
});
|
|
3764
|
+
if (this.iceRestartStopped || !this.peerConnection) {
|
|
3765
|
+
s.getTracks().forEach((c) => c.stop());
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3768
|
+
this.inputAudioStream = s, this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: me.GRANTED }), (i = this.connectionMilestones) === null || i === void 0 || i.record("microphone_permission_granted"), this.publicEventEmitter.emit(O.MIC_PERMISSION_GRANTED), yield this.setupAudioTrack();
|
|
3763
3769
|
} catch (a) {
|
|
3764
3770
|
console.error("Failed to get microphone permission:", a), this.inputAudioState = Object.assign(Object.assign({}, this.inputAudioState), { permissionState: me.DENIED }), (n = this.connectionMilestones) === null || n === void 0 || n.record("microphone_permission_denied", Object.assign({}, $e(a)));
|
|
3765
3771
|
const s = a instanceof Error ? a.message : String(a);
|
|
3766
|
-
this.publicEventEmitter.emit(
|
|
3772
|
+
this.publicEventEmitter.emit(O.MIC_PERMISSION_DENIED, s);
|
|
3767
3773
|
}
|
|
3768
3774
|
}
|
|
3769
3775
|
});
|
|
@@ -3772,7 +3778,7 @@ class kr {
|
|
|
3772
3778
|
* Set up audio track and add it to the peer connection using replaceTrack
|
|
3773
3779
|
*/
|
|
3774
3780
|
setupAudioTrack() {
|
|
3775
|
-
return
|
|
3781
|
+
return Z(this, void 0, void 0, function* () {
|
|
3776
3782
|
var e;
|
|
3777
3783
|
if (!this.peerConnection || !this.inputAudioStream)
|
|
3778
3784
|
return;
|
|
@@ -3795,11 +3801,11 @@ class kr {
|
|
|
3795
3801
|
this.peerConnection.addTrack(i, this.inputAudioStream);
|
|
3796
3802
|
(e = this.connectionMilestones) === null || e === void 0 || e.record("input_audio_stream_started", {
|
|
3797
3803
|
audioTrackCount: this.inputAudioStream.getAudioTracks().length
|
|
3798
|
-
}), this.publicEventEmitter.emit(
|
|
3804
|
+
}), this.publicEventEmitter.emit(O.INPUT_AUDIO_STREAM_STARTED, this.inputAudioStream);
|
|
3799
3805
|
});
|
|
3800
3806
|
}
|
|
3801
3807
|
initPeerConnectionAndSendOffer() {
|
|
3802
|
-
return
|
|
3808
|
+
return Z(this, void 0, void 0, function* () {
|
|
3803
3809
|
var e, i, n, a, s, c;
|
|
3804
3810
|
if (yield this.initPeerConnection(), !this.peerConnection) {
|
|
3805
3811
|
console.error("StreamingClient - initPeerConnectionAndSendOffer: peer connection is not initialized");
|
|
@@ -3818,7 +3824,7 @@ class kr {
|
|
|
3818
3824
|
});
|
|
3819
3825
|
}
|
|
3820
3826
|
shutdown() {
|
|
3821
|
-
return
|
|
3827
|
+
return Z(this, void 0, void 0, function* () {
|
|
3822
3828
|
var e;
|
|
3823
3829
|
if (this.iceRestartStopped = !0, this.cancelIceRestart(), this.showPeerConnectionStatsReport) {
|
|
3824
3830
|
const i = yield (e = this.peerConnection) === null || e === void 0 ? void 0 : e.getStats();
|
|
@@ -3876,7 +3882,7 @@ const yt = (t) => {
|
|
|
3876
3882
|
};
|
|
3877
3883
|
class Lr {
|
|
3878
3884
|
constructor(e, i) {
|
|
3879
|
-
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(
|
|
3885
|
+
this.reasoning_messages = [], this.publicEventEmitter = e, this.internalEventEmitter = i, this.internalEventEmitter.addListener(B.WEBRTC_REASONING_TEXT_MESSAGE_RECEIVED, this.processWebRtcReasoningTextMessageEvent.bind(this));
|
|
3880
3886
|
}
|
|
3881
3887
|
webRtcTextMessageEventToReasoningStreamEvent(e) {
|
|
3882
3888
|
return {
|
|
@@ -3888,7 +3894,7 @@ class Lr {
|
|
|
3888
3894
|
}
|
|
3889
3895
|
processWebRtcReasoningTextMessageEvent(e) {
|
|
3890
3896
|
const i = this.webRtcTextMessageEventToReasoningStreamEvent(e);
|
|
3891
|
-
this.publicEventEmitter.emit(
|
|
3897
|
+
this.publicEventEmitter.emit(O.REASONING_STREAM_EVENT_RECEIVED, i);
|
|
3892
3898
|
const n = {
|
|
3893
3899
|
id: i.id,
|
|
3894
3900
|
content: i.content,
|
|
@@ -3899,7 +3905,7 @@ class Lr {
|
|
|
3899
3905
|
s.content += n.content, this.reasoning_messages[a] = s;
|
|
3900
3906
|
} else
|
|
3901
3907
|
this.reasoning_messages.push(n);
|
|
3902
|
-
i.endOfThought && this.publicEventEmitter.emit(
|
|
3908
|
+
i.endOfThought && this.publicEventEmitter.emit(O.REASONING_HISTORY_UPDATED, this.reasoning_messages);
|
|
3903
3909
|
}
|
|
3904
3910
|
}
|
|
3905
3911
|
var fe = function(t, e, i, n) {
|
|
@@ -3909,24 +3915,24 @@ var fe = function(t, e, i, n) {
|
|
|
3909
3915
|
});
|
|
3910
3916
|
}
|
|
3911
3917
|
return new (i || (i = Promise))(function(s, c) {
|
|
3912
|
-
function l(
|
|
3918
|
+
function l(p) {
|
|
3913
3919
|
try {
|
|
3914
|
-
|
|
3920
|
+
f(n.next(p));
|
|
3915
3921
|
} catch (u) {
|
|
3916
3922
|
c(u);
|
|
3917
3923
|
}
|
|
3918
3924
|
}
|
|
3919
|
-
function m(
|
|
3925
|
+
function m(p) {
|
|
3920
3926
|
try {
|
|
3921
|
-
|
|
3927
|
+
f(n.throw(p));
|
|
3922
3928
|
} catch (u) {
|
|
3923
3929
|
c(u);
|
|
3924
3930
|
}
|
|
3925
3931
|
}
|
|
3926
|
-
function p
|
|
3927
|
-
|
|
3932
|
+
function f(p) {
|
|
3933
|
+
p.done ? s(p.value) : a(p.value).then(l, m);
|
|
3928
3934
|
}
|
|
3929
|
-
|
|
3935
|
+
f((n = n.apply(t, e || [])).next());
|
|
3930
3936
|
});
|
|
3931
3937
|
};
|
|
3932
3938
|
class Mr {
|
|
@@ -3936,9 +3942,9 @@ class Mr {
|
|
|
3936
3942
|
isMuted: !1,
|
|
3937
3943
|
permissionState: me.NOT_REQUESTED
|
|
3938
3944
|
}, this.sessionId = null, this.organizationId = null, this.streamingClient = null, this._isStreaming = !1;
|
|
3939
|
-
const
|
|
3940
|
-
if (
|
|
3941
|
-
throw new
|
|
3945
|
+
const f = this.validateClientConfig(e, i, n);
|
|
3946
|
+
if (f)
|
|
3947
|
+
throw new V(f, J.CLIENT_ERROR_CODE_CONFIGURATION_ERROR, 400);
|
|
3942
3948
|
this.personaConfig = i, this.clientOptions = n, (!((a = n?.api) === null || a === void 0) && a.baseUrl || !((s = n?.api) === null || s === void 0) && s.apiVersion) && tr(n.api.baseUrl || rn, n.api.apiVersion || $t), !((l = (c = n?.api) === null || c === void 0 ? void 0 : c.apiGateway) === null || l === void 0) && l.enabled && ir(n.api.apiGateway), !((m = n?.metrics) === null || m === void 0) && m.disableClientMetrics && nr(!0), this.publicEventEmitter = new wr(), this.internalEventEmitter = new Ir(), this.toolCallManager = new un(this.publicEventEmitter, this.internalEventEmitter), this.apiClient = new Er(e, n?.apiKey, n?.api), this.messageHistoryClient = new br(this.publicEventEmitter, this.internalEventEmitter), this.reasoningHistoryClient = new Lr(this.publicEventEmitter, this.internalEventEmitter);
|
|
3943
3949
|
}
|
|
3944
3950
|
decodeJwt(e) {
|
|
@@ -4008,17 +4014,17 @@ class Mr {
|
|
|
4008
4014
|
}
|
|
4009
4015
|
startSession(e, i) {
|
|
4010
4016
|
return fe(this, void 0, void 0, function* () {
|
|
4011
|
-
var n, a, s, c, l, m,
|
|
4012
|
-
const N = this.personaConfig,
|
|
4017
|
+
var n, a, s, c, l, m, f, p, u, y, E, T, I, w, A, R, b;
|
|
4018
|
+
const N = this.personaConfig, S = this.buildStartSessionOptionsForClient();
|
|
4013
4019
|
i?.record("start_session_request_started");
|
|
4014
|
-
let
|
|
4020
|
+
let k;
|
|
4015
4021
|
try {
|
|
4016
|
-
|
|
4017
|
-
} catch (
|
|
4018
|
-
throw i?.record("start_session_request_failed", Object.assign({}, Oe(
|
|
4022
|
+
k = yield this.apiClient.startSession(N, S), i?.record("start_session_request_completed");
|
|
4023
|
+
} catch (re) {
|
|
4024
|
+
throw i?.record("start_session_request_failed", Object.assign({}, Oe(re))), i?.publishFailure(Object.assign({ failureStage: "start_session_request" }, Oe(re))), re;
|
|
4019
4025
|
}
|
|
4020
|
-
const { sessionId:
|
|
4021
|
-
this.sessionId =
|
|
4026
|
+
const { sessionId: U, clientConfig: z, engineHost: Y, engineProtocol: oe, signallingEndpoint: K } = k, { heartbeatIntervalSeconds: te, maxWsReconnectionAttempts: de, iceServers: ue, iceTransportPolicy: Se } = z;
|
|
4027
|
+
this.sessionId = U, this.toolCallManager.setActiveSession(U), Fe({
|
|
4022
4028
|
sessionId: this.sessionId
|
|
4023
4029
|
}), i?.updateContext({
|
|
4024
4030
|
sessionId: this.sessionId,
|
|
@@ -4026,17 +4032,17 @@ class Mr {
|
|
|
4026
4032
|
});
|
|
4027
4033
|
const Te = (l = (a = (n = this.clientOptions) === null || n === void 0 ? void 0 : n.iceServers) !== null && a !== void 0 ? a : (c = (s = this.clientOptions) === null || s === void 0 ? void 0 : s.rtcConfiguration) === null || c === void 0 ? void 0 : c.iceServers) !== null && l !== void 0 ? l : ue;
|
|
4028
4034
|
try {
|
|
4029
|
-
this.streamingClient = new kr(
|
|
4035
|
+
this.streamingClient = new kr(U, {
|
|
4030
4036
|
engine: {
|
|
4031
|
-
baseUrl: `${oe}://${
|
|
4037
|
+
baseUrl: `${oe}://${Y}`
|
|
4032
4038
|
},
|
|
4033
4039
|
signalling: {
|
|
4034
|
-
heartbeatIntervalSeconds:
|
|
4040
|
+
heartbeatIntervalSeconds: te,
|
|
4035
4041
|
maxWsReconnectionAttempts: de,
|
|
4036
4042
|
url: {
|
|
4037
|
-
baseUrl:
|
|
4043
|
+
baseUrl: Y,
|
|
4038
4044
|
protocol: oe,
|
|
4039
|
-
signallingPath:
|
|
4045
|
+
signallingPath: K
|
|
4040
4046
|
}
|
|
4041
4047
|
},
|
|
4042
4048
|
iceServers: Te,
|
|
@@ -4044,25 +4050,25 @@ class Mr {
|
|
|
4044
4050
|
rtcConfiguration: (m = this.clientOptions) === null || m === void 0 ? void 0 : m.rtcConfiguration,
|
|
4045
4051
|
inputAudio: {
|
|
4046
4052
|
inputAudioState: this.inputAudioState,
|
|
4047
|
-
userProvidedMediaStream: !((
|
|
4048
|
-
audioDeviceId: (
|
|
4053
|
+
userProvidedMediaStream: !((f = this.clientOptions) === null || f === void 0) && f.disableInputAudio ? void 0 : e,
|
|
4054
|
+
audioDeviceId: (p = this.clientOptions) === null || p === void 0 ? void 0 : p.audioDeviceId,
|
|
4049
4055
|
disableInputAudio: (u = this.clientOptions) === null || u === void 0 ? void 0 : u.disableInputAudio
|
|
4050
4056
|
},
|
|
4051
|
-
apiGateway: (E = (
|
|
4057
|
+
apiGateway: (E = (y = this.clientOptions) === null || y === void 0 ? void 0 : y.api) === null || E === void 0 ? void 0 : E.apiGateway,
|
|
4052
4058
|
metrics: {
|
|
4053
|
-
showPeerConnectionStatsReport: (
|
|
4054
|
-
peerConnectionStatsReportOutputFormat: (
|
|
4059
|
+
showPeerConnectionStatsReport: (w = (I = (T = this.clientOptions) === null || T === void 0 ? void 0 : T.metrics) === null || I === void 0 ? void 0 : I.showPeerConnectionStatsReport) !== null && w !== void 0 ? w : !1,
|
|
4060
|
+
peerConnectionStatsReportOutputFormat: (b = (R = (A = this.clientOptions) === null || A === void 0 ? void 0 : A.metrics) === null || R === void 0 ? void 0 : R.peerConnectionStatsReportOutputFormat) !== null && b !== void 0 ? b : "console"
|
|
4055
4061
|
}
|
|
4056
4062
|
}, this.publicEventEmitter, this.internalEventEmitter, this.toolCallManager, i);
|
|
4057
|
-
} catch (
|
|
4058
|
-
throw i?.publishFailure(Object.assign({ failureStage: "streaming_client_initialization" }, Oe(
|
|
4063
|
+
} catch (re) {
|
|
4064
|
+
throw i?.publishFailure(Object.assign({ failureStage: "streaming_client_initialization" }, Oe(re))), this.toolCallManager.clearSessionState(), Fe({
|
|
4059
4065
|
sessionId: null
|
|
4060
|
-
}), new
|
|
4061
|
-
cause:
|
|
4062
|
-
sessionId:
|
|
4066
|
+
}), new V("Failed to initialize streaming client", J.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4067
|
+
cause: re instanceof Error ? re.message : String(re),
|
|
4068
|
+
sessionId: U
|
|
4063
4069
|
});
|
|
4064
4070
|
}
|
|
4065
|
-
return
|
|
4071
|
+
return U;
|
|
4066
4072
|
});
|
|
4067
4073
|
}
|
|
4068
4074
|
startSessionIfNeeded(e, i) {
|
|
@@ -4070,7 +4076,7 @@ class Mr {
|
|
|
4070
4076
|
if ((!this.sessionId || !this.streamingClient) && (yield this.startSession(e, i), !this.sessionId || !this.streamingClient))
|
|
4071
4077
|
throw i?.publishFailure({
|
|
4072
4078
|
failureStage: "start_session_validation"
|
|
4073
|
-
}), new
|
|
4079
|
+
}), new V("Session ID or streaming client is not available after starting session", J.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4074
4080
|
cause: "Failed to initialize session properly"
|
|
4075
4081
|
});
|
|
4076
4082
|
});
|
|
@@ -4091,10 +4097,10 @@ class Mr {
|
|
|
4091
4097
|
var s;
|
|
4092
4098
|
const c = [];
|
|
4093
4099
|
let l = !1, m = !1;
|
|
4094
|
-
this.publicEventEmitter.addListener(
|
|
4095
|
-
c.push(
|
|
4096
|
-
}), this.publicEventEmitter.addListener(
|
|
4097
|
-
c.push(
|
|
4100
|
+
this.publicEventEmitter.addListener(O.VIDEO_STREAM_STARTED, (f) => {
|
|
4101
|
+
c.push(f), l = !0, m && a(c);
|
|
4102
|
+
}), this.publicEventEmitter.addListener(O.AUDIO_STREAM_STARTED, (f) => {
|
|
4103
|
+
c.push(f), m = !0, l && a(c);
|
|
4098
4104
|
}), (s = this.streamingClient) === null || s === void 0 || s.startConnection();
|
|
4099
4105
|
});
|
|
4100
4106
|
});
|
|
@@ -4115,7 +4121,7 @@ class Mr {
|
|
|
4115
4121
|
try {
|
|
4116
4122
|
yield this.startSessionIfNeeded(i, a);
|
|
4117
4123
|
} catch (s) {
|
|
4118
|
-
throw a.publishFailure(Object.assign({ failureStage: "start_session" }, Oe(s))), s instanceof
|
|
4124
|
+
throw a.publishFailure(Object.assign({ failureStage: "start_session" }, Oe(s))), s instanceof V ? s : new V("Failed to start session", J.CLIENT_ERROR_CODE_SERVER_ERROR, 500, {
|
|
4119
4125
|
cause: s instanceof Error ? s.message : String(s),
|
|
4120
4126
|
sessionId: this.sessionId
|
|
4121
4127
|
});
|
|
@@ -4215,7 +4221,7 @@ class Mr {
|
|
|
4215
4221
|
}
|
|
4216
4222
|
stopStreaming() {
|
|
4217
4223
|
return fe(this, void 0, void 0, function* () {
|
|
4218
|
-
this.streamingClient && (this.publicEventEmitter.emit(
|
|
4224
|
+
this.streamingClient && (this.publicEventEmitter.emit(O.CONNECTION_CLOSED, Ee.NORMAL), this.toolCallManager.clearSessionState(), yield this.streamingClient.stopConnection(), this.streamingClient = null, this.sessionId = null, Fe({
|
|
4219
4225
|
attemptCorrelationId: null,
|
|
4220
4226
|
sessionId: null,
|
|
4221
4227
|
organizationId: this.organizationId
|
|
@@ -4283,7 +4289,7 @@ class Mr {
|
|
|
4283
4289
|
return this.toolCallManager.registerHandler(e, i);
|
|
4284
4290
|
}
|
|
4285
4291
|
}
|
|
4286
|
-
const Oe = (t) => t instanceof
|
|
4292
|
+
const Oe = (t) => t instanceof V ? {
|
|
4287
4293
|
errorName: t.name,
|
|
4288
4294
|
errorCode: t.code,
|
|
4289
4295
|
httpStatusCode: t.statusCode
|
|
@@ -4360,7 +4366,7 @@ const Br = () => /* @__PURE__ */ C("svg", { width: "14", height: "14", viewBox:
|
|
|
4360
4366
|
function Vr(t) {
|
|
4361
4367
|
return $r[t.kind](t.data);
|
|
4362
4368
|
}
|
|
4363
|
-
const
|
|
4369
|
+
const ee = {
|
|
4364
4370
|
SESSION_STARTED: "anam-agent:session-started",
|
|
4365
4371
|
SESSION_ENDED: "anam-agent:session-ended",
|
|
4366
4372
|
MESSAGE_RECEIVED: "anam-agent:message-received",
|
|
@@ -4392,31 +4398,32 @@ function jr(t, e) {
|
|
|
4392
4398
|
}
|
|
4393
4399
|
function Gr() {
|
|
4394
4400
|
return {
|
|
4395
|
-
client:
|
|
4396
|
-
connectionStatus:
|
|
4397
|
-
isStreaming:
|
|
4398
|
-
isMuted:
|
|
4399
|
-
messages:
|
|
4401
|
+
client: q(null),
|
|
4402
|
+
connectionStatus: q("idle"),
|
|
4403
|
+
isStreaming: q(!1),
|
|
4404
|
+
isMuted: q(!1),
|
|
4405
|
+
messages: q([]),
|
|
4400
4406
|
messageTimes: /* @__PURE__ */ new Map(),
|
|
4401
4407
|
pendingSent: [],
|
|
4402
4408
|
messageSeq: /* @__PURE__ */ new Map(),
|
|
4403
4409
|
seqCounter: 0,
|
|
4404
4410
|
localIdCounter: 0,
|
|
4405
|
-
toolBlocks:
|
|
4411
|
+
toolBlocks: q([]),
|
|
4406
4412
|
seenToolCallIds: /* @__PURE__ */ new Set(),
|
|
4407
|
-
caption:
|
|
4413
|
+
caption: q(null),
|
|
4408
4414
|
captionTimer: null,
|
|
4409
|
-
sentCaption:
|
|
4415
|
+
sentCaption: q(null),
|
|
4410
4416
|
sentCaptionTimer: null,
|
|
4411
|
-
error:
|
|
4412
|
-
sessionId:
|
|
4413
|
-
avatarThumbnailUrl:
|
|
4414
|
-
avatarVideoUrl:
|
|
4415
|
-
personaName:
|
|
4416
|
-
serverConfig:
|
|
4417
|
-
isConfigured:
|
|
4418
|
-
isReady:
|
|
4417
|
+
error: q(null),
|
|
4418
|
+
sessionId: q(null),
|
|
4419
|
+
avatarThumbnailUrl: q(null),
|
|
4420
|
+
avatarVideoUrl: q(null),
|
|
4421
|
+
personaName: q(null),
|
|
4422
|
+
serverConfig: q(null),
|
|
4423
|
+
isConfigured: q(!1),
|
|
4424
|
+
isReady: q(!1),
|
|
4419
4425
|
generation: 0,
|
|
4426
|
+
stopAttempt: null,
|
|
4420
4427
|
prevMessageCount: 0,
|
|
4421
4428
|
dispatch: null
|
|
4422
4429
|
};
|
|
@@ -4462,128 +4469,163 @@ async function qr(t, e, i, n, a) {
|
|
|
4462
4469
|
return;
|
|
4463
4470
|
const s = ++t.generation;
|
|
4464
4471
|
Vt(t), t.connectionStatus.value = "connecting", t.error.value = null;
|
|
4465
|
-
let c;
|
|
4472
|
+
let c, l = null, m = "", f = !1, p = null, u, y;
|
|
4473
|
+
const E = new AbortController(), T = () => {
|
|
4474
|
+
clearInterval(u), clearTimeout(y), u = void 0;
|
|
4475
|
+
}, I = () => {
|
|
4476
|
+
if (!l) return !1;
|
|
4477
|
+
const b = l.getActiveSessionId();
|
|
4478
|
+
try {
|
|
4479
|
+
l.stopStreaming().catch(() => {
|
|
4480
|
+
});
|
|
4481
|
+
} catch {
|
|
4482
|
+
}
|
|
4483
|
+
if (b && !f && p !== b) {
|
|
4484
|
+
p = b;
|
|
4485
|
+
try {
|
|
4486
|
+
fetch(`${i.replace(/\/$/, "")}/api/sessions/${encodeURIComponent(b)}/release`, {
|
|
4487
|
+
method: "POST",
|
|
4488
|
+
credentials: "same-origin",
|
|
4489
|
+
keepalive: !0,
|
|
4490
|
+
headers: { Authorization: `Bearer ${m}` }
|
|
4491
|
+
}).catch(() => {
|
|
4492
|
+
});
|
|
4493
|
+
} catch {
|
|
4494
|
+
}
|
|
4495
|
+
}
|
|
4496
|
+
return !!b;
|
|
4497
|
+
}, w = () => {
|
|
4498
|
+
if (clearTimeout(R), E.abort(), I()) {
|
|
4499
|
+
T();
|
|
4500
|
+
return;
|
|
4501
|
+
}
|
|
4502
|
+
l && !u && !p && (u = setInterval(() => {
|
|
4503
|
+
l?.getActiveSessionId() && I() && T();
|
|
4504
|
+
}, 100), y = setTimeout(T, 45e3));
|
|
4505
|
+
}, A = (b, N = "SESSION_ERROR") => {
|
|
4506
|
+
s === t.generation && (t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.isStreaming.value = !1, t.sessionId.value = null, t.error.value = b, t.connectionStatus.value = "error", t.dispatch?.(ee.ERROR, { code: N, message: b }));
|
|
4507
|
+
}, R = setTimeout(() => A(
|
|
4508
|
+
"Taking too long to connect. Check your network and try again.",
|
|
4509
|
+
"STARTUP_TIMEOUT"
|
|
4510
|
+
), 45e3);
|
|
4511
|
+
t.stopAttempt = w;
|
|
4466
4512
|
try {
|
|
4467
|
-
let l;
|
|
4468
4513
|
if (a)
|
|
4469
|
-
|
|
4514
|
+
m = a;
|
|
4470
4515
|
else {
|
|
4471
4516
|
if (!hn(e))
|
|
4472
4517
|
throw new Error("Invalid agent ID format");
|
|
4473
|
-
const
|
|
4518
|
+
const S = await fetch(`${i}/v1/auth/widget`, {
|
|
4474
4519
|
method: "POST",
|
|
4475
4520
|
headers: { "Content-Type": "application/json" },
|
|
4476
|
-
body: JSON.stringify({ agentId: e })
|
|
4521
|
+
body: JSON.stringify({ agentId: e }),
|
|
4522
|
+
signal: E.signal
|
|
4477
4523
|
});
|
|
4478
4524
|
if (s !== t.generation) return;
|
|
4479
|
-
if (c =
|
|
4480
|
-
const
|
|
4481
|
-
throw new Error(
|
|
4525
|
+
if (c = S.status, !S.ok) {
|
|
4526
|
+
const U = await S.json().catch(() => ({}));
|
|
4527
|
+
throw new Error(U.error || `HTTP ${S.status}`);
|
|
4482
4528
|
}
|
|
4483
|
-
|
|
4529
|
+
m = (await S.json()).sessionToken;
|
|
4484
4530
|
}
|
|
4485
4531
|
if (s !== t.generation) return;
|
|
4486
|
-
const
|
|
4532
|
+
const b = Dr(m, {
|
|
4487
4533
|
api: i ? { baseUrl: i } : void 0,
|
|
4488
4534
|
metrics: { disableClientMetrics: !0 }
|
|
4489
4535
|
});
|
|
4490
|
-
|
|
4536
|
+
l = b, t.client.value = b, b.addListener(O.CONNECTION_ESTABLISHED, () => {
|
|
4491
4537
|
s === t.generation && (t.connectionStatus.value = "connected");
|
|
4492
|
-
}),
|
|
4493
|
-
|
|
4494
|
-
}), m.addListener(A.AUDIO_STREAM_STARTED, () => {
|
|
4495
|
-
}), m.addListener(A.MESSAGE_HISTORY_UPDATED, (f) => {
|
|
4538
|
+
}), b.addListener(O.AUDIO_STREAM_STARTED, () => {
|
|
4539
|
+
}), b.addListener(O.MESSAGE_HISTORY_UPDATED, (S) => {
|
|
4496
4540
|
if (s !== t.generation) return;
|
|
4497
|
-
for (let
|
|
4498
|
-
const
|
|
4499
|
-
t.dispatch?.(
|
|
4500
|
-
role:
|
|
4501
|
-
content:
|
|
4541
|
+
for (let z = t.prevMessageCount; z < S.length; z++) {
|
|
4542
|
+
const Y = S[z];
|
|
4543
|
+
t.dispatch?.(ee.MESSAGE_RECEIVED, {
|
|
4544
|
+
role: Y.role === "persona" ? "agent" : "user",
|
|
4545
|
+
content: Y.content
|
|
4502
4546
|
});
|
|
4503
4547
|
}
|
|
4504
|
-
t.prevMessageCount =
|
|
4505
|
-
const
|
|
4506
|
-
for (const
|
|
4507
|
-
t.messageTimes.has(
|
|
4508
|
-
t.messages.value =
|
|
4509
|
-
}),
|
|
4548
|
+
t.prevMessageCount = S.length;
|
|
4549
|
+
const k = Hr(t, S), U = (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
4550
|
+
for (const z of k)
|
|
4551
|
+
t.messageTimes.has(z.id) || t.messageTimes.set(z.id, U);
|
|
4552
|
+
t.messages.value = k;
|
|
4553
|
+
}), b.addListener(O.MESSAGE_STREAM_EVENT_RECEIVED, (S) => {
|
|
4510
4554
|
if (s !== t.generation) return;
|
|
4511
4555
|
t.captionTimer && (clearTimeout(t.captionTimer), t.captionTimer = null);
|
|
4512
|
-
const
|
|
4513
|
-
t.caption.value = { id:
|
|
4556
|
+
const k = t.caption.value, U = S.role === ve.PERSONA && k?.id === S.id ? k.content + S.content : S.content;
|
|
4557
|
+
t.caption.value = { id: S.id, role: S.role, content: U, at: Date.now() }, S.endOfSpeech && (t.captionTimer = window.setTimeout(() => {
|
|
4514
4558
|
t.caption.value = null, t.captionTimer = null;
|
|
4515
4559
|
}, 4e3));
|
|
4516
|
-
}),
|
|
4560
|
+
}), b.addListener(O.TOOL_CALL_STARTED, (S) => {
|
|
4517
4561
|
if (s !== t.generation) return;
|
|
4518
|
-
t.dispatch?.(
|
|
4519
|
-
toolName:
|
|
4520
|
-
toolCallId:
|
|
4521
|
-
toolType:
|
|
4522
|
-
toolSubtype:
|
|
4523
|
-
arguments:
|
|
4562
|
+
t.dispatch?.(ee.TOOL_CALL_STARTED, {
|
|
4563
|
+
toolName: S.toolName,
|
|
4564
|
+
toolCallId: S.toolCallId,
|
|
4565
|
+
toolType: S.toolType,
|
|
4566
|
+
toolSubtype: S.toolSubtype,
|
|
4567
|
+
arguments: S.arguments
|
|
4524
4568
|
});
|
|
4525
|
-
const
|
|
4526
|
-
|
|
4527
|
-
}),
|
|
4528
|
-
s === t.generation && t.dispatch?.(
|
|
4529
|
-
toolName:
|
|
4530
|
-
toolCallId:
|
|
4531
|
-
toolType:
|
|
4532
|
-
toolSubtype:
|
|
4533
|
-
result:
|
|
4534
|
-
executionTime:
|
|
4535
|
-
documentsAccessed:
|
|
4569
|
+
const k = Pr(S.toolName, S.toolCallId, S.arguments);
|
|
4570
|
+
k && !t.seenToolCallIds.has(S.toolCallId) && (t.seenToolCallIds.add(S.toolCallId), t.messageSeq.set(k.id, t.seqCounter++), t.messageTimes.set(k.id, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })), t.toolBlocks.value = [...t.toolBlocks.value, k]);
|
|
4571
|
+
}), b.addListener(O.TOOL_CALL_COMPLETED, (S) => {
|
|
4572
|
+
s === t.generation && t.dispatch?.(ee.TOOL_CALL_COMPLETED, {
|
|
4573
|
+
toolName: S.toolName,
|
|
4574
|
+
toolCallId: S.toolCallId,
|
|
4575
|
+
toolType: S.toolType,
|
|
4576
|
+
toolSubtype: S.toolSubtype,
|
|
4577
|
+
result: S.result,
|
|
4578
|
+
executionTime: S.executionTime,
|
|
4579
|
+
documentsAccessed: S.documentsAccessed
|
|
4536
4580
|
});
|
|
4537
|
-
}),
|
|
4538
|
-
s === t.generation && t.dispatch?.(
|
|
4539
|
-
toolName:
|
|
4540
|
-
toolCallId:
|
|
4541
|
-
toolType:
|
|
4542
|
-
toolSubtype:
|
|
4543
|
-
errorMessage:
|
|
4544
|
-
executionTime:
|
|
4581
|
+
}), b.addListener(O.TOOL_CALL_FAILED, (S) => {
|
|
4582
|
+
s === t.generation && t.dispatch?.(ee.TOOL_CALL_FAILED, {
|
|
4583
|
+
toolName: S.toolName,
|
|
4584
|
+
toolCallId: S.toolCallId,
|
|
4585
|
+
toolType: S.toolType,
|
|
4586
|
+
toolSubtype: S.toolSubtype,
|
|
4587
|
+
errorMessage: S.errorMessage,
|
|
4588
|
+
executionTime: S.executionTime
|
|
4545
4589
|
});
|
|
4546
|
-
}),
|
|
4590
|
+
}), b.addListener(O.CONNECTION_CLOSED, (S, k) => {
|
|
4547
4591
|
if (s !== t.generation) return;
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4592
|
+
if (!t.isStreaming.value) {
|
|
4593
|
+
A("The connection ended before playback. Please try again.");
|
|
4594
|
+
return;
|
|
4595
|
+
}
|
|
4596
|
+
const U = t.sessionId.value;
|
|
4597
|
+
t.generation++, t.stopAttempt = null, w(), t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.sessionId.value = null, t.dispatch?.(ee.SESSION_ENDED, {
|
|
4598
|
+
sessionId: U ?? "",
|
|
4599
|
+
reason: k ?? S
|
|
4552
4600
|
});
|
|
4553
|
-
}),
|
|
4554
|
-
s === t.generation && (t.sessionId.value =
|
|
4601
|
+
}), b.addListener(O.SESSION_READY, (S) => {
|
|
4602
|
+
s === t.generation && (f = !0, t.sessionId.value = S, t.dispatch?.(ee.SESSION_STARTED, { sessionId: S }));
|
|
4555
4603
|
});
|
|
4556
|
-
const
|
|
4604
|
+
const N = await b.stream();
|
|
4557
4605
|
if (s !== t.generation) {
|
|
4558
|
-
|
|
4559
|
-
await m.stopStreaming();
|
|
4560
|
-
} catch {
|
|
4561
|
-
}
|
|
4606
|
+
w();
|
|
4562
4607
|
return;
|
|
4563
4608
|
}
|
|
4564
|
-
if (
|
|
4565
|
-
const
|
|
4566
|
-
|
|
4609
|
+
if (n && N.length > 0) {
|
|
4610
|
+
const S = N.find((k) => k.getVideoTracks().length > 0);
|
|
4611
|
+
if (S) {
|
|
4612
|
+
if (n.srcObject = S, await n.play(), s !== t.generation) return;
|
|
4613
|
+
t.isStreaming.value = !0, clearTimeout(R);
|
|
4614
|
+
}
|
|
4567
4615
|
}
|
|
4568
|
-
} catch (
|
|
4569
|
-
if (s !== t.generation)
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
message: m
|
|
4575
|
-
});
|
|
4616
|
+
} catch (b) {
|
|
4617
|
+
if (s !== t.generation) {
|
|
4618
|
+
w();
|
|
4619
|
+
return;
|
|
4620
|
+
}
|
|
4621
|
+
A(jr(b, c), c ? `HTTP_${c}` : "SESSION_ERROR");
|
|
4576
4622
|
}
|
|
4577
4623
|
}
|
|
4578
4624
|
async function Yr(t) {
|
|
4579
4625
|
const e = t.sessionId.value, i = t.connectionStatus.value !== "idle";
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
} catch (n) {
|
|
4584
|
-
console.error("[AnamWidget] Failed to stop session:", n);
|
|
4585
|
-
}
|
|
4586
|
-
t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.sessionId.value = null, i && t.dispatch?.(X.SESSION_ENDED, {
|
|
4626
|
+
t.generation++;
|
|
4627
|
+
const n = t.stopAttempt;
|
|
4628
|
+
t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.sessionId.value = null, n?.(), i && t.dispatch?.(ee.SESSION_ENDED, {
|
|
4587
4629
|
sessionId: e ?? "",
|
|
4588
4630
|
reason: "USER_ENDED"
|
|
4589
4631
|
});
|
|
@@ -4598,13 +4640,13 @@ function Kr(t, e) {
|
|
|
4598
4640
|
};
|
|
4599
4641
|
t.messageSeq.set(i.id, t.seqCounter++), t.messageTimes.set(i.id, (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })), t.pendingSent.push(i), t.messages.value = [...t.messages.value, i], t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaption.value = { id: i.id, role: ve.USER, content: e, at: Date.now() }, t.sentCaptionTimer = window.setTimeout(() => {
|
|
4600
4642
|
t.sentCaption.value = null, t.sentCaptionTimer = null;
|
|
4601
|
-
}, 4e3), t.dispatch?.(
|
|
4643
|
+
}, 4e3), t.dispatch?.(ee.MESSAGE_SENT, { content: e });
|
|
4602
4644
|
}
|
|
4603
4645
|
function Jr(t) {
|
|
4604
|
-
t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1, t.dispatch?.(
|
|
4646
|
+
t.client.value && (t.isMuted.value ? (t.client.value.unmuteInputAudio(), t.isMuted.value = !1, t.dispatch?.(ee.MIC_UNMUTED, {})) : (t.client.value.muteInputAudio(), t.isMuted.value = !0, t.dispatch?.(ee.MIC_MUTED, {})));
|
|
4605
4647
|
}
|
|
4606
4648
|
function Xr(t) {
|
|
4607
|
-
t.generation++, t.
|
|
4649
|
+
t.generation++, t.stopAttempt?.(), t.stopAttempt = null, t.client.value = null, t.connectionStatus.value = "idle", t.isStreaming.value = !1, t.isMuted.value = !1, Vt(t), t.captionTimer && clearTimeout(t.captionTimer), t.captionTimer = null, t.caption.value = null, t.sentCaptionTimer && clearTimeout(t.sentCaptionTimer), t.sentCaptionTimer = null, t.sentCaption.value = null, t.error.value = null, t.sessionId.value = null, t.avatarThumbnailUrl.value = null, t.avatarVideoUrl.value = null, t.personaName.value = null, t.serverConfig.value = null;
|
|
4608
4650
|
}
|
|
4609
4651
|
function Zr(t, e, i, n) {
|
|
4610
4652
|
const a = qe();
|
|
@@ -4638,15 +4680,15 @@ function Zr(t, e, i, n) {
|
|
|
4638
4680
|
return;
|
|
4639
4681
|
}
|
|
4640
4682
|
if (i) {
|
|
4641
|
-
const
|
|
4642
|
-
|
|
4683
|
+
const p = Si(i).widgetConfig;
|
|
4684
|
+
p && (typeof p.personaName == "string" && p.personaName && (s.personaName.value = p.personaName), typeof p.avatarImageUrl == "string" && p.avatarImageUrl && (s.avatarThumbnailUrl.value = p.avatarImageUrl), typeof p.avatarVideoUrl == "string" && p.avatarVideoUrl && (s.avatarVideoUrl.value = p.avatarVideoUrl), p.removeWatermark === !0 && (s.serverConfig.value = { removeWatermark: !0 })), s.isReady.value = !0;
|
|
4643
4685
|
return;
|
|
4644
4686
|
}
|
|
4645
4687
|
s.isReady.value = !0;
|
|
4646
4688
|
},
|
|
4647
|
-
startSession: (
|
|
4689
|
+
startSession: (f) => !c && !i ? (s.error.value = "No agent ID or session token configured", Promise.resolve()) : qr(s, c || "", m, f, i),
|
|
4648
4690
|
stopSession: () => Yr(s),
|
|
4649
|
-
sendMessage: (
|
|
4691
|
+
sendMessage: (f) => Kr(s, f),
|
|
4650
4692
|
toggleMute: () => Jr(s),
|
|
4651
4693
|
cleanup: () => Xr(s)
|
|
4652
4694
|
};
|
|
@@ -4754,45 +4796,45 @@ function ho({
|
|
|
4754
4796
|
agentName: c,
|
|
4755
4797
|
onCollapse: l,
|
|
4756
4798
|
onStop: m,
|
|
4757
|
-
dispatch:
|
|
4799
|
+
dispatch: f
|
|
4758
4800
|
}) {
|
|
4759
|
-
const
|
|
4760
|
-
const
|
|
4761
|
-
|
|
4762
|
-
|
|
4801
|
+
const p = qe(null), [u, y] = Rt(""), E = e.connectionStatus.value === "connected", T = e.connectionStatus.value === "connecting", I = e.connectionStatus.value === "error", w = e.isStreaming.value, A = !T && !E && !I, R = E || w, b = t.orientation ?? "landscape", N = t.showTranscript && R, [S, k] = Rt(!1), U = qe(null), z = c || "Agent", Y = Ve(() => {
|
|
4802
|
+
const G = !S;
|
|
4803
|
+
k(G), f(
|
|
4804
|
+
G ? ee.TRANSCRIPT_OPENED : ee.TRANSCRIPT_CLOSED,
|
|
4763
4805
|
{}
|
|
4764
4806
|
);
|
|
4765
|
-
}, [
|
|
4807
|
+
}, [S, f]);
|
|
4766
4808
|
Ie(() => {
|
|
4767
|
-
|
|
4768
|
-
}, [
|
|
4809
|
+
R || k(!1);
|
|
4810
|
+
}, [R]);
|
|
4769
4811
|
const oe = e.toolBlocks.value.length;
|
|
4770
4812
|
Ie(() => {
|
|
4771
|
-
oe > 0 &&
|
|
4813
|
+
oe > 0 && R && N && !S && (k(!0), f(ee.TRANSCRIPT_OPENED, {}));
|
|
4772
4814
|
}, [oe]), Ie(() => {
|
|
4773
|
-
|
|
4774
|
-
}, [
|
|
4775
|
-
const
|
|
4776
|
-
if (!
|
|
4777
|
-
|
|
4778
|
-
}, [e.messages.value, e.toolBlocks.value,
|
|
4779
|
-
const
|
|
4815
|
+
S && U.current && (U.current.scrollTop = U.current.scrollHeight);
|
|
4816
|
+
}, [S]), Ie(() => {
|
|
4817
|
+
const G = U.current;
|
|
4818
|
+
if (!G || !S) return;
|
|
4819
|
+
G.scrollHeight - G.scrollTop - G.clientHeight < 160 && (G.scrollTop = G.scrollHeight);
|
|
4820
|
+
}, [e.messages.value, e.toolBlocks.value, S]);
|
|
4821
|
+
const K = N && S && b === "landscape", te = t.showCaptions ? e.caption.value : null, de = e.sentCaption.value, ue = te && de ? te.at >= de.at ? te : de : te ?? de, Se = Ve(async () => {
|
|
4780
4822
|
i.current && await e.startSession(i.current);
|
|
4781
4823
|
}, [e.startSession]), Te = Ve(() => {
|
|
4782
|
-
u.trim() && (e.sendMessage(u.trim()),
|
|
4783
|
-
}, [u]),
|
|
4784
|
-
|
|
4824
|
+
u.trim() && (e.sendMessage(u.trim()), y(""), p.current?.focus());
|
|
4825
|
+
}, [u]), re = Ve((G) => {
|
|
4826
|
+
G.key === "Enter" && !G.shiftKey && (G.preventDefault(), Te());
|
|
4785
4827
|
}, [Te]), ut = t.showTextInput ? /* @__PURE__ */ C("div", { class: "anam-ctl-input-wrap", children: [
|
|
4786
4828
|
/* @__PURE__ */ C(
|
|
4787
4829
|
"input",
|
|
4788
4830
|
{
|
|
4789
|
-
ref:
|
|
4831
|
+
ref: p,
|
|
4790
4832
|
type: "text",
|
|
4791
4833
|
class: "anam-ctl-input",
|
|
4792
4834
|
placeholder: "Type a message...",
|
|
4793
4835
|
value: u,
|
|
4794
|
-
onInput: (
|
|
4795
|
-
onKeyDown:
|
|
4836
|
+
onInput: (G) => y(G.target.value),
|
|
4837
|
+
onKeyDown: re,
|
|
4796
4838
|
disabled: !E
|
|
4797
4839
|
}
|
|
4798
4840
|
),
|
|
@@ -4817,13 +4859,13 @@ function ho({
|
|
|
4817
4859
|
}
|
|
4818
4860
|
),
|
|
4819
4861
|
ut,
|
|
4820
|
-
N &&
|
|
4862
|
+
N && b === "landscape" && /* @__PURE__ */ C(
|
|
4821
4863
|
"button",
|
|
4822
4864
|
{
|
|
4823
4865
|
class: "anam-ctl-btn anam-transcript-toggle",
|
|
4824
|
-
onClick:
|
|
4825
|
-
"aria-expanded":
|
|
4826
|
-
"aria-label":
|
|
4866
|
+
onClick: Y,
|
|
4867
|
+
"aria-expanded": S,
|
|
4868
|
+
"aria-label": S ? "Hide transcript" : "Show transcript",
|
|
4827
4869
|
children: /* @__PURE__ */ C(lo, {})
|
|
4828
4870
|
}
|
|
4829
4871
|
)
|
|
@@ -4832,23 +4874,23 @@ function ho({
|
|
|
4832
4874
|
"div",
|
|
4833
4875
|
{
|
|
4834
4876
|
class: "anam-sheet",
|
|
4835
|
-
"data-orientation":
|
|
4836
|
-
"data-transcript":
|
|
4877
|
+
"data-orientation": b,
|
|
4878
|
+
"data-transcript": S ? "open" : "closed",
|
|
4837
4879
|
children: [
|
|
4838
|
-
N &&
|
|
4880
|
+
N && b === "portrait" && /* @__PURE__ */ C("div", { class: "anam-transcript-rail", children: /* @__PURE__ */ C("div", { class: "anam-transcript-rail-inner", children: [
|
|
4839
4881
|
/* @__PURE__ */ C("div", { class: "anam-transcript-head", children: [
|
|
4840
4882
|
/* @__PURE__ */ C("span", { class: "anam-transcript-title", children: "Transcript" }),
|
|
4841
4883
|
/* @__PURE__ */ C(
|
|
4842
4884
|
"button",
|
|
4843
4885
|
{
|
|
4844
4886
|
class: "anam-transcript-collapse",
|
|
4845
|
-
onClick:
|
|
4887
|
+
onClick: Y,
|
|
4846
4888
|
"aria-label": "Hide transcript",
|
|
4847
4889
|
children: /* @__PURE__ */ C(co, {})
|
|
4848
4890
|
}
|
|
4849
4891
|
)
|
|
4850
4892
|
] }),
|
|
4851
|
-
/* @__PURE__ */ C(Ti, { session: e, agentLabel:
|
|
4893
|
+
/* @__PURE__ */ C(Ti, { session: e, agentLabel: z, rowsRef: U })
|
|
4852
4894
|
] }) }),
|
|
4853
4895
|
/* @__PURE__ */ C("div", { class: "anam-video-region", children: [
|
|
4854
4896
|
/* @__PURE__ */ C(
|
|
@@ -4858,10 +4900,10 @@ function ho({
|
|
|
4858
4900
|
class: "anam-video",
|
|
4859
4901
|
autoplay: !0,
|
|
4860
4902
|
playsinline: !0,
|
|
4861
|
-
"data-hidden":
|
|
4903
|
+
"data-hidden": w ? void 0 : "true"
|
|
4862
4904
|
}
|
|
4863
4905
|
),
|
|
4864
|
-
|
|
4906
|
+
A && (e.isConfigured.value ? (
|
|
4865
4907
|
/* Has agent-id: show avatar or placeholder + CTA pill */
|
|
4866
4908
|
/* @__PURE__ */ C("div", { class: "anam-overlay-idle", children: [
|
|
4867
4909
|
a ? /* @__PURE__ */ C(
|
|
@@ -4873,8 +4915,8 @@ function ho({
|
|
|
4873
4915
|
muted: !0,
|
|
4874
4916
|
playsinline: !0,
|
|
4875
4917
|
class: "anam-preview-video",
|
|
4876
|
-
onError: (
|
|
4877
|
-
|
|
4918
|
+
onError: (G) => {
|
|
4919
|
+
G.target.style.display = "none";
|
|
4878
4920
|
}
|
|
4879
4921
|
}
|
|
4880
4922
|
) : null,
|
|
@@ -4899,15 +4941,15 @@ function ho({
|
|
|
4899
4941
|
/* @__PURE__ */ C("span", { children: "Agent not configured" })
|
|
4900
4942
|
] })
|
|
4901
4943
|
)),
|
|
4902
|
-
|
|
4944
|
+
T && /* @__PURE__ */ C("div", { class: "anam-overlay-loading", children: [
|
|
4903
4945
|
/* @__PURE__ */ C("span", { class: "anam-spinner" }),
|
|
4904
4946
|
/* @__PURE__ */ C("span", { children: "Starting your conversation..." })
|
|
4905
4947
|
] }),
|
|
4906
|
-
|
|
4948
|
+
I && /* @__PURE__ */ C("div", { class: "anam-overlay-error", children: [
|
|
4907
4949
|
/* @__PURE__ */ C("div", { class: "anam-overlay-error-text", children: e.error.value || "Something went wrong" }),
|
|
4908
4950
|
/* @__PURE__ */ C("button", { class: "anam-retry-btn", onClick: Se, children: "Try Again" })
|
|
4909
4951
|
] }),
|
|
4910
|
-
(l || m && (E ||
|
|
4952
|
+
(l || m && (E || T || w)) && /* @__PURE__ */ C(
|
|
4911
4953
|
"button",
|
|
4912
4954
|
{
|
|
4913
4955
|
class: "anam-close-btn",
|
|
@@ -4916,7 +4958,7 @@ function ho({
|
|
|
4916
4958
|
children: /* @__PURE__ */ C(no, {})
|
|
4917
4959
|
}
|
|
4918
4960
|
),
|
|
4919
|
-
|
|
4961
|
+
R && /* @__PURE__ */ C(Ce, { children: [
|
|
4920
4962
|
/* @__PURE__ */ C("div", { class: "anam-scrim" }),
|
|
4921
4963
|
ue && /* @__PURE__ */ C(
|
|
4922
4964
|
"div",
|
|
@@ -4925,12 +4967,12 @@ function ho({
|
|
|
4925
4967
|
children: ue.content
|
|
4926
4968
|
}
|
|
4927
4969
|
),
|
|
4928
|
-
!
|
|
4929
|
-
N &&
|
|
4970
|
+
!K && Je,
|
|
4971
|
+
N && b === "portrait" && !S && /* @__PURE__ */ C(
|
|
4930
4972
|
"button",
|
|
4931
4973
|
{
|
|
4932
4974
|
class: "anam-transcript-tab",
|
|
4933
|
-
onClick:
|
|
4975
|
+
onClick: Y,
|
|
4934
4976
|
"aria-label": "Show transcript",
|
|
4935
4977
|
children: /* @__PURE__ */ C(uo, {})
|
|
4936
4978
|
}
|
|
@@ -4952,9 +4994,9 @@ function ho({
|
|
|
4952
4994
|
}
|
|
4953
4995
|
)
|
|
4954
4996
|
] }),
|
|
4955
|
-
N &&
|
|
4956
|
-
/* @__PURE__ */ C(Ti, { session: e, agentLabel:
|
|
4957
|
-
|
|
4997
|
+
N && b === "landscape" && /* @__PURE__ */ C("div", { class: "anam-transcript-pane", children: [
|
|
4998
|
+
/* @__PURE__ */ C(Ti, { session: e, agentLabel: z, rowsRef: U }),
|
|
4999
|
+
K && /* @__PURE__ */ C("div", { class: "anam-transcript-footer", children: Je })
|
|
4958
5000
|
] })
|
|
4959
5001
|
]
|
|
4960
5002
|
}
|
|
@@ -4967,9 +5009,9 @@ function fo(t) {
|
|
|
4967
5009
|
] });
|
|
4968
5010
|
}
|
|
4969
5011
|
function po(t) {
|
|
4970
|
-
const e = qe(null), i = qe(null), n = Ve((
|
|
4971
|
-
const
|
|
4972
|
-
|
|
5012
|
+
const e = qe(null), i = qe(null), n = Ve((b, N) => {
|
|
5013
|
+
const S = i.current?.getRootNode();
|
|
5014
|
+
S && S instanceof ShadowRoot && Qr(S.host, b, N);
|
|
4973
5015
|
}, []);
|
|
4974
5016
|
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.");
|
|
4975
5017
|
const a = t["session-token"] ? void 0 : t["agent-id"], s = Zr(a, t["api-base-url"], t["session-token"], n);
|
|
@@ -4980,8 +5022,8 @@ function po(t) {
|
|
|
4980
5022
|
() => io(t),
|
|
4981
5023
|
[t.layout, t["initial-state"], t.position, t["ui-mute-button"], t["ui-text-input"], t["ui-captions"], t["ui-transcript"], t["call-to-action"]]
|
|
4982
5024
|
), l = ke(() => {
|
|
4983
|
-
const
|
|
4984
|
-
return kt(kt({ ...di },
|
|
5025
|
+
const b = s.serverConfig.value;
|
|
5026
|
+
return kt(kt({ ...di }, b ?? {}), c);
|
|
4985
5027
|
}, [s.serverConfig.value, c]), m = Qi(
|
|
4986
5028
|
l.layout === "floating" ? l.initialState : "expanded"
|
|
4987
5029
|
);
|
|
@@ -4990,15 +5032,15 @@ function po(t) {
|
|
|
4990
5032
|
}, [l.layout, l.initialState]), Ie(() => {
|
|
4991
5033
|
s.fetchWidgetConfig();
|
|
4992
5034
|
}, [a, t["api-base-url"], t["session-token"]]);
|
|
4993
|
-
const
|
|
5035
|
+
const f = t["avatar-url"] || s.avatarThumbnailUrl.value || null, p = t["avatar-video-url"] || s.avatarVideoUrl.value || null, y = t["agent-name"] || s.personaName.value, E = l.callToAction === di.callToAction && y ? `Talk to ${y}` : l.callToAction, T = ke(() => {
|
|
4994
5036
|
if (l.layout === "inline") return "";
|
|
4995
|
-
const
|
|
4996
|
-
return Object.entries(
|
|
4997
|
-
}, [l.layout, l.position]),
|
|
4998
|
-
m.value = "expanded", n(
|
|
4999
|
-
},
|
|
5000
|
-
s.connectionStatus.value !== "idle" && await s.stopSession(), m.value = "minimized", n(
|
|
5001
|
-
},
|
|
5037
|
+
const b = Gn(l.position);
|
|
5038
|
+
return Object.entries(b).map(([N, S]) => `${N}: ${S}`).join("; ");
|
|
5039
|
+
}, [l.layout, l.position]), I = l.layout === "floating", w = () => {
|
|
5040
|
+
m.value = "expanded", n(ee.EXPANDED, {});
|
|
5041
|
+
}, A = async () => {
|
|
5042
|
+
s.connectionStatus.value !== "idle" && await s.stopSession(), m.value = "minimized", n(ee.COLLAPSED, {});
|
|
5043
|
+
}, R = I ? m.value === "expanded" : !0;
|
|
5002
5044
|
return s.isReady.value ? /* @__PURE__ */ C(
|
|
5003
5045
|
"div",
|
|
5004
5046
|
{
|
|
@@ -5006,29 +5048,29 @@ function po(t) {
|
|
|
5006
5048
|
class: "anam-widget",
|
|
5007
5049
|
"data-layout": l.layout,
|
|
5008
5050
|
"data-state": m.value,
|
|
5009
|
-
style:
|
|
5051
|
+
style: T,
|
|
5010
5052
|
children: [
|
|
5011
|
-
|
|
5053
|
+
I && m.value === "minimized" && /* @__PURE__ */ C(
|
|
5012
5054
|
"button",
|
|
5013
5055
|
{
|
|
5014
5056
|
class: "anam-trigger",
|
|
5015
|
-
onClick:
|
|
5057
|
+
onClick: w,
|
|
5016
5058
|
"aria-label": E,
|
|
5017
|
-
children:
|
|
5059
|
+
children: f ? /* @__PURE__ */ C("img", { src: f, alt: "Avatar" }) : /* @__PURE__ */ C(Lt, {})
|
|
5018
5060
|
}
|
|
5019
5061
|
),
|
|
5020
|
-
|
|
5062
|
+
R && /* @__PURE__ */ C(
|
|
5021
5063
|
ho,
|
|
5022
5064
|
{
|
|
5023
5065
|
config: l,
|
|
5024
5066
|
session: s,
|
|
5025
5067
|
videoRef: e,
|
|
5026
|
-
avatarSrc:
|
|
5027
|
-
avatarVideoSrc:
|
|
5068
|
+
avatarSrc: f,
|
|
5069
|
+
avatarVideoSrc: p,
|
|
5028
5070
|
displayCta: E,
|
|
5029
|
-
agentName:
|
|
5030
|
-
onCollapse:
|
|
5031
|
-
onStop:
|
|
5071
|
+
agentName: y || null,
|
|
5072
|
+
onCollapse: I ? A : null,
|
|
5073
|
+
onStop: I ? null : () => s.stopSession(),
|
|
5032
5074
|
dispatch: n
|
|
5033
5075
|
}
|
|
5034
5076
|
)
|
|
@@ -5074,6 +5116,6 @@ function yi(t = "anam-agent") {
|
|
|
5074
5116
|
typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", () => yi()) : yi());
|
|
5075
5117
|
export {
|
|
5076
5118
|
di as DefaultConfig,
|
|
5077
|
-
|
|
5119
|
+
ee as WidgetEventNames,
|
|
5078
5120
|
yi as registerWidget
|
|
5079
5121
|
};
|