@ariaflowagents/widget 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/widget.js +329 -332
- package/dist/widget.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var
|
|
2
|
-
function
|
|
1
|
+
var B, m, Ie, F, be, De, Re, oe, K, L, Le, de, _e, ce, X = {}, Y = [], ht = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ne = Array.isArray;
|
|
2
|
+
function U(t, e) {
|
|
3
3
|
for (var n in e) t[n] = e[n];
|
|
4
4
|
return t;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function ge(t) {
|
|
7
7
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
var
|
|
11
|
-
for (
|
|
12
|
-
if (arguments.length > 2 && (a.children = arguments.length > 3 ?
|
|
13
|
-
return O(t, a,
|
|
9
|
+
function D(t, e, n) {
|
|
10
|
+
var i, o, s, a = {};
|
|
11
|
+
for (s in e) s == "key" ? i = e[s] : s == "ref" ? o = e[s] : a[s] = e[s];
|
|
12
|
+
if (arguments.length > 2 && (a.children = arguments.length > 3 ? B.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (s in t.defaultProps) a[s] === void 0 && (a[s] = t.defaultProps[s]);
|
|
13
|
+
return O(t, a, i, o, null);
|
|
14
14
|
}
|
|
15
|
-
function O(t, e, n,
|
|
16
|
-
var
|
|
17
|
-
return o == null && m.vnode != null && m.vnode(
|
|
15
|
+
function O(t, e, n, i, o) {
|
|
16
|
+
var s = { type: t, props: e, key: n, ref: i, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++Ie, __i: -1, __u: 0 };
|
|
17
|
+
return o == null && m.vnode != null && m.vnode(s), s;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function H(t) {
|
|
20
20
|
return t.children;
|
|
21
21
|
}
|
|
22
22
|
function J(t, e) {
|
|
@@ -27,65 +27,69 @@ function R(t, e) {
|
|
|
27
27
|
for (var n; e < t.__k.length; e++) if ((n = t.__k[e]) != null && n.__e != null) return n.__e;
|
|
28
28
|
return typeof t.type == "function" ? R(t) : null;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
t.__e = t.__c.base = n.__e;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
return Le(t);
|
|
30
|
+
function dt(t) {
|
|
31
|
+
if (t.__P && t.__d) {
|
|
32
|
+
var e = t.__v, n = e.__e, i = [], o = [], s = U({}, e);
|
|
33
|
+
s.__v = e.__v + 1, m.vnode && m.vnode(s), fe(t.__P, s, e, t.__n, t.__P.namespaceURI, 32 & e.__u ? [n] : null, i, n ?? R(e), !!(32 & e.__u), o), s.__v = e.__v, s.__.__k[s.__i] = s, Qe(i, s, o), e.__e = e.__ = null, s.__e != n && Oe(s);
|
|
38
34
|
}
|
|
39
35
|
}
|
|
40
|
-
function
|
|
41
|
-
(
|
|
36
|
+
function Oe(t) {
|
|
37
|
+
if ((t = t.__) != null && t.__c != null) return t.__e = t.__c.base = null, t.__k.some(function(e) {
|
|
38
|
+
if (e != null && e.__e != null) return t.__e = t.__c.base = e.__e;
|
|
39
|
+
}), Oe(t);
|
|
42
40
|
}
|
|
43
|
-
function
|
|
44
|
-
|
|
45
|
-
X.__r = 0;
|
|
41
|
+
function Ce(t) {
|
|
42
|
+
(!t.__d && (t.__d = !0) && F.push(t) && !Z.__r++ || be != m.debounceRendering) && ((be = m.debounceRendering) || De)(Z);
|
|
46
43
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
function Z() {
|
|
45
|
+
try {
|
|
46
|
+
for (var t, e = 1; F.length; ) F.length > e && F.sort(Re), t = F.shift(), e = F.length, dt(t);
|
|
47
|
+
} finally {
|
|
48
|
+
F.length = Z.__r = 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function qe(t, e, n, i, o, s, a, _, c, l, u) {
|
|
52
|
+
var r, g, h, v, k, w, p, f = i && i.__k || Y, x = e.length;
|
|
53
|
+
for (c = gt(n, e, f, c, x), r = 0; r < x; r++) (h = n.__k[r]) != null && (g = h.__i != -1 && f[h.__i] || X, h.__i = r, w = fe(t, h, g, o, s, a, _, c, l, u), v = h.__e, h.ref && g.ref != h.ref && (g.ref && pe(g.ref, null, h), u.push(h.ref, h.__c || v, h)), k == null && v != null && (k = v), (p = !!(4 & h.__u)) || g.__k === h.__k ? (c = Be(h, c, t, p), p && g.__e && (g.__e = null)) : typeof h.type == "function" && w !== void 0 ? c = w : v && (c = v.nextSibling), h.__u &= -7);
|
|
50
54
|
return n.__e = k, c;
|
|
51
55
|
}
|
|
52
|
-
function
|
|
53
|
-
var
|
|
54
|
-
for (t.__k = new Array(o),
|
|
55
|
-
if (r) for (
|
|
56
|
-
return
|
|
56
|
+
function gt(t, e, n, i, o) {
|
|
57
|
+
var s, a, _, c, l, u = n.length, r = u, g = 0;
|
|
58
|
+
for (t.__k = new Array(o), s = 0; s < o; s++) (a = e[s]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[s] = O(null, a, null, null, null) : ne(a) ? a = t.__k[s] = O(H, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[s] = O(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[s] = a, c = s + g, a.__ = t, a.__b = t.__b + 1, _ = null, (l = a.__i = ft(a, n, c, r)) != -1 && (r--, (_ = n[l]) && (_.__u |= 2)), _ == null || _.__v == null ? (l == -1 && (o > u ? g-- : o < u && g++), typeof a.type != "function" && (a.__u |= 4)) : l != c && (l == c - 1 ? g-- : l == c + 1 ? g++ : (l > c ? g-- : g++, a.__u |= 4))) : t.__k[s] = null;
|
|
59
|
+
if (r) for (s = 0; s < u; s++) (_ = n[s]) != null && !(2 & _.__u) && (_.__e == i && (i = R(_)), je(_, _));
|
|
60
|
+
return i;
|
|
57
61
|
}
|
|
58
|
-
function
|
|
59
|
-
var o,
|
|
62
|
+
function Be(t, e, n, i) {
|
|
63
|
+
var o, s;
|
|
60
64
|
if (typeof t.type == "function") {
|
|
61
|
-
for (o = t.__k,
|
|
65
|
+
for (o = t.__k, s = 0; o && s < o.length; s++) o[s] && (o[s].__ = t, e = Be(o[s], e, n, i));
|
|
62
66
|
return e;
|
|
63
67
|
}
|
|
64
|
-
t.__e != e && (
|
|
68
|
+
t.__e != e && (i && (e && t.type && !e.parentNode && (e = R(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
|
|
65
69
|
do
|
|
66
70
|
e = e && e.nextSibling;
|
|
67
71
|
while (e != null && e.nodeType == 8);
|
|
68
72
|
return e;
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
var o,
|
|
74
|
+
function ft(t, e, n, i) {
|
|
75
|
+
var o, s, a, _ = t.key, c = t.type, l = e[n], u = l != null && (2 & l.__u) == 0;
|
|
72
76
|
if (l === null && _ == null || u && _ == l.key && c == l.type) return n;
|
|
73
|
-
if (
|
|
74
|
-
for (o = n - 1,
|
|
77
|
+
if (i > (u ? 1 : 0)) {
|
|
78
|
+
for (o = n - 1, s = n + 1; o >= 0 || s < e.length; ) if ((l = e[a = o >= 0 ? o-- : s++]) != null && !(2 & l.__u) && _ == l.key && c == l.type) return a;
|
|
75
79
|
}
|
|
76
80
|
return -1;
|
|
77
81
|
}
|
|
78
|
-
function
|
|
79
|
-
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" ||
|
|
82
|
+
function ke(t, e, n) {
|
|
83
|
+
e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || ht.test(e) ? n : n + "px";
|
|
80
84
|
}
|
|
81
|
-
function
|
|
82
|
-
var
|
|
85
|
+
function V(t, e, n, i, o) {
|
|
86
|
+
var s, a;
|
|
83
87
|
e: if (e == "style") if (typeof n == "string") t.style.cssText = n;
|
|
84
88
|
else {
|
|
85
|
-
if (typeof
|
|
86
|
-
if (n) for (e in n)
|
|
89
|
+
if (typeof i == "string" && (t.style.cssText = i = ""), i) for (e in i) n && e in n || ke(t.style, e, "");
|
|
90
|
+
if (n) for (e in n) i && n[e] == i[e] || ke(t.style, e, n[e]);
|
|
87
91
|
}
|
|
88
|
-
else if (e[0] == "o" && e[1] == "n")
|
|
92
|
+
else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(Le, "$1")), a = e.toLowerCase(), e = a in t || e == "onFocusOut" || e == "onFocusIn" ? a.slice(2) : e.slice(2), t.l || (t.l = {}), t.l[e + s] = n, n ? i ? n[L] = i[L] : (n[L] = de, t.addEventListener(e, s ? ce : _e, s)) : t.removeEventListener(e, s ? ce : _e, s);
|
|
89
93
|
else {
|
|
90
94
|
if (o == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
91
95
|
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 {
|
|
@@ -96,375 +100,368 @@ function K(t, e, n, s, o) {
|
|
|
96
100
|
typeof n == "function" || (n == null || n === !1 && e[4] != "-" ? t.removeAttribute(e) : t.setAttribute(e, e == "popover" && n == 1 ? "" : n));
|
|
97
101
|
}
|
|
98
102
|
}
|
|
99
|
-
function
|
|
103
|
+
function Se(t) {
|
|
100
104
|
return function(e) {
|
|
101
105
|
if (this.l) {
|
|
102
106
|
var n = this.l[e.type + t];
|
|
103
|
-
if (e
|
|
104
|
-
else if (e
|
|
107
|
+
if (e[K] == null) e[K] = de++;
|
|
108
|
+
else if (e[K] < n[L]) return;
|
|
105
109
|
return n(m.event ? m.event(e) : e);
|
|
106
110
|
}
|
|
107
111
|
};
|
|
108
112
|
}
|
|
109
|
-
function
|
|
110
|
-
var u, r, g, h, v, k, w, p, f,
|
|
113
|
+
function fe(t, e, n, i, o, s, a, _, c, l) {
|
|
114
|
+
var u, r, g, h, v, k, w, p, f, x, S, E, P, I, A, $ = e.type;
|
|
111
115
|
if (e.constructor !== void 0) return null;
|
|
112
|
-
128 & n.__u && (c = !!(32 & n.__u),
|
|
113
|
-
e: if (typeof
|
|
114
|
-
if (p = e.props, f =
|
|
116
|
+
128 & n.__u && (c = !!(32 & n.__u), s = [_ = e.__e = n.__e]), (u = m.__b) && u(e);
|
|
117
|
+
e: if (typeof $ == "function") try {
|
|
118
|
+
if (p = e.props, f = $.prototype && $.prototype.render, x = (u = $.contextType) && i[u.__c], S = u ? x ? x.props.value : u.__ : i, n.__c ? w = (r = e.__c = n.__c).__ = r.__E : (f ? e.__c = r = new $(p, S) : (e.__c = r = new J(p, S), r.constructor = $, r.render = mt), x && x.sub(r), r.state || (r.state = {}), r.__n = i, g = r.__d = !0, r.__h = [], r._sb = []), f && r.__s == null && (r.__s = r.state), f && $.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = U({}, r.__s)), U(r.__s, $.getDerivedStateFromProps(p, r.__s))), h = r.props, v = r.state, r.__v = e, g) f && $.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), f && r.componentDidMount != null && r.__h.push(r.componentDidMount);
|
|
115
119
|
else {
|
|
116
|
-
if (f &&
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
r._sb = [], r.__h.length && a.push(r);
|
|
120
|
+
if (f && $.getDerivedStateFromProps == null && p !== h && r.componentWillReceiveProps != null && r.componentWillReceiveProps(p, S), e.__v == n.__v || !r.__e && r.shouldComponentUpdate != null && r.shouldComponentUpdate(p, r.__s, S) === !1) {
|
|
121
|
+
e.__v != n.__v && (r.props = p, r.state = r.__s, r.__d = !1), e.__e = n.__e, e.__k = n.__k, e.__k.some(function(W) {
|
|
122
|
+
W && (W.__ = e);
|
|
123
|
+
}), Y.push.apply(r.__h, r._sb), r._sb = [], r.__h.length && a.push(r);
|
|
121
124
|
break e;
|
|
122
125
|
}
|
|
123
|
-
r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s,
|
|
126
|
+
r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s, S), f && r.componentDidUpdate != null && r.__h.push(function() {
|
|
124
127
|
r.componentDidUpdate(h, v, k);
|
|
125
128
|
});
|
|
126
129
|
}
|
|
127
|
-
if (r.context =
|
|
128
|
-
|
|
129
|
-
r.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
} catch (P) {
|
|
135
|
-
if (e.__v = null, c || i != null) if (P.then) {
|
|
130
|
+
if (r.context = S, r.props = p, r.__P = t, r.__e = !1, E = m.__r, P = 0, f) r.state = r.__s, r.__d = !1, E && E(e), u = r.render(r.props, r.state, r.context), Y.push.apply(r.__h, r._sb), r._sb = [];
|
|
131
|
+
else do
|
|
132
|
+
r.__d = !1, E && E(e), u = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
133
|
+
while (r.__d && ++P < 25);
|
|
134
|
+
r.state = r.__s, r.getChildContext != null && (i = U(U({}, i), r.getChildContext())), f && !g && r.getSnapshotBeforeUpdate != null && (k = r.getSnapshotBeforeUpdate(h, v)), I = u != null && u.type === H && u.key == null ? ze(u.props.children) : u, _ = qe(t, ne(I) ? I : [I], e, n, i, o, s, a, _, c, l), r.base = e.__e, e.__u &= -161, r.__h.length && a.push(r), w && (r.__E = r.__ = null);
|
|
135
|
+
} catch (W) {
|
|
136
|
+
if (e.__v = null, c || s != null) if (W.then) {
|
|
136
137
|
for (e.__u |= c ? 160 : 128; _ && _.nodeType == 8 && _.nextSibling; ) _ = _.nextSibling;
|
|
137
|
-
|
|
138
|
+
s[s.indexOf(_)] = null, e.__e = _;
|
|
138
139
|
} else {
|
|
139
|
-
for (
|
|
140
|
-
|
|
140
|
+
for (A = s.length; A--; ) ge(s[A]);
|
|
141
|
+
ue(e);
|
|
141
142
|
}
|
|
142
|
-
else e.__e = n.__e, e.__k = n.__k,
|
|
143
|
-
m.__e(
|
|
143
|
+
else e.__e = n.__e, e.__k = n.__k, W.then || ue(e);
|
|
144
|
+
m.__e(W, e, n);
|
|
144
145
|
}
|
|
145
|
-
else
|
|
146
|
+
else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : _ = e.__e = pt(n.__e, e, n, i, o, s, a, c, l);
|
|
146
147
|
return (u = m.diffed) && u(e), 128 & e.__u ? void 0 : _;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
t && t.__c && (t.__c.__e = !0), t
|
|
149
|
+
function ue(t) {
|
|
150
|
+
t && (t.__c && (t.__c.__e = !0), t.__k && t.__k.some(ue));
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
-
for (var
|
|
152
|
+
function Qe(t, e, n) {
|
|
153
|
+
for (var i = 0; i < n.length; i++) pe(n[i], n[++i], n[++i]);
|
|
153
154
|
m.__c && m.__c(e, t), t.some(function(o) {
|
|
154
155
|
try {
|
|
155
|
-
t = o.__h, o.__h = [], t.some(function(
|
|
156
|
-
|
|
156
|
+
t = o.__h, o.__h = [], t.some(function(s) {
|
|
157
|
+
s.call(o);
|
|
157
158
|
});
|
|
158
|
-
} catch (
|
|
159
|
-
m.__e(
|
|
159
|
+
} catch (s) {
|
|
160
|
+
m.__e(s, o.__v);
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
}
|
|
163
|
-
function
|
|
164
|
-
return typeof t != "object" || t == null || t.__b
|
|
164
|
+
function ze(t) {
|
|
165
|
+
return typeof t != "object" || t == null || t.__b > 0 ? t : ne(t) ? t.map(ze) : U({}, t);
|
|
165
166
|
}
|
|
166
|
-
function
|
|
167
|
-
var l, u, r, g, h, v, k, w = n.props ||
|
|
168
|
-
if (f == "svg" ? o = "http://www.w3.org/2000/svg" : f == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"),
|
|
169
|
-
for (l = 0; l <
|
|
170
|
-
t = h,
|
|
167
|
+
function pt(t, e, n, i, o, s, a, _, c) {
|
|
168
|
+
var l, u, r, g, h, v, k, w = n.props || X, p = e.props, f = e.type;
|
|
169
|
+
if (f == "svg" ? o = "http://www.w3.org/2000/svg" : f == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), s != null) {
|
|
170
|
+
for (l = 0; l < s.length; l++) if ((h = s[l]) && "setAttribute" in h == !!f && (f ? h.localName == f : h.nodeType == 3)) {
|
|
171
|
+
t = h, s[l] = null;
|
|
171
172
|
break;
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
if (t == null) {
|
|
175
176
|
if (f == null) return document.createTextNode(p);
|
|
176
|
-
t = document.createElementNS(o, f, p.is && p), _ && (m.__m && m.__m(e,
|
|
177
|
+
t = document.createElementNS(o, f, p.is && p), _ && (m.__m && m.__m(e, s), _ = !1), s = null;
|
|
177
178
|
}
|
|
178
179
|
if (f == null) w === p || _ && t.data == p || (t.data = p);
|
|
179
180
|
else {
|
|
180
|
-
if (
|
|
181
|
-
for (l in w)
|
|
182
|
-
|
|
183
|
-
else if (!(l in p)) {
|
|
184
|
-
if (l == "value" && "defaultValue" in p || l == "checked" && "defaultChecked" in p) continue;
|
|
185
|
-
K(t, l, null, h, o);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
for (l in p) h = p[l], l == "children" ? g = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? v = h : l == "checked" ? k = h : _ && typeof h != "function" || w[l] === h || K(t, l, h, w[l], o);
|
|
181
|
+
if (s = s && B.call(t.childNodes), !_ && s != null) for (w = {}, l = 0; l < t.attributes.length; l++) w[(h = t.attributes[l]).name] = h.value;
|
|
182
|
+
for (l in w) h = w[l], l == "dangerouslySetInnerHTML" ? r = h : l == "children" || l in p || l == "value" && "defaultValue" in p || l == "checked" && "defaultChecked" in p || V(t, l, null, h, o);
|
|
183
|
+
for (l in p) h = p[l], l == "children" ? g = h : l == "dangerouslySetInnerHTML" ? u = h : l == "value" ? v = h : l == "checked" ? k = h : _ && typeof h != "function" || w[l] === h || V(t, l, h, w[l], o);
|
|
189
184
|
if (u) _ || r && (u.__html == r.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
|
|
190
|
-
else if (r && (t.innerHTML = ""),
|
|
191
|
-
_ || (l = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[l] || f == "progress" && !v || f == "option" && v != w[l]) &&
|
|
185
|
+
else if (r && (t.innerHTML = ""), qe(e.type == "template" ? t.content : t, ne(g) ? g : [g], e, n, i, f == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, a, s ? s[0] : n.__k && R(n, 0), _, c), s != null) for (l = s.length; l--; ) ge(s[l]);
|
|
186
|
+
_ || (l = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[l] || f == "progress" && !v || f == "option" && v != w[l]) && V(t, l, v, w[l], o), l = "checked", k != null && k != t[l] && V(t, l, k, w[l], o));
|
|
192
187
|
}
|
|
193
188
|
return t;
|
|
194
189
|
}
|
|
195
|
-
function
|
|
190
|
+
function pe(t, e, n) {
|
|
196
191
|
try {
|
|
197
192
|
if (typeof t == "function") {
|
|
198
|
-
var
|
|
199
|
-
|
|
193
|
+
var i = typeof t.__u == "function";
|
|
194
|
+
i && t.__u(), i && e == null || (t.__u = t(e));
|
|
200
195
|
} else t.current = e;
|
|
201
196
|
} catch (o) {
|
|
202
197
|
m.__e(o, n);
|
|
203
198
|
}
|
|
204
199
|
}
|
|
205
|
-
function
|
|
206
|
-
var
|
|
207
|
-
if (m.unmount && m.unmount(t), (
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
} catch (
|
|
211
|
-
m.__e(
|
|
200
|
+
function je(t, e, n) {
|
|
201
|
+
var i, o;
|
|
202
|
+
if (m.unmount && m.unmount(t), (i = t.ref) && (i.current && i.current != t.__e || pe(i, null, e)), (i = t.__c) != null) {
|
|
203
|
+
if (i.componentWillUnmount) try {
|
|
204
|
+
i.componentWillUnmount();
|
|
205
|
+
} catch (s) {
|
|
206
|
+
m.__e(s, e);
|
|
212
207
|
}
|
|
213
|
-
|
|
208
|
+
i.base = i.__P = null;
|
|
214
209
|
}
|
|
215
|
-
if (
|
|
216
|
-
n ||
|
|
210
|
+
if (i = t.__k) for (o = 0; o < i.length; o++) i[o] && je(i[o], e, n || typeof t.type != "function");
|
|
211
|
+
n || ge(t.__e), t.__c = t.__ = t.__e = void 0;
|
|
217
212
|
}
|
|
218
|
-
function
|
|
213
|
+
function mt(t, e, n) {
|
|
219
214
|
return this.constructor(t, n);
|
|
220
215
|
}
|
|
221
|
-
function
|
|
222
|
-
var
|
|
223
|
-
e == document && (e = document.documentElement), m.__ && m.__(t, e), o = (
|
|
216
|
+
function se(t, e, n) {
|
|
217
|
+
var i, o, s, a;
|
|
218
|
+
e == document && (e = document.documentElement), m.__ && m.__(t, e), o = (i = typeof n == "function") ? null : n && n.__k || e.__k, s = [], a = [], fe(e, t = (!i && n || e).__k = D(H, null, [t]), o || X, X, e.namespaceURI, !i && n ? [n] : o ? null : e.firstChild ? B.call(e.childNodes) : null, s, !i && n ? n : o ? o.__e : e.firstChild, i, a), Qe(s, t, a);
|
|
224
219
|
}
|
|
225
|
-
function
|
|
226
|
-
|
|
220
|
+
function Ve(t, e) {
|
|
221
|
+
se(t, e, Ve);
|
|
227
222
|
}
|
|
228
|
-
function
|
|
229
|
-
var
|
|
230
|
-
for (
|
|
231
|
-
return arguments.length > 2 && (_.children = arguments.length > 3 ?
|
|
223
|
+
function Ke(t, e, n) {
|
|
224
|
+
var i, o, s, a, _ = U({}, t.props);
|
|
225
|
+
for (s in t.type && t.type.defaultProps && (a = t.type.defaultProps), e) s == "key" ? i = e[s] : s == "ref" ? o = e[s] : _[s] = e[s] === void 0 && a != null ? a[s] : e[s];
|
|
226
|
+
return arguments.length > 2 && (_.children = arguments.length > 3 ? B.call(arguments, 2) : n), O(t.type, _, i || t.key, o || t.ref, null);
|
|
232
227
|
}
|
|
233
|
-
|
|
234
|
-
for (var o,
|
|
235
|
-
if ((
|
|
228
|
+
B = Y.slice, m = { __e: function(t, e, n, i) {
|
|
229
|
+
for (var o, s, a; e = e.__; ) if ((o = e.__c) && !o.__) try {
|
|
230
|
+
if ((s = o.constructor) && s.getDerivedStateFromError != null && (o.setState(s.getDerivedStateFromError(t)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(t, i || {}), a = o.__d), a) return o.__E = o;
|
|
236
231
|
} catch (_) {
|
|
237
232
|
t = _;
|
|
238
233
|
}
|
|
239
234
|
throw t;
|
|
240
|
-
} },
|
|
235
|
+
} }, Ie = 0, J.prototype.setState = function(t, e) {
|
|
241
236
|
var n;
|
|
242
|
-
n = this.__s != null && this.__s != this.state ? this.__s : this.__s =
|
|
237
|
+
n = this.__s != null && this.__s != this.state ? this.__s : this.__s = U({}, this.state), typeof t == "function" && (t = t(U({}, n), this.props)), t && U(n, t), t != null && this.__v && (e && this._sb.push(e), Ce(this));
|
|
243
238
|
}, J.prototype.forceUpdate = function(t) {
|
|
244
|
-
this.__v && (this.__e = !0, t && this.__h.push(t),
|
|
245
|
-
}, J.prototype.render =
|
|
239
|
+
this.__v && (this.__e = !0, t && this.__h.push(t), Ce(this));
|
|
240
|
+
}, J.prototype.render = H, F = [], De = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Re = function(t, e) {
|
|
246
241
|
return t.__v.__b - e.__v.__b;
|
|
247
|
-
},
|
|
248
|
-
function
|
|
249
|
-
return
|
|
242
|
+
}, Z.__r = 0, oe = Math.random().toString(8), K = "__d" + oe, L = "__a" + oe, Le = /(PointerCapture)$|Capture$/i, de = 0, _e = Se(!1), ce = Se(!0);
|
|
243
|
+
function ee() {
|
|
244
|
+
return ee = Object.assign ? Object.assign.bind() : function(t) {
|
|
250
245
|
for (var e = 1; e < arguments.length; e++) {
|
|
251
246
|
var n = arguments[e];
|
|
252
|
-
for (var
|
|
247
|
+
for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (t[i] = n[i]);
|
|
253
248
|
}
|
|
254
249
|
return t;
|
|
255
|
-
},
|
|
250
|
+
}, ee.apply(this, arguments);
|
|
256
251
|
}
|
|
257
|
-
function
|
|
252
|
+
function Je(t, e) {
|
|
258
253
|
if (t == null) return {};
|
|
259
|
-
var n,
|
|
260
|
-
for (
|
|
254
|
+
var n, i, o = {}, s = Object.keys(t);
|
|
255
|
+
for (i = 0; i < s.length; i++) e.indexOf(n = s[i]) >= 0 || (o[n] = t[n]);
|
|
261
256
|
return o;
|
|
262
257
|
}
|
|
263
|
-
var
|
|
264
|
-
function
|
|
258
|
+
var yt = ["context", "children"], vt = ["useFragment"];
|
|
259
|
+
function wt(t, e, n, i) {
|
|
265
260
|
function o() {
|
|
266
|
-
var
|
|
267
|
-
return a._vdomComponent = t,
|
|
261
|
+
var s, a = Reflect.construct(HTMLElement, [], o);
|
|
262
|
+
return a._vdomComponent = t, i && i.shadow ? (a._root = a.attachShadow({ mode: i.mode || "open", serializable: (s = i.serializable) != null && s }), i.adoptedStyleSheets && (a._root.adoptedStyleSheets = i.adoptedStyleSheets)) : a._root = a, a;
|
|
268
263
|
}
|
|
269
264
|
return (o.prototype = Object.create(HTMLElement.prototype)).constructor = o, o.prototype.connectedCallback = function() {
|
|
270
|
-
|
|
271
|
-
}, o.prototype.attributeChangedCallback =
|
|
272
|
-
Object.defineProperty(o.prototype,
|
|
273
|
-
return this._vdom ? this._vdom.props[
|
|
265
|
+
Ct.call(this, i);
|
|
266
|
+
}, o.prototype.attributeChangedCallback = kt, o.prototype.disconnectedCallback = St, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), o.observedAttributes = n, t.formAssociated && (o.formAssociated = !0), n.forEach(function(s) {
|
|
267
|
+
Object.defineProperty(o.prototype, s, { get: function() {
|
|
268
|
+
return this._vdom ? this._vdom.props[s] : this._props[s];
|
|
274
269
|
}, set: function(a) {
|
|
275
|
-
this._vdom ? this.attributeChangedCallback(
|
|
270
|
+
this._vdom ? this.attributeChangedCallback(s, null, a) : (this._props || (this._props = {}), this._props[s] = a);
|
|
276
271
|
var _ = typeof a;
|
|
277
|
-
a != null && _ !== "string" && _ !== "boolean" && _ !== "number" || this.setAttribute(
|
|
272
|
+
a != null && _ !== "string" && _ !== "boolean" && _ !== "number" || this.setAttribute(s, a);
|
|
278
273
|
} });
|
|
279
274
|
}), customElements.define(e, o), o;
|
|
280
275
|
}
|
|
281
|
-
function
|
|
276
|
+
function bt(t) {
|
|
282
277
|
this.getChildContext = function() {
|
|
283
278
|
return t.context;
|
|
284
279
|
};
|
|
285
|
-
var e = t.children, n =
|
|
286
|
-
return
|
|
280
|
+
var e = t.children, n = Je(t, yt);
|
|
281
|
+
return Ke(e, n);
|
|
287
282
|
}
|
|
288
|
-
function
|
|
283
|
+
function Ct(t) {
|
|
289
284
|
var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
|
|
290
|
-
this.dispatchEvent(e), this._vdom =
|
|
285
|
+
this.dispatchEvent(e), this._vdom = D(bt, ee({}, this._props, { context: e.detail.context }), Xe(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? Ve : se)(this._vdom, this._root);
|
|
291
286
|
}
|
|
292
|
-
function
|
|
287
|
+
function Ge(t) {
|
|
293
288
|
return t.replace(/-(\w)/g, function(e, n) {
|
|
294
289
|
return n ? n.toUpperCase() : "";
|
|
295
290
|
});
|
|
296
291
|
}
|
|
297
|
-
function
|
|
292
|
+
function kt(t, e, n) {
|
|
298
293
|
if (this._vdom) {
|
|
299
|
-
var
|
|
300
|
-
|
|
294
|
+
var i = {};
|
|
295
|
+
i[t] = n = n ?? void 0, i[Ge(t)] = n, this._vdom = Ke(this._vdom, i), se(this._vdom, this._root);
|
|
301
296
|
}
|
|
302
297
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
298
|
+
function St() {
|
|
299
|
+
se(this._vdom = null, this._root);
|
|
305
300
|
}
|
|
306
|
-
function
|
|
307
|
-
var n = this,
|
|
308
|
-
return
|
|
309
|
-
|
|
301
|
+
function Ae(t, e) {
|
|
302
|
+
var n = this, i = t.useFragment, o = Je(t, vt);
|
|
303
|
+
return D(i ? H : "slot", ee({}, o, { ref: function(s) {
|
|
304
|
+
s ? (n.ref = s, n._listener || (n._listener = function(a) {
|
|
310
305
|
a.stopPropagation(), a.detail.context = e;
|
|
311
|
-
},
|
|
306
|
+
}, s.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
|
|
312
307
|
} }));
|
|
313
308
|
}
|
|
314
|
-
function
|
|
309
|
+
function Xe(t, e, n) {
|
|
315
310
|
if (t.nodeType === 3) return t.data;
|
|
316
311
|
if (t.nodeType !== 1) return null;
|
|
317
|
-
var
|
|
318
|
-
for (
|
|
319
|
-
for (
|
|
320
|
-
var c =
|
|
321
|
-
l ? o[l] =
|
|
312
|
+
var i = [], o = {}, s = 0, a = t.attributes, _ = t.childNodes;
|
|
313
|
+
for (s = a.length; s--; ) a[s].name !== "slot" && (o[a[s].name] = a[s].value, o[Ge(a[s].name)] = a[s].value);
|
|
314
|
+
for (s = _.length; s--; ) {
|
|
315
|
+
var c = Xe(_[s], null, n), l = _[s].slot;
|
|
316
|
+
l ? o[l] = D(Ae, { name: l }, c) : i[s] = c;
|
|
322
317
|
}
|
|
323
|
-
var u = !(!n || !n.shadow), r = e ?
|
|
324
|
-
return !u && e && (t.innerHTML = ""),
|
|
318
|
+
var u = !(!n || !n.shadow), r = e ? D(Ae, { useFragment: !u }, i) : i;
|
|
319
|
+
return !u && e && (t.innerHTML = ""), D(e || t.nodeName.toLowerCase(), o, r);
|
|
325
320
|
}
|
|
326
|
-
var
|
|
327
|
-
function d(t, e, n,
|
|
321
|
+
var At = 0;
|
|
322
|
+
function d(t, e, n, i, o, s) {
|
|
328
323
|
e || (e = {});
|
|
329
324
|
var a, _, c = e;
|
|
330
325
|
if ("ref" in c) for (_ in c = {}, e) _ == "ref" ? a = e[_] : c[_] = e[_];
|
|
331
|
-
var l = { type: t, props: c, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --
|
|
326
|
+
var l = { type: t, props: c, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --At, __i: -1, __u: 0, __source: o, __self: s };
|
|
332
327
|
if (typeof t == "function" && (a = t.defaultProps)) for (_ in a) c[_] === void 0 && (c[_] = a[_]);
|
|
333
328
|
return m.vnode && m.vnode(l), l;
|
|
334
329
|
}
|
|
335
|
-
var
|
|
336
|
-
function
|
|
337
|
-
C.__h && C.__h(y, t,
|
|
330
|
+
var q, y, re, $e, te = 0, Ye = [], C = m, Ne = C.__b, xe = C.__r, Pe = C.diffed, We = C.__c, Me = C.unmount, Te = C.__;
|
|
331
|
+
function me(t, e) {
|
|
332
|
+
C.__h && C.__h(y, t, te || e), te = 0;
|
|
338
333
|
var n = y.__H || (y.__H = { __: [], __h: [] });
|
|
339
334
|
return t >= n.__.length && n.__.push({}), n.__[t];
|
|
340
335
|
}
|
|
341
|
-
function
|
|
342
|
-
return
|
|
336
|
+
function T(t) {
|
|
337
|
+
return te = 1, $t(et, t);
|
|
343
338
|
}
|
|
344
|
-
function
|
|
345
|
-
var
|
|
346
|
-
if (
|
|
347
|
-
var c =
|
|
348
|
-
c !== l && (
|
|
349
|
-
}],
|
|
339
|
+
function $t(t, e, n) {
|
|
340
|
+
var i = me(q++, 2);
|
|
341
|
+
if (i.t = t, !i.__c && (i.__ = [et(void 0, e), function(_) {
|
|
342
|
+
var c = i.__N ? i.__N[0] : i.__[0], l = i.t(c, _);
|
|
343
|
+
c !== l && (i.__N = [l, i.__[1]], i.__c.setState({}));
|
|
344
|
+
}], i.__c = y, !y.__f)) {
|
|
350
345
|
var o = function(_, c, l) {
|
|
351
|
-
if (!
|
|
352
|
-
var u =
|
|
353
|
-
return
|
|
346
|
+
if (!i.__c.__H) return !0;
|
|
347
|
+
var u = i.__c.__H.__.filter(function(g) {
|
|
348
|
+
return g.__c;
|
|
354
349
|
});
|
|
355
350
|
if (u.every(function(g) {
|
|
356
351
|
return !g.__N;
|
|
357
|
-
})) return !
|
|
358
|
-
var r =
|
|
359
|
-
return u.
|
|
352
|
+
})) return !s || s.call(this, _, c, l);
|
|
353
|
+
var r = i.__c.props !== _;
|
|
354
|
+
return u.some(function(g) {
|
|
360
355
|
if (g.__N) {
|
|
361
356
|
var h = g.__[0];
|
|
362
357
|
g.__ = g.__N, g.__N = void 0, h !== g.__[0] && (r = !0);
|
|
363
358
|
}
|
|
364
|
-
}),
|
|
359
|
+
}), s && s.call(this, _, c, l) || r;
|
|
365
360
|
};
|
|
366
361
|
y.__f = !0;
|
|
367
|
-
var
|
|
362
|
+
var s = y.shouldComponentUpdate, a = y.componentWillUpdate;
|
|
368
363
|
y.componentWillUpdate = function(_, c, l) {
|
|
369
364
|
if (this.__e) {
|
|
370
|
-
var u =
|
|
371
|
-
|
|
365
|
+
var u = s;
|
|
366
|
+
s = void 0, o(_, c, l), s = u;
|
|
372
367
|
}
|
|
373
368
|
a && a.call(this, _, c, l);
|
|
374
369
|
}, y.shouldComponentUpdate = o;
|
|
375
370
|
}
|
|
376
|
-
return
|
|
371
|
+
return i.__N || i.__;
|
|
377
372
|
}
|
|
378
|
-
function
|
|
379
|
-
var n =
|
|
380
|
-
!C.__s &&
|
|
373
|
+
function Ue(t, e) {
|
|
374
|
+
var n = me(q++, 3);
|
|
375
|
+
!C.__s && Ze(n.__H, e) && (n.__ = t, n.u = e, y.__H.__h.push(n));
|
|
381
376
|
}
|
|
382
|
-
function
|
|
383
|
-
return
|
|
377
|
+
function Ee(t) {
|
|
378
|
+
return te = 5, Nt(function() {
|
|
384
379
|
return { current: t };
|
|
385
380
|
}, []);
|
|
386
381
|
}
|
|
387
|
-
function
|
|
388
|
-
var n =
|
|
389
|
-
return
|
|
382
|
+
function Nt(t, e) {
|
|
383
|
+
var n = me(q++, 7);
|
|
384
|
+
return Ze(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
|
|
390
385
|
}
|
|
391
|
-
function
|
|
392
|
-
for (var t; t =
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
386
|
+
function xt() {
|
|
387
|
+
for (var t; t = Ye.shift(); ) {
|
|
388
|
+
var e = t.__H;
|
|
389
|
+
if (t.__P && e) try {
|
|
390
|
+
e.__h.some(G), e.__h.some(he), e.__h = [];
|
|
391
|
+
} catch (n) {
|
|
392
|
+
e.__h = [], C.__e(n, t.__v);
|
|
393
|
+
}
|
|
396
394
|
}
|
|
397
395
|
}
|
|
398
396
|
C.__b = function(t) {
|
|
399
|
-
y = null,
|
|
397
|
+
y = null, Ne && Ne(t);
|
|
400
398
|
}, C.__ = function(t, e) {
|
|
401
|
-
t && e.__k && e.__k.__m && (t.__m = e.__k.__m),
|
|
399
|
+
t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Te && Te(t, e);
|
|
402
400
|
}, C.__r = function(t) {
|
|
403
|
-
|
|
401
|
+
xe && xe(t), q = 0;
|
|
404
402
|
var e = (y = t.__c).__H;
|
|
405
|
-
e && (
|
|
403
|
+
e && (re === y ? (e.__h = [], y.__h = [], e.__.some(function(n) {
|
|
406
404
|
n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
|
|
407
|
-
})) : (e.__h.
|
|
405
|
+
})) : (e.__h.some(G), e.__h.some(he), e.__h = [], q = 0)), re = y;
|
|
408
406
|
}, C.diffed = function(t) {
|
|
409
|
-
|
|
407
|
+
Pe && Pe(t);
|
|
410
408
|
var e = t.__c;
|
|
411
|
-
e && e.__H && (e.__H.__h.length && (
|
|
409
|
+
e && e.__H && (e.__H.__h.length && (Ye.push(e) !== 1 && $e === C.requestAnimationFrame || (($e = C.requestAnimationFrame) || Pt)(xt)), e.__H.__.some(function(n) {
|
|
412
410
|
n.u && (n.__H = n.u), n.u = void 0;
|
|
413
|
-
})),
|
|
411
|
+
})), re = y = null;
|
|
414
412
|
}, C.__c = function(t, e) {
|
|
415
413
|
e.some(function(n) {
|
|
416
414
|
try {
|
|
417
|
-
n.__h.
|
|
418
|
-
return !
|
|
415
|
+
n.__h.some(G), n.__h = n.__h.filter(function(i) {
|
|
416
|
+
return !i.__ || he(i);
|
|
419
417
|
});
|
|
420
|
-
} catch (
|
|
418
|
+
} catch (i) {
|
|
421
419
|
e.some(function(o) {
|
|
422
420
|
o.__h && (o.__h = []);
|
|
423
|
-
}), e = [], C.__e(
|
|
421
|
+
}), e = [], C.__e(i, n.__v);
|
|
424
422
|
}
|
|
425
|
-
}),
|
|
423
|
+
}), We && We(t, e);
|
|
426
424
|
}, C.unmount = function(t) {
|
|
427
|
-
|
|
425
|
+
Me && Me(t);
|
|
428
426
|
var e, n = t.__c;
|
|
429
|
-
n && n.__H && (n.__H.__.
|
|
427
|
+
n && n.__H && (n.__H.__.some(function(i) {
|
|
430
428
|
try {
|
|
431
|
-
G(
|
|
429
|
+
G(i);
|
|
432
430
|
} catch (o) {
|
|
433
431
|
e = o;
|
|
434
432
|
}
|
|
435
433
|
}), n.__H = void 0, e && C.__e(e, n.__v));
|
|
436
434
|
};
|
|
437
|
-
var
|
|
438
|
-
function
|
|
435
|
+
var Fe = typeof requestAnimationFrame == "function";
|
|
436
|
+
function Pt(t) {
|
|
439
437
|
var e, n = function() {
|
|
440
|
-
clearTimeout(
|
|
441
|
-
},
|
|
442
|
-
|
|
438
|
+
clearTimeout(i), Fe && cancelAnimationFrame(e), setTimeout(t);
|
|
439
|
+
}, i = setTimeout(n, 35);
|
|
440
|
+
Fe && (e = requestAnimationFrame(n));
|
|
443
441
|
}
|
|
444
442
|
function G(t) {
|
|
445
443
|
var e = y, n = t.__c;
|
|
446
444
|
typeof n == "function" && (t.__c = void 0, n()), y = e;
|
|
447
445
|
}
|
|
448
|
-
function
|
|
446
|
+
function he(t) {
|
|
449
447
|
var e = y;
|
|
450
448
|
t.__c = t.__(), y = e;
|
|
451
449
|
}
|
|
452
|
-
function
|
|
453
|
-
return !t || t.length !== e.length || e.some(function(n,
|
|
454
|
-
return n !== t[
|
|
450
|
+
function Ze(t, e) {
|
|
451
|
+
return !t || t.length !== e.length || e.some(function(n, i) {
|
|
452
|
+
return n !== t[i];
|
|
455
453
|
});
|
|
456
454
|
}
|
|
457
|
-
function
|
|
455
|
+
function et(t, e) {
|
|
458
456
|
return typeof e == "function" ? e(t) : e;
|
|
459
457
|
}
|
|
460
|
-
|
|
461
|
-
let ie = (t = 21) => {
|
|
458
|
+
let Wt = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", ae = (t = 21) => {
|
|
462
459
|
let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
|
|
463
460
|
for (; t--; )
|
|
464
|
-
e +=
|
|
461
|
+
e += Wt[n[t] & 63];
|
|
465
462
|
return e;
|
|
466
463
|
};
|
|
467
|
-
class
|
|
464
|
+
class Mt {
|
|
468
465
|
constructor(e, n) {
|
|
469
466
|
this.agentUrl = e, this.agentId = n, this.agentConfig = null, this.ws = null, this.messageCallbacks = /* @__PURE__ */ new Set(), this.suggestionsCallbacks = /* @__PURE__ */ new Set(), this.connectionCallbacks = /* @__PURE__ */ new Set(), this.streamingCallbacks = /* @__PURE__ */ new Set(), this.processingCallbacks = /* @__PURE__ */ new Set(), this.queueCallbacks = /* @__PURE__ */ new Set(), this.messages = [], this.activeSuggestions = [], this.reconnectAttempts = 0, this.maxReconnectAttempts = 5, this.reconnectDelay = 1e3, this.isAgentStreaming = !1, this.isAgentProcessing = !1, this.messageQueue = [], this.disposed = !1;
|
|
470
467
|
}
|
|
@@ -474,9 +471,9 @@ class Nt {
|
|
|
474
471
|
async initWidget() {
|
|
475
472
|
try {
|
|
476
473
|
try {
|
|
477
|
-
const
|
|
478
|
-
if (
|
|
479
|
-
const o = await
|
|
474
|
+
const i = await fetch(`${this.normalizeBaseUrl(this.agentUrl)}/api/agent/${this.agentId}`);
|
|
475
|
+
if (i.ok) {
|
|
476
|
+
const o = await i.json();
|
|
480
477
|
return !o || o.status !== "active" ? (console.error("Agent not found or inactive"), null) : (this.agentConfig = o, this.maxReconnectAttempts = o.config.maxRetries || 5, this.reconnectDelay = o.config.reconnectDelay || 1e3, await this.connectToAgent(), o);
|
|
481
478
|
}
|
|
482
479
|
} catch {
|
|
@@ -512,23 +509,23 @@ class Nt {
|
|
|
512
509
|
if (this.disposed)
|
|
513
510
|
return;
|
|
514
511
|
const e = this.getSessionId(), n = `${this.normalizeBaseUrl(this.agentConfig.wsUrl)}/${e}`;
|
|
515
|
-
return new Promise((
|
|
512
|
+
return new Promise((i, o) => {
|
|
516
513
|
try {
|
|
517
514
|
this.ws = new WebSocket(n), this.ws.onopen = () => {
|
|
518
|
-
console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0),
|
|
519
|
-
}, this.ws.onmessage = (
|
|
520
|
-
this.handleMessage(
|
|
515
|
+
console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0), i();
|
|
516
|
+
}, this.ws.onmessage = (s) => {
|
|
517
|
+
this.handleMessage(s);
|
|
521
518
|
}, this.ws.onclose = () => {
|
|
522
519
|
if (this.ws = null, this.notifyConnectionChange(!1), !this.disposed && this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
523
520
|
this.reconnectAttempts++;
|
|
524
|
-
const
|
|
525
|
-
console.log(`[Widget] Reconnecting in ${
|
|
521
|
+
const s = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);
|
|
522
|
+
console.log(`[Widget] Reconnecting in ${s}ms... (attempt ${this.reconnectAttempts})`), setTimeout(() => this.connectToAgent(), s);
|
|
526
523
|
}
|
|
527
|
-
}, this.ws.onerror = (
|
|
528
|
-
console.error("[Widget] WebSocket error:",
|
|
524
|
+
}, this.ws.onerror = (s) => {
|
|
525
|
+
console.error("[Widget] WebSocket error:", s), o(s);
|
|
529
526
|
};
|
|
530
|
-
} catch (
|
|
531
|
-
o(
|
|
527
|
+
} catch (s) {
|
|
528
|
+
o(s);
|
|
532
529
|
}
|
|
533
530
|
});
|
|
534
531
|
}
|
|
@@ -552,15 +549,15 @@ class Nt {
|
|
|
552
549
|
if (n.type === "connected")
|
|
553
550
|
this.notifyConnectionChange(!0);
|
|
554
551
|
else if (n.type === "text-delta")
|
|
555
|
-
this.isAgentProcessing && this.notifyProcessingChange(!1), this.setMessages((
|
|
556
|
-
const o =
|
|
552
|
+
this.isAgentProcessing && this.notifyProcessingChange(!1), this.setMessages((i) => {
|
|
553
|
+
const o = i[i.length - 1];
|
|
557
554
|
return o && o.role === "assistant" && o.isStreaming ? [
|
|
558
|
-
...
|
|
555
|
+
...i.slice(0, -1),
|
|
559
556
|
{ ...o, content: o.content + n.text }
|
|
560
557
|
] : [
|
|
561
|
-
...
|
|
558
|
+
...i,
|
|
562
559
|
{
|
|
563
|
-
id:
|
|
560
|
+
id: ae(),
|
|
564
561
|
role: "assistant",
|
|
565
562
|
content: n.text,
|
|
566
563
|
timestamp: Date.now(),
|
|
@@ -569,20 +566,20 @@ class Nt {
|
|
|
569
566
|
];
|
|
570
567
|
});
|
|
571
568
|
else if (n.type === "done")
|
|
572
|
-
this.notifyProcessingChange(!1), this.setMessages((
|
|
573
|
-
const o =
|
|
569
|
+
this.notifyProcessingChange(!1), this.setMessages((i) => {
|
|
570
|
+
const o = i[i.length - 1];
|
|
574
571
|
return o && o.role === "assistant" && o.isStreaming ? [
|
|
575
|
-
...
|
|
572
|
+
...i.slice(0, -1),
|
|
576
573
|
{ ...o, isStreaming: !1 }
|
|
577
|
-
] :
|
|
574
|
+
] : i;
|
|
578
575
|
}), this.isAgentStreaming = !1, this.notifyStreamingChange(!1), this.processMessageQueue();
|
|
579
576
|
else if (n.type === "step-start" || n.type === "agent-start")
|
|
580
577
|
this.isAgentStreaming = !0, this.notifyStreamingChange(!0), this.notifyProcessingChange(!0);
|
|
581
578
|
else if (n.type === "step-end" || n.type === "agent-end")
|
|
582
579
|
n.type === "agent-end" && this.notifyProcessingChange(!1);
|
|
583
580
|
else if (n.type === "tool-call") {
|
|
584
|
-
const
|
|
585
|
-
this.notifyProcessingChange(!0),
|
|
581
|
+
const i = n.tool?.name || n.toolName, o = n.tool?.arguments || n.args;
|
|
582
|
+
this.notifyProcessingChange(!0), i === "suggest_options" && o?.options && this.setActiveSuggestions(o.options);
|
|
586
583
|
} else n.type === "tool-result" || n.type === "handoff" || (n.type === "suggested-questions" ? this.setActiveSuggestions(n.suggestions) : n.type === "error" || n.type === "interrupted" ? (this.notifyProcessingChange(!1), this.isAgentStreaming = !1, this.notifyStreamingChange(!1)) : n.type === "cancelled" ? this.notifyProcessingChange(!1) : console.log("[Widget] Unknown message type:", n.type));
|
|
587
584
|
} catch (n) {
|
|
588
585
|
console.error("[Widget] Error parsing message:", e.data, n);
|
|
@@ -596,12 +593,12 @@ class Nt {
|
|
|
596
593
|
throw new Error("Not connected to agent");
|
|
597
594
|
this.setActiveSuggestions([]);
|
|
598
595
|
const n = {
|
|
599
|
-
id:
|
|
596
|
+
id: ae(),
|
|
600
597
|
role: "user",
|
|
601
598
|
content: e,
|
|
602
599
|
timestamp: Date.now()
|
|
603
600
|
};
|
|
604
|
-
if (this.setMessages((
|
|
601
|
+
if (this.setMessages((i) => [...i, n]), this.isAgentStreaming) {
|
|
605
602
|
console.log("[Widget] Agent is streaming, queuing message"), this.messageQueue.push(e), this.notifyQueueChange(this.messageQueue.length);
|
|
606
603
|
return;
|
|
607
604
|
}
|
|
@@ -636,7 +633,7 @@ class Nt {
|
|
|
636
633
|
*/
|
|
637
634
|
getSessionId() {
|
|
638
635
|
let e = sessionStorage.getItem("ariaflow_session_id");
|
|
639
|
-
return e || (e =
|
|
636
|
+
return e || (e = ae(), sessionStorage.setItem("ariaflow_session_id", e)), e;
|
|
640
637
|
}
|
|
641
638
|
/**
|
|
642
639
|
* Update messages state
|
|
@@ -706,8 +703,8 @@ class Nt {
|
|
|
706
703
|
* Normalize and notify suggestion changes
|
|
707
704
|
*/
|
|
708
705
|
setActiveSuggestions(e) {
|
|
709
|
-
const n = Array.isArray(e) ? e.filter((o) => typeof o == "string").map((o) => o.trim()).filter(Boolean) : [],
|
|
710
|
-
this.activeSuggestions =
|
|
706
|
+
const n = Array.isArray(e) ? e.filter((o) => typeof o == "string").map((o) => o.trim()).filter(Boolean) : [], i = [...new Set(n)];
|
|
707
|
+
this.activeSuggestions = i, this.suggestionsCallbacks.forEach((o) => o(i));
|
|
711
708
|
}
|
|
712
709
|
normalizeBaseUrl(e) {
|
|
713
710
|
return e.replace(/\/+$/, "");
|
|
@@ -745,20 +742,20 @@ class Nt {
|
|
|
745
742
|
this.disposed = !0, this.ws && (this.ws.close(), this.ws = null), this.messageCallbacks.clear(), this.suggestionsCallbacks.clear(), this.connectionCallbacks.clear(), this.streamingCallbacks.clear(), this.processingCallbacks.clear(), this.queueCallbacks.clear();
|
|
746
743
|
}
|
|
747
744
|
}
|
|
748
|
-
const
|
|
745
|
+
const le = {
|
|
749
746
|
none: "0",
|
|
750
747
|
small: "0.375rem",
|
|
751
748
|
medium: "0.75rem",
|
|
752
749
|
large: "1rem"
|
|
753
750
|
};
|
|
754
|
-
function
|
|
751
|
+
function Tt({
|
|
755
752
|
agentUrl: t,
|
|
756
753
|
agentId: e,
|
|
757
754
|
// Legacy props for backward compatibility
|
|
758
755
|
widgetId: n,
|
|
759
|
-
apiUrl:
|
|
756
|
+
apiUrl: i,
|
|
760
757
|
mode: o = "chat",
|
|
761
|
-
theme:
|
|
758
|
+
theme: s = "light",
|
|
762
759
|
position: a = "bottom-right",
|
|
763
760
|
size: _ = "full",
|
|
764
761
|
radius: c = "medium",
|
|
@@ -770,45 +767,45 @@ function xt({
|
|
|
770
767
|
subtitle: v,
|
|
771
768
|
emptyChatMessage: k
|
|
772
769
|
}) {
|
|
773
|
-
const [w, p] =
|
|
774
|
-
|
|
770
|
+
const [w, p] = T(!1), [f, x] = T([]), [S, E] = T(""), [P, I] = T(!1), [A, $] = T(!1), [W, tt] = T(null), [Q, nt] = T(!1), [st, it] = T(!1), [ie, ot] = T(0), [ye, rt] = T([]), z = Ee(null), ve = Ee(null);
|
|
771
|
+
Ue(() => ((async () => {
|
|
775
772
|
if (t && e) {
|
|
776
|
-
const
|
|
777
|
-
|
|
773
|
+
const M = new Mt(t, e);
|
|
774
|
+
z.current = M;
|
|
778
775
|
try {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}),
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
} catch (
|
|
785
|
-
console.error("[AriaFlow Widget] Initialization error:",
|
|
776
|
+
M.onMessages((N) => x(N)), M.onConnectionChange((N) => {
|
|
777
|
+
I(N), N && $(!0);
|
|
778
|
+
}), M.onStreamingChange((N) => nt(N)), M.onQueueChange((N) => ot(N)), M.onProcessingChange((N) => it(N)), M.onSuggestionsChange((N) => rt(N));
|
|
779
|
+
const j = await M.initWidget();
|
|
780
|
+
j ? tt(j) : console.error("[AriaFlow Widget] Agent config fetch failed");
|
|
781
|
+
} catch (j) {
|
|
782
|
+
console.error("[AriaFlow Widget] Initialization error:", j);
|
|
786
783
|
}
|
|
787
|
-
} else t && !e ? (console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: agent-id is required")) :
|
|
784
|
+
} else t && !e ? (console.warn("[AriaFlow Widget] Direct WebSocket URLs are deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: agent-id is required")) : i && n ? (console.warn("[AriaFlow Widget] Legacy widget config is deprecated. Use agent-url + agent-id instead."), console.error("[AriaFlow Widget] Configuration error: use agent-url + agent-id instead")) : console.error("[AriaFlow Widget] Invalid configuration. Provide agent-url and agent-id.");
|
|
788
785
|
})(), () => {
|
|
789
|
-
|
|
790
|
-
}), [t, e, n,
|
|
791
|
-
|
|
786
|
+
z.current?.dispose();
|
|
787
|
+
}), [t, e, n, i]), Ue(() => {
|
|
788
|
+
ve.current?.scrollIntoView({ behavior: "smooth" });
|
|
792
789
|
}, [f]);
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
795
|
-
const b =
|
|
796
|
-
|
|
790
|
+
const we = async () => {
|
|
791
|
+
if (!S.trim() || !P) return;
|
|
792
|
+
const b = S.trim();
|
|
793
|
+
E("");
|
|
797
794
|
try {
|
|
798
|
-
await
|
|
799
|
-
} catch (
|
|
800
|
-
console.error("Failed to send message:",
|
|
795
|
+
await z.current?.sendMessage(b);
|
|
796
|
+
} catch (M) {
|
|
797
|
+
console.error("Failed to send message:", M);
|
|
801
798
|
}
|
|
802
|
-
},
|
|
803
|
-
b.key === "Enter" && !b.shiftKey && (b.preventDefault(),
|
|
804
|
-
},
|
|
805
|
-
!
|
|
806
|
-
},
|
|
799
|
+
}, at = (b) => {
|
|
800
|
+
b.key === "Enter" && !b.shiftKey && (b.preventDefault(), we());
|
|
801
|
+
}, lt = (b) => {
|
|
802
|
+
!P || Q || z.current?.sendMessage(b);
|
|
803
|
+
}, _t = h || W?.config.title || "Ninewells Hospital", ct = v || W?.config.subtitle || "How can we help you today?", ut = k || W?.config.emptyChatMessage || "Start a conversation with Ninewells...";
|
|
807
804
|
return /* @__PURE__ */ d(
|
|
808
805
|
"div",
|
|
809
806
|
{
|
|
810
807
|
className: `ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${_} ariaflow-widget-radius-${c}`,
|
|
811
|
-
"data-theme":
|
|
808
|
+
"data-theme": s,
|
|
812
809
|
style: {
|
|
813
810
|
"--ariaflow-accent-color": u,
|
|
814
811
|
"--ariaflow-base-color": l
|
|
@@ -868,8 +865,8 @@ function xt({
|
|
|
868
865
|
{
|
|
869
866
|
className: "ariaflow-widget-window",
|
|
870
867
|
style: {
|
|
871
|
-
backgroundColor:
|
|
872
|
-
borderRadius:
|
|
868
|
+
backgroundColor: s === "dark" && l ? l : void 0,
|
|
869
|
+
borderRadius: le[c]
|
|
873
870
|
},
|
|
874
871
|
children: [
|
|
875
872
|
/* @__PURE__ */ d(
|
|
@@ -878,12 +875,12 @@ function xt({
|
|
|
878
875
|
className: "ariaflow-widget-header",
|
|
879
876
|
style: {
|
|
880
877
|
backgroundColor: u,
|
|
881
|
-
borderRadius: c === "none" ? "0" : `${
|
|
878
|
+
borderRadius: c === "none" ? "0" : `${le[c]} ${le[c]} 0 0`
|
|
882
879
|
},
|
|
883
880
|
children: [
|
|
884
881
|
/* @__PURE__ */ d("div", { className: "ariaflow-widget-header-content", children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-title-group", children: [
|
|
885
|
-
/* @__PURE__ */ d("h3", { className: "ariaflow-widget-title", children:
|
|
886
|
-
/* @__PURE__ */ d("p", { className: "ariaflow-widget-subtitle", children:
|
|
882
|
+
/* @__PURE__ */ d("h3", { className: "ariaflow-widget-title", children: _t }),
|
|
883
|
+
/* @__PURE__ */ d("p", { className: "ariaflow-widget-subtitle", children: ct })
|
|
887
884
|
] }) }),
|
|
888
885
|
/* @__PURE__ */ d(
|
|
889
886
|
"button",
|
|
@@ -911,16 +908,16 @@ function xt({
|
|
|
911
908
|
]
|
|
912
909
|
}
|
|
913
910
|
),
|
|
914
|
-
!
|
|
911
|
+
!P && /* @__PURE__ */ d("div", { className: "ariaflow-widget-status", children: [
|
|
915
912
|
/* @__PURE__ */ d("span", { className: "ariaflow-widget-status-dot" }),
|
|
916
913
|
"Connecting..."
|
|
917
914
|
] }),
|
|
918
|
-
/* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children:
|
|
915
|
+
/* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children: P ? ut : "Connecting to agent..." }) }) : /* @__PURE__ */ d(H, { children: [
|
|
919
916
|
f.map((b) => b.role === "tool" ? null : /* @__PURE__ */ d(
|
|
920
917
|
"div",
|
|
921
918
|
{
|
|
922
919
|
className: `ariaflow-widget-message ariaflow-widget-message-${b.role}`,
|
|
923
|
-
children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(
|
|
920
|
+
children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(H, { children: [
|
|
924
921
|
b.content,
|
|
925
922
|
b.isStreaming && /* @__PURE__ */ d("span", { className: "ariaflow-widget-typing-indicator", children: [
|
|
926
923
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
@@ -931,18 +928,18 @@ function xt({
|
|
|
931
928
|
},
|
|
932
929
|
b.id
|
|
933
930
|
)),
|
|
934
|
-
/* @__PURE__ */ d("div", { ref:
|
|
935
|
-
|
|
931
|
+
/* @__PURE__ */ d("div", { ref: ve }),
|
|
932
|
+
st && !Q && /* @__PURE__ */ d("div", { className: "ariaflow-widget-message ariaflow-widget-message-assistant", children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d("span", { className: "ariaflow-widget-typing-indicator", children: [
|
|
936
933
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
937
934
|
/* @__PURE__ */ d("span", { children: "•" }),
|
|
938
935
|
/* @__PURE__ */ d("span", { children: "•" })
|
|
939
936
|
] }) }) })
|
|
940
937
|
] }) }),
|
|
941
|
-
!
|
|
938
|
+
!Q && ye.length > 0 && /* @__PURE__ */ d("div", { className: "ariaflow-widget-suggestions", children: ye.map((b) => /* @__PURE__ */ d(
|
|
942
939
|
"button",
|
|
943
940
|
{
|
|
944
941
|
className: "ariaflow-widget-chip",
|
|
945
|
-
onClick: () =>
|
|
942
|
+
onClick: () => lt(b),
|
|
946
943
|
style: {
|
|
947
944
|
borderColor: u,
|
|
948
945
|
color: u,
|
|
@@ -957,20 +954,20 @@ function xt({
|
|
|
957
954
|
/* @__PURE__ */ d(
|
|
958
955
|
"textarea",
|
|
959
956
|
{
|
|
960
|
-
value:
|
|
961
|
-
onInput: (b) =>
|
|
962
|
-
onKeyDown:
|
|
963
|
-
placeholder:
|
|
957
|
+
value: S,
|
|
958
|
+
onInput: (b) => E(b.target.value),
|
|
959
|
+
onKeyDown: at,
|
|
960
|
+
placeholder: P ? Q ? ie > 0 ? `Agent is responding... (${ie} message${ie > 1 ? "s" : ""} queued)` : "Agent is responding..." : "Type your message..." : "Connecting...",
|
|
964
961
|
rows: 1,
|
|
965
|
-
disabled: !
|
|
962
|
+
disabled: !P
|
|
966
963
|
}
|
|
967
964
|
),
|
|
968
965
|
/* @__PURE__ */ d(
|
|
969
966
|
"button",
|
|
970
967
|
{
|
|
971
968
|
className: "ariaflow-widget-send",
|
|
972
|
-
onClick:
|
|
973
|
-
disabled:
|
|
969
|
+
onClick: we,
|
|
970
|
+
disabled: !S.trim() || !P,
|
|
974
971
|
style: { backgroundColor: u },
|
|
975
972
|
"aria-label": "Send message",
|
|
976
973
|
children: /* @__PURE__ */ d(
|
|
@@ -998,7 +995,7 @@ function xt({
|
|
|
998
995
|
}
|
|
999
996
|
);
|
|
1000
997
|
}
|
|
1001
|
-
const
|
|
998
|
+
const Ut = [
|
|
1002
999
|
"agent-url",
|
|
1003
1000
|
"agent-id",
|
|
1004
1001
|
// Legacy support
|
|
@@ -1018,20 +1015,20 @@ const Pt = [
|
|
|
1018
1015
|
"subtitle",
|
|
1019
1016
|
"empty-chat-message"
|
|
1020
1017
|
];
|
|
1021
|
-
|
|
1022
|
-
|
|
1018
|
+
wt(
|
|
1019
|
+
Tt,
|
|
1023
1020
|
"ariaflow-widget",
|
|
1024
1021
|
// Keep kebab-case attribute names for HTML usage.
|
|
1025
|
-
|
|
1022
|
+
Ut,
|
|
1026
1023
|
// Shadow DOM (optional, set to false for light DOM)
|
|
1027
1024
|
{ shadow: !1 }
|
|
1028
1025
|
);
|
|
1029
|
-
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
1030
|
-
function
|
|
1026
|
+
typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", He) : He());
|
|
1027
|
+
function He() {
|
|
1031
1028
|
const t = document.querySelectorAll("ariaflow-widget");
|
|
1032
1029
|
console.log(`[AriaFlow] Initializing ${t.length} widget(s)`);
|
|
1033
1030
|
}
|
|
1034
1031
|
export {
|
|
1035
|
-
|
|
1036
|
-
|
|
1032
|
+
Tt as Widget,
|
|
1033
|
+
Mt as WidgetClient
|
|
1037
1034
|
};
|