@aiden-voice/widget 0.10.1 → 0.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widget.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region src/i18n/messages.ts
1
+ // src/i18n/messages.ts
2
2
  var e = {
3
3
  openChat: "Open chat",
4
4
  closeChat: "Close chat",
@@ -31,8 +31,7 @@ var e = {
31
31
  opensInNewTab: "(opens in new tab)",
32
32
  agreeToNotice: "I agree"
33
33
  }, t = Object.keys(e);
34
- //#endregion
35
- //#region src/imageUrl.ts
34
+ // src/imageUrl.ts
36
35
  function n(e, t) {
37
36
  if (e != null && e !== "") {
38
37
  if (typeof e == "string") try {
@@ -42,8 +41,7 @@ function n(e, t) {
42
41
  console.warn(`whoo-aiden-widget: ignoring \`${t}\` -- only https: and data:image/ URLs are allowed.`);
43
42
  }
44
43
  }
45
- //#endregion
46
- //#region src/themeRoles.ts
44
+ // src/themeRoles.ts
47
45
  var r = [
48
46
  "primary",
49
47
  "onPrimary",
@@ -171,25 +169,25 @@ var E = ["bubble", "centered"], D = ["top", "footer"];
171
169
  function O(e) {
172
170
  return T(e, E, "greetingStyle") ?? "bubble";
173
171
  }
174
- function k(e) {
172
+ function ee(e) {
175
173
  return T(e, D, "noticePlacement") ?? "top";
176
174
  }
177
- var A = 200, ee = /url\(|[@;{}\\]/i;
178
- function te(e) {
175
+ var te = 200, ne = /url\(|[@;{}\\]/i;
176
+ function re(e) {
179
177
  if (!S(e)) {
180
178
  if (typeof e == "string") {
181
179
  let t = e.trim();
182
- if (t && t.length <= A && !ee.test(t)) return t;
180
+ if (t && t.length <= te && !ne.test(t)) return t;
183
181
  }
184
- p(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${A} characters, without url(), @, ;, {, } or \\.`);
182
+ p(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${te} characters, without url(), @, ;, {, } or \\.`);
185
183
  }
186
184
  }
187
- var ne = [
185
+ var ie = [
188
186
  "chat",
189
187
  "message",
190
188
  "sparkle"
191
- ], re = ["chevron-down", "close"], ie = /* @__PURE__ */ new WeakMap();
192
- function ae(e) {
189
+ ], ae = ["chevron-down", "close"], oe = /* @__PURE__ */ new WeakMap();
190
+ function se(e) {
193
191
  let t = {
194
192
  colors: {},
195
193
  fontFamily: void 0,
@@ -197,7 +195,7 @@ function ae(e) {
197
195
  };
198
196
  if (e == null) return t;
199
197
  if (!x(e)) return _(e), t;
200
- let i = ie.get(e);
198
+ let i = oe.get(e);
201
199
  if (i) return i;
202
200
  w(e, [
203
201
  "colors",
@@ -213,7 +211,7 @@ function ae(e) {
213
211
  }
214
212
  }
215
213
  let o = C(e, "fonts", "theme.fonts");
216
- o && (w(o, ["family"], "theme.fonts"), t.fontFamily = te(o.family));
214
+ o && (w(o, ["family"], "theme.fonts"), t.fontFamily = re(o.family));
217
215
  let s = C(e, "launcher", "theme.launcher");
218
216
  if (s) {
219
217
  w(s, [
@@ -222,31 +220,31 @@ function ae(e) {
222
220
  "openIcon",
223
221
  "openIconUrl"
224
222
  ], "theme.launcher");
225
- let e = T(s.icon, ne, "theme.launcher.icon"), r = n(s.iconUrl, "theme.launcher.iconUrl"), i = T(s.openIcon, re, "theme.launcher.openIcon"), a = n(s.openIconUrl, "theme.launcher.openIconUrl");
223
+ let e = T(s.icon, ie, "theme.launcher.icon"), r = n(s.iconUrl, "theme.launcher.iconUrl"), i = T(s.openIcon, ae, "theme.launcher.openIcon"), a = n(s.openIconUrl, "theme.launcher.openIconUrl");
226
224
  e && (t.launcher.icon = e), r && (t.launcher.iconUrl = r), i && (t.launcher.openIcon = i), a && (t.launcher.openIconUrl = a);
227
225
  }
228
- return ie.set(e, t), t;
226
+ return oe.set(e, t), t;
229
227
  }
230
- var j = {
228
+ var k = {
231
229
  offsetX: 20,
232
230
  offsetY: 20,
233
231
  launcherSize: 56,
234
232
  panelWidth: 360,
235
233
  panelHeight: 480
236
234
  };
237
- function M(e, t, n) {
235
+ function A(e, t, n) {
238
236
  return e == null ? n : typeof e == "number" && Number.isFinite(e) && e >= 0 ? e : (p(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`), n);
239
237
  }
240
- function oe(e, t, n, r) {
238
+ function j(e, t, n, r) {
241
239
  let i = Math.min(r, Math.max(n, e));
242
240
  return i !== e && p(`\`${t}\` ${e} is out of range (${r === Infinity ? `at least ${n}` : `${n}-${r}`}); using ${i}.`), i;
243
241
  }
244
- var se = /* @__PURE__ */ new WeakMap();
245
- function ce(e) {
246
- let t = { ...j };
242
+ var ce = /* @__PURE__ */ new WeakMap();
243
+ function le(e) {
244
+ let t = { ...k };
247
245
  if (e == null) return t;
248
246
  if (!x(e)) return v(e), t;
249
- let n = se.get(e);
247
+ let n = ce.get(e);
250
248
  if (n) return n;
251
249
  w(e, [
252
250
  "offset",
@@ -255,16 +253,15 @@ function ce(e) {
255
253
  "cornerRadius"
256
254
  ], "layout");
257
255
  let r = C(e, "offset", "layout.offset");
258
- r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = M(r.x, "layout.offset.x", j.offsetX), t.offsetY = M(r.y, "layout.offset.y", j.offsetY)), t.launcherSize = oe(M(e.launcherSize, "layout.launcherSize", j.launcherSize), "layout.launcherSize", 24, 120);
256
+ r && (w(r, ["x", "y"], "layout.offset"), t.offsetX = A(r.x, "layout.offset.x", k.offsetX), t.offsetY = A(r.y, "layout.offset.y", k.offsetY)), t.launcherSize = j(A(e.launcherSize, "layout.launcherSize", k.launcherSize), "layout.launcherSize", 24, 120);
259
257
  let i = C(e, "panel", "layout.panel");
260
- i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = oe(M(i.width, "layout.panel.width", j.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = oe(M(i.height, "layout.panel.height", j.panelHeight), "layout.panel.height", 320, Infinity));
258
+ i && (w(i, ["width", "height"], "layout.panel"), t.panelWidth = j(A(i.width, "layout.panel.width", k.panelWidth), "layout.panel.width", 280, Infinity), t.panelHeight = j(A(i.height, "layout.panel.height", k.panelHeight), "layout.panel.height", 320, Infinity));
261
259
  let a = e.cornerRadius;
262
- return typeof a == "number" && Number.isFinite(a) && a >= 0 ? t.cornerRadius = oe(a, "layout.cornerRadius", 0, 32) : S(a) || p("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."), se.set(e, t), t;
260
+ return typeof a == "number" && Number.isFinite(a) && a >= 0 ? t.cornerRadius = j(a, "layout.cornerRadius", 0, 32) : S(a) || p("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."), ce.set(e, t), t;
263
261
  }
264
- //#endregion
265
- //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/dist/preact.mjs
266
- var N, le, P, ue, de, fe, pe, me, he, ge, _e = {}, ve = [], ye = /^m(i|n|o|s|text|space)$/, be = Array.isArray, xe = ve.slice, F = Object.assign;
267
- function Se(e) {
262
+ // node_modules/.pnpm/preact@11.1.1/node_modules/preact/dist/preact.mjs
263
+ var M, ue, N, de, fe, pe, P, me, he, ge, _e = Symbol.for("pv"), ve = {}, ye = [], be = /^m(i|n|o|s|text|space)$/, xe = Array.isArray, Se = ye.slice, F = Object.assign;
264
+ function I(e) {
268
265
  e && e.parentNode && e.remove();
269
266
  }
270
267
  function Ce(e, t, n, r, i) {
@@ -278,23 +275,23 @@ function Ce(e, t, n, r, i) {
278
275
  __b: 0,
279
276
  __e: null,
280
277
  __c: null,
281
- constructor: void 0,
282
- __v: i || ++le,
278
+ constructor: _e,
279
+ __v: i || ++ue,
283
280
  __i: -1,
284
281
  __u: 0
285
282
  };
286
- return !i && N.vnode && N.vnode(a), a;
283
+ return !i && M.vnode && M.vnode(a), a;
287
284
  }
288
- function I(e) {
285
+ function L(e) {
289
286
  return e.children;
290
287
  }
291
288
  function we(e, t) {
292
289
  this.props = e, this.context = t, this.__g = 0;
293
290
  }
294
- function L(e, t) {
295
- if (t == null) return e.__ ? L(e.__, e.__i + 1) : null;
291
+ function R(e, t) {
292
+ if (t == null) return e.__ && R(e.__, e.__i + 1);
296
293
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) && n.__e) return n.__e;
297
- return typeof e.type != "function" || e.props.__P ? null : L(e);
294
+ return typeof e.type != "function" || e.props.__P ? null : R(e);
298
295
  }
299
296
  function Te(e) {
300
297
  if ((e = e.__) && e.__c && !e.props.__P) return e.__e = null, e.__k.some(function(t) {
@@ -302,50 +299,51 @@ function Te(e) {
302
299
  }), Te(e);
303
300
  }
304
301
  function Ee(e) {
305
- (8 & e.__g || !(e.__g |= 8) || !P.push(e) || de++) && ue == N.debounceRendering || ((ue = N.debounceRendering) || queueMicrotask)(De);
302
+ (8 & e.__g || (e.__g |= 8, N.push(e), fe++)) && de == M.debounceRendering || ((de = M.debounceRendering) || queueMicrotask)(De);
306
303
  }
307
304
  function De() {
308
305
  var e, t, n, r, i, a, o, s, c;
309
306
  try {
310
- for (t = 1; P.length;) P.length > t && P.sort(fe), e = P.shift(), t = P.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, N.vnode && N.vnode(r), Fe(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, Le(o, r, s), i.__ = i.__e = null, r.__e != a && Te(r)));
307
+ for (t = 1; N.length;) N.length > t && N.sort(pe), e = N.shift(), t = N.length, 8 & e.__g && (r = void 0, i = void 0, a = (i = (n = e).__v).__e, o = [], s = [], (c = n.__P) && ((r = F({ constructor: _e }, i)).__v = i.__v + 1, M.vnode && M.vnode(r), Fe(c, r, i, n.__n, c.namespaceURI, 32 & i.__u ? [a] : null, o, a || R(i), 32 & i.__u, s), r.__v = i.__v, r.__.__k[r.__i] = r, Re(o, r, s), i.__ = i.__e = null, r.__e != a && Te(r)));
311
308
  } finally {
312
- P.length = de = 0;
309
+ (fe = N.length) && (de || queueMicrotask)(De);
313
310
  }
314
311
  }
315
312
  function Oe(e, t, n, r, i, a, o, s, c, l, u) {
316
- var d, f, p, m, h, g, _ = r.__k || ve, v = t.length;
317
- for (c = ke(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || _e, p.__i = d, g = Fe(e, p, f, i, a, o, s, c, l, u), m = p.__e, (f.ref != p.ref || 8 & f.__u) && (f.ref && ze(f.ref, null, p, f), p.ref && u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Ae(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);
313
+ var d, f, p, m, h, g, _ = r.__k || ye, v = t.length;
314
+ for (c = ke(n, t, _, c, v), d = 0; d < v; d++) (p = n.__k[d]) != null && (f = ~p.__i && _[p.__i] || ve, p.__i = d, g = Fe(e, p, f, i, a, o, s, c, l, u), m = p.__e, (f.ref != p.ref || 8 & f.__u) && (f.ref && Be(f.ref, null, p, f), p.ref && u.push(p.ref, p.__c || m, p)), h ||= m, 4 & p.__u ? (c = Ae(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 &= -21);
318
315
  return n.__e = h, c;
319
316
  }
320
317
  function ke(e, t, n, r, i) {
321
- var a, o, s, c, l, u, d, f, p, m, h = n.length, g = h, _ = 0, v = !1, y = e.__k = Array(i);
322
- 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] = Ce(null, o) : be(o) ? o = y[a] = Ce(I, { children: o }) : o.constructor === void 0 && o.__b ? o = y[a] = Ce(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 = je(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;
323
- if (v) {
324
- for (u = [], d = [], a = 0; a < i; a++) if ((o = y[a]) && 2 & o.__u) {
325
- for (f = 0, p = u.length; f < p;) u[m = f + p >> 1] < o.__i ? f = m + 1 : p = m;
326
- u[f] = o.__i, d[a] = f + 1;
318
+ var a, o, s, c, l, u, d, f, p, m = n.length, h = m, g = 0, _ = 0, v = e.__k = Array(i);
319
+ for (a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o != "object" || o.constructor === String ? o = v[a] = Ce(null, o) : xe(o) ? o = v[a] = Ce(L, { children: o }) : o.constructor === _e && o.__b ? o = v[a] = Ce(o.type, o.props, o.key, o.ref, o.__v) : v[a] = o, c = a + g, o.__ = e, o.__b = e.__b + 1, s = null, ~(l = o.__i = je(o, n, c, h)) && (h--, (s = n[l]) && (s.__u |= 2)), s && s.__v ? (o.__u |= 16, l == c - 1 ? g-- : l == c + 1 ? g++ : l != c && (l > c ? g-- : g++, _ = 1)) : (~l || (i > m ? g-- : i < m && g++), typeof o.type != "function" && (o.__u |= 4))) : v[a] = null;
320
+ if (_) {
321
+ for (u = [], d = [], a = 0; a < i; a++) if ((o = v[a]) && 16 & o.__u) {
322
+ for (g = 0, f = u.length; g < f;) u[p = g + f >> 1] < o.__i ? g = p + 1 : f = p;
323
+ u[g] = o.__i, d[a] = g + 1;
327
324
  }
328
- for (_ = u.length; a--;) d[a] && (d[a] == _ ? _-- : y[a].__u |= 4);
325
+ for (g = u.length; a--;) d[a] && (d[a] == g ? g-- : v[a].__u |= 4);
329
326
  }
330
- if (g) for (a = 0; a < h; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = L(s)), Be(s, s));
327
+ if (h) for (a = 0; a < m; a++) !(s = n[a]) || 2 & s.__u || (s.__e == r && (r = R(s)), Ve(s, s));
331
328
  return r;
332
329
  }
333
330
  function Ae(e, t, n, r) {
334
- var i, a, o;
331
+ var i, a, o, s;
335
332
  if (typeof e.type == "function") {
336
333
  if (e.props.__P) return t;
337
334
  if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && (i[a].__ = e, t = Ae(i[a], t, n, !1));
338
335
  return t;
339
336
  }
340
- for (t && !t.parentNode && (t = L(e)) && !t.parentNode && (t = null), o = t; o && o.nodeType == 8;) o = o.nextSibling;
341
- for (e.__e != o && (!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;);
337
+ for (t && !t.parentNode && (t = R(e)) && !t.parentNode && (t = null), o = e.__e, s = t; s && s.nodeType == 8;) s = s.nextSibling;
338
+ for (o != s && (!r && n.moveBefore && o.parentNode ? n.moveBefore(o, t) : n.insertBefore(o, t || null)), t = o; (t &&= t.nextSibling) && t.nodeType == 8 && !t.data.startsWith("$s"););
342
339
  return t;
343
340
  }
344
341
  function je(e, t, n, r) {
345
- var i, a, o, s = e.key, c = e.type, l = t[n], u = l && !(2 & l.__u);
346
- if (l === null && s == null || u && s == l.key && c == l.type) return n;
347
- if (r > +!!u) {
348
- for (i = n - 1, a = n + 1; i >= 0 || a < t.length;) if ((l = t[o = i >= 0 ? i-- : a++]) && !(2 & l.__u) && s == l.key && c == l.type) return o;
342
+ var i, a = e.key, o = e.type, s = t[n], c = s && !(2 & s.__u);
343
+ if (s === null && a == null || c && a == s.key && o == s.type) return n;
344
+ if (r > +!!c) {
345
+ for (i = n - 1; i >= 0; i--) if ((s = t[i]) && !(2 & s.__u) && a == s.key && o == s.type) return i;
346
+ for (i = n + 1; i < t.length; i++) if ((s = t[i]) && !(2 & s.__u) && a == s.key && o == s.type) return i;
349
347
  }
350
348
  return -1;
351
349
  }
@@ -354,10 +352,10 @@ function Me(e, t, n) {
354
352
  }
355
353
  function Ne(e, t, n, r, i) {
356
354
  var a, o;
357
- n: if (t == "style") {
355
+ if (t == "style") {
358
356
  if (typeof n == "string") e.style.cssText = n;
359
357
  else {
360
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Me(e.style, t, "");
358
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Me(e.style, t);
361
359
  if (n) for (t in n) r && n[t] == r[t] || Me(e.style, t, n[t]);
362
360
  }
363
361
  } else if (t[0] == "o" && t[1] == "n") (e.__e ||= {})[t] = n, n && r || (o = ge[t] || (ge[t] = Pe(t)), (e.__a ||= {})[t] = he, a = t != (t = t.replace(me, "$1")), (t = t.slice(2))[0] < "a" && (t = t.toLowerCase()), n ? e.addEventListener(t, o, a) : e.removeEventListener(t, o, a));
@@ -365,101 +363,97 @@ function Ne(e, t, n, r, i) {
365
363
  if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
366
364
  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 {
367
365
  e[t] = n ?? "";
368
- break n;
366
+ return;
369
367
  } catch {}
370
- typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
368
+ if (typeof n == "function") return;
369
+ n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n);
371
370
  }
372
371
  }
373
372
  function Pe(e) {
374
373
  return function(t) {
375
- if (this.__e) {
376
- var n = this.__e[e];
377
- if (t[pe] == null) t[pe] = he++;
378
- else if (t[pe] < this.__a[e]) return;
379
- return n(N.event ? N.event(t) : t);
374
+ var n = this.__e;
375
+ if (n) {
376
+ if (n = n[e], t[P] == null) t[P] = he++;
377
+ else if (t[P] < this.__a[e]) return;
378
+ return n(M.event ? M.event(t) : t);
380
379
  }
381
380
  };
382
381
  }
383
382
  function Fe(e, t, n, r, i, a, o, s, c, l) {
384
- var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A = t.type;
385
- if (t.constructor !== void 0) return null;
386
- if (128 & n.__u && (c = 32 & n.__u, u = n.__c.__z)) {
387
- if (t.__u |= c, d = a = [], u.nodeType == 8) for (f = 1, p = u.nextSibling; p; p = p.nextSibling) {
388
- if (p.nodeType == 8) {
389
- if (p.data.startsWith("$s")) f++;
390
- else if (p.data.startsWith("/$s") && !--f) break;
391
- }
392
- a.push(p);
393
- }
394
- else a.push(u);
395
- s = a[0];
396
- }
397
- (u = N.__b) && u(t);
398
- n: if (typeof A == "function") {
399
- m = o.length;
383
+ var u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O = t.type;
384
+ if (t.constructor !== _e) return null;
385
+ 128 & n.__u && (c = 32 & n.__u, u = n.__c.__z) && (t.__u |= c, d = a = [], u.nodeType == 8 ? s = Ie(u, a) : a.push(u), s = a[0] || s), (u = M.__b) && u(t);
386
+ n: if (typeof O == "function") {
387
+ f = o.length;
400
388
  try {
401
- if (y = t.props, b = (u = A.prototype) && u.render, x = (u = A.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 A(y, S) : (t.__c = h = new we(y, S), h.constructor = A, h.render = Ve), 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), A.getDerivedStateFromProps && (h.__s == h.state && (h.__s = F({}, h.__s)), F(h.__s, A.getDerivedStateFromProps(y, h.__s)))), g = h.props, _ = h.state, h.__v = t, n.__c) {
402
- if (b && !A.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)) {
403
- 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) {
389
+ if (_ = t.props, v = (u = O.prototype) && u.render, y = (u = O.contextType) && r[u.__c], b = u ? y ? y.props.value : u.__ : r, (p = n.__c) ? (t.__c = p, 2 & p.__g && (p.__g |= 1)) : (v ? t.__c = p = new O(_, b) : (t.__c = p = new we(_, b), p.constructor = O, p.render = He), y && y.sub(p), p.state || (p.state = {}), p.__n = r, p.__g |= 8, p.__h = [], p.__k = []), v && (p.__s || (p.__s = p.state), O.getDerivedStateFromProps && (p.__s == p.state && (p.__s = F({}, p.__s)), F(p.__s, O.getDerivedStateFromProps(_, p.__s)))), m = p.props, h = p.state, p.__v = t, n.__c) {
390
+ if (_ !== m && v && !O.getDerivedStateFromProps && p.componentWillReceiveProps && p.componentWillReceiveProps(_, b), t.__v == n.__v && !(8 & p.__g) || !(4 & p.__g) && p.shouldComponentUpdate && !1 === p.shouldComponentUpdate(_, p.__s, b)) {
391
+ t.__v != n.__v && (p.props = _, p.state = p.__s, p.__g &= -9), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(e) {
404
392
  e && (e.__ = t);
405
- }), ve.push.apply(h.__h, h.__k), h.__k = [], h.__h.length && o.push(h), s = L(n);
393
+ }), ye.push.apply(p.__h, p.__k), p.__k = [], p.__h.length && o.push(p), s = R(n);
406
394
  break n;
407
395
  }
408
- h.componentWillUpdate && h.componentWillUpdate(y, h.__s, S), b && h.componentDidUpdate && h.__h.push(function() {
409
- h.componentDidUpdate(g, _, v);
396
+ p.componentWillUpdate && p.componentWillUpdate(_, p.__s, b), v && p.componentDidUpdate && p.__h.push(function() {
397
+ p.componentDidUpdate(m, h, g);
410
398
  });
411
- } else b && !A.getDerivedStateFromProps && h.componentWillMount && h.componentWillMount(), b && h.componentDidMount && h.__h.push(h.componentDidMount);
412
- if (h.context = S, h.props = y, h.__P = e, h.__g &= -5, C = N.__r, w = 0, b) h.state = h.__s, h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), ve.push.apply(h.__h, h.__k), h.__k = [];
399
+ } else v && !O.getDerivedStateFromProps && p.componentWillMount && p.componentWillMount(), v && p.componentDidMount && p.__h.push(p.componentDidMount);
400
+ if (p.context = b, p.props = _, p.__P = e, p.__g &= -5, x = M.__r, S = 0, v) p.state = p.__s, p.__g &= -9, x && x(t), u = p.render(p.props, p.state, p.context), ye.push.apply(p.__h, p.__k), p.__k = [];
413
401
  else do
414
- h.__g &= -9, C && C(t), u = h.render(h.props, h.state, h.context), h.state = h.__s;
415
- while (8 & h.__g && ++w < 25);
416
- h.state = h.__s, h.getChildContext && (r = F({}, r, h.getChildContext())), b && n.__c && h.getSnapshotBeforeUpdate && (v = h.getSnapshotBeforeUpdate(g, _)), T = 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) {
417
- e && Be(e, e);
418
- }), n.__k = null), s = n.__k ? L(n, 0) : null), s = Oe(e, be(T) ? T : [T], 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(Se), h.__h.length && o.push(h), 1 & h.__g && (h.__g &= -4);
402
+ p.__g &= -9, x && x(t), u = p.render(p.props, p.state, p.context), p.state = p.__s;
403
+ while (8 & p.__g && ++S < 25);
404
+ p.state = p.__s, p.getChildContext && (r = F({}, r, p.getChildContext())), v && n.__c && p.getSnapshotBeforeUpdate && (g = p.getSnapshotBeforeUpdate(m, h)), C = u && u.type === L && u.key == null ? u.props.children : u, _.__P && (u = s, i = (e = _.__P).namespaceURI, c = a = null, n.props && n.props.__P != e && (n.__k.some(function(e) {
405
+ e && Ve(e, e);
406
+ }), n.__k = null), s = n.__k ? R(n, 0) : null), s = Oe(e, xe(C) ? C : [C], t, n, r, i, a, o, s, c, l), _.__P && (t.__e = null, s = u), t.__u &= -161, d && d.some(I), p.__h.length && o.push(p), 1 & p.__g && (p.__g &= -4);
419
407
  } catch (e) {
420
- if (o.length = m, t.__v = null, c || a) {
408
+ if (o.length = f, t.__v = null, c || a) {
421
409
  if (e.then) {
422
- if (E = 0, t.__u |= c ? 160 : 128, a) {
423
- for (~(O = a.indexOf(s || void 0)) || (O = a.length); (k = a[O - 1]) && k.nodeType == 8;) O--;
424
- for (; O < a.length; O++) if (k = a[O]) {
425
- if (a[O] = null, k.nodeType == 8) {
426
- if (k.data.startsWith("$s")) E++ || (D = k);
427
- else if (E && k.data.startsWith("/$s") && !--E) {
428
- s = k;
429
- break;
430
- }
431
- } else if (!E) break;
410
+ if (w = 0, t.__u |= 128 | c, a) {
411
+ for (~(E = a.indexOf(s || void 0)) || (E = a.length); (D = a[E - 1]) && D.nodeType == 8;) E--;
412
+ for (; E < a.length; E++) if (D = a[E]) {
413
+ if (a[E] = null, D.nodeType == 8) {
414
+ if (D.data.startsWith("$s")) w++ || (T = D);
415
+ else if (w && D.data.startsWith("/$s") && !--w) break;
416
+ } else if (!w) break;
432
417
  }
433
418
  }
434
- if (!D) {
419
+ if (!T) {
435
420
  for (; s && s.nodeType == 8 && s.nextSibling;) s = s.nextSibling;
436
- D = s;
421
+ T = s;
437
422
  }
438
- t.__c.__z || (t.__c.__z = D), t.__e = s;
439
- } else a && a.some(Se);
423
+ (u = Ie(T = t.__c.__z || (t.__c.__z = T))) ? (t.__e = T, s = u) : t.__e = s, s &&= s.nextSibling;
424
+ } else a && a.some(I);
440
425
  } else t.__e = n.__e;
441
- t.__k ||= n.__k || [], e.then || Ie(t), N.__e(e, t, n);
426
+ t.__k ||= n.__k || [], e.then || Le(t), M.__e(e, t, n);
442
427
  }
443
- } else s = t.__e = Re(n.__e, t, n, r, i, a, o, c, l, e);
444
- return (u = N.diffed) && u(t), 128 & t.__u ? void 0 : s;
428
+ } else s = t.__e = ze(n.__e, t, n, r, i, a, o, c, l, e);
429
+ return (u = M.diffed) && u(t), s;
430
+ }
431
+ function Ie(e, t) {
432
+ if (e && e.nodeType == 8 && e.data.startsWith("$s")) for (var n = 1; e = e.nextSibling;) {
433
+ if (e.nodeType == 8) {
434
+ if (e.data.startsWith("$s")) n++;
435
+ else if (e.data.startsWith("/$s") && !--n) return e;
436
+ }
437
+ t && t.push(e);
438
+ }
445
439
  }
446
- function Ie(e) {
447
- e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Ie));
440
+ function Le(e) {
441
+ e && (e.__c && (e.__c.__g |= 4), e.__k && e.__k.some(Le));
448
442
  }
449
- function Le(e, t, n) {
450
- for (var r = 0; r < n.length;) ze(n[r++], n[r++], n[r++]);
451
- N.__c && N.__c(t, e), e.some(function(t) {
443
+ function Re(e, t, n) {
444
+ for (var r = 0; r < n.length;) Be(n[r++], n[r++], n[r++]);
445
+ M.__c && M.__c(t, e), e.some(function(t) {
452
446
  try {
453
447
  e = t.__h, t.__h = [], e.some(function(e) {
454
448
  e.call(t);
455
449
  });
456
450
  } catch (e) {
457
- N.__e(e, t.__v);
451
+ M.__e(e, t.__v);
458
452
  }
459
453
  });
460
454
  }
461
- function Re(e, t, n, r, i, a, o, s, c, l) {
462
- var u, d, f, p, m, h, g, _, v, y = n.props || _e, b = t.props, x = t.type;
455
+ function ze(e, t, n, r, i, a, o, s, c, l) {
456
+ var u, d, f, p, m, h, g, _, v, y = n.props || ve, b = t.props, x = t.type;
463
457
  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) {
464
458
  for (u = 0; u < a.length; u++) if ((m = a[u]) && (x ? m.localName == x : m.nodeType == 3)) {
465
459
  e = m, a[u] = null;
@@ -468,89 +462,88 @@ function Re(e, t, n, r, i, a, o, s, c, l) {
468
462
  }
469
463
  if (!e) {
470
464
  if (_ = l.ownerDocument || document, !x) return _.createTextNode(b);
471
- e = _.createElementNS(i, x, b.is && b), s &&= (N.__m && N.__m(t, a), !1), a = null;
465
+ e = _.createElementNS(i, x, b.is && b), s &&= (M.__m && M.__m(t, a), !1), a = null;
472
466
  }
473
467
  if (x) {
474
- if (l = x == "template" ? e.content : e, a = x == "textarea" && b.defaultValue != null ? null : a && xe.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
468
+ if (l = x == "template" && e.content || e, a = x == "textarea" && b.defaultValue != null ? null : a && Se.call(l.childNodes), !s && a) for (y = {}, u = 0; u < e.attributes.length; u++) y[(m = e.attributes[u]).name] = m.value;
475
469
  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 || Ne(e, u, null, m, i);
476
470
  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) || Ne(e, u, m, y[u], i);
477
- 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" && ye.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Oe(l, be(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && L(n, 0), s, c), a && a.some(Se)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || Ne(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && Ne(e, u, g, y[u], i));
471
+ 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" && be.test(x)) && (i = "http://www.w3.org/1999/xhtml"), Oe(l, xe(p) ? p : [p], t, n, r, i, a, o, a ? a[0] : n.__k && R(n, 0), s, c), a && a.some(I)), s && x != "textarea" || (u = "value", x == "progress" && h == null ? e.removeAttribute(u) : h == null || h === e[u] && (x != "progress" || h) || Ne(e, u, h, y[u], i), u = "checked", g != null && g != e[u] && Ne(e, u, g, y[u], i));
478
472
  } else y === b || s && e.data == b || (e.data = b);
479
473
  return e;
480
474
  }
481
- function ze(e, t, n, r) {
475
+ function Be(e, t, n, r) {
482
476
  try {
483
477
  typeof e == "function" ? t ? t.__x = e(t) || 1 : (r &&= r.__c || r.__e) && (t = r.__x) && (r.__x = null, typeof t == "function" ? t() : e(null)) : e.current = t;
484
478
  } catch (e) {
485
- N.__e(e, n);
479
+ M.__e(e, n);
486
480
  }
487
481
  }
488
- function Be(e, t, n) {
489
- var r, i;
490
- if (N.unmount && N.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || ze(r, null, t, e), r = e.__c) {
482
+ function Ve(e, t, n) {
483
+ var r, i, a, o;
484
+ if (M.unmount && M.unmount(e), !(r = e.ref) || r.current && r.current != e.__e || Be(r, null, t, e), r = e.__c) {
491
485
  if (r.componentWillUnmount) try {
492
486
  r.componentWillUnmount();
493
487
  } catch (e) {
494
- N.__e(e, t);
488
+ M.__e(e, t);
495
489
  }
496
490
  r.__P = r.__n = null;
497
491
  }
498
- if (r = e.__k) for (i = 0; i < r.length; i++) r[i] && Be(r[i], t, typeof e.type != "function" || n && !e.props.__P);
499
- (r = e.__e) && (n || Se(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
492
+ if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && Ve(r[o], t, typeof e.type != "function" || n && !e.props.__P);
493
+ !n && (r = e.__c) && (r = r.__z) && (i = Ie(r, a = [])) && (r == e.__e && a.some(I), I(i), I(r)), (r = e.__e) && (n || I(r), r.__e && (r.__e = null)), e.__e = e.__c = e.__ = null;
500
494
  }
501
- function Ve(e, t, n) {
495
+ function He(e, t, n) {
502
496
  return this.constructor(e, n);
503
497
  }
504
- function He(e, t) {
498
+ function Ue(e, t) {
505
499
  var n, r, i, a;
506
- N.__ && N.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = Ce(I, { children: [e] }), i = [], a = [], Fe(t, t.__k, r || _e, _e, t.namespaceURI, r ? null : t.firstChild ? xe.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Le(i, t.__k, a), t.__k.props.children = null;
500
+ M.__ && M.__(e, t), t.nodeType == 9 && (t = t.documentElement), r = (n = e && 32 & e.__u) ? null : t.__k, t.__k = Ce(L, { children: [e] }), i = [], a = [], Fe(t, t.__k, r || ve, ve, t.namespaceURI, r ? null : t.firstChild ? Se.call(t.childNodes) : null, i, r ? r.__e : t.firstChild, n, a), Re(i, t.__k, a), t.__k.props.children = null;
507
501
  }
508
- N = { __e: function(e, t, n, r) {
502
+ M = { __e: function(e, t, n, r) {
509
503
  for (var i, a, o; t = t.__;) if ((i = t.__c) && !(1 & i.__g)) {
510
504
  i.__g |= 4;
511
505
  try {
512
- if ((a = i.constructor) && a.getDerivedStateFromError && (i.setState(a.getDerivedStateFromError(e)), o = 8 & i.__g), i.componentDidCatch && (i.componentDidCatch(e, r || {}), o = 8 & i.__g), o) return void (i.__g |= 2);
506
+ if ((o = (a = i.constructor) && a.getDerivedStateFromError) && i.setState(a.getDerivedStateFromError(e)), i.componentDidCatch && (i.componentDidCatch(e, r || {}), o = 1), o && 8 & i.__g) return void (i.__g |= 2);
513
507
  } catch (t) {
514
- e = t, o = 0;
508
+ e = t;
515
509
  }
516
510
  }
517
- throw de = 0, e;
518
- } }, le = 0, we.prototype.setState = function(e, t) {
511
+ throw fe = 0, e;
512
+ } }, ue = 0, we.prototype.setState = function(e, t) {
519
513
  var n = this.__s;
520
514
  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), Ee(this)));
521
515
  }, we.prototype.forceUpdate = function(e) {
522
516
  this.__v && (this.__g |= 4, e && this.__h.push(e), Ee(this));
523
- }, we.prototype.render = I, P = [], de = 0, fe = function(e, t) {
517
+ }, we.prototype.render = L, N = [], fe = 0, pe = function(e, t) {
524
518
  return e.__v.__b - t.__v.__b;
525
- }, pe = Symbol(), me = /(PointerCapture)$|Capture$/i, he = 0, ge = {};
526
- //#endregion
527
- //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/hooks/dist/hooks.mjs
528
- var R, z, Ue, We, Ge = Object.is, Ke = 0, qe = [], Je = [], B = N, Ye = B.__b, Xe = B.__r, Ze = B.diffed, Qe = B.__c, $e = B.unmount, et = B.__;
529
- function tt(e, t) {
530
- B.__h && B.__h(z, e, Ke || t), Ke = 0;
531
- var n = z.__H || (z.__H = {
519
+ }, P = Symbol(), me = /(PointerCapture)$|Capture$/i, he = 0, ge = {};
520
+ // node_modules/.pnpm/preact@11.1.1/node_modules/preact/hooks/dist/hooks.mjs
521
+ var z, B, We, Ge, Ke = Object.is, qe = 0, Je = [], Ye = [], V = M, Xe = V.__b, Ze = V.__r, Qe = V.diffed, $e = V.__c, et = V.unmount, tt = V.__;
522
+ function nt(e, t) {
523
+ V.__h && V.__h(B, e, qe || t), qe = 0;
524
+ var n = B.__H || (B.__H = {
532
525
  __: [],
533
526
  __h: []
534
527
  });
535
528
  return e >= n.__.length && n.__.push({}), n.__[e];
536
529
  }
537
- function nt(e) {
538
- return Ke = 1, rt(ft, e);
530
+ function rt(e) {
531
+ return qe = 1, it(pt, e);
539
532
  }
540
- function rt(e, t, n) {
541
- var r = tt(R++, 2);
542
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ft(void 0, t), function(e) {
533
+ function it(e, t, n) {
534
+ var r = nt(z++, 2);
535
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : pt(void 0, t), function(e) {
543
536
  var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
544
- Ge(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
545
- }], r.__c = z, !z.__f)) {
546
- z.__f = !0;
547
- var i = z.shouldComponentUpdate;
548
- z.shouldComponentUpdate = function(e, t, n) {
537
+ Ke(t, n) || (r.__N = [n, r.__[1]], r.__c.setState({}));
538
+ }], r.__c = B, !B.__f)) {
539
+ B.__f = !0;
540
+ var i = B.shouldComponentUpdate;
541
+ B.shouldComponentUpdate = function(e, t, n) {
549
542
  var r = this.__H;
550
543
  if (!r) return !0;
551
544
  var a = !1, o = this.props != e;
552
545
  if (r.__.some(function(e) {
553
- e.__N && (a = !0, Ge(e.__[0], e.__N[0]) || (o = !0));
546
+ e.__N && (a = !0, Ke(e.__[0], e.__N[0]) || (o = !0));
554
547
  }), i) {
555
548
  var s = i.call(this, e, t, n);
556
549
  return a ? s || o : s;
@@ -560,71 +553,71 @@ function rt(e, t, n) {
560
553
  }
561
554
  return r.__;
562
555
  }
563
- function it(e, t) {
564
- var n = tt(R++, 3);
565
- !B.__s && dt(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, z.__H.__h.push(n));
556
+ function at(e, t) {
557
+ var n = nt(z++, 3);
558
+ !V.__s && ft(n.__H, t) && (n.__P = !0, n.__ = e, n.u = t, B.__H.__h.push(n));
566
559
  }
567
- function V(e, t) {
568
- var n = tt(R++, 4);
569
- !B.__s && dt(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, z.__h.push(n));
560
+ function H(e, t) {
561
+ var n = nt(z++, 4);
562
+ !V.__s && ft(n.__H, t) && (n.__P = !1, n.__ = e, n.u = t, B.__h.push(n));
570
563
  }
571
- function H(e) {
572
- return Ke = 5, at(function() {
564
+ function U(e) {
565
+ return qe = 5, ot(function() {
573
566
  return { current: e };
574
567
  }, []);
575
568
  }
576
- function at(e, t) {
577
- var n = tt(R++, 7);
578
- return dt(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
569
+ function ot(e, t) {
570
+ var n = nt(z++, 7);
571
+ return ft(n.__H, t) && (n.__ = e(), n.__H = t), n.__;
579
572
  }
580
- function ot() {
573
+ function st() {
581
574
  var e;
582
575
  do {
583
- for (; e = Je.shift();) try {
584
- U(e);
576
+ for (; e = Ye.shift();) try {
577
+ W(e);
585
578
  } catch (t) {
586
- B.__e(t, { __: (e = e.__P) && e.__v });
579
+ V.__e(t, { __: (e = e.__P) && e.__v });
587
580
  }
588
- for (; e = qe.shift();) {
581
+ for (; e = Je.shift();) {
589
582
  var t = e.__H;
590
583
  if (e.__P && t) try {
591
- t.__h.some(U), t.__h.some(ut), t.__h = [];
584
+ t.__h.some(W), t.__h.some(dt), t.__h = [];
592
585
  } catch (n) {
593
- t.__h = [], B.__e(n, e.__v);
586
+ t.__h = [], V.__e(n, e.__v);
594
587
  }
595
588
  }
596
- } while (Je.length);
597
- }
598
- B.__b = function(e) {
599
- z = null, Ye && Ye(e);
600
- }, B.__ = function(e, t) {
601
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), et && et(e, t);
602
- }, B.__r = function(e) {
603
- Xe && Xe(e), R = 0;
604
- var t = (z = e.__c).__H;
605
- t && (Ue == z ? z.__h = [] : (t.__h.some(U), t.__h.some(ut), R = 0), t.__h = [], t.__.some(function(e) {
589
+ } while (Ye.length);
590
+ }
591
+ V.__b = function(e) {
592
+ B = null, Xe && Xe(e);
593
+ }, V.__ = function(e, t) {
594
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), tt && tt(e, t);
595
+ }, V.__r = function(e) {
596
+ Ze && Ze(e), z = 0;
597
+ var t = (B = e.__c).__H;
598
+ t && (We == B ? B.__h = [] : (t.__h.some(W), t.__h.some(dt), z = 0), t.__h = [], t.__.some(function(e) {
606
599
  e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
607
- })), Ue = z;
608
- }, B.diffed = function(e) {
609
- Ze && Ze(e);
600
+ })), We = B;
601
+ }, V.diffed = function(e) {
602
+ Qe && Qe(e);
610
603
  var t = e.__c;
611
- t && t.__H && (t.__H.__h.length && lt(qe.push(t)), t.__H.__.some(function(e) {
604
+ t && t.__H && (t.__H.__h.length && ut(Je.push(t)), t.__H.__.some(function(e) {
612
605
  e.u && (e.__H = e.u);
613
- })), Ue = z = null;
614
- }, B.__c = function(e, t) {
606
+ })), We = B = null;
607
+ }, V.__c = function(e, t) {
615
608
  t.some(function(e) {
616
609
  try {
617
- e.__h.some(U), e.__h = e.__h.filter(function(e) {
618
- return !e.__ || ut(e);
610
+ e.__h.some(W), e.__h = e.__h.filter(function(e) {
611
+ return !e.__ || dt(e);
619
612
  });
620
- } catch (n) {
621
- t.some(function(e) {
622
- e.__h &&= [];
623
- }), t = [], B.__e(n, e.__v);
613
+ } catch (t) {
614
+ e.__h = [function() {
615
+ throw t;
616
+ }];
624
617
  }
625
- }), Qe && Qe(e, t);
626
- }, B.unmount = function(e) {
627
- $e && $e(e);
618
+ }), $e && $e(e, t);
619
+ }, V.unmount = function(e) {
620
+ et && et(e);
628
621
  var t, n, r = e.__c;
629
622
  r && r.__H && (r.__H.__.some(function(r) {
630
623
  try {
@@ -633,44 +626,43 @@ B.__b = function(e) {
633
626
  for (n = e.__; n && (!n.__c || !n.__c.__P);) n = n.__;
634
627
  n &&= n.__c;
635
628
  }
636
- r.__P = n, lt(Je.push(r));
637
- } else U(r);
629
+ r.__P = n, ut(Ye.push(r));
630
+ } else W(r);
638
631
  } catch (e) {
639
632
  t = e;
640
633
  }
641
- }), r.__H = void 0, t && B.__e(t, r.__v));
634
+ }), r.__H = void 0, t && V.__e(t, r.__v));
642
635
  };
643
- var st = typeof requestAnimationFrame == "function";
644
- function ct(e) {
636
+ var ct = typeof requestAnimationFrame == "function";
637
+ function lt(e) {
645
638
  var t, n = function() {
646
- clearTimeout(r), st && cancelAnimationFrame(t), setTimeout(e);
639
+ clearTimeout(r), ct && cancelAnimationFrame(t), setTimeout(e);
647
640
  }, r = setTimeout(n, 35);
648
- st && (t = requestAnimationFrame(n));
641
+ ct && (t = requestAnimationFrame(n));
649
642
  }
650
- function lt(e) {
651
- e != 1 && We == B.requestAnimationFrame || ((We = B.requestAnimationFrame) || ct)(ot);
643
+ function ut(e) {
644
+ e != 1 && Ge == V.requestAnimationFrame || ((Ge = V.requestAnimationFrame) || lt)(st);
652
645
  }
653
- function U(e) {
654
- var t = z, n = e.__c;
655
- typeof n == "function" && (e.__c = void 0, n()), z = t;
646
+ function W(e) {
647
+ var t = B, n = e.__c;
648
+ typeof n == "function" && (e.__c = void 0, n()), B = t;
656
649
  }
657
- function ut(e) {
658
- var t = z;
659
- e.__c = e.__(), z = t;
650
+ function dt(e) {
651
+ var t = B;
652
+ e.__c = e.__(), B = t;
660
653
  }
661
- function dt(e, t) {
654
+ function ft(e, t) {
662
655
  return !e || e.length != t.length || t.some(function(t, n) {
663
- return !Ge(t, e[n]);
656
+ return !Ke(t, e[n]);
664
657
  });
665
658
  }
666
- function ft(e, t) {
659
+ function pt(e, t) {
667
660
  return typeof t == "function" ? t(e) : t;
668
661
  }
669
- //#endregion
670
- //#region node_modules/.pnpm/preact@11.0.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
671
- var pt = 0;
662
+ // node_modules/.pnpm/preact@11.1.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
663
+ var mt = Symbol.for("pv"), ht = 0;
672
664
  Array.isArray;
673
- function W(e, t, n, r, i, a) {
665
+ function G(e, t, n, r, i, a) {
674
666
  t ||= {};
675
667
  var o, s, c = t;
676
668
  if ("ref" in c && typeof e != "function") for (s in c = {}, t) s == "ref" ? o = t[s] : c[s] = t[s];
@@ -684,17 +676,16 @@ function W(e, t, n, r, i, a) {
684
676
  __b: 0,
685
677
  __e: null,
686
678
  __c: null,
687
- constructor: void 0,
688
- __v: --pt,
679
+ constructor: mt,
680
+ __v: --ht,
689
681
  __i: -1,
690
682
  __u: 0
691
683
  };
692
- return (i || a) && (l.__source = i, l.__self = a), N.vnode && N.vnode(l), l;
684
+ return (i || a) && (l.__source = i, l.__self = a), M.vnode && M.vnode(l), l;
693
685
  }
694
- //#endregion
695
- //#region src/components/icons.tsx
696
- function G({ name: e, size: t, children: n }) {
697
- return /* @__PURE__ */ W("svg", {
686
+ // src/components/icons.tsx
687
+ function K({ name: e, size: t, children: n }) {
688
+ return /* @__PURE__ */ G("svg", {
698
689
  "data-icon": e,
699
690
  "aria-hidden": "true",
700
691
  focusable: "false",
@@ -709,83 +700,82 @@ function G({ name: e, size: t, children: n }) {
709
700
  children: n
710
701
  });
711
702
  }
712
- function mt({ size: e = 26 }) {
713
- return /* @__PURE__ */ W(G, {
703
+ function gt({ size: e = 26 }) {
704
+ return /* @__PURE__ */ G(K, {
714
705
  name: "chat",
715
706
  size: e,
716
- children: [/* @__PURE__ */ W("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__ */ W("path", {
707
+ 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", {
717
708
  d: "M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01",
718
709
  "stroke-width": "2.5"
719
710
  })]
720
711
  });
721
712
  }
722
- function ht({ size: e = 26 }) {
723
- return /* @__PURE__ */ W(G, {
713
+ function _t({ size: e = 26 }) {
714
+ return /* @__PURE__ */ G(K, {
724
715
  name: "message",
725
716
  size: e,
726
- children: /* @__PURE__ */ W("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" })
717
+ 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" })
727
718
  });
728
719
  }
729
- function gt({ size: e = 26 }) {
730
- return /* @__PURE__ */ W(G, {
720
+ function vt({ size: e = 26 }) {
721
+ return /* @__PURE__ */ G(K, {
731
722
  name: "sparkle",
732
723
  size: e,
733
- children: [/* @__PURE__ */ W("path", { d: "M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z" }), /* @__PURE__ */ W("path", { d: "M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z" })]
724
+ 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" })]
734
725
  });
735
726
  }
736
- function _t({ size: e = 26 }) {
737
- return /* @__PURE__ */ W(G, {
727
+ function yt({ size: e = 26 }) {
728
+ return /* @__PURE__ */ G(K, {
738
729
  name: "chevron-down",
739
730
  size: e,
740
- children: /* @__PURE__ */ W("path", { d: "M6 9l6 6 6-6" })
731
+ children: /* @__PURE__ */ G("path", { d: "M6 9l6 6 6-6" })
741
732
  });
742
733
  }
743
- function vt({ size: e = 18 }) {
744
- return /* @__PURE__ */ W(G, {
734
+ function bt({ size: e = 18 }) {
735
+ return /* @__PURE__ */ G(K, {
745
736
  name: "close",
746
737
  size: e,
747
- children: /* @__PURE__ */ W("path", { d: "M6 6l12 12M18 6L6 18" })
738
+ children: /* @__PURE__ */ G("path", { d: "M6 6l12 12M18 6L6 18" })
748
739
  });
749
740
  }
750
- var yt = "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";
751
- function bt({ size: e = 16 }) {
752
- return /* @__PURE__ */ W(G, {
741
+ var xt = "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";
742
+ function St({ size: e = 16 }) {
743
+ return /* @__PURE__ */ G(K, {
753
744
  name: "thumb-up",
754
745
  size: e,
755
- children: /* @__PURE__ */ W("path", { d: yt })
746
+ children: /* @__PURE__ */ G("path", { d: xt })
756
747
  });
757
748
  }
758
- function xt({ size: e = 16 }) {
759
- return /* @__PURE__ */ W(G, {
749
+ function Ct({ size: e = 16 }) {
750
+ return /* @__PURE__ */ G(K, {
760
751
  name: "thumb-down",
761
752
  size: e,
762
- children: /* @__PURE__ */ W("path", {
763
- d: yt,
753
+ children: /* @__PURE__ */ G("path", {
754
+ d: xt,
764
755
  transform: "matrix(1 0 0 -1 0 24)"
765
756
  })
766
757
  });
767
758
  }
768
- //#endregion
769
- //#region src/components/Launcher.tsx
770
- var St = {
771
- chat: mt,
772
- message: ht,
773
- sparkle: gt
774
- }, Ct = {
775
- "chevron-down": _t,
776
- close: vt
759
+ // src/components/Launcher.tsx
760
+ var wt = {
761
+ chat: gt,
762
+ message: _t,
763
+ sparkle: vt
764
+ }, Tt = {
765
+ "chevron-down": yt,
766
+ close: bt
777
767
  };
778
- function wt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
779
- let [l, u] = nt("loading"), [d, f] = nt("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = St[i] ?? mt, v = Ct[o] ?? _t;
780
- return /* @__PURE__ */ W("button", {
768
+ function Et({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl: a, openIcon: o = "chevron-down", buttonRef: s, text: c = e }) {
769
+ let [l, u] = rt("loading"), [d, f] = rt("loading"), p = r !== void 0 && l !== "failed", m = a !== void 0 && d !== "failed", h = p && !t && l === "loaded", g = m && t && d === "loaded", _ = wt[i] ?? gt, v = Tt[o] ?? yt;
770
+ return /* @__PURE__ */ G("button", {
781
771
  type: "button",
782
772
  class: "whoo-widget-launcher",
783
773
  onClick: n,
784
774
  "aria-label": t ? c.closeChat : c.openChat,
785
775
  ref: s,
786
776
  children: [
787
- t ? g ? null : /* @__PURE__ */ W(v, {}) : h ? null : /* @__PURE__ */ W(_, {}),
788
- p ? /* @__PURE__ */ W("img", {
777
+ t ? g ? null : /* @__PURE__ */ G(v, {}) : h ? null : /* @__PURE__ */ G(_, {}),
778
+ p ? /* @__PURE__ */ G("img", {
789
779
  class: "whoo-widget-launcher-icon-image",
790
780
  src: r,
791
781
  alt: "",
@@ -794,7 +784,7 @@ function wt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl:
794
784
  onLoad: () => u("loaded"),
795
785
  onError: () => u("failed")
796
786
  }) : null,
797
- m ? /* @__PURE__ */ W("img", {
787
+ m ? /* @__PURE__ */ G("img", {
798
788
  class: "whoo-widget-launcher-icon-image",
799
789
  src: a,
800
790
  alt: "",
@@ -806,9 +796,8 @@ function wt({ isOpen: t, onClick: n, iconUrl: r, icon: i = "chat", openIconUrl:
806
796
  ]
807
797
  });
808
798
  }
809
- //#endregion
810
- //#region src/i18n/index.ts
811
- var Tt = {
799
+ // src/i18n/index.ts
800
+ var Dt = {
812
801
  en: e,
813
802
  fr: {
814
803
  openChat: "Ouvrir le chat",
@@ -1130,45 +1119,45 @@ var Tt = {
1130
1119
  opensInNewTab: "(يُفتح في علامة تبويب جديدة)",
1131
1120
  agreeToNotice: "أوافق"
1132
1121
  }
1133
- }, Et = Object.freeze(Object.keys(Tt)), Dt = {
1122
+ }, Ot = Object.freeze(Object.keys(Dt)), kt = {
1134
1123
  pt: "pt-BR",
1135
1124
  es: "es-419",
1136
1125
  zh: "zh-Hans"
1137
- }, Ot = /* @__PURE__ */ new Set(["ar"]), kt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, At = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1138
- function jt(e) {
1139
- return Tt[e];
1126
+ }, At = /* @__PURE__ */ new Set(["ar"]), jt = /^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i, Mt = /^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;
1127
+ function Nt(e) {
1128
+ return Dt[e];
1140
1129
  }
1141
- function Mt(e) {
1130
+ function Pt(e) {
1142
1131
  let t = e.trim();
1143
- if (!kt.test(t) || At.test(t)) return null;
1132
+ if (!jt.test(t) || Mt.test(t)) return null;
1144
1133
  let n = t.split(/[-_]/)[0].toLowerCase();
1145
- return Object.hasOwn(Tt, n) ? n : null;
1134
+ return Object.hasOwn(Dt, n) ? n : null;
1146
1135
  }
1147
- function Nt(e, t) {
1136
+ function Ft(e, t) {
1148
1137
  let n = null;
1149
- return e != null && e !== "" && (n = typeof e == "string" ? Mt(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${Pt(e)} -- expected one of ${Et.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? Mt(t) : null, n ??= "en", {
1138
+ return e != null && e !== "" && (n = typeof e == "string" ? Pt(e) : null, n || console.warn(`whoo-aiden-widget: ignoring \`language\` ${It(e)} -- expected one of ${Ot.join(", ")} (or a regional tag like pt-BR). Using the page's language instead.`)), n ??= typeof t == "string" ? Pt(t) : null, n ??= "en", {
1150
1139
  language: n,
1151
- tag: Dt[n] ?? n,
1152
- dir: Ot.has(n) ? "rtl" : "ltr"
1140
+ tag: kt[n] ?? n,
1141
+ dir: At.has(n) ? "rtl" : "ltr"
1153
1142
  };
1154
1143
  }
1155
- function Pt(e) {
1144
+ function It(e) {
1156
1145
  return typeof e == "string" ? JSON.stringify(e) : `(a ${typeof e})`;
1157
1146
  }
1158
- function Ft(e) {
1147
+ function Lt(e) {
1159
1148
  if (typeof e != "string") return null;
1160
1149
  let t = e.trim().replace(/_/g, "-");
1161
- return kt.test(t) ? t : null;
1150
+ return jt.test(t) ? t : null;
1162
1151
  }
1163
- function It(e, t, n) {
1152
+ function Rt(e, t, n) {
1164
1153
  if (e != null && e !== "") {
1165
- let t = Ft(e);
1154
+ let t = Lt(e);
1166
1155
  if (t) return t;
1167
- console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Pt(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1156
+ console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${It(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`);
1168
1157
  }
1169
- return Ft(t) ?? Ft(n) ?? "";
1158
+ return Lt(t) ?? Lt(n) ?? "";
1170
1159
  }
1171
- function Lt(e) {
1160
+ function zt(e) {
1172
1161
  let t = e.indexOf("{name}");
1173
1162
  return t === -1 ? {
1174
1163
  before: e,
@@ -1180,24 +1169,23 @@ function Lt(e) {
1180
1169
  hasName: !0
1181
1170
  };
1182
1171
  }
1183
- function Rt(e, t) {
1172
+ function Bt(e, t) {
1184
1173
  return e.split("{name}").join(t.name);
1185
1174
  }
1186
- //#endregion
1187
- //#region src/viewport.ts
1188
- var zt = "(max-width: 400px), (max-height: 420px)", Bt = "data-fit-visible", Vt = 40;
1189
- function Ht(e) {
1175
+ // src/viewport.ts
1176
+ var Vt = "(max-width: 400px), (max-height: 420px)", Ht = "data-fit-visible", Ut = 40;
1177
+ function Wt(e) {
1190
1178
  let t = typeof window < "u" ? window.visualViewport : null;
1191
1179
  if (!t) return () => {};
1192
1180
  let n = () => {
1193
- e.removeAttribute(Bt), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1181
+ e.removeAttribute(Ht), e.style.removeProperty("--whoo-widget-visible-top"), e.style.removeProperty("--whoo-widget-visible-height");
1194
1182
  }, r = () => {
1195
1183
  let r = document.documentElement.clientHeight, i = Math.abs(t.scale - 1) > .01, a = r - t.height;
1196
- if (i || r === 0 || a < Vt) {
1184
+ if (i || r === 0 || a < Ut) {
1197
1185
  n();
1198
1186
  return;
1199
1187
  }
1200
- e.setAttribute(Bt, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1188
+ e.setAttribute(Ht, ""), e.style.setProperty("--whoo-widget-visible-top", `${Math.max(0, t.offsetTop)}px`), e.style.setProperty("--whoo-widget-visible-height", `${t.height}px`);
1201
1189
  let o = e.getRootNode().activeElement;
1202
1190
  o && e.contains(o) && typeof o.scrollIntoView == "function" && o.scrollIntoView({ block: "nearest" });
1203
1191
  };
@@ -1205,52 +1193,51 @@ function Ht(e) {
1205
1193
  t.removeEventListener("resize", r), t.removeEventListener("scroll", r), n();
1206
1194
  };
1207
1195
  }
1208
- function Ut(e, t) {
1196
+ function Gt(e, t) {
1209
1197
  return typeof e.addEventListener == "function" ? (e.addEventListener("change", t), () => e.removeEventListener("change", t)) : typeof e.addListener == "function" ? (e.addListener(t), () => e.removeListener(t)) : () => {};
1210
1198
  }
1211
- var Wt = 0, Gt = "";
1212
- function Kt() {
1213
- Wt++ === 0 && (Gt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1199
+ var Kt = 0, qt = "";
1200
+ function Jt() {
1201
+ Kt++ === 0 && (qt = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden");
1214
1202
  }
1215
- function qt() {
1216
- --Wt === 0 && (document.documentElement.style.overflow = Gt);
1203
+ function Yt() {
1204
+ --Kt === 0 && (document.documentElement.style.overflow = qt);
1217
1205
  }
1218
- function Jt() {
1206
+ function Xt() {
1219
1207
  if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
1220
- let e = window.matchMedia(zt), t = !1, n = () => {
1221
- e.matches && !t ? (t = !0, Kt()) : !e.matches && t && (t = !1, qt());
1208
+ let e = window.matchMedia(Vt), t = !1, n = () => {
1209
+ e.matches && !t ? (t = !0, Jt()) : !e.matches && t && (t = !1, Yt());
1222
1210
  };
1223
1211
  n();
1224
- let r = Ut(e, n);
1212
+ let r = Gt(e, n);
1225
1213
  return () => {
1226
- r(), t && (t = !1, qt());
1214
+ r(), t && (t = !1, Yt());
1227
1215
  };
1228
1216
  }
1229
- function Yt(e) {
1217
+ function Zt(e) {
1230
1218
  if (typeof window > "u" || typeof window.matchMedia != "function" || typeof e.showModal != "function") return () => {};
1231
- let t = window.matchMedia(zt), n = !1, r = () => {
1219
+ let t = window.matchMedia(Vt), n = !1, r = () => {
1232
1220
  if (t.matches === n || !e.isConnected) return;
1233
1221
  n = t.matches;
1234
1222
  let r = e.getRootNode().activeElement;
1235
1223
  e.close(), n ? e.showModal() : e.show(), r && e.contains(r) && r.focus({ preventScroll: !0 });
1236
1224
  };
1237
- return r(), Ut(t, r);
1225
+ return r(), Gt(t, r);
1238
1226
  }
1239
- //#endregion
1240
- //#region src/components/Composer.tsx
1241
- function Xt(e) {
1227
+ // src/components/Composer.tsx
1228
+ function Qt(e) {
1242
1229
  return e.isComposing || e.keyCode === 229;
1243
1230
  }
1244
- function Zt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1245
- return /* @__PURE__ */ W("div", {
1231
+ function $t({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text: o = e, contentLanguage: s }) {
1232
+ return /* @__PURE__ */ G("div", {
1246
1233
  class: "whoo-widget-composer",
1247
1234
  children: [
1248
- /* @__PURE__ */ W("label", {
1235
+ /* @__PURE__ */ G("label", {
1249
1236
  class: "whoo-widget-sr-only",
1250
1237
  for: "whoo-widget-composer-input",
1251
1238
  children: o.message
1252
1239
  }),
1253
- /* @__PURE__ */ W("input", {
1240
+ /* @__PURE__ */ G("input", {
1254
1241
  id: "whoo-widget-composer-input",
1255
1242
  class: "whoo-widget-composer-input",
1256
1243
  lang: s,
@@ -1262,10 +1249,10 @@ function Zt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1262
1249
  ref: a,
1263
1250
  onInput: (e) => n(e.target.value),
1264
1251
  onKeyDown: (e) => {
1265
- e.key === "Enter" && !Xt(e) && r();
1252
+ e.key === "Enter" && !Qt(e) && r();
1266
1253
  }
1267
1254
  }),
1268
- /* @__PURE__ */ W("button", {
1255
+ /* @__PURE__ */ G("button", {
1269
1256
  type: "button",
1270
1257
  class: "whoo-widget-composer-send",
1271
1258
  "aria-disabled": i,
@@ -1277,19 +1264,17 @@ function Zt({ value: t, onChange: n, onSend: r, disabled: i, inputRef: a, text:
1277
1264
  ]
1278
1265
  });
1279
1266
  }
1280
- //#endregion
1281
- //#region src/components/ErrorBanner.tsx
1282
- function Qt({ message: e }) {
1283
- return /* @__PURE__ */ W("div", {
1267
+ // src/components/ErrorBanner.tsx
1268
+ function en({ message: e }) {
1269
+ return /* @__PURE__ */ G("div", {
1284
1270
  class: "whoo-widget-error-banner",
1285
1271
  role: "alert",
1286
1272
  children: e
1287
1273
  });
1288
1274
  }
1289
- //#endregion
1290
- //#region src/markdown/tokenizer.ts
1291
- var K = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, $t = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, en = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, tn = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, nn = /[ \t]*[*+-][ \t]+/y, rn = /https?:\/\/\S+/y, an = /[.,;:!?)\]}>]+$/;
1292
- function on(e) {
1275
+ // src/markdown/tokenizer.ts
1276
+ var tn = /\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y, nn = /\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y, rn = /(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y, an = /\*([^*\s](?:[^*]*[^*\s])?)\*/y, on = /[ \t]*[*+-][ \t]+/y, sn = /https?:\/\/\S+/y, cn = /[.,;:!?)\]}>]+$/;
1277
+ function ln(e) {
1293
1278
  let t = [], n = 0, r = 0, i = (n) => {
1294
1279
  n > r && t.push({
1295
1280
  type: "text",
@@ -1299,13 +1284,13 @@ function on(e) {
1299
1284
  });
1300
1285
  };
1301
1286
  for (; n < e.length;) {
1302
- if ((n === 0 || e[n - 1] === "\n") && (nn.lastIndex = n, nn.exec(e))) {
1287
+ if ((n === 0 || e[n - 1] === "\n") && (on.lastIndex = n, on.exec(e))) {
1303
1288
  i(n), t.push({
1304
1289
  type: "text",
1305
1290
  value: "• ",
1306
1291
  start: n,
1307
- end: nn.lastIndex
1308
- }), n = nn.lastIndex, r = n;
1292
+ end: on.lastIndex
1293
+ }), n = on.lastIndex, r = n;
1309
1294
  continue;
1310
1295
  }
1311
1296
  if (e[n] === "!" && n + 1 < e.length && e[n + 1] === "[") {
@@ -1318,56 +1303,56 @@ function on(e) {
1318
1303
  }
1319
1304
  }
1320
1305
  if (e[n - 1] !== "!") {
1321
- K.lastIndex = n;
1322
- let a = K.exec(e);
1306
+ tn.lastIndex = n;
1307
+ let a = tn.exec(e);
1323
1308
  if (a) {
1324
1309
  i(n), t.push({
1325
1310
  type: "link",
1326
1311
  text: a[1],
1327
1312
  url: a[2],
1328
1313
  start: n,
1329
- end: K.lastIndex
1330
- }), n = K.lastIndex, r = n;
1314
+ end: tn.lastIndex
1315
+ }), n = tn.lastIndex, r = n;
1331
1316
  continue;
1332
1317
  }
1333
1318
  }
1334
- $t.lastIndex = n;
1335
- let a = $t.exec(e);
1319
+ nn.lastIndex = n;
1320
+ let a = nn.exec(e);
1336
1321
  if (a) {
1337
1322
  i(n), t.push({
1338
1323
  type: "bold",
1339
1324
  value: a[1],
1340
1325
  start: n,
1341
- end: $t.lastIndex
1342
- }), n = $t.lastIndex, r = n;
1326
+ end: nn.lastIndex
1327
+ }), n = nn.lastIndex, r = n;
1343
1328
  continue;
1344
1329
  }
1345
- en.lastIndex = n;
1346
- let o = en.exec(e);
1330
+ rn.lastIndex = n;
1331
+ let o = rn.exec(e);
1347
1332
  if (o) {
1348
1333
  i(n), t.push({
1349
1334
  type: "italic",
1350
1335
  value: o[1],
1351
1336
  start: n,
1352
- end: en.lastIndex
1353
- }), n = en.lastIndex, r = n;
1337
+ end: rn.lastIndex
1338
+ }), n = rn.lastIndex, r = n;
1354
1339
  continue;
1355
1340
  }
1356
- tn.lastIndex = n;
1357
- let s = tn.exec(e);
1341
+ an.lastIndex = n;
1342
+ let s = an.exec(e);
1358
1343
  if (s) {
1359
1344
  i(n), t.push({
1360
1345
  type: "italic",
1361
1346
  value: s[1],
1362
1347
  start: n,
1363
- end: tn.lastIndex
1364
- }), n = tn.lastIndex, r = n;
1348
+ end: an.lastIndex
1349
+ }), n = an.lastIndex, r = n;
1365
1350
  continue;
1366
1351
  }
1367
- rn.lastIndex = n;
1368
- let c = rn.exec(e);
1352
+ sn.lastIndex = n;
1353
+ let c = sn.exec(e);
1369
1354
  if (c) {
1370
- let e = c[0].match(an), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1355
+ let e = c[0].match(cn), a = e ? c[0].slice(0, c[0].length - e[0].length) : c[0];
1371
1356
  if (a.length > 0) {
1372
1357
  i(n), t.push({
1373
1358
  type: "link",
@@ -1383,14 +1368,13 @@ function on(e) {
1383
1368
  }
1384
1369
  return i(e.length), t;
1385
1370
  }
1386
- //#endregion
1387
- //#region src/markdown/render.tsx
1388
- var sn = /^[ \t]*[*+-][ \t]+(.*)$/, cn = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;
1389
- function ln(e) {
1371
+ // src/markdown/render.tsx
1372
+ var un = /^[ \t]*[*+-][ \t]+(.*)$/, dn = /[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;
1373
+ function fn(e) {
1390
1374
  let t = e.match(/\p{L}/u)?.[0];
1391
- if (t) return cn.test(t) ? "rtl" : "ltr";
1375
+ if (t) return dn.test(t) ? "rtl" : "ltr";
1392
1376
  }
1393
- function un(e) {
1377
+ function pn(e) {
1394
1378
  let t = [], n = [], r = [], i = () => {
1395
1379
  n.length > 0 && t.push({
1396
1380
  type: "text",
@@ -1403,7 +1387,7 @@ function un(e) {
1403
1387
  }), r = [];
1404
1388
  };
1405
1389
  for (let t of e.split("\n")) {
1406
- let e = t.match(sn);
1390
+ let e = t.match(un);
1407
1391
  e ? (i(), r.push(e[1])) : (a(), n.push(t));
1408
1392
  }
1409
1393
  return i(), a(), t.some((e) => e.type === "list") ? t.flatMap((e, n) => {
@@ -1416,15 +1400,15 @@ function un(e) {
1416
1400
  }) : null;
1417
1401
  }
1418
1402
  function q(e, t = {}) {
1419
- return on(e).map((e, n) => {
1403
+ return ln(e).map((e, n) => {
1420
1404
  switch (e.type) {
1421
- case "bold": return /* @__PURE__ */ W("strong", { children: q(e.value, t) }, n);
1422
- case "italic": return /* @__PURE__ */ W("em", { children: q(e.value, t) }, n);
1423
- case "link": return /* @__PURE__ */ W("a", {
1405
+ case "bold": return /* @__PURE__ */ G("strong", { children: q(e.value, t) }, n);
1406
+ case "italic": return /* @__PURE__ */ G("em", { children: q(e.value, t) }, n);
1407
+ case "link": return /* @__PURE__ */ G("a", {
1424
1408
  href: e.url,
1425
1409
  target: "_blank",
1426
1410
  rel: "noopener noreferrer",
1427
- children: [e.text, /* @__PURE__ */ W("span", {
1411
+ children: [e.text, /* @__PURE__ */ G("span", {
1428
1412
  class: "whoo-widget-sr-only",
1429
1413
  lang: t.linkCueLang,
1430
1414
  children: [" ", t.linkCue ?? "(opens in new tab)"]
@@ -1434,20 +1418,19 @@ function q(e, t = {}) {
1434
1418
  }
1435
1419
  });
1436
1420
  }
1437
- function dn(e, t = {}) {
1438
- let n = e.replace(/\r\n?/g, "\n"), r = un(n);
1439
- return r ? r.map((e, n) => e.type === "list" ? /* @__PURE__ */ W("ul", {
1421
+ function mn(e, t = {}) {
1422
+ let n = e.replace(/\r\n?/g, "\n"), r = pn(n);
1423
+ return r ? r.map((e, n) => e.type === "list" ? /* @__PURE__ */ G("ul", {
1440
1424
  class: "whoo-widget-list",
1441
- dir: ln(e.items.find((e) => ln(e)) ?? ""),
1442
- children: e.items.map((e, n) => /* @__PURE__ */ W("li", {
1443
- dir: ln(e),
1425
+ dir: fn(e.items.find((e) => fn(e)) ?? ""),
1426
+ children: e.items.map((e, n) => /* @__PURE__ */ G("li", {
1427
+ dir: fn(e),
1444
1428
  children: q(e, t)
1445
1429
  }, n))
1446
- }, n) : /* @__PURE__ */ W("span", { children: q(e.text, t) }, n)) : q(n, t);
1430
+ }, n) : /* @__PURE__ */ G("span", { children: q(e.text, t) }, n)) : q(n, t);
1447
1431
  }
1448
- //#endregion
1449
- //#region src/components/MessageFeedback.tsx
1450
- function fn(e) {
1432
+ // src/components/MessageFeedback.tsx
1433
+ function hn(e) {
1451
1434
  return [
1452
1435
  {
1453
1436
  value: "",
@@ -1471,9 +1454,9 @@ function fn(e) {
1471
1454
  }
1472
1455
  ];
1473
1456
  }
1474
- function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1475
- let u = t.correction ?? "", d = t.category ?? "", f = H(t.status), p = H(null), m = H(null);
1476
- if (V(() => {
1457
+ function gn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraftChange: a, onSubmitDetailed: o, onCancel: s, text: c = e, contentLanguage: l }) {
1458
+ let u = t.correction ?? "", d = t.category ?? "", f = U(t.status), p = U(null), m = U(null);
1459
+ if (H(() => {
1477
1460
  let e = f.current;
1478
1461
  if (f.current = t.status, e === t.status) return;
1479
1462
  if (t.status === "expanded") {
@@ -1488,13 +1471,13 @@ function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1488
1471
  if (!r) return;
1489
1472
  let i = r.getRootNode(), a = r.ownerDocument, o = i.activeElement;
1490
1473
  (o === null ? a.activeElement === null || a.activeElement === a.body : o === a.body) && r.focus();
1491
- }, [t.status, n]), t.status === "expanded") return /* @__PURE__ */ W("div", {
1474
+ }, [t.status, n]), t.status === "expanded") return /* @__PURE__ */ G("div", {
1492
1475
  class: "whoo-widget-feedback-form",
1493
1476
  children: [
1494
- /* @__PURE__ */ W("label", { children: [/* @__PURE__ */ W("span", {
1477
+ /* @__PURE__ */ G("label", { children: [/* @__PURE__ */ G("span", {
1495
1478
  class: "whoo-widget-sr-only",
1496
1479
  children: c.additionalFeedback
1497
- }), /* @__PURE__ */ W("textarea", {
1480
+ }), /* @__PURE__ */ G("textarea", {
1498
1481
  ref: p,
1499
1482
  class: "whoo-widget-feedback-textarea",
1500
1483
  lang: l,
@@ -1502,24 +1485,24 @@ function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1502
1485
  onInput: (e) => a(e.target.value, d),
1503
1486
  placeholder: c.feedbackPlaceholder
1504
1487
  })] }),
1505
- /* @__PURE__ */ W("select", {
1488
+ /* @__PURE__ */ G("select", {
1506
1489
  class: "whoo-widget-feedback-select",
1507
1490
  "aria-label": c.feedbackCategory,
1508
1491
  value: d,
1509
1492
  onChange: (e) => a(u, e.target.value),
1510
- children: fn(c).map((e) => /* @__PURE__ */ W("option", {
1493
+ children: hn(c).map((e) => /* @__PURE__ */ G("option", {
1511
1494
  value: e.value,
1512
1495
  children: e.label
1513
1496
  }, e.value))
1514
1497
  }),
1515
- /* @__PURE__ */ W("div", {
1498
+ /* @__PURE__ */ G("div", {
1516
1499
  class: "whoo-widget-feedback-form-buttons",
1517
- children: [/* @__PURE__ */ W("button", {
1500
+ children: [/* @__PURE__ */ G("button", {
1518
1501
  type: "button",
1519
1502
  class: "whoo-widget-feedback-submit",
1520
1503
  onClick: () => o(u, d),
1521
1504
  children: c.submit
1522
- }), /* @__PURE__ */ W("button", {
1505
+ }), /* @__PURE__ */ G("button", {
1523
1506
  type: "button",
1524
1507
  class: "whoo-widget-feedback-cancel",
1525
1508
  onClick: s,
@@ -1529,19 +1512,19 @@ function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1529
1512
  ]
1530
1513
  });
1531
1514
  let h = t.status === "submitting", g = t.status === "submitted";
1532
- return /* @__PURE__ */ W("div", {
1515
+ return /* @__PURE__ */ G("div", {
1533
1516
  class: "whoo-widget-feedback",
1534
- children: [g ? null : /* @__PURE__ */ W("div", {
1517
+ children: [g ? null : /* @__PURE__ */ G("div", {
1535
1518
  class: "whoo-widget-feedback-buttons",
1536
- children: [/* @__PURE__ */ W("button", {
1519
+ children: [/* @__PURE__ */ G("button", {
1537
1520
  type: "button",
1538
1521
  "aria-label": c.goodResponse,
1539
1522
  "aria-disabled": h,
1540
1523
  onClick: () => {
1541
1524
  h || r();
1542
1525
  },
1543
- children: /* @__PURE__ */ W(bt, {})
1544
- }), /* @__PURE__ */ W("button", {
1526
+ children: /* @__PURE__ */ G(St, {})
1527
+ }), /* @__PURE__ */ G("button", {
1545
1528
  ref: m,
1546
1529
  type: "button",
1547
1530
  "aria-label": c.badResponse,
@@ -1549,37 +1532,36 @@ function pn({ state: t, containerRef: n, onThumbsUp: r, onThumbsDown: i, onDraft
1549
1532
  onClick: () => {
1550
1533
  h || i();
1551
1534
  },
1552
- children: /* @__PURE__ */ W(xt, {})
1535
+ children: /* @__PURE__ */ G(Ct, {})
1553
1536
  })]
1554
- }), /* @__PURE__ */ W("div", {
1537
+ }), /* @__PURE__ */ G("div", {
1555
1538
  role: "status",
1556
1539
  class: g ? "whoo-widget-feedback-submitted" : t.status === "error" ? "whoo-widget-feedback-error" : void 0,
1557
1540
  children: g ? c.feedbackThanks : t.status === "error" ? c.feedbackFailed : null
1558
1541
  })]
1559
1542
  });
1560
1543
  }
1561
- //#endregion
1562
- //#region src/components/MessageList.tsx
1563
- function mn({ isSlowResponse: e, text: t }) {
1564
- return /* @__PURE__ */ W("div", {
1544
+ // src/components/MessageList.tsx
1545
+ function _n({ isSlowResponse: e, text: t }) {
1546
+ return /* @__PURE__ */ G("div", {
1565
1547
  class: "whoo-widget-pending",
1566
- children: [/* @__PURE__ */ W("span", {
1548
+ children: [/* @__PURE__ */ G("span", {
1567
1549
  class: "whoo-widget-typing",
1568
1550
  "aria-hidden": "true",
1569
1551
  children: [
1570
- /* @__PURE__ */ W("span", {}),
1571
- /* @__PURE__ */ W("span", {}),
1572
- /* @__PURE__ */ W("span", {})
1552
+ /* @__PURE__ */ G("span", {}),
1553
+ /* @__PURE__ */ G("span", {}),
1554
+ /* @__PURE__ */ G("span", {})
1573
1555
  ]
1574
- }), e ? /* @__PURE__ */ W("span", {
1556
+ }), e ? /* @__PURE__ */ G("span", {
1575
1557
  class: "whoo-widget-pending-text",
1576
1558
  children: t.lookingItUp
1577
1559
  }) : null]
1578
1560
  });
1579
1561
  }
1580
- function hn({ url: e, alt: t, lang: n }) {
1581
- let [r, i] = nt(!1);
1582
- return r ? null : /* @__PURE__ */ W("img", {
1562
+ function vn({ url: e, alt: t, lang: n }) {
1563
+ let [r, i] = rt(!1);
1564
+ return r ? null : /* @__PURE__ */ G("img", {
1583
1565
  class: "whoo-widget-empty-state-image",
1584
1566
  src: e,
1585
1567
  alt: t,
@@ -1588,48 +1570,48 @@ function hn({ url: e, alt: t, lang: n }) {
1588
1570
  onError: () => i(!0)
1589
1571
  });
1590
1572
  }
1591
- var gn = "whoo-widget-notice";
1592
- function _n({ notice: e, placement: t = "top", text: n, contentLanguage: r, languageTag: i }) {
1593
- return t === "footer" ? /* @__PURE__ */ W("div", {
1594
- id: gn,
1573
+ var yn = "whoo-widget-notice";
1574
+ function bn({ notice: e, placement: t = "top", text: n, contentLanguage: r, languageTag: i }) {
1575
+ return t === "footer" ? /* @__PURE__ */ G("div", {
1576
+ id: yn,
1595
1577
  class: "whoo-widget-notice-footer",
1596
1578
  role: "note",
1597
1579
  tabIndex: 0,
1598
- children: /* @__PURE__ */ W("div", {
1580
+ children: /* @__PURE__ */ G("div", {
1599
1581
  class: "whoo-widget-message-text",
1600
1582
  dir: "auto",
1601
1583
  lang: r,
1602
- children: dn(e, {
1584
+ children: mn(e, {
1603
1585
  linkCue: n.opensInNewTab,
1604
1586
  linkCueLang: i
1605
1587
  })
1606
1588
  })
1607
- }) : /* @__PURE__ */ W("div", {
1608
- id: gn,
1589
+ }) : /* @__PURE__ */ G("div", {
1590
+ id: yn,
1609
1591
  class: "whoo-widget-notice",
1610
1592
  role: "note",
1611
- children: /* @__PURE__ */ W("div", {
1593
+ children: /* @__PURE__ */ G("div", {
1612
1594
  class: "whoo-widget-message-text",
1613
1595
  dir: "auto",
1614
1596
  lang: r,
1615
- children: dn(e, {
1597
+ children: mn(e, {
1616
1598
  linkCue: n.opensInNewTab,
1617
1599
  linkCueLang: i
1618
1600
  })
1619
1601
  })
1620
1602
  });
1621
1603
  }
1622
- function vn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u, text: d, contentLanguage: f, languageTag: p }) {
1623
- let m = H(null), h = e.id;
1624
- return /* @__PURE__ */ W("div", {
1604
+ function xn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending: i, isSlowResponse: a, onThumbsUp: o, onThumbsDown: s, onDraftChange: c, onSubmitDetailed: l, onCancelFeedback: u, text: d, contentLanguage: f, languageTag: p }) {
1605
+ let m = U(null), h = e.id;
1606
+ return /* @__PURE__ */ G("div", {
1625
1607
  ref: m,
1626
1608
  tabIndex: -1,
1627
1609
  class: `whoo-widget-message whoo-widget-message--${e.role}`,
1628
1610
  children: [
1629
- /* @__PURE__ */ W("span", {
1611
+ /* @__PURE__ */ G("span", {
1630
1612
  class: "whoo-widget-sr-only",
1631
1613
  children: [
1632
- e.role === "assistant" ? /* @__PURE__ */ W("span", {
1614
+ e.role === "assistant" ? /* @__PURE__ */ G("span", {
1633
1615
  lang: f,
1634
1616
  children: t
1635
1617
  }) : t,
@@ -1637,19 +1619,19 @@ function vn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1637
1619
  " "
1638
1620
  ]
1639
1621
  }),
1640
- i ? /* @__PURE__ */ W(mn, {
1622
+ i ? /* @__PURE__ */ G(_n, {
1641
1623
  isSlowResponse: a,
1642
1624
  text: d
1643
- }) : /* @__PURE__ */ W("div", {
1625
+ }) : /* @__PURE__ */ G("div", {
1644
1626
  class: "whoo-widget-message-text",
1645
1627
  dir: "auto",
1646
1628
  lang: f,
1647
- children: dn(e.content, {
1629
+ children: mn(e.content, {
1648
1630
  linkCue: d.opensInNewTab,
1649
1631
  linkCueLang: p
1650
1632
  })
1651
1633
  }),
1652
- r && e.role === "assistant" && h ? /* @__PURE__ */ W(pn, {
1634
+ r && e.role === "assistant" && h ? /* @__PURE__ */ G(gn, {
1653
1635
  state: n,
1654
1636
  containerRef: m,
1655
1637
  onThumbsUp: () => o(h),
@@ -1663,9 +1645,9 @@ function vn({ message: e, speaker: t, feedbackState: n, showFeedback: r, pending
1663
1645
  ]
1664
1646
  });
1665
1647
  }
1666
- function yn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage: i, centerEmptyState: a = !1, centeredGreeting: o, notice: s, agentName: c = l, showFeedback: u = !1, isStreaming: d = !1, isSlowResponse: f = !1, onThumbsUp: p, onThumbsDown: m, onDraftChange: h = () => {}, onSubmitDetailed: g, onCancelFeedback: _, text: v = e, contentLanguage: y, languageTag: b, announcementIsContent: x = !1 }) {
1667
- let S = H(null), C = !!s && !t.some((e) => e.role === "user");
1668
- it(() => {
1648
+ function Sn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage: i, centerEmptyState: a = !1, centeredGreeting: o, notice: s, agentName: c = l, showFeedback: u = !1, isStreaming: d = !1, isSlowResponse: f = !1, onThumbsUp: p, onThumbsDown: m, onDraftChange: h = () => {}, onSubmitDetailed: g, onCancelFeedback: _, text: v = e, contentLanguage: y, languageTag: b, announcementIsContent: x = !1 }) {
1649
+ let S = U(null), C = !!s && !t.some((e) => e.role === "user");
1650
+ at(() => {
1669
1651
  let e = S.current;
1670
1652
  e && (e.scrollTop = C ? 0 : e.scrollHeight);
1671
1653
  }, [
@@ -1673,36 +1655,36 @@ function yn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1673
1655
  f,
1674
1656
  C
1675
1657
  ]);
1676
- let w = i ? /* @__PURE__ */ W(hn, {
1658
+ let w = i ? /* @__PURE__ */ G(vn, {
1677
1659
  ...i,
1678
1660
  lang: y
1679
1661
  }) : null, T = a && t.length === 0 && (i || o);
1680
- return /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W("section", {
1662
+ return /* @__PURE__ */ G(L, { children: [/* @__PURE__ */ G("section", {
1681
1663
  class: `whoo-widget-message-list${T ? " whoo-widget-message-list--centered" : ""}`,
1682
1664
  ref: S,
1683
1665
  "aria-label": v.conversation,
1684
1666
  tabIndex: 0,
1685
1667
  children: [
1686
1668
  a ? null : w,
1687
- s ? /* @__PURE__ */ W(_n, {
1669
+ s ? /* @__PURE__ */ G(bn, {
1688
1670
  notice: s,
1689
1671
  text: v,
1690
1672
  contentLanguage: y,
1691
1673
  languageTag: b
1692
1674
  }) : null,
1693
- T ? /* @__PURE__ */ W("div", {
1675
+ T ? /* @__PURE__ */ G("div", {
1694
1676
  class: "whoo-widget-empty-state",
1695
- children: [w, o ? /* @__PURE__ */ W("div", {
1677
+ children: [w, o ? /* @__PURE__ */ G("div", {
1696
1678
  class: "whoo-widget-empty-state-greeting whoo-widget-message-text",
1697
1679
  dir: "auto",
1698
1680
  lang: y,
1699
- children: dn(o, {
1681
+ children: mn(o, {
1700
1682
  linkCue: v.opensInNewTab,
1701
1683
  linkCueLang: b
1702
1684
  })
1703
1685
  }) : null]
1704
1686
  }) : null,
1705
- t.map((e, r) => /* @__PURE__ */ W(vn, {
1687
+ t.map((e, r) => /* @__PURE__ */ G(xn, {
1706
1688
  message: e,
1707
1689
  speaker: e.role === "user" ? v.you : c,
1708
1690
  showFeedback: u,
@@ -1719,7 +1701,7 @@ function yn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1719
1701
  languageTag: b
1720
1702
  }, e.id ?? r))
1721
1703
  ]
1722
- }), /* @__PURE__ */ W("div", {
1704
+ }), /* @__PURE__ */ G("div", {
1723
1705
  class: "whoo-widget-sr-only",
1724
1706
  role: "status",
1725
1707
  "aria-live": "polite",
@@ -1728,40 +1710,39 @@ function yn({ messages: t, messageFeedback: n, announcement: r, emptyStateImage:
1728
1710
  children: r ?? ""
1729
1711
  })] });
1730
1712
  }
1731
- //#endregion
1732
- //#region src/components/Panel.tsx
1733
- var bn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1734
- function xn(e) {
1735
- return Array.from(e.querySelectorAll(bn)).filter((e) => {
1713
+ // src/components/Panel.tsx
1714
+ var Cn = "button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
1715
+ function wn(e) {
1716
+ return Array.from(e.querySelectorAll(Cn)).filter((e) => {
1736
1717
  let t = getComputedStyle(e);
1737
1718
  return t.display !== "none" && t.visibility !== "hidden";
1738
1719
  });
1739
1720
  }
1740
- function Sn({ state: e, controller: t, greeting: n }) {
1741
- let r = H(null), i = H(null), a = H(null), o = H(!1);
1742
- V(() => {
1721
+ function Tn({ state: e, controller: t, greeting: n }) {
1722
+ let r = U(null), i = U(null), a = U(null), o = U(!1);
1723
+ H(() => {
1743
1724
  (a.current ?? i.current)?.focus();
1744
- }, []), V(() => {
1725
+ }, []), H(() => {
1745
1726
  e.noticeAgreed && o.current && (o.current = !1, i.current?.focus());
1746
- }, [e.noticeAgreed]), V(() => {
1747
- let e = r.current, n = e ? Ht(e) : () => {}, i = e ? Yt(e) : () => {}, a = () => {
1727
+ }, [e.noticeAgreed]), H(() => {
1728
+ let e = r.current, n = e ? Wt(e) : () => {}, i = e ? Zt(e) : () => {}, a = () => {
1748
1729
  e && !e.open && t.close();
1749
1730
  };
1750
1731
  e?.addEventListener("close", a);
1751
- let o = Jt();
1732
+ let o = Xt();
1752
1733
  return () => {
1753
1734
  n(), i(), e?.removeEventListener("close", a), o();
1754
1735
  };
1755
1736
  }, []);
1756
1737
  let s = (e) => {
1757
- if (e.key === "Escape" && !Xt(e)) {
1738
+ if (e.key === "Escape" && !Qt(e)) {
1758
1739
  e.preventDefault(), t.close();
1759
1740
  return;
1760
1741
  }
1761
1742
  if (e.key !== "Tab") return;
1762
1743
  let n = r.current;
1763
1744
  if (!n) return;
1764
- let i = xn(n);
1745
+ let i = wn(n);
1765
1746
  if (i.length === 0) return;
1766
1747
  let a = n.getRootNode().activeElement;
1767
1748
  e.preventDefault();
@@ -1775,7 +1756,7 @@ function Sn({ state: e, controller: t, greeting: n }) {
1775
1756
  }, c = () => {
1776
1757
  let n = e.draft.trim();
1777
1758
  n && !e.isStreaming && (t.setDraft(""), t.sendMessage(n));
1778
- }, l = t.resolvedAgentName, d = u(t.config.title), { before: f, after: p, hasName: m } = Lt(t.text.chatWith), h = t.greetingStyle === "centered", g = e.messages.length === 0 && n && !h ? [{
1759
+ }, l = t.resolvedAgentName, d = u(t.config.title), { before: f, after: p, hasName: m } = zt(t.text.chatWith), h = t.greetingStyle === "centered", g = e.messages.length === 0 && n && !h ? [{
1779
1760
  role: "assistant",
1780
1761
  content: n,
1781
1762
  id: null
@@ -1783,64 +1764,64 @@ function Sn({ state: e, controller: t, greeting: n }) {
1783
1764
  url: y,
1784
1765
  alt: t.emptyStateImageAlt
1785
1766
  } : void 0;
1786
- return /* @__PURE__ */ W("dialog", {
1767
+ return /* @__PURE__ */ G("dialog", {
1787
1768
  open: !0,
1788
1769
  class: "whoo-widget-panel",
1789
1770
  "aria-modal": "true",
1790
1771
  "aria-labelledby": "whoo-widget-title",
1791
- "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? gn : void 0,
1772
+ "aria-describedby": t.notice && e.noticeAgreed && e.messages.length === 0 ? yn : void 0,
1792
1773
  ref: r,
1793
1774
  onKeyDown: s,
1794
1775
  onCancel: (e) => {
1795
1776
  e.preventDefault(), t.close();
1796
1777
  },
1797
1778
  children: [
1798
- /* @__PURE__ */ W("div", {
1779
+ /* @__PURE__ */ G("div", {
1799
1780
  class: "whoo-widget-header",
1800
- children: [/* @__PURE__ */ W("div", {
1781
+ children: [/* @__PURE__ */ G("div", {
1801
1782
  class: "whoo-widget-header-titles",
1802
- children: [d ? /* @__PURE__ */ W("h2", {
1783
+ children: [d ? /* @__PURE__ */ G("h2", {
1803
1784
  id: "whoo-widget-title",
1804
1785
  class: "whoo-widget-header-title",
1805
1786
  lang: t.contentLanguage,
1806
1787
  dir: "auto",
1807
1788
  children: d
1808
- }) : /* @__PURE__ */ W("h2", {
1789
+ }) : /* @__PURE__ */ G("h2", {
1809
1790
  id: "whoo-widget-title",
1810
1791
  class: "whoo-widget-header-title",
1811
1792
  children: [
1812
1793
  f,
1813
- m ? /* @__PURE__ */ W("bdi", {
1794
+ m ? /* @__PURE__ */ G("bdi", {
1814
1795
  lang: t.contentLanguage,
1815
1796
  children: l
1816
1797
  }) : null,
1817
1798
  p
1818
1799
  ]
1819
- }), t.subtitle ? /* @__PURE__ */ W("p", {
1800
+ }), t.subtitle ? /* @__PURE__ */ G("p", {
1820
1801
  class: "whoo-widget-header-subtitle",
1821
1802
  lang: t.contentLanguage,
1822
1803
  dir: "auto",
1823
1804
  children: t.subtitle
1824
1805
  }) : null]
1825
- }), /* @__PURE__ */ W("div", {
1806
+ }), /* @__PURE__ */ G("div", {
1826
1807
  class: "whoo-widget-header-actions",
1827
- children: [e.messages.length > 0 && /* @__PURE__ */ W("button", {
1808
+ children: [e.messages.length > 0 && /* @__PURE__ */ G("button", {
1828
1809
  type: "button",
1829
1810
  class: "whoo-widget-header-reset",
1830
1811
  onClick: () => {
1831
1812
  t.resetConversation(), i.current?.focus();
1832
1813
  },
1833
1814
  children: t.text.newConversation
1834
- }), /* @__PURE__ */ W("button", {
1815
+ }), /* @__PURE__ */ G("button", {
1835
1816
  type: "button",
1836
1817
  class: "whoo-widget-header-close",
1837
1818
  "aria-label": t.text.closeChat,
1838
1819
  onClick: () => t.close(),
1839
- children: /* @__PURE__ */ W(vt, {})
1820
+ children: /* @__PURE__ */ G(bt, {})
1840
1821
  })]
1841
1822
  })]
1842
1823
  }),
1843
- /* @__PURE__ */ W(yn, {
1824
+ /* @__PURE__ */ G(Sn, {
1844
1825
  messages: g,
1845
1826
  messageFeedback: e.messageFeedback,
1846
1827
  announcement: e.announcement,
@@ -1862,8 +1843,8 @@ function Sn({ state: e, controller: t, greeting: n }) {
1862
1843
  languageTag: t.languageTag,
1863
1844
  announcementIsContent: e.announcementIsContent
1864
1845
  }),
1865
- e.runtimeError && /* @__PURE__ */ W(Qt, { message: e.runtimeError }),
1866
- e.noticeAgreed ? /* @__PURE__ */ W(Zt, {
1846
+ e.runtimeError && /* @__PURE__ */ G(en, { message: e.runtimeError }),
1847
+ e.noticeAgreed ? /* @__PURE__ */ G($t, {
1867
1848
  value: e.draft,
1868
1849
  onChange: (e) => t.setDraft(e),
1869
1850
  onSend: c,
@@ -1871,13 +1852,13 @@ function Sn({ state: e, controller: t, greeting: n }) {
1871
1852
  inputRef: i,
1872
1853
  text: t.text,
1873
1854
  contentLanguage: t.contentLanguage
1874
- }) : /* @__PURE__ */ W("div", {
1855
+ }) : /* @__PURE__ */ G("div", {
1875
1856
  class: "whoo-widget-agreement",
1876
- children: /* @__PURE__ */ W("button", {
1857
+ children: /* @__PURE__ */ G("button", {
1877
1858
  type: "button",
1878
1859
  class: "whoo-widget-agreement-button",
1879
1860
  ref: a,
1880
- "aria-describedby": gn,
1861
+ "aria-describedby": yn,
1881
1862
  autoFocus: !0,
1882
1863
  onClick: () => {
1883
1864
  o.current = !0, t.agreeToNotice();
@@ -1885,7 +1866,7 @@ function Sn({ state: e, controller: t, greeting: n }) {
1885
1866
  children: t.text.agreeToNotice
1886
1867
  })
1887
1868
  }),
1888
- v ? /* @__PURE__ */ W(_n, {
1869
+ v ? /* @__PURE__ */ G(bn, {
1889
1870
  notice: t.notice,
1890
1871
  placement: "footer",
1891
1872
  text: t.text,
@@ -1895,13 +1876,12 @@ function Sn({ state: e, controller: t, greeting: n }) {
1895
1876
  ]
1896
1877
  });
1897
1878
  }
1898
- //#endregion
1899
- //#region src/components/App.tsx
1900
- function Cn({ controller: e }) {
1901
- let [t, n] = nt(e.getState()), r = H(null), i = H(t.isOpen);
1902
- return it(() => (n(e.getState()), e.subscribe(n)), [e]), V(() => {
1879
+ // src/components/App.tsx
1880
+ function En({ controller: e }) {
1881
+ let [t, n] = rt(e.getState()), r = U(null), i = U(t.isOpen);
1882
+ return at(() => (n(e.getState()), e.subscribe(n)), [e]), H(() => {
1903
1883
  i.current && !t.isOpen && r.current?.focus(), i.current = t.isOpen;
1904
- }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ W(I, { children: [/* @__PURE__ */ W(wt, {
1884
+ }, [t.isOpen]), t.initError || t.isInitializing ? null : /* @__PURE__ */ G(L, { children: [/* @__PURE__ */ G(Et, {
1905
1885
  isOpen: t.isOpen,
1906
1886
  onClick: () => t.isOpen ? e.close() : e.open(),
1907
1887
  iconUrl: e.launcher.iconUrl,
@@ -1910,52 +1890,51 @@ function Cn({ controller: e }) {
1910
1890
  openIcon: e.launcher.openIcon,
1911
1891
  buttonRef: r,
1912
1892
  text: e.text
1913
- }), t.isOpen && /* @__PURE__ */ W(Sn, {
1893
+ }), t.isOpen && /* @__PURE__ */ G(Tn, {
1914
1894
  state: t,
1915
1895
  controller: e,
1916
1896
  greeting: e.config.greeting
1917
1897
  })] });
1918
1898
  }
1919
- //#endregion
1920
- //#region src/api/client.ts
1921
- var wn = class extends Error {
1899
+ // src/api/client.ts
1900
+ var Dn = class extends Error {
1922
1901
  status;
1923
1902
  constructor(e, t) {
1924
1903
  super(e), this.name = "WidgetApiError", this.status = t;
1925
1904
  }
1926
1905
  };
1927
- function Tn(e) {
1906
+ function On(e) {
1928
1907
  if (typeof e != "string") return null;
1929
1908
  let t = e.trim();
1930
1909
  return t === "" ? null : t;
1931
1910
  }
1932
- async function En(e, t) {
1911
+ async function kn(e, t) {
1933
1912
  let n = await fetch(`${e}/api/v1/widget/session`, {
1934
1913
  method: "POST",
1935
1914
  headers: { "Content-Type": "application/json" },
1936
1915
  body: JSON.stringify({ publishable_key: t })
1937
1916
  });
1938
- if (!n.ok) throw new wn(`Failed to create widget session (${n.status})`, n.status);
1917
+ if (!n.ok) throw new Dn(`Failed to create widget session (${n.status})`, n.status);
1939
1918
  let r = await n.json();
1940
1919
  return {
1941
1920
  token: r.token,
1942
- ...Dn(r)
1921
+ ...An(r)
1943
1922
  };
1944
1923
  }
1945
- function Dn(e) {
1924
+ function An(e) {
1946
1925
  return {
1947
- primaryColor: Tn(e.primary_color),
1948
- name: Tn(e.name),
1949
- accentColor: Tn(e.accent_color),
1950
- inkColor: Tn(e.ink_color)
1926
+ primaryColor: On(e.primary_color),
1927
+ name: On(e.name),
1928
+ accentColor: On(e.accent_color),
1929
+ inkColor: On(e.ink_color)
1951
1930
  };
1952
1931
  }
1953
- async function On(e, t) {
1932
+ async function jn(e, t) {
1954
1933
  let n = await fetch(`${e}/api/v1/widget/branding`, { headers: { Authorization: `Bearer ${t}` } });
1955
- if (!n.ok) throw new wn(`Failed to load widget branding (${n.status})`, n.status);
1956
- return Dn(await n.json());
1934
+ if (!n.ok) throw new Dn(`Failed to load widget branding (${n.status})`, n.status);
1935
+ return An(await n.json());
1957
1936
  }
1958
- async function kn(e, t, n) {
1937
+ async function Mn(e, t, n) {
1959
1938
  let r = await fetch(`${e}/api/v1/widget/feedback`, {
1960
1939
  method: "POST",
1961
1940
  headers: {
@@ -1969,11 +1948,10 @@ async function kn(e, t, n) {
1969
1948
  category: n.category ?? null
1970
1949
  })
1971
1950
  });
1972
- if (!r.ok) throw new wn(`Feedback submission failed (${r.status})`, r.status);
1951
+ if (!r.ok) throw new Dn(`Feedback submission failed (${r.status})`, r.status);
1973
1952
  }
1974
- //#endregion
1975
- //#region src/api/sse.ts
1976
- async function* An(e, t, n, r, i) {
1953
+ // src/api/sse.ts
1954
+ async function* Nn(e, t, n, r, i) {
1977
1955
  let a = await fetch(`${e}/api/v1/widget/chat`, {
1978
1956
  method: "POST",
1979
1957
  headers: {
@@ -1986,7 +1964,7 @@ async function* An(e, t, n, r, i) {
1986
1964
  }),
1987
1965
  signal: i
1988
1966
  });
1989
- if (!a.ok || !a.body) throw new wn(`Chat request failed (${a.status})`, a.status);
1967
+ if (!a.ok || !a.body) throw new Dn(`Chat request failed (${a.status})`, a.status);
1990
1968
  let o = a.body.getReader(), s = new TextDecoder(), c = "";
1991
1969
  for (;;) {
1992
1970
  let { done: e, value: t } = await o.read();
@@ -1998,11 +1976,11 @@ async function* An(e, t, n, r, i) {
1998
1976
  c = c.slice(n + 2);
1999
1977
  let t = e.split("\n").find((e) => e.startsWith("data: "));
2000
1978
  if (i?.aborted) return;
2001
- t && (yield jn(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
1979
+ t && (yield Pn(JSON.parse(t.slice(6)))), n = c.indexOf("\n\n");
2002
1980
  }
2003
1981
  }
2004
1982
  }
2005
- function jn(e) {
1983
+ function Pn(e) {
2006
1984
  return typeof e.error == "string" ? {
2007
1985
  type: "error",
2008
1986
  error: e.error,
@@ -2023,30 +2001,28 @@ function jn(e) {
2023
2001
  conversationId: e.conversation_id
2024
2002
  };
2025
2003
  }
2026
- //#endregion
2027
- //#region src/markdown/plainText.ts
2028
- function Mn(e) {
2029
- return on(e.replace(/\r\n?/g, "\n")).map((e) => {
2004
+ // src/markdown/plainText.ts
2005
+ function Fn(e) {
2006
+ return ln(e.replace(/\r\n?/g, "\n")).map((e) => {
2030
2007
  switch (e.type) {
2031
2008
  case "bold":
2032
- case "italic": return Mn(e.value);
2009
+ case "italic": return Fn(e.value);
2033
2010
  case "link": return e.text;
2034
2011
  default: return e.value;
2035
2012
  }
2036
2013
  }).join("");
2037
2014
  }
2038
- //#endregion
2039
- //#region src/markdown/reveal.ts
2040
- var Nn = 40, Pn = 120;
2041
- function Fn(e) {
2015
+ // src/markdown/reveal.ts
2016
+ var In = 40, Ln = 120;
2017
+ function Rn(e) {
2042
2018
  let t = [];
2043
- for (let n of on(e)) if (n.type === "text") {
2019
+ for (let n of ln(e)) if (n.type === "text") {
2044
2020
  let e = n.value.split(/(\s+)/), r = n.start;
2045
2021
  for (let n of e) r += n.length, n.trim().length > 0 && t.push(r);
2046
2022
  } else t.push(n.end);
2047
2023
  return t;
2048
2024
  }
2049
- function In(e) {
2025
+ function zn(e) {
2050
2026
  let t = null;
2051
2027
  return e?.addEventListener("abort", () => {
2052
2028
  t?.();
@@ -2061,14 +2037,13 @@ function In(e) {
2061
2037
  });
2062
2038
  };
2063
2039
  }
2064
- async function Ln(e, t, n) {
2065
- let r = n?.wordIntervalMs ?? Nn, i = n?.tokenIntervalMs ?? Pn, a = n?.signal, o = on(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = In(a), l = "";
2066
- for (let n of Fn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
2040
+ async function Bn(e, t, n) {
2041
+ let r = n?.wordIntervalMs ?? In, i = n?.tokenIntervalMs ?? Ln, a = n?.signal, o = ln(e), s = new Set(o.filter((e) => e.type !== "text").map((e) => e.end)), c = zn(a), l = "";
2042
+ for (let n of Rn(e)) if (a?.aborted || (l = e.slice(0, n), t(l), await c(s.has(n) ? i : r), a?.aborted)) return;
2067
2043
  l !== e && t(e);
2068
2044
  }
2069
- //#endregion
2070
- //#region src/sessionToken.ts
2071
- function Rn(e) {
2045
+ // src/sessionToken.ts
2046
+ function Vn(e) {
2072
2047
  let t = e.split(".");
2073
2048
  if (t.length !== 3 || t.some((e) => e === "")) return null;
2074
2049
  let n = t[1];
@@ -2082,60 +2057,58 @@ function Rn(e) {
2082
2057
  return null;
2083
2058
  }
2084
2059
  }
2085
- function zn(e) {
2086
- let t = Rn(e)?.exp;
2060
+ function Hn(e) {
2061
+ let t = Vn(e)?.exp;
2087
2062
  return typeof t == "number" ? t * 1e3 : null;
2088
2063
  }
2089
- function Bn(e, t = Date.now()) {
2090
- let n = zn(e);
2064
+ function Un(e, t = Date.now()) {
2065
+ let n = Hn(e);
2091
2066
  return n !== null && n <= t;
2092
2067
  }
2093
- function Vn(e, t = Date.now()) {
2094
- let n = Rn(e);
2068
+ function Wn(e, t = Date.now()) {
2069
+ let n = Vn(e);
2095
2070
  return n?.exp == null ? null : n.iat != null && n.exp > n.iat ? t + (n.exp - n.iat) * 1e3 : n.exp * 1e3;
2096
2071
  }
2097
- //#endregion
2098
- //#region src/storage.ts
2099
- function Hn(e) {
2072
+ // src/storage.ts
2073
+ function Gn(e) {
2100
2074
  return `whoo-aiden-widget:conversation:${e}`;
2101
2075
  }
2102
- function Un(e) {
2076
+ function Kn(e) {
2103
2077
  try {
2104
- return window.sessionStorage.getItem(Hn(e));
2078
+ return window.sessionStorage.getItem(Gn(e));
2105
2079
  } catch {
2106
2080
  return null;
2107
2081
  }
2108
2082
  }
2109
- function Wn(e, t) {
2083
+ function qn(e, t) {
2110
2084
  try {
2111
- window.sessionStorage.setItem(Hn(e), t);
2085
+ window.sessionStorage.setItem(Gn(e), t);
2112
2086
  } catch {}
2113
2087
  }
2114
- function Gn(e) {
2088
+ function Jn(e) {
2115
2089
  return `whoo-aiden-widget:notice-agreed:${e}`;
2116
2090
  }
2117
- function Kn(e, t) {
2091
+ function Yn(e, t) {
2118
2092
  try {
2119
- return window.sessionStorage.getItem(Gn(e)) === t;
2093
+ return window.sessionStorage.getItem(Jn(e)) === t;
2120
2094
  } catch {
2121
2095
  return !1;
2122
2096
  }
2123
2097
  }
2124
- function qn(e, t) {
2098
+ function Xn(e, t) {
2125
2099
  try {
2126
- window.sessionStorage.setItem(Gn(e), t);
2100
+ window.sessionStorage.setItem(Jn(e), t);
2127
2101
  } catch {}
2128
2102
  }
2129
- function Jn(e) {
2103
+ function Zn(e) {
2130
2104
  try {
2131
- window.sessionStorage.removeItem(Hn(e));
2105
+ window.sessionStorage.removeItem(Gn(e));
2132
2106
  } catch {}
2133
2107
  }
2134
- //#endregion
2135
- //#region src/theme.ts
2136
- var Yn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2137
- function Xn(e) {
2138
- if (Yn.test(e.trim())) return null;
2108
+ // src/theme.ts
2109
+ var Qn = /^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;
2110
+ function $n(e) {
2111
+ if (Qn.test(e.trim())) return null;
2139
2112
  let t = document.createElement("div");
2140
2113
  if (t.style.color = e, t.style.color === "") return null;
2141
2114
  let n = document.createElement("div");
@@ -2155,7 +2128,7 @@ function Xn(e) {
2155
2128
  };
2156
2129
  }
2157
2130
  function J(e) {
2158
- return Xn(e)?.rgb ?? null;
2131
+ return $n(e)?.rgb ?? null;
2159
2132
  }
2160
2133
  function Y([e, t, n]) {
2161
2134
  let r = (e) => {
@@ -2164,59 +2137,59 @@ function Y([e, t, n]) {
2164
2137
  };
2165
2138
  return .2126 * r(e) + .7152 * r(t) + .0722 * r(n);
2166
2139
  }
2167
- function Zn(e, t) {
2140
+ function er(e, t) {
2168
2141
  let n = Math.max(e, t), r = Math.min(e, t);
2169
2142
  return (n + .05) / (r + .05);
2170
2143
  }
2171
- function Qn(e) {
2144
+ function tr(e) {
2172
2145
  let t = J(e);
2173
2146
  if (!t) return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`), "#ffffff";
2174
2147
  let n = Y(t);
2175
- return Zn(n, Y([
2148
+ return er(n, Y([
2176
2149
  0,
2177
2150
  0,
2178
2151
  0
2179
- ])) >= Zn(n, Y([
2152
+ ])) >= er(n, Y([
2180
2153
  255,
2181
2154
  255,
2182
2155
  255
2183
2156
  ])) ? "#000000" : "#ffffff";
2184
2157
  }
2185
- function $n(e, t) {
2158
+ function nr(e, t) {
2186
2159
  let n = J(e), r = J(t);
2187
- return !n || !r ? NaN : Zn(Y(n), Y(r));
2160
+ return !n || !r ? NaN : er(Y(n), Y(r));
2188
2161
  }
2189
- var er = i.primary, tr = i.panel, nr = i.assistantBubble, rr = i.headerHover, ir = 4.5;
2190
- function ar([e, t, n]) {
2162
+ var rr = i.primary, ir = i.panel, ar = i.assistantBubble, or = i.headerHover, sr = 4.5;
2163
+ function cr([e, t, n]) {
2191
2164
  return `#${[
2192
2165
  e,
2193
2166
  t,
2194
2167
  n
2195
2168
  ].map((e) => e.toString(16).padStart(2, "0")).join("")}`;
2196
2169
  }
2197
- function or(e, t = tr) {
2170
+ function lr(e, t = ir) {
2198
2171
  let n = J(e), r = J(t);
2199
- if (!n || !r) return er;
2200
- let i = Y(r), a = (e) => Zn(Y(e), i) >= ir;
2201
- if (a(n)) return ar(n);
2172
+ if (!n || !r) return rr;
2173
+ let i = Y(r), a = (e) => er(Y(e), i) >= sr;
2174
+ if (a(n)) return cr(n);
2202
2175
  for (let e = .99; e > 0; e -= .01) {
2203
2176
  let t = n.map((t) => Math.round(t * e));
2204
- if (a(t)) return ar(t);
2177
+ if (a(t)) return cr(t);
2205
2178
  }
2206
2179
  return "#000000";
2207
2180
  }
2208
- var sr = i.ink, cr = i.link;
2181
+ var ur = i.ink, dr = i.link;
2209
2182
  function X(e) {
2210
2183
  if (typeof e != "string" || !e) return null;
2211
- let t = Xn(e);
2212
- return t ? ar(t.rgb) : null;
2184
+ let t = $n(e);
2185
+ return t ? cr(t.rgb) : null;
2213
2186
  }
2214
- function lr(e) {
2187
+ function fr(e) {
2215
2188
  if (typeof e != "string" || !e) return null;
2216
- let t = Xn(e);
2217
- return t ? t.translucent ? e.trim() : ar(t.rgb) : null;
2189
+ let t = $n(e);
2190
+ return t ? t.translucent ? e.trim() : cr(t.rgb) : null;
2218
2191
  }
2219
- var ur = [
2192
+ var pr = [
2220
2193
  {
2221
2194
  role: "onPrimary",
2222
2195
  against: ["primary"],
@@ -2269,7 +2242,7 @@ var ur = [
2269
2242
  }
2270
2243
  ];
2271
2244
  function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2272
- let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => lr(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? er, d = s("primaryText"), f = d ?? or(u, rr), p = s("onPrimary") ?? Qn(u), m = X(t), h = s("ink") ?? (m ? or(m, nr) : sr), g = X(n), _ = s("link") ?? (g ? or(g, nr) : cr), v = (e) => s(e) ?? i[e], y = {
2245
+ let o = typeof a == "object" && a && !Array.isArray(a) ? a : {}, s = (e) => fr(o[e]), c = X(e), l = s("primary"), u = l ?? c ?? rr, d = s("primaryText"), f = d ?? lr(u, or), p = s("onPrimary") ?? tr(u), m = X(t), h = s("ink") ?? (m ? lr(m, ar) : ur), g = X(n), _ = s("link") ?? (g ? lr(g, ar) : dr), v = (e) => s(e) ?? i[e], y = {
2273
2246
  primary: u,
2274
2247
  onPrimary: p,
2275
2248
  primaryText: f,
@@ -2287,9 +2260,9 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2287
2260
  inputBorder: v("inputBorder"),
2288
2261
  focusRing: v("focusRing")
2289
2262
  }, b = Object.fromEntries(r.map((e) => [e, s(e) !== null])), x = [];
2290
- for (let { role: e, against: t, required: n } of ur) for (let r of t) {
2263
+ for (let { role: e, against: t, required: n } of pr) for (let r of t) {
2291
2264
  if (!b[e] && !b[r]) continue;
2292
- let t = $n(y[e], y[r]);
2265
+ let t = nr(y[e], y[r]);
2293
2266
  Number.isFinite(t) && t < n && x.push({
2294
2267
  role: e,
2295
2268
  against: r,
@@ -2318,62 +2291,61 @@ function Z({ color: e, inkColor: t, accentColor: n, overrides: a }) {
2318
2291
  function Q(e) {
2319
2292
  return typeof e == "string" ? `"${e}"` : `a ${typeof e} value`;
2320
2293
  }
2321
- function dr(e, t, n = er) {
2294
+ function mr(e, t, n = rr) {
2322
2295
  let r = t;
2323
2296
  X(t) === null && (console.warn(`[whoo-aiden-widget] Could not use ${Q(t)} as the theme color; falling back to ${Q(n)}.`), r = n);
2324
2297
  let i = Z({ color: r });
2325
2298
  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);
2326
2299
  }
2327
- function fr(e, { inkColor: t, accentColor: n }) {
2300
+ function hr(e, { inkColor: t, accentColor: n }) {
2328
2301
  let r = Z({
2329
2302
  inkColor: t,
2330
2303
  accentColor: n
2331
2304
  });
2332
2305
  e.style.setProperty("--whoo-widget-ink", r.ink), e.style.setProperty("--whoo-widget-link-color", r.link);
2333
2306
  }
2334
- function pr(e, t) {
2307
+ function gr(e, t) {
2335
2308
  let n = Z({ overrides: t });
2336
2309
  for (let t of r) {
2337
2310
  let r = n.overridden.primary && (t === "onPrimary" || t === "primaryText");
2338
2311
  (n.overridden[t] || r) && e.style.setProperty(a[t], n.roles[t]);
2339
2312
  }
2340
2313
  }
2341
- function mr(e, t) {
2314
+ function _r(e, t) {
2342
2315
  e && X(e) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(e)} as the ${t}; using the default.`);
2343
2316
  }
2344
- function hr(e, t, n) {
2317
+ function vr(e, t, n) {
2345
2318
  for (let e of r) {
2346
2319
  let n = t[e];
2347
2320
  n && X(n) === null && console.warn(`[whoo-aiden-widget] Could not use ${Q(n)} as theme.colors.${e}; using the calculated color.`);
2348
2321
  }
2349
2322
  let i = t.primary;
2350
- typeof i == "string" && Xn(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.`), gr({
2323
+ typeof i == "string" && $n(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.`), yr({
2351
2324
  color: e.color,
2352
2325
  inkColor: e.inkColor,
2353
2326
  accentColor: e.accentColor,
2354
2327
  overrides: t
2355
2328
  }, n);
2356
2329
  }
2357
- function gr(e, t) {
2330
+ function yr(e, t) {
2358
2331
  for (let n of Z(e).contrastWarnings) {
2359
2332
  let { role: e, against: r, value: i, ratio: a, required: o, overridden: s } = n, c = `${e}|${r}|${i}`;
2360
2333
  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.`));
2361
2334
  }
2362
2335
  }
2363
- function _r(e, t, n = /* @__PURE__ */ new Set()) {
2364
- dr(e, t.color ?? er), mr(t.inkColor, "ink color"), mr(t.accentColor, "accent color"), fr(e, {
2336
+ function br(e, t, n = /* @__PURE__ */ new Set()) {
2337
+ mr(e, t.color ?? rr), _r(t.inkColor, "ink color"), _r(t.accentColor, "accent color"), hr(e, {
2365
2338
  inkColor: t.inkColor,
2366
2339
  accentColor: t.accentColor
2367
2340
  });
2368
- let r = ae(t.theme);
2369
- hr(t, r.colors, n), pr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2341
+ let r = se(t.theme);
2342
+ vr(t, r.colors, n), gr(e, r.colors), r.fontFamily && e.style.setProperty("--whoo-widget-font", r.fontFamily);
2370
2343
  }
2371
- //#endregion
2372
- //#region src/controller.ts
2373
- var vr = 8e3, yr = 3e3, br = 15e3, xr = class extends Error {
2344
+ // src/controller.ts
2345
+ var xr = 8e3, Sr = 3e3, Cr = 15e3, wr = class extends Error {
2374
2346
  name = "SessionUnavailableError";
2375
2347
  };
2376
- function Sr(e, t) {
2348
+ function Tr(e, t) {
2377
2349
  return t ? new Promise((n, r) => {
2378
2350
  let i = () => r(new DOMException("Aborted", "AbortError"));
2379
2351
  if (t.aborted) return i();
@@ -2384,23 +2356,23 @@ function Sr(e, t) {
2384
2356
  });
2385
2357
  }) : e;
2386
2358
  }
2387
- function Cr(e, t) {
2388
- return e === "refused" ? new Tr(t) : new xr();
2359
+ function Er(e, t) {
2360
+ return e === "refused" ? new Or(t) : new wr();
2389
2361
  }
2390
- function wr(e) {
2362
+ function Dr(e) {
2391
2363
  let t = e?.status;
2392
2364
  return t === 401 || t === 403 || t === 404;
2393
2365
  }
2394
- var Tr = class extends Error {
2366
+ var Or = class extends Error {
2395
2367
  name = "SessionExpiredError";
2396
2368
  constructor(e) {
2397
2369
  super(e instanceof Error ? e.message : "The session has expired.");
2398
2370
  }
2399
2371
  };
2400
- function Er(e) {
2372
+ function kr(e) {
2401
2373
  return e?.status === 401;
2402
2374
  }
2403
- function Dr(e, t) {
2375
+ function Ar(e, t) {
2404
2376
  return new Promise((n) => {
2405
2377
  let r = setTimeout(n, t);
2406
2378
  e.then(() => {
@@ -2408,7 +2380,7 @@ function Dr(e, t) {
2408
2380
  });
2409
2381
  });
2410
2382
  }
2411
- var Or = class {
2383
+ var jr = class {
2412
2384
  config;
2413
2385
  state;
2414
2386
  listeners = /* @__PURE__ */ new Set();
@@ -2441,14 +2413,14 @@ var Or = class {
2441
2413
  dir;
2442
2414
  constructor(e) {
2443
2415
  this.config = e;
2444
- let t = ae(e.theme).launcher, r = t.iconUrl ?? n(e.launcherIconUrl, "launcherIconUrl");
2416
+ let t = se(e.theme).launcher, r = t.iconUrl ?? n(e.launcherIconUrl, "launcherIconUrl");
2445
2417
  this.launcher = {
2446
2418
  ...t,
2447
2419
  ...r ? { iconUrl: r } : {}
2448
- }, this.launcherIconUrl = r, this.emptyStateImageUrl = n(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.notice = typeof e.notice == "string" && !d(e.notice) ? e.notice.trim() : "", this.requireNoticeAgreement = e.requireNoticeAgreement === !0 && this.notice !== "", e.requireNoticeAgreement === !0 && !this.notice && console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."), this.noticePlacement = k(e.noticePlacement), this.subtitle = typeof e.subtitle == "string" && !d(e.subtitle) ? e.subtitle.trim() : "", this.greetingStyle = O(e.greetingStyle), this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.getSessionToken = m(e);
2449
- let { language: i, tag: a, dir: o } = Nt(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2450
- this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = It(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2451
- ...jt(i),
2420
+ }, this.launcherIconUrl = r, this.emptyStateImageUrl = n(e.emptyStateImageUrl, "emptyStateImageUrl"), this.emptyStateImageAlt = typeof e.emptyStateImageAlt == "string" ? e.emptyStateImageAlt.trim() : "", this.notice = typeof e.notice == "string" && !d(e.notice) ? e.notice.trim() : "", this.requireNoticeAgreement = e.requireNoticeAgreement === !0 && this.notice !== "", e.requireNoticeAgreement === !0 && !this.notice && console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."), this.noticePlacement = ee(e.noticePlacement), this.subtitle = typeof e.subtitle == "string" && !d(e.subtitle) ? e.subtitle.trim() : "", this.greetingStyle = O(e.greetingStyle), this.showFeedback = e.showFeedback === !0, this.storageIdentifier = e.publishableKey ?? "session-token-mode", this.getSessionToken = m(e);
2421
+ let { language: i, tag: a, dir: o } = Ft(e.language, typeof document > "u" ? void 0 : document.documentElement.lang);
2422
+ this.language = i, this.languageTag = a, this.dir = o, this.contentLanguage = Rt(e.contentLanguage, typeof document > "u" ? void 0 : document.documentElement.lang, e.language), this.text = {
2423
+ ...Nt(i),
2452
2424
  ...b(e.messages)
2453
2425
  }, this.prefersReducedMotion = typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.state = {
2454
2426
  isOpen: !1,
@@ -2465,7 +2437,7 @@ var Or = class {
2465
2437
  announcement: null,
2466
2438
  announcementIsContent: !1,
2467
2439
  isSlowResponse: !1,
2468
- noticeAgreed: !this.requireNoticeAgreement || Kn(this.storageIdentifier, this.notice),
2440
+ noticeAgreed: !this.requireNoticeAgreement || Yn(this.storageIdentifier, this.notice),
2469
2441
  draft: ""
2470
2442
  };
2471
2443
  }
@@ -2511,12 +2483,12 @@ var Or = class {
2511
2483
  let e = this.config.apiBaseUrl ?? "https://api.aidenvoice.com";
2512
2484
  try {
2513
2485
  if (this.config.sessionToken) {
2514
- if (Bn(this.config.sessionToken)) {
2486
+ if (Un(this.config.sessionToken)) {
2515
2487
  if (!("token" in await this.renewToken())) throw Error("The sessionToken has expired.");
2516
- } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = zn(this.config.sessionToken);
2488
+ } else this.sessionToken = this.config.sessionToken, this.sessionTokenExpiresAt = Hn(this.config.sessionToken);
2517
2489
  } else if (this.config.publishableKey) {
2518
- let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await En(e, this.config.publishableKey);
2519
- this.sessionToken = t, this.sessionTokenExpiresAt = Vn(t), this.setState({
2490
+ let { token: t, primaryColor: n, name: r, accentColor: i, inkColor: a } = await kn(e, this.config.publishableKey);
2491
+ this.sessionToken = t, this.sessionTokenExpiresAt = Wn(t), this.setState({
2520
2492
  primaryColor: n,
2521
2493
  agentName: r,
2522
2494
  accentColor: i,
@@ -2527,13 +2499,13 @@ var Or = class {
2527
2499
  console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) });
2528
2500
  return;
2529
2501
  }
2530
- this.conversationId = Un(this.storageIdentifier), this.config.sessionToken && await Dr(this.loadBranding(e), yr);
2502
+ this.conversationId = Kn(this.storageIdentifier), this.config.sessionToken && await Ar(this.loadBranding(e), Sr);
2531
2503
  }
2532
2504
  async loadBranding(e) {
2533
2505
  try {
2534
2506
  let t = this.config;
2535
2507
  if (X(t.color) && X(t.inkColor) && X(t.accentColor) && u(t.name)) return;
2536
- let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => On(e, t));
2508
+ let { primaryColor: n, name: r, accentColor: i, inkColor: a } = await this.withSession((t) => jn(e, t));
2537
2509
  this.setState({
2538
2510
  primaryColor: n,
2539
2511
  agentName: r,
@@ -2542,14 +2514,14 @@ var Or = class {
2542
2514
  });
2543
2515
  } catch (e) {
2544
2516
  let t = e?.status;
2545
- (e instanceof Tr || t === 401 || t === 403) && (this.state.isInitializing ? (console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) })) : (console.error("[whoo-aiden-widget] the session was refused after start-up:", e), this.setState({ runtimeError: this.text.sessionExpired })));
2517
+ (e instanceof Or || t === 401 || t === 403) && (this.state.isInitializing ? (console.error("[whoo-aiden-widget] initialization failed:", e), this.setState({ initError: e instanceof Error ? e.message : String(e) })) : (console.error("[whoo-aiden-widget] the session was refused after start-up:", e), this.setState({ runtimeError: this.text.sessionExpired })));
2546
2518
  }
2547
2519
  }
2548
2520
  open() {
2549
2521
  this.setState({ isOpen: !0 });
2550
2522
  }
2551
2523
  resetConversation() {
2552
- this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, Jn(this.storageIdentifier), this.setState({
2524
+ this.sendEpoch += 1, this.activeRequestController?.abort("reset"), this.activeRequestController = null, this.clearSlowResponse(), this.conversationId = null, Zn(this.storageIdentifier), this.setState({
2553
2525
  messages: [],
2554
2526
  messageFeedback: {},
2555
2527
  runtimeError: null,
@@ -2557,7 +2529,7 @@ var Or = class {
2557
2529
  }), this.announce(this.text.conversationCleared);
2558
2530
  }
2559
2531
  agreeToNotice() {
2560
- this.state.noticeAgreed || (qn(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2532
+ this.state.noticeAgreed || (Xn(this.storageIdentifier, this.notice), this.setState({ noticeAgreed: !0 }));
2561
2533
  }
2562
2534
  setDraft(e) {
2563
2535
  this.setState({ draft: e });
@@ -2586,7 +2558,7 @@ var Or = class {
2586
2558
  ],
2587
2559
  isStreaming: !0,
2588
2560
  runtimeError: null
2589
- }), this.announce(Rt(this.text.messageSent, { name: this.resolvedAgentName }), !1, !0);
2561
+ }), this.announce(Bt(this.text.messageSent, { name: this.resolvedAgentName }), !1, !0);
2590
2562
  let o = a, s = (e) => {
2591
2563
  let t = o;
2592
2564
  o = {
@@ -2598,18 +2570,18 @@ var Or = class {
2598
2570
  let { signal: u } = l, d = !1;
2599
2571
  this.slowResponseTimer = setTimeout(() => {
2600
2572
  this.slowResponseTimer = null, this.setState({ isSlowResponse: !0 }), r() && this.announce(this.text.lookingItUp);
2601
- }, vr);
2573
+ }, xr);
2602
2574
  let f = !1, p = () => {
2603
2575
  this.state.draft === "" && (f = !0, this.setState({ draft: e }));
2604
2576
  }, m = !1, h = (e) => {
2605
- m = !0, this.announce(Mn(e), !0);
2577
+ m = !0, this.announce(Fn(e), !0);
2606
2578
  }, g = (e = this.text.genericError) => {
2607
2579
  r() && (m || (m = !0, this.announce(null)), this.setState({ runtimeError: e }), p());
2608
2580
  }, _ = "";
2609
2581
  try {
2610
2582
  let { stream: n, first: i } = await this.withSession(async (n) => {
2611
2583
  d = !0;
2612
- let r = An(t, n, this.conversationId, e, u);
2584
+ let r = Nn(t, n, this.conversationId, e, u);
2613
2585
  return {
2614
2586
  stream: r,
2615
2587
  first: await r.next()
@@ -2617,16 +2589,16 @@ var Or = class {
2617
2589
  }, u);
2618
2590
  for (let e = i; !e.done && !u.aborted && r(); e = await n.next()) {
2619
2591
  let t = e.value;
2620
- if (t.type === "conversation_id") this.conversationId = t.conversationId, Wn(this.storageIdentifier, t.conversationId);
2621
- else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Ln(t.delta, (e) => c(e), { signal: u }), _ = t.delta) : t.verbatim ? (_ = t.delta, c(_)) : (_ += t.delta, c(_));
2622
- else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, Wn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && h(_);
2592
+ if (t.type === "conversation_id") this.conversationId = t.conversationId, qn(this.storageIdentifier, t.conversationId);
2593
+ else if (t.type === "delta") this.clearSlowResponse(), t.verbatim && !this.prefersReducedMotion ? (await Bn(t.delta, (e) => c(e), { signal: u }), _ = t.delta) : t.verbatim ? (_ = t.delta, c(_)) : (_ += t.delta, c(_));
2594
+ else if (t.type === "done") t.conversationId && (this.conversationId = t.conversationId, qn(this.storageIdentifier, t.conversationId)), t.messageId && s({ id: t.messageId }), r() && h(_);
2623
2595
  else if (t.type === "error") {
2624
2596
  console.error("[whoo-aiden-widget] chat error:", t.error), _.trim() !== "" && r() && h(_), g(), l.abort();
2625
2597
  break;
2626
2598
  }
2627
2599
  }
2628
2600
  } catch (e) {
2629
- u.aborted ? u.reason === "close" && r() && !d && p() : e instanceof Tr ? (console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), g(this.text.sessionExpired)) : e instanceof xr ? (console.error("[whoo-aiden-widget] chat request failed: no session could be had."), g()) : (console.error("[whoo-aiden-widget] chat request failed:", e), g());
2601
+ u.aborted ? u.reason === "close" && r() && !d && p() : e instanceof Or ? (console.error("[whoo-aiden-widget] chat request failed: the session has expired.", e), g(this.text.sessionExpired)) : e instanceof wr ? (console.error("[whoo-aiden-widget] chat request failed: no session could be had."), g()) : (console.error("[whoo-aiden-widget] chat request failed:", e), g());
2630
2602
  } finally {
2631
2603
  let e = o.id === null && o.content.trim() === "", t = this.state.messages.filter((t) => !(e && t === o) && !(e && f && t === i)), n = t.length !== this.state.messages.length;
2632
2604
  r() ? (this.activeRequestController = null, this.clearSlowResponse(), m || (!u.aborted && _.trim() !== "" ? h(_) : this.announce(null)), this.setState({
@@ -2673,7 +2645,7 @@ var Or = class {
2673
2645
  }
2674
2646
  } });
2675
2647
  try {
2676
- await this.withSession((a) => kn(i, a, {
2648
+ await this.withSession((a) => Mn(i, a, {
2677
2649
  messageId: e,
2678
2650
  rating: t,
2679
2651
  correction: n,
@@ -2699,7 +2671,7 @@ var Or = class {
2699
2671
  }
2700
2672
  async currentToken(e) {
2701
2673
  let t = this.sessionToken, n = this.sessionTokenExpiresAt;
2702
- return t && (n === null || n - Date.now() > 6e4) ? { token: t } : Sr(this.renewToken(), e);
2674
+ return t && (n === null || n - Date.now() > 6e4) ? { token: t } : Tr(this.renewToken(), e);
2703
2675
  }
2704
2676
  renewToken() {
2705
2677
  return this.tokenRenewal ??= this.fetchNewToken().finally(() => {
@@ -2710,7 +2682,7 @@ var Or = class {
2710
2682
  let e = ++this.renewalGeneration, t, n = new Promise((e) => {
2711
2683
  t = setTimeout(() => {
2712
2684
  console.error("[whoo-aiden-widget] could not renew the session: it took too long."), e({ failure: "unavailable" });
2713
- }, br);
2685
+ }, Cr);
2714
2686
  });
2715
2687
  try {
2716
2688
  return await Promise.race([this.obtainToken(e), n]);
@@ -2721,73 +2693,71 @@ var Or = class {
2721
2693
  async obtainToken(e) {
2722
2694
  let t = this.config.apiBaseUrl ?? "https://api.aidenvoice.com", n;
2723
2695
  try {
2724
- if (this.config.publishableKey) n = (await En(t, this.config.publishableKey)).token;
2696
+ if (this.config.publishableKey) n = (await kn(t, this.config.publishableKey)).token;
2725
2697
  else if (this.getSessionToken) n = await this.getSessionToken();
2726
2698
  else return { failure: "refused" };
2727
2699
  } catch (e) {
2728
- return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && wr(e) ? "refused" : "unavailable" };
2700
+ return console.error("[whoo-aiden-widget] could not renew the session:", e), { failure: this.config.publishableKey && Dr(e) ? "refused" : "unavailable" };
2729
2701
  }
2730
- let r = typeof n == "string" ? Vn(n) : null;
2702
+ let r = typeof n == "string" ? Wn(n) : null;
2731
2703
  return typeof n != "string" || n === "" || r !== null && r <= Date.now() ? (console.error("[whoo-aiden-widget] could not renew the session: no usable token was returned."), { failure: "refused" }) : (e === this.renewalGeneration && (this.sessionToken = n, this.sessionTokenExpiresAt = r), { token: n });
2732
2704
  }
2733
2705
  async withSession(e, t) {
2734
2706
  let n = await this.currentToken(t);
2735
- if (!("token" in n)) throw Cr(n.failure);
2707
+ if (!("token" in n)) throw Er(n.failure);
2736
2708
  let { token: r } = n;
2737
2709
  try {
2738
2710
  return await e(r);
2739
2711
  } catch (n) {
2740
- if (!Er(n)) throw n;
2741
- let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await Sr(this.renewToken(), t);
2742
- if (!("token" in i)) throw Cr(i.failure, n);
2712
+ if (!kr(n)) throw n;
2713
+ let i = this.sessionToken && this.sessionToken !== r ? { token: this.sessionToken } : await Tr(this.renewToken(), t);
2714
+ if (!("token" in i)) throw Er(i.failure, n);
2743
2715
  try {
2744
2716
  return await e(i.token);
2745
2717
  } catch (e) {
2746
- throw Er(e) ? new Tr(e) : e;
2718
+ throw kr(e) ? new Or(e) : e;
2747
2719
  }
2748
2720
  }
2749
2721
  }
2750
- }, $ = 20, kr = 12, Ar = 300, jr = 352;
2751
- function Mr() {
2722
+ }, $ = 20, Mr = 12, Nr = 300, Pr = 352;
2723
+ function Fr() {
2752
2724
  try {
2753
2725
  return typeof CSS < "u" && CSS.supports?.("height", "100dvh") ? "dvh" : "vh";
2754
2726
  } catch {
2755
2727
  return "vh";
2756
2728
  }
2757
2729
  }
2758
- function Nr(e, t) {
2759
- let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o, cornerRadius: s } = ce(t.layout), c = (e) => typeof t.layout?.offset?.[e] == "number";
2730
+ function Ir(e, t) {
2731
+ let { offsetX: n, offsetY: r, launcherSize: i, panelWidth: a, panelHeight: o, cornerRadius: s } = le(t.layout), c = (e) => typeof t.layout?.offset?.[e] == "number";
2760
2732
  if (typeof window < "u" && window.innerWidth > 0 && window.innerHeight > 0) {
2761
- let e = Math.max($, window.innerWidth - Ar), t = Math.max($, window.innerHeight - i - jr);
2733
+ let e = Math.max($, window.innerWidth - Nr), t = Math.max($, window.innerHeight - i - Pr);
2762
2734
  c("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.`), c("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.`);
2763
2735
  }
2764
- let l = `100${Mr()}`, u = `min(${n}px, max(${$}px, calc(100vw - ${Ar}px)), calc(100vw - ${i}px))`, d = `min(${r}px, max(${$}px, calc(${l} - ${i + jr}px)), calc(${l} - ${i}px))`, f = `calc(${d} + ${i}px + ${kr}px)`, p = t.position === "bottom-left", m = (t, n) => e.style.setProperty(t, n);
2736
+ let l = `100${Fr()}`, u = `min(${n}px, max(${$}px, calc(100vw - ${Nr}px)), calc(100vw - ${i}px))`, d = `min(${r}px, max(${$}px, calc(${l} - ${i + Pr}px)), calc(${l} - ${i}px))`, f = `calc(${d} + ${i}px + ${Mr}px)`, p = t.position === "bottom-left", m = (t, n) => e.style.setProperty(t, n);
2765
2737
  m("--whoo-widget-inset-left", p ? u : "auto"), m("--whoo-widget-inset-right", p ? "auto" : u), m("--whoo-widget-inset-bottom", d), m("--whoo-widget-launcher-size", `${i}px`), m("--whoo-widget-panel-bottom", f), m("--whoo-widget-panel-width", `${a}px`), m("--whoo-widget-panel-height", `${o}px`), m("--whoo-widget-panel-max-width", `calc(100vw - ${u} - ${$}px)`), m("--whoo-widget-panel-max-height", `calc(${l} - ${f} - ${$}px)`), s === void 0 ? e.style.removeProperty("--whoo-widget-corner-radius") : m("--whoo-widget-corner-radius", `${s}px`);
2766
2738
  }
2767
- //#endregion
2768
- //#region src/styles.css?inline
2769
- var Pr = ":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);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@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-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start: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}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start: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:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer: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-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[aria-disabled=true]{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;unicode-bidi:plaintext;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}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-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
2770
- //#endregion
2771
- //#region src/mount.tsx
2772
- function Fr(e) {
2739
+ // src/styles.css?inline
2740
+ var Lr = ":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);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@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-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start: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}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start: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:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer: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-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[aria-disabled=true]{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;unicode-bidi:plaintext;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}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-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}";
2741
+ // src/mount.tsx
2742
+ function Rr(e) {
2773
2743
  let t = document.createElement("div");
2774
2744
  t.id = "whoo-aiden-widget-host", t.style.position = "relative", t.style.zIndex = String(c(e.zIndex));
2775
2745
  let n = t.attachShadow({ mode: "open" }), r = document.createElement("style");
2776
- r.textContent = Pr, n.appendChild(r);
2746
+ r.textContent = Lr, n.appendChild(r);
2777
2747
  let i = document.createElement("div");
2778
2748
  n.appendChild(i);
2779
2749
  let a = /* @__PURE__ */ new Set();
2780
- _r(i, e, a), Nr(i, e);
2781
- let o = new Or(e);
2750
+ br(i, e, a), Ir(i, e);
2751
+ let o = new jr(e);
2782
2752
  i.setAttribute("lang", o.languageTag), i.setAttribute("dir", o.dir);
2783
- let s = X(e.color) !== null, l = null, u = "", d = ae(e.theme).colors, f = Object.keys(d).length > 0, p = {
2753
+ let s = X(e.color) !== null, l = null, u = "", d = se(e.theme).colors, f = Object.keys(d).length > 0, p = {
2784
2754
  color: e.color,
2785
2755
  inkColor: e.inkColor,
2786
2756
  accentColor: e.accentColor
2787
2757
  };
2788
2758
  return o.subscribe((t) => {
2789
2759
  let n = !1;
2790
- !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, dr(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
2760
+ !s && t.primaryColor && t.primaryColor !== l && (l = t.primaryColor, mr(i, t.primaryColor, e.color), X(t.primaryColor) && (p = {
2791
2761
  ...p,
2792
2762
  color: t.primaryColor
2793
2763
  }), n = !0);
@@ -2795,7 +2765,7 @@ function Fr(e) {
2795
2765
  if ((t.inkColor || t.accentColor) && r !== u) {
2796
2766
  u = r;
2797
2767
  let a = X(e.inkColor) ? e.inkColor : t.inkColor, o = X(e.accentColor) ? e.accentColor : t.accentColor;
2798
- fr(i, {
2768
+ hr(i, {
2799
2769
  inkColor: a,
2800
2770
  accentColor: o
2801
2771
  }), p = {
@@ -2804,18 +2774,16 @@ function Fr(e) {
2804
2774
  accentColor: o
2805
2775
  }, n = !0;
2806
2776
  }
2807
- n && (pr(i, d), f && gr({
2777
+ n && (gr(i, d), f && yr({
2808
2778
  ...p,
2809
2779
  overrides: d
2810
2780
  }, a));
2811
- }), o.init(), He(/* @__PURE__ */ W(Cn, { controller: o }), i), document.body.appendChild(t), { unmount() {
2812
- He(null, i), t.remove();
2781
+ }), o.init(), Ue(/* @__PURE__ */ G(En, { controller: o }), i), document.body.appendChild(t), { unmount() {
2782
+ Ue(null, i), t.remove();
2813
2783
  } };
2814
2784
  }
2815
- //#endregion
2816
- //#region src/index.ts
2817
- function Ir(e) {
2818
- return f(e), Fr(e);
2785
+ // src/index.ts
2786
+ function zr(e) {
2787
+ return f(e), Rr(e);
2819
2788
  }
2820
- //#endregion
2821
- export { Et as SUPPORTED_LANGUAGES, Ir as init, Z as resolveTheme };
2789
+ export { Ot as SUPPORTED_LANGUAGES, zr as init, Z as resolveTheme };