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