@ariaflowagents/widget 0.6.14 → 0.9.0

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 CHANGED
@@ -1,31 +1,31 @@
1
- var z, m, He, D, we, Ie, Ue, De, ge, le, _e, j = {}, Re = [], _t = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ne = Array.isArray;
2
- function E(t, e) {
1
+ var Q, m, He, I, ye, Fe, Ue, Ie, ce, re, ae, q = {}, De = [], _t = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ee = Array.isArray;
2
+ function T(t, e) {
3
3
  for (var n in e) t[n] = e[n];
4
4
  return t;
5
5
  }
6
- function de(t) {
6
+ function ue(t) {
7
7
  t && t.parentNode && t.parentNode.removeChild(t);
8
8
  }
9
- function O(t, e, n) {
10
- var o, i, s, a = {};
11
- for (s in e) s == "key" ? o = e[s] : s == "ref" ? i = e[s] : a[s] = e[s];
12
- if (arguments.length > 2 && (a.children = arguments.length > 3 ? z.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 q(t, a, o, i, null);
9
+ function L(t, e, n) {
10
+ var s, o, i, a = {};
11
+ for (i in e) i == "key" ? s = e[i] : i == "ref" ? o = e[i] : a[i] = e[i];
12
+ if (arguments.length > 2 && (a.children = arguments.length > 3 ? Q.call(arguments, 2) : n), typeof t == "function" && t.defaultProps != null) for (i in t.defaultProps) a[i] === void 0 && (a[i] = t.defaultProps[i]);
13
+ return O(t, a, s, o, null);
14
14
  }
15
- function q(t, e, n, o, i) {
16
- var s = { type: t, props: e, key: n, ref: o, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: i ?? ++He, __i: -1, __u: 0 };
17
- return i == null && m.vnode != null && m.vnode(s), s;
15
+ function O(t, e, n, s, o) {
16
+ var i = { type: t, props: e, key: n, ref: s, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: o ?? ++He, __i: -1, __u: 0 };
17
+ return o == null && m.vnode != null && m.vnode(i), i;
18
18
  }
19
- function R(t) {
19
+ function D(t) {
20
20
  return t.children;
21
21
  }
22
- function X(t, e) {
22
+ function J(t, e) {
23
23
  this.props = t, this.context = e;
24
24
  }
25
- function Q(t, e) {
26
- if (e == null) return t.__ ? Q(t.__, t.__i + 1) : null;
25
+ function R(t, e) {
26
+ if (e == null) return t.__ ? R(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" ? Q(t) : null;
28
+ return typeof t.type == "function" ? R(t) : null;
29
29
  }
30
30
  function Le(t) {
31
31
  var e, n;
@@ -38,56 +38,56 @@ function Le(t) {
38
38
  }
39
39
  }
40
40
  function ve(t) {
41
- (!t.__d && (t.__d = !0) && D.push(t) && !Z.__r++ || we != m.debounceRendering) && ((we = m.debounceRendering) || Ie)(Z);
41
+ (!t.__d && (t.__d = !0) && I.push(t) && !X.__r++ || ye != m.debounceRendering) && ((ye = m.debounceRendering) || Fe)(X);
42
42
  }
43
- function Z() {
44
- for (var t, e, n, o, i, s, a, l = 1; D.length; ) D.length > l && D.sort(Ue), t = D.shift(), l = D.length, t.__d && (n = void 0, o = void 0, i = (o = (e = t).__v).__e, s = [], a = [], e.__P && ((n = E({}, o)).__v = o.__v + 1, m.vnode && m.vnode(n), he(e.__P, n, o, e.__n, e.__P.namespaceURI, 32 & o.__u ? [i] : null, s, i ?? Q(o), !!(32 & o.__u), a), n.__v = o.__v, n.__.__k[n.__i] = n, qe(s, n, a), o.__e = o.__ = null, n.__e != i && Le(n)));
45
- Z.__r = 0;
43
+ function X() {
44
+ for (var t, e, n, s, o, i, a, _ = 1; I.length; ) I.length > _ && I.sort(Ue), t = I.shift(), _ = I.length, t.__d && (n = void 0, s = void 0, o = (s = (e = t).__v).__e, i = [], a = [], e.__P && ((n = T({}, s)).__v = s.__v + 1, m.vnode && m.vnode(n), he(e.__P, n, s, e.__n, e.__P.namespaceURI, 32 & s.__u ? [o] : null, i, o ?? R(s), !!(32 & s.__u), a), n.__v = s.__v, n.__.__k[n.__i] = n, qe(i, n, a), s.__e = s.__ = null, n.__e != o && Le(n)));
45
+ X.__r = 0;
46
46
  }
47
- function Oe(t, e, n, o, i, s, a, l, c, _, u) {
48
- var r, h, g, v, $, y, p, f = o && o.__k || Re, F = e.length;
49
- for (c = ct(n, e, f, c, F), r = 0; r < F; r++) (g = n.__k[r]) != null && (h = g.__i == -1 ? j : f[g.__i] || j, g.__i = r, y = he(t, g, h, i, s, a, l, c, _, u), v = g.__e, g.ref && h.ref != g.ref && (h.ref && fe(h.ref, null, g), u.push(g.ref, g.__c || v, g)), $ == null && v != null && ($ = v), (p = !!(4 & g.__u)) || h.__k === g.__k ? c = Qe(g, c, t, p) : typeof g.type == "function" && y !== void 0 ? c = y : v && (c = v.nextSibling), g.__u &= -7);
50
- return n.__e = $, c;
47
+ function Re(t, e, n, s, o, i, a, _, c, l, u) {
48
+ var r, g, h, v, k, w, p, f = s && s.__k || De, E = e.length;
49
+ for (c = ct(n, e, f, c, E), r = 0; r < E; r++) (h = n.__k[r]) != null && (g = h.__i == -1 ? q : f[h.__i] || q, h.__i = r, w = he(t, h, g, o, i, a, _, c, l, u), v = h.__e, h.ref && g.ref != h.ref && (g.ref && de(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 = Oe(h, c, t, p) : typeof h.type == "function" && w !== void 0 ? c = w : v && (c = v.nextSibling), h.__u &= -7);
50
+ return n.__e = k, c;
51
51
  }
52
- function ct(t, e, n, o, i) {
53
- var s, a, l, c, _, u = n.length, r = u, h = 0;
54
- for (t.__k = new Array(i), s = 0; s < i; 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] = q(null, a, null, null, null) : ne(a) ? a = t.__k[s] = q(R, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[s] = q(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[s] = a, c = s + h, a.__ = t, a.__b = t.__b + 1, l = null, (_ = a.__i = ut(a, n, c, r)) != -1 && (r--, (l = n[_]) && (l.__u |= 2)), l == null || l.__v == null ? (_ == -1 && (i > u ? h-- : i < u && h++), typeof a.type != "function" && (a.__u |= 4)) : _ != c && (_ == c - 1 ? h-- : _ == c + 1 ? h++ : (_ > c ? h-- : h++, a.__u |= 4))) : t.__k[s] = null;
55
- if (r) for (s = 0; s < u; s++) (l = n[s]) != null && !(2 & l.__u) && (l.__e == o && (o = Q(l)), Be(l, l));
56
- return o;
52
+ function ct(t, e, n, s, o) {
53
+ var i, a, _, c, l, u = n.length, r = u, g = 0;
54
+ for (t.__k = new Array(o), i = 0; i < o; i++) (a = e[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = t.__k[i] = O(null, a, null, null, null) : ee(a) ? a = t.__k[i] = O(D, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = t.__k[i] = O(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : t.__k[i] = a, c = i + g, a.__ = t, a.__b = t.__b + 1, _ = null, (l = a.__i = ut(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[i] = null;
55
+ if (r) for (i = 0; i < u; i++) (_ = n[i]) != null && !(2 & _.__u) && (_.__e == s && (s = R(_)), Qe(_, _));
56
+ return s;
57
57
  }
58
- function Qe(t, e, n, o) {
59
- var i, s;
58
+ function Oe(t, e, n, s) {
59
+ var o, i;
60
60
  if (typeof t.type == "function") {
61
- for (i = t.__k, s = 0; i && s < i.length; s++) i[s] && (i[s].__ = t, e = Qe(i[s], e, n, o));
61
+ for (o = t.__k, i = 0; o && i < o.length; i++) o[i] && (o[i].__ = t, e = Oe(o[i], e, n, s));
62
62
  return e;
63
63
  }
64
- t.__e != e && (o && (e && t.type && !e.parentNode && (e = Q(t)), n.insertBefore(t.__e, e || null)), e = t.__e);
64
+ t.__e != e && (s && (e && t.type && !e.parentNode && (e = R(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 ut(t, e, n, o) {
71
- var i, s, a, l = t.key, c = t.type, _ = e[n], u = _ != null && (2 & _.__u) == 0;
72
- if (_ === null && l == null || u && l == _.key && c == _.type) return n;
73
- if (o > (u ? 1 : 0)) {
74
- for (i = n - 1, s = n + 1; i >= 0 || s < e.length; ) if ((_ = e[a = i >= 0 ? i-- : s++]) != null && !(2 & _.__u) && l == _.key && c == _.type) return a;
70
+ function ut(t, e, n, s) {
71
+ var o, i, a, _ = t.key, c = t.type, l = e[n], u = l != null && (2 & l.__u) == 0;
72
+ if (l === null && _ == null || u && _ == l.key && c == l.type) return n;
73
+ if (s > (u ? 1 : 0)) {
74
+ for (o = n - 1, i = n + 1; o >= 0 || i < e.length; ) if ((l = e[a = o >= 0 ? o-- : i++]) != null && !(2 & l.__u) && _ == l.key && c == l.type) return a;
75
75
  }
76
76
  return -1;
77
77
  }
78
- function be(t, e, n) {
78
+ function we(t, e, n) {
79
79
  e[0] == "-" ? t.setProperty(e, n ?? "") : t[e] = n == null ? "" : typeof n != "number" || _t.test(e) ? n : n + "px";
80
80
  }
81
- function K(t, e, n, o, i) {
82
- var s, a;
81
+ function K(t, e, n, s, o) {
82
+ var i, a;
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 || be(t.style, e, "");
86
- if (n) for (e in n) o && n[e] == o[e] || be(t.style, e, n[e]);
85
+ if (typeof s == "string" && (t.style.cssText = s = ""), s) for (e in s) n && e in n || we(t.style, e, "");
86
+ if (n) for (e in n) s && n[e] == s[e] || we(t.style, e, n[e]);
87
87
  }
88
- else if (e[0] == "o" && e[1] == "n") s = e != (e = e.replace(De, "$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 ? o ? n.u = o.u : (n.u = ge, t.addEventListener(e, s ? _e : le, s)) : t.removeEventListener(e, s ? _e : le, s);
88
+ else if (e[0] == "o" && e[1] == "n") i = e != (e = e.replace(Ie, "$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 + i] = n, n ? s ? n.u = s.u : (n.u = ce, t.addEventListener(e, i ? ae : re, i)) : t.removeEventListener(e, i ? ae : re, i);
89
89
  else {
90
- if (i == "http://www.w3.org/2000/svg") e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
90
+ if (o == "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,398 +96,396 @@ function K(t, e, n, o, i) {
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 Ce(t) {
99
+ function be(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 = ge++;
103
+ if (e.t == null) e.t = ce++;
104
104
  else if (e.t < n.u) return;
105
105
  return n(m.event ? m.event(e) : e);
106
106
  }
107
107
  };
108
108
  }
109
- function he(t, e, n, o, i, s, a, l, c, _) {
110
- var u, r, h, g, v, $, y, p, f, F, N, H, W, V, A, I, U, x = e.type;
109
+ function he(t, e, n, s, o, i, a, _, c, l) {
110
+ var u, r, g, h, v, k, w, p, f, E, $, H, S, z, A, F, U, N = e.type;
111
111
  if (e.constructor !== void 0) return null;
112
- 128 & n.__u && (c = !!(32 & n.__u), s = [l = e.__e = n.__e]), (u = m.__b) && u(e);
113
- e: if (typeof x == "function") try {
114
- if (p = e.props, f = "prototype" in x && x.prototype.render, F = (u = x.contextType) && o[u.__c], N = u ? F ? F.props.value : u.__ : o, n.__c ? y = (r = e.__c = n.__c).__ = r.__E : (f ? e.__c = r = new x(p, N) : (e.__c = r = new X(p, N), r.constructor = x, r.render = dt), F && F.sub(r), r.state || (r.state = {}), r.__n = o, h = r.__d = !0, r.__h = [], r._sb = []), f && r.__s == null && (r.__s = r.state), f && x.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = E({}, r.__s)), E(r.__s, x.getDerivedStateFromProps(p, r.__s))), g = r.props, v = r.state, r.__v = e, h) f && x.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), f && r.componentDidMount != null && r.__h.push(r.componentDidMount);
112
+ 128 & n.__u && (c = !!(32 & n.__u), i = [_ = e.__e = n.__e]), (u = m.__b) && u(e);
113
+ e: if (typeof N == "function") try {
114
+ if (p = e.props, f = "prototype" in N && N.prototype.render, E = (u = N.contextType) && s[u.__c], $ = u ? E ? E.props.value : u.__ : s, n.__c ? w = (r = e.__c = n.__c).__ = r.__E : (f ? e.__c = r = new N(p, $) : (e.__c = r = new J(p, $), r.constructor = N, r.render = dt), E && E.sub(r), r.state || (r.state = {}), r.__n = s, g = r.__d = !0, r.__h = [], r._sb = []), f && r.__s == null && (r.__s = r.state), f && N.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = T({}, r.__s)), T(r.__s, N.getDerivedStateFromProps(p, r.__s))), h = r.props, v = r.state, r.__v = e, g) f && N.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), f && r.componentDidMount != null && r.__h.push(r.componentDidMount);
115
115
  else {
116
- if (f && x.getDerivedStateFromProps == null && p !== g && r.componentWillReceiveProps != null && r.componentWillReceiveProps(p, N), e.__v == n.__v || !r.__e && r.shouldComponentUpdate != null && r.shouldComponentUpdate(p, r.__s, N) === !1) {
117
- for (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(M) {
118
- M && (M.__ = e);
116
+ if (f && N.getDerivedStateFromProps == null && p !== h && r.componentWillReceiveProps != null && r.componentWillReceiveProps(p, $), e.__v == n.__v || !r.__e && r.shouldComponentUpdate != null && r.shouldComponentUpdate(p, r.__s, $) === !1) {
117
+ for (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(P) {
118
+ P && (P.__ = e);
119
119
  }), H = 0; H < r._sb.length; H++) r.__h.push(r._sb[H]);
120
120
  r._sb = [], r.__h.length && a.push(r);
121
121
  break e;
122
122
  }
123
- r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s, N), f && r.componentDidUpdate != null && r.__h.push(function() {
124
- r.componentDidUpdate(g, v, $);
123
+ r.componentWillUpdate != null && r.componentWillUpdate(p, r.__s, $), f && r.componentDidUpdate != null && r.__h.push(function() {
124
+ r.componentDidUpdate(h, v, k);
125
125
  });
126
126
  }
127
- if (r.context = N, r.props = p, r.__P = t, r.__e = !1, W = m.__r, V = 0, f) {
128
- for (r.state = r.__s, r.__d = !1, W && W(e), u = r.render(r.props, r.state, r.context), A = 0; A < r._sb.length; A++) r.__h.push(r._sb[A]);
127
+ if (r.context = $, r.props = p, r.__P = t, r.__e = !1, S = m.__r, z = 0, f) {
128
+ for (r.state = r.__s, r.__d = !1, S && S(e), u = r.render(r.props, r.state, r.context), A = 0; A < r._sb.length; A++) r.__h.push(r._sb[A]);
129
129
  r._sb = [];
130
130
  } else do
131
- r.__d = !1, W && W(e), u = r.render(r.props, r.state, r.context), r.state = r.__s;
132
- while (r.__d && ++V < 25);
133
- r.state = r.__s, r.getChildContext != null && (o = E(E({}, o), r.getChildContext())), f && !h && r.getSnapshotBeforeUpdate != null && ($ = r.getSnapshotBeforeUpdate(g, v)), I = u, u != null && u.type === R && u.key == null && (I = je(u.props.children)), l = Oe(t, ne(I) ? I : [I], e, n, o, i, s, a, l, c, _), r.base = e.__e, e.__u &= -161, r.__h.length && a.push(r), y && (r.__E = r.__ = null);
134
- } catch (M) {
135
- if (e.__v = null, c || s != null) if (M.then) {
136
- for (e.__u |= c ? 160 : 128; l && l.nodeType == 8 && l.nextSibling; ) l = l.nextSibling;
137
- s[s.indexOf(l)] = null, e.__e = l;
131
+ r.__d = !1, S && S(e), u = r.render(r.props, r.state, r.context), r.state = r.__s;
132
+ while (r.__d && ++z < 25);
133
+ r.state = r.__s, r.getChildContext != null && (s = T(T({}, s), r.getChildContext())), f && !g && r.getSnapshotBeforeUpdate != null && (k = r.getSnapshotBeforeUpdate(h, v)), F = u, u != null && u.type === D && u.key == null && (F = Be(u.props.children)), _ = Re(t, ee(F) ? F : [F], e, n, s, o, i, a, _, c, l), r.base = e.__e, e.__u &= -161, r.__h.length && a.push(r), w && (r.__E = r.__ = null);
134
+ } catch (P) {
135
+ if (e.__v = null, c || i != null) if (P.then) {
136
+ for (e.__u |= c ? 160 : 128; _ && _.nodeType == 8 && _.nextSibling; ) _ = _.nextSibling;
137
+ i[i.indexOf(_)] = null, e.__e = _;
138
138
  } else {
139
- for (U = s.length; U--; ) de(s[U]);
140
- ce(e);
139
+ for (U = i.length; U--; ) ue(i[U]);
140
+ le(e);
141
141
  }
142
- else e.__e = n.__e, e.__k = n.__k, M.then || ce(e);
143
- m.__e(M, e, n);
142
+ else e.__e = n.__e, e.__k = n.__k, P.then || le(e);
143
+ m.__e(P, e, n);
144
144
  }
145
- else s == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : l = e.__e = gt(n.__e, e, n, o, i, s, a, c, _);
146
- return (u = m.diffed) && u(e), 128 & e.__u ? void 0 : l;
145
+ else i == null && e.__v == n.__v ? (e.__k = n.__k, e.__e = n.__e) : _ = e.__e = ht(n.__e, e, n, s, o, i, a, c, l);
146
+ return (u = m.diffed) && u(e), 128 & e.__u ? void 0 : _;
147
147
  }
148
- function ce(t) {
149
- t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(ce);
148
+ function le(t) {
149
+ t && t.__c && (t.__c.__e = !0), t && t.__k && t.__k.forEach(le);
150
150
  }
151
151
  function qe(t, e, n) {
152
- for (var o = 0; o < n.length; o++) fe(n[o], n[++o], n[++o]);
153
- m.__c && m.__c(e, t), t.some(function(i) {
152
+ for (var s = 0; s < n.length; s++) de(n[s], n[++s], n[++s]);
153
+ m.__c && m.__c(e, t), t.some(function(o) {
154
154
  try {
155
- t = i.__h, i.__h = [], t.some(function(s) {
156
- s.call(i);
155
+ t = o.__h, o.__h = [], t.some(function(i) {
156
+ i.call(o);
157
157
  });
158
- } catch (s) {
159
- m.__e(s, i.__v);
158
+ } catch (i) {
159
+ m.__e(i, o.__v);
160
160
  }
161
161
  });
162
162
  }
163
- function je(t) {
164
- return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : ne(t) ? t.map(je) : E({}, t);
163
+ function Be(t) {
164
+ return typeof t != "object" || t == null || t.__b && t.__b > 0 ? t : ee(t) ? t.map(Be) : T({}, t);
165
165
  }
166
- function gt(t, e, n, o, i, s, a, l, c) {
167
- var _, u, r, h, g, v, $, y = n.props || j, p = e.props, f = e.type;
168
- if (f == "svg" ? i = "http://www.w3.org/2000/svg" : f == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i || (i = "http://www.w3.org/1999/xhtml"), s != null) {
169
- for (_ = 0; _ < s.length; _++) if ((g = s[_]) && "setAttribute" in g == !!f && (f ? g.localName == f : g.nodeType == 3)) {
170
- t = g, s[_] = null;
166
+ function ht(t, e, n, s, o, i, a, _, c) {
167
+ var l, u, r, g, h, v, k, w = n.props || q, p = e.props, f = e.type;
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"), i != null) {
169
+ for (l = 0; l < i.length; l++) if ((h = i[l]) && "setAttribute" in h == !!f && (f ? h.localName == f : h.nodeType == 3)) {
170
+ t = h, i[l] = null;
171
171
  break;
172
172
  }
173
173
  }
174
174
  if (t == null) {
175
175
  if (f == null) return document.createTextNode(p);
176
- t = document.createElementNS(i, f, p.is && p), l && (m.__m && m.__m(e, s), l = !1), s = null;
176
+ t = document.createElementNS(o, f, p.is && p), _ && (m.__m && m.__m(e, i), _ = !1), i = null;
177
177
  }
178
- if (f == null) y === p || l && t.data == p || (t.data = p);
178
+ if (f == null) w === p || _ && t.data == p || (t.data = p);
179
179
  else {
180
- if (s = s && z.call(t.childNodes), !l && s != null) for (y = {}, _ = 0; _ < t.attributes.length; _++) y[(g = t.attributes[_]).name] = g.value;
181
- for (_ in y) if (g = y[_], _ != "children") {
182
- if (_ == "dangerouslySetInnerHTML") r = g;
183
- else if (!(_ in p)) {
184
- if (_ == "value" && "defaultValue" in p || _ == "checked" && "defaultChecked" in p) continue;
185
- K(t, _, null, g, i);
180
+ if (i = i && Q.call(t.childNodes), !_ && i != null) for (w = {}, l = 0; l < t.attributes.length; l++) w[(h = t.attributes[l]).name] = h.value;
181
+ for (l in w) if (h = w[l], l != "children") {
182
+ if (l == "dangerouslySetInnerHTML") r = h;
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
186
  }
187
187
  }
188
- for (_ in p) g = p[_], _ == "children" ? h = g : _ == "dangerouslySetInnerHTML" ? u = g : _ == "value" ? v = g : _ == "checked" ? $ = g : l && typeof g != "function" || y[_] === g || K(t, _, g, y[_], i);
189
- if (u) l || r && (u.__html == r.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
190
- else if (r && (t.innerHTML = ""), Oe(e.type == "template" ? t.content : t, ne(h) ? h : [h], e, n, o, f == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, a, s ? s[0] : n.__k && Q(n, 0), l, c), s != null) for (_ = s.length; _--; ) de(s[_]);
191
- l || (_ = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[_] || f == "progress" && !v || f == "option" && v != y[_]) && K(t, _, v, y[_], i), _ = "checked", $ != null && $ != t[_] && K(t, _, $, y[_], i));
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);
189
+ if (u) _ || r && (u.__html == r.__html || u.__html == t.innerHTML) || (t.innerHTML = u.__html), e.__k = [];
190
+ else if (r && (t.innerHTML = ""), Re(e.type == "template" ? t.content : t, ee(g) ? g : [g], e, n, s, f == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, a, i ? i[0] : n.__k && R(n, 0), _, c), i != null) for (l = i.length; l--; ) ue(i[l]);
191
+ _ || (l = "value", f == "progress" && v == null ? t.removeAttribute("value") : v != null && (v !== t[l] || f == "progress" && !v || f == "option" && v != w[l]) && K(t, l, v, w[l], o), l = "checked", k != null && k != t[l] && K(t, l, k, w[l], o));
192
192
  }
193
193
  return t;
194
194
  }
195
- function fe(t, e, n) {
195
+ function de(t, e, n) {
196
196
  try {
197
197
  if (typeof t == "function") {
198
- var o = typeof t.__u == "function";
199
- o && t.__u(), o && e == null || (t.__u = t(e));
198
+ var s = typeof t.__u == "function";
199
+ s && t.__u(), s && e == null || (t.__u = t(e));
200
200
  } else t.current = e;
201
- } catch (i) {
202
- m.__e(i, n);
201
+ } catch (o) {
202
+ m.__e(o, n);
203
203
  }
204
204
  }
205
- function Be(t, e, n) {
206
- var o, i;
207
- if (m.unmount && m.unmount(t), (o = t.ref) && (o.current && o.current != t.__e || fe(o, null, e)), (o = t.__c) != null) {
208
- if (o.componentWillUnmount) try {
209
- o.componentWillUnmount();
210
- } catch (s) {
211
- m.__e(s, e);
205
+ function Qe(t, e, n) {
206
+ var s, o;
207
+ if (m.unmount && m.unmount(t), (s = t.ref) && (s.current && s.current != t.__e || de(s, null, e)), (s = t.__c) != null) {
208
+ if (s.componentWillUnmount) try {
209
+ s.componentWillUnmount();
210
+ } catch (i) {
211
+ m.__e(i, e);
212
212
  }
213
- o.base = o.__P = null;
213
+ s.base = s.__P = null;
214
214
  }
215
- if (o = t.__k) for (i = 0; i < o.length; i++) o[i] && Be(o[i], e, n || typeof t.type != "function");
216
- n || de(t.__e), t.__c = t.__ = t.__e = void 0;
215
+ if (s = t.__k) for (o = 0; o < s.length; o++) s[o] && Qe(s[o], e, n || typeof t.type != "function");
216
+ n || ue(t.__e), t.__c = t.__ = t.__e = void 0;
217
217
  }
218
218
  function dt(t, e, n) {
219
219
  return this.constructor(t, n);
220
220
  }
221
- function oe(t, e, n) {
222
- var o, i, s, a;
223
- e == document && (e = document.documentElement), m.__ && m.__(t, e), i = (o = typeof n == "function") ? null : n && n.__k || e.__k, s = [], a = [], he(e, t = (!o && n || e).__k = O(R, null, [t]), i || j, j, e.namespaceURI, !o && n ? [n] : i ? null : e.firstChild ? z.call(e.childNodes) : null, s, !o && n ? n : i ? i.__e : e.firstChild, o, a), qe(s, t, a);
221
+ function te(t, e, n) {
222
+ var s, o, i, a;
223
+ e == document && (e = document.documentElement), m.__ && m.__(t, e), o = (s = typeof n == "function") ? null : n && n.__k || e.__k, i = [], a = [], he(e, t = (!s && n || e).__k = L(D, null, [t]), o || q, q, e.namespaceURI, !s && n ? [n] : o ? null : e.firstChild ? Q.call(e.childNodes) : null, i, !s && n ? n : o ? o.__e : e.firstChild, s, a), qe(i, t, a);
224
224
  }
225
225
  function ze(t, e) {
226
- oe(t, e, ze);
226
+ te(t, e, ze);
227
227
  }
228
- function Ve(t, e, n) {
229
- var o, i, s, a, l = E({}, t.props);
230
- for (s in t.type && t.type.defaultProps && (a = t.type.defaultProps), e) s == "key" ? o = e[s] : s == "ref" ? i = e[s] : l[s] = e[s] === void 0 && a != null ? a[s] : e[s];
231
- return arguments.length > 2 && (l.children = arguments.length > 3 ? z.call(arguments, 2) : n), q(t.type, l, o || t.key, i || t.ref, null);
228
+ function je(t, e, n) {
229
+ var s, o, i, a, _ = T({}, t.props);
230
+ for (i in t.type && t.type.defaultProps && (a = t.type.defaultProps), e) i == "key" ? s = e[i] : i == "ref" ? o = e[i] : _[i] = e[i] === void 0 && a != null ? a[i] : e[i];
231
+ return arguments.length > 2 && (_.children = arguments.length > 3 ? Q.call(arguments, 2) : n), O(t.type, _, s || t.key, o || t.ref, null);
232
232
  }
233
- z = Re.slice, m = { __e: function(t, e, n, o) {
234
- for (var i, s, a; e = e.__; ) if ((i = e.__c) && !i.__) try {
235
- if ((s = i.constructor) && s.getDerivedStateFromError != null && (i.setState(s.getDerivedStateFromError(t)), a = i.__d), i.componentDidCatch != null && (i.componentDidCatch(t, o || {}), a = i.__d), a) return i.__E = i;
236
- } catch (l) {
237
- t = l;
233
+ Q = De.slice, m = { __e: function(t, e, n, s) {
234
+ for (var o, i, a; e = e.__; ) if ((o = e.__c) && !o.__) try {
235
+ if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(t)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(t, s || {}), a = o.__d), a) return o.__E = o;
236
+ } catch (_) {
237
+ t = _;
238
238
  }
239
239
  throw t;
240
- } }, He = 0, X.prototype.setState = function(t, e) {
240
+ } }, He = 0, J.prototype.setState = function(t, e) {
241
241
  var n;
242
- n = this.__s != null && this.__s != this.state ? this.__s : this.__s = E({}, this.state), typeof t == "function" && (t = t(E({}, n), this.props)), t && E(n, t), t != null && this.__v && (e && this._sb.push(e), ve(this));
243
- }, X.prototype.forceUpdate = function(t) {
242
+ n = this.__s != null && this.__s != this.state ? this.__s : this.__s = T({}, this.state), typeof t == "function" && (t = t(T({}, n), this.props)), t && T(n, t), t != null && this.__v && (e && this._sb.push(e), ve(this));
243
+ }, J.prototype.forceUpdate = function(t) {
244
244
  this.__v && (this.__e = !0, t && this.__h.push(t), ve(this));
245
- }, X.prototype.render = R, D = [], Ie = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ue = function(t, e) {
245
+ }, J.prototype.render = D, I = [], Fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Ue = function(t, e) {
246
246
  return t.__v.__b - e.__v.__b;
247
- }, Z.__r = 0, De = /(PointerCapture)$|Capture$/i, ge = 0, le = Ce(!1), _e = Ce(!0);
248
- function ee() {
249
- return ee = Object.assign ? Object.assign.bind() : function(t) {
247
+ }, X.__r = 0, Ie = /(PointerCapture)$|Capture$/i, ce = 0, re = be(!1), ae = be(!0);
248
+ function Y() {
249
+ return Y = Object.assign ? Object.assign.bind() : function(t) {
250
250
  for (var e = 1; e < arguments.length; e++) {
251
251
  var n = arguments[e];
252
- for (var o in n) Object.prototype.hasOwnProperty.call(n, o) && (t[o] = n[o]);
252
+ for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && (t[s] = n[s]);
253
253
  }
254
254
  return t;
255
- }, ee.apply(this, arguments);
255
+ }, Y.apply(this, arguments);
256
256
  }
257
- function Je(t, e) {
257
+ function Ve(t, e) {
258
258
  if (t == null) return {};
259
- var n, o, i = {}, s = Object.keys(t);
260
- for (o = 0; o < s.length; o++) e.indexOf(n = s[o]) >= 0 || (i[n] = t[n]);
261
- return i;
259
+ var n, s, o = {}, i = Object.keys(t);
260
+ for (s = 0; s < i.length; s++) e.indexOf(n = i[s]) >= 0 || (o[n] = t[n]);
261
+ return o;
262
262
  }
263
- var ht = ["context", "children"], ft = ["useFragment"];
264
- function pt(t, e, n, o) {
265
- function i() {
266
- var s = Reflect.construct(HTMLElement, [], i);
267
- return s._vdomComponent = t, s._root = s, s;
263
+ var gt = ["context", "children"], ft = ["useFragment"];
264
+ function pt(t, e, n, s) {
265
+ function o() {
266
+ var i, a = Reflect.construct(HTMLElement, [], o);
267
+ return a._vdomComponent = t, s && s.shadow ? (a._root = a.attachShadow({ mode: s.mode || "open", serializable: (i = s.serializable) != null && i }), s.adoptedStyleSheets && (a._root.adoptedStyleSheets = s.adoptedStyleSheets)) : a._root = a, a;
268
268
  }
269
- return (i.prototype = Object.create(HTMLElement.prototype)).constructor = i, i.prototype.connectedCallback = function() {
270
- yt.call(this, o);
271
- }, i.prototype.attributeChangedCallback = wt, i.prototype.disconnectedCallback = vt, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), i.observedAttributes = n, t.formAssociated && (i.formAssociated = !0), n.forEach(function(s) {
272
- Object.defineProperty(i.prototype, s, { get: function() {
273
- return this._vdom ? this._vdom.props[s] : this._props[s];
269
+ return (o.prototype = Object.create(HTMLElement.prototype)).constructor = o, o.prototype.connectedCallback = function() {
270
+ yt.call(this, s);
271
+ }, o.prototype.attributeChangedCallback = vt, o.prototype.disconnectedCallback = wt, n = n || t.observedAttributes || Object.keys(t.propTypes || {}), o.observedAttributes = n, t.formAssociated && (o.formAssociated = !0), n.forEach(function(i) {
272
+ Object.defineProperty(o.prototype, i, { get: function() {
273
+ return this._vdom ? this._vdom.props[i] : this._props[i];
274
274
  }, set: function(a) {
275
- this._vdom ? this.attributeChangedCallback(s, null, a) : (this._props || (this._props = {}), this._props[s] = a);
276
- var l = typeof a;
277
- a != null && l !== "string" && l !== "boolean" && l !== "number" || this.setAttribute(s, a);
275
+ this._vdom ? this.attributeChangedCallback(i, null, a) : (this._props || (this._props = {}), this._props[i] = a);
276
+ var _ = typeof a;
277
+ a != null && _ !== "string" && _ !== "boolean" && _ !== "number" || this.setAttribute(i, a);
278
278
  } });
279
- }), customElements.define(e, i), i;
279
+ }), customElements.define(e, o), o;
280
280
  }
281
281
  function mt(t) {
282
282
  this.getChildContext = function() {
283
283
  return t.context;
284
284
  };
285
- var e = t.children, n = Je(t, ht);
286
- return Ve(e, n);
285
+ var e = t.children, n = Ve(t, gt);
286
+ return je(e, n);
287
287
  }
288
288
  function yt(t) {
289
289
  var e = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
290
- this.dispatchEvent(e), this._vdom = O(mt, ee({}, this._props, { context: e.detail.context }), Ge(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? ze : oe)(this._vdom, this._root);
290
+ this.dispatchEvent(e), this._vdom = L(mt, Y({}, this._props, { context: e.detail.context }), Je(this, this._vdomComponent, t)), (this.hasAttribute("hydrate") ? ze : te)(this._vdom, this._root);
291
291
  }
292
292
  function Ke(t) {
293
293
  return t.replace(/-(\w)/g, function(e, n) {
294
294
  return n ? n.toUpperCase() : "";
295
295
  });
296
296
  }
297
- function wt(t, e, n) {
297
+ function vt(t, e, n) {
298
298
  if (this._vdom) {
299
- var o = {};
300
- o[t] = n = n ?? void 0, o[Ke(t)] = n, this._vdom = Ve(this._vdom, o), oe(this._vdom, this._root);
299
+ var s = {};
300
+ s[t] = n = n ?? void 0, s[Ke(t)] = n, this._vdom = je(this._vdom, s), te(this._vdom, this._root);
301
301
  }
302
302
  }
303
- function vt() {
304
- oe(this._vdom = null, this._root);
303
+ function wt() {
304
+ te(this._vdom = null, this._root);
305
305
  }
306
- function ke(t, e) {
307
- var n = this, o = t.useFragment, i = Je(t, ft);
308
- return O(o ? R : "slot", ee({}, i, { ref: function(s) {
309
- s ? (n.ref = s, n._listener || (n._listener = function(a) {
306
+ function Ce(t, e) {
307
+ var n = this, s = t.useFragment, o = Ve(t, ft);
308
+ return L(s ? D : "slot", Y({}, o, { ref: function(i) {
309
+ i ? (n.ref = i, n._listener || (n._listener = function(a) {
310
310
  a.stopPropagation(), a.detail.context = e;
311
- }, s.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
311
+ }, i.addEventListener("_preact", n._listener))) : n.ref.removeEventListener("_preact", n._listener);
312
312
  } }));
313
313
  }
314
- function Ge(t, e, n) {
314
+ function Je(t, e, n) {
315
315
  if (t.nodeType === 3) return t.data;
316
316
  if (t.nodeType !== 1) return null;
317
- var o = [], i = {}, s = 0, a = t.attributes, l = t.childNodes;
318
- for (s = a.length; s--; ) a[s].name !== "slot" && (i[a[s].name] = a[s].value, i[Ke(a[s].name)] = a[s].value);
319
- for (s = l.length; s--; ) {
320
- var c = Ge(l[s], null, n), _ = l[s].slot;
321
- _ ? i[_] = O(ke, { name: _ }, c) : o[s] = c;
317
+ var s = [], o = {}, i = 0, a = t.attributes, _ = t.childNodes;
318
+ for (i = a.length; i--; ) a[i].name !== "slot" && (o[a[i].name] = a[i].value, o[Ke(a[i].name)] = a[i].value);
319
+ for (i = _.length; i--; ) {
320
+ var c = Je(_[i], null, n), l = _[i].slot;
321
+ l ? o[l] = L(Ce, { name: l }, c) : s[i] = c;
322
322
  }
323
- var u = !(!n || !n.shadow), r = e ? O(ke, { useFragment: !u }, o) : o;
324
- return !u && e && (t.innerHTML = ""), O(e || t.nodeName.toLowerCase(), i, r);
323
+ var u = !(!n || !n.shadow), r = e ? L(Ce, { useFragment: !u }, s) : s;
324
+ return !u && e && (t.innerHTML = ""), L(e || t.nodeName.toLowerCase(), o, r);
325
325
  }
326
326
  var bt = 0;
327
- function d(t, e, n, o, i, s) {
327
+ function d(t, e, n, s, o, i) {
328
328
  e || (e = {});
329
- var a, l, c = e;
330
- if ("ref" in c) for (l in c = {}, e) l == "ref" ? a = e[l] : c[l] = e[l];
331
- var _ = { type: t, props: c, key: n, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --bt, __i: -1, __u: 0, __source: i, __self: s };
332
- if (typeof t == "function" && (a = t.defaultProps)) for (l in a) c[l] === void 0 && (c[l] = a[l]);
333
- return m.vnode && m.vnode(_), _;
329
+ var a, _, c = e;
330
+ 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: --bt, __i: -1, __u: 0, __source: o, __self: i };
332
+ if (typeof t == "function" && (a = t.defaultProps)) for (_ in a) c[_] === void 0 && (c[_] = a[_]);
333
+ return m.vnode && m.vnode(l), l;
334
334
  }
335
- var B, w, re, Ae, te = 0, Xe = [], C = m, Se = C.__b, $e = C.__r, We = C.diffed, Ne = C.__c, xe = C.unmount, Me = C.__;
336
- function pe(t, e) {
337
- C.__h && C.__h(w, t, te || e), te = 0;
338
- var n = w.__H || (w.__H = { __: [], __h: [] });
335
+ var B, y, se, ke, Z = 0, Ge = [], C = m, Se = C.__b, Ae = C.__r, $e = C.diffed, Ne = C.__c, xe = C.unmount, Pe = C.__;
336
+ function ge(t, e) {
337
+ C.__h && C.__h(y, t, Z || e), Z = 0;
338
+ var n = y.__H || (y.__H = { __: [], __h: [] });
339
339
  return t >= n.__.length && n.__.push({}), n.__[t];
340
340
  }
341
- function T(t) {
342
- return te = 1, Ct(Ze, t);
341
+ function M(t) {
342
+ return Z = 1, Ct(Ye, t);
343
343
  }
344
344
  function Ct(t, e, n) {
345
- var o = pe(B++, 2);
346
- if (o.t = t, !o.__c && (o.__ = [Ze(void 0, e), function(l) {
347
- var c = o.__N ? o.__N[0] : o.__[0], _ = o.t(c, l);
348
- c !== _ && (o.__N = [_, o.__[1]], o.__c.setState({}));
349
- }], o.__c = w, !w.__f)) {
350
- var i = function(l, c, _) {
351
- if (!o.__c.__H) return !0;
352
- var u = o.__c.__H.__.filter(function(h) {
353
- return !!h.__c;
345
+ var s = ge(B++, 2);
346
+ if (s.t = t, !s.__c && (s.__ = [Ye(void 0, e), function(_) {
347
+ var c = s.__N ? s.__N[0] : s.__[0], l = s.t(c, _);
348
+ c !== l && (s.__N = [l, s.__[1]], s.__c.setState({}));
349
+ }], s.__c = y, !y.__f)) {
350
+ var o = function(_, c, l) {
351
+ if (!s.__c.__H) return !0;
352
+ var u = s.__c.__H.__.filter(function(g) {
353
+ return !!g.__c;
354
354
  });
355
- if (u.every(function(h) {
356
- return !h.__N;
357
- })) return !s || s.call(this, l, c, _);
358
- var r = o.__c.props !== l;
359
- return u.forEach(function(h) {
360
- if (h.__N) {
361
- var g = h.__[0];
362
- h.__ = h.__N, h.__N = void 0, g !== h.__[0] && (r = !0);
355
+ if (u.every(function(g) {
356
+ return !g.__N;
357
+ })) return !i || i.call(this, _, c, l);
358
+ var r = s.__c.props !== _;
359
+ return u.forEach(function(g) {
360
+ if (g.__N) {
361
+ var h = g.__[0];
362
+ g.__ = g.__N, g.__N = void 0, h !== g.__[0] && (r = !0);
363
363
  }
364
- }), s && s.call(this, l, c, _) || r;
364
+ }), i && i.call(this, _, c, l) || r;
365
365
  };
366
- w.__f = !0;
367
- var s = w.shouldComponentUpdate, a = w.componentWillUpdate;
368
- w.componentWillUpdate = function(l, c, _) {
366
+ y.__f = !0;
367
+ var i = y.shouldComponentUpdate, a = y.componentWillUpdate;
368
+ y.componentWillUpdate = function(_, c, l) {
369
369
  if (this.__e) {
370
- var u = s;
371
- s = void 0, i(l, c, _), s = u;
370
+ var u = i;
371
+ i = void 0, o(_, c, l), i = u;
372
372
  }
373
- a && a.call(this, l, c, _);
374
- }, w.shouldComponentUpdate = i;
373
+ a && a.call(this, _, c, l);
374
+ }, y.shouldComponentUpdate = o;
375
375
  }
376
- return o.__N || o.__;
376
+ return s.__N || s.__;
377
377
  }
378
- function Fe(t, e) {
379
- var n = pe(B++, 3);
380
- !C.__s && Ye(n.__H, e) && (n.__ = t, n.u = e, w.__H.__h.push(n));
378
+ function Ee(t, e) {
379
+ var n = ge(B++, 3);
380
+ !C.__s && Xe(n.__H, e) && (n.__ = t, n.u = e, y.__H.__h.push(n));
381
381
  }
382
- function Pe(t) {
383
- return te = 5, kt(function() {
382
+ function We(t) {
383
+ return Z = 5, kt(function() {
384
384
  return { current: t };
385
385
  }, []);
386
386
  }
387
387
  function kt(t, e) {
388
- var n = pe(B++, 7);
389
- return Ye(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
388
+ var n = ge(B++, 7);
389
+ return Xe(n.__H, e) && (n.__ = t(), n.__H = e, n.__h = t), n.__;
390
390
  }
391
- function At() {
392
- for (var t; t = Xe.shift(); ) if (t.__P && t.__H) try {
393
- t.__H.__h.forEach(Y), t.__H.__h.forEach(ue), t.__H.__h = [];
391
+ function St() {
392
+ for (var t; t = Ge.shift(); ) if (t.__P && t.__H) try {
393
+ t.__H.__h.forEach(G), t.__H.__h.forEach(_e), t.__H.__h = [];
394
394
  } catch (e) {
395
395
  t.__H.__h = [], C.__e(e, t.__v);
396
396
  }
397
397
  }
398
398
  C.__b = function(t) {
399
- w = null, Se && Se(t);
399
+ y = null, Se && Se(t);
400
400
  }, C.__ = function(t, e) {
401
- t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Me && Me(t, e);
401
+ t && e.__k && e.__k.__m && (t.__m = e.__k.__m), Pe && Pe(t, e);
402
402
  }, C.__r = function(t) {
403
- $e && $e(t), B = 0;
404
- var e = (w = t.__c).__H;
405
- e && (re === w ? (e.__h = [], w.__h = [], e.__.forEach(function(n) {
403
+ Ae && Ae(t), B = 0;
404
+ var e = (y = t.__c).__H;
405
+ e && (se === y ? (e.__h = [], y.__h = [], e.__.forEach(function(n) {
406
406
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
407
- })) : (e.__h.forEach(Y), e.__h.forEach(ue), e.__h = [], B = 0)), re = w;
407
+ })) : (e.__h.forEach(G), e.__h.forEach(_e), e.__h = [], B = 0)), se = y;
408
408
  }, C.diffed = function(t) {
409
- We && We(t);
409
+ $e && $e(t);
410
410
  var e = t.__c;
411
- e && e.__H && (e.__H.__h.length && (Xe.push(e) !== 1 && Ae === C.requestAnimationFrame || ((Ae = C.requestAnimationFrame) || St)(At)), e.__H.__.forEach(function(n) {
411
+ e && e.__H && (e.__H.__h.length && (Ge.push(e) !== 1 && ke === C.requestAnimationFrame || ((ke = C.requestAnimationFrame) || At)(St)), e.__H.__.forEach(function(n) {
412
412
  n.u && (n.__H = n.u), n.u = void 0;
413
- })), re = w = null;
413
+ })), se = y = null;
414
414
  }, C.__c = function(t, e) {
415
415
  e.some(function(n) {
416
416
  try {
417
- n.__h.forEach(Y), n.__h = n.__h.filter(function(o) {
418
- return !o.__ || ue(o);
417
+ n.__h.forEach(G), n.__h = n.__h.filter(function(s) {
418
+ return !s.__ || _e(s);
419
419
  });
420
- } catch (o) {
421
- e.some(function(i) {
422
- i.__h && (i.__h = []);
423
- }), e = [], C.__e(o, n.__v);
420
+ } catch (s) {
421
+ e.some(function(o) {
422
+ o.__h && (o.__h = []);
423
+ }), e = [], C.__e(s, n.__v);
424
424
  }
425
425
  }), Ne && Ne(t, e);
426
426
  }, C.unmount = function(t) {
427
427
  xe && xe(t);
428
428
  var e, n = t.__c;
429
- n && n.__H && (n.__H.__.forEach(function(o) {
429
+ n && n.__H && (n.__H.__.forEach(function(s) {
430
430
  try {
431
- Y(o);
432
- } catch (i) {
433
- e = i;
431
+ G(s);
432
+ } catch (o) {
433
+ e = o;
434
434
  }
435
435
  }), n.__H = void 0, e && C.__e(e, n.__v));
436
436
  };
437
- var Ee = typeof requestAnimationFrame == "function";
438
- function St(t) {
437
+ var Me = typeof requestAnimationFrame == "function";
438
+ function At(t) {
439
439
  var e, n = function() {
440
- clearTimeout(o), Ee && cancelAnimationFrame(e), setTimeout(t);
441
- }, o = setTimeout(n, 35);
442
- Ee && (e = requestAnimationFrame(n));
440
+ clearTimeout(s), Me && cancelAnimationFrame(e), setTimeout(t);
441
+ }, s = setTimeout(n, 35);
442
+ Me && (e = requestAnimationFrame(n));
443
443
  }
444
- function Y(t) {
445
- var e = w, n = t.__c;
446
- typeof n == "function" && (t.__c = void 0, n()), w = e;
444
+ function G(t) {
445
+ var e = y, n = t.__c;
446
+ typeof n == "function" && (t.__c = void 0, n()), y = e;
447
447
  }
448
- function ue(t) {
449
- var e = w;
450
- t.__c = t.__(), w = e;
448
+ function _e(t) {
449
+ var e = y;
450
+ t.__c = t.__(), y = e;
451
451
  }
452
- function Ye(t, e) {
453
- return !t || t.length !== e.length || e.some(function(n, o) {
454
- return n !== t[o];
452
+ function Xe(t, e) {
453
+ return !t || t.length !== e.length || e.some(function(n, s) {
454
+ return n !== t[s];
455
455
  });
456
456
  }
457
- function Ze(t, e) {
457
+ function Ye(t, e) {
458
458
  return typeof e == "function" ? e(t) : e;
459
459
  }
460
460
  const $t = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
461
- let G = (t = 21) => {
461
+ let ie = (t = 21) => {
462
462
  let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
463
463
  for (; t--; )
464
464
  e += $t[n[t] & 63];
465
465
  return e;
466
466
  };
467
- class Wt {
467
+ class Nt {
468
468
  constructor(e, n) {
469
- this.agentUrl = e, this.agentId = n, this.agentConfig = null, this.ws = null, this.messageCallbacks = /* @__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.reconnectAttempts = 0, this.maxReconnectAttempts = 5, this.reconnectDelay = 1e3, this.isAgentStreaming = !1, this.isAgentProcessing = !1, this.messageQueue = [];
469
+ 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
470
  }
471
471
  /**
472
472
  * Initialize the widget by fetching agent configuration
473
473
  */
474
474
  async initWidget() {
475
475
  try {
476
- console.log("[AriaFlow Widget] Fetching agent config...", { agentUrl: this.agentUrl, agentId: this.agentId });
477
476
  try {
478
- const n = await fetch(`${this.agentUrl}/api/agent/${this.agentId}`);
479
- if (n.ok) {
480
- const o = await n.json();
481
- return console.log("[AriaFlow Widget] Agent config received:", o), !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);
477
+ const s = await fetch(`${this.normalizeBaseUrl(this.agentUrl)}/api/agent/${this.agentId}`);
478
+ if (s.ok) {
479
+ const o = await s.json();
480
+ 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);
482
481
  }
483
482
  } catch {
484
483
  console.warn("[AriaFlow Widget] Agent config endpoint not available, trying fallback");
485
484
  }
486
- console.log("[AriaFlow Widget] Using fallback config for Railway deployment");
487
- const e = {
485
+ const e = this.toWebSocketBaseUrl(this.normalizeBaseUrl(this.agentUrl)), n = {
488
486
  id: this.agentId,
489
487
  name: this.agentId === "hospital" ? "Hospital Support" : "Support Agent",
490
- wsUrl: `${this.agentUrl.replace(/^https/, "wss")}/ws`,
488
+ wsUrl: `${e}/agents/chat`,
491
489
  status: "active",
492
490
  capabilities: ["chat", "streaming"],
493
491
  config: {
@@ -500,7 +498,7 @@ class Wt {
500
498
  reconnectDelay: 1e3
501
499
  }
502
500
  };
503
- return this.agentConfig = e, await this.connectToAgent(), e;
501
+ return this.agentConfig = n, await this.connectToAgent(), n;
504
502
  } catch (e) {
505
503
  return console.error("Failed to initialize widget:", e), null;
506
504
  }
@@ -511,24 +509,26 @@ class Wt {
511
509
  async connectToAgent() {
512
510
  if (!this.agentConfig?.wsUrl)
513
511
  throw new Error("No agent WebSocket URL configured");
514
- const e = this.getSessionId(), n = `${this.agentConfig.wsUrl}/${e}`;
515
- return console.log("[AriaFlow Widget] Connecting to WebSocket:", n), new Promise((o, i) => {
512
+ if (this.disposed)
513
+ return;
514
+ const e = this.getSessionId(), n = `${this.normalizeBaseUrl(this.agentConfig.wsUrl)}/${e}`;
515
+ return new Promise((s, o) => {
516
516
  try {
517
517
  this.ws = new WebSocket(n), this.ws.onopen = () => {
518
- console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0), o();
519
- }, this.ws.onmessage = (s) => {
520
- this.handleMessage(s);
518
+ console.log("[Widget] Connected to agent"), this.reconnectAttempts = 0, this.notifyConnectionChange(!0), s();
519
+ }, this.ws.onmessage = (i) => {
520
+ this.handleMessage(i);
521
521
  }, this.ws.onclose = () => {
522
- if (console.log("[Widget] Disconnected from agent"), this.notifyConnectionChange(!1), this.reconnectAttempts < this.maxReconnectAttempts) {
522
+ if (this.ws = null, this.notifyConnectionChange(!1), !this.disposed && this.reconnectAttempts < this.maxReconnectAttempts) {
523
523
  this.reconnectAttempts++;
524
- const s = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);
525
- console.log(`[Widget] Reconnecting in ${s}ms... (attempt ${this.reconnectAttempts})`), setTimeout(() => this.connectToAgent(), s);
524
+ const i = this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1);
525
+ console.log(`[Widget] Reconnecting in ${i}ms... (attempt ${this.reconnectAttempts})`), setTimeout(() => this.connectToAgent(), i);
526
526
  }
527
- }, this.ws.onerror = (s) => {
528
- console.error("[Widget] WebSocket error:", s), i(s);
527
+ }, this.ws.onerror = (i) => {
528
+ console.error("[Widget] WebSocket error:", i), o(i);
529
529
  };
530
- } catch (s) {
531
- i(s);
530
+ } catch (i) {
531
+ o(i);
532
532
  }
533
533
  });
534
534
  }
@@ -549,16 +549,18 @@ class Wt {
549
549
  handleMessage(e) {
550
550
  try {
551
551
  const n = JSON.parse(e.data);
552
- if (n.type === "text-delta")
553
- this.isAgentProcessing && this.notifyProcessingChange(!1), this.setMessages((o) => {
554
- const i = o[o.length - 1];
555
- return i && i.role === "assistant" && i.isStreaming ? [
556
- ...o.slice(0, -1),
557
- { ...i, content: i.content + n.text }
552
+ if (n.type === "connected")
553
+ this.notifyConnectionChange(!0);
554
+ else if (n.type === "text-delta")
555
+ this.isAgentProcessing && this.notifyProcessingChange(!1), this.setMessages((s) => {
556
+ const o = s[s.length - 1];
557
+ return o && o.role === "assistant" && o.isStreaming ? [
558
+ ...s.slice(0, -1),
559
+ { ...o, content: o.content + n.text }
558
560
  ] : [
559
- ...o,
561
+ ...s,
560
562
  {
561
- id: G(),
563
+ id: ie(),
562
564
  role: "assistant",
563
565
  content: n.text,
564
566
  timestamp: Date.now(),
@@ -567,47 +569,21 @@ class Wt {
567
569
  ];
568
570
  });
569
571
  else if (n.type === "done")
570
- console.log("[Widget] Response complete"), this.notifyProcessingChange(!1), this.setMessages((o) => {
571
- const i = o[o.length - 1];
572
- return i && i.role === "assistant" && i.isStreaming ? [
573
- ...o.slice(0, -1),
574
- { ...i, isStreaming: !1 }
575
- ] : o;
572
+ this.notifyProcessingChange(!1), this.setMessages((s) => {
573
+ const o = s[s.length - 1];
574
+ return o && o.role === "assistant" && o.isStreaming ? [
575
+ ...s.slice(0, -1),
576
+ { ...o, isStreaming: !1 }
577
+ ] : s;
576
578
  }), this.isAgentStreaming = !1, this.notifyStreamingChange(!1), this.processMessageQueue();
577
579
  else if (n.type === "step-start" || n.type === "agent-start")
578
- console.log(`[Widget] ${n.type} received:`, n.agentId || ""), this.isAgentStreaming = !0, this.notifyStreamingChange(!0), this.notifyProcessingChange(!0);
580
+ this.isAgentStreaming = !0, this.notifyStreamingChange(!0), this.notifyProcessingChange(!0);
579
581
  else if (n.type === "step-end" || n.type === "agent-end")
580
- console.log(`[Widget] ${n.type} received`), n.type === "agent-end" && this.notifyProcessingChange(!1);
582
+ n.type === "agent-end" && this.notifyProcessingChange(!1);
581
583
  else if (n.type === "tool-call") {
582
- const o = n.tool?.name || n.toolName, i = n.tool?.arguments || n.args;
583
- console.log("[Widget] Tool call:", { name: o, args: i }), this.notifyProcessingChange(!0);
584
- const s = {
585
- id: G(),
586
- role: "tool",
587
- content: `Calling tool: ${o}`,
588
- timestamp: Date.now(),
589
- toolCall: {
590
- name: o,
591
- arguments: i
592
- }
593
- };
594
- this.setMessages((a) => [...a, s]), o === "suggest_options" && i?.options && this.setMessages((a) => {
595
- const l = [...a].reverse().find((c) => c.role === "assistant");
596
- return l ? a.map(
597
- (c) => c.id === l.id ? { ...c, suggestions: i.options } : c
598
- ) : a;
599
- });
600
- } else n.type === "tool-result" ? (console.log("[Widget] Tool result:", n.result), this.setMessages((o) => {
601
- const i = o[o.length - 1];
602
- return i && i.role === "tool" && !i.toolResult ? [
603
- ...o.slice(0, -1),
604
- { ...i, content: i.content + `
605
- Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
606
- ] : o;
607
- })) : n.type === "agent-start" ? (console.log(`[Widget] Agent started: ${n.agentId}`), this.isAgentStreaming = !0, this.notifyStreamingChange(!0)) : n.type === "handoff" ? console.log(`[Widget] Handoff: ${n.from} -> ${n.to}: ${n.reason}`) : n.type === "suggested-questions" ? (console.log("[Widget] Suggestions received:", n.suggestions), this.setMessages((o) => {
608
- const i = [...o].reverse().find((s) => s.role === "assistant");
609
- return i ? o.map((s) => s.id === i.id ? { ...s, suggestions: n.suggestions } : s) : o;
610
- })) : console.log("[Widget] Unknown message type:", n.type);
584
+ const s = n.tool?.name || n.toolName, o = n.tool?.arguments || n.args;
585
+ this.notifyProcessingChange(!0), s === "suggest_options" && o?.options && this.setActiveSuggestions(o.options);
586
+ } 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));
611
587
  } catch (n) {
612
588
  console.error("[Widget] Error parsing message:", e.data, n);
613
589
  }
@@ -618,13 +594,14 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
618
594
  async sendMessage(e) {
619
595
  if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
620
596
  throw new Error("Not connected to agent");
597
+ this.setActiveSuggestions([]);
621
598
  const n = {
622
- id: G(),
599
+ id: ie(),
623
600
  role: "user",
624
601
  content: e,
625
602
  timestamp: Date.now()
626
603
  };
627
- if (this.setMessages((o) => [...o, n]), this.isAgentStreaming) {
604
+ if (this.setMessages((s) => [...s, n]), this.isAgentStreaming) {
628
605
  console.log("[Widget] Agent is streaming, queuing message"), this.messageQueue.push(e), this.notifyQueueChange(this.messageQueue.length);
629
606
  return;
630
607
  }
@@ -659,7 +636,7 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
659
636
  */
660
637
  getSessionId() {
661
638
  let e = sessionStorage.getItem("ariaflow_session_id");
662
- return e || (e = G(), sessionStorage.setItem("ariaflow_session_id", e)), e;
639
+ return e || (e = ie(), sessionStorage.setItem("ariaflow_session_id", e)), e;
663
640
  }
664
641
  /**
665
642
  * Update messages state
@@ -717,6 +694,32 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
717
694
  notifyQueueChange(e) {
718
695
  this.queueCallbacks.forEach((n) => n(e));
719
696
  }
697
+ /**
698
+ * Register a callback for active suggestion updates
699
+ */
700
+ onSuggestionsChange(e) {
701
+ return this.suggestionsCallbacks.add(e), e(this.activeSuggestions), () => {
702
+ this.suggestionsCallbacks.delete(e);
703
+ };
704
+ }
705
+ /**
706
+ * Normalize and notify suggestion changes
707
+ */
708
+ setActiveSuggestions(e) {
709
+ const n = Array.isArray(e) ? e.filter((o) => typeof o == "string").map((o) => o.trim()).filter(Boolean) : [], s = [...new Set(n)];
710
+ this.activeSuggestions = s, this.suggestionsCallbacks.forEach((o) => o(s));
711
+ }
712
+ normalizeBaseUrl(e) {
713
+ return e.replace(/\/+$/, "");
714
+ }
715
+ toWebSocketBaseUrl(e) {
716
+ try {
717
+ const n = new URL(e);
718
+ return n.protocol === "https:" ? n.protocol = "wss:" : n.protocol === "http:" && (n.protocol = "ws:"), n.toString().replace(/\/+$/, "");
719
+ } catch {
720
+ return e.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://").replace(/\/+$/, "");
721
+ }
722
+ }
720
723
  /**
721
724
  * Get current messages
722
725
  */
@@ -739,95 +742,86 @@ Result: ${JSON.stringify(n.result)}`, toolResult: n.result }
739
742
  * Disconnect and cleanup
740
743
  */
741
744
  dispose() {
742
- this.ws && (this.ws.close(), this.ws = null), this.messageCallbacks.clear(), this.connectionCallbacks.clear();
745
+ 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();
743
746
  }
744
747
  }
745
- const ae = {
748
+ const oe = {
746
749
  none: "0",
747
750
  small: "0.375rem",
748
751
  medium: "0.75rem",
749
752
  large: "1rem"
750
753
  };
751
- function Nt({
754
+ function xt({
752
755
  agentUrl: t,
753
756
  agentId: e,
754
757
  // Legacy props for backward compatibility
755
758
  widgetId: n,
756
- apiUrl: o,
757
- mode: i = "chat",
758
- theme: s = "light",
759
+ apiUrl: s,
760
+ mode: o = "chat",
761
+ theme: i = "light",
759
762
  position: a = "bottom-right",
760
- size: l = "full",
763
+ size: _ = "full",
761
764
  radius: c = "medium",
762
- baseColor: _,
765
+ baseColor: l,
763
766
  accentColor: u = "#14B8A6",
764
767
  buttonBaseColor: r = "#000000",
765
- buttonAccentColor: h = "#FFFFFF",
766
- title: g,
768
+ buttonAccentColor: g = "#FFFFFF",
769
+ title: h,
767
770
  subtitle: v,
768
- emptyChatMessage: $
771
+ emptyChatMessage: k
769
772
  }) {
770
- const [y, p] = T(!1), [f, F] = T([]), [N, H] = T(""), [W, V] = T(!1), [A, I] = T(!1), [U, x] = T(null), [M, et] = T(!1), [tt, nt] = T(!1), [se, ot] = T(0), J = Pe(null), me = Pe(null);
771
- Fe(() => ((async () => {
773
+ const [w, p] = M(!1), [f, E] = M([]), [$, H] = M(""), [S, z] = M(!1), [A, F] = M(!1), [U, N] = M(null), [P, Ze] = M(!1), [et, tt] = M(!1), [ne, nt] = M(0), [fe, st] = M([]), j = We(null), pe = We(null);
774
+ Ee(() => ((async () => {
772
775
  if (t && e) {
773
- console.log("[AriaFlow Widget] Using new agent resolution:", { agentUrl: t, agentId: e });
774
- const S = new Wt(t, e);
775
- J.current = S;
776
+ const W = new Nt(t, e);
777
+ j.current = W;
776
778
  try {
777
- S.onMessages((k) => {
778
- console.log("[AriaFlow Widget] Messages updated:", k.length), F(k);
779
- }), S.onConnectionChange((k) => {
780
- console.log("[AriaFlow Widget] Connection state:", k), V(k), k && I(!0);
781
- }), S.onStreamingChange((k) => {
782
- console.log("[AriaFlow Widget] Streaming state:", k), et(k);
783
- }), S.onQueueChange((k) => {
784
- console.log("[AriaFlow Widget] Queue count:", k), ot(k);
785
- }), S.onProcessingChange((k) => {
786
- console.log("[AriaFlow Widget] Processing state:", k), nt(k);
787
- });
788
- const L = await S.initWidget();
789
- console.log("[AriaFlow Widget] Agent config received:", L), L ? (x(L), console.log("[AriaFlow Widget] Widget initialized successfully (v0.6.11)")) : console.error("[AriaFlow Widget] Agent config fetch failed");
790
- } catch (L) {
791
- console.error("[AriaFlow Widget] Initialization error:", L);
779
+ W.onMessages((x) => E(x)), W.onConnectionChange((x) => {
780
+ z(x), x && F(!0);
781
+ }), W.onStreamingChange((x) => Ze(x)), W.onQueueChange((x) => nt(x)), W.onProcessingChange((x) => tt(x)), W.onSuggestionsChange((x) => st(x));
782
+ const V = await W.initWidget();
783
+ V ? N(V) : console.error("[AriaFlow Widget] Agent config fetch failed");
784
+ } catch (V) {
785
+ console.error("[AriaFlow Widget] Initialization error:", V);
792
786
  }
793
- } 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")) : o && 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.");
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")) : s && 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.");
794
788
  })(), () => {
795
- J.current?.dispose();
796
- }), [t, e, n, o]), Fe(() => {
797
- me.current?.scrollIntoView({ behavior: "smooth" });
789
+ j.current?.dispose();
790
+ }), [t, e, n, s]), Ee(() => {
791
+ pe.current?.scrollIntoView({ behavior: "smooth" });
798
792
  }, [f]);
799
- const ye = async () => {
800
- if (!N.trim() || !W) return;
801
- const b = N.trim();
793
+ const me = async () => {
794
+ if (!$.trim() || !S) return;
795
+ const b = $.trim();
802
796
  H("");
803
797
  try {
804
- await J.current?.sendMessage(b);
805
- } catch (S) {
806
- console.error("Failed to send message:", S);
798
+ await j.current?.sendMessage(b);
799
+ } catch (W) {
800
+ console.error("Failed to send message:", W);
807
801
  }
808
- }, st = (b) => {
809
- b.key === "Enter" && !b.shiftKey && (b.preventDefault(), ye());
810
802
  }, it = (b) => {
811
- !W || M || J.current?.sendMessage(b);
812
- }, rt = g || U?.config.title || "Ninewells Hospital", at = v || U?.config.subtitle || "How can we help you today?", lt = $ || U?.config.emptyChatMessage || "Start a conversation with Ninewells...";
813
- return console.log("[AriaFlow Widget] Rendering widget component", { isInitialized: A, isOpen: y, position: a }), /* @__PURE__ */ d(
803
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), me());
804
+ }, ot = (b) => {
805
+ !S || P || j.current?.sendMessage(b);
806
+ }, rt = h || U?.config.title || "Ninewells Hospital", at = v || U?.config.subtitle || "How can we help you today?", lt = k || U?.config.emptyChatMessage || "Start a conversation with Ninewells...";
807
+ return /* @__PURE__ */ d(
814
808
  "div",
815
809
  {
816
- className: `ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${l} ariaflow-widget-radius-${c}`,
817
- "data-theme": s,
810
+ className: `ariaflow-widget-container ariaflow-widget-${a} ariaflow-widget-${_} ariaflow-widget-radius-${c}`,
811
+ "data-theme": i,
818
812
  style: {
819
813
  "--ariaflow-accent-color": u,
820
- "--ariaflow-base-color": _
814
+ "--ariaflow-base-color": l
821
815
  },
822
816
  children: [
823
- !y && /* @__PURE__ */ d(
817
+ !w && /* @__PURE__ */ d(
824
818
  "button",
825
819
  {
826
820
  className: "ariaflow-widget-launcher",
827
821
  onClick: () => p(!0),
828
822
  style: {
829
823
  backgroundColor: r,
830
- color: h,
824
+ color: g,
831
825
  opacity: A ? 1 : 0.8,
832
826
  cursor: A ? "pointer" : "wait",
833
827
  position: "relative"
@@ -847,7 +841,7 @@ function Nt({
847
841
  transform: "translate(-50%, -50%)",
848
842
  width: "20px",
849
843
  height: "20px",
850
- border: `2px solid ${h}`,
844
+ border: `2px solid ${g}`,
851
845
  borderTop: "2px solid transparent",
852
846
  borderRadius: "50%",
853
847
  animation: "spin 1s linear infinite"
@@ -869,13 +863,13 @@ function Nt({
869
863
  ]
870
864
  }
871
865
  ),
872
- y && A && /* @__PURE__ */ d(
866
+ w && A && /* @__PURE__ */ d(
873
867
  "div",
874
868
  {
875
869
  className: "ariaflow-widget-window",
876
870
  style: {
877
- backgroundColor: s === "dark" && _ ? _ : void 0,
878
- borderRadius: ae[c]
871
+ backgroundColor: i === "dark" && l ? l : void 0,
872
+ borderRadius: oe[c]
879
873
  },
880
874
  children: [
881
875
  /* @__PURE__ */ d(
@@ -884,7 +878,7 @@ function Nt({
884
878
  className: "ariaflow-widget-header",
885
879
  style: {
886
880
  backgroundColor: u,
887
- borderRadius: c === "none" ? "0" : `${ae[c]} ${ae[c]} 0 0`
881
+ borderRadius: c === "none" ? "0" : `${oe[c]} ${oe[c]} 0 0`
888
882
  },
889
883
  children: [
890
884
  /* @__PURE__ */ d("div", { className: "ariaflow-widget-header-content", children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-title-group", children: [
@@ -917,16 +911,16 @@ function Nt({
917
911
  ]
918
912
  }
919
913
  ),
920
- !W && /* @__PURE__ */ d("div", { className: "ariaflow-widget-status", children: [
914
+ !S && /* @__PURE__ */ d("div", { className: "ariaflow-widget-status", children: [
921
915
  /* @__PURE__ */ d("span", { className: "ariaflow-widget-status-dot" }),
922
916
  "Connecting..."
923
917
  ] }),
924
- /* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children: W ? lt : "Connecting to agent..." }) }) : /* @__PURE__ */ d(R, { children: [
925
- f.map((b, S) => (f.length - 1, b.role === "tool" ? null : /* @__PURE__ */ d(
918
+ /* @__PURE__ */ d("div", { className: "ariaflow-widget-messages", children: f.length === 0 ? /* @__PURE__ */ d("div", { className: "ariaflow-widget-empty", children: /* @__PURE__ */ d("p", { children: S ? lt : "Connecting to agent..." }) }) : /* @__PURE__ */ d(D, { children: [
919
+ f.map((b) => b.role === "tool" ? null : /* @__PURE__ */ d(
926
920
  "div",
927
921
  {
928
922
  className: `ariaflow-widget-message ariaflow-widget-message-${b.role}`,
929
- children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(R, { children: [
923
+ children: /* @__PURE__ */ d("div", { className: "ariaflow-widget-message-bubble", children: /* @__PURE__ */ d(D, { children: [
930
924
  b.content,
931
925
  b.isStreaming && /* @__PURE__ */ d("span", { className: "ariaflow-widget-typing-indicator", children: [
932
926
  /* @__PURE__ */ d("span", { children: "•" }),
@@ -936,57 +930,47 @@ function Nt({
936
930
  ] }) })
937
931
  },
938
932
  b.id
939
- ))),
940
- /* @__PURE__ */ d("div", { ref: me }),
941
- tt && !M && /* @__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: [
933
+ )),
934
+ /* @__PURE__ */ d("div", { ref: pe }),
935
+ et && !P && /* @__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: [
942
936
  /* @__PURE__ */ d("span", { children: "•" }),
943
937
  /* @__PURE__ */ d("span", { children: "•" }),
944
938
  /* @__PURE__ */ d("span", { children: "•" })
945
939
  ] }) }) })
946
940
  ] }) }),
947
- !M && (() => {
948
- const b = [...f].reverse(), S = b.findIndex((P) => P.role === "user"), k = (S === -1 ? b : b.slice(0, S)).find(
949
- (P) => P.suggestions && P.suggestions.length > 0 || P.role === "tool" && P.toolCall?.name === "suggest_options" && P.toolCall.arguments?.options?.length > 0
950
- );
951
- if (k) {
952
- const P = k.suggestions || k.toolCall?.arguments?.options || [];
953
- if (P.length > 0)
954
- return /* @__PURE__ */ d("div", { className: "ariaflow-widget-suggestions", children: P.map((ie) => /* @__PURE__ */ d(
955
- "button",
956
- {
957
- className: "ariaflow-widget-chip",
958
- onClick: () => it(ie),
959
- style: {
960
- borderColor: u,
961
- color: u,
962
- backgroundColor: "rgba(255, 255, 255, 0.95)",
963
- backdropFilter: "blur(4px)"
964
- },
965
- children: ie
966
- },
967
- ie
968
- )) });
969
- }
970
- return null;
971
- })(),
941
+ !P && fe.length > 0 && /* @__PURE__ */ d("div", { className: "ariaflow-widget-suggestions", children: fe.map((b) => /* @__PURE__ */ d(
942
+ "button",
943
+ {
944
+ className: "ariaflow-widget-chip",
945
+ onClick: () => ot(b),
946
+ style: {
947
+ borderColor: u,
948
+ color: u,
949
+ backgroundColor: "rgba(255, 255, 255, 0.95)",
950
+ backdropFilter: "blur(4px)"
951
+ },
952
+ children: b
953
+ },
954
+ b
955
+ )) }),
972
956
  /* @__PURE__ */ d("div", { className: "ariaflow-widget-input", children: [
973
957
  /* @__PURE__ */ d(
974
958
  "textarea",
975
959
  {
976
- value: N,
960
+ value: $,
977
961
  onInput: (b) => H(b.target.value),
978
- onKeyDown: st,
979
- placeholder: W ? M ? se > 0 ? `Agent is responding... (${se} message${se > 1 ? "s" : ""} queued)` : "Agent is responding..." : "Type your message..." : "Connecting...",
962
+ onKeyDown: it,
963
+ placeholder: S ? P ? ne > 0 ? `Agent is responding... (${ne} message${ne > 1 ? "s" : ""} queued)` : "Agent is responding..." : "Type your message..." : "Connecting...",
980
964
  rows: 1,
981
- disabled: !W
965
+ disabled: !S
982
966
  }
983
967
  ),
984
968
  /* @__PURE__ */ d(
985
969
  "button",
986
970
  {
987
971
  className: "ariaflow-widget-send",
988
- onClick: ye,
989
- disabled: !N.trim() || !W,
972
+ onClick: me,
973
+ disabled: !$.trim() || !S,
990
974
  style: { backgroundColor: u },
991
975
  "aria-label": "Send message",
992
976
  children: /* @__PURE__ */ d(
@@ -1014,32 +998,33 @@ function Nt({
1014
998
  }
1015
999
  );
1016
1000
  }
1001
+ const Pt = [
1002
+ "agent-url",
1003
+ "agent-id",
1004
+ // Legacy support
1005
+ "widget-id",
1006
+ "api-url",
1007
+ // Other options
1008
+ "mode",
1009
+ "theme",
1010
+ "position",
1011
+ "size",
1012
+ "radius",
1013
+ "base-color",
1014
+ "accent-color",
1015
+ "button-base-color",
1016
+ "button-accent-color",
1017
+ "title",
1018
+ "subtitle",
1019
+ "empty-chat-message"
1020
+ ];
1017
1021
  pt(
1018
- Nt,
1022
+ xt,
1019
1023
  "ariaflow-widget",
1020
- // Properties to observe from HTML attributes (mirror Vapi's naming convention)
1021
- [
1022
- "agent-url",
1023
- "agent-id",
1024
- // Legacy support
1025
- "widget-id",
1026
- "api-url",
1027
- // Other options
1028
- "mode",
1029
- "theme",
1030
- "position",
1031
- "size",
1032
- "radius",
1033
- "base-color",
1034
- "accent-color",
1035
- "button-base-color",
1036
- "button-accent-color",
1037
- "title",
1038
- "subtitle",
1039
- "empty-chat-message"
1040
- ],
1024
+ // Keep kebab-case attribute names for HTML usage.
1025
+ Pt,
1041
1026
  // Shadow DOM (optional, set to false for light DOM)
1042
- !1
1027
+ { shadow: !1 }
1043
1028
  );
1044
1029
  typeof document < "u" && (document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", Te) : Te());
1045
1030
  function Te() {
@@ -1047,6 +1032,6 @@ function Te() {
1047
1032
  console.log(`[AriaFlow] Initializing ${t.length} widget(s)`);
1048
1033
  }
1049
1034
  export {
1050
- Nt as Widget,
1051
- Wt as WidgetClient
1035
+ xt as Widget,
1036
+ Nt as WidgetClient
1052
1037
  };