@aiden-voice/widget 0.7.1 → 0.7.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/widget.js CHANGED
@@ -193,11 +193,11 @@ function te(e) {
193
193
  }
194
194
  //#endregion
195
195
  //#region node_modules/.pnpm/preact@11.0.0/node_modules/preact/dist/preact.mjs
196
- var A, ne, j, re, ie, ae, oe, M, se, ce, le, ue, de = {}, fe = [], pe = /^m(i|n|o|s|text|space)$/, me = Array.isArray, he = fe.slice, N = Object.assign;
197
- function ge(e) {
196
+ var A, ne, j, re, M, ie, ae, N, oe, se, ce, le, ue = {}, P = [], de = /^m(i|n|o|s|text|space)$/, fe = Array.isArray, pe = P.slice, F = Object.assign;
197
+ function me(e) {
198
198
  e && e.parentNode && e.remove();
199
199
  }
200
- function _e(e, t, n, r, i) {
200
+ function he(e, t, n, r, i) {
201
201
  var a = {
202
202
  type: e,
203
203
  props: t,
@@ -215,41 +215,41 @@ function _e(e, t, n, r, i) {
215
215
  };
216
216
  return !i && A.vnode && A.vnode(a), a;
217
217
  }
218
- function P(e) {
218
+ function I(e) {
219
219
  return e.children;
220
220
  }
221
- function ve(e, t) {
221
+ function ge(e, t) {
222
222
  this.props = e, this.context = t, this.__g = 0;
223
223
  }
224
- function F(e, t) {
225
- if (t == null) return e.__ ? F(e.__, e.__i + 1) : null;
224
+ function L(e, t) {
225
+ if (t == null) return e.__ ? L(e.__, e.__i + 1) : null;
226
226
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) && n.__e) return n.__e;
227
- return typeof e.type != "function" || e.props.__P ? null : F(e);
227
+ return typeof e.type != "function" || e.props.__P ? null : L(e);
228
228
  }
229
- function ye(e) {
229
+ function _e(e) {
230
230
  if ((e = e.__) && e.__c && !e.props.__P) return e.__e = null, e.__k.some(function(t) {
231
231
  return t && (e.__e = t.__e);
232
- }), ye(e);
232
+ }), _e(e);
233
233
  }
234
- function be(e) {
235
- (8 & e.__g || !(e.__g |= 8) || !j.push(e) || ie++) && re == A.debounceRendering || ((re = A.debounceRendering) || queueMicrotask)(xe);
234
+ function ve(e) {
235
+ (8 & e.__g || !(e.__g |= 8) || !j.push(e) || M++) && re == A.debounceRendering || ((re = A.debounceRendering) || queueMicrotask)(ye);
236
236
  }
237
- function xe() {
237
+ function ye() {
238
238
  var e, t, n, r, i, a, o, s, c;
239
239
  try {
240
- for (t = 1; j.length;) j.length > t && j.sort(ae), e = j.shift(), t = j.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = N({ constructor: void 0 }, i)).__v = i.__v + 1, A.vnode && A.vnode(r), ke(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || F(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, je(o, r, s), i.__ = i.__e = null, r.__e != a && ye(r)));
240
+ for (t = 1; j.length;) j.length > t && j.sort(ie), e = j.shift(), t = j.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = F({ constructor: void 0 }, i)).__v = i.__v + 1, A.vnode && A.vnode(r), De(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || L(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, ke(o, r, s), i.__ = i.__e = null, r.__e != a && _e(r)));
241
241
  } finally {
242
- j.length = ie = 0;
242
+ j.length = M = 0;
243
243
  }
244
244
  }
245
- function Se(e, t, n, r, i, a, o, s, c, l, u) {
246
- var d, f, p, m, h, g, _ = r.__k || fe, v = t.length;
247
- for (c = Ce(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || de, p.__i = d, g = ke(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 && Ne(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = we(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);
245
+ function be(e, t, n, r, i, a, o, s, c, l, u) {
246
+ var d, f, p, m, h, g, _ = r.__k || P, v = t.length;
247
+ for (c = xe(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || ue, p.__i = d, g = De(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 && je(f.ref, null, p), u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Se(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);
248
248
  return n.__e = h, c;
249
249
  }
250
- function Ce(e, t, n, r, i) {
250
+ function xe(e, t, n, r, i) {
251
251
  var a, o, s, c, l, u, d, f, p, m, h = n.length, g = h, _ = 0, v = !1, y = e.__k = Array(i);
252
- 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] = _e(null, o) : me(o) ? o = y[a] = _e(P, { children: o }) : o.constructor === void 0 && o.__b ? o = y[a] = _e(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 = Te(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;
252
+ 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] = he(null, o) : fe(o) ? o = y[a] = he(I, { children: o }) : o.constructor === void 0 && o.__b ? o = y[a] = he(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 = Ce(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;
253
253
  if (v) {
254
254
  for (u = [], d = [], a = 0; a < i; a++) if ((o = y[a]) && 2 & o.__u) {
255
255
  for (f = 0, p = u.length; f < p;) u[m = f + p >> 1] < o.__i ? f = m + 1 : p = m;
@@ -257,20 +257,20 @@ function Ce(e, t, n, r, i) {
257
257
  }
258
258
  for (_ = u.length; a--;) d[a] && (d[a] == _ ? _-- : y[a].__u |= 4);
259
259
  }
260
- if (g) for (a = 0; a < h; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = F(s)), Pe(s, s));
260
+ if (g) for (a = 0; a < h; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = L(s)), Me(s, s));
261
261
  return r;
262
262
  }
263
- function we(e, t, n, r) {
263
+ function Se(e, t, n, r) {
264
264
  var i, a;
265
265
  if (typeof e.type == "function") {
266
266
  if (e.props.__P) return t;
267
- if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = we(i[a], t, n, !1));
267
+ if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Se(i[a], t, n, !1));
268
268
  return t;
269
269
  }
270
- for (t && !t.parentNode && (t = F(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;);
270
+ for (t && !t.parentNode && (t = L(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;);
271
271
  return t;
272
272
  }
273
- function Te(e, t, n, r) {
273
+ function Ce(e, t, n, r) {
274
274
  var i, a, o, s = e.key, c = e.type, l = t[n], u = l && !(2 & l.__u);
275
275
  if (l === null && s == null || u && s == l.key && c == l.type) return n;
276
276
  if (r > +!!u) {
@@ -278,18 +278,18 @@ function Te(e, t, n, r) {
278
278
  }
279
279
  return -1;
280
280
  }
281
- function Ee(e, t, n) {
281
+ function we(e, t, n) {
282
282
  n ??= "", t[0] == "-" ? e.setProperty(t, n) : e[t] = n;
283
283
  }
284
- function De(e, t, n, r, i) {
284
+ function Te(e, t, n, r, i) {
285
285
  var a;
286
286
  n: if (t == "style") {
287
287
  if (typeof n == "string") e.style.cssText = n;
288
288
  else {
289
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Ee(e.style, t, "");
290
- if (n) for (t in n) r && n[t] == r[t] || Ee(e.style, t, n[t]);
289
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || we(e.style, t, "");
290
+ if (n) for (t in n) r && n[t] == r[t] || we(e.style, t, n[t]);
291
291
  }
292
- } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(se, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), (e.__e ||= {})[t + a] = n, n ? r ? n[M] = r[M] : (n[M] = ce, e.addEventListener(t, a ? ue : le, a)) : e.removeEventListener(t, a ? ue : le, a);
292
+ } else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(oe, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), (e.__e ||= {})[t + a] = n, n ? r ? n[N] = r[N] : (n[N] = se, e.addEventListener(t, a ? le : ce, a)) : e.removeEventListener(t, a ? le : ce, a);
293
293
  else {
294
294
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
295
295
  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 {
@@ -299,17 +299,17 @@ function De(e, t, n, r, i) {
299
299
  typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
300
300
  }
301
301
  }
302
- function Oe(e) {
302
+ function Ee(e) {
303
303
  return function(t) {
304
304
  if (this.__e) {
305
305
  var n = this.__e[t.type + e];
306
- if (t[oe] == null) t[oe] = ce++;
307
- else if (t[oe] < n[M]) return;
306
+ if (t[ae] == null) t[ae] = se++;
307
+ else if (t[ae] < n[N]) return;
308
308
  return n(A.event ? A.event(t) : t);
309
309
  }
310
310
  };
311
311
  }
312
- function ke(e, t, n, r, i, a, o, s, c, l) {
312
+ function De(e, t, n, r, i, a, o, s, c, l) {
313
313
  var u, d, f, p, m, h, g, _, v, y, b, x, S, C, ee, w, T, E, D, O, k = t.type;
314
314
  if (t.constructor !== void 0) return null;
315
315
  if (128 & n.__u && (c = 32 & n.__u, u = n.__c.__z)) {
@@ -327,24 +327,24 @@ function ke(e, t, n, r, i, a, o, s, c, l) {
327
327
  n: if (typeof k == "function") {
328
328
  m = o.length;
329
329
  try {
330
- if (y = t.props, b = (u = k.prototype) && u.render, x = (u = k.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? 2 & (h = t.__c = n.__c).__g && (h.__g |= 1) : (b ? t.__c = h = new k(y, S) : (t.__c = h = new ve(y, S), h.constructor = k, h.render = Fe), x && x.sub(h), h.state || (h.state = {}), h.__n = r, h.__g |= 8, h.__h = [], h.__k = []), b && (h.__s || (h.__s = h.state), k.getDerivedStateFromProps && (h.__s == h.state && (h.__s = N({}, h.__s)), N(h.__s, k.getDerivedStateFromProps(y, h.__s)))), g = h.props, _ = h.state, h.__v = t, n.__c) {
330
+ if (y = t.props, b = (u = k.prototype) && u.render, x = (u = k.contextType) && r[u.__c], S = u ? x ? x.props.value : u.__ : r, n.__c ? 2 & (h = t.__c = n.__c).__g && (h.__g |= 1) : (b ? t.__c = h = new k(y, S) : (t.__c = h = new ge(y, S), h.constructor = k, h.render = Ne), x && x.sub(h), h.state || (h.state = {}), h.__n = r, h.__g |= 8, h.__h = [], h.__k = []), b && (h.__s || (h.__s = h.state), k.getDerivedStateFromProps && (h.__s == h.state && (h.__s = F({}, h.__s)), F(h.__s, k.getDerivedStateFromProps(y, h.__s)))), g = h.props, _ = h.state, h.__v = t, n.__c) {
331
331
  if (b && !k.getDerivedStateFromProps && y !== g && h.componentWillReceiveProps && h.componentWillReceiveProps(y, S), t.__v == n.__v && !(8 & h.__g) || !(4 & h.__g) && h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(y, h.__s, S)) {
332
332
  t.__v != n.__v && (h.props = y, h.state = h.__s, h.__g &= -9), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
333
333
  e && (e.__ = t);
334
- }), fe.push.apply(h.__h, h.__k), h.__k = [], h.__h.length && o.push(h), s = F(n);
334
+ }), P.push.apply(h.__h, h.__k), h.__k = [], h.__h.length && o.push(h), s = L(n);
335
335
  break n;
336
336
  }
337
337
  h.componentWillUpdate && h.componentWillUpdate(y, h.__s, S), b && h.componentDidUpdate && h.__h.push(function() {
338
338
  h.componentDidUpdate(g, _, v);
339
339
  });
340
340
  } else b && !k.getDerivedStateFromProps && h.componentWillMount && h.componentWillMount(), b && h.componentDidMount && h.__h.push(h.componentDidMount);
341
- if (h.context = S, h.props = y, h.__P = e, h.__g &= -5, C = A.__r, ee = 0, b) h.state = h.__s, h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), fe.push.apply(h.__h, h.__k), h.__k = [];
341
+ if (h.context = S, h.props = y, h.__P = e, h.__g &= -5, C = A.__r, ee = 0, b) h.state = h.__s, h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), P.push.apply(h.__h, h.__k), h.__k = [];
342
342
  else do
343
343
  h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), h.state = h.__s;
344
344
  while (8 & h.__g && ++ee < 25);
345
- h.state = h.__s, h.getChildContext && (r = N({}, r, h.getChildContext())), b && n.__c && h.getSnapshotBeforeUpdate && (v = h.getSnapshotBeforeUpdate(g, _)), w = u && u.type === P && u.key == null ? u.props.children : u, y.__P && (u = s, i = (e = y.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
346
- e && Pe(e, e);
347
- }), n.__k = null), s = n.__k ? F(n, 0) : null), s = Se(e, me(w) ? w : [w], t, n, r, i, a, o, s, c, l), y.__P && (t.__e = null, s = u), t.__u &= -161, 128 & n.__u && (h.__z = null), d && d.some(ge), h.__h.length && o.push(h), 1 & h.__g && (h.__g &= -4);
345
+ h.state = h.__s, h.getChildContext && (r = F({}, r, h.getChildContext())), b && n.__c && h.getSnapshotBeforeUpdate && (v = h.getSnapshotBeforeUpdate(g, _)), w = u && u.type === I && u.key == null ? u.props.children : u, y.__P && (u = s, i = (e = y.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
346
+ e && Me(e, e);
347
+ }), n.__k = null), s = n.__k ? L(n, 0) : null), s = be(e, fe(w) ? w : [w], t, n, r, i, a, o, s, c, l), y.__P && (t.__e = null, s = u), t.__u &= -161, 128 & n.__u && (h.__z = null), d && d.some(me), h.__h.length && o.push(h), 1 & h.__g && (h.__g &= -4);
348
348
  } catch (e) {
349
349
  if (o.length = m, t.__v = null, c || a) {
350
350
  if (e.then) {
@@ -364,18 +364,18 @@ function ke(e, t, n, r, i, a, o, s, c, l) {
364
364
  a && (a[a.indexOf(s)] = null), E = s;
365
365
  }
366
366
  t.__c.__z || (t.__c.__z = E), t.__e = s;
367
- } else a && a.some(ge);
367
+ } else a && a.some(me);
368
368
  } else t.__e = n.__e;
369
- t.__k ||= n.__k || [], e.then || Ae(t), A.__e(e, t, n);
369
+ t.__k ||= n.__k || [], e.then || Oe(t), A.__e(e, t, n);
370
370
  }
371
- } else s = t.__e = Me(n.__e, t, n, r, i, a, o, c, l, e);
371
+ } else s = t.__e = Ae(n.__e, t, n, r, i, a, o, c, l, e);
372
372
  return (u = A.diffed) && u(t), 128 & t.__u ? void 0 : s;
373
373
  }
374
- function Ae(e) {
375
- e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Ae));
374
+ function Oe(e) {
375
+ e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Oe));
376
376
  }
377
- function je(e, t, n) {
378
- for (var r = 0; r < n.length;) Ne(n[r++], n[r++], n[r++]);
377
+ function ke(e, t, n) {
378
+ for (var r = 0; r < n.length;) je(n[r++], n[r++], n[r++]);
379
379
  A.__c && A.__c(t, e), e.some(function(t) {
380
380
  try {
381
381
  e = t.__h, t.__h = [], e.some(function(e) {
@@ -386,8 +386,8 @@ function je(e, t, n) {
386
386
  }
387
387
  });
388
388
  }
389
- function Me(e, t, n, r, i, a, o, s, c, l) {
390
- var u, d, f, p, m, h, g, _, v, y = n.props || de, b = t.props, x = t.type;
389
+ function Ae(e, t, n, r, i, a, o, s, c, l) {
390
+ var u, d, f, p, m, h, g, _, v, y = n.props || ue, b = t.props, x = t.type;
391
391
  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", a) {
392
392
  for (u = 0; u < a.length; u++) if ((m = a[u]) && (x ? m.localName == x : m.nodeType == 3)) {
393
393
  e = m, a[u] = null;
@@ -399,23 +399,23 @@ function Me(e, t, n, r, i, a, o, s, c, l) {
399
399
  e = _.createElementNS(i, x, b.is && b), s &&= (A.__m && A.__m(t, a), !1), a = null;
400
400
  }
401
401
  if (x) {
402
- if (l = x == "template" ? e.content : e, a = x == "textarea" && b.defaultValue != null ? null : a && he.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
403
- for (u in y) m = y[u], u == "dangerouslySetInnerHTML" ? f = m : u == "children" || u in b || u == "value" && "defaultValue" in b || u == "checked" && "defaultChecked" in b || De(e, u, null, m, i);
404
- for (u in v = 1 & n.__u, b) m = b[u], u == "children" ? p = m : u == "dangerouslySetInnerHTML" ? d = m : u == "value" ? h = m : u == "checked" ? g = m : s && typeof m != "function" || !(y[u] !== m || v && m != null) || De(e, u, m, y[u], i);
405
- d ? (s || f && (d.__html == f.__html || d.__html == e.innerHTML) || (e.innerHTML = d.__html), t.__k = []) : (f && (e.textContent = ""), (x == "foreignObject" || i == "http://www.w3.org/1998/Math/MathML" && pe.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Se(l, me(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && F(n, 0), s, c), a && a.some(ge)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || De(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && De(e, u, g, y[u], i));
402
+ if (l = x == "template" ? e.content : e, a = x == "textarea" && b.defaultValue != null ? null : a && pe.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
403
+ for (u in y) m = y[u], u == "dangerouslySetInnerHTML" ? f = m : u == "children" || u in b || u == "value" && "defaultValue" in b || u == "checked" && "defaultChecked" in b || Te(e, u, null, m, i);
404
+ for (u in v = 1 & n.__u, b) m = b[u], u == "children" ? p = m : u == "dangerouslySetInnerHTML" ? d = m : u == "value" ? h = m : u == "checked" ? g = m : s && typeof m != "function" || !(y[u] !== m || v && m != null) || Te(e, u, m, y[u], i);
405
+ d ? (s || f && (d.__html == f.__html || d.__html == e.innerHTML) || (e.innerHTML = d.__html), t.__k = []) : (f && (e.textContent = ""), (x == "foreignObject" || i == "http://www.w3.org/1998/Math/MathML" && de.test(x)) && (i = "http://www.w3.org/1999/xhtml"), be(l, fe(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && L(n, 0), s, c), a && a.some(me)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || Te(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && Te(e, u, g, y[u], i));
406
406
  } else y === b || s && e.data == b || (e.data = b);
407
407
  return e;
408
408
  }
409
- function Ne(e, t, n) {
409
+ function je(e, t, n) {
410
410
  try {
411
411
  typeof e == "function" ? (typeof e.__u == "function" && e.__u(), (typeof e.__u != "function" || t) && (e.__u = e(t))) : e.current = t;
412
412
  } catch (e) {
413
413
  A.__e(e, n);
414
414
  }
415
415
  }
416
- function Pe(e, t, n) {
416
+ function Me(e, t, n) {
417
417
  var r, i;
418
- if (A.unmount && A.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || Ne(r, null, t), r = e.__c) {
418
+ if (A.unmount && A.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || je(r, null, t), r = e.__c) {
419
419
  if (r.componentWillUnmount) try {
420
420
  r.componentWillUnmount();
421
421
  } catch (e) {
@@ -423,15 +423,15 @@ function Pe(e, t, n) {
423
423
  }
424
424
  r.__P = r.__n = null;
425
425
  }
426
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Pe(r[i], t, typeof e.type != "function" || n && !e.props.__P);
427
- (r = e.__e) && (n || ge(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
426
+ if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Me(r[i], t, typeof e.type != "function" || n && !e.props.__P);
427
+ (r = e.__e) && (n || me(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
428
428
  }
429
- function Fe(e, t, n) {
429
+ function Ne(e, t, n) {
430
430
  return this.constructor(e, n);
431
431
  }
432
- function Ie(e, t) {
432
+ function Pe(e, t) {
433
433
  var n, r, i, a;
434
- A.__ && A.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = _e(P, { children: [e] }), i = [], a = [], ke(t, t.__k, r || de, de, t.namespaceURI, r ? null : t.firstChild ? he.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), je(i, t.__k, a), t.__k.props.children = null;
434
+ A.__ && A.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = he(I, { children: [e] }), i = [], a = [], De(t, t.__k, r || ue, ue, t.namespaceURI, r ? null : t.firstChild ? pe.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), ke(i, t.__k, a), t.__k.props.children = null;
435
435
  }
436
436
  A = { __e: function(e, t, n, r) {
437
437
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !(1 & i.__g)) {
@@ -442,43 +442,43 @@ A = { __e: function(e, t, n, r) {
442
442
  e = t, o = 0;
443
443
  }
444
444
  }
445
- throw ie = 0, e;
446
- } }, ne = 0, ve.prototype.setState = function(e, t) {
445
+ throw M = 0, e;
446
+ } }, ne = 0, ge.prototype.setState = function(e, t) {
447
447
  var n = this.__s;
448
- n && n != this.state || (n = this.__s = N({}, this.state)), typeof e == "function" && (e = e(N({}, n), this.props)), e && (N(n, e), this.__v && (t && this.__k.push(t), be(this)));
449
- }, ve.prototype.forceUpdate = function(e) {
450
- this.__v && (this.__g |= 4, e && this.__h.push(e), be(this));
451
- }, ve.prototype.render = P, j = [], ie = 0, ae = function(e, t) {
448
+ n && n != this.state || (n = this.__s = F({}, this.state)), typeof e == "function" && (e = e(F({}, n), this.props)), e && (F(n, e), this.__v && (t && this.__k.push(t), ve(this)));
449
+ }, ge.prototype.forceUpdate = function(e) {
450
+ this.__v && (this.__g |= 4, e && this.__h.push(e), ve(this));
451
+ }, ge.prototype.render = I, j = [], M = 0, ie = function(e, t) {
452
452
  return e.__v.__b - t.__v.__b;
453
- }, oe = Symbol(), M = Symbol(), se = /(PointerCapture)$|Capture$/i, ce = 0, le = Oe(!1), ue = Oe(!0);
453
+ }, ae = Symbol(), N = Symbol(), oe = /(PointerCapture)$|Capture$/i, se = 0, ce = Ee(!1), le = Ee(!0);
454
454
  //#endregion
455
455
  //#region node_modules/.pnpm/preact@11.0.0/node_modules/preact/hooks/dist/hooks.mjs
456
- var I, L, Le, Re, ze = Object.is, R = 0, Be = [], Ve = [], z = A, He = z.__b, Ue = z.__r, We = z.diffed, Ge = z.__c, Ke = z.unmount, qe = z.__;
457
- function Je(e, t) {
458
- z.__h && z.__h(L, e, R || t), R = 0;
459
- var n = L.__H || (L.__H = {
456
+ var R, z, Fe, Ie, Le = Object.is, B = 0, Re = [], ze = [], V = A, Be = V.__b, Ve = V.__r, He = V.diffed, Ue = V.__c, We = V.unmount, Ge = V.__;
457
+ function Ke(e, t) {
458
+ V.__h && V.__h(z, e, B || t), B = 0;
459
+ var n = z.__H || (z.__H = {
460
460
  __: [],
461
461
  __h: []
462
462
  });
463
463
  return e >= n.__.length && n.__.push({}), n.__[e];
464
464
  }
465
- function Ye(e) {
466
- return R = 1, Xe(it, e);
465
+ function qe(e) {
466
+ return B = 1, Je(nt, e);
467
467
  }
468
- function Xe(e, t, n) {
469
- var r = Je(I++, 2);
470
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : it(void 0, t), function(e) {
468
+ function Je(e, t, n) {
469
+ var r = Ke(R++, 2);
470
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : nt(void 0, t), function(e) {
471
471
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
472
- ze(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
473
- }], r.__c = L, !L.__f)) {
474
- L.__f = !0;
475
- var i = L.shouldComponentUpdate;
476
- L.shouldComponentUpdate = function(e, t, n) {
472
+ Le(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
473
+ }], r.__c = z, !z.__f)) {
474
+ z.__f = !0;
475
+ var i = z.shouldComponentUpdate;
476
+ z.shouldComponentUpdate = function(e, t, n) {
477
477
  var r = this.__H;
478
478
  if (!r) return !0;
479
479
  var a = !1, o = this.props != e;
480
480
  if (r.__.some(function(e) {
481
- e.__N && (a = !0, ze(e.__[0], e.__N[0]) || (o = !0));
481
+ e.__N && (a = !0, Le(e.__[0], e.__N[0]) || (o = !0));
482
482
  }), i) {
483
483
  var s = i.call(this, e, t, n);
484
484
  return a ? s || o : s;
@@ -488,67 +488,67 @@ function Xe(e, t, n) {
488
488
  }
489
489
  return r.__;
490
490
  }
491
- function B(e, t) {
492
- var n = Je(I++, 3);
493
- !z.__s && rt(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, L.__H.__h.push(n));
491
+ function H(e, t) {
492
+ var n = Ke(R++, 3);
493
+ !V.__s && tt(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, z.__H.__h.push(n));
494
494
  }
495
- function V(e) {
496
- return R = 5, Ze(function() {
495
+ function U(e) {
496
+ return B = 5, Ye(function() {
497
497
  return { current: e };
498
498
  }, []);
499
499
  }
500
- function Ze(e, t) {
501
- var n = Je(I++, 7);
502
- return rt(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
500
+ function Ye(e, t) {
501
+ var n = Ke(R++, 7);
502
+ return tt(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
503
503
  }
504
- function Qe() {
504
+ function Xe() {
505
505
  var e;
506
506
  do {
507
- for (; e = Ve.shift();) try {
508
- H(e);
507
+ for (; e = ze.shift();) try {
508
+ W(e);
509
509
  } catch (t) {
510
- z.__e(t, { __: (e = e.__P) && e.__v });
510
+ V.__e(t, { __: (e = e.__P) && e.__v });
511
511
  }
512
- for (; e = Be.shift();) {
512
+ for (; e = Re.shift();) {
513
513
  var t = e.__H;
514
514
  if (e.__P && t) try {
515
- t.__h.some(H), t.__h.some(nt), t.__h = [];
515
+ t.__h.some(W), t.__h.some(et), t.__h = [];
516
516
  } catch (n) {
517
- t.__h = [], z.__e(n, e.__v);
517
+ t.__h = [], V.__e(n, e.__v);
518
518
  }
519
519
  }
520
- } while (Ve.length);
521
- }
522
- z.__b = function(e) {
523
- L = null, He && He(e);
524
- }, z.__ = function(e, t) {
525
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), qe && qe(e, t);
526
- }, z.__r = function(e) {
527
- Ue && Ue(e), I = 0;
528
- var t = (L = e.__c).__H;
529
- t && (Le == L ? L.__h = [] : (t.__h.some(H), t.__h.some(nt), I = 0), t.__h = [], t.__.some(function(e) {
520
+ } while (ze.length);
521
+ }
522
+ V.__b = function(e) {
523
+ z = null, Be && Be(e);
524
+ }, V.__ = function(e, t) {
525
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), Ge && Ge(e, t);
526
+ }, V.__r = function(e) {
527
+ Ve && Ve(e), R = 0;
528
+ var t = (z = e.__c).__H;
529
+ t && (Fe == z ? z.__h = [] : (t.__h.some(W), t.__h.some(et), R = 0), t.__h = [], t.__.some(function(e) {
530
530
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
531
- })), Le = L;
532
- }, z.diffed = function(e) {
533
- We && We(e);
531
+ })), Fe = z;
532
+ }, V.diffed = function(e) {
533
+ He && He(e);
534
534
  var t = e.__c;
535
- t && t.__H && (t.__H.__h.length && tt(Be.push(t)), t.__H.__.some(function(e) {
535
+ t && t.__H && (t.__H.__h.length && $e(Re.push(t)), t.__H.__.some(function(e) {
536
536
  e.u && (e.__H = e.u);
537
- })), Le = L = null;
538
- }, z.__c = function(e, t) {
537
+ })), Fe = z = null;
538
+ }, V.__c = function(e, t) {
539
539
  t.some(function(e) {
540
540
  try {
541
- e.__h.some(H), e.__h = e.__h.filter(function(e) {
542
- return !e.__ || nt(e);
541
+ e.__h.some(W), e.__h = e.__h.filter(function(e) {
542
+ return !e.__ || et(e);
543
543
  });
544
544
  } catch (n) {
545
545
  t.some(function(e) {
546
546
  e.__h &&= [];
547
- }), t = [], z.__e(n, e.__v);
547
+ }), t = [], V.__e(n, e.__v);
548
548
  }
549
- }), Ge && Ge(e, t);
550
- }, z.unmount = function(e) {
551
- Ke && Ke(e);
549
+ }), Ue && Ue(e, t);
550
+ }, V.unmount = function(e) {
551
+ We && We(e);
552
552
  var t, n, r = e.__c;
553
553
  r && r.__H && (r.__H.__.some(function(r) {
554
554
  try {
@@ -557,44 +557,44 @@ z.__b = function(e) {
557
557
  for (n = e.__; n && (!n.__c || !n.__c.__P);) n = n.__;
558
558
  n &&= n.__c;
559
559
  }
560
- r.__P = n, tt(Ve.push(r));
561
- } else H(r);
560
+ r.__P = n, $e(ze.push(r));
561
+ } else W(r);
562
562
  } catch (e) {
563
563
  t = e;
564
564
  }
565
- }), r.__H = void 0, t && z.__e(t, r.__v));
565
+ }), r.__H = void 0, t && V.__e(t, r.__v));
566
566
  };
567
- var $e = typeof requestAnimationFrame == "function";
568
- function et(e) {
567
+ var Ze = typeof requestAnimationFrame == "function";
568
+ function Qe(e) {
569
569
  var t, n = function() {
570
- clearTimeout(r), $e && cancelAnimationFrame(t), setTimeout(e);
570
+ clearTimeout(r), Ze && cancelAnimationFrame(t), setTimeout(e);
571
571
  }, r = setTimeout(n, 35);
572
- $e && (t = requestAnimationFrame(n));
572
+ Ze && (t = requestAnimationFrame(n));
573
573
  }
574
- function tt(e) {
575
- e != 1 && Re == z.requestAnimationFrame || ((Re = z.requestAnimationFrame) || et)(Qe);
574
+ function $e(e) {
575
+ e != 1 && Ie == V.requestAnimationFrame || ((Ie = V.requestAnimationFrame) || Qe)(Xe);
576
576
  }
577
- function H(e) {
578
- var t = L, n = e.__c;
579
- typeof n == "function" && (e.__c = void 0, n()), L = t;
577
+ function W(e) {
578
+ var t = z, n = e.__c;
579
+ typeof n == "function" && (e.__c = void 0, n()), z = t;
580
580
  }
581
- function nt(e) {
582
- var t = L;
583
- e.__c = e.__(), L = t;
581
+ function et(e) {
582
+ var t = z;
583
+ e.__c = e.__(), z = t;
584
584
  }
585
- function rt(e, t) {
585
+ function tt(e, t) {
586
586
  return !e || e.length != t.length || t.some(function(t, n) {
587
- return !ze(t, e[n]);
587
+ return !Le(t, e[n]);
588
588
  });
589
589
  }
590
- function it(e, t) {
590
+ function nt(e, t) {
591
591
  return typeof t == "function" ? t(e) : t;
592
592
  }
593
593
  //#endregion
594
594
  //#region node_modules/.pnpm/preact@11.0.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
595
- var at = 0;
595
+ var rt = 0;
596
596
  Array.isArray;
597
- function U(e, t, n, r, i, a) {
597
+ function G(e, t, n, r, i, a) {
598
598
  t ||= {};
599
599
  var o, s, c = t;
600
600
  if ("ref" in c && typeof e != "function") for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -609,7 +609,7 @@ function U(e, t, n, r, i, a) {
609
609
  __e: null,
610
610
  __c: null,
611
611
  constructor: void 0,
612
- __v: --at,
612
+ __v: --rt,
613
613
  __i: -1,
614
614
  __u: 0
615
615
  };
@@ -617,8 +617,8 @@ function U(e, t, n, r, i, a) {
617
617
  }
618
618
  //#endregion
619
619
  //#region src/components/icons.tsx
620
- function W({ name: e, size: t, children: n }) {
621
- return /* @__PURE__ */ U("svg", {
620
+ function K({ name: e, size: t, children: n }) {
621
+ return /* @__PURE__ */ G("svg", {
622
622
  "data-icon": e,
623
623
  "aria-hidden": "true",
624
624
  focusable: "false",
@@ -633,83 +633,83 @@ function W({ name: e, size: t, children: n }) {
633
633
  children: n
634
634
  });
635
635
  }
636
- function ot({ size: e = 26 }) {
637
- return /* @__PURE__ */ U(W, {
636
+ function it({ size: e = 26 }) {
637
+ return /* @__PURE__ */ G(K, {
638
638
  name: "chat",
639
639
  size: e,
640
- 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", {
640
+ 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", {
641
641
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
642
642
  "stroke-width": "2.5"
643
643
  })]
644
644
  });
645
645
  }
646
- function st({ size: e = 26 }) {
647
- return /* @__PURE__ */ U(W, {
646
+ function at({ size: e = 26 }) {
647
+ return /* @__PURE__ */ G(K, {
648
648
  name: "message",
649
649
  size: e,
650
- children: /* @__PURE__ */ U("path", { d: "M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z" })
650
+ children: /* @__PURE__ */ G("path", { d: "M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z" })
651
651
  });
652
652
  }
653
- function ct({ size: e = 26 }) {
654
- return /* @__PURE__ */ U(W, {
653
+ function ot({ size: e = 26 }) {
654
+ return /* @__PURE__ */ G(K, {
655
655
  name: "sparkle",
656
656
  size: e,
657
- children: [/* @__PURE__ */ U("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ U("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
657
+ children: [/* @__PURE__ */ G("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ G("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
658
658
  });
659
659
  }
660
- function lt({ size: e = 26 }) {
661
- return /* @__PURE__ */ U(W, {
660
+ function st({ size: e = 26 }) {
661
+ return /* @__PURE__ */ G(K, {
662
662
  name: "chevron-down",
663
663
  size: e,
664
- children: /* @__PURE__ */ U("path", { d: "M6 9l6 6 6-6" })
664
+ children: /* @__PURE__ */ G("path", { d: "M6 9l6 6 6-6" })
665
665
  });
666
666
  }
667
- function ut({ size: e = 18 }) {
668
- return /* @__PURE__ */ U(W, {
667
+ function ct({ size: e = 18 }) {
668
+ return /* @__PURE__ */ G(K, {
669
669
  name: "close",
670
670
  size: e,
671
- children: /* @__PURE__ */ U("path", { d: "M6 6l12 12M18 6L6 18" })
671
+ children: /* @__PURE__ */ G("path", { d: "M6 6l12 12M18 6L6 18" })
672
672
  });
673
673
  }
674
- var dt = "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";
675
- function ft({ size: e = 16 }) {
676
- return /* @__PURE__ */ U(W, {
674
+ var lt = "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";
675
+ function ut({ size: e = 16 }) {
676
+ return /* @__PURE__ */ G(K, {
677
677
  name: "thumb-up",
678
678
  size: e,
679
- children: /* @__PURE__ */ U("path", { d: dt })
679
+ children: /* @__PURE__ */ G("path", { d: lt })
680
680
  });
681
681
  }
682
- function pt({ size: e = 16 }) {
683
- return /* @__PURE__ */ U(W, {
682
+ function dt({ size: e = 16 }) {
683
+ return /* @__PURE__ */ G(K, {
684
684
  name: "thumb-down",
685
685
  size: e,
686
- children: /* @__PURE__ */ U("path", {
687
- d: dt,
686
+ children: /* @__PURE__ */ G("path", {
687
+ d: lt,
688
688
  transform: "matrix(1 0 0 -1 0 24)"
689
689
  })
690
690
  });
691
691
  }
692
692
  //#endregion
693
693
  //#region src/components/Launcher.tsx
694
- var mt = {
695
- chat: ot,
696
- message: st,
697
- sparkle: ct
698
- }, ht = {
699
- "chevron-down": lt,
700
- close: ut
694
+ var ft = {
695
+ chat: it,
696
+ message: at,
697
+ sparkle: ot
698
+ }, pt = {
699
+ "chevron-down": st,
700
+ close: ct
701
701
  };
702
- function gt({ isOpen: e, onClick: t, iconUrl: n, icon: r = "chat", openIconUrl: i, openIcon: a = "chevron-down", buttonRef: o }) {
703
- let [s, c] = Ye("loading"), [l, u] = Ye("loading"), d = n !== void 0 && s !== "failed", f = i !== void 0 && l !== "failed", p = d && !e && s === "loaded", m = f && e && l === "loaded", h = mt[r] ?? ot, g = ht[a] ?? lt;
704
- return /* @__PURE__ */ U("button", {
702
+ function mt({ isOpen: e, onClick: t, iconUrl: n, icon: r = "chat", openIconUrl: i, openIcon: a = "chevron-down", buttonRef: o }) {
703
+ let [s, c] = qe("loading"), [l, u] = qe("loading"), d = n !== void 0 && s !== "failed", f = i !== void 0 && l !== "failed", p = d && !e && s === "loaded", m = f && e && l === "loaded", h = ft[r] ?? it, g = pt[a] ?? st;
704
+ return /* @__PURE__ */ G("button", {
705
705
  type: "button",
706
706
  class: "whoo-widget-launcher",
707
707
  onClick: t,
708
708
  "aria-label": e ? "Close chat" : "Open chat",
709
709
  ref: o,
710
710
  children: [
711
- e ? m ? null : /* @__PURE__ */ U(g, {}) : p ? null : /* @__PURE__ */ U(h, {}),
712
- d ? /* @__PURE__ */ U("img", {
711
+ e ? m ? null : /* @__PURE__ */ G(g, {}) : p ? null : /* @__PURE__ */ G(h, {}),
712
+ d ? /* @__PURE__ */ G("img", {
713
713
  class: "whoo-widget-launcher-icon-image",
714
714
  src: n,
715
715
  alt: "",
@@ -718,7 +718,7 @@ function gt({ isOpen: e, onClick: t, iconUrl: n, icon: r = "chat", openIconUrl:
718
718
  onLoad: () => c("loaded"),
719
719
  onError: () => c("failed")
720
720
  }) : null,
721
- f ? /* @__PURE__ */ U("img", {
721
+ f ? /* @__PURE__ */ G("img", {
722
722
  class: "whoo-widget-launcher-icon-image",
723
723
  src: i,
724
724
  alt: "",
@@ -731,17 +731,55 @@ function gt({ isOpen: e, onClick: t, iconUrl: n, icon: r = "chat", openIconUrl:
731
731
  });
732
732
  }
733
733
  //#endregion
734
+ //#region src/viewport.ts
735
+ var ht = "(max-width: 400px), (max-height: 420px)", gt = "data-fit-visible", _t = 40;
736
+ function vt(e) {
737
+ let t = typeof window < "u" ? window.visualViewport : null;
738
+ if (!t) return () => {};
739
+ let n = () => {
740
+ e.removeAttribute(gt), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
741
+ }, r = () => {
742
+ let r = document.documentElement.clientHeight, i = Math.abs(t.scale - 1) > .01, a = r - t.height;
743
+ if (i || r === 0 || a < _t) {
744
+ n();
745
+ return;
746
+ }
747
+ e.setAttribute(gt, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
748
+ };
749
+ return r(), t.addEventListener("resize", r), t.addEventListener("scroll", r), () => {
750
+ t.removeEventListener("resize", r), t.removeEventListener("scroll", r), n();
751
+ };
752
+ }
753
+ var yt = 0, bt = "";
754
+ function xt() {
755
+ yt++ === 0 && (bt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
756
+ }
757
+ function St() {
758
+ --yt === 0 && (document.documentElement.style.overflow = bt);
759
+ }
760
+ function Ct() {
761
+ if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
762
+ let e = window.matchMedia(ht), t = !1, n = () => {
763
+ e.matches && !t ? (t = !0, xt()) : !e.matches && t && (t = !1, St());
764
+ }, r = (t) => {
765
+ typeof e.addEventListener == "function" ? t ? e.addEventListener("change", n) : e.removeEventListener("change", n) : typeof e.addListener == "function" && (t ? e.addListener(n) : e.removeListener(n));
766
+ };
767
+ return n(), r(!0), () => {
768
+ r(!1), t && (t = !1, St());
769
+ };
770
+ }
771
+ //#endregion
734
772
  //#region src/components/Composer.tsx
735
- function _t({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
736
- return /* @__PURE__ */ U("div", {
773
+ function wt({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
774
+ return /* @__PURE__ */ G("div", {
737
775
  class: "whoo-widget-composer",
738
776
  children: [
739
- /* @__PURE__ */ U("label", {
777
+ /* @__PURE__ */ G("label", {
740
778
  class: "whoo-widget-sr-only",
741
779
  for: "whoo-widget-composer-input",
742
780
  children: "Message"
743
781
  }),
744
- /* @__PURE__ */ U("input", {
782
+ /* @__PURE__ */ G("input", {
745
783
  id: "whoo-widget-composer-input",
746
784
  class: "whoo-widget-composer-input",
747
785
  value: e,
@@ -753,7 +791,7 @@ function _t({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
753
791
  e.key === "Enter" && n();
754
792
  }
755
793
  }),
756
- /* @__PURE__ */ U("button", {
794
+ /* @__PURE__ */ G("button", {
757
795
  type: "button",
758
796
  class: "whoo-widget-composer-send",
759
797
  "aria-disabled": r,
@@ -767,8 +805,8 @@ function _t({ value: e, onChange: t, onSend: n, disabled: r, inputRef: i }) {
767
805
  }
768
806
  //#endregion
769
807
  //#region src/components/ErrorBanner.tsx
770
- function vt({ message: e }) {
771
- return /* @__PURE__ */ U("div", {
808
+ function Tt({ message: e }) {
809
+ return /* @__PURE__ */ G("div", {
772
810
  class: "whoo-widget-error-banner",
773
811
  role: "alert",
774
812
  children: e
@@ -776,8 +814,8 @@ function vt({ message: e }) {
776
814
  }
777
815
  //#endregion
778
816
  //#region src/markdown/tokenizer.ts
779
- var yt = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, bt = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, xt = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, St = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, Ct = /[ \t]*[*+-][ \t]+/y, wt = /https?:\/\/\S+/y, Tt = /[.,;:!?)\]}>]+$/;
780
- function Et(e) {
817
+ var Et = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, Dt = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, Ot = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, kt = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, At = /[ \t]*[*+-][ \t]+/y, jt = /https?:\/\/\S+/y, Mt = /[.,;:!?)\]}>]+$/;
818
+ function Nt(e) {
781
819
  let t = [], n = 0, r = 0, i = (n) => {
782
820
  n > r && t.push({
783
821
  type: "text",
@@ -787,13 +825,13 @@ function Et(e) {
787
825
  });
788
826
  };
789
827
  for (; n < e.length;) {
790
- if ((n === 0 || e[n - 1] === "\n") && (Ct.lastIndex = n, Ct.exec(e))) {
828
+ if ((n === 0 || e[n - 1] === "\n") && (At.lastIndex = n, At.exec(e))) {
791
829
  i(n), t.push({
792
830
  type: "text",
793
831
  value: "• ",
794
832
  start: n,
795
- end: Ct.lastIndex
796
- }), n = Ct.lastIndex, r = n;
833
+ end: At.lastIndex
834
+ }), n = At.lastIndex, r = n;
797
835
  continue;
798
836
  }
799
837
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -806,56 +844,56 @@ function Et(e) {
806
844
  }
807
845
  }
808
846
  if (e[n - 1] !== "!") {
809
- yt.lastIndex = n;
810
- let a = yt.exec(e);
847
+ Et.lastIndex = n;
848
+ let a = Et.exec(e);
811
849
  if (a) {
812
850
  i(n), t.push({
813
851
  type: "link",
814
852
  text: a[1],
815
853
  url: a[2],
816
854
  start: n,
817
- end: yt.lastIndex
818
- }), n = yt.lastIndex, r = n;
855
+ end: Et.lastIndex
856
+ }), n = Et.lastIndex, r = n;
819
857
  continue;
820
858
  }
821
859
  }
822
- bt.lastIndex = n;
823
- let a = bt.exec(e);
860
+ Dt.lastIndex = n;
861
+ let a = Dt.exec(e);
824
862
  if (a) {
825
863
  i(n), t.push({
826
864
  type: "bold",
827
865
  value: a[1],
828
866
  start: n,
829
- end: bt.lastIndex
830
- }), n = bt.lastIndex, r = n;
867
+ end: Dt.lastIndex
868
+ }), n = Dt.lastIndex, r = n;
831
869
  continue;
832
870
  }
833
- xt.lastIndex = n;
834
- let o = xt.exec(e);
871
+ Ot.lastIndex = n;
872
+ let o = Ot.exec(e);
835
873
  if (o) {
836
874
  i(n), t.push({
837
875
  type: "italic",
838
876
  value: o[1],
839
877
  start: n,
840
- end: xt.lastIndex
841
- }), n = xt.lastIndex, r = n;
878
+ end: Ot.lastIndex
879
+ }), n = Ot.lastIndex, r = n;
842
880
  continue;
843
881
  }
844
- St.lastIndex = n;
845
- let s = St.exec(e);
882
+ kt.lastIndex = n;
883
+ let s = kt.exec(e);
846
884
  if (s) {
847
885
  i(n), t.push({
848
886
  type: "italic",
849
887
  value: s[1],
850
888
  start: n,
851
- end: St.lastIndex
852
- }), n = St.lastIndex, r = n;
889
+ end: kt.lastIndex
890
+ }), n = kt.lastIndex, r = n;
853
891
  continue;
854
892
  }
855
- wt.lastIndex = n;
856
- let c = wt.exec(e);
893
+ jt.lastIndex = n;
894
+ let c = jt.exec(e);
857
895
  if (c) {
858
- let e = c[0].match(Tt), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
896
+ let e = c[0].match(Mt), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
859
897
  if (a.length > 0) {
860
898
  i(n), t.push({
861
899
  type: "link",
@@ -873,8 +911,8 @@ function Et(e) {
873
911
  }
874
912
  //#endregion
875
913
  //#region src/markdown/render.tsx
876
- var Dt = /^[ \t]*[*+-][ \t]+(.*)$/;
877
- function Ot(e) {
914
+ var Pt = /^[ \t]*[*+-][ \t]+(.*)$/;
915
+ function Ft(e) {
878
916
  let t = [], n = [], r = [], i = () => {
879
917
  n.length > 0 && t.push({
880
918
  type: "text",
@@ -887,7 +925,7 @@ function Ot(e) {
887
925
  }), r = [];
888
926
  };
889
927
  for (let t of e.split("\n")) {
890
- let e = t.match(Dt);
928
+ let e = t.match(Pt);
891
929
  e ? (i(), r.push(e[1])) : (a(), n.push(t));
892
930
  }
893
931
  return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
@@ -899,16 +937,16 @@ function Ot(e) {
899
937
  }];
900
938
  }) : null;
901
939
  }
902
- function G(e) {
903
- return Et(e).map((e, t) => {
940
+ function q(e) {
941
+ return Nt(e).map((e, t) => {
904
942
  switch (e.type) {
905
- case "bold": return /* @__PURE__ */ U("strong", { children: G(e.value) }, t);
906
- case "italic": return /* @__PURE__ */ U("em", { children: G(e.value) }, t);
907
- case "link": return /* @__PURE__ */ U("a", {
943
+ case "bold": return /* @__PURE__ */ G("strong", { children: q(e.value) }, t);
944
+ case "italic": return /* @__PURE__ */ G("em", { children: q(e.value) }, t);
945
+ case "link": return /* @__PURE__ */ G("a", {
908
946
  href: e.url,
909
947
  target: "_blank",
910
948
  rel: "noopener noreferrer",
911
- children: [e.text, /* @__PURE__ */ U("span", {
949
+ children: [e.text, /* @__PURE__ */ G("span", {
912
950
  class: "whoo-widget-sr-only",
913
951
  children: " (opens in new tab)"
914
952
  })]
@@ -917,16 +955,16 @@ function G(e) {
917
955
  }
918
956
  });
919
957
  }
920
- function kt(e) {
921
- let t = e.replace(/\r\n?/g, "\n"), n = Ot(t);
922
- return n ? n.map((e, t) => e.type === "list" ? /* @__PURE__ */ U("ul", {
958
+ function It(e) {
959
+ let t = e.replace(/\r\n?/g, "\n"), n = Ft(t);
960
+ return n ? n.map((e, t) => e.type === "list" ? /* @__PURE__ */ G("ul", {
923
961
  class: "whoo-widget-list",
924
- children: e.items.map((e, t) => /* @__PURE__ */ U("li", { children: G(e) }, t))
925
- }, t) : /* @__PURE__ */ U("span", { children: G(e.text) }, t)) : G(t);
962
+ children: e.items.map((e, t) => /* @__PURE__ */ G("li", { children: q(e) }, t))
963
+ }, t) : /* @__PURE__ */ G("span", { children: q(e.text) }, t)) : q(t);
926
964
  }
927
965
  //#endregion
928
966
  //#region src/components/MessageFeedback.tsx
929
- var At = [
967
+ var Lt = [
930
968
  {
931
969
  value: "",
932
970
  label: "Select a reason (optional)"
@@ -948,9 +986,9 @@ var At = [
948
986
  label: "Other"
949
987
  }
950
988
  ];
951
- function jt({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraftChange: i, onSubmitDetailed: a, onCancel: o }) {
952
- let s = e.correction ?? "", c = e.category ?? "", l = V(e.status), u = V(null), d = V(null);
953
- if (B(() => {
989
+ function Rt({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraftChange: i, onSubmitDetailed: a, onCancel: o }) {
990
+ let s = e.correction ?? "", c = e.category ?? "", l = U(e.status), u = U(null), d = U(null);
991
+ if (H(() => {
954
992
  let n = l.current;
955
993
  if (l.current = e.status, n === e.status) return;
956
994
  if (e.status === "expanded") {
@@ -965,37 +1003,37 @@ function jt({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraft
965
1003
  if (!r) return;
966
1004
  let i = r.getRootNode();
967
1005
  r.contains(i.activeElement) || r.focus();
968
- }, [e.status, t]), e.status === "expanded") return /* @__PURE__ */ U("div", {
1006
+ }, [e.status, t]), e.status === "expanded") return /* @__PURE__ */ G("div", {
969
1007
  class: "whoo-widget-feedback-form",
970
1008
  children: [
971
- /* @__PURE__ */ U("label", { children: [/* @__PURE__ */ U("span", {
1009
+ /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("span", {
972
1010
  class: "whoo-widget-sr-only",
973
1011
  children: "Additional feedback"
974
- }), /* @__PURE__ */ U("textarea", {
1012
+ }), /* @__PURE__ */ G("textarea", {
975
1013
  ref: u,
976
1014
  class: "whoo-widget-feedback-textarea",
977
1015
  value: s,
978
1016
  onInput: (e) => i(e.target.value, c),
979
1017
  placeholder: "What was wrong? (optional)"
980
1018
  })] }),
981
- /* @__PURE__ */ U("select", {
1019
+ /* @__PURE__ */ G("select", {
982
1020
  class: "whoo-widget-feedback-select",
983
1021
  "aria-label": "Feedback category",
984
1022
  value: c,
985
1023
  onChange: (e) => i(s, e.target.value),
986
- children: At.map((e) => /* @__PURE__ */ U("option", {
1024
+ children: Lt.map((e) => /* @__PURE__ */ G("option", {
987
1025
  value: e.value,
988
1026
  children: e.label
989
1027
  }, e.value))
990
1028
  }),
991
- /* @__PURE__ */ U("div", {
1029
+ /* @__PURE__ */ G("div", {
992
1030
  class: "whoo-widget-feedback-form-buttons",
993
- children: [/* @__PURE__ */ U("button", {
1031
+ children: [/* @__PURE__ */ G("button", {
994
1032
  type: "button",
995
1033
  class: "whoo-widget-feedback-submit",
996
1034
  onClick: () => a(s, c),
997
1035
  children: "Submit"
998
- }), /* @__PURE__ */ U("button", {
1036
+ }), /* @__PURE__ */ G("button", {
999
1037
  type: "button",
1000
1038
  class: "whoo-widget-feedback-cancel",
1001
1039
  onClick: o,
@@ -1005,25 +1043,25 @@ function jt({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraft
1005
1043
  ]
1006
1044
  });
1007
1045
  let f = e.status === "submitting", p = e.status === "submitted";
1008
- return /* @__PURE__ */ U("div", {
1046
+ return /* @__PURE__ */ G("div", {
1009
1047
  class: "whoo-widget-feedback",
1010
- children: [p ? null : /* @__PURE__ */ U("div", {
1048
+ children: [p ? null : /* @__PURE__ */ G("div", {
1011
1049
  class: "whoo-widget-feedback-buttons",
1012
- children: [/* @__PURE__ */ U("button", {
1050
+ children: [/* @__PURE__ */ G("button", {
1013
1051
  type: "button",
1014
1052
  "aria-label": "Good response",
1015
1053
  disabled: f,
1016
1054
  onClick: n,
1017
- children: /* @__PURE__ */ U(ft, {})
1018
- }), /* @__PURE__ */ U("button", {
1055
+ children: /* @__PURE__ */ G(ut, {})
1056
+ }), /* @__PURE__ */ G("button", {
1019
1057
  ref: d,
1020
1058
  type: "button",
1021
1059
  "aria-label": "Bad response",
1022
1060
  disabled: f,
1023
1061
  onClick: r,
1024
- children: /* @__PURE__ */ U(pt, {})
1062
+ children: /* @__PURE__ */ G(dt, {})
1025
1063
  })]
1026
- }), /* @__PURE__ */ U("div", {
1064
+ }), /* @__PURE__ */ G("div", {
1027
1065
  role: "status",
1028
1066
  class: p ? "whoo-widget-feedback-submitted" : e.status === "error" ? "whoo-widget-feedback-error" : void 0,
1029
1067
  children: p ? "Thanks for the feedback" : e.status === "error" ? "Couldn't send feedback" : null
@@ -1032,27 +1070,27 @@ function jt({ state: e, containerRef: t, onThumbsUp: n, onThumbsDown: r, onDraft
1032
1070
  }
1033
1071
  //#endregion
1034
1072
  //#region src/components/MessageList.tsx
1035
- function Mt({ isSlowResponse: e }) {
1036
- return /* @__PURE__ */ U("div", {
1073
+ function zt({ isSlowResponse: e }) {
1074
+ return /* @__PURE__ */ G("div", {
1037
1075
  class: "whoo-widget-pending",
1038
1076
  role: "status",
1039
- children: [/* @__PURE__ */ U("span", {
1077
+ children: [/* @__PURE__ */ G("span", {
1040
1078
  class: "whoo-widget-typing",
1041
1079
  "aria-hidden": "true",
1042
1080
  children: [
1043
- /* @__PURE__ */ U("span", {}),
1044
- /* @__PURE__ */ U("span", {}),
1045
- /* @__PURE__ */ U("span", {})
1081
+ /* @__PURE__ */ G("span", {}),
1082
+ /* @__PURE__ */ G("span", {}),
1083
+ /* @__PURE__ */ G("span", {})
1046
1084
  ]
1047
- }), e ? /* @__PURE__ */ U("span", {
1085
+ }), e ? /* @__PURE__ */ G("span", {
1048
1086
  class: "whoo-widget-pending-text",
1049
1087
  children: "Looking that up for you…"
1050
1088
  }) : null]
1051
1089
  });
1052
1090
  }
1053
- function Nt({ url: e, alt: t }) {
1054
- let [n, r] = Ye(!1);
1055
- return n ? null : /* @__PURE__ */ U("img", {
1091
+ function Bt({ url: e, alt: t }) {
1092
+ let [n, r] = qe(!1);
1093
+ return n ? null : /* @__PURE__ */ G("img", {
1056
1094
  class: "whoo-widget-empty-state-image",
1057
1095
  src: e,
1058
1096
  alt: t,
@@ -1060,19 +1098,19 @@ function Nt({ url: e, alt: t }) {
1060
1098
  onError: () => r(!0)
1061
1099
  });
1062
1100
  }
1063
- function Pt({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u }) {
1064
- let d = V(null), f = e.id;
1065
- return /* @__PURE__ */ U("div", {
1101
+ function Vt({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u }) {
1102
+ let d = U(null), f = e.id;
1103
+ return /* @__PURE__ */ G("div", {
1066
1104
  ref: d,
1067
1105
  tabIndex: -1,
1068
1106
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
1069
1107
  children: [
1070
- /* @__PURE__ */ U("span", {
1108
+ /* @__PURE__ */ G("span", {
1071
1109
  class: "whoo-widget-sr-only",
1072
1110
  children: [t, ": "]
1073
1111
  }),
1074
- i ? /* @__PURE__ */ U(Mt, { isSlowResponse: a }) : kt(e.content),
1075
- r && e.role === "assistant" && f ? /* @__PURE__ */ U(jt, {
1112
+ i ? /* @__PURE__ */ G(zt, { isSlowResponse: a }) : It(e.content),
1113
+ r && e.role === "assistant" && f ? /* @__PURE__ */ G(Rt, {
1076
1114
  state: n,
1077
1115
  containerRef: d,
1078
1116
  onThumbsUp: () => o(f),
@@ -1084,17 +1122,17 @@ function Pt({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1084
1122
  ]
1085
1123
  });
1086
1124
  }
1087
- function Ft({ messages: e, messageFeedback: t, announcement: n, emptyStateImage: r, agentName: i = s, showFeedback: a = !1, isStreaming: o = !1, isSlowResponse: c = !1, onThumbsUp: l, onThumbsDown: u, onDraftChange: d = () => {}, onSubmitDetailed: f, onCancelFeedback: p }) {
1088
- let m = V(null);
1089
- return B(() => {
1125
+ function Ht({ messages: e, messageFeedback: t, announcement: n, emptyStateImage: r, agentName: i = s, showFeedback: a = !1, isStreaming: o = !1, isSlowResponse: c = !1, onThumbsUp: l, onThumbsDown: u, onDraftChange: d = () => {}, onSubmitDetailed: f, onCancelFeedback: p }) {
1126
+ let m = U(null);
1127
+ return H(() => {
1090
1128
  let e = m.current;
1091
1129
  e && (e.scrollTop = e.scrollHeight);
1092
- }, [e, c]), /* @__PURE__ */ U(P, { children: [/* @__PURE__ */ U("section", {
1130
+ }, [e, c]), /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ G("section", {
1093
1131
  class: "whoo-widget-message-list",
1094
1132
  ref: m,
1095
1133
  "aria-label": "Conversation",
1096
1134
  tabIndex: 0,
1097
- children: [r ? /* @__PURE__ */ U(Nt, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ U(Pt, {
1135
+ children: [r ? /* @__PURE__ */ G(Bt, { ...r }) : null, e.map((n, r) => /* @__PURE__ */ G(Vt, {
1098
1136
  message: n,
1099
1137
  speaker: n.role === "user" ? "You" : i,
1100
1138
  showFeedback: a,
@@ -1107,7 +1145,7 @@ function Ft({ messages: e, messageFeedback: t, announcement: n, emptyStateImage:
1107
1145
  onSubmitDetailed: f,
1108
1146
  onCancelFeedback: p
1109
1147
  }, n.id ?? r))]
1110
- }), /* @__PURE__ */ U("div", {
1148
+ }), /* @__PURE__ */ G("div", {
1111
1149
  class: "whoo-widget-sr-only",
1112
1150
  "aria-live": "polite",
1113
1151
  "aria-atomic": "true",
@@ -1116,17 +1154,22 @@ function Ft({ messages: e, messageFeedback: t, announcement: n, emptyStateImage:
1116
1154
  }
1117
1155
  //#endregion
1118
1156
  //#region src/components/Panel.tsx
1119
- var It = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1120
- function Lt(e) {
1121
- return Array.from(e.querySelectorAll(It)).filter((e) => {
1157
+ var Ut = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1158
+ function Wt(e) {
1159
+ return Array.from(e.querySelectorAll(Ut)).filter((e) => {
1122
1160
  let t = getComputedStyle(e);
1123
1161
  return t.display !== "none" && t.visibility !== "hidden";
1124
1162
  });
1125
1163
  }
1126
- function Rt({ state: e, controller: t, greeting: n }) {
1127
- let r = V(null), i = V(null);
1128
- B(() => {
1164
+ function Gt({ state: e, controller: t, greeting: n }) {
1165
+ let r = U(null), i = U(null);
1166
+ H(() => {
1129
1167
  i.current?.focus();
1168
+ }, []), H(() => {
1169
+ let e = r.current, t = e ? vt(e) : () => {}, n = Ct();
1170
+ return () => {
1171
+ t(), n();
1172
+ };
1130
1173
  }, []);
1131
1174
  let a = (e) => {
1132
1175
  if (e.key === "Escape") {
@@ -1136,7 +1179,7 @@ function Rt({ state: e, controller: t, greeting: n }) {
1136
1179
  if (e.key !== "Tab") return;
1137
1180
  let n = r.current;
1138
1181
  if (!n) return;
1139
- let i = Lt(n);
1182
+ let i = Wt(n);
1140
1183
  if (i.length === 0) return;
1141
1184
  let a = i[0], o = i[i.length - 1], s = n.getRootNode().activeElement;
1142
1185
  if (!n.contains(s)) {
@@ -1155,7 +1198,7 @@ function Rt({ state: e, controller: t, greeting: n }) {
1155
1198
  url: d,
1156
1199
  alt: t.emptyStateImageAlt
1157
1200
  } : void 0;
1158
- return /* @__PURE__ */ U("div", {
1201
+ return /* @__PURE__ */ G("div", {
1159
1202
  class: "whoo-widget-panel",
1160
1203
  role: "dialog",
1161
1204
  "aria-modal": "true",
@@ -1163,30 +1206,30 @@ function Rt({ state: e, controller: t, greeting: n }) {
1163
1206
  ref: r,
1164
1207
  onKeyDown: a,
1165
1208
  children: [
1166
- /* @__PURE__ */ U("div", {
1209
+ /* @__PURE__ */ G("div", {
1167
1210
  class: "whoo-widget-header",
1168
- children: [/* @__PURE__ */ U("h2", {
1211
+ children: [/* @__PURE__ */ G("h2", {
1169
1212
  class: "whoo-widget-header-title",
1170
1213
  children: l
1171
- }), /* @__PURE__ */ U("div", {
1214
+ }), /* @__PURE__ */ G("div", {
1172
1215
  class: "whoo-widget-header-actions",
1173
- children: [e.messages.length > 0 && /* @__PURE__ */ U("button", {
1216
+ children: [e.messages.length > 0 && /* @__PURE__ */ G("button", {
1174
1217
  type: "button",
1175
1218
  class: "whoo-widget-header-reset",
1176
1219
  onClick: () => {
1177
1220
  t.resetConversation(), i.current?.focus();
1178
1221
  },
1179
1222
  children: "New conversation"
1180
- }), /* @__PURE__ */ U("button", {
1223
+ }), /* @__PURE__ */ G("button", {
1181
1224
  type: "button",
1182
1225
  class: "whoo-widget-header-close",
1183
1226
  "aria-label": "Close chat",
1184
1227
  onClick: () => t.close(),
1185
- children: /* @__PURE__ */ U(ut, {})
1228
+ children: /* @__PURE__ */ G(ct, {})
1186
1229
  })]
1187
1230
  })]
1188
1231
  }),
1189
- /* @__PURE__ */ U(Ft, {
1232
+ /* @__PURE__ */ G(Ht, {
1190
1233
  messages: u,
1191
1234
  messageFeedback: e.messageFeedback,
1192
1235
  announcement: e.announcement,
@@ -1201,8 +1244,8 @@ function Rt({ state: e, controller: t, greeting: n }) {
1201
1244
  onSubmitDetailed: (e, n, r) => t.submitFeedback(e, "down", n || void 0, r || void 0),
1202
1245
  onCancelFeedback: (e) => t.cancelFeedback(e)
1203
1246
  }),
1204
- e.runtimeError && /* @__PURE__ */ U(vt, { message: e.runtimeError }),
1205
- /* @__PURE__ */ U(_t, {
1247
+ e.runtimeError && /* @__PURE__ */ G(Tt, { message: e.runtimeError }),
1248
+ /* @__PURE__ */ G(wt, {
1206
1249
  value: e.draft,
1207
1250
  onChange: (e) => t.setDraft(e),
1208
1251
  onSend: o,
@@ -1214,11 +1257,11 @@ function Rt({ state: e, controller: t, greeting: n }) {
1214
1257
  }
1215
1258
  //#endregion
1216
1259
  //#region src/components/App.tsx
1217
- function zt({ controller: e }) {
1218
- let [t, n] = Ye(e.getState()), r = V(null), i = V(t.isOpen);
1219
- return B(() => (n(e.getState()), e.subscribe(n)), [e]), B(() => {
1260
+ function Kt({ controller: e }) {
1261
+ let [t, n] = qe(e.getState()), r = U(null), i = U(t.isOpen);
1262
+ return H(() => (n(e.getState()), e.subscribe(n)), [e]), H(() => {
1220
1263
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
1221
- }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ U(P, { children: [/* @__PURE__ */ U(gt, {
1264
+ }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ G(I, { children: [/* @__PURE__ */ G(mt, {
1222
1265
  isOpen: t.isOpen,
1223
1266
  onClick: () => t.isOpen ? e.close() : e.open(),
1224
1267
  iconUrl: e.launcher.iconUrl,
@@ -1226,7 +1269,7 @@ function zt({ controller: e }) {
1226
1269
  openIconUrl: e.launcher.openIconUrl,
1227
1270
  openIcon: e.launcher.openIcon,
1228
1271
  buttonRef: r
1229
- }), t.isOpen && /* @__PURE__ */ U(Rt, {
1272
+ }), t.isOpen && /* @__PURE__ */ G(Gt, {
1230
1273
  state: t,
1231
1274
  controller: e,
1232
1275
  greeting: e.config.greeting
@@ -1234,44 +1277,44 @@ function zt({ controller: e }) {
1234
1277
  }
1235
1278
  //#endregion
1236
1279
  //#region src/api/client.ts
1237
- var Bt = class extends Error {
1280
+ var qt = class extends Error {
1238
1281
  status;
1239
1282
  constructor(e, t) {
1240
1283
  super(e), this.name = "WidgetApiError", this.status = t;
1241
1284
  }
1242
1285
  };
1243
- function Vt(e) {
1286
+ function Jt(e) {
1244
1287
  if (typeof e != "string") return null;
1245
1288
  let t = e.trim();
1246
1289
  return t === "" ? null : t;
1247
1290
  }
1248
- async function Ht(e, t) {
1291
+ async function Yt(e, t) {
1249
1292
  let n = await fetch(`${e}/api/v1/widget/session`, {
1250
1293
  method: "POST",
1251
1294
  headers: { "Content-Type": "application/json" },
1252
1295
  body: JSON.stringify({ publishable_key: t })
1253
1296
  });
1254
- if (!n.ok) throw new Bt(`Failed to create widget session (${n.status})`, n.status);
1297
+ if (!n.ok) throw new qt(`Failed to create widget session (${n.status})`, n.status);
1255
1298
  let r = await n.json();
1256
1299
  return {
1257
1300
  token: r.token,
1258
- ...Ut(r)
1301
+ ...Xt(r)
1259
1302
  };
1260
1303
  }
1261
- function Ut(e) {
1304
+ function Xt(e) {
1262
1305
  return {
1263
- primaryColor: Vt(e.primary_color),
1264
- name: Vt(e.name),
1265
- accentColor: Vt(e.accent_color),
1266
- inkColor: Vt(e.ink_color)
1306
+ primaryColor: Jt(e.primary_color),
1307
+ name: Jt(e.name),
1308
+ accentColor: Jt(e.accent_color),
1309
+ inkColor: Jt(e.ink_color)
1267
1310
  };
1268
1311
  }
1269
- async function Wt(e, t) {
1312
+ async function Zt(e, t) {
1270
1313
  let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
1271
- if (!n.ok) throw new Bt(`Failed to load widget branding (${n.status})`, n.status);
1272
- return Ut(await n.json());
1314
+ if (!n.ok) throw new qt(`Failed to load widget branding (${n.status})`, n.status);
1315
+ return Xt(await n.json());
1273
1316
  }
1274
- async function Gt(e, t, n) {
1317
+ async function Qt(e, t, n) {
1275
1318
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
1276
1319
  method: "POST",
1277
1320
  headers: {
@@ -1285,11 +1328,11 @@ async function Gt(e, t, n) {
1285
1328
  category: n.category ?? null
1286
1329
  })
1287
1330
  });
1288
- if (!r.ok) throw new Bt(`Feedback submission failed (${r.status})`, r.status);
1331
+ if (!r.ok) throw new qt(`Feedback submission failed (${r.status})`, r.status);
1289
1332
  }
1290
1333
  //#endregion
1291
1334
  //#region src/api/sse.ts
1292
- async function* Kt(e, t, n, r, i) {
1335
+ async function* $t(e, t, n, r, i) {
1293
1336
  let a = await fetch(`${e}/api/v1/widget/chat`, {
1294
1337
  method: "POST",
1295
1338
  headers: {
@@ -1302,7 +1345,7 @@ async function* Kt(e, t, n, r, i) {
1302
1345
  }),
1303
1346
  signal: i
1304
1347
  });
1305
- if (!a.ok || !a.body) throw new Bt(`Chat request failed (${a.status})`, a.status);
1348
+ if (!a.ok || !a.body) throw new qt(`Chat request failed (${a.status})`, a.status);
1306
1349
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1307
1350
  for (;;) {
1308
1351
  let { done: e, value: t } = await o.read();
@@ -1313,11 +1356,11 @@ async function* Kt(e, t, n, r, i) {
1313
1356
  let e = c.slice(0, n);
1314
1357
  c = c.slice(n + 2);
1315
1358
  let t = e.split("\n").find((e) => e.startsWith("data: "));
1316
- t && (yield qt(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1359
+ t && (yield en(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1317
1360
  }
1318
1361
  }
1319
1362
  }
1320
- function qt(e) {
1363
+ function en(e) {
1321
1364
  return typeof e.error == "string" ? {
1322
1365
  type: "error",
1323
1366
  error: e.error,
@@ -1340,11 +1383,11 @@ function qt(e) {
1340
1383
  }
1341
1384
  //#endregion
1342
1385
  //#region src/markdown/plainText.ts
1343
- function Jt(e) {
1344
- return Et(e.replace(/\r\n?/g, "\n")).map((e) => {
1386
+ function tn(e) {
1387
+ return Nt(e.replace(/\r\n?/g, "\n")).map((e) => {
1345
1388
  switch (e.type) {
1346
1389
  case "bold":
1347
- case "italic": return Jt(e.value);
1390
+ case "italic": return tn(e.value);
1348
1391
  case "link": return e.text;
1349
1392
  default: return e.value;
1350
1393
  }
@@ -1352,16 +1395,16 @@ function Jt(e) {
1352
1395
  }
1353
1396
  //#endregion
1354
1397
  //#region src/markdown/reveal.ts
1355
- var Yt = 40, Xt = 120;
1356
- function Zt(e) {
1398
+ var nn = 40, rn = 120;
1399
+ function an(e) {
1357
1400
  let t = [];
1358
- for (let n of Et(e)) if (n.type === "text") {
1401
+ for (let n of Nt(e)) if (n.type === "text") {
1359
1402
  let e = n.value.split(/(\s+)/), r = n.start;
1360
1403
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
1361
1404
  } else t.push(n.end);
1362
1405
  return t;
1363
1406
  }
1364
- function Qt(e) {
1407
+ function on(e) {
1365
1408
  let t = null;
1366
1409
  return e?.addEventListener("abort", () => {
1367
1410
  t?.();
@@ -1376,14 +1419,14 @@ function Qt(e) {
1376
1419
  });
1377
1420
  };
1378
1421
  }
1379
- async function $t(e, t, n) {
1380
- let r = n?.wordIntervalMs ?? Yt, i = n?.tokenIntervalMs ?? Xt, a = n?.signal, o = Et(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = Qt(a), l = "";
1381
- for (let n of Zt(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1422
+ async function sn(e, t, n) {
1423
+ let r = n?.wordIntervalMs ?? nn, i = n?.tokenIntervalMs ?? rn, a = n?.signal, o = Nt(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = on(a), l = "";
1424
+ for (let n of an(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
1382
1425
  l !== e && t(e);
1383
1426
  }
1384
1427
  //#endregion
1385
1428
  //#region src/sessionToken.ts
1386
- function en(e, t = Date.now()) {
1429
+ function cn(e, t = Date.now()) {
1387
1430
  let n = e.split(".");
1388
1431
  if (n.length !== 3 || n.some((e) => e === "")) return !1;
1389
1432
  let r = n[1];
@@ -1396,31 +1439,31 @@ function en(e, t = Date.now()) {
1396
1439
  }
1397
1440
  //#endregion
1398
1441
  //#region src/storage.ts
1399
- function tn(e) {
1442
+ function ln(e) {
1400
1443
  return `whoo-aiden-widget:conversation:${e}`;
1401
1444
  }
1402
- function nn(e) {
1445
+ function un(e) {
1403
1446
  try {
1404
- return window.sessionStorage.getItem(tn(e));
1447
+ return window.sessionStorage.getItem(ln(e));
1405
1448
  } catch {
1406
1449
  return null;
1407
1450
  }
1408
1451
  }
1409
- function rn(e, t) {
1452
+ function dn(e, t) {
1410
1453
  try {
1411
- window.sessionStorage.setItem(tn(e), t);
1454
+ window.sessionStorage.setItem(ln(e), t);
1412
1455
  } catch {}
1413
1456
  }
1414
- function an(e) {
1457
+ function fn(e) {
1415
1458
  try {
1416
- window.sessionStorage.removeItem(tn(e));
1459
+ window.sessionStorage.removeItem(ln(e));
1417
1460
  } catch {}
1418
1461
  }
1419
1462
  //#endregion
1420
1463
  //#region src/theme.ts
1421
- var on = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1422
- function K(e) {
1423
- if (on.test(e.trim())) return null;
1464
+ var pn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
1465
+ function mn(e) {
1466
+ if (pn.test(e.trim())) return null;
1424
1467
  let t = document.createElement("div");
1425
1468
  if (t.style.color = e, t.style.color === "") return null;
1426
1469
  let n = document.createElement("div");
@@ -1439,69 +1482,69 @@ function K(e) {
1439
1482
  translucent: a < 1
1440
1483
  };
1441
1484
  }
1442
- function q(e) {
1443
- return K(e)?.rgb ?? null;
1485
+ function J(e) {
1486
+ return mn(e)?.rgb ?? null;
1444
1487
  }
1445
- function J([e, t, n]) {
1488
+ function Y([e, t, n]) {
1446
1489
  let r = (e) => {
1447
1490
  let t = e / 255;
1448
1491
  return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
1449
1492
  };
1450
1493
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
1451
1494
  }
1452
- function sn(e, t) {
1495
+ function hn(e, t) {
1453
1496
  let n = Math.max(e, t), r = Math.min(e, t);
1454
1497
  return (n + .05) / (r + .05);
1455
1498
  }
1456
- function cn(e) {
1457
- let t = q(e);
1499
+ function gn(e) {
1500
+ let t = J(e);
1458
1501
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
1459
- let n = J(t);
1460
- return sn(n, J([
1502
+ let n = Y(t);
1503
+ return hn(n, Y([
1461
1504
  0,
1462
1505
  0,
1463
1506
  0
1464
- ])) >= sn(n, J([
1507
+ ])) >= hn(n, Y([
1465
1508
  255,
1466
1509
  255,
1467
1510
  255
1468
1511
  ])) ? "#000000" : "#ffffff";
1469
1512
  }
1470
- function ln(e, t) {
1471
- let n = q(e), r = q(t);
1472
- return !n || !r ? NaN : sn(J(n), J(r));
1513
+ function _n(e, t) {
1514
+ let n = J(e), r = J(t);
1515
+ return !n || !r ? NaN : hn(Y(n), Y(r));
1473
1516
  }
1474
- var un = n.primary, dn = n.panel, fn = n.assistantBubble, pn = n.headerHover, mn = 4.5;
1475
- function Y([e, t, n]) {
1517
+ var vn = n.primary, yn = n.panel, bn = n.assistantBubble, xn = n.headerHover, Sn = 4.5;
1518
+ function Cn([e, t, n]) {
1476
1519
  return `#${[
1477
1520
  e,
1478
1521
  t,
1479
1522
  n
1480
1523
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
1481
1524
  }
1482
- function hn(e, t = dn) {
1483
- let n = q(e), r = q(t);
1484
- if (!n || !r) return un;
1485
- let i = J(r), a = (e) => sn(J(e), i) >= mn;
1486
- if (a(n)) return Y(n);
1525
+ function wn(e, t = yn) {
1526
+ let n = J(e), r = J(t);
1527
+ if (!n || !r) return vn;
1528
+ let i = Y(r), a = (e) => hn(Y(e), i) >= Sn;
1529
+ if (a(n)) return Cn(n);
1487
1530
  for (let e = .99; e > 0; e -= .01) {
1488
1531
  let t = n.map((t) => Math.round(t * e));
1489
- if (a(t)) return Y(t);
1532
+ if (a(t)) return Cn(t);
1490
1533
  }
1491
1534
  return "#000000";
1492
1535
  }
1493
- var gn = n.ink, _n = n.link;
1536
+ var Tn = n.ink, En = n.link;
1494
1537
  function X(e) {
1495
1538
  if (typeof e != "string" || !e) return null;
1496
- let t = K(e);
1497
- return t ? Y(t.rgb) : null;
1539
+ let t = mn(e);
1540
+ return t ? Cn(t.rgb) : null;
1498
1541
  }
1499
- function vn(e) {
1542
+ function Dn(e) {
1500
1543
  if (typeof e != "string" || !e) return null;
1501
- let t = K(e);
1502
- return t ? t.translucent ? e.trim() : Y(t.rgb) : null;
1544
+ let t = mn(e);
1545
+ return t ? t.translucent ? e.trim() : Cn(t.rgb) : null;
1503
1546
  }
1504
- var yn = [
1547
+ var On = [
1505
1548
  {
1506
1549
  role: "onPrimary",
1507
1550
  against: ["primary"],
@@ -1554,7 +1597,7 @@ var yn = [
1554
1597
  }
1555
1598
  ];
1556
1599
  function Z({ color: e, inkColor: r, accentColor: i, overrides: a }) {
1557
- let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => vn(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? un, d = s("primaryText"), f = d ?? hn(u, pn), p = s("onPrimary") ?? cn(u), m = X(r), h = s("ink") ?? (m ? hn(m, fn) : gn), g = X(i), _ = s("link") ?? (g ? hn(g, fn) : _n), v = (e) => s(e) ?? n[e], y = {
1600
+ let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => Dn(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? vn, d = s("primaryText"), f = d ?? wn(u, xn), p = s("onPrimary") ?? gn(u), m = X(r), h = s("ink") ?? (m ? wn(m, bn) : Tn), g = X(i), _ = s("link") ?? (g ? wn(g, bn) : En), v = (e) => s(e) ?? n[e], y = {
1558
1601
  primary: u,
1559
1602
  onPrimary: p,
1560
1603
  primaryText: f,
@@ -1572,9 +1615,9 @@ function Z({ color: e, inkColor: r, accentColor: i, overrides: a }) {
1572
1615
  inputBorder: v("inputBorder"),
1573
1616
  focusRing: v("focusRing")
1574
1617
  }, b = Object.fromEntries(t.map((e) => [e, s(e) !== null])), x = [];
1575
- for (let { role: e, against: t, required: n } of yn) for (let r of t) {
1618
+ for (let { role: e, against: t, required: n } of On) for (let r of t) {
1576
1619
  if (!b[e] && !b[r]) continue;
1577
- let t = ln(y[e], y[r]);
1620
+ let t = _n(y[e], y[r]);
1578
1621
  Number.isFinite(t) && t < n && x.push({
1579
1622
  role: e,
1580
1623
  against: r,
@@ -1603,56 +1646,60 @@ function Z({ color: e, inkColor: r, accentColor: i, overrides: a }) {
1603
1646
  function Q(e) {
1604
1647
  return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
1605
1648
  }
1606
- function bn(e, t, n = un) {
1649
+ function kn(e, t, n = vn) {
1607
1650
  let r = t;
1608
1651
  X(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Q(t)} as the theme color; falling back to ${Q(n)}.`), r = n);
1609
1652
  let i = Z({ color: r });
1610
1653
  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);
1611
1654
  }
1612
- function xn(e, { inkColor: t, accentColor: n }) {
1655
+ function An(e, { inkColor: t, accentColor: n }) {
1613
1656
  let r = Z({
1614
1657
  inkColor: t,
1615
1658
  accentColor: n
1616
1659
  });
1617
1660
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
1618
1661
  }
1619
- function Sn(e, n) {
1662
+ function jn(e, n) {
1620
1663
  let i = Z({ overrides: n });
1621
1664
  for (let n of t) {
1622
1665
  let t = i.overridden.primary && (n === "onPrimary" || n === "primaryText");
1623
1666
  (i.overridden[n] || t) && e.style.setProperty(r[n], i.roles[n]);
1624
1667
  }
1625
1668
  }
1626
- function Cn(e, t) {
1669
+ function Mn(e, t) {
1627
1670
  e && X(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(e)} as the ${t}; using the default.`);
1628
1671
  }
1629
- function wn(e, n) {
1672
+ function Nn(e, n, r) {
1630
1673
  for (let e of t) {
1631
1674
  let t = n[e];
1632
1675
  t && X(t) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(t)} as theme.colors.${e}; using the calculated color.`);
1633
1676
  }
1634
- let r = n.primary;
1635
- typeof r == "string" && K(r)?.translucent && console.warn(`[whoo-aiden-widget] theme.colors.primary ${Q(r)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`);
1636
- let { contrastWarnings: i } = Z({
1677
+ let i = n.primary;
1678
+ typeof i == "string" && mn(i)?.translucent && console.warn(`[whoo-aiden-widget] theme.colors.primary ${Q(i)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`), Pn({
1637
1679
  color: e.color,
1638
1680
  inkColor: e.inkColor,
1639
1681
  accentColor: e.accentColor,
1640
1682
  overrides: n
1641
- });
1642
- for (let { role: e, against: t, value: n, ratio: r, required: a, overridden: o } of i) console.warn(o ? `[whoo-aiden-widget] theme.colors.${e} (${n}) has ${r.toFixed(2)}:1 contrast against the ${t} color; ${a}:1 is recommended. Using it as given.` : `[whoo-aiden-widget] the ${e} color (${n}) has ${r.toFixed(2)}:1 contrast against your theme.colors.${t}; ${a}:1 is recommended. Override theme.colors.${e} too.`);
1683
+ }, r);
1643
1684
  }
1644
- function Tn(e, t) {
1645
- bn(e, t.color ?? un), Cn(t.inkColor, "ink color"), Cn(t.accentColor, "accent color"), xn(e, {
1685
+ function Pn(e, t) {
1686
+ for (let n of Z(e).contrastWarnings) {
1687
+ let { role: e, against: r, value: i, ratio: a, required: o, overridden: s } = n, c = `${e}|${r}|${i}`;
1688
+ t.has(c) || (t.add(c), console.warn(s ? `[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.` : `[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`));
1689
+ }
1690
+ }
1691
+ function Fn(e, t, n = /* @__PURE__ */ new Set()) {
1692
+ kn(e, t.color ?? vn), Mn(t.inkColor, "ink color"), Mn(t.accentColor, "accent color"), An(e, {
1646
1693
  inkColor: t.inkColor,
1647
1694
  accentColor: t.accentColor
1648
1695
  });
1649
- let n = T(t.theme);
1650
- wn(t, n.colors), Sn(e, n.colors), n.fontFamily && (e.style.setProperty("--whoo-widget-font", n.fontFamily), e.setAttribute("data-whoo-custom-font", ""));
1696
+ let r = T(t.theme);
1697
+ Nn(t, r.colors, n), jn(e, r.colors), r.fontFamily && (e.style.setProperty("--whoo-widget-font", r.fontFamily), e.setAttribute("data-whoo-custom-font", ""));
1651
1698
  }
1652
1699
  //#endregion
1653
1700
  //#region src/controller.ts
1654
- var En = 8e3, Dn = 3e3;
1655
- function On(e, t) {
1701
+ var In = 8e3, Ln = 3e3;
1702
+ function Rn(e, t) {
1656
1703
  return new Promise((n) => {
1657
1704
  let r = setTimeout(n, t);
1658
1705
  e.then(() => {
@@ -1660,7 +1707,7 @@ function On(e, t) {
1660
1707
  });
1661
1708
  });
1662
1709
  }
1663
- var kn = class {
1710
+ var zn = class {
1664
1711
  config;
1665
1712
  state;
1666
1713
  listeners = /* @__PURE__ */ new Set();
@@ -1726,10 +1773,10 @@ var kn = class {
1726
1773
  let e = this.config.apiBaseUrl ?? "https://api.aidenvoice.com";
1727
1774
  try {
1728
1775
  if (this.config.sessionToken) {
1729
- if (en(this.config.sessionToken)) throw Error("The sessionToken has expired.");
1776
+ if (cn(this.config.sessionToken)) throw Error("The sessionToken has expired.");
1730
1777
  this.sessionToken = this.config.sessionToken;
1731
1778
  } else if (this.config.publishableKey) {
1732
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await Ht(e, this.config.publishableKey);
1779
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await Yt(e, this.config.publishableKey);
1733
1780
  this.sessionToken = t, this.setState({
1734
1781
  primaryColor: n,
1735
1782
  agentName: r,
@@ -1741,13 +1788,13 @@ var kn = class {
1741
1788
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
1742
1789
  return;
1743
1790
  }
1744
- this.conversationId = nn(this.storageIdentifier), this.config.sessionToken && await On(this.loadBranding(e, this.config.sessionToken), Dn);
1791
+ this.conversationId = un(this.storageIdentifier), this.config.sessionToken && await Rn(this.loadBranding(e, this.config.sessionToken), Ln);
1745
1792
  }
1746
1793
  async loadBranding(e, t) {
1747
1794
  try {
1748
1795
  let n = this.config;
1749
1796
  if (X(n.color) && X(n.inkColor) && X(n.accentColor) && c(n.name)) return;
1750
- let { primaryColor: r, name: i, accentColor: a, inkColor: o } = await Wt(e, t);
1797
+ let { primaryColor: r, name: i, accentColor: a, inkColor: o } = await Zt(e, t);
1751
1798
  this.setState({
1752
1799
  primaryColor: r,
1753
1800
  agentName: i,
@@ -1763,7 +1810,7 @@ var kn = class {
1763
1810
  this.setState({ isOpen: !0 });
1764
1811
  }
1765
1812
  resetConversation() {
1766
- this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, an(this.storageIdentifier), this.setState({
1813
+ this.activeRequestController?.abort(), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, fn(this.storageIdentifier), this.setState({
1767
1814
  messages: [],
1768
1815
  messageFeedback: {},
1769
1816
  runtimeError: null,
@@ -1798,45 +1845,37 @@ var kn = class {
1798
1845
  runtimeError: null,
1799
1846
  announcement: null
1800
1847
  });
1801
- let i = (e) => {
1802
- let t = [...this.state.messages];
1803
- t[t.length - 1] = {
1804
- ...t[t.length - 1],
1805
- content: e
1806
- }, this.setState({ messages: t });
1807
- };
1848
+ let i = r, a = (e) => {
1849
+ let t = i;
1850
+ i = {
1851
+ ...i,
1852
+ ...e
1853
+ }, this.setState({ messages: this.state.messages.map((e) => e === t ? i : e) });
1854
+ }, o = (e) => a({ content: e });
1808
1855
  this.activeRequestController = new AbortController();
1809
- let { signal: a } = this.activeRequestController;
1856
+ let { signal: s } = this.activeRequestController;
1810
1857
  this.slowResponseTimer = setTimeout(() => {
1811
1858
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 });
1812
- }, En);
1813
- let o = () => {
1859
+ }, In);
1860
+ let c = () => {
1814
1861
  this.setState({
1815
1862
  runtimeError: "Something went wrong, please try again.",
1816
1863
  ...this.state.draft === "" ? { draft: e } : {}
1817
1864
  });
1818
- }, s = "";
1865
+ }, l = "";
1819
1866
  try {
1820
- for await (let n of Kt(t, this.sessionToken, this.conversationId, e, a)) if (n.type === "conversation_id") this.conversationId = n.conversationId, rn(this.storageIdentifier, n.conversationId);
1821
- 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));
1822
- else if (n.type === "done") {
1823
- if (n.conversationId && (this.conversationId = n.conversationId, rn(this.storageIdentifier, n.conversationId)), n.messageId) {
1824
- let e = [...this.state.messages];
1825
- e[e.length - 1] = {
1826
- ...e[e.length - 1],
1827
- id: n.messageId
1828
- }, this.setState({ messages: e });
1829
- }
1830
- this.setState({ announcement: Jt(s) });
1831
- } else if (n.type === "error") {
1832
- console.error("[whoo-aiden-widget] chat error:", n.error), o(), this.activeRequestController?.abort();
1867
+ for await (let n of $t(t, this.sessionToken, this.conversationId, e, s)) if (n.type === "conversation_id") this.conversationId = n.conversationId, dn(this.storageIdentifier, n.conversationId);
1868
+ else if (n.type === "delta") this.clearSlowResponse(), n.verbatim && !this.prefersReducedMotion ? (await sn(n.delta, (e) => o(e), { signal: s }), l = n.delta) : n.verbatim ? (l = n.delta, o(l)) : (l += n.delta, o(l));
1869
+ else if (n.type === "done") n.conversationId && (this.conversationId = n.conversationId, dn(this.storageIdentifier, n.conversationId)), n.messageId && a({ id: n.messageId }), this.setState({ announcement: tn(l) });
1870
+ else if (n.type === "error") {
1871
+ console.error("[whoo-aiden-widget] chat error:", n.error), c(), this.activeRequestController?.abort();
1833
1872
  break;
1834
1873
  }
1835
1874
  } catch (e) {
1836
- e?.name === "AbortError" || (console.error("[whoo-aiden-widget] chat request failed:", e), o());
1875
+ e?.name === "AbortError" || (console.error("[whoo-aiden-widget] chat request failed:", e), c());
1837
1876
  } finally {
1838
1877
  this.activeRequestController = null, this.clearSlowResponse();
1839
- let e = this.state.messages.filter((e) => e !== r);
1878
+ let e = i.id === null && i.content.trim() === "" ? this.state.messages.filter((e) => e !== i) : this.state.messages;
1840
1879
  this.setState({
1841
1880
  isStreaming: !1,
1842
1881
  ...e.length === this.state.messages.length ? {} : { messages: e }
@@ -1881,7 +1920,7 @@ var kn = class {
1881
1920
  }
1882
1921
  } });
1883
1922
  try {
1884
- await Gt(i, this.sessionToken, {
1923
+ await Qt(i, this.sessionToken, {
1885
1924
  messageId: e,
1886
1925
  rating: t,
1887
1926
  correction: n,
@@ -1905,45 +1944,73 @@ var kn = class {
1905
1944
  } });
1906
1945
  }
1907
1946
  }
1908
- }, $ = 20, An = 12, jn = 300, Mn = 352;
1909
- function Nn(e, t) {
1947
+ }, $ = 20, Bn = 12, Vn = 300, Hn = 352;
1948
+ function Un() {
1949
+ try {
1950
+ return typeof CSS < "u" && CSS.supports?.("height", "100dvh") ? "dvh" : "vh";
1951
+ } catch {
1952
+ return "vh";
1953
+ }
1954
+ }
1955
+ function Wn(e, t) {
1910
1956
  let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o } = te(t.layout), s = (e) => typeof t.layout?.offset?.[e] == "number";
1911
1957
  if (typeof window < "u" && window.innerWidth > 0 && window.innerHeight > 0) {
1912
- let e = Math.max($, window.innerWidth - jn), t = Math.max($, window.innerHeight - i - Mn);
1958
+ let e = Math.max($, window.innerWidth - Vn), t = Math.max($, window.innerHeight - i - Hn);
1913
1959
  s("x") && (n > e || n > window.innerWidth - i) && console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`), s("y") && (r > t || r > window.innerHeight - i) && console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`);
1914
1960
  }
1915
- let c = `min(${n}px, max(${$}px, calc(100vw - ${jn}px)), calc(100vw - ${i}px))`, l = `min(${r}px, max(${$}px, calc(100vh - ${i + Mn}px)), calc(100vh - ${i}px))`, u = `calc(${l} + ${i}px + ${An}px)`, d = t.position === "bottom-left", f = (t, n) => e.style.setProperty(t, n);
1916
- f("--whoo-widget-inset-left", d ? c : "auto"), f("--whoo-widget-inset-right", d ? "auto" : c), f("--whoo-widget-inset-bottom", l), f("--whoo-widget-launcher-size", `${i}px`), f("--whoo-widget-panel-bottom", u), f("--whoo-widget-panel-width", `${a}px`), f("--whoo-widget-panel-height", `${o}px`), f("--whoo-widget-panel-max-width", `calc(100vw - ${c} - ${$}px)`), f("--whoo-widget-panel-max-height", `calc(100vh - ${u} - ${$}px)`);
1961
+ let c = `100${Un()}`, l = `min(${n}px, max(${$}px, calc(100vw - ${Vn}px)), calc(100vw - ${i}px))`, u = `min(${r}px, max(${$}px, calc(${c} - ${i + Hn}px)), calc(${c} - ${i}px))`, d = `calc(${u} + ${i}px + ${Bn}px)`, f = t.position === "bottom-left", p = (t, n) => e.style.setProperty(t, n);
1962
+ p("--whoo-widget-inset-left", f ? l : "auto"), p("--whoo-widget-inset-right", f ? "auto" : l), p("--whoo-widget-inset-bottom", u), p("--whoo-widget-launcher-size", `${i}px`), p("--whoo-widget-panel-bottom", d), p("--whoo-widget-panel-width", `${a}px`), p("--whoo-widget-panel-height", `${o}px`), p("--whoo-widget-panel-max-width", `calc(100vw - ${l} - ${$}px)`), p("--whoo-widget-panel-max-height", `calc(${c} - ${d} - ${$}px)`);
1917
1963
  }
1918
1964
  //#endregion
1919
1965
  //#region src/styles.css?inline
1920
- var Pn = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);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{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);border-radius:12px;flex-direction:column;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 var(--whoo-widget-border,#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:var(--whoo-widget-panel,#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:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#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{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.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:var(--whoo-widget-typing-dots,#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{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#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:var(--whoo-widget-muted,#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:var(--whoo-widget-text,#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;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;border-radius:6px;width:100%;padding:6px;font-size:12px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#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{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#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}[data-whoo-custom-font] button,[data-whoo-custom-font] input,[data-whoo-custom-font] textarea,[data-whoo-custom-font] select{font-family:inherit}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#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}}";
1966
+ var Gn = ":host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);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{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);border-radius:12px;flex-direction:column;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-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#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:var(--whoo-widget-panel,#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:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#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{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.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:var(--whoo-widget-typing-dots,#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{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;flex:1;min-width:0;padding:8px;font-size:16px}.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:var(--whoo-widget-muted,#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:var(--whoo-widget-text,#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;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.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{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#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}[data-whoo-custom-font] button,[data-whoo-custom-font] input,[data-whoo-custom-font] textarea,[data-whoo-custom-font] select{font-family:inherit}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#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}}";
1921
1967
  //#endregion
1922
1968
  //#region src/mount.tsx
1923
- function Fn(e) {
1969
+ function Kn(e) {
1924
1970
  let t = document.createElement("div");
1925
1971
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(o(e.zIndex));
1926
1972
  let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
1927
- r.textContent = Pn, n.appendChild(r);
1973
+ r.textContent = Gn, n.appendChild(r);
1928
1974
  let i = document.createElement("div");
1929
- n.appendChild(i), Tn(i, e), Nn(i, e);
1930
- let a = new kn(e), s = X(e.color) !== null, c = null, l = "", u = T(e.theme).colors;
1931
- return a.subscribe((t) => {
1975
+ n.appendChild(i);
1976
+ let a = /* @__PURE__ */ new Set();
1977
+ Fn(i, e, a), Wn(i, e);
1978
+ let s = new zn(e), c = X(e.color) !== null, l = null, u = "", d = T(e.theme).colors, f = Object.keys(d).length > 0, p = {
1979
+ color: e.color,
1980
+ inkColor: e.inkColor,
1981
+ accentColor: e.accentColor
1982
+ };
1983
+ return s.subscribe((t) => {
1932
1984
  let n = !1;
1933
- !s && t.primaryColor && t.primaryColor !== c && (c = t.primaryColor, bn(i, t.primaryColor, e.color), n = !0);
1985
+ !c && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, kn(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
1986
+ ...p,
1987
+ color: t.primaryColor
1988
+ }), n = !0);
1934
1989
  let r = `${t.inkColor}|${t.accentColor}`;
1935
- (t.inkColor || t.accentColor) && r !== l && (l = r, xn(i, {
1936
- inkColor: X(e.inkColor) ? e.inkColor : t.inkColor,
1937
- accentColor: X(e.accentColor) ? e.accentColor : t.accentColor
1938
- }), n = !0), n && Sn(i, u);
1939
- }), a.init(), Ie(/* @__PURE__ */ U(zt, { controller: a }), i), document.body.appendChild(t), { unmount() {
1940
- Ie(null, i), t.remove();
1990
+ if ((t.inkColor || t.accentColor) && r !== u) {
1991
+ u = r;
1992
+ let a = X(e.inkColor) ? e.inkColor : t.inkColor, o = X(e.accentColor) ? e.accentColor : t.accentColor;
1993
+ An(i, {
1994
+ inkColor: a,
1995
+ accentColor: o
1996
+ }), p = {
1997
+ ...p,
1998
+ inkColor: a,
1999
+ accentColor: o
2000
+ }, n = !0;
2001
+ }
2002
+ n && (jn(i, d), f && Pn({
2003
+ ...p,
2004
+ overrides: d
2005
+ }, a));
2006
+ }), s.init(), Pe(/* @__PURE__ */ G(Kt, { controller: s }), i), document.body.appendChild(t), { unmount() {
2007
+ Pe(null, i), t.remove();
1941
2008
  } };
1942
2009
  }
1943
2010
  //#endregion
1944
2011
  //#region src/index.ts
1945
- function In(e) {
1946
- return l(e), Fn(e);
2012
+ function qn(e) {
2013
+ return l(e), Kn(e);
1947
2014
  }
1948
2015
  //#endregion
1949
- export { In as init, Z as resolveTheme };
2016
+ export { qn as init, Z as resolveTheme };