@aiden-voice/widget 0.4.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -3,26 +3,29 @@ function n(n) {
3
3
  return n === void 0 ? e : Number.isInteger(n) && Math.abs(n) <= t ? n : (console.warn(`whoo-aiden-widget: ignoring zIndex ${String(n)} (expected an integer between -${t} and ${t}); using ${e}.`), e);
4
4
  }
5
5
  function r(e) {
6
+ return typeof e == "string" ? e.trim() : "";
7
+ }
8
+ function i(e) {
6
9
  if ((typeof e.publishableKey == "string" && e.publishableKey.length > 0) == (typeof e.sessionToken == "string" && e.sessionToken.length > 0)) throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.");
7
10
  }
8
11
  //#endregion
9
12
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/dist/preact.module.js
10
- var i, a, o, s, c, l, u, d, f, p, m, h, g, _, v = {}, y = [], b = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, x = Array.isArray;
11
- function S(e, t) {
13
+ var a, o, s, c, l, u, d, f, p, m, h, g, _, v, y = {}, b = [], x = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, S = Array.isArray;
14
+ function C(e, t) {
12
15
  for (var n in t) e[n] = t[n];
13
16
  return e;
14
17
  }
15
18
  function ee(e) {
16
19
  e && e.parentNode && e.parentNode.removeChild(e);
17
20
  }
18
- function C(e, t, n) {
19
- var r, a, o, s = {};
20
- for (o in t) o == "key" ? r = t[o] : o == "ref" ? a = t[o] : s[o] = t[o];
21
- if (arguments.length > 2 && (s.children = arguments.length > 3 ? i.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) s[o] === void 0 && (s[o] = e.defaultProps[o]);
22
- return w(e, s, r, a, null);
21
+ function w(e, t, n) {
22
+ var r, i, o, s = {};
23
+ for (o in t) o == "key" ? r = t[o] : o == "ref" ? i = t[o] : s[o] = t[o];
24
+ if (arguments.length > 2 && (s.children = arguments.length > 3 ? a.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (o in e.defaultProps) s[o] === void 0 && (s[o] = e.defaultProps[o]);
25
+ return T(e, s, r, i, null);
23
26
  }
24
- function w(e, t, n, r, i) {
25
- var s = {
27
+ function T(e, t, n, r, i) {
28
+ var a = {
26
29
  type: e,
27
30
  props: t,
28
31
  key: n,
@@ -33,16 +36,16 @@ function w(e, t, n, r, i) {
33
36
  __e: null,
34
37
  __c: null,
35
38
  constructor: void 0,
36
- __v: i ?? ++o,
39
+ __v: i ?? ++s,
37
40
  __i: -1,
38
41
  __u: 0
39
42
  };
40
- return i == null && a.vnode != null && a.vnode(s), s;
43
+ return i == null && o.vnode != null && o.vnode(a), a;
41
44
  }
42
- function T(e) {
45
+ function E(e) {
43
46
  return e.children;
44
47
  }
45
- function E(e, t) {
48
+ function te(e, t) {
46
49
  this.props = e, this.context = t;
47
50
  }
48
51
  function D(e, t) {
@@ -52,8 +55,8 @@ function D(e, t) {
52
55
  }
53
56
  function O(e) {
54
57
  if (e.__P && e.__d) {
55
- var t = e.__v, n = t.__e, r = [], i = [], o = S({}, t);
56
- o.__v = t.__v + 1, a.vnode && a.vnode(o), ae(e.__P, o, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? D(t), !!(32 & t.__u), i), o.__v = t.__v, o.__.__k[o.__i] = o, se(r, o, i), t.__e = t.__ = null, o.__e != n && k(o);
58
+ var t = e.__v, n = t.__e, r = [], i = [], a = C({}, t);
59
+ a.__v = t.__v + 1, o.vnode && o.vnode(a), se(e.__P, a, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n ?? D(t), !!(32 & t.__u), i), a.__v = t.__v, a.__.__k[a.__i] = a, le(r, a, i), t.__e = t.__ = null, a.__e != n && k(a);
57
60
  }
58
61
  }
59
62
  function k(e) {
@@ -62,30 +65,30 @@ function k(e) {
62
65
  }), k(e);
63
66
  }
64
67
  function A(e) {
65
- (!e.__d && (e.__d = !0) && s.push(e) && !j.__r++ || c != a.debounceRendering) && ((c = a.debounceRendering) || l)(j);
68
+ (!e.__d && (e.__d = !0) && c.push(e) && !j.__r++ || l != o.debounceRendering) && ((l = o.debounceRendering) || u)(j);
66
69
  }
67
70
  function j() {
68
71
  try {
69
- for (var e, t = 1; s.length;) s.length > t && s.sort(u), e = s.shift(), t = s.length, O(e);
72
+ for (var e, t = 1; c.length;) c.length > t && c.sort(d), e = c.shift(), t = c.length, O(e);
70
73
  } finally {
71
- s.length = j.__r = 0;
74
+ c.length = j.__r = 0;
72
75
  }
73
76
  }
74
- function te(e, t, n, r, i, a, o, s, c, l, u) {
75
- var d, f, p, m, h, g, _ = r && r.__k || y, b = t.length;
76
- for (c = M(n, t, _, c, b), d = 0; d < b; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || v, p.__i = d, g = ae(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && ue(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = N(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
77
+ function ne(e, t, n, r, i, a, o, s, c, l, u) {
78
+ var d, f, p, m, h, g, _ = r && r.__k || b, v = t.length;
79
+ for (c = M(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && _[p.__i] || y, p.__i = d, g = se(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && fe(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h == null && m != null && (h = m), 4 & p.__u ? (c = re(p, c, e), f.__e && (f.__e = null)) : typeof p.type == "function" && g !== void 0 ? c = g : m && (c = m.nextSibling), p.__u &= -7);
77
80
  return n.__e = h, c;
78
81
  }
79
82
  function M(e, t, n, r, i) {
80
83
  var a, o, s, c, l, u = n.length, d = u, f = 0;
81
- for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = w(null, o, null, null, null) : x(o) ? o = e.__k[a] = w(T, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = w(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = ne(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
82
- if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = D(s)), de(s, s));
84
+ for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = T(null, o, null, null, null) : S(o) ? o = e.__k[a] = T(E, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = ie(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
85
+ if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = D(s)), pe(s, s));
83
86
  return r;
84
87
  }
85
- function N(e, t, n) {
88
+ function re(e, t, n) {
86
89
  var r, i;
87
90
  if (typeof e.type == "function") {
88
- for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = N(r[i], t, n));
91
+ for (r = e.__k, i = 0; r && i < r.length; i++) r[i] && (r[i].__ = e, t = re(r[i], t, n));
89
92
  return t;
90
93
  }
91
94
  e.__e != t && (t && e.type && !t.parentNode && (t = D(e)), t = n.insertBefore(e.__e, t || null));
@@ -94,7 +97,7 @@ function N(e, t, n) {
94
97
  while (t != null && t.nodeType == 8);
95
98
  return t;
96
99
  }
97
- function ne(e, t, n, r) {
100
+ function ie(e, t, n, r) {
98
101
  var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && !(2 & l.__u);
99
102
  if (l === null && s == null || u && s == l.key && c == l.type) return n;
100
103
  if (r > +!!u) {
@@ -102,18 +105,18 @@ function ne(e, t, n, r) {
102
105
  }
103
106
  return -1;
104
107
  }
105
- function re(e, t, n) {
106
- t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || b.test(t) ? n : n + "px";
108
+ function ae(e, t, n) {
109
+ t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || x.test(t) ? n : n + "px";
107
110
  }
108
- function P(e, t, n, r, i) {
111
+ function N(e, t, n, r, i) {
109
112
  var a, o;
110
113
  n: if (t == "style") {
111
114
  if (typeof n == "string") e.style.cssText = n;
112
115
  else {
113
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || re(e.style, t, "");
114
- if (n) for (t in n) r && n[t] == r[t] || re(e.style, t, n[t]);
116
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || ae(e.style, t, "");
117
+ if (n) for (t in n) r && n[t] == r[t] || ae(e.style, t, n[t]);
115
118
  }
116
- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(m, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[p] = r[p] : (n[p] = h, e.addEventListener(t, a ? _ : g, a)) : e.removeEventListener(t, a ? _ : g, a);
119
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(h, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[m] = r[m] : (n[m] = g, e.addEventListener(t, a ? v : _, a)) : e.removeEventListener(t, a ? v : _, a);
117
120
  else {
118
121
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
119
122
  else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
@@ -123,158 +126,158 @@ function P(e, t, n, r, i) {
123
126
  typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
124
127
  }
125
128
  }
126
- function ie(e) {
129
+ function oe(e) {
127
130
  return function(t) {
128
131
  if (this.l) {
129
132
  var n = this.l[t.type + e];
130
- if (t[f] == null) t[f] = h++;
131
- else if (t[f] < n[p]) return;
132
- return n(a.event ? a.event(t) : t);
133
+ if (t[p] == null) t[p] = g++;
134
+ else if (t[p] < n[m]) return;
135
+ return n(o.event ? o.event(t) : t);
133
136
  }
134
137
  };
135
138
  }
136
- function ae(e, t, n, r, i, o, s, c, l, u) {
137
- var d, f, p, m, h, g, _, v, b, C, w, O, k, A, j, M, N = t.type;
139
+ function se(e, t, n, r, i, a, s, c, l, u) {
140
+ var d, f, p, m, h, g, _, v, y, x, w, T, O, k, A, j, M = t.type;
138
141
  if (t.constructor !== void 0) return null;
139
- 128 & n.__u && (l = !!(32 & n.__u), o = [c = t.__e = n.__e]), (d = a.__b) && d(t);
140
- n: if (typeof N == "function") {
142
+ 128 & n.__u && (l = !!(32 & n.__u), a = [c = t.__e = n.__e]), (d = o.__b) && d(t);
143
+ n: if (typeof M == "function") {
141
144
  f = s.length;
142
145
  try {
143
- if (b = t.props, C = N.prototype && N.prototype.render, w = (d = N.contextType) && r[d.__c], O = d ? w ? w.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (C ? t.__c = p = new N(b, O) : (t.__c = p = new E(b, O), p.constructor = N, p.render = fe), w && w.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), C && p.__s == null && (p.__s = p.state), C && N.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = S({}, p.__s)), S(p.__s, N.getDerivedStateFromProps(b, p.__s))), h = p.props, g = p.state, p.__v = t, m) C && N.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), C && p.componentDidMount != null && p.__h.push(p.componentDidMount);
146
+ if (y = t.props, x = M.prototype && M.prototype.render, w = (d = M.contextType) && r[d.__c], T = d ? w ? w.props.value : d.__ : r, n.__c ? v = (p = t.__c = n.__c).__ = p.__E : (x ? t.__c = p = new M(y, T) : (t.__c = p = new te(y, T), p.constructor = M, p.render = me), w && w.sub(p), p.state || (p.state = {}), p.__n = r, m = p.__d = !0, p.__h = [], p._sb = []), x && p.__s == null && (p.__s = p.state), x && M.getDerivedStateFromProps != null && (p.__s == p.state && (p.__s = C({}, p.__s)), C(p.__s, M.getDerivedStateFromProps(y, p.__s))), h = p.props, g = p.state, p.__v = t, m) x && M.getDerivedStateFromProps == null && p.componentWillMount != null && p.componentWillMount(), x && p.componentDidMount != null && p.__h.push(p.componentDidMount);
144
147
  else {
145
- if (C && N.getDerivedStateFromProps == null && b !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(b, O), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(b, p.__s, O)) {
146
- t.__v != n.__v && (p.props = b, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
148
+ if (x && M.getDerivedStateFromProps == null && y !== h && p.componentWillReceiveProps != null && p.componentWillReceiveProps(y, T), t.__v == n.__v || !p.__e && p.shouldComponentUpdate != null && !1 === p.shouldComponentUpdate(y, p.__s, T)) {
149
+ t.__v != n.__v && (p.props = y, p.state = p.__s, p.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
147
150
  e && (e.__ = t);
148
- }), y.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = D(n);
151
+ }), b.push.apply(p.__h, p._sb), p._sb = [], p.__h.length && s.push(p), c = D(n);
149
152
  break n;
150
153
  }
151
- p.componentWillUpdate != null && p.componentWillUpdate(b, p.__s, O), C && p.componentDidUpdate != null && p.__h.push(function() {
154
+ p.componentWillUpdate != null && p.componentWillUpdate(y, p.__s, T), x && p.componentDidUpdate != null && p.__h.push(function() {
152
155
  p.componentDidUpdate(h, g, _);
153
156
  });
154
157
  }
155
- if (p.context = O, p.props = b, p.__P = e, p.__e = !1, k = a.__r, A = 0, C) p.state = p.__s, p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), y.push.apply(p.__h, p._sb), p._sb = [];
158
+ if (p.context = T, p.props = y, p.__P = e, p.__e = !1, O = o.__r, k = 0, x) p.state = p.__s, p.__d = !1, O && O(t), d = p.render(p.props, p.state, p.context), b.push.apply(p.__h, p._sb), p._sb = [];
156
159
  else do
157
- p.__d = !1, k && k(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
158
- while (p.__d && ++A < 25);
159
- p.state = p.__s, p.getChildContext != null && (r = S(S({}, r), p.getChildContext())), C && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), j = d != null && d.type === T && d.key == null ? ce(d.props.children) : d, c = te(e, x(j) ? j : [j], t, n, r, i, o, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), v && (p.__E = p.__ = null);
160
+ p.__d = !1, O && O(t), d = p.render(p.props, p.state, p.context), p.state = p.__s;
161
+ while (p.__d && ++k < 25);
162
+ p.state = p.__s, p.getChildContext != null && (r = C(C({}, r), p.getChildContext())), x && !m && p.getSnapshotBeforeUpdate != null && (_ = p.getSnapshotBeforeUpdate(h, g)), A = d != null && d.type === E && d.key == null ? ue(d.props.children) : d, c = ne(e, S(A) ? A : [A], t, n, r, i, a, s, c, l, u), p.base = t.__e, t.__u &= -161, p.__h.length && s.push(p), v && (p.__E = p.__ = null);
160
163
  } catch (e) {
161
- if (s.length = f, t.__v = null, l || o != null) {
164
+ if (s.length = f, t.__v = null, l || a != null) {
162
165
  if (e.then) {
163
166
  for (t.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
164
- o != null && (o[o.indexOf(c)] = null), t.__e = c;
165
- } else if (o != null) for (M = o.length; M--;) ee(o[M]);
167
+ a != null && (a[a.indexOf(c)] = null), t.__e = c;
168
+ } else if (a != null) for (j = a.length; j--;) ee(a[j]);
166
169
  } else t.__e = n.__e;
167
- t.__k ??= n.__k || [], e.then || oe(t), a.__e(e, t, n);
170
+ t.__k ??= n.__k || [], e.then || ce(t), o.__e(e, t, n);
168
171
  }
169
- } else o == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : c = t.__e = le(n.__e, t, n, r, i, o, s, l, u);
170
- return (d = a.diffed) && d(t), 128 & t.__u ? void 0 : c;
172
+ } else a == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : c = t.__e = de(n.__e, t, n, r, i, a, s, l, u);
173
+ return (d = o.diffed) && d(t), 128 & t.__u ? void 0 : c;
171
174
  }
172
- function oe(e) {
173
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(oe));
175
+ function ce(e) {
176
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(ce));
174
177
  }
175
- function se(e, t, n) {
176
- for (var r = 0; r < n.length; r++) ue(n[r], n[++r], n[++r]);
177
- a.__c && a.__c(t, e), e.some(function(t) {
178
+ function le(e, t, n) {
179
+ for (var r = 0; r < n.length; r++) fe(n[r], n[++r], n[++r]);
180
+ o.__c && o.__c(t, e), e.some(function(t) {
178
181
  try {
179
182
  e = t.__h, t.__h = [], e.some(function(e) {
180
183
  e.call(t);
181
184
  });
182
185
  } catch (e) {
183
- a.__e(e, t.__v);
186
+ o.__e(e, t.__v);
184
187
  }
185
188
  });
186
189
  }
187
- function ce(e) {
188
- return typeof e != "object" || !e || e.__b > 0 ? e : x(e) ? e.map(ce) : e.constructor === void 0 ? S({}, e) : null;
190
+ function ue(e) {
191
+ return typeof e != "object" || !e || e.__b > 0 ? e : S(e) ? e.map(ue) : e.constructor === void 0 ? C({}, e) : null;
189
192
  }
190
- function le(e, t, n, r, o, s, c, l, u) {
191
- var d, f, p, m, h, g, _, y = n.props || v, b = t.props, S = t.type;
192
- if (S == "svg" ? o = "http://www.w3.org/2000/svg" : S == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o ||= "http://www.w3.org/1999/xhtml", s != null) {
193
- for (d = 0; d < s.length; d++) if ((h = s[d]) && "setAttribute" in h == !!S && (S ? h.localName == S : h.nodeType == 3)) {
193
+ function de(e, t, n, r, i, s, c, l, u) {
194
+ var d, f, p, m, h, g, _, v = n.props || y, b = t.props, x = t.type;
195
+ if (x == "svg" ? i = "http://www.w3.org/2000/svg" : x == "math" ? i = "http://www.w3.org/1998/Math/MathML" : i ||= "http://www.w3.org/1999/xhtml", s != null) {
196
+ for (d = 0; d < s.length; d++) if ((h = s[d]) && "setAttribute" in h == !!x && (x ? h.localName == x : h.nodeType == 3)) {
194
197
  e = h, s[d] = null;
195
198
  break;
196
199
  }
197
200
  }
198
201
  if (e == null) {
199
- if (S == null) return document.createTextNode(b);
200
- e = document.createElementNS(o, S, b.is && b), l &&= (a.__m && a.__m(t, s), !1), s = null;
202
+ if (x == null) return document.createTextNode(b);
203
+ e = document.createElementNS(i, x, b.is && b), l &&= (o.__m && o.__m(t, s), !1), s = null;
201
204
  }
202
- if (S == null) y === b || l && e.data == b || (e.data = b);
205
+ if (x == null) v === b || l && e.data == b || (e.data = b);
203
206
  else {
204
- if (s = S == "textarea" && b.defaultValue != null ? null : s && i.call(e.childNodes), !l && s != null) for (y = {}, d = 0; d < e.attributes.length; d++) y[(h = e.attributes[d]).name] = h.value;
205
- for (d in y) h = y[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || P(e, d, null, h, o);
206
- for (d in b) h = b[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : l && typeof h != "function" || y[d] === h || P(e, d, h, y[d], o);
207
+ if (s = x == "textarea" && b.defaultValue != null ? null : s && a.call(e.childNodes), !l && s != null) for (v = {}, d = 0; d < e.attributes.length; d++) v[(h = e.attributes[d]).name] = h.value;
208
+ for (d in v) h = v[d], d == "dangerouslySetInnerHTML" ? p = h : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || N(e, d, null, h, i);
209
+ for (d in b) h = b[d], d == "children" ? m = h : d == "dangerouslySetInnerHTML" ? f = h : d == "value" ? g = h : d == "checked" ? _ = h : l && typeof h != "function" || v[d] === h || N(e, d, h, v[d], i);
207
210
  if (f) l || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
208
- else if (p && (e.innerHTML = ""), te(t.type == "template" ? e.content : e, x(m) ? m : [m], t, n, r, S == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, c, s ? s[0] : n.__k && D(n, 0), l, u), s != null) for (d = s.length; d--;) ee(s[d]);
209
- l && S != "textarea" || (d = "value", S == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || S == "progress" && !g || S == "option" && g != y[d]) && P(e, d, g, y[d], o), d = "checked", _ != null && _ != e[d] && P(e, d, _, y[d], o));
211
+ else if (p && (e.innerHTML = ""), ne(t.type == "template" ? e.content : e, S(m) ? m : [m], t, n, r, x == "foreignObject" ? "http://www.w3.org/1999/xhtml" : i, s, c, s ? s[0] : n.__k && D(n, 0), l, u), s != null) for (d = s.length; d--;) ee(s[d]);
212
+ l && x != "textarea" || (d = "value", x == "progress" && g == null ? e.removeAttribute("value") : g != null && (g !== e[d] || x == "progress" && !g || x == "option" && g != v[d]) && N(e, d, g, v[d], i), d = "checked", _ != null && _ != e[d] && N(e, d, _, v[d], i));
210
213
  }
211
214
  return e;
212
215
  }
213
- function ue(e, t, n) {
216
+ function fe(e, t, n) {
214
217
  try {
215
218
  if (typeof e == "function") {
216
219
  var r = typeof e.__u == "function";
217
220
  r && e.__u(), r && t == null || (e.__u = e(t));
218
221
  } else e.current = t;
219
222
  } catch (e) {
220
- a.__e(e, n);
223
+ o.__e(e, n);
221
224
  }
222
225
  }
223
- function de(e, t, n) {
226
+ function pe(e, t, n) {
224
227
  var r, i;
225
- if (a.unmount && a.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || ue(r, null, t)), (r = e.__c) != null) {
228
+ if (o.unmount && o.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || fe(r, null, t)), (r = e.__c) != null) {
226
229
  if (r.componentWillUnmount) try {
227
230
  r.componentWillUnmount();
228
231
  } catch (e) {
229
- a.__e(e, t);
232
+ o.__e(e, t);
230
233
  }
231
234
  r.base = r.__P = r.__n = null;
232
235
  }
233
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && de(r[i], t, n || typeof e.type != "function");
236
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && pe(r[i], t, n || typeof e.type != "function");
234
237
  n || ee(e.__e), e.__c = e.__ = e.__e = void 0;
235
238
  }
236
- function fe(e, t, n) {
239
+ function me(e, t, n) {
237
240
  return this.constructor(e, n);
238
241
  }
239
- function pe(e, t, n) {
240
- var r, o, s, c;
241
- t == document && (t = document.documentElement), a.__ && a.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, s = [], c = [], ae(t, e = (!r && n || t).__k = C(T, null, [e]), o || v, v, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? i.call(t.childNodes) : null, s, !r && n ? n : o ? o.__e : t.firstChild, r, c), se(s, e, c), e.props.children = null;
242
+ function he(e, t, n) {
243
+ var r, i, s, c;
244
+ t == document && (t = document.documentElement), o.__ && o.__(e, t), i = (r = typeof n == "function") ? null : n && n.__k || t.__k, s = [], c = [], se(t, e = (!r && n || t).__k = w(E, null, [e]), i || y, y, t.namespaceURI, !r && n ? [n] : i ? null : t.firstChild ? a.call(t.childNodes) : null, s, !r && n ? n : i ? i.__e : t.firstChild, r, c), le(s, e, c), e.props.children = null;
242
245
  }
243
- i = y.slice, a = { __e: function(e, t, n, r) {
246
+ a = b.slice, o = { __e: function(e, t, n, r) {
244
247
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
245
248
  if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
246
249
  } catch (t) {
247
250
  e = t;
248
251
  }
249
252
  throw e;
250
- } }, o = 0, E.prototype.setState = function(e, t) {
251
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = S({}, this.state);
252
- typeof e == "function" && (e = e(S({}, n), this.props)), e && S(n, e), e != null && this.__v && (t && this._sb.push(t), A(this));
253
- }, E.prototype.forceUpdate = function(e) {
253
+ } }, s = 0, te.prototype.setState = function(e, t) {
254
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = C({}, this.state);
255
+ typeof e == "function" && (e = e(C({}, n), this.props)), e && C(n, e), e != null && this.__v && (t && this._sb.push(t), A(this));
256
+ }, te.prototype.forceUpdate = function(e) {
254
257
  this.__v && (this.__e = !0, e && this.__h.push(e), A(this));
255
- }, E.prototype.render = T, s = [], l = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, u = function(e, t) {
258
+ }, te.prototype.render = E, c = [], u = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, d = function(e, t) {
256
259
  return e.__v.__b - t.__v.__b;
257
- }, j.__r = 0, d = Math.random().toString(8), f = "__d" + d, p = "__a" + d, m = /(PointerCapture)$|Capture$/i, h = 0, g = ie(!1), _ = ie(!0);
260
+ }, j.__r = 0, f = Math.random().toString(8), p = "__d" + f, m = "__a" + f, h = /(PointerCapture)$|Capture$/i, g = 0, _ = oe(!1), v = oe(!0);
258
261
  //#endregion
259
262
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/hooks/dist/hooks.module.js
260
- var F, I, me, he, L = 0, ge = [], R = a, _e = R.__b, ve = R.__r, ye = R.diffed, be = R.__c, xe = R.unmount, Se = R.__;
261
- function Ce(e, t) {
262
- R.__h && R.__h(I, e, L || t), L = 0;
263
- var n = I.__H || (I.__H = {
263
+ var P, F, ge, _e, I = 0, ve = [], L = o, ye = L.__b, be = L.__r, xe = L.diffed, Se = L.__c, Ce = L.unmount, we = L.__;
264
+ function Te(e, t) {
265
+ L.__h && L.__h(F, e, I || t), I = 0;
266
+ var n = F.__H || (F.__H = {
264
267
  __: [],
265
268
  __h: []
266
269
  });
267
270
  return e >= n.__.length && n.__.push({}), n.__[e];
268
271
  }
269
- function z(e) {
270
- return L = 1, we(je, e);
272
+ function Ee(e) {
273
+ return I = 1, De(Pe, e);
271
274
  }
272
- function we(e, t, n) {
273
- var r = Ce(F++, 2);
274
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : je(void 0, t), function(e) {
275
+ function De(e, t, n) {
276
+ var r = Te(P++, 2);
277
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Pe(void 0, t), function(e) {
275
278
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
276
279
  t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
277
- }], r.__c = I, !I.__f)) {
280
+ }], r.__c = F, !F.__f)) {
278
281
  var i = function(e, t, n) {
279
282
  if (!r.__c.__H) return !0;
280
283
  var i = !1, o = r.__c.props !== e;
@@ -290,108 +293,108 @@ function we(e, t, n) {
290
293
  }
291
294
  return !i || o;
292
295
  };
293
- I.__f = !0;
294
- var a = I.shouldComponentUpdate, o = I.componentWillUpdate;
295
- I.componentWillUpdate = function(e, t, n) {
296
+ F.__f = !0;
297
+ var a = F.shouldComponentUpdate, o = F.componentWillUpdate;
298
+ F.componentWillUpdate = function(e, t, n) {
296
299
  if (this.__e) {
297
300
  var r = a;
298
301
  a = void 0, i(e, t, n), a = r;
299
302
  }
300
303
  o && o.call(this, e, t, n);
301
- }, I.shouldComponentUpdate = i;
304
+ }, F.shouldComponentUpdate = i;
302
305
  }
303
306
  return r.__N || r.__;
304
307
  }
305
- function B(e, t) {
306
- var n = Ce(F++, 3);
307
- !R.__s && Ae(n.__H, t) && (n.__ = e, n.u = t, I.__H.__h.push(n));
308
+ function R(e, t) {
309
+ var n = Te(P++, 3);
310
+ !L.__s && Ne(n.__H, t) && (n.__ = e, n.u = t, F.__H.__h.push(n));
308
311
  }
309
- function V(e) {
310
- return L = 5, Te(function() {
312
+ function z(e) {
313
+ return I = 5, Oe(function() {
311
314
  return { current: e };
312
315
  }, []);
313
316
  }
314
- function Te(e, t) {
315
- var n = Ce(F++, 7);
316
- return Ae(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
317
+ function Oe(e, t) {
318
+ var n = Te(P++, 7);
319
+ return Ne(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
317
320
  }
318
- function Ee() {
319
- for (var e; e = ge.shift();) {
321
+ function ke() {
322
+ for (var e; e = ve.shift();) {
320
323
  var t = e.__H;
321
324
  if (e.__P && t) try {
322
- t.__h.some(H), t.__h.some(ke), t.__h = [];
325
+ t.__h.some(B), t.__h.some(Me), t.__h = [];
323
326
  } catch (n) {
324
- t.__h = [], R.__e(n, e.__v);
327
+ t.__h = [], L.__e(n, e.__v);
325
328
  }
326
329
  }
327
330
  }
328
- R.__b = function(e) {
329
- I = null, _e && _e(e);
330
- }, R.__ = function(e, t) {
331
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Se && Se(e, t);
332
- }, R.__r = function(e) {
333
- ve && ve(e), F = 0;
334
- var t = (I = e.__c).__H;
335
- t && (me === I ? (t.__h = [], I.__h = [], t.__.some(function(e) {
331
+ L.__b = function(e) {
332
+ F = null, ye && ye(e);
333
+ }, L.__ = function(e, t) {
334
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), we && we(e, t);
335
+ }, L.__r = function(e) {
336
+ be && be(e), P = 0;
337
+ var t = (F = e.__c).__H;
338
+ t && (ge === F ? (t.__h = [], F.__h = [], t.__.some(function(e) {
336
339
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
337
- })) : (t.__h.some(H), t.__h.some(ke), t.__h = [], F = 0)), me = I;
338
- }, R.diffed = function(e) {
339
- ye && ye(e);
340
+ })) : (t.__h.some(B), t.__h.some(Me), t.__h = [], P = 0)), ge = F;
341
+ }, L.diffed = function(e) {
342
+ xe && xe(e);
340
343
  var t = e.__c;
341
- t && t.__H && (t.__H.__h.length && (ge.push(t) !== 1 && he === R.requestAnimationFrame || ((he = R.requestAnimationFrame) || Oe)(Ee)), t.__H.__.some(function(e) {
344
+ t && t.__H && (t.__H.__h.length && (ve.push(t) !== 1 && _e === L.requestAnimationFrame || ((_e = L.requestAnimationFrame) || je)(ke)), t.__H.__.some(function(e) {
342
345
  e.u &&= (e.__H = e.u, void 0);
343
- })), me = I = null;
344
- }, R.__c = function(e, t) {
346
+ })), ge = F = null;
347
+ }, L.__c = function(e, t) {
345
348
  t.some(function(e) {
346
349
  try {
347
- e.__h.some(H), e.__h = e.__h.filter(function(e) {
348
- return !e.__ || ke(e);
350
+ e.__h.some(B), e.__h = e.__h.filter(function(e) {
351
+ return !e.__ || Me(e);
349
352
  });
350
353
  } catch (n) {
351
354
  t.some(function(e) {
352
355
  e.__h &&= [];
353
- }), t = [], R.__e(n, e.__v);
356
+ }), t = [], L.__e(n, e.__v);
354
357
  }
355
- }), be && be(e, t);
356
- }, R.unmount = function(e) {
357
- xe && xe(e);
358
+ }), Se && Se(e, t);
359
+ }, L.unmount = function(e) {
360
+ Ce && Ce(e);
358
361
  var t, n = e.__c;
359
362
  n && n.__H && (n.__H.__.some(function(e) {
360
363
  try {
361
- H(e);
364
+ B(e);
362
365
  } catch (e) {
363
366
  t = e;
364
367
  }
365
- }), n.__H = void 0, t && R.__e(t, n.__v));
368
+ }), n.__H = void 0, t && L.__e(t, n.__v));
366
369
  };
367
- var De = typeof requestAnimationFrame == "function";
368
- function Oe(e) {
370
+ var Ae = typeof requestAnimationFrame == "function";
371
+ function je(e) {
369
372
  var t, n = function() {
370
- clearTimeout(r), De && cancelAnimationFrame(t), setTimeout(e);
373
+ clearTimeout(r), Ae && cancelAnimationFrame(t), setTimeout(e);
371
374
  }, r = setTimeout(n, 35);
372
- De && (t = requestAnimationFrame(n));
375
+ Ae && (t = requestAnimationFrame(n));
373
376
  }
374
- function H(e) {
375
- var t = I, n = e.__c;
376
- typeof n == "function" && (e.__c = void 0, n()), I = t;
377
+ function B(e) {
378
+ var t = F, n = e.__c;
379
+ typeof n == "function" && (e.__c = void 0, n()), F = t;
377
380
  }
378
- function ke(e) {
379
- var t = I;
380
- e.__c = e.__(), I = t;
381
+ function Me(e) {
382
+ var t = F;
383
+ e.__c = e.__(), F = t;
381
384
  }
382
- function Ae(e, t) {
385
+ function Ne(e, t) {
383
386
  return !e || e.length !== t.length || t.some(function(t, n) {
384
387
  return t !== e[n];
385
388
  });
386
389
  }
387
- function je(e, t) {
390
+ function Pe(e, t) {
388
391
  return typeof t == "function" ? t(e) : t;
389
392
  }
390
393
  //#endregion
391
394
  //#region node_modules/.pnpm/preact@10.29.8/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
392
- var Me = 0;
395
+ var Fe = 0;
393
396
  Array.isArray;
394
- function U(e, t, n, r, i, o) {
397
+ function V(e, t, n, r, i, a) {
395
398
  t ||= {};
396
399
  var s, c, l = t;
397
400
  if ("ref" in l) for (c in l = {}, t) c == "ref" ? s = t[c] : l[c] = t[c];
@@ -406,19 +409,19 @@ function U(e, t, n, r, i, o) {
406
409
  __e: null,
407
410
  __c: null,
408
411
  constructor: void 0,
409
- __v: --Me,
412
+ __v: --Fe,
410
413
  __i: -1,
411
414
  __u: 0,
412
415
  __source: i,
413
- __self: o
416
+ __self: a
414
417
  };
415
418
  if (typeof e == "function" && (s = e.defaultProps)) for (c in s) l[c] === void 0 && (l[c] = s[c]);
416
- return a.vnode && a.vnode(u), u;
419
+ return o.vnode && o.vnode(u), u;
417
420
  }
418
421
  //#endregion
419
422
  //#region src/components/icons.tsx
420
- function W({ name: e, size: t, children: n }) {
421
- return /* @__PURE__ */ U("svg", {
423
+ function H({ name: e, size: t, children: n }) {
424
+ return /* @__PURE__ */ V("svg", {
422
425
  "data-icon": e,
423
426
  "aria-hidden": "true",
424
427
  focusable: "false",
@@ -433,59 +436,59 @@ function W({ name: e, size: t, children: n }) {
433
436
  children: n
434
437
  });
435
438
  }
436
- function Ne({ size: e = 26 }) {
437
- return /* @__PURE__ */ U(W, {
439
+ function Ie({ size: e = 26 }) {
440
+ return /* @__PURE__ */ V(H, {
438
441
  name: "chat",
439
442
  size: e,
440
- children: [/* @__PURE__ */ U("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z" }), /* @__PURE__ */ U("path", {
443
+ children: [/* @__PURE__ */ V("path", { d: "M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z" }), /* @__PURE__ */ V("path", {
441
444
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
442
445
  "stroke-width": "2.5"
443
446
  })]
444
447
  });
445
448
  }
446
- function Pe({ size: e = 26 }) {
447
- return /* @__PURE__ */ U(W, {
449
+ function Le({ size: e = 26 }) {
450
+ return /* @__PURE__ */ V(H, {
448
451
  name: "chevron-down",
449
452
  size: e,
450
- children: /* @__PURE__ */ U("path", { d: "M6 9l6 6 6-6" })
453
+ children: /* @__PURE__ */ V("path", { d: "M6 9l6 6 6-6" })
451
454
  });
452
455
  }
453
- function Fe({ size: e = 18 }) {
454
- return /* @__PURE__ */ U(W, {
456
+ function Re({ size: e = 18 }) {
457
+ return /* @__PURE__ */ V(H, {
455
458
  name: "close",
456
459
  size: e,
457
- children: /* @__PURE__ */ U("path", { d: "M6 6l12 12M18 6L6 18" })
460
+ children: /* @__PURE__ */ V("path", { d: "M6 6l12 12M18 6L6 18" })
458
461
  });
459
462
  }
460
- var Ie = "M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7";
461
- function Le({ size: e = 16 }) {
462
- return /* @__PURE__ */ U(W, {
463
+ var ze = "M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7";
464
+ function Be({ size: e = 16 }) {
465
+ return /* @__PURE__ */ V(H, {
463
466
  name: "thumb-up",
464
467
  size: e,
465
- children: /* @__PURE__ */ U("path", { d: Ie })
468
+ children: /* @__PURE__ */ V("path", { d: ze })
466
469
  });
467
470
  }
468
- function Re({ size: e = 16 }) {
469
- return /* @__PURE__ */ U(W, {
471
+ function Ve({ size: e = 16 }) {
472
+ return /* @__PURE__ */ V(H, {
470
473
  name: "thumb-down",
471
474
  size: e,
472
- children: /* @__PURE__ */ U("path", {
473
- d: Ie,
475
+ children: /* @__PURE__ */ V("path", {
476
+ d: ze,
474
477
  transform: "matrix(1 0 0 -1 0 24)"
475
478
  })
476
479
  });
477
480
  }
478
481
  //#endregion
479
482
  //#region src/components/Launcher.tsx
480
- function ze({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
481
- let [i, a] = z("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
482
- return /* @__PURE__ */ U("button", {
483
+ function He({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
484
+ let [i, a] = Ee("loading"), o = n !== void 0 && i !== "failed", s = o && !e && i === "loaded";
485
+ return /* @__PURE__ */ V("button", {
483
486
  type: "button",
484
487
  class: "whoo-widget-launcher",
485
488
  onClick: t,
486
489
  "aria-label": e ? "Close chat" : "Open chat",
487
490
  ref: r,
488
- children: [e ? /* @__PURE__ */ U(Pe, {}) : s ? null : /* @__PURE__ */ U(Ne, {}), o ? /* @__PURE__ */ U("img", {
491
+ children: [e ? /* @__PURE__ */ V(Le, {}) : s ? null : /* @__PURE__ */ V(Ie, {}), o ? /* @__PURE__ */ V("img", {
489
492
  class: "whoo-widget-launcher-icon-image",
490
493
  src: n,
491
494
  alt: "",
@@ -498,16 +501,16 @@ function ze({ isOpen: e, onClick: t, iconUrl: n, buttonRef: r }) {
498
501
  }
499
502
  //#endregion
500
503
  //#region src/components/Composer.tsx
501
- function Be({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
502
- return /* @__PURE__ */ U("div", {
504
+ function Ue({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
505
+ return /* @__PURE__ */ V("div", {
503
506
  class: "whoo-widget-composer",
504
507
  children: [
505
- /* @__PURE__ */ U("label", {
508
+ /* @__PURE__ */ V("label", {
506
509
  class: "whoo-widget-sr-only",
507
510
  for: "whoo-widget-composer-input",
508
511
  children: "Message"
509
512
  }),
510
- /* @__PURE__ */ U("input", {
513
+ /* @__PURE__ */ V("input", {
511
514
  id: "whoo-widget-composer-input",
512
515
  class: "whoo-widget-composer-input",
513
516
  value: e,
@@ -519,11 +522,13 @@ function Be({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
519
522
  e.key === "Enter" && n();
520
523
  }
521
524
  }),
522
- /* @__PURE__ */ U("button", {
525
+ /* @__PURE__ */ V("button", {
523
526
  type: "button",
524
527
  class: "whoo-widget-composer-send",
525
- onClick: n,
526
- disabled: r,
528
+ "aria-disabled": r,
529
+ onClick: () => {
530
+ r || n();
531
+ },
527
532
  children: "Send"
528
533
  })
529
534
  ]
@@ -531,8 +536,8 @@ function Be({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
531
536
  }
532
537
  //#endregion
533
538
  //#region src/components/ErrorBanner.tsx
534
- function Ve({ message: e }) {
535
- return /* @__PURE__ */ U("div", {
539
+ function We({ message: e }) {
540
+ return /* @__PURE__ */ V("div", {
536
541
  class: "whoo-widget-error-banner",
537
542
  role: "alert",
538
543
  children: e
@@ -540,8 +545,8 @@ function Ve({ message: e }) {
540
545
  }
541
546
  //#endregion
542
547
  //#region src/markdown/tokenizer.ts
543
- var G = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, K = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, q = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, J = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, Y = /[ \t]*[*+-][ \t]+/y, He = /https?:\/\/\S+/y, Ue = /[.,;:!?)\]}>]+$/;
544
- function We(e) {
548
+ var U = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, W = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, G = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, K = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, q = /[ \t]*[*+-][ \t]+/y, Ge = /https?:\/\/\S+/y, Ke = /[.,;:!?)\]}>]+$/;
549
+ function J(e) {
545
550
  let t = [], n = 0, r = 0, i = (n) => {
546
551
  n > r && t.push({
547
552
  type: "text",
@@ -551,13 +556,13 @@ function We(e) {
551
556
  });
552
557
  };
553
558
  for (; n < e.length;) {
554
- if ((n === 0 || e[n - 1] === "\n") && (Y.lastIndex = n, Y.exec(e))) {
559
+ if ((n === 0 || e[n - 1] === "\n") && (q.lastIndex = n, q.exec(e))) {
555
560
  i(n), t.push({
556
561
  type: "text",
557
562
  value: "• ",
558
563
  start: n,
559
- end: Y.lastIndex
560
- }), n = Y.lastIndex, r = n;
564
+ end: q.lastIndex
565
+ }), n = q.lastIndex, r = n;
561
566
  continue;
562
567
  }
563
568
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -570,56 +575,56 @@ function We(e) {
570
575
  }
571
576
  }
572
577
  if (e[n - 1] !== "!") {
573
- G.lastIndex = n;
574
- let a = G.exec(e);
578
+ U.lastIndex = n;
579
+ let a = U.exec(e);
575
580
  if (a) {
576
581
  i(n), t.push({
577
582
  type: "link",
578
583
  text: a[1],
579
584
  url: a[2],
580
585
  start: n,
581
- end: G.lastIndex
582
- }), n = G.lastIndex, r = n;
586
+ end: U.lastIndex
587
+ }), n = U.lastIndex, r = n;
583
588
  continue;
584
589
  }
585
590
  }
586
- K.lastIndex = n;
587
- let a = K.exec(e);
591
+ W.lastIndex = n;
592
+ let a = W.exec(e);
588
593
  if (a) {
589
594
  i(n), t.push({
590
595
  type: "bold",
591
596
  value: a[1],
592
597
  start: n,
593
- end: K.lastIndex
594
- }), n = K.lastIndex, r = n;
598
+ end: W.lastIndex
599
+ }), n = W.lastIndex, r = n;
595
600
  continue;
596
601
  }
597
- q.lastIndex = n;
598
- let o = q.exec(e);
602
+ G.lastIndex = n;
603
+ let o = G.exec(e);
599
604
  if (o) {
600
605
  i(n), t.push({
601
606
  type: "italic",
602
607
  value: o[1],
603
608
  start: n,
604
- end: q.lastIndex
605
- }), n = q.lastIndex, r = n;
609
+ end: G.lastIndex
610
+ }), n = G.lastIndex, r = n;
606
611
  continue;
607
612
  }
608
- J.lastIndex = n;
609
- let s = J.exec(e);
613
+ K.lastIndex = n;
614
+ let s = K.exec(e);
610
615
  if (s) {
611
616
  i(n), t.push({
612
617
  type: "italic",
613
618
  value: s[1],
614
619
  start: n,
615
- end: J.lastIndex
616
- }), n = J.lastIndex, r = n;
620
+ end: K.lastIndex
621
+ }), n = K.lastIndex, r = n;
617
622
  continue;
618
623
  }
619
- He.lastIndex = n;
620
- let c = He.exec(e);
624
+ Ge.lastIndex = n;
625
+ let c = Ge.exec(e);
621
626
  if (c) {
622
- let e = c[0].match(Ue), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
627
+ let e = c[0].match(Ke), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
623
628
  if (a.length > 0) {
624
629
  i(n), t.push({
625
630
  type: "link",
@@ -637,16 +642,42 @@ function We(e) {
637
642
  }
638
643
  //#endregion
639
644
  //#region src/markdown/render.tsx
640
- function Ge(e) {
641
- return We(e).map((e, t) => {
645
+ var qe = /^[ \t]*[*+-][ \t]+(.*)$/;
646
+ function Je(e) {
647
+ let t = [], n = [], r = [], i = () => {
648
+ n.length > 0 && t.push({
649
+ type: "text",
650
+ text: n.join("\n")
651
+ }), n = [];
652
+ }, a = () => {
653
+ r.length > 0 && t.push({
654
+ type: "list",
655
+ items: r
656
+ }), r = [];
657
+ };
658
+ for (let t of e.split("\n")) {
659
+ let e = t.match(qe);
660
+ e ? (i(), r.push(e[1])) : (a(), n.push(t));
661
+ }
662
+ return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
663
+ if (e.type === "list") return [e];
664
+ let { text: r } = e;
665
+ return t[n - 1]?.type === "list" && (r = r.replace(/^(?:[ \t]*\n)+/, "")), t[n + 1]?.type === "list" && (r = r.replace(/(?:\n[ \t]*)+$/, "")), r.trim() === "" ? [] : [{
666
+ type: "text",
667
+ text: r
668
+ }];
669
+ }) : null;
670
+ }
671
+ function Y(e) {
672
+ return J(e).map((e, t) => {
642
673
  switch (e.type) {
643
- case "bold": return /* @__PURE__ */ U("strong", { children: Ge(e.value) }, t);
644
- case "italic": return /* @__PURE__ */ U("em", { children: Ge(e.value) }, t);
645
- case "link": return /* @__PURE__ */ U("a", {
674
+ case "bold": return /* @__PURE__ */ V("strong", { children: Y(e.value) }, t);
675
+ case "italic": return /* @__PURE__ */ V("em", { children: Y(e.value) }, t);
676
+ case "link": return /* @__PURE__ */ V("a", {
646
677
  href: e.url,
647
678
  target: "_blank",
648
679
  rel: "noopener noreferrer",
649
- children: [e.text, /* @__PURE__ */ U("span", {
680
+ children: [e.text, /* @__PURE__ */ V("span", {
650
681
  class: "whoo-widget-sr-only",
651
682
  children: " (opens in new tab)"
652
683
  })]
@@ -655,9 +686,16 @@ function Ge(e) {
655
686
  }
656
687
  });
657
688
  }
689
+ function Ye(e) {
690
+ let t = e.replace(/\r\n?/g, "\n"), n = Je(t);
691
+ return n ? n.map((e, t) => e.type === "list" ? /* @__PURE__ */ V("ul", {
692
+ class: "whoo-widget-list",
693
+ children: e.items.map((e, t) => /* @__PURE__ */ V("li", { children: Y(e) }, t))
694
+ }, t) : /* @__PURE__ */ V("span", { children: Y(e.text) }, t)) : Y(t);
695
+ }
658
696
  //#endregion
659
697
  //#region src/components/MessageFeedback.tsx
660
- var Ke = [
698
+ var Xe = [
661
699
  {
662
700
  value: "",
663
701
  label: "Select a reason (optional)"
@@ -679,106 +717,101 @@ var Ke = [
679
717
  label: "Other"
680
718
  }
681
719
  ];
682
- function qe({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onSubmitDetailed: i, onCancel: a }) {
683
- let [o, s] = z(""), [c, l] = z(""), u = V(e.status);
684
- if (B(() => {
685
- let n = u.current;
686
- if (u.current = e.status, n === e.status) return;
720
+ function Ze({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraftChange: i, onSubmitDetailed: a, onCancel: o }) {
721
+ let s = e.correction ?? "", c = e.category ?? "", l = z(e.status);
722
+ if (R(() => {
723
+ let n = l.current;
724
+ if (l.current = e.status, n === e.status) return;
687
725
  let r = t?.current;
688
726
  if (!r) return;
689
727
  let i = r.getRootNode();
690
728
  r.contains(i.activeElement) || r.focus();
691
- }, [e.status, t]), e.status === "submitted") return /* @__PURE__ */ U("div", {
692
- class: "whoo-widget-feedback-submitted",
693
- role: "status",
694
- children: "Thanks for the feedback"
695
- });
696
- if (e.status === "expanded") return /* @__PURE__ */ U("div", {
729
+ }, [e.status, t]), e.status === "expanded") return /* @__PURE__ */ V("div", {
697
730
  class: "whoo-widget-feedback-form",
698
731
  children: [
699
- /* @__PURE__ */ U("label", { children: [/* @__PURE__ */ U("span", {
732
+ /* @__PURE__ */ V("label", { children: [/* @__PURE__ */ V("span", {
700
733
  class: "whoo-widget-sr-only",
701
734
  children: "Additional feedback"
702
- }), /* @__PURE__ */ U("textarea", {
735
+ }), /* @__PURE__ */ V("textarea", {
703
736
  class: "whoo-widget-feedback-textarea",
704
- value: o,
705
- onInput: (e) => s(e.target.value),
737
+ value: s,
738
+ onInput: (e) => i(e.target.value, c),
706
739
  placeholder: "What was wrong? (optional)"
707
740
  })] }),
708
- /* @__PURE__ */ U("select", {
741
+ /* @__PURE__ */ V("select", {
709
742
  class: "whoo-widget-feedback-select",
710
743
  "aria-label": "Feedback category",
711
744
  value: c,
712
- onChange: (e) => l(e.target.value),
713
- children: Ke.map((e) => /* @__PURE__ */ U("option", {
745
+ onChange: (e) => i(s, e.target.value),
746
+ children: Xe.map((e) => /* @__PURE__ */ V("option", {
714
747
  value: e.value,
715
748
  children: e.label
716
749
  }, e.value))
717
750
  }),
718
- /* @__PURE__ */ U("div", {
751
+ /* @__PURE__ */ V("div", {
719
752
  class: "whoo-widget-feedback-form-buttons",
720
- children: [/* @__PURE__ */ U("button", {
753
+ children: [/* @__PURE__ */ V("button", {
721
754
  type: "button",
722
755
  class: "whoo-widget-feedback-submit",
723
- onClick: () => i(o, c),
756
+ onClick: () => a(s, c),
724
757
  children: "Submit"
725
- }), /* @__PURE__ */ U("button", {
758
+ }), /* @__PURE__ */ V("button", {
726
759
  type: "button",
727
760
  class: "whoo-widget-feedback-cancel",
728
- onClick: a,
761
+ onClick: o,
729
762
  children: "Cancel"
730
763
  })]
731
764
  })
732
765
  ]
733
766
  });
734
- let d = e.status === "submitting";
735
- return /* @__PURE__ */ U("div", {
767
+ let u = e.status === "submitting", d = e.status === "submitted";
768
+ return /* @__PURE__ */ V("div", {
736
769
  class: "whoo-widget-feedback",
737
- children: [/* @__PURE__ */ U("div", {
770
+ children: [d ? null : /* @__PURE__ */ V("div", {
738
771
  class: "whoo-widget-feedback-buttons",
739
- children: [/* @__PURE__ */ U("button", {
772
+ children: [/* @__PURE__ */ V("button", {
740
773
  type: "button",
741
774
  "aria-label": "Good response",
742
- disabled: d,
775
+ disabled: u,
743
776
  onClick: n,
744
- children: /* @__PURE__ */ U(Le, {})
745
- }), /* @__PURE__ */ U("button", {
777
+ children: /* @__PURE__ */ V(Be, {})
778
+ }), /* @__PURE__ */ V("button", {
746
779
  type: "button",
747
780
  "aria-label": "Bad response",
748
- disabled: d,
781
+ disabled: u,
749
782
  onClick: r,
750
- children: /* @__PURE__ */ U(Re, {})
783
+ children: /* @__PURE__ */ V(Ve, {})
751
784
  })]
752
- }), e.status === "error" ? /* @__PURE__ */ U("div", {
753
- class: "whoo-widget-feedback-error",
785
+ }), /* @__PURE__ */ V("div", {
754
786
  role: "status",
755
- children: "Couldn't send feedback"
756
- }) : null]
787
+ class: d ? "whoo-widget-feedback-submitted" : e.status === "error" ? "whoo-widget-feedback-error" : void 0,
788
+ children: d ? "Thanks for the feedback" : e.status === "error" ? "Couldn't send feedback" : null
789
+ })]
757
790
  });
758
791
  }
759
792
  //#endregion
760
793
  //#region src/components/MessageList.tsx
761
- function Je({ isSlowResponse: e }) {
762
- return /* @__PURE__ */ U("div", {
794
+ function Qe({ isSlowResponse: e }) {
795
+ return /* @__PURE__ */ V("div", {
763
796
  class: "whoo-widget-pending",
764
797
  role: "status",
765
- children: [/* @__PURE__ */ U("span", {
798
+ children: [/* @__PURE__ */ V("span", {
766
799
  class: "whoo-widget-typing",
767
800
  "aria-hidden": "true",
768
801
  children: [
769
- /* @__PURE__ */ U("span", {}),
770
- /* @__PURE__ */ U("span", {}),
771
- /* @__PURE__ */ U("span", {})
802
+ /* @__PURE__ */ V("span", {}),
803
+ /* @__PURE__ */ V("span", {}),
804
+ /* @__PURE__ */ V("span", {})
772
805
  ]
773
- }), e ? /* @__PURE__ */ U("span", {
806
+ }), e ? /* @__PURE__ */ V("span", {
774
807
  class: "whoo-widget-pending-text",
775
808
  children: "Looking that up for you…"
776
809
  }) : null]
777
810
  });
778
811
  }
779
- function Ye({ url: e, alt: t }) {
780
- let [n, r] = z(!1);
781
- return n ? null : /* @__PURE__ */ U("img", {
812
+ function $e({ url: e, alt: t }) {
813
+ let [n, r] = Ee(!1);
814
+ return n ? null : /* @__PURE__ */ V("img", {
782
815
  class: "whoo-widget-empty-state-image",
783
816
  src: e,
784
817
  alt: t,
@@ -786,42 +819,54 @@ function Ye({ url: e, alt: t }) {
786
819
  onError: () => r(!0)
787
820
  });
788
821
  }
789
- function Xe({ message: e, feedbackState: t, showFeedback: n, pending: r, isSlowResponse: i, onThumbsUp: a, onThumbsDown: o, onSubmitDetailed: s, onCancelFeedback: c }) {
790
- let l = V(null), u = e.id;
791
- return /* @__PURE__ */ U("div", {
792
- ref: l,
822
+ function et({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u }) {
823
+ let d = z(null), f = e.id;
824
+ return /* @__PURE__ */ V("div", {
825
+ ref: d,
793
826
  tabIndex: -1,
794
827
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
795
- children: [r ? /* @__PURE__ */ U(Je, { isSlowResponse: i }) : Ge(e.content), n && e.role === "assistant" && u ? /* @__PURE__ */ U(qe, {
796
- state: t,
797
- containerRef: l,
798
- onThumbsUp: () => a(u),
799
- onThumbsDown: () => o(u),
800
- onSubmitDetailed: (e, t) => s(u, e, t),
801
- onCancel: () => c(u)
802
- }) : null]
828
+ children: [
829
+ /* @__PURE__ */ V("span", {
830
+ class: "whoo-widget-sr-only",
831
+ children: [t, ": "]
832
+ }),
833
+ i ? /* @__PURE__ */ V(Qe, { isSlowResponse: a }) : Ye(e.content),
834
+ r && e.role === "assistant" && f ? /* @__PURE__ */ V(Ze, {
835
+ state: n,
836
+ containerRef: d,
837
+ onThumbsUp: () => o(f),
838
+ onThumbsDown: () => s(f),
839
+ onDraftChange: (e, t) => c(f, e, t),
840
+ onSubmitDetailed: (e, t) => l(f, e, t),
841
+ onCancel: () => u(f)
842
+ }) : null
843
+ ]
803
844
  });
804
845
  }
805
- function Ze({ messages: e, messageFeedback: t, lastCompletedMessageText: n, emptyStateImage: r, showFeedback: i = !1, isStreaming: a = !1, isSlowResponse: o = !1, onThumbsUp: s, onThumbsDown: c, onSubmitDetailed: l, onCancelFeedback: u }) {
806
- let d = V(null);
807
- return B(() => {
808
- let e = d.current;
846
+ function tt({ messages: e, messageFeedback: t, announcement: n, emptyStateImage: r, agentName: i = "Aiden", showFeedback: a = !1, isStreaming: o = !1, isSlowResponse: s = !1, onThumbsUp: c, onThumbsDown: l, onDraftChange: u = () => {}, onSubmitDetailed: d, onCancelFeedback: f }) {
847
+ let p = z(null);
848
+ return R(() => {
849
+ let e = p.current;
809
850
  e && (e.scrollTop = e.scrollHeight);
810
- }, [e, o]), /* @__PURE__ */ U(T, { children: [/* @__PURE__ */ U("div", {
851
+ }, [e, s]), /* @__PURE__ */ V(E, { children: [/* @__PURE__ */ V("section", {
811
852
  class: "whoo-widget-message-list",
812
- ref: d,
813
- children: [r ? /* @__PURE__ */ U(Ye, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ U(Xe, {
853
+ ref: p,
854
+ "aria-label": "Conversation",
855
+ tabIndex: 0,
856
+ children: [r ? /* @__PURE__ */ V($e, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ V(et, {
814
857
  message: n,
815
- showFeedback: i,
858
+ speaker: n.role === "user" ? "You" : i,
859
+ showFeedback: a,
816
860
  feedbackState: n.id ? t[n.id] ?? { status: "idle" } : { status: "idle" },
817
- pending: a && r === e.length - 1 && n.role === "assistant" && n.content === "",
818
- isSlowResponse: o,
819
- onThumbsUp: s,
820
- onThumbsDown: c,
821
- onSubmitDetailed: l,
822
- onCancelFeedback: u
861
+ pending: o && r === e.length - 1 && n.role === "assistant" && n.content === "",
862
+ isSlowResponse: s,
863
+ onThumbsUp: c,
864
+ onThumbsDown: l,
865
+ onDraftChange: u,
866
+ onSubmitDetailed: d,
867
+ onCancelFeedback: f
823
868
  }, n.id ?? r))]
824
- }), /* @__PURE__ */ U("div", {
869
+ }), /* @__PURE__ */ V("div", {
825
870
  class: "whoo-widget-sr-only",
826
871
  "aria-live": "polite",
827
872
  "aria-atomic": "true",
@@ -830,110 +875,114 @@ function Ze({ messages: e, messageFeedback: t, lastCompletedMessageText: n, empt
830
875
  }
831
876
  //#endregion
832
877
  //#region src/components/Panel.tsx
833
- var Qe = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
834
- function $e(e) {
835
- return Array.from(e.querySelectorAll(Qe)).filter((e) => {
878
+ var nt = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
879
+ function rt(e) {
880
+ return Array.from(e.querySelectorAll(nt)).filter((e) => {
836
881
  let t = getComputedStyle(e);
837
882
  return t.display !== "none" && t.visibility !== "hidden";
838
883
  });
839
884
  }
840
- function et({ state: e, controller: t, greeting: n }) {
841
- let r = V(null), i = V(null);
842
- B(() => {
843
- i.current?.focus();
885
+ function it({ state: e, controller: t, greeting: n }) {
886
+ let i = z(null), a = z(null);
887
+ R(() => {
888
+ a.current?.focus();
844
889
  }, []);
845
- let a = (e) => {
890
+ let o = (e) => {
846
891
  if (e.key === "Escape") {
847
892
  t.close();
848
893
  return;
849
894
  }
850
895
  if (e.key !== "Tab") return;
851
- let n = r.current;
896
+ let n = i.current;
852
897
  if (!n) return;
853
- let i = $e(n);
854
- if (i.length === 0) return;
855
- let a = i[0], o = i[i.length - 1], s = n.getRootNode().activeElement;
898
+ let r = rt(n);
899
+ if (r.length === 0) return;
900
+ let a = r[0], o = r[r.length - 1], s = n.getRootNode().activeElement;
856
901
  if (!n.contains(s)) {
857
902
  e.preventDefault(), a.focus();
858
903
  return;
859
904
  }
860
905
  e.shiftKey && s === a ? (e.preventDefault(), o.focus()) : !e.shiftKey && s === o && (e.preventDefault(), a.focus());
861
- }, o = () => {
906
+ }, s = () => {
862
907
  let n = e.draft.trim();
863
908
  n && !e.isStreaming && (t.setDraft(""), t.sendMessage(n));
864
- }, s = `Chat with ${e.agentName ?? (t.config.name?.trim() || "Aiden")}`, c = e.messages.length === 0 && n ? [{
909
+ }, c = r(t.config.name) || e.agentName || "Aiden", l = `Chat with ${c}`, u = e.messages.length === 0 && n ? [{
865
910
  role: "assistant",
866
911
  content: n,
867
912
  id: null
868
- }] : e.messages, l = t.emptyStateImageUrl, u = e.messages.length === 0 && l ? {
869
- url: l,
913
+ }] : e.messages, d = t.emptyStateImageUrl, f = e.messages.length === 0 && d ? {
914
+ url: d,
870
915
  alt: t.emptyStateImageAlt
871
916
  } : void 0;
872
- return /* @__PURE__ */ U("div", {
917
+ return /* @__PURE__ */ V("div", {
873
918
  class: "whoo-widget-panel",
874
919
  role: "dialog",
875
920
  "aria-modal": "true",
876
- "aria-label": s,
877
- ref: r,
878
- onKeyDown: a,
921
+ "aria-label": l,
922
+ ref: i,
923
+ onKeyDown: o,
879
924
  children: [
880
- /* @__PURE__ */ U("div", {
925
+ /* @__PURE__ */ V("div", {
881
926
  class: "whoo-widget-header",
882
- children: [/* @__PURE__ */ U("h2", {
927
+ children: [/* @__PURE__ */ V("h2", {
883
928
  class: "whoo-widget-header-title",
884
- children: s
885
- }), /* @__PURE__ */ U("div", {
929
+ children: l
930
+ }), /* @__PURE__ */ V("div", {
886
931
  class: "whoo-widget-header-actions",
887
- children: [e.messages.length > 0 && /* @__PURE__ */ U("button", {
932
+ children: [e.messages.length > 0 && /* @__PURE__ */ V("button", {
888
933
  type: "button",
889
934
  class: "whoo-widget-header-reset",
890
- onClick: () => t.resetConversation(),
935
+ onClick: () => {
936
+ t.resetConversation(), a.current?.focus();
937
+ },
891
938
  children: "New conversation"
892
- }), /* @__PURE__ */ U("button", {
939
+ }), /* @__PURE__ */ V("button", {
893
940
  type: "button",
894
941
  class: "whoo-widget-header-close",
895
942
  "aria-label": "Close chat",
896
943
  onClick: () => t.close(),
897
- children: /* @__PURE__ */ U(Fe, {})
944
+ children: /* @__PURE__ */ V(Re, {})
898
945
  })]
899
946
  })]
900
947
  }),
901
- /* @__PURE__ */ U(Ze, {
902
- messages: c,
948
+ /* @__PURE__ */ V(tt, {
949
+ messages: u,
903
950
  messageFeedback: e.messageFeedback,
904
- lastCompletedMessageText: e.lastCompletedMessageText,
905
- emptyStateImage: u,
951
+ announcement: e.announcement,
952
+ emptyStateImage: f,
953
+ agentName: c,
906
954
  showFeedback: t.showFeedback,
907
955
  isStreaming: e.isStreaming,
908
956
  isSlowResponse: e.isSlowResponse,
909
957
  onThumbsUp: (e) => t.submitFeedback(e, "up"),
910
958
  onThumbsDown: (e) => t.expandFeedback(e),
959
+ onDraftChange: (e, n, r) => t.setFeedbackDraft(e, n, r),
911
960
  onSubmitDetailed: (e, n, r) => t.submitFeedback(e, "down", n || void 0, r || void 0),
912
961
  onCancelFeedback: (e) => t.cancelFeedback(e)
913
962
  }),
914
- e.runtimeError && /* @__PURE__ */ U(Ve, { message: e.runtimeError }),
915
- /* @__PURE__ */ U(Be, {
963
+ e.runtimeError && /* @__PURE__ */ V(We, { message: e.runtimeError }),
964
+ /* @__PURE__ */ V(Ue, {
916
965
  value: e.draft,
917
966
  onChange: (e) => t.setDraft(e),
918
- onSend: o,
967
+ onSend: s,
919
968
  disabled: e.isStreaming,
920
- inputRef: i
969
+ inputRef: a
921
970
  })
922
971
  ]
923
972
  });
924
973
  }
925
974
  //#endregion
926
975
  //#region src/components/App.tsx
927
- function tt({ controller: e }) {
928
- let [t, n] = z(e.getState()), r = V(null), i = V(t.isOpen);
929
- return B(() => (n(e.getState()), e.subscribe(n)), [e]), B(() => {
976
+ function at({ controller: e }) {
977
+ let [t, n] = Ee(e.getState()), r = z(null), i = z(t.isOpen);
978
+ return R(() => (n(e.getState()), e.subscribe(n)), [e]), R(() => {
930
979
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
931
- }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ U(T, { children: [/* @__PURE__ */ U(ze, {
980
+ }, [t.isOpen]), t.initError ? null : /* @__PURE__ */ V(E, { children: [/* @__PURE__ */ V(He, {
932
981
  isOpen: t.isOpen,
933
982
  onClick: () => t.isOpen ? e.close() : e.open(),
934
983
  iconUrl: e.launcherIconUrl,
935
984
  buttonRef: r
936
- }), t.isOpen && /* @__PURE__ */ U(et, {
985
+ }), t.isOpen && /* @__PURE__ */ V(it, {
937
986
  state: t,
938
987
  controller: e,
939
988
  greeting: e.config.greeting
@@ -941,34 +990,44 @@ function tt({ controller: e }) {
941
990
  }
942
991
  //#endregion
943
992
  //#region src/api/client.ts
944
- var nt = class extends Error {
993
+ var X = class extends Error {
945
994
  status;
946
995
  constructor(e, t) {
947
996
  super(e), this.name = "WidgetApiError", this.status = t;
948
997
  }
949
998
  };
950
- function rt(e) {
999
+ function Z(e) {
951
1000
  if (typeof e != "string") return null;
952
1001
  let t = e.trim();
953
1002
  return t === "" ? null : t;
954
1003
  }
955
- async function it(e, t) {
1004
+ async function ot(e, t) {
956
1005
  let n = await fetch(`${e}/api/v1/widget/session`, {
957
1006
  method: "POST",
958
1007
  headers: { "Content-Type": "application/json" },
959
1008
  body: JSON.stringify({ publishable_key: t })
960
1009
  });
961
- if (!n.ok) throw new nt(`Failed to create widget session (${n.status})`, n.status);
1010
+ if (!n.ok) throw new X(`Failed to create widget session (${n.status})`, n.status);
962
1011
  let r = await n.json();
963
1012
  return {
964
1013
  token: r.token,
965
- primaryColor: r.primary_color ?? null,
966
- name: rt(r.name),
967
- accentColor: rt(r.accent_color),
968
- inkColor: rt(r.ink_color)
1014
+ ...st(r)
1015
+ };
1016
+ }
1017
+ function st(e) {
1018
+ return {
1019
+ primaryColor: Z(e.primary_color),
1020
+ name: Z(e.name),
1021
+ accentColor: Z(e.accent_color),
1022
+ inkColor: Z(e.ink_color)
969
1023
  };
970
1024
  }
971
- async function at(e, t, n) {
1025
+ async function ct(e, t) {
1026
+ let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
1027
+ if (!n.ok) throw new X(`Failed to load widget branding (${n.status})`, n.status);
1028
+ return st(await n.json());
1029
+ }
1030
+ async function lt(e, t, n) {
972
1031
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
973
1032
  method: "POST",
974
1033
  headers: {
@@ -982,11 +1041,11 @@ async function at(e, t, n) {
982
1041
  category: n.category ?? null
983
1042
  })
984
1043
  });
985
- if (!r.ok) throw new nt(`Feedback submission failed (${r.status})`, r.status);
1044
+ if (!r.ok) throw new X(`Feedback submission failed (${r.status})`, r.status);
986
1045
  }
987
1046
  //#endregion
988
1047
  //#region src/api/sse.ts
989
- async function* ot(e, t, n, r, i) {
1048
+ async function* ut(e, t, n, r, i) {
990
1049
  let a = await fetch(`${e}/api/v1/widget/chat`, {
991
1050
  method: "POST",
992
1051
  headers: {
@@ -999,7 +1058,7 @@ async function* ot(e, t, n, r, i) {
999
1058
  }),
1000
1059
  signal: i
1001
1060
  });
1002
- if (!a.ok || !a.body) throw new nt(`Chat request failed (${a.status})`, a.status);
1061
+ if (!a.ok || !a.body) throw new X(`Chat request failed (${a.status})`, a.status);
1003
1062
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1004
1063
  for (;;) {
1005
1064
  let { done: e, value: t } = await o.read();
@@ -1010,11 +1069,11 @@ async function* ot(e, t, n, r, i) {
1010
1069
  let e = c.slice(0, n);
1011
1070
  c = c.slice(n + 2);
1012
1071
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1013
- t && (yield st(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1072
+ t && (yield dt(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1014
1073
  }
1015
1074
  }
1016
1075
  }
1017
- function st(e) {
1076
+ function dt(e) {
1018
1077
  return typeof e.error == "string" ? {
1019
1078
  type: "error",
1020
1079
  error: e.error,
@@ -1037,7 +1096,7 @@ function st(e) {
1037
1096
  }
1038
1097
  //#endregion
1039
1098
  //#region src/imageUrl.ts
1040
- function ct(e, t) {
1099
+ function ft(e, t) {
1041
1100
  if (e != null && e !== "") {
1042
1101
  if (typeof e == "string") try {
1043
1102
  let t = new URL(e);
@@ -1047,17 +1106,29 @@ function ct(e, t) {
1047
1106
  }
1048
1107
  }
1049
1108
  //#endregion
1109
+ //#region src/markdown/plainText.ts
1110
+ function pt(e) {
1111
+ return J(e.replace(/\r\n?/g, "\n")).map((e) => {
1112
+ switch (e.type) {
1113
+ case "bold":
1114
+ case "italic": return pt(e.value);
1115
+ case "link": return e.text;
1116
+ default: return e.value;
1117
+ }
1118
+ }).join("");
1119
+ }
1120
+ //#endregion
1050
1121
  //#region src/markdown/reveal.ts
1051
- var lt = 40, ut = 120;
1052
- function dt(e) {
1122
+ var mt = 40, ht = 120;
1123
+ function gt(e) {
1053
1124
  let t = [];
1054
- for (let n of We(e)) if (n.type === "text") {
1125
+ for (let n of J(e)) if (n.type === "text") {
1055
1126
  let e = n.value.split(/(\s+)/), r = n.start;
1056
1127
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
1057
1128
  } else t.push(n.end);
1058
1129
  return t;
1059
1130
  }
1060
- function ft(e) {
1131
+ function _t(e) {
1061
1132
  let t = null;
1062
1133
  return e?.addEventListener("abort", () => {
1063
1134
  t?.();
@@ -1072,36 +1143,154 @@ function ft(e) {
1072
1143
  });
1073
1144
  };
1074
1145
  }
1075
- async function pt(e, t, n) {
1076
- let r = n?.wordIntervalMs ?? lt, i = n?.tokenIntervalMs ?? ut, a = n?.signal, o = We(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = ft(a), l = "";
1077
- for (let n of dt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1146
+ async function vt(e, t, n) {
1147
+ let r = n?.wordIntervalMs ?? mt, i = n?.tokenIntervalMs ?? ht, a = n?.signal, o = J(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = _t(a), l = "";
1148
+ for (let n of gt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1078
1149
  l !== e && t(e);
1079
1150
  }
1080
1151
  //#endregion
1081
1152
  //#region src/storage.ts
1082
- function mt(e) {
1153
+ function yt(e) {
1083
1154
  return `whoo-aiden-widget:conversation:${e}`;
1084
1155
  }
1085
- function ht(e) {
1156
+ function bt(e) {
1086
1157
  try {
1087
- return window.sessionStorage.getItem(mt(e));
1158
+ return window.sessionStorage.getItem(yt(e));
1088
1159
  } catch {
1089
1160
  return null;
1090
1161
  }
1091
1162
  }
1092
- function gt(e, t) {
1163
+ function xt(e, t) {
1093
1164
  try {
1094
- window.sessionStorage.setItem(mt(e), t);
1165
+ window.sessionStorage.setItem(yt(e), t);
1095
1166
  } catch {}
1096
1167
  }
1097
- function _t(e) {
1168
+ function St(e) {
1098
1169
  try {
1099
- window.sessionStorage.removeItem(mt(e));
1170
+ window.sessionStorage.removeItem(yt(e));
1100
1171
  } catch {}
1101
1172
  }
1102
1173
  //#endregion
1174
+ //#region src/theme.ts
1175
+ var Ct = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1176
+ function wt(e) {
1177
+ if (Ct.test(e.trim())) return null;
1178
+ let t = document.createElement("div");
1179
+ if (t.style.color = e, t.style.color === "") return null;
1180
+ let n = document.createElement("div");
1181
+ n.attachShadow({ mode: "open" }).appendChild(t), document.body.appendChild(n);
1182
+ let r = getComputedStyle(t).color;
1183
+ n.remove();
1184
+ let i = r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);
1185
+ if (!i) return null;
1186
+ let a = i[4] === void 0 ? 1 : Number(i[4]);
1187
+ return {
1188
+ rgb: [
1189
+ Number(i[1]),
1190
+ Number(i[2]),
1191
+ Number(i[3])
1192
+ ].map((e) => Math.round(e * a + 255 * (1 - a))),
1193
+ translucent: a < 1
1194
+ };
1195
+ }
1196
+ function Tt(e) {
1197
+ return wt(e)?.rgb ?? null;
1198
+ }
1199
+ function Q([e, t, n]) {
1200
+ let r = (e) => {
1201
+ let t = e / 255;
1202
+ return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1203
+ };
1204
+ return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
1205
+ }
1206
+ function Et(e, t) {
1207
+ let n = Math.max(e, t), r = Math.min(e, t);
1208
+ return (n + .05) / (r + .05);
1209
+ }
1210
+ function Dt(e) {
1211
+ let t = Tt(e);
1212
+ if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
1213
+ let n = Q(t);
1214
+ return Et(n, Q([
1215
+ 0,
1216
+ 0,
1217
+ 0
1218
+ ])) >= Et(n, Q([
1219
+ 255,
1220
+ 255,
1221
+ 255
1222
+ ])) ? "#000000" : "#ffffff";
1223
+ }
1224
+ var Ot = "#4f46e5", kt = "#ffffff", At = "#f0f0f0", jt = "#f3f4f6", Mt = 4.5;
1225
+ function Nt([e, t, n]) {
1226
+ return `#${[
1227
+ e,
1228
+ t,
1229
+ n
1230
+ ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
1231
+ }
1232
+ function Pt(e, t = kt) {
1233
+ let n = Tt(e), r = Tt(t);
1234
+ if (!n || !r) return Ot;
1235
+ let i = Q(r), a = (e) => Et(Q(e), i) >= Mt;
1236
+ if (a(n)) return Nt(n);
1237
+ for (let e = .99; e > 0; e -= .01) {
1238
+ let t = n.map((t) => Math.round(t * e));
1239
+ if (a(t)) return Nt(t);
1240
+ }
1241
+ return "#000000";
1242
+ }
1243
+ var Ft = "#111111", It = "#0000ee";
1244
+ function $(e) {
1245
+ if (typeof e != "string" || !e) return null;
1246
+ let t = wt(e);
1247
+ return t ? Nt(t.rgb) : null;
1248
+ }
1249
+ function Lt({ color: e, inkColor: t, accentColor: n }) {
1250
+ let r = $(e), i = r ?? Ot, a = Pt(i, jt), o = $(t), s = o ? Pt(o, At) : Ft, c = $(n), l = c ? Pt(c, At) : It;
1251
+ return {
1252
+ primary: i,
1253
+ textOnPrimary: Dt(i),
1254
+ primaryAsText: a,
1255
+ ink: s,
1256
+ link: l,
1257
+ adjusted: {
1258
+ primary: r !== null && a !== i,
1259
+ ink: o !== null && s !== o,
1260
+ link: c !== null && l !== c
1261
+ }
1262
+ };
1263
+ }
1264
+ function Rt(e) {
1265
+ return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
1266
+ }
1267
+ function zt(e, t, n = Ot) {
1268
+ let r = t;
1269
+ $(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Rt(t)} as the theme color; falling back to ${Rt(n)}.`), r = n);
1270
+ let i = Lt({ color: r });
1271
+ e.style.setProperty("--whoo-widget-color", i.primary), e.style.setProperty("--whoo-widget-text-on-color", i.textOnPrimary), e.style.setProperty("--whoo-widget-color-text", i.primaryAsText);
1272
+ }
1273
+ function Bt(e, { inkColor: t, accentColor: n }) {
1274
+ let r = Lt({
1275
+ inkColor: t,
1276
+ accentColor: n
1277
+ });
1278
+ e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
1279
+ }
1280
+ function Vt(e, t) {
1281
+ e && $(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Rt(e)} as the ${t}; using the default.`);
1282
+ }
1283
+ function Ht(e, t) {
1284
+ zt(e, t.color ?? Ot), Vt(t.inkColor, "ink color"), Vt(t.accentColor, "accent color"), Bt(e, {
1285
+ inkColor: t.inkColor,
1286
+ accentColor: t.accentColor
1287
+ });
1288
+ let n = t.position === "bottom-left";
1289
+ e.style.setProperty("--whoo-widget-inset-left", n ? "20px" : "auto"), e.style.setProperty("--whoo-widget-inset-right", n ? "auto" : "20px");
1290
+ }
1291
+ //#endregion
1103
1292
  //#region src/controller.ts
1104
- var vt = 8e3, yt = class {
1293
+ var Ut = 8e3, Wt = class {
1105
1294
  config;
1106
1295
  state;
1107
1296
  listeners = /* @__PURE__ */ new Set();
@@ -1116,7 +1305,7 @@ var vt = 8e3, yt = class {
1116
1305
  emptyStateImageAlt;
1117
1306
  showFeedback;
1118
1307
  constructor(e) {
1119
- this.config = e, this.launcherIconUrl = ct(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = ct(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
1308
+ this.config = e, this.launcherIconUrl = ft(e.launcherIconUrl, "launcherIconUrl"), this.emptyStateImageUrl = ft(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
1120
1309
  isOpen: !1,
1121
1310
  messages: [],
1122
1311
  isStreaming: !1,
@@ -1127,7 +1316,7 @@ var vt = 8e3, yt = class {
1127
1316
  agentName: null,
1128
1317
  accentColor: null,
1129
1318
  inkColor: null,
1130
- lastCompletedMessageText: null,
1319
+ announcement: null,
1131
1320
  isSlowResponse: !1,
1132
1321
  draft: ""
1133
1322
  };
@@ -1153,7 +1342,7 @@ var vt = 8e3, yt = class {
1153
1342
  try {
1154
1343
  if (this.config.sessionToken) this.sessionToken = this.config.sessionToken;
1155
1344
  else if (this.config.publishableKey) {
1156
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await it(e, this.config.publishableKey);
1345
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await ot(e, this.config.publishableKey);
1157
1346
  this.sessionToken = t, this.setState({
1158
1347
  primaryColor: n,
1159
1348
  agentName: r,
@@ -1165,18 +1354,31 @@ var vt = 8e3, yt = class {
1165
1354
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
1166
1355
  return;
1167
1356
  }
1168
- this.conversationId = ht(this.storageIdentifier);
1357
+ this.conversationId = bt(this.storageIdentifier), this.config.sessionToken && await this.loadBranding(e, this.config.sessionToken);
1358
+ }
1359
+ async loadBranding(e, t) {
1360
+ try {
1361
+ let n = this.config;
1362
+ if ($(n.color) && $(n.inkColor) && $(n.accentColor) && r(n.name)) return;
1363
+ let { primaryColor: i, name: a, accentColor: o, inkColor: s } = await ct(e, t);
1364
+ this.setState({
1365
+ primaryColor: i,
1366
+ agentName: a,
1367
+ accentColor: o,
1368
+ inkColor: s
1369
+ });
1370
+ } catch {}
1169
1371
  }
1170
1372
  open() {
1171
1373
  this.setState({ isOpen: !0 });
1172
1374
  }
1173
1375
  resetConversation() {
1174
- this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, _t(this.storageIdentifier), this.setState({
1376
+ this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, St(this.storageIdentifier), this.setState({
1175
1377
  messages: [],
1176
1378
  messageFeedback: {},
1177
1379
  runtimeError: null,
1178
1380
  isStreaming: !1,
1179
- lastCompletedMessageText: null
1381
+ announcement: "Conversation cleared"
1180
1382
  });
1181
1383
  }
1182
1384
  setDraft(e) {
@@ -1203,7 +1405,8 @@ var vt = 8e3, yt = class {
1203
1405
  r
1204
1406
  ],
1205
1407
  isStreaming: !0,
1206
- runtimeError: null
1408
+ runtimeError: null,
1409
+ announcement: null
1207
1410
  });
1208
1411
  let i = (e) => {
1209
1412
  let t = [...this.state.messages];
@@ -1216,7 +1419,7 @@ var vt = 8e3, yt = class {
1216
1419
  let { signal: a } = this.activeRequestController;
1217
1420
  this.slowResponseTimer = setTimeout(() => {
1218
1421
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 });
1219
- }, vt);
1422
+ }, Ut);
1220
1423
  let o = () => {
1221
1424
  this.setState({
1222
1425
  runtimeError: "Something went wrong, please try again.",
@@ -1224,17 +1427,17 @@ var vt = 8e3, yt = class {
1224
1427
  });
1225
1428
  }, s = "";
1226
1429
  try {
1227
- for await (let n of ot(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, gt(this.storageIdentifier, n.conversationId);
1228
- else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await pt(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1430
+ for await (let n of ut(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, xt(this.storageIdentifier, n.conversationId);
1431
+ else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await vt(n.delta, (e) => i(e), { signal: a }), s = n.delta) : n.verbatim ? (s = n.delta, i(s)) : (s += n.delta, i(s));
1229
1432
  else if (n.type === "done") {
1230
- if (n.conversationId && (this.conversationId = n.conversationId, gt(this.storageIdentifier, n.conversationId)), n.messageId) {
1433
+ if (n.conversationId && (this.conversationId = n.conversationId, xt(this.storageIdentifier, n.conversationId)), n.messageId) {
1231
1434
  let e = [...this.state.messages];
1232
1435
  e[e.length - 1] = {
1233
1436
  ...e[e.length - 1],
1234
1437
  id: n.messageId
1235
1438
  }, this.setState({ messages: e });
1236
1439
  }
1237
- this.setState({ lastCompletedMessageText: s });
1440
+ this.setState({ announcement: pt(s) });
1238
1441
  } else if (n.type === "error") {
1239
1442
  console.error("[whoo-aiden-widget] chat error:", n.error), o(), this.activeRequestController?.abort();
1240
1443
  break;
@@ -1246,9 +1449,24 @@ var vt = 8e3, yt = class {
1246
1449
  }
1247
1450
  }
1248
1451
  expandFeedback(e) {
1452
+ let { correction: t, category: n } = this.state.messageFeedback[e] ?? {};
1249
1453
  this.setState({ messageFeedback: {
1250
1454
  ...this.state.messageFeedback,
1251
- [e]: { status: "expanded" }
1455
+ [e]: {
1456
+ status: "expanded",
1457
+ correction: t,
1458
+ category: n
1459
+ }
1460
+ } });
1461
+ }
1462
+ setFeedbackDraft(e, t, n) {
1463
+ this.setState({ messageFeedback: {
1464
+ ...this.state.messageFeedback,
1465
+ [e]: {
1466
+ ...this.state.messageFeedback[e],
1467
+ correction: t,
1468
+ category: n
1469
+ }
1252
1470
  } });
1253
1471
  }
1254
1472
  cancelFeedback(e) {
@@ -1268,7 +1486,7 @@ var vt = 8e3, yt = class {
1268
1486
  }
1269
1487
  } });
1270
1488
  try {
1271
- await at(i, this.sessionToken, {
1489
+ await lt(i, this.sessionToken, {
1272
1490
  messageId: e,
1273
1491
  rating: t,
1274
1492
  correction: n,
@@ -1280,154 +1498,44 @@ var vt = 8e3, yt = class {
1280
1498
  rating: t
1281
1499
  }
1282
1500
  } });
1283
- } catch (n) {
1284
- console.error("[whoo-aiden-widget] feedback submission failed:", n), this.setState({ messageFeedback: {
1501
+ } catch (i) {
1502
+ console.error("[whoo-aiden-widget] feedback submission failed:", i), this.setState({ messageFeedback: {
1285
1503
  ...this.state.messageFeedback,
1286
1504
  [e]: {
1287
1505
  status: "error",
1288
- rating: t
1506
+ rating: t,
1507
+ correction: n,
1508
+ category: r
1289
1509
  }
1290
1510
  } });
1291
1511
  }
1292
1512
  }
1293
- }, bt = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:20px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:var(--whoo-widget-color,#4f46e5);width:56px;height:56px;color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{display:block}.whoo-widget-launcher-icon-image{object-fit:cover;border-radius:50%;width:32px;height:32px}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:88px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:#fff;border-radius:12px;flex-direction:column;width:360px;max-width:calc(100vw - 40px);height:480px;max-height:calc(100vh - 108px);display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-header{border-bottom:1px solid #e5e5e5;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 16px;display:flex}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:15px;font-weight:600;overflow:hidden}.whoo-widget-header-actions{flex-shrink:0;align-items:center;gap:4px;display:flex}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:#f3f4f6}.whoo-widget-message-list{flex:1;min-height:100px;padding:12px;overflow-y:auto}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-message{white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-left:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{color:var(--whoo-widget-ink,#111);background:#f0f0f0}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:#6b7280;border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{color:#991b1b;background:#fee2e2;padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid #e5e5e5;gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid #6b7280;border-radius:6px;flex:1;padding:8px}.whoo-widget-composer-send{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px}.whoo-widget-composer-send:disabled,.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:#4b5563;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:#111;background:#0000000f}.whoo-widget-feedback-buttons button:disabled{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;resize:vertical;border:1px solid #6b7280;border-radius:6px;width:100%;padding:6px;font-size:12px}.whoo-widget-feedback-select{border:1px solid #6b7280;border-radius:6px;min-height:24px;padding:4px;font-size:12px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{color:#111;cursor:pointer;background:#fff;border:1px solid #6b7280;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:#6b7280;margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:#991b1b;font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline-offset:2px;outline:2px solid #111827;box-shadow:0 0 0 4px #fff}", xt = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1294
- function St(e) {
1295
- if (xt.test(e.trim())) return null;
1296
- let t = document.createElement("div");
1297
- if (t.style.color = e, t.style.color === "") return null;
1298
- let n = document.createElement("div");
1299
- n.attachShadow({ mode: "open" }).appendChild(t), document.body.appendChild(n);
1300
- let r = getComputedStyle(t).color;
1301
- n.remove();
1302
- let i = r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);
1303
- if (!i) return null;
1304
- let a = i[4] === void 0 ? 1 : Number(i[4]);
1305
- return {
1306
- rgb: [
1307
- Number(i[1]),
1308
- Number(i[2]),
1309
- Number(i[3])
1310
- ].map((e) => Math.round(e * a + 255 * (1 - a))),
1311
- translucent: a < 1
1312
- };
1313
- }
1314
- function Ct(e) {
1315
- return St(e)?.rgb ?? null;
1316
- }
1317
- function X([e, t, n]) {
1318
- let r = (e) => {
1319
- let t = e / 255;
1320
- return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1321
- };
1322
- return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
1323
- }
1324
- function Z(e, t) {
1325
- let n = Math.max(e, t), r = Math.min(e, t);
1326
- return (n + .05) / (r + .05);
1327
- }
1328
- function wt(e) {
1329
- let t = Ct(e);
1330
- if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
1331
- let n = X(t);
1332
- return Z(n, X([
1333
- 0,
1334
- 0,
1335
- 0
1336
- ])) >= Z(n, X([
1337
- 255,
1338
- 255,
1339
- 255
1340
- ])) ? "#000000" : "#ffffff";
1341
- }
1342
- var Q = "#4f46e5", Tt = "#ffffff", Et = "#f0f0f0", Dt = 4.5;
1343
- function Ot([e, t, n]) {
1344
- return `#${[
1345
- e,
1346
- t,
1347
- n
1348
- ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
1349
- }
1350
- function kt(e, t = Tt) {
1351
- let n = Ct(e), r = Ct(t);
1352
- if (!n || !r) return Q;
1353
- let i = X(r), a = (e) => Z(X(e), i) >= Dt;
1354
- if (a(n)) return Ot(n);
1355
- for (let e = .99; e > 0; e -= .01) {
1356
- let t = n.map((t) => Math.round(t * e));
1357
- if (a(t)) return Ot(t);
1358
- }
1359
- return "#000000";
1360
- }
1361
- var At = "#111111", jt = "#0000ee";
1362
- function $(e) {
1363
- if (!e) return null;
1364
- let t = St(e);
1365
- return t ? Ot(t.rgb) : null;
1366
- }
1367
- function Mt({ color: e, inkColor: t, accentColor: n }) {
1368
- let r = $(e), i = r ?? Q, a = kt(i), o = $(t), s = o ? kt(o, Et) : At, c = $(n), l = c ? kt(c, Et) : jt;
1369
- return {
1370
- primary: i,
1371
- textOnPrimary: wt(i),
1372
- primaryAsText: a,
1373
- ink: s,
1374
- link: l,
1375
- adjusted: {
1376
- primary: r !== null && a !== i,
1377
- ink: o !== null && s !== o,
1378
- link: c !== null && l !== c
1379
- }
1380
- };
1381
- }
1382
- function Nt(e, t, n = Q) {
1383
- let r = t;
1384
- $(t) === null && (console.warn(`[whoo-aiden-widget] Could not use "${t}" as the theme color; falling back to "${n}".`), r = n);
1385
- let i = Mt({ color: r });
1386
- e.style.setProperty("--whoo-widget-color", i.primary), e.style.setProperty("--whoo-widget-text-on-color", i.textOnPrimary), e.style.setProperty("--whoo-widget-color-text", i.primaryAsText);
1387
- }
1388
- function Pt(e, { inkColor: t, accentColor: n }) {
1389
- let r = Mt({
1390
- inkColor: t,
1391
- accentColor: n
1392
- });
1393
- e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
1394
- }
1395
- function Ft(e, t) {
1396
- e && $(e) === null && console.warn(`[whoo-aiden-widget] Could not use "${e}" as the ${t}; using the default.`);
1397
- }
1398
- function It(e, t) {
1399
- Nt(e, t.color ?? Q), Ft(t.inkColor, "ink color"), Ft(t.accentColor, "accent color"), Pt(e, {
1400
- inkColor: t.inkColor,
1401
- accentColor: t.accentColor
1402
- });
1403
- let n = t.position === "bottom-left";
1404
- e.style.setProperty("--whoo-widget-inset-left", n ? "20px" : "auto"), e.style.setProperty("--whoo-widget-inset-right", n ? "auto" : "20px");
1405
- }
1513
+ }, Gt = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:20px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:var(--whoo-widget-color,#4f46e5);width:56px;height:56px;color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{display:block}.whoo-widget-launcher-icon-image{object-fit:cover;border-radius:50%;width:32px;height:32px}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:88px;left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);background:#fff;border-radius:12px;flex-direction:column;width:360px;max-width:calc(100vw - 40px);height:480px;max-height:calc(100vh - 108px);display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-header{border-bottom:1px solid #e5e5e5;flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding:8px 8px 8px 16px;display:flex;overflow-y:auto}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;flex:auto;min-width:0;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-actions{background:#fff;flex-shrink:0;align-items:center;gap:4px;margin-left:auto;display:flex;position:sticky;bottom:0}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:#f3f4f6}.whoo-widget-message-list{flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline-offset:-2px;outline:2px solid #111827;box-shadow:inset 0 0 0 4px #fff}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-list{margin:4px 0;padding-left:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-left:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{color:var(--whoo-widget-ink,#111);background:#f0f0f0}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:#6b7280;border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{color:#991b1b;background:#fee2e2;padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid #e5e5e5;gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid #6b7280;border-radius:6px;flex:1;padding:8px}.whoo-widget-composer-send{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:#4b5563;background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:#111;background:#0000000f}.whoo-widget-feedback-buttons button:disabled{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;resize:vertical;border:1px solid #6b7280;border-radius:6px;width:100%;padding:6px;font-size:12px}.whoo-widget-feedback-select{border:1px solid #6b7280;border-radius:6px;min-height:24px;padding:4px;font-size:12px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{color:#111;cursor:pointer;background:#fff;border:1px solid #6b7280;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:#4b5563;margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:#991b1b;font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline-offset:2px;outline:2px solid #111827;box-shadow:0 0 0 4px #fff}@media (forced-colors:active){.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
1406
1514
  //#endregion
1407
1515
  //#region src/mount.tsx
1408
- function Lt(e) {
1516
+ function Kt(e) {
1409
1517
  let t = document.createElement("div");
1410
1518
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(n(e.zIndex));
1411
1519
  let r = t.attachShadow({ mode: "open" }), i = document.createElement("style");
1412
- i.textContent = bt, r.appendChild(i);
1520
+ i.textContent = Gt, r.appendChild(i);
1413
1521
  let a = document.createElement("div");
1414
- r.appendChild(a), It(a, e);
1415
- let o = new yt(e), s = null, c = "";
1522
+ r.appendChild(a), Ht(a, e);
1523
+ let o = new Wt(e), s = $(e.color) !== null, c = null, l = "";
1416
1524
  return o.subscribe((t) => {
1417
- t.primaryColor && t.primaryColor !== s && (s = t.primaryColor, Nt(a, t.primaryColor, e.color));
1525
+ !s && t.primaryColor && t.primaryColor !== c && (c = t.primaryColor, zt(a, t.primaryColor, e.color));
1418
1526
  let n = `${t.inkColor}|${t.accentColor}`;
1419
- (t.inkColor || t.accentColor) && n !== c && (c = n, Pt(a, {
1420
- inkColor: $(t.inkColor) ? t.inkColor : e.inkColor,
1421
- accentColor: $(t.accentColor) ? t.accentColor : e.accentColor
1527
+ (t.inkColor || t.accentColor) && n !== l && (l = n, Bt(a, {
1528
+ inkColor: $(e.inkColor) ? e.inkColor : t.inkColor,
1529
+ accentColor: $(e.accentColor) ? e.accentColor : t.accentColor
1422
1530
  }));
1423
- }), pe(/* @__PURE__ */ U(tt, { controller: o }), a), o.init(), document.body.appendChild(t), { unmount() {
1424
- pe(null, a), t.remove();
1531
+ }), he(/* @__PURE__ */ V(at, { controller: o }), a), o.init(), document.body.appendChild(t), { unmount() {
1532
+ he(null, a), t.remove();
1425
1533
  } };
1426
1534
  }
1427
1535
  //#endregion
1428
1536
  //#region src/index.ts
1429
- function Rt(e) {
1430
- return r(e), Lt(e);
1537
+ function qt(e) {
1538
+ return i(e), Kt(e);
1431
1539
  }
1432
1540
  //#endregion
1433
- export { Rt as init, Mt as resolveTheme };
1541
+ export { qt as init, Lt as resolveTheme };