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