@usereq/widget 1.0.0-experimental.0 → 1.0.0-experimental.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/embed.mjs CHANGED
@@ -1,4 +1,4 @@
1
- async function Vt(e) {
1
+ async function tn(e) {
2
2
  const t = e.getReader(), n = new TextDecoder();
3
3
  let r = "", o = "";
4
4
  const i = [], a = /* @__PURE__ */ new Map(), u = (d) => {
@@ -20,8 +20,8 @@ async function Vt(e) {
20
20
  break;
21
21
  case "text-delta":
22
22
  if ("id" in f && "delta" in f) {
23
- var p;
24
- a.set(f.id, ((p = a.get(f.id)) !== null && p !== void 0 ? p : "") + f.delta);
23
+ var h;
24
+ a.set(f.id, ((h = a.get(f.id)) !== null && h !== void 0 ? h : "") + f.delta);
25
25
  }
26
26
  break;
27
27
  case "error":
@@ -47,42 +47,42 @@ async function Vt(e) {
47
47
  })
48
48
  };
49
49
  }
50
- function Z(e) {
50
+ function re(e) {
51
51
  "@babel/helpers - typeof";
52
- return Z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
52
+ return re = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
53
53
  return typeof t;
54
54
  } : function(t) {
55
55
  return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
56
- }, Z(e);
56
+ }, re(e);
57
57
  }
58
- function Kt(e, t) {
59
- if (Z(e) != "object" || !e) return e;
58
+ function nn(e, t) {
59
+ if (re(e) != "object" || !e) return e;
60
60
  var n = e[Symbol.toPrimitive];
61
61
  if (n !== void 0) {
62
62
  var r = n.call(e, t || "default");
63
- if (Z(r) != "object") return r;
63
+ if (re(r) != "object") return r;
64
64
  throw new TypeError("@@toPrimitive must return a primitive value.");
65
65
  }
66
66
  return (t === "string" ? String : Number)(e);
67
67
  }
68
- function Xt(e) {
69
- var t = Kt(e, "string");
70
- return Z(t) == "symbol" ? t : t + "";
68
+ function rn(e) {
69
+ var t = nn(e, "string");
70
+ return re(t) == "symbol" ? t : t + "";
71
71
  }
72
- function Ee(e, t, n) {
73
- return (t = Xt(t)) in e ? Object.defineProperty(e, t, {
72
+ function je(e, t, n) {
73
+ return (t = rn(t)) in e ? Object.defineProperty(e, t, {
74
74
  value: n,
75
75
  enumerable: !0,
76
76
  configurable: !0,
77
77
  writable: !0
78
78
  }) : e[t] = n, e;
79
79
  }
80
- var ce = class extends Error {
80
+ var V = class extends Error {
81
81
  constructor(e, t, n) {
82
- super(n), Ee(this, "status", void 0), Ee(this, "code", void 0), this.status = e, this.code = t;
82
+ super(n), je(this, "status", void 0), je(this, "code", void 0), this.status = e, this.code = t;
83
83
  }
84
84
  };
85
- async function Pe(e) {
85
+ async function se(e) {
86
86
  let t = "request_failed", n = `The request failed (${e.status}).`;
87
87
  try {
88
88
  var r, o;
@@ -90,9 +90,9 @@ async function Pe(e) {
90
90
  !((r = i.error) === null || r === void 0) && r.code && (t = i.error.code), !((o = i.error) === null || o === void 0) && o.message && (n = i.error.message);
91
91
  } catch {
92
92
  }
93
- throw new ce(e.status, t, n);
93
+ throw new V(e.status, t, n);
94
94
  }
95
- var Fe = (e, t = {}) => ({
95
+ var Le = (e, t = {}) => ({
96
96
  method: "POST",
97
97
  headers: {
98
98
  "Content-Type": "application/json",
@@ -100,17 +100,29 @@ var Fe = (e, t = {}) => ({
100
100
  },
101
101
  body: JSON.stringify(e)
102
102
  });
103
- async function Jt(e, t, n) {
103
+ async function on(e, t, n) {
104
104
  const r = await fetch(`${e.base}/api/embed/${t}/${n}`);
105
- return r.ok ? r.json() : Pe(r);
105
+ return r.ok ? r.json() : se(r);
106
+ }
107
+ async function sn(e, t) {
108
+ const n = await fetch(`${e.base}/api/embed/sessions`, Le(t));
109
+ return n.ok ? n.json() : se(n);
106
110
  }
107
- async function Zt(e, t) {
108
- const n = await fetch(`${e.base}/api/embed/sessions`, Fe(t));
109
- return n.ok ? n.json() : Pe(n);
111
+ var Ne = (e) => ({ Authorization: `Bearer ${e}` });
112
+ async function an(e, t) {
113
+ const n = await fetch(`${e.base}/api/embed/sessions/current`, { headers: Ne(t) });
114
+ return n.ok ? n.json() : se(n);
110
115
  }
111
- async function Qt(e, t, n, r, o) {
116
+ async function ln(e, t) {
117
+ const n = await fetch(`${e.base}/api/embed/sessions/current/end`, {
118
+ method: "POST",
119
+ headers: Ne(t)
120
+ });
121
+ return n.ok ? n.json() : se(n);
122
+ }
123
+ async function cn(e, t, n, r, o) {
112
124
  const i = await fetch(`${e.base}/api/embed/chat`, {
113
- ...Fe({
125
+ ...Le({
114
126
  message: {
115
127
  id: n.id,
116
128
  role: "user",
@@ -120,15 +132,15 @@ async function Qt(e, t, n, r, o) {
120
132
  }]
121
133
  },
122
134
  trigger: r
123
- }, { Authorization: `Bearer ${t}` }),
135
+ }, Ne(t)),
124
136
  signal: o
125
137
  });
126
- return !i.ok || !i.body ? Pe(i) : Vt(i.body);
138
+ return !i.ok || !i.body ? se(i) : tn(i.body);
127
139
  }
128
- async function en(e, t) {
140
+ async function un(e, t) {
129
141
  try {
130
142
  const n = await fetch(`${e.base}/api/embed/events`, {
131
- ...Fe(t),
143
+ ...Le(t),
132
144
  keepalive: !0
133
145
  });
134
146
  return n.ok ? await n.json() : null;
@@ -136,31 +148,31 @@ async function en(e, t) {
136
148
  return null;
137
149
  }
138
150
  }
139
- var O = (e) => typeof e == "object" && e !== null;
140
- function _t(e) {
141
- return O(e) && typeof e.id == "string" && O(e.config) && typeof e.config.type == "string" && O(e.config.appearance) && Array.isArray(e.rules);
151
+ var X = (e) => typeof e == "object" && e !== null;
152
+ function xt(e) {
153
+ return X(e) && typeof e.id == "string" && X(e.config) && typeof e.config.type == "string" && X(e.config.appearance) && Array.isArray(e.rules);
142
154
  }
143
- function tn(e) {
144
- return O(e) && typeof e.id == "string" && typeof e.mode == "string" && O(e.config) && Array.isArray(e.members) && e.members.every((t) => O(t) && _t(t.widget)) && Array.isArray(e.rules);
155
+ function dn(e) {
156
+ return X(e) && typeof e.id == "string" && typeof e.mode == "string" && X(e.config) && Array.isArray(e.members) && e.members.every((t) => X(t) && xt(t.widget)) && Array.isArray(e.rules);
145
157
  }
146
- function nn(e, t) {
147
- return !O(e) || e.kind !== t ? null : t === "widget" && _t(e.payload) || t === "group" && tn(e.payload) ? e : null;
158
+ function fn(e, t) {
159
+ return !X(e) || e.kind !== t ? null : t === "widget" && xt(e.payload) || t === "group" && dn(e.payload) ? e : null;
148
160
  }
149
- var _e, C, gt, rn, L, Ve, mt, bt, $e, ie, J, vt, je, ze, He, on, ue = {}, de = [], an = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ge = Array.isArray;
150
- function B(e, t) {
161
+ var Se, I, wt, pn, U, tt, St, kt, Me, pe, te, $t, Oe, Be, De, hn, me = {}, be = [], _n = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ke = Array.isArray;
162
+ function L(e, t) {
151
163
  for (var n in t) e[n] = t[n];
152
164
  return e;
153
165
  }
154
- function Be(e) {
166
+ function Ue(e) {
155
167
  e && e.parentNode && e.parentNode.removeChild(e);
156
168
  }
157
- function sn(e, t, n) {
169
+ function gn(e, t, n) {
158
170
  var r, o, i, a = {};
159
171
  for (i in t) i == "key" ? r = t[i] : i == "ref" ? o = t[i] : a[i] = t[i];
160
- if (arguments.length > 2 && (a.children = arguments.length > 3 ? _e.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (i in e.defaultProps) a[i] === void 0 && (a[i] = e.defaultProps[i]);
161
- return oe(e, a, r, o, null);
172
+ if (arguments.length > 2 && (a.children = arguments.length > 3 ? Se.call(arguments, 2) : n), typeof e == "function" && e.defaultProps != null) for (i in e.defaultProps) a[i] === void 0 && (a[i] = e.defaultProps[i]);
173
+ return he(e, a, r, o, null);
162
174
  }
163
- function oe(e, t, n, r, o) {
175
+ function he(e, t, n, r, o) {
164
176
  var i = {
165
177
  type: e,
166
178
  props: t,
@@ -172,68 +184,68 @@ function oe(e, t, n, r, o) {
172
184
  __e: null,
173
185
  __c: null,
174
186
  constructor: void 0,
175
- __v: o == null ? ++gt : o,
187
+ __v: o == null ? ++wt : o,
176
188
  __i: -1,
177
189
  __u: 0
178
190
  };
179
- return o == null && C.vnode != null && C.vnode(i), i;
191
+ return o == null && I.vnode != null && I.vnode(i), i;
180
192
  }
181
- function W(e) {
193
+ function Y(e) {
182
194
  return e.children;
183
195
  }
184
- function ae(e, t) {
196
+ function _e(e, t) {
185
197
  this.props = e, this.context = t;
186
198
  }
187
- function U(e, t) {
188
- if (t == null) return e.__ ? U(e.__, e.__i + 1) : null;
199
+ function Z(e, t) {
200
+ if (t == null) return e.__ ? Z(e.__, e.__i + 1) : null;
189
201
  for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
190
- return typeof e.type == "function" ? U(e) : null;
202
+ return typeof e.type == "function" ? Z(e) : null;
191
203
  }
192
- function ln(e) {
204
+ function mn(e) {
193
205
  if (e.__P && e.__d) {
194
- var t = e.__v, n = t.__e, r = [], o = [], i = B({}, t);
195
- i.__v = t.__v + 1, C.vnode && C.vnode(i), De(e.__P, i, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n == null ? U(t) : n, !!(32 & t.__u), o), i.__v = t.__v, i.__.__k[i.__i] = i, St(r, i, o), t.__e = t.__ = null, i.__e != n && yt(i);
206
+ var t = e.__v, n = t.__e, r = [], o = [], i = L({}, t);
207
+ i.__v = t.__v + 1, I.vnode && I.vnode(i), Ye(e.__P, i, t, e.__n, e.__P.namespaceURI, 32 & t.__u ? [n] : null, r, n == null ? Z(t) : n, !!(32 & t.__u), o), i.__v = t.__v, i.__.__k[i.__i] = i, Mt(r, i, o), t.__e = t.__ = null, i.__e != n && Ct(i);
196
208
  }
197
209
  }
198
- function yt(e) {
210
+ function Ct(e) {
199
211
  if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
200
212
  if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
201
- }), yt(e);
213
+ }), Ct(e);
202
214
  }
203
- function Ke(e) {
204
- (!e.__d && (e.__d = !0) && L.push(e) && !fe.__r++ || Ve != C.debounceRendering) && ((Ve = C.debounceRendering) || mt)(fe);
215
+ function nt(e) {
216
+ (!e.__d && (e.__d = !0) && U.push(e) && !ve.__r++ || tt != I.debounceRendering) && ((tt = I.debounceRendering) || St)(ve);
205
217
  }
206
- function fe() {
218
+ function ve() {
207
219
  try {
208
- for (var e, t = 1; L.length; ) L.length > t && L.sort(bt), e = L.shift(), t = L.length, ln(e);
220
+ for (var e, t = 1; U.length; ) U.length > t && U.sort(kt), e = U.shift(), t = U.length, mn(e);
209
221
  } finally {
210
- L.length = fe.__r = 0;
222
+ U.length = ve.__r = 0;
211
223
  }
212
224
  }
213
- function xt(e, t, n, r, o, i, a, u, d, c, f) {
214
- var p, l, h, m, y, w, _ = r && r.__k || de, g = t.length;
215
- for (d = cn(n, t, _, d, g), p = 0; p < g; p++) (h = n.__k[p]) != null && (l = h.__i != -1 && _[h.__i] || ue, h.__i = p, w = De(e, h, l, o, i, a, u, d, c, f), m = h.__e, h.ref && l.ref != h.ref && (l.ref && Le(l.ref, null, h), f.push(h.ref, h.__c || m, h)), y == null && m != null && (y = m), 4 & h.__u ? (d = wt(h, d, e), l.__e && (l.__e = null)) : typeof h.type == "function" && w !== void 0 ? d = w : m && (d = m.nextSibling), h.__u &= -7);
216
- return n.__e = y, d;
225
+ function qt(e, t, n, r, o, i, a, u, d, c, f) {
226
+ var h, l, p, m, x, b, _ = r && r.__k || be, g = t.length;
227
+ for (d = bn(n, t, _, d, g), h = 0; h < g; h++) (p = n.__k[h]) != null && (l = p.__i != -1 && _[p.__i] || me, p.__i = h, b = Ye(e, p, l, o, i, a, u, d, c, f), m = p.__e, p.ref && l.ref != p.ref && (l.ref && Ge(l.ref, null, p), f.push(p.ref, p.__c || m, p)), x == null && m != null && (x = m), 4 & p.__u ? (d = It(p, d, e), l.__e && (l.__e = null)) : typeof p.type == "function" && b !== void 0 ? d = b : m && (d = m.nextSibling), p.__u &= -7);
228
+ return n.__e = x, d;
217
229
  }
218
- function cn(e, t, n, r, o) {
219
- var i, a, u, d, c, f = n.length, p = f, l = 0;
220
- for (e.__k = new Array(o), i = 0; i < o; i++) (a = t[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = e.__k[i] = oe(null, a, null, null, null) : ge(a) ? a = e.__k[i] = oe(W, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = e.__k[i] = oe(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : e.__k[i] = a, d = i + l, a.__ = e, a.__b = e.__b + 1, u = null, (c = a.__i = un(a, n, d, p)) != -1 && (p--, (u = n[c]) && (u.__u |= 2)), u == null || u.__v == null ? (c == -1 && (o > f ? l-- : o < f && l++), typeof a.type != "function" && (a.__u |= 4)) : c != d && (c == d - 1 ? l-- : c == d + 1 ? l++ : (c > d ? l-- : l++, a.__u |= 4))) : e.__k[i] = null;
221
- if (p) for (i = 0; i < f; i++) (u = n[i]) != null && (2 & u.__u) == 0 && (u.__e == r && (r = U(u)), Ct(u, u));
230
+ function bn(e, t, n, r, o) {
231
+ var i, a, u, d, c, f = n.length, h = f, l = 0;
232
+ for (e.__k = new Array(o), i = 0; i < o; i++) (a = t[i]) != null && typeof a != "boolean" && typeof a != "function" ? (typeof a == "string" || typeof a == "number" || typeof a == "bigint" || a.constructor == String ? a = e.__k[i] = he(null, a, null, null, null) : ke(a) ? a = e.__k[i] = he(Y, { children: a }, null, null, null) : a.constructor === void 0 && a.__b > 0 ? a = e.__k[i] = he(a.type, a.props, a.key, a.ref ? a.ref : null, a.__v) : e.__k[i] = a, d = i + l, a.__ = e, a.__b = e.__b + 1, u = null, (c = a.__i = vn(a, n, d, h)) != -1 && (h--, (u = n[c]) && (u.__u |= 2)), u == null || u.__v == null ? (c == -1 && (o > f ? l-- : o < f && l++), typeof a.type != "function" && (a.__u |= 4)) : c != d && (c == d - 1 ? l-- : c == d + 1 ? l++ : (c > d ? l-- : l++, a.__u |= 4))) : e.__k[i] = null;
233
+ if (h) for (i = 0; i < f; i++) (u = n[i]) != null && (2 & u.__u) == 0 && (u.__e == r && (r = Z(u)), At(u, u));
222
234
  return r;
223
235
  }
224
- function wt(e, t, n) {
236
+ function It(e, t, n) {
225
237
  var r, o;
226
238
  if (typeof e.type == "function") {
227
- for (r = e.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = e, t = wt(r[o], t, n));
239
+ for (r = e.__k, o = 0; r && o < r.length; o++) r[o] && (r[o].__ = e, t = It(r[o], t, n));
228
240
  return t;
229
241
  }
230
- e.__e != t && (t && e.type && !t.parentNode && (t = U(e)), t = n.insertBefore(e.__e, t || null));
242
+ e.__e != t && (t && e.type && !t.parentNode && (t = Z(e)), t = n.insertBefore(e.__e, t || null));
231
243
  do
232
244
  t = t && t.nextSibling;
233
245
  while (t != null && t.nodeType == 8);
234
246
  return t;
235
247
  }
236
- function un(e, t, n, r) {
248
+ function vn(e, t, n, r) {
237
249
  var o, i, a, u = e.key, d = e.type, c = t[n], f = c != null && (2 & c.__u) == 0;
238
250
  if (c === null && u == null || f && u == c.key && d == c.type) return n;
239
251
  if (r > (f ? 1 : 0)) {
@@ -241,17 +253,17 @@ function un(e, t, n, r) {
241
253
  }
242
254
  return -1;
243
255
  }
244
- function Xe(e, t, n) {
245
- t[0] == "-" ? e.setProperty(t, n == null ? "" : n) : e[t] = n == null ? "" : typeof n != "number" || an.test(t) ? n : n + "px";
256
+ function rt(e, t, n) {
257
+ t[0] == "-" ? e.setProperty(t, n == null ? "" : n) : e[t] = n == null ? "" : typeof n != "number" || _n.test(t) ? n : n + "px";
246
258
  }
247
- function te(e, t, n, r, o) {
259
+ function ue(e, t, n, r, o) {
248
260
  var i, a;
249
261
  e: if (t == "style") if (typeof n == "string") e.style.cssText = n;
250
262
  else {
251
- if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || Xe(e.style, t, "");
252
- if (n) for (t in n) r && n[t] == r[t] || Xe(e.style, t, n[t]);
263
+ if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || rt(e.style, t, "");
264
+ if (n) for (t in n) r && n[t] == r[t] || rt(e.style, t, n[t]);
253
265
  }
254
- else if (t[0] == "o" && t[1] == "n") i = t != (t = t.replace(vt, "$1")), a = t.toLowerCase(), t = a in e || t == "onFocusOut" || t == "onFocusIn" ? a.slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = n, n ? r ? n[J] = r[J] : (n[J] = je, e.addEventListener(t, i ? He : ze, i)) : e.removeEventListener(t, i ? He : ze, i);
266
+ else if (t[0] == "o" && t[1] == "n") i = t != (t = t.replace($t, "$1")), a = t.toLowerCase(), t = a in e || t == "onFocusOut" || t == "onFocusIn" ? a.slice(2) : t.slice(2), e.l || (e.l = {}), e.l[t + i] = n, n ? r ? n[te] = r[te] : (n[te] = Oe, e.addEventListener(t, i ? De : Be, i)) : e.removeEventListener(t, i ? De : Be, i);
255
267
  else {
256
268
  if (o == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
257
269
  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 {
@@ -262,276 +274,276 @@ function te(e, t, n, r, o) {
262
274
  typeof n == "function" || (n == null || n === !1 && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
263
275
  }
264
276
  }
265
- function Je(e) {
277
+ function it(e) {
266
278
  return function(t) {
267
279
  if (this.l) {
268
280
  var n = this.l[t.type + e];
269
- if (t[ie] == null) t[ie] = je++;
270
- else if (t[ie] < n[J]) return;
271
- return n(C.event ? C.event(t) : t);
281
+ if (t[pe] == null) t[pe] = Oe++;
282
+ else if (t[pe] < n[te]) return;
283
+ return n(I.event ? I.event(t) : t);
272
284
  }
273
285
  };
274
286
  }
275
- function De(e, t, n, r, o, i, a, u, d, c) {
276
- var f, p, l, h, m, y, w, _, g, v, k, x, q, $, z, H, A = t.type;
287
+ function Ye(e, t, n, r, o, i, a, u, d, c) {
288
+ var f, h, l, p, m, x, b, _, g, y, $, q, z, S, C, w, T = t.type;
277
289
  if (t.constructor !== void 0) return null;
278
- 128 & n.__u && (d = !!(32 & n.__u), i = [u = t.__e = n.__e]), (f = C.__b) && f(t);
279
- e: if (typeof A == "function") {
280
- p = a.length;
290
+ 128 & n.__u && (d = !!(32 & n.__u), i = [u = t.__e = n.__e]), (f = I.__b) && f(t);
291
+ e: if (typeof T == "function") {
292
+ h = a.length;
281
293
  try {
282
- if (g = t.props, v = A.prototype && A.prototype.render, k = (f = A.contextType) && r[f.__c], x = f ? k ? k.props.value : f.__ : r, n.__c ? _ = (l = t.__c = n.__c).__ = l.__E : (v ? t.__c = l = new A(g, x) : (t.__c = l = new ae(g, x), l.constructor = A, l.render = fn), k && k.sub(l), l.state || (l.state = {}), l.__n = r, h = l.__d = !0, l.__h = [], l._sb = []), v && l.__s == null && (l.__s = l.state), v && A.getDerivedStateFromProps != null && (l.__s == l.state && (l.__s = B({}, l.__s)), B(l.__s, A.getDerivedStateFromProps(g, l.__s))), m = l.props, y = l.state, l.__v = t, h) v && A.getDerivedStateFromProps == null && l.componentWillMount != null && l.componentWillMount(), v && l.componentDidMount != null && l.__h.push(l.componentDidMount);
294
+ if (g = t.props, y = T.prototype && T.prototype.render, $ = (f = T.contextType) && r[f.__c], q = f ? $ ? $.props.value : f.__ : r, n.__c ? _ = (l = t.__c = n.__c).__ = l.__E : (y ? t.__c = l = new T(g, q) : (t.__c = l = new _e(g, q), l.constructor = T, l.render = xn), $ && $.sub(l), l.state || (l.state = {}), l.__n = r, p = l.__d = !0, l.__h = [], l._sb = []), y && l.__s == null && (l.__s = l.state), y && T.getDerivedStateFromProps != null && (l.__s == l.state && (l.__s = L({}, l.__s)), L(l.__s, T.getDerivedStateFromProps(g, l.__s))), m = l.props, x = l.state, l.__v = t, p) y && T.getDerivedStateFromProps == null && l.componentWillMount != null && l.componentWillMount(), y && l.componentDidMount != null && l.__h.push(l.componentDidMount);
283
295
  else {
284
- if (v && A.getDerivedStateFromProps == null && g !== m && l.componentWillReceiveProps != null && l.componentWillReceiveProps(g, x), t.__v == n.__v || !l.__e && l.shouldComponentUpdate != null && l.shouldComponentUpdate(g, l.__s, x) === !1) {
285
- t.__v != n.__v && (l.props = g, l.state = l.__s, l.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(R) {
286
- R && (R.__ = t);
287
- }), de.push.apply(l.__h, l._sb), l._sb = [], l.__h.length && a.push(l), u = U(n);
296
+ if (y && T.getDerivedStateFromProps == null && g !== m && l.componentWillReceiveProps != null && l.componentWillReceiveProps(g, q), t.__v == n.__v || !l.__e && l.shouldComponentUpdate != null && l.shouldComponentUpdate(g, l.__s, q) === !1) {
297
+ t.__v != n.__v && (l.props = g, l.state = l.__s, l.__d = !1), t.__e = n.__e, t.__k = n.__k, t.__k.some(function(M) {
298
+ M && (M.__ = t);
299
+ }), be.push.apply(l.__h, l._sb), l._sb = [], l.__h.length && a.push(l), u = Z(n);
288
300
  break e;
289
301
  }
290
- l.componentWillUpdate != null && l.componentWillUpdate(g, l.__s, x), v && l.componentDidUpdate != null && l.__h.push(function() {
291
- l.componentDidUpdate(m, y, w);
302
+ l.componentWillUpdate != null && l.componentWillUpdate(g, l.__s, q), y && l.componentDidUpdate != null && l.__h.push(function() {
303
+ l.componentDidUpdate(m, x, b);
292
304
  });
293
305
  }
294
- if (l.context = x, l.props = g, l.__P = e, l.__e = !1, q = C.__r, $ = 0, v) l.state = l.__s, l.__d = !1, q && q(t), f = l.render(l.props, l.state, l.context), de.push.apply(l.__h, l._sb), l._sb = [];
306
+ if (l.context = q, l.props = g, l.__P = e, l.__e = !1, z = I.__r, S = 0, y) l.state = l.__s, l.__d = !1, z && z(t), f = l.render(l.props, l.state, l.context), be.push.apply(l.__h, l._sb), l._sb = [];
295
307
  else do
296
- l.__d = !1, q && q(t), f = l.render(l.props, l.state, l.context), l.state = l.__s;
297
- while (l.__d && ++$ < 25);
298
- l.state = l.__s, l.getChildContext != null && (r = B(B({}, r), l.getChildContext())), v && !h && l.getSnapshotBeforeUpdate != null && (w = l.getSnapshotBeforeUpdate(m, y)), z = f != null && f.type === W && f.key == null ? $t(f.props.children) : f, u = xt(e, ge(z) ? z : [z], t, n, r, o, i, a, u, d, c), l.base = t.__e, t.__u &= -161, l.__h.length && a.push(l), _ && (l.__E = l.__ = null);
299
- } catch (R) {
300
- if (a.length = p, t.__v = null, d || i != null) {
301
- if (R.then) {
308
+ l.__d = !1, z && z(t), f = l.render(l.props, l.state, l.context), l.state = l.__s;
309
+ while (l.__d && ++S < 25);
310
+ l.state = l.__s, l.getChildContext != null && (r = L(L({}, r), l.getChildContext())), y && !p && l.getSnapshotBeforeUpdate != null && (b = l.getSnapshotBeforeUpdate(m, x)), C = f != null && f.type === Y && f.key == null ? zt(f.props.children) : f, u = qt(e, ke(C) ? C : [C], t, n, r, o, i, a, u, d, c), l.base = t.__e, t.__u &= -161, l.__h.length && a.push(l), _ && (l.__E = l.__ = null);
311
+ } catch (M) {
312
+ if (a.length = h, t.__v = null, d || i != null) {
313
+ if (M.then) {
302
314
  for (t.__u |= d ? 160 : 128; u && u.nodeType == 8 && u.nextSibling; ) u = u.nextSibling;
303
315
  i != null && (i[i.indexOf(u)] = null), t.__e = u;
304
- } else if (i != null) for (H = i.length; H--; ) Be(i[H]);
316
+ } else if (i != null) for (w = i.length; w--; ) Ue(i[w]);
305
317
  } else t.__e = n.__e;
306
- t.__k == null && (t.__k = n.__k || []), R.then || kt(t), C.__e(R, t, n);
318
+ t.__k == null && (t.__k = n.__k || []), M.then || Tt(t), I.__e(M, t, n);
307
319
  }
308
- } else i == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : u = t.__e = dn(n.__e, t, n, r, o, i, a, d, c);
309
- return (f = C.diffed) && f(t), 128 & t.__u ? void 0 : u;
320
+ } else i == null && t.__v == n.__v ? (t.__k = n.__k, t.__e = n.__e) : u = t.__e = yn(n.__e, t, n, r, o, i, a, d, c);
321
+ return (f = I.diffed) && f(t), 128 & t.__u ? void 0 : u;
310
322
  }
311
- function kt(e) {
312
- e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(kt));
323
+ function Tt(e) {
324
+ e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(Tt));
313
325
  }
314
- function St(e, t, n) {
315
- for (var r = 0; r < n.length; r++) Le(n[r], n[++r], n[++r]);
316
- C.__c && C.__c(t, e), e.some(function(o) {
326
+ function Mt(e, t, n) {
327
+ for (var r = 0; r < n.length; r++) Ge(n[r], n[++r], n[++r]);
328
+ I.__c && I.__c(t, e), e.some(function(o) {
317
329
  try {
318
330
  e = o.__h, o.__h = [], e.some(function(i) {
319
331
  i.call(o);
320
332
  });
321
333
  } catch (i) {
322
- C.__e(i, o.__v);
334
+ I.__e(i, o.__v);
323
335
  }
324
336
  });
325
337
  }
326
- function $t(e) {
327
- return typeof e != "object" || e == null || e.__b > 0 ? e : ge(e) ? e.map($t) : e.constructor !== void 0 ? null : B({}, e);
338
+ function zt(e) {
339
+ return typeof e != "object" || e == null || e.__b > 0 ? e : ke(e) ? e.map(zt) : e.constructor !== void 0 ? null : L({}, e);
328
340
  }
329
- function dn(e, t, n, r, o, i, a, u, d) {
330
- var c, f, p, l, h, m, y, w = n.props || ue, _ = t.props, g = t.type;
341
+ function yn(e, t, n, r, o, i, a, u, d) {
342
+ var c, f, h, l, p, m, x, b = n.props || me, _ = t.props, g = t.type;
331
343
  if (g == "svg" ? o = "http://www.w3.org/2000/svg" : g == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o || (o = "http://www.w3.org/1999/xhtml"), i != null) {
332
- for (c = 0; c < i.length; c++) if ((h = i[c]) && "setAttribute" in h == !!g && (g ? h.localName == g : h.nodeType == 3)) {
333
- e = h, i[c] = null;
344
+ for (c = 0; c < i.length; c++) if ((p = i[c]) && "setAttribute" in p == !!g && (g ? p.localName == g : p.nodeType == 3)) {
345
+ e = p, i[c] = null;
334
346
  break;
335
347
  }
336
348
  }
337
349
  if (e == null) {
338
350
  if (g == null) return document.createTextNode(_);
339
- e = document.createElementNS(o, g, _.is && _), u && (C.__m && C.__m(t, i), u = !1), i = null;
351
+ e = document.createElementNS(o, g, _.is && _), u && (I.__m && I.__m(t, i), u = !1), i = null;
340
352
  }
341
- if (g == null) w === _ || u && e.data == _ || (e.data = _);
353
+ if (g == null) b === _ || u && e.data == _ || (e.data = _);
342
354
  else {
343
- if (i = g == "textarea" && _.defaultValue != null ? null : i && _e.call(e.childNodes), !u && i != null) for (w = {}, c = 0; c < e.attributes.length; c++) w[(h = e.attributes[c]).name] = h.value;
344
- for (c in w) h = w[c], c == "dangerouslySetInnerHTML" ? p = h : c == "children" || c in _ || c == "value" && "defaultValue" in _ || c == "checked" && "defaultChecked" in _ || te(e, c, null, h, o);
345
- for (c in _) h = _[c], c == "children" ? l = h : c == "dangerouslySetInnerHTML" ? f = h : c == "value" ? m = h : c == "checked" ? y = h : u && typeof h != "function" || w[c] === h || te(e, c, h, w[c], o);
346
- if (f) u || p && (f.__html == p.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
347
- else if (p && (e.innerHTML = ""), xt(t.type == "template" ? e.content : e, ge(l) ? l : [l], t, n, r, g == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, a, i ? i[0] : n.__k && U(n, 0), u, d), i != null) for (c = i.length; c--; ) Be(i[c]);
348
- u && g != "textarea" || (c = "value", g == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[c] || g == "progress" && !m || g == "option" && m != w[c]) && te(e, c, m, w[c], o), c = "checked", y != null && y != e[c] && te(e, c, y, w[c], o));
355
+ if (i = g == "textarea" && _.defaultValue != null ? null : i && Se.call(e.childNodes), !u && i != null) for (b = {}, c = 0; c < e.attributes.length; c++) b[(p = e.attributes[c]).name] = p.value;
356
+ for (c in b) p = b[c], c == "dangerouslySetInnerHTML" ? h = p : c == "children" || c in _ || c == "value" && "defaultValue" in _ || c == "checked" && "defaultChecked" in _ || ue(e, c, null, p, o);
357
+ for (c in _) p = _[c], c == "children" ? l = p : c == "dangerouslySetInnerHTML" ? f = p : c == "value" ? m = p : c == "checked" ? x = p : u && typeof p != "function" || b[c] === p || ue(e, c, p, b[c], o);
358
+ if (f) u || h && (f.__html == h.__html || f.__html == e.innerHTML) || (e.innerHTML = f.__html), t.__k = [];
359
+ else if (h && (e.innerHTML = ""), qt(t.type == "template" ? e.content : e, ke(l) ? l : [l], t, n, r, g == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, i, a, i ? i[0] : n.__k && Z(n, 0), u, d), i != null) for (c = i.length; c--; ) Ue(i[c]);
360
+ u && g != "textarea" || (c = "value", g == "progress" && m == null ? e.removeAttribute("value") : m != null && (m !== e[c] || g == "progress" && !m || g == "option" && m != b[c]) && ue(e, c, m, b[c], o), c = "checked", x != null && x != e[c] && ue(e, c, x, b[c], o));
349
361
  }
350
362
  return e;
351
363
  }
352
- function Le(e, t, n) {
364
+ function Ge(e, t, n) {
353
365
  try {
354
366
  if (typeof e == "function") {
355
367
  var r = typeof e.__u == "function";
356
368
  r && e.__u(), r && t == null || (e.__u = e(t));
357
369
  } else e.current = t;
358
370
  } catch (o) {
359
- C.__e(o, n);
371
+ I.__e(o, n);
360
372
  }
361
373
  }
362
- function Ct(e, t, n) {
374
+ function At(e, t, n) {
363
375
  var r, o;
364
- if (C.unmount && C.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Le(r, null, t)), (r = e.__c) != null) {
376
+ if (I.unmount && I.unmount(e), (r = e.ref) && (r.current && r.current != e.__e || Ge(r, null, t)), (r = e.__c) != null) {
365
377
  if (r.componentWillUnmount) try {
366
378
  r.componentWillUnmount();
367
379
  } catch (i) {
368
- C.__e(i, t);
380
+ I.__e(i, t);
369
381
  }
370
382
  r.base = r.__P = r.__n = null;
371
383
  }
372
- if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && Ct(r[o], t, n || typeof e.type != "function");
373
- n || Be(e.__e), e.__c = e.__ = e.__e = void 0;
384
+ if (r = e.__k) for (o = 0; o < r.length; o++) r[o] && At(r[o], t, n || typeof e.type != "function");
385
+ n || Ue(e.__e), e.__c = e.__ = e.__e = void 0;
374
386
  }
375
- function fn(e, t, n) {
387
+ function xn(e, t, n) {
376
388
  return this.constructor(e, n);
377
389
  }
378
- function Ze(e, t, n) {
390
+ function ot(e, t, n) {
379
391
  var r, o, i, a;
380
- t == document && (t = document.documentElement), C.__ && C.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], a = [], De(t, e = (!r && n || t).__k = sn(W, null, [e]), o || ue, ue, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? _e.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, a), St(i, e, a), e.props.children = null;
392
+ t == document && (t = document.documentElement), I.__ && I.__(e, t), o = (r = typeof n == "function") ? null : n && n.__k || t.__k, i = [], a = [], Ye(t, e = (!r && n || t).__k = gn(Y, null, [e]), o || me, me, t.namespaceURI, !r && n ? [n] : o ? null : t.firstChild ? Se.call(t.childNodes) : null, i, !r && n ? n : o ? o.__e : t.firstChild, r, a), Mt(i, e, a), e.props.children = null;
381
393
  }
382
- _e = de.slice, C = { __e: function(e, t, n, r) {
394
+ Se = be.slice, I = { __e: function(e, t, n, r) {
383
395
  for (var o, i, a; t = t.__; ) if ((o = t.__c) && !o.__) try {
384
396
  if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, r || {}), a = o.__d), a) return o.__E = o;
385
397
  } catch (u) {
386
398
  e = u;
387
399
  }
388
400
  throw e;
389
- } }, gt = 0, rn = function(e) {
401
+ } }, wt = 0, pn = function(e) {
390
402
  return e != null && e.constructor === void 0;
391
- }, ae.prototype.setState = function(e, t) {
392
- var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = B({}, this.state);
393
- typeof e == "function" && (e = e(B({}, n), this.props)), e && B(n, e), e != null && this.__v && (t && this._sb.push(t), Ke(this));
394
- }, ae.prototype.forceUpdate = function(e) {
395
- this.__v && (this.__e = !0, e && this.__h.push(e), Ke(this));
396
- }, ae.prototype.render = W, L = [], mt = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, bt = function(e, t) {
403
+ }, _e.prototype.setState = function(e, t) {
404
+ var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = L({}, this.state);
405
+ typeof e == "function" && (e = e(L({}, n), this.props)), e && L(n, e), e != null && this.__v && (t && this._sb.push(t), nt(this));
406
+ }, _e.prototype.forceUpdate = function(e) {
407
+ this.__v && (this.__e = !0, e && this.__h.push(e), nt(this));
408
+ }, _e.prototype.render = Y, U = [], St = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, kt = function(e, t) {
397
409
  return e.__v.__b - t.__v.__b;
398
- }, fe.__r = 0, $e = Math.random().toString(8), ie = "__d" + $e, J = "__a" + $e, vt = /(PointerCapture)$|Capture$/i, je = 0, ze = Je(!1), He = Je(!0), on = 0;
399
- var Q, M, Ce, Qe, ee = 0, qt = [], T = C, et = T.__b, tt = T.__r, nt = T.diffed, rt = T.__c, it = T.unmount, ot = T.__;
400
- function We(e, t) {
401
- T.__h && T.__h(M, e, ee || t), ee = 0;
402
- var n = M.__H || (M.__H = {
410
+ }, ve.__r = 0, Me = Math.random().toString(8), pe = "__d" + Me, te = "__a" + Me, $t = /(PointerCapture)$|Capture$/i, Oe = 0, Be = it(!1), De = it(!0), hn = 0;
411
+ var ie, H, ze, st, oe = 0, Ht = [], R = I, at = R.__b, lt = R.__r, ct = R.diffed, ut = R.__c, dt = R.unmount, ft = R.__;
412
+ function Ke(e, t) {
413
+ R.__h && R.__h(H, e, oe || t), oe = 0;
414
+ var n = H.__H || (H.__H = {
403
415
  __: [],
404
416
  __h: []
405
417
  });
406
418
  return e >= n.__.length && n.__.push({}), n.__[e];
407
419
  }
408
420
  function E(e) {
409
- return ee = 1, hn(Mt, e);
421
+ return oe = 1, wn(Et, e);
410
422
  }
411
- function hn(e, t, n) {
412
- var r = We(Q++, 2);
413
- if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Mt(void 0, t), function(u) {
423
+ function wn(e, t, n) {
424
+ var r = Ke(ie++, 2);
425
+ if (r.t = e, !r.__c && (r.__ = [n ? n(t) : Et(void 0, t), function(u) {
414
426
  var d = r.__N ? r.__N[0] : r.__[0], c = r.t(d, u);
415
427
  d !== c && (r.__N = [c, r.__[1]], r.__c.setState({}));
416
- }], r.__c = M, !M.__f)) {
428
+ }], r.__c = H, !H.__f)) {
417
429
  var o = function(u, d, c) {
418
430
  if (!r.__c.__H) return !0;
419
- var f = !1, p = r.__c.props !== u;
420
- if (r.__c.__H.__.some(function(h) {
421
- if (h.__N) {
431
+ var f = !1, h = r.__c.props !== u;
432
+ if (r.__c.__H.__.some(function(p) {
433
+ if (p.__N) {
422
434
  f = !0;
423
- var m = h.__[0];
424
- h.__ = h.__N, h.__N = void 0, m !== h.__[0] && (p = !0);
435
+ var m = p.__[0];
436
+ p.__ = p.__N, p.__N = void 0, m !== p.__[0] && (h = !0);
425
437
  }
426
438
  }), i) {
427
439
  var l = i.call(this, u, d, c);
428
- return f ? l || p : l;
440
+ return f ? l || h : l;
429
441
  }
430
- return !f || p;
442
+ return !f || h;
431
443
  };
432
- M.__f = !0;
433
- var i = M.shouldComponentUpdate, a = M.componentWillUpdate;
434
- M.componentWillUpdate = function(u, d, c) {
444
+ H.__f = !0;
445
+ var i = H.shouldComponentUpdate, a = H.componentWillUpdate;
446
+ H.componentWillUpdate = function(u, d, c) {
435
447
  if (this.__e) {
436
448
  var f = i;
437
449
  i = void 0, o(u, d, c), i = f;
438
450
  }
439
451
  a && a.call(this, u, d, c);
440
- }, M.shouldComponentUpdate = o;
452
+ }, H.shouldComponentUpdate = o;
441
453
  }
442
454
  return r.__N || r.__;
443
455
  }
444
456
  function P(e, t) {
445
- var n = We(Q++, 3);
446
- !T.__s && It(n.__H, t) && (n.__ = e, n.u = t, M.__H.__h.push(n));
457
+ var n = Ke(ie++, 3);
458
+ !R.__s && Rt(n.__H, t) && (n.__ = e, n.u = t, H.__H.__h.push(n));
447
459
  }
448
- function F(e) {
449
- return ee = 5, he(function() {
460
+ function D(e) {
461
+ return oe = 5, ye(function() {
450
462
  return { current: e };
451
463
  }, []);
452
464
  }
453
- function he(e, t) {
454
- var n = We(Q++, 7);
455
- return It(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
465
+ function ye(e, t) {
466
+ var n = Ke(ie++, 7);
467
+ return Rt(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
456
468
  }
457
- function X(e, t) {
458
- return ee = 8, he(function() {
469
+ function O(e, t) {
470
+ return oe = 8, ye(function() {
459
471
  return e;
460
472
  }, t);
461
473
  }
462
- function pn() {
463
- for (var e; e = qt.shift(); ) {
474
+ function Sn() {
475
+ for (var e; e = Ht.shift(); ) {
464
476
  var t = e.__H;
465
477
  if (e.__P && t) try {
466
- t.__h.some(se), t.__h.some(Re), t.__h = [];
478
+ t.__h.some(ge), t.__h.some(We), t.__h = [];
467
479
  } catch (n) {
468
- t.__h = [], T.__e(n, e.__v);
480
+ t.__h = [], R.__e(n, e.__v);
469
481
  }
470
482
  }
471
483
  }
472
- T.__b = function(e) {
473
- M = null, et && et(e);
474
- }, T.__ = function(e, t) {
475
- e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ot && ot(e, t);
476
- }, T.__r = function(e) {
477
- tt && tt(e), Q = 0;
478
- var t = (M = e.__c).__H;
479
- t && (Ce === M ? (t.__h = [], M.__h = [], t.__.some(function(n) {
484
+ R.__b = function(e) {
485
+ H = null, at && at(e);
486
+ }, R.__ = function(e, t) {
487
+ e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ft && ft(e, t);
488
+ }, R.__r = function(e) {
489
+ lt && lt(e), ie = 0;
490
+ var t = (H = e.__c).__H;
491
+ t && (ze === H ? (t.__h = [], H.__h = [], t.__.some(function(n) {
480
492
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
481
- })) : (t.__h.some(se), t.__h.some(Re), t.__h = [], Q = 0)), Ce = M;
482
- }, T.diffed = function(e) {
483
- nt && nt(e);
493
+ })) : (t.__h.some(ge), t.__h.some(We), t.__h = [], ie = 0)), ze = H;
494
+ }, R.diffed = function(e) {
495
+ ct && ct(e);
484
496
  var t = e.__c;
485
- t && t.__H && (t.__H.__h.length && (qt.push(t) !== 1 && Qe === T.requestAnimationFrame || ((Qe = T.requestAnimationFrame) || _n)(pn)), t.__H.__.some(function(n) {
497
+ t && t.__H && (t.__H.__h.length && (Ht.push(t) !== 1 && st === R.requestAnimationFrame || ((st = R.requestAnimationFrame) || kn)(Sn)), t.__H.__.some(function(n) {
486
498
  n.u && (n.__H = n.u, n.u = void 0);
487
- })), Ce = M = null;
488
- }, T.__c = function(e, t) {
499
+ })), ze = H = null;
500
+ }, R.__c = function(e, t) {
489
501
  t.some(function(n) {
490
502
  try {
491
- n.__h.some(se), n.__h = n.__h.filter(function(r) {
492
- return !r.__ || Re(r);
503
+ n.__h.some(ge), n.__h = n.__h.filter(function(r) {
504
+ return !r.__ || We(r);
493
505
  });
494
506
  } catch (r) {
495
507
  t.some(function(o) {
496
508
  o.__h && (o.__h = []);
497
- }), t = [], T.__e(r, n.__v);
509
+ }), t = [], R.__e(r, n.__v);
498
510
  }
499
- }), rt && rt(e, t);
500
- }, T.unmount = function(e) {
501
- it && it(e);
511
+ }), ut && ut(e, t);
512
+ }, R.unmount = function(e) {
513
+ dt && dt(e);
502
514
  var t, n = e.__c;
503
515
  n && n.__H && (n.__H.__.some(function(r) {
504
516
  try {
505
- se(r);
517
+ ge(r);
506
518
  } catch (o) {
507
519
  t = o;
508
520
  }
509
- }), n.__H = void 0, t && T.__e(t, n.__v));
521
+ }), n.__H = void 0, t && R.__e(t, n.__v));
510
522
  };
511
- var at = typeof requestAnimationFrame == "function";
512
- function _n(e) {
523
+ var pt = typeof requestAnimationFrame == "function";
524
+ function kn(e) {
513
525
  var t, n = function() {
514
- clearTimeout(r), at && cancelAnimationFrame(t), setTimeout(e);
526
+ clearTimeout(r), pt && cancelAnimationFrame(t), setTimeout(e);
515
527
  }, r = setTimeout(n, 35);
516
- at && (t = requestAnimationFrame(n));
528
+ pt && (t = requestAnimationFrame(n));
517
529
  }
518
- function se(e) {
519
- var t = M, n = e.__c;
520
- typeof n == "function" && (e.__c = void 0, n()), M = t;
530
+ function ge(e) {
531
+ var t = H, n = e.__c;
532
+ typeof n == "function" && (e.__c = void 0, n()), H = t;
521
533
  }
522
- function Re(e) {
523
- var t = M;
524
- e.__c = e.__(), M = t;
534
+ function We(e) {
535
+ var t = H;
536
+ e.__c = e.__(), H = t;
525
537
  }
526
- function It(e, t) {
538
+ function Rt(e, t) {
527
539
  return !e || e.length !== t.length || t.some(function(n, r) {
528
540
  return n !== e[r];
529
541
  });
530
542
  }
531
- function Mt(e, t) {
543
+ function Et(e, t) {
532
544
  return typeof t == "function" ? t(e) : t;
533
545
  }
534
- var gn = `
546
+ var $n = `
535
547
  :host{all:initial;display:contents;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;font-size:14px;line-height:1.4;-webkit-font-smoothing:antialiased;color:#15171e}
536
548
  :host([hidden]){display:none}
537
549
  *,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
@@ -564,44 +576,50 @@ img,video{display:block;max-width:100%}
564
576
  @keyframes uq-slide{from{transform:translateY(100%)}to{transform:none}}
565
577
  @media (prefers-reduced-motion:reduce){.uq-rise,.uq-fade,.uq-slide,.uq-dots span{animation:none}.uq-drawer{transition:none}}
566
578
  `;
567
- function me(e, t) {
579
+ function ae(e, t) {
568
580
  try {
569
581
  return window[e].getItem(t);
570
582
  } catch {
571
583
  return null;
572
584
  }
573
585
  }
574
- function be(e, t, n) {
586
+ function le(e, t, n) {
575
587
  try {
576
588
  window[e].setItem(t, n);
577
589
  } catch {
578
590
  }
579
591
  }
580
- var mn = 2e3, bn = 20, vn = 100;
581
- function Ne(e = Date.now()) {
592
+ function Pt(e, t) {
593
+ try {
594
+ window[e].removeItem(t);
595
+ } catch {
596
+ }
597
+ }
598
+ var Cn = 2e3, qn = 20, In = 100;
599
+ function Ve(e = Date.now()) {
582
600
  const t = /* @__PURE__ */ new Uint8Array(16);
583
601
  crypto.getRandomValues(t), t[0] = e / 2 ** 40 & 255, t[1] = e / 2 ** 32 & 255, t[2] = e / 2 ** 24 & 255, t[3] = e / 2 ** 16 & 255, t[4] = e / 256 & 255, t[5] = e & 255, t[6] = t[6] & 15 | 112, t[8] = t[8] & 63 | 128;
584
602
  const n = Array.from(t, (r) => r.toString(16).padStart(2, "0")).join("");
585
603
  return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
586
604
  }
587
- var st = "usereq:visitor";
588
- function Tt() {
589
- const e = me("localStorage", st);
605
+ var ht = "usereq:visitor";
606
+ function Ft() {
607
+ const e = ae("localStorage", ht);
590
608
  if (e) return e;
591
- const t = Ne();
592
- return be("localStorage", st, t), t;
609
+ const t = Ve();
610
+ return le("localStorage", ht, t), t;
593
611
  }
594
- function yn(e, t) {
612
+ function Tn(e, t) {
595
613
  const n = [];
596
614
  let r = null;
597
- const o = Tt(), i = () => {
615
+ const o = Ft(), i = () => {
598
616
  for (r !== null && (window.clearTimeout(r), r = null); n.length > 0; ) {
599
- const u = n.splice(0, vn);
600
- en(e, { events: u });
617
+ const u = n.splice(0, In);
618
+ un(e, { events: u });
601
619
  }
602
620
  }, a = (u, d = {}) => {
603
621
  n.push({
604
- id: Ne(),
622
+ id: Ve(),
605
623
  type: u,
606
624
  embedKind: t.kind,
607
625
  embedId: t.id,
@@ -611,7 +629,7 @@ function yn(e, t) {
611
629
  url: window.location.href.slice(0, 2e3),
612
630
  occurredAt: (/* @__PURE__ */ new Date()).toISOString(),
613
631
  payload: d.payload
614
- }), n.length >= bn ? i() : r === null && (r = window.setTimeout(i, mn));
632
+ }), n.length >= qn ? i() : r === null && (r = window.setTimeout(i, Cn));
615
633
  };
616
634
  return window.addEventListener("pagehide", i), document.addEventListener("visibilitychange", () => {
617
635
  document.visibilityState === "hidden" && i();
@@ -620,8 +638,8 @@ function yn(e, t) {
620
638
  flush: i
621
639
  };
622
640
  }
623
- var At = (e) => `usereq:once:${e}`;
624
- function qe(e, t, n) {
641
+ var jt = (e) => `usereq:once:${e}`;
642
+ function Ae(e, t, n) {
625
643
  switch (e) {
626
644
  case "is":
627
645
  return t === n;
@@ -637,26 +655,26 @@ function qe(e, t, n) {
637
655
  }
638
656
  }
639
657
  }
640
- function xn(e, t) {
658
+ function Mn(e, t) {
641
659
  switch (e.kind) {
642
660
  case "path":
643
- return e.value === "*" || qe(e.op, t.path, e.value);
661
+ return e.value === "*" || Ae(e.op, t.path, e.value);
644
662
  case "utm":
645
663
  var n;
646
- return qe(e.op, (n = t.utm[e.param]) !== null && n !== void 0 ? n : "", e.value);
664
+ return Ae(e.op, (n = t.utm[e.param]) !== null && n !== void 0 ? n : "", e.value);
647
665
  case "device":
648
666
  return t.device === e.value;
649
667
  case "referrer":
650
- return qe(e.op, t.referrer, e.value);
668
+ return Ae(e.op, t.referrer, e.value);
651
669
  }
652
670
  }
653
- function wn(e, t) {
671
+ function zn(e, t) {
654
672
  for (const n of e)
655
- if (!(n.once && me("sessionStorage", At(n.id))) && n.conditions.every((r) => xn(r, t)))
673
+ if (!(n.once && ae("sessionStorage", jt(n.id))) && n.conditions.every((r) => Mn(r, t)))
656
674
  return n;
657
675
  return null;
658
676
  }
659
- function Et(e, t, n) {
677
+ function Bt(e, t, n) {
660
678
  let r = !1, o = () => {
661
679
  };
662
680
  const i = () => {
@@ -684,10 +702,10 @@ function Et(e, t, n) {
684
702
  case "element_click": {
685
703
  var a;
686
704
  const d = String((a = t.selector) !== null && a !== void 0 ? a : ""), c = (f) => {
687
- const p = f.target;
688
- if (!(!(p instanceof Element) || !d))
705
+ const h = f.target;
706
+ if (!(!(h instanceof Element) || !d))
689
707
  try {
690
- p.closest(d) && i();
708
+ h.closest(d) && i();
691
709
  } catch {
692
710
  }
693
711
  };
@@ -699,15 +717,15 @@ function Et(e, t, n) {
699
717
  const d = String((u = t.selector) !== null && u !== void 0 ? u : "");
700
718
  let c = null;
701
719
  const f = () => {
702
- let p = null;
720
+ let h = null;
703
721
  try {
704
- p = d ? document.querySelector(d) : null;
722
+ h = d ? document.querySelector(d) : null;
705
723
  } catch {
706
- p = null;
724
+ h = null;
707
725
  }
708
- return p ? (c = new IntersectionObserver((l) => {
709
- l.some((h) => h.isIntersecting) && i();
710
- }), c.observe(p), !0) : !1;
726
+ return h ? (c = new IntersectionObserver((l) => {
727
+ l.some((p) => p.isIntersecting) && i();
728
+ }), c.observe(h), !0) : !1;
711
729
  };
712
730
  !f() && document.readyState === "loading" && document.addEventListener("DOMContentLoaded", () => void f(), { once: !0 }), o = () => c == null ? void 0 : c.disconnect();
713
731
  break;
@@ -724,30 +742,30 @@ function Et(e, t, n) {
724
742
  r = !0, o();
725
743
  };
726
744
  }
727
- function zt(e, t, n) {
728
- const r = wn(e, t);
729
- return r ? Et(r.trigger, r.triggerParams, () => {
730
- r.once && be("sessionStorage", At(r.id), "1"), n(r);
745
+ function Dt(e, t, n) {
746
+ const r = zn(e, t);
747
+ return r ? Bt(r.trigger, r.triggerParams, () => {
748
+ r.once && le("sessionStorage", jt(r.id), "1"), n(r);
731
749
  }) : () => {
732
750
  };
733
751
  }
734
- var lt = (e) => `usereq:split:${e}`, Ht = (e) => `usereq:seq:${e}`;
735
- function kn(e) {
752
+ var _t = (e) => `usereq:split:${e}`, Wt = (e) => `usereq:seq:${e}`;
753
+ function An(e) {
736
754
  let t = 2166136261;
737
755
  for (let n = 0; n < e.length; n++)
738
756
  t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
739
757
  return t >>> 0;
740
758
  }
741
- function ve(e) {
759
+ function $e(e) {
742
760
  return [...e].sort((t, n) => t.position - n.position);
743
761
  }
744
- function Sn(e) {
745
- const t = ve(e.members);
762
+ function Hn(e) {
763
+ const t = $e(e.members);
746
764
  if (t.length === 0) return null;
747
- const n = me("localStorage", lt(e.id)), r = n ? t.find((u) => u.widget.id === n) : void 0;
765
+ const n = ae("localStorage", _t(e.id)), r = n ? t.find((u) => u.widget.id === n) : void 0;
748
766
  if (r) return r;
749
767
  const o = t.reduce((u, d) => u + d.weight, 0);
750
- let i = kn(`${Tt()}:${e.config.salt}`) % o, a = t[t.length - 1];
768
+ let i = An(`${Ft()}:${e.config.salt}`) % o, a = t[t.length - 1];
751
769
  for (const u of t) {
752
770
  if (i < u.weight) {
753
771
  a = u;
@@ -755,50 +773,50 @@ function Sn(e) {
755
773
  }
756
774
  i -= u.weight;
757
775
  }
758
- return be("localStorage", lt(e.id), a.widget.id), a;
776
+ return le("localStorage", _t(e.id), a.widget.id), a;
759
777
  }
760
- function Rt(e) {
778
+ function Lt(e) {
761
779
  var t, n;
762
- const r = ve(e.members);
780
+ const r = $e(e.members);
763
781
  if (r.length === 0) return null;
764
- const o = Number((t = me("sessionStorage", Ht(e.id))) !== null && t !== void 0 ? t : 0);
782
+ const o = Number((t = ae("sessionStorage", Wt(e.id))) !== null && t !== void 0 ? t : 0);
765
783
  return (n = r[Number.isFinite(o) ? Math.min(o, r.length - 1) : 0]) !== null && n !== void 0 ? n : null;
766
784
  }
767
- function $n(e, t, n) {
785
+ function Rn(e, t, n) {
768
786
  if (!t.advanceOn) return () => {
769
787
  };
770
- const r = ve(e.members), o = r.findIndex((i) => i.widget.id === t.widget.id);
771
- return Et(t.advanceOn.kind, t.advanceOn.params, () => {
788
+ const r = $e(e.members), o = r.findIndex((i) => i.widget.id === t.widget.id);
789
+ return Bt(t.advanceOn.kind, t.advanceOn.params, () => {
772
790
  var i;
773
791
  const a = o + 1 < r.length ? o + 1 : null;
774
792
  if (a === null) {
775
793
  n(null);
776
794
  return;
777
795
  }
778
- be("sessionStorage", Ht(e.id), String(a)), n((i = r[a]) !== null && i !== void 0 ? i : null);
796
+ le("sessionStorage", Wt(e.id), String(a)), n((i = r[a]) !== null && i !== void 0 ? i : null);
779
797
  });
780
798
  }
781
- function Cn(e) {
799
+ function En(e) {
782
800
  switch (e.mode) {
783
801
  case "split": {
784
- const t = Sn(e);
802
+ const t = Hn(e);
785
803
  return t ? [t.widget] : [];
786
804
  }
787
805
  case "sequence": {
788
- const t = Rt(e);
806
+ const t = Lt(e);
789
807
  return t ? [t.widget] : [];
790
808
  }
791
809
  case "parallel":
792
- return ve(e.members).map((t) => t.widget);
810
+ return $e(e.members).map((t) => t.widget);
793
811
  }
794
812
  }
795
- function qn(e) {
813
+ function Pn(e) {
796
814
  var t, n, r, o;
797
815
  if (e) return e === "dark";
798
- const i = (t = ct(getComputedStyle(document.body).backgroundColor)) !== null && t !== void 0 ? t : ct(getComputedStyle(document.documentElement).backgroundColor);
816
+ const i = (t = gt(getComputedStyle(document.body).backgroundColor)) !== null && t !== void 0 ? t : gt(getComputedStyle(document.documentElement).backgroundColor);
799
817
  return i !== null ? i < 0.5 : (n = (r = (o = window).matchMedia) === null || r === void 0 ? void 0 : r.call(o, "(prefers-color-scheme: dark)").matches) !== null && n !== void 0 ? n : !1;
800
818
  }
801
- function ct(e) {
819
+ function gt(e) {
802
820
  const t = /rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+))?/.exec(e);
803
821
  if (!t || (t[4] === void 0 ? 1 : Number(t[4])) < 0.5) return null;
804
822
  const [n, r, o] = [
@@ -808,10 +826,10 @@ function ct(e) {
808
826
  ];
809
827
  return (0.299 * n + 0.587 * r + 0.114 * o) / 255;
810
828
  }
811
- function In(e = window.innerWidth) {
829
+ function Fn(e = window.innerWidth) {
812
830
  return e < 640 ? "mobile" : e < 1024 ? "tablet" : "desktop";
813
831
  }
814
- function Mn() {
832
+ function jn() {
815
833
  const e = new URL(window.location.href), t = {};
816
834
  for (const n of [
817
835
  "source",
@@ -828,10 +846,10 @@ function Mn() {
828
846
  path: e.pathname,
829
847
  referrer: document.referrer.slice(0, 2e3),
830
848
  utm: t,
831
- device: In()
849
+ device: Fn()
832
850
  };
833
851
  }
834
- function Pt(e) {
852
+ function Nt(e) {
835
853
  const t = e.replace("#", "");
836
854
  return {
837
855
  r: parseInt(t.slice(0, 2), 16),
@@ -839,36 +857,36 @@ function Pt(e) {
839
857
  b: parseInt(t.slice(4, 6), 16)
840
858
  };
841
859
  }
842
- function Tn(e) {
843
- const { r: t, g: n, b: r } = Pt(e);
860
+ function Bn(e) {
861
+ const { r: t, g: n, b: r } = Nt(e);
844
862
  return (0.299 * t + 0.587 * n + 0.114 * r) / 255 > 0.62 ? "#15171e" : "#ffffff";
845
863
  }
846
- var ye = (e) => e ? "245,245,241" : "21,23,30";
847
- function An(e, t) {
864
+ var ce = (e) => e ? "245,245,241" : "21,23,30";
865
+ function Dn(e, t) {
848
866
  const n = e.appearance, r = n.accent;
849
867
  return {
850
868
  accent: r,
851
869
  accentFill: (() => {
852
870
  if (n.alpha >= 100) return r;
853
- const { r: o, g: i, b: a } = Pt(r);
871
+ const { r: o, g: i, b: a } = Nt(r);
854
872
  return `rgba(${o},${i},${a},${n.alpha / 100})`;
855
873
  })(),
856
- accentText: Tn(r),
874
+ accentText: Bn(r),
857
875
  rad: n.radius,
858
876
  isGlass: e.type === "chat" && e.variant === "stream" && n.skin === "glass",
859
877
  isMessenger: e.type === "chat" && e.variant === "bubble" && e.preset === "facebook-messenger",
860
878
  hostDark: t,
861
- ink: ye(t),
879
+ ink: ce(t),
862
880
  surfaceBg: t ? "#181b22" : "#ffffff",
863
881
  side: n.position === "bottom-right" ? { right: n.offsetX } : { left: n.offsetX },
864
882
  offsetY: n.offsetY
865
883
  };
866
884
  }
867
- function S(e, t, n) {
885
+ function k(e, t, n) {
868
886
  const r = e.appearance.parts[t], o = [`uq-${t}`];
869
887
  return n && o.push(n), r && o.push(r.trim()), o.join(" ");
870
888
  }
871
- var En = 0;
889
+ var Wn = 0;
872
890
  function s(e, t, n, r, o, i) {
873
891
  t || (t = {});
874
892
  var a, u, d = t;
@@ -884,14 +902,14 @@ function s(e, t, n, r, o, i) {
884
902
  __e: null,
885
903
  __c: null,
886
904
  constructor: void 0,
887
- __v: --En,
905
+ __v: --Wn,
888
906
  __i: -1,
889
907
  __u: 0,
890
908
  __source: o,
891
909
  __self: i
892
910
  };
893
911
  if (typeof e == "function" && (a = e.defaultProps)) for (u in a) d[u] === void 0 && (d[u] = a[u]);
894
- return C.vnode && C.vnode(c), c;
912
+ return I.vnode && I.vnode(c), c;
895
913
  }
896
914
  function j({ size: e, children: t }) {
897
915
  return /* @__PURE__ */ s("svg", {
@@ -908,7 +926,7 @@ function j({ size: e, children: t }) {
908
926
  children: t
909
927
  });
910
928
  }
911
- var Ft = ({ size: e }) => /* @__PURE__ */ s(j, {
929
+ var Ot = ({ size: e }) => /* @__PURE__ */ s(j, {
912
930
  size: e,
913
931
  children: [
914
932
  /* @__PURE__ */ s("path", { d: "M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z" }),
@@ -920,16 +938,23 @@ var Ft = ({ size: e }) => /* @__PURE__ */ s(j, {
920
938
  r: "2"
921
939
  })
922
940
  ]
923
- }), jt = ({ size: e }) => /* @__PURE__ */ s(j, {
941
+ }), Ut = ({ size: e }) => /* @__PURE__ */ s(j, {
924
942
  size: e,
925
943
  children: [/* @__PURE__ */ s("path", { d: "M5 12h14" }), /* @__PURE__ */ s("path", { d: "m12 5 7 7-7 7" })]
926
- }), xe = ({ size: e }) => /* @__PURE__ */ s(j, {
944
+ }), Ce = ({ size: e }) => /* @__PURE__ */ s(j, {
927
945
  size: e,
928
946
  children: [/* @__PURE__ */ s("path", { d: "M18 6 6 18" }), /* @__PURE__ */ s("path", { d: "m6 6 12 12" })]
929
- }), zn = ({ size: e }) => /* @__PURE__ */ s(j, {
947
+ }), Xe = ({ size: e }) => /* @__PURE__ */ s(j, {
948
+ size: e,
949
+ children: [
950
+ /* @__PURE__ */ s("path", { d: "M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719" }),
951
+ /* @__PURE__ */ s("path", { d: "m15 9-6 6" }),
952
+ /* @__PURE__ */ s("path", { d: "m9 9 6 6" })
953
+ ]
954
+ }), Ln = ({ size: e }) => /* @__PURE__ */ s(j, {
930
955
  size: e,
931
956
  children: /* @__PURE__ */ s("path", { d: "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" })
932
- }), Hn = ({ size: e }) => /* @__PURE__ */ s(j, {
957
+ }), Nn = ({ size: e }) => /* @__PURE__ */ s(j, {
933
958
  size: e,
934
959
  children: [/* @__PURE__ */ s("path", { d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5" }), /* @__PURE__ */ s("rect", {
935
960
  x: "2",
@@ -938,7 +963,7 @@ var Ft = ({ size: e }) => /* @__PURE__ */ s(j, {
938
963
  height: "12",
939
964
  rx: "2"
940
965
  })]
941
- }), Rn = ({ size: e }) => /* @__PURE__ */ s(j, {
966
+ }), On = ({ size: e }) => /* @__PURE__ */ s(j, {
942
967
  size: e,
943
968
  children: [
944
969
  /* @__PURE__ */ s("circle", {
@@ -949,23 +974,23 @@ var Ft = ({ size: e }) => /* @__PURE__ */ s(j, {
949
974
  /* @__PURE__ */ s("path", { d: "M12 16v-4" }),
950
975
  /* @__PURE__ */ s("path", { d: "M12 8h.01" })
951
976
  ]
952
- }), Bt = ({ size: e }) => /* @__PURE__ */ s(j, {
977
+ }), Yt = ({ size: e }) => /* @__PURE__ */ s(j, {
953
978
  size: e,
954
979
  children: /* @__PURE__ */ s("path", { d: "m6 9 6 6 6-6" })
955
- }), Pn = ({ size: e }) => /* @__PURE__ */ s(j, {
980
+ }), Un = ({ size: e }) => /* @__PURE__ */ s(j, {
956
981
  size: e,
957
982
  children: /* @__PURE__ */ s("path", { d: "M5 12h14" })
958
- }), Fn = ({ size: e }) => /* @__PURE__ */ s(j, {
983
+ }), Yn = ({ size: e }) => /* @__PURE__ */ s(j, {
959
984
  size: e,
960
985
  children: [/* @__PURE__ */ s("path", { d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z" }), /* @__PURE__ */ s("path", { d: "m21.854 2.147-10.94 10.939" })]
961
- }), jn = ({ size: e }) => /* @__PURE__ */ s(j, {
986
+ }), Gn = ({ size: e }) => /* @__PURE__ */ s(j, {
962
987
  size: e,
963
988
  children: [
964
989
  /* @__PURE__ */ s("path", { d: "M15 3h6v6" }),
965
990
  /* @__PURE__ */ s("path", { d: "M10 14 21 3" }),
966
991
  /* @__PURE__ */ s("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
967
992
  ]
968
- }), Bn = ({ size: e, d: t }) => /* @__PURE__ */ s("svg", {
993
+ }), Kn = ({ size: e, d: t }) => /* @__PURE__ */ s("svg", {
969
994
  xmlns: "http://www.w3.org/2000/svg",
970
995
  width: e,
971
996
  height: e,
@@ -974,19 +999,19 @@ var Ft = ({ size: e }) => /* @__PURE__ */ s(j, {
974
999
  "aria-hidden": "true",
975
1000
  children: /* @__PURE__ */ s("path", { d: t })
976
1001
  });
977
- function Dn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
1002
+ function Vn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
978
1003
  var a;
979
1004
  const u = e.config, { accentFill: d, accentText: c, rad: f } = t;
980
1005
  if (!r) return null;
981
- const p = !((a = u.cta) === null || a === void 0) && a.label.trim() ? u.cta : null, l = (p == null ? void 0 : p.href.trim()) || "", h = u.position === "bottom" ? { bottom: 0 } : { top: 0 };
1006
+ const h = !((a = u.cta) === null || a === void 0) && a.label.trim() ? u.cta : null, l = (h == null ? void 0 : h.href.trim()) || "", p = u.position === "bottom" ? { bottom: 0 } : { top: 0 };
982
1007
  return /* @__PURE__ */ s("div", {
983
- class: S(u, "strip", "uq-fixed uq-fade"),
1008
+ class: k(u, "strip", "uq-fixed uq-fade"),
984
1009
  role: "region",
985
1010
  "aria-label": "Announcement",
986
1011
  style: {
987
1012
  left: 0,
988
1013
  right: 0,
989
- ...h,
1014
+ ...p,
990
1015
  display: "flex",
991
1016
  alignItems: "center",
992
1017
  justifyContent: "center",
@@ -997,15 +1022,15 @@ function Dn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
997
1022
  },
998
1023
  children: [
999
1024
  /* @__PURE__ */ s("span", {
1000
- class: S(u, "text"),
1025
+ class: k(u, "text"),
1001
1026
  style: {
1002
1027
  fontSize: 12.5,
1003
1028
  fontWeight: 500
1004
1029
  },
1005
1030
  children: u.text
1006
1031
  }),
1007
- p && /* @__PURE__ */ s("a", {
1008
- class: S(u, "cta"),
1032
+ h && /* @__PURE__ */ s("a", {
1033
+ class: k(u, "cta"),
1009
1034
  href: l || "#",
1010
1035
  target: l ? "_blank" : void 0,
1011
1036
  rel: l ? "noopener noreferrer" : void 0,
@@ -1020,11 +1045,11 @@ function Dn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
1020
1045
  border: `1px solid ${c}`,
1021
1046
  whiteSpace: "nowrap"
1022
1047
  },
1023
- children: p.label
1048
+ children: h.label
1024
1049
  }),
1025
1050
  !i && /* @__PURE__ */ s("button", {
1026
1051
  type: "button",
1027
- class: S(u, "close"),
1052
+ class: k(u, "close"),
1028
1053
  onClick: () => o(!1),
1029
1054
  "aria-label": "Close",
1030
1055
  style: {
@@ -1039,38 +1064,150 @@ function Dn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
1039
1064
  justifyContent: "center",
1040
1065
  opacity: 0.7
1041
1066
  },
1042
- children: /* @__PURE__ */ s(xe, { size: 14 })
1067
+ children: /* @__PURE__ */ s(Ce, { size: 14 })
1043
1068
  })
1044
1069
  ]
1045
1070
  });
1046
1071
  }
1047
- var Ie = {
1072
+ var K = {
1073
+ panelWidth: 340,
1074
+ panelHeight: 480,
1075
+ launcherSize: 44,
1076
+ panelGap: 10
1077
+ }, v = {
1078
+ accent: "#7B5BFF",
1079
+ gradient: "linear-gradient(135deg,#00B2FF 0%,#006AFF 38%,#8E5BFF 100%)",
1080
+ blue: "#0084FF",
1081
+ surface: {
1082
+ light: "#ffffff",
1083
+ dark: "#242526"
1084
+ },
1085
+ bubble: {
1086
+ light: "#f5f5f5",
1087
+ dark: "#404040"
1088
+ },
1089
+ muted: {
1090
+ light: "#8e8e8e",
1091
+ dark: "#a8a8a8"
1092
+ },
1093
+ border: {
1094
+ light: "rgba(0,0,0,.1)",
1095
+ dark: "rgba(255,255,255,.12)"
1096
+ },
1097
+ panelWidth: 372,
1098
+ panelHeight: 520,
1099
+ panelRadius: 24,
1100
+ panelGap: 14,
1101
+ panelShadow: "0 8px 32px rgba(0,0,0,.16)",
1102
+ launcherSize: 60,
1103
+ launcherShadow: "0 6px 20px rgba(123,91,255,.4)",
1104
+ badgeSize: 20,
1105
+ logo: "M12 2C6.48 2 2 6.18 2 11.32c0 2.93 1.45 5.55 3.7 7.27v3.4l3.39-1.86a10.5 10.5 0 0 0 2.91.41c5.52 0 10-4.18 10-9.22S17.52 2 12 2Zm1.06 12.42-2.55-2.72-4.97 2.72 5.46-5.8 2.61 2.72 4.91-2.72-5.46 5.8Z",
1106
+ headerAvatar: 40,
1107
+ headerButton: 28,
1108
+ headerIcon: 18,
1109
+ nameFont: 15,
1110
+ avatarSize: 28,
1111
+ bubbleRadius: 18,
1112
+ bubbleFont: 14,
1113
+ bubblePadding: "6px 12px",
1114
+ bubbleMaxWidth: "78%",
1115
+ ctaShadow: "0 4px 12px rgba(123,91,255,.32)",
1116
+ composerPlaceholder: "Aa",
1117
+ composerRadius: 24,
1118
+ composerHeight: 36,
1119
+ sendSize: 36,
1120
+ sendIcon: 20
1121
+ }, He = {
1048
1122
  holdMs: 1260,
1049
1123
  gapMs: 1520,
1050
1124
  jitterMs: 100
1051
1125
  };
1052
- function Ln(e, t = Math.random) {
1126
+ function Xn(e, t = Math.random) {
1053
1127
  const n = [];
1054
1128
  let r = 0;
1055
1129
  for (let o = 0; o < e; o++) {
1056
- if (o === 0) r += Ie.holdMs;
1130
+ if (o === 0) r += He.holdMs;
1057
1131
  else {
1058
- const i = Math.round((t() * 2 - 1) * Ie.jitterMs);
1059
- r += Math.max(0, Ie.gapMs + i);
1132
+ const i = Math.round((t() * 2 - 1) * He.jitterMs);
1133
+ r += Math.max(0, He.gapMs + i);
1060
1134
  }
1061
1135
  n.push(r);
1062
1136
  }
1063
1137
  return n;
1064
1138
  }
1065
- function Wn(e, t, n, r) {
1066
- const [o, i] = E([]), [a, u] = E(!1), [d, c] = E(null), [f, p] = E(null), l = F(null), h = F(null), m = F([]), y = F(null), w = () => {
1067
- for (const v of m.current) window.clearTimeout(v);
1068
- m.current = [];
1139
+ var xe = (e) => `usereq:session:${e}`;
1140
+ function Jn(e, t = Date.now()) {
1141
+ const n = ae("localStorage", xe(e));
1142
+ if (!n) return null;
1143
+ try {
1144
+ const r = JSON.parse(n);
1145
+ if (typeof r != "object" || r === null || !("token" in r) || typeof r.token != "string" || !("conversationId" in r) || typeof r.conversationId != "string" || !("expiresAt" in r) || typeof r.expiresAt != "string") return null;
1146
+ const o = Date.parse(r.expiresAt);
1147
+ return !Number.isFinite(o) || o <= t ? (Pt("localStorage", xe(e)), null) : {
1148
+ token: r.token,
1149
+ conversationId: r.conversationId,
1150
+ expiresAt: r.expiresAt
1151
+ };
1152
+ } catch {
1153
+ return null;
1154
+ }
1155
+ }
1156
+ function Zn(e, t) {
1157
+ le("localStorage", xe(e), JSON.stringify(t));
1158
+ }
1159
+ function Qn(e) {
1160
+ Pt("localStorage", xe(e));
1161
+ }
1162
+ function er(e) {
1163
+ const t = e.parts.map((n) => n.text).filter((n) => n.trim());
1164
+ return t.length === 0 ? null : {
1165
+ id: e.id,
1166
+ role: e.role,
1167
+ parts: t,
1168
+ shown: t.length
1069
1169
  };
1070
- P(() => () => w(), []);
1071
- const _ = X(async () => {
1072
- if (l.current) return l.current;
1073
- const v = await Zt(e, {
1170
+ }
1171
+ function tr(e, t, n, r) {
1172
+ const [o, i] = E([]), [a, u] = E(!1), [d, c] = E(null), [f, h] = E(null), [l, p] = E(null), m = D(null), x = D(null), b = D([]), _ = D(null), g = () => {
1173
+ for (const S of b.current) window.clearTimeout(S);
1174
+ b.current = [];
1175
+ };
1176
+ P(() => () => g(), []);
1177
+ const y = t.id, $ = O(() => {
1178
+ m.current = null, h(null), Qn(y);
1179
+ }, [y]);
1180
+ P(() => {
1181
+ const S = Jn(y);
1182
+ if (!S) return;
1183
+ let C = !1;
1184
+ return m.current = {
1185
+ token: S.token,
1186
+ conversationId: S.conversationId
1187
+ }, h(S.conversationId), an(e, S.token).then((w) => {
1188
+ if (!C) {
1189
+ if (w.ended) {
1190
+ $();
1191
+ return;
1192
+ }
1193
+ i(w.messages.flatMap((T) => {
1194
+ const M = er(T);
1195
+ return M ? [M] : [];
1196
+ }));
1197
+ }
1198
+ }).catch((w) => {
1199
+ C || w instanceof V && w.status < 500 && $();
1200
+ }), () => {
1201
+ C = !0;
1202
+ };
1203
+ }, [
1204
+ e,
1205
+ y,
1206
+ $
1207
+ ]);
1208
+ const q = O(async () => {
1209
+ if (m.current) return m.current;
1210
+ const S = await sn(e, {
1074
1211
  kind: n.kind,
1075
1212
  id: n.id,
1076
1213
  widgetId: n.kind === "group" ? t.id : void 0,
@@ -1078,74 +1215,121 @@ function Wn(e, t, n, r) {
1078
1215
  referrer: r.referrer || void 0,
1079
1216
  utm: Object.keys(r.utm).length ? r.utm : void 0
1080
1217
  });
1081
- return l.current = {
1082
- token: v.token,
1083
- conversationId: v.conversationId
1084
- }, p(v.conversationId), l.current;
1218
+ return m.current = {
1219
+ token: S.token,
1220
+ conversationId: S.conversationId
1221
+ }, Zn(y, {
1222
+ token: S.token,
1223
+ conversationId: S.conversationId,
1224
+ expiresAt: S.expiresAt
1225
+ }), h(S.conversationId), m.current;
1085
1226
  }, [
1086
1227
  e,
1087
1228
  n.kind,
1088
1229
  n.id,
1089
1230
  t.id,
1090
- r
1091
- ]), g = X(async (v, k) => {
1092
- var x;
1093
- (x = h.current) === null || x === void 0 || x.abort();
1094
- const q = new AbortController();
1095
- h.current = q, w(), u(!0), c(null);
1231
+ r,
1232
+ y
1233
+ ]), z = O(async (S, C) => {
1234
+ var w;
1235
+ (w = x.current) === null || w === void 0 || w.abort();
1236
+ const T = new AbortController();
1237
+ x.current = T, g(), u(!0), c(null);
1096
1238
  try {
1097
- const { token: $ } = await _(), z = await Qt(e, $, v, k, q.signal);
1098
- if (q.signal.aborted) return;
1099
- const H = z.parts.filter((A) => A.trim());
1100
- if (H.length === 0) throw new Error("The agent did not answer. Try again.");
1101
- i((A) => [...A, {
1102
- id: z.id,
1239
+ const { token: M } = await q(), G = await cn(e, M, S, C, T.signal);
1240
+ if (T.signal.aborted) return;
1241
+ const F = G.parts.filter((W) => W.trim());
1242
+ if (F.length === 0) throw new Error("The agent did not answer. Try again.");
1243
+ i((W) => [...W, {
1244
+ id: G.id,
1103
1245
  role: "assistant",
1104
- parts: H,
1246
+ parts: F,
1105
1247
  shown: 0
1106
- }]), m.current = Ln(H.length).map((A, R) => window.setTimeout(() => {
1107
- i((D) => D.map((N) => N.id === z.id ? {
1108
- ...N,
1109
- shown: R + 1
1110
- } : N)), R === H.length - 1 && u(!1);
1111
- }, A));
1112
- } catch ($) {
1113
- if (q.signal.aborted) return;
1114
- $ instanceof ce && ($.status === 401 || $.status === 409) && (l.current = null), u(!1), c($ instanceof ce ? $.message : $ instanceof TypeError ? "Could not reach the agent. Try again." : $ instanceof Error && $.message ? $.message : "Something went wrong. Try again.");
1248
+ }]), b.current = Xn(F.length).map((W, ee) => window.setTimeout(() => {
1249
+ i((N) => N.map((B) => B.id === G.id ? {
1250
+ ...B,
1251
+ shown: ee + 1
1252
+ } : B)), ee === F.length - 1 && u(!1);
1253
+ }, W));
1254
+ } catch (M) {
1255
+ if (T.signal.aborted) return;
1256
+ M instanceof V && (M.status === 401 || M.status === 409) && $(), u(!1), c(M instanceof V ? M.message : M instanceof TypeError ? "Could not reach the agent. Try again." : M instanceof Error && M.message ? M.message : "Something went wrong. Try again.");
1115
1257
  }
1116
- }, [e, _]);
1258
+ }, [
1259
+ e,
1260
+ q,
1261
+ $
1262
+ ]);
1117
1263
  return {
1118
1264
  turns: o,
1119
1265
  busy: a,
1120
1266
  error: d,
1121
1267
  sessionId: f,
1122
- send: X((v) => {
1123
- const k = v.trim().slice(0, 4e3);
1124
- if (!k || a) return;
1125
- const x = {
1126
- id: Ne(),
1127
- text: k
1268
+ stopping: l,
1269
+ send: O((S) => {
1270
+ const C = S.trim().slice(0, 4e3);
1271
+ if (!C || a || l) return;
1272
+ const w = {
1273
+ id: Ve(),
1274
+ text: C
1128
1275
  };
1129
- y.current = x, i((q) => [...q, {
1130
- id: x.id,
1276
+ _.current = w, i((T) => [...T, {
1277
+ id: w.id,
1131
1278
  role: "user",
1132
- parts: [k],
1279
+ parts: [C],
1133
1280
  shown: 1
1134
- }]), g(x, "submit-message");
1135
- }, [a, g]),
1136
- retry: X(() => {
1137
- !y.current || a || g(y.current, "regenerate-message");
1138
- }, [a, g]),
1139
- stop: X(() => {
1140
- var v;
1141
- (v = h.current) === null || v === void 0 || v.abort(), h.current = null, w(), i((k) => k.map((x) => x.role === "assistant" && x.shown < x.parts.length ? {
1142
- ...x,
1143
- shown: x.parts.length
1144
- } : x)), u(!1);
1145
- }, [])
1281
+ }]), z(w, "submit-message");
1282
+ }, [
1283
+ a,
1284
+ l,
1285
+ z
1286
+ ]),
1287
+ retry: O(() => {
1288
+ !_.current || a || l || z(_.current, "regenerate-message");
1289
+ }, [
1290
+ a,
1291
+ l,
1292
+ z
1293
+ ]),
1294
+ stop: O(() => {
1295
+ var S;
1296
+ (S = x.current) === null || S === void 0 || S.abort(), x.current = null, g(), i((C) => C.map((w) => w.role === "assistant" && w.shown < w.parts.length ? {
1297
+ ...w,
1298
+ shown: w.parts.length
1299
+ } : w)), u(!1);
1300
+ }, []),
1301
+ askToStop: O(() => {
1302
+ !m.current || a || p({
1303
+ busy: !1,
1304
+ error: null
1305
+ });
1306
+ }, [a]),
1307
+ answerStop: O(async (S) => {
1308
+ const C = m.current;
1309
+ if (!S || !C) {
1310
+ p(null);
1311
+ return;
1312
+ }
1313
+ p({
1314
+ busy: !0,
1315
+ error: null
1316
+ });
1317
+ try {
1318
+ await ln(e, C.token);
1319
+ } catch (w) {
1320
+ if (!(w instanceof V && (w.status === 401 || w.status === 409))) {
1321
+ p({
1322
+ busy: !1,
1323
+ error: w instanceof V ? w.message : "Could not stop the conversation. Try again."
1324
+ });
1325
+ return;
1326
+ }
1327
+ }
1328
+ $(), _.current = null, i([]), c(null), p(null);
1329
+ }, [e, $])
1146
1330
  };
1147
1331
  }
1148
- function Nn() {
1332
+ function nr() {
1149
1333
  const e = "(max-width: 639px)", [t, n] = E(() => {
1150
1334
  var r, o, i;
1151
1335
  return (r = (o = (i = window).matchMedia) === null || o === void 0 ? void 0 : o.call(i, e).matches) !== null && r !== void 0 ? r : !1;
@@ -1158,9 +1342,9 @@ function Nn() {
1158
1342
  return i.addEventListener("change", a), () => i.removeEventListener("change", a);
1159
1343
  }, []), t;
1160
1344
  }
1161
- var On = 0.5, ut = 120, Me = () => document.documentElement.clientHeight;
1162
- function Dt({ look: e, pinned: t, onClose: n, children: r }) {
1163
- const [o, i] = E("half"), [a, u] = E(null), d = F(null), c = F(null), f = (_) => {
1345
+ var rr = 0.5, mt = 120, Re = () => document.documentElement.clientHeight;
1346
+ function Gt({ look: e, pinned: t, onClose: n, children: r }) {
1347
+ const [o, i] = E("half"), [a, u] = E(null), d = D(null), c = D(null), f = (_) => {
1164
1348
  const g = d.current;
1165
1349
  g && (_.currentTarget.setPointerCapture(_.pointerId), c.current = {
1166
1350
  startY: _.clientY,
@@ -1169,125 +1353,81 @@ function Dt({ look: e, pinned: t, onClose: n, children: r }) {
1169
1353
  lastAt: _.timeStamp,
1170
1354
  velocity: 0
1171
1355
  }, u(c.current.startHeight));
1172
- }, p = (_) => {
1356
+ }, h = (_) => {
1173
1357
  const g = c.current;
1174
1358
  if (!g) return;
1175
- const v = _.timeStamp - g.lastAt;
1176
- v > 0 && (g.velocity = (_.clientY - g.lastY) / v), g.lastY = _.clientY, g.lastAt = _.timeStamp;
1177
- const k = g.startHeight + (g.startY - _.clientY);
1178
- u(Math.max(ut, Math.min(Me(), k)));
1359
+ const y = _.timeStamp - g.lastAt;
1360
+ y > 0 && (g.velocity = (_.clientY - g.lastY) / y), g.lastY = _.clientY, g.lastAt = _.timeStamp;
1361
+ const $ = g.startHeight + (g.startY - _.clientY);
1362
+ u(Math.max(mt, Math.min(Re(), $)));
1179
1363
  }, l = () => {
1180
1364
  const _ = c.current;
1181
1365
  if (!_) return;
1182
1366
  c.current = null;
1183
- const g = Math.max(ut, Math.min(Me(), _.startHeight + (_.startY - _.lastY))), v = Me();
1184
- let k;
1185
- if (_.velocity < -0.5 ? k = "full" : _.velocity > On ? k = o === "full" ? "half" : "closed" : g > v * 0.75 ? k = "full" : g < v * 0.3 ? k = "closed" : k = "half", u(null), k === "closed") {
1367
+ const g = Math.max(mt, Math.min(Re(), _.startHeight + (_.startY - _.lastY))), y = Re();
1368
+ let $;
1369
+ if (_.velocity < -0.5 ? $ = "full" : _.velocity > rr ? $ = o === "full" ? "half" : "closed" : g > y * 0.75 ? $ = "full" : g < y * 0.3 ? $ = "closed" : $ = "half", u(null), $ === "closed") {
1186
1370
  t ? i("half") : n();
1187
1371
  return;
1188
1372
  }
1189
- i(k);
1190
- }, { ink: h, surfaceBg: m, rad: y } = e, w = o === "full" && a === null;
1373
+ i($);
1374
+ }, { ink: p, surfaceBg: m, rad: x } = e, b = o === "full" && a === null;
1191
1375
  return /* @__PURE__ */ s("div", {
1192
1376
  ref: d,
1193
1377
  class: [
1194
1378
  "uq-fixed uq-drawer uq-slide",
1195
- w ? "uq-drawer-full" : "uq-drawer-half",
1379
+ b ? "uq-drawer-full" : "uq-drawer-half",
1196
1380
  a !== null && "uq-drawer-held"
1197
1381
  ].filter(Boolean).join(" "),
1198
1382
  role: "dialog",
1199
1383
  "aria-modal": "false",
1200
1384
  style: {
1201
1385
  height: a !== null ? a : void 0,
1202
- borderRadius: w ? 0 : `${y}px ${y}px 0 0`,
1203
- borderTop: `1px solid rgba(${h},.12)`,
1386
+ borderRadius: b ? 0 : `${x}px ${x}px 0 0`,
1387
+ borderTop: `1px solid rgba(${p},.12)`,
1204
1388
  background: m,
1205
1389
  boxShadow: "0 -12px 40px rgba(0,0,0,.18)"
1206
1390
  },
1207
1391
  children: [/* @__PURE__ */ s("div", {
1208
1392
  class: "uq-grab",
1209
1393
  onPointerDown: f,
1210
- onPointerMove: p,
1394
+ onPointerMove: h,
1211
1395
  onPointerUp: l,
1212
1396
  onPointerCancel: l,
1213
- "aria-label": w ? "Drag down to shrink or close" : "Drag up to expand",
1397
+ "aria-label": b ? "Drag down to shrink or close" : "Drag up to expand",
1214
1398
  style: { background: m },
1215
- children: /* @__PURE__ */ s("span", { style: { background: `rgba(${h},.25)` } })
1399
+ children: /* @__PURE__ */ s("span", { style: { background: `rgba(${p},.25)` } })
1216
1400
  }), r]
1217
1401
  });
1218
1402
  }
1219
- var b = {
1220
- accent: "#7B5BFF",
1221
- gradient: "linear-gradient(135deg,#00B2FF 0%,#006AFF 38%,#8E5BFF 100%)",
1222
- blue: "#0084FF",
1223
- surface: {
1224
- light: "#ffffff",
1225
- dark: "#242526"
1226
- },
1227
- bubble: {
1228
- light: "#f5f5f5",
1229
- dark: "#404040"
1230
- },
1231
- muted: {
1232
- light: "#8e8e8e",
1233
- dark: "#a8a8a8"
1234
- },
1235
- border: {
1236
- light: "rgba(0,0,0,.1)",
1237
- dark: "rgba(255,255,255,.12)"
1238
- },
1239
- panelWidth: 372,
1240
- panelHeight: 520,
1241
- panelRadius: 24,
1242
- panelGap: 14,
1243
- panelShadow: "0 8px 32px rgba(0,0,0,.16)",
1244
- launcherSize: 60,
1245
- launcherShadow: "0 6px 20px rgba(123,91,255,.4)",
1246
- badgeSize: 20,
1247
- logo: "M12 2C6.48 2 2 6.18 2 11.32c0 2.93 1.45 5.55 3.7 7.27v3.4l3.39-1.86a10.5 10.5 0 0 0 2.91.41c5.52 0 10-4.18 10-9.22S17.52 2 12 2Zm1.06 12.42-2.55-2.72-4.97 2.72 5.46-5.8 2.61 2.72 4.91-2.72-5.46 5.8Z",
1248
- headerAvatar: 40,
1249
- headerButton: 28,
1250
- headerIcon: 18,
1251
- nameFont: 15,
1252
- avatarSize: 28,
1253
- bubbleRadius: 18,
1254
- bubbleFont: 14,
1255
- bubblePadding: "6px 12px",
1256
- bubbleMaxWidth: "78%",
1257
- ctaShadow: "0 4px 12px rgba(123,91,255,.32)",
1258
- composerPlaceholder: "Aa",
1259
- composerRadius: 24,
1260
- composerHeight: 36,
1261
- sendSize: 36,
1262
- sendIcon: 20
1263
- }, Yn = 3600, Oe = (e) => e.welcome || "Hi! Ask me anything before you buy.";
1264
- function Lt(e, t = "Type your message…") {
1403
+ var ir = 3600, Je = (e) => e.welcome || "Hi! Ask me anything before you buy.";
1404
+ function Kt(e, t = "Type your message…") {
1265
1405
  const n = e.spotlights.filter((a) => a.trim()), [r, o] = E(0);
1266
1406
  P(() => {
1267
1407
  if (n.length < 2) return;
1268
- const a = window.setInterval(() => o((u) => u + 1), Yn);
1408
+ const a = window.setInterval(() => o((u) => u + 1), ir);
1269
1409
  return () => window.clearInterval(a);
1270
1410
  }, [n.length]);
1271
1411
  const i = e.placeholder || t;
1272
1412
  return n.length ? n[r % n.length] : i;
1273
1413
  }
1274
- function we(e) {
1275
- const t = F(null);
1414
+ function qe(e) {
1415
+ const t = D(null);
1276
1416
  return P(() => {
1277
1417
  const n = t.current;
1278
1418
  n && (n.scrollTop = n.scrollHeight);
1279
1419
  }, e), t;
1280
1420
  }
1281
- function Wt(e) {
1421
+ function Vt(e) {
1282
1422
  const t = e ? "dark" : "light";
1283
1423
  return {
1284
- surface: b.surface[t],
1285
- bubble: b.bubble[t],
1286
- muted: b.muted[t],
1287
- border: b.border[t]
1424
+ surface: v.surface[t],
1425
+ bubble: v.bubble[t],
1426
+ muted: v.muted[t],
1427
+ border: v.border[t]
1288
1428
  };
1289
1429
  }
1290
- var Y = (e, t = {}) => ({
1430
+ var J = (e, t = {}) => ({
1291
1431
  width: e,
1292
1432
  height: e,
1293
1433
  borderRadius: "50%",
@@ -1297,7 +1437,7 @@ var Y = (e, t = {}) => ({
1297
1437
  flexShrink: 0,
1298
1438
  ...t
1299
1439
  });
1300
- function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1440
+ function Ze({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1301
1441
  var i, a, u, d;
1302
1442
  const c = (i = (a = e.agent) === null || a === void 0 ? void 0 : a.name) !== null && i !== void 0 ? i : null, f = (u = (d = e.agent) === null || d === void 0 ? void 0 : d.avatarUrl) !== null && u !== void 0 ? u : null;
1303
1443
  return f ? /* @__PURE__ */ s("img", {
@@ -1305,9 +1445,9 @@ function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1305
1445
  alt: "",
1306
1446
  width: t,
1307
1447
  height: t,
1308
- style: Y(t, { objectFit: "cover" })
1448
+ style: J(t, { objectFit: "cover" })
1309
1449
  }) : /* @__PURE__ */ s("span", {
1310
- style: Y(t, {
1450
+ style: J(t, {
1311
1451
  background: r.bubble,
1312
1452
  color: r.muted,
1313
1453
  fontSize: n,
@@ -1317,7 +1457,7 @@ function Ye({ payload: e, size: t, font: n, palette: r, fallback: o }) {
1317
1457
  children: c ? c.trim().charAt(0).toUpperCase() : "A"
1318
1458
  });
1319
1459
  }
1320
- function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, palette: a, children: u }) {
1460
+ function Ee({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, palette: a, children: u }) {
1321
1461
  return /* @__PURE__ */ s("div", {
1322
1462
  class: "uq-rise",
1323
1463
  style: {
@@ -1327,23 +1467,23 @@ function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, pal
1327
1467
  justifyContent: t ? "flex-end" : "flex-start",
1328
1468
  marginTop: n ? 6 : 2
1329
1469
  },
1330
- children: [!t && (n ? /* @__PURE__ */ s(Ye, {
1470
+ children: [!t && (n ? /* @__PURE__ */ s(Ze, {
1331
1471
  payload: i,
1332
- size: b.avatarSize,
1472
+ size: v.avatarSize,
1333
1473
  font: 12,
1334
1474
  palette: a
1335
1475
  }) : /* @__PURE__ */ s("span", { style: {
1336
- width: b.avatarSize,
1476
+ width: v.avatarSize,
1337
1477
  flexShrink: 0
1338
1478
  } })), /* @__PURE__ */ s("div", {
1339
- class: S(o, t ? "userMessage" : "botMessage"),
1479
+ class: k(o, t ? "userMessage" : "botMessage"),
1340
1480
  style: {
1341
- maxWidth: b.bubbleMaxWidth,
1342
- padding: u ? "8px 12px" : b.bubblePadding,
1343
- borderRadius: b.bubbleRadius,
1344
- background: t ? b.gradient : a.bubble,
1481
+ maxWidth: v.bubbleMaxWidth,
1482
+ padding: u ? "8px 12px" : v.bubblePadding,
1483
+ borderRadius: v.bubbleRadius,
1484
+ background: t ? v.gradient : a.bubble,
1345
1485
  color: t ? "#fff" : `rgb(${r.ink})`,
1346
- fontSize: b.bubbleFont,
1486
+ fontSize: v.bubbleFont,
1347
1487
  lineHeight: 1.375,
1348
1488
  whiteSpace: "pre-wrap",
1349
1489
  overflowWrap: "anywhere"
@@ -1352,72 +1492,131 @@ function dt({ text: e, mine: t, runStart: n, look: r, config: o, payload: i, pal
1352
1492
  })]
1353
1493
  });
1354
1494
  }
1355
- function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobile: a, fill: u = !1, onMinimize: d, onClose: c }) {
1356
- var f, p, l, h;
1357
- const m = Wt(n.hostDark), { surface: y, bubble: w, muted: _, border: g } = m, v = Lt(t, b.composerPlaceholder), k = (f = (p = e.agent) === null || p === void 0 ? void 0 : p.name) !== null && f !== void 0 ? f : null, x = !!(!((l = e.agent) === null || l === void 0) && l.live), q = we([
1495
+ function or({ chat: e, stopping: t }) {
1496
+ const n = {
1497
+ padding: "6px 12px",
1498
+ borderRadius: 999,
1499
+ fontSize: 13,
1500
+ fontWeight: 600,
1501
+ lineHeight: 1.3,
1502
+ opacity: t.busy ? 0.6 : 1
1503
+ };
1504
+ return /* @__PURE__ */ s("div", {
1505
+ class: "uq-stop",
1506
+ style: {
1507
+ display: "flex",
1508
+ flexDirection: "column",
1509
+ gap: 8
1510
+ },
1511
+ children: [
1512
+ /* @__PURE__ */ s("span", {
1513
+ style: { fontWeight: 600 },
1514
+ children: "Stop the conversation?"
1515
+ }),
1516
+ /* @__PURE__ */ s("span", { children: "Do you want to stop this conversation?" }),
1517
+ /* @__PURE__ */ s("div", {
1518
+ style: {
1519
+ display: "flex",
1520
+ gap: 6,
1521
+ flexWrap: "wrap"
1522
+ },
1523
+ children: [/* @__PURE__ */ s("button", {
1524
+ type: "button",
1525
+ onClick: () => e.answerStop(!1),
1526
+ disabled: t.busy,
1527
+ style: {
1528
+ ...n,
1529
+ border: `1px solid ${v.blue}`,
1530
+ color: v.blue
1531
+ },
1532
+ children: "Keep chatting"
1533
+ }), /* @__PURE__ */ s("button", {
1534
+ type: "button",
1535
+ onClick: () => e.answerStop(!0),
1536
+ disabled: t.busy,
1537
+ style: {
1538
+ ...n,
1539
+ background: v.gradient,
1540
+ color: "#fff"
1541
+ },
1542
+ children: t.busy ? "Stopping…" : "Stop conversation"
1543
+ })]
1544
+ }),
1545
+ t.error && /* @__PURE__ */ s("span", {
1546
+ class: "uq-fade",
1547
+ style: { opacity: 0.7 },
1548
+ children: t.error
1549
+ })
1550
+ ]
1551
+ });
1552
+ }
1553
+ function bt({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobile: a, fill: u = !1, onMinimize: d, onClose: c }) {
1554
+ var f, h, l, p;
1555
+ const m = Vt(n.hostDark), { surface: x, bubble: b, muted: _, border: g } = m, y = Kt(t, v.composerPlaceholder), $ = (f = (h = e.agent) === null || h === void 0 ? void 0 : h.name) !== null && f !== void 0 ? f : null, q = !!(!((l = e.agent) === null || l === void 0) && l.live), z = qe([
1358
1556
  r.turns,
1359
1557
  r.busy,
1360
- r.error
1361
- ]), [$, z] = E(""), H = F(null);
1558
+ r.error,
1559
+ r.stopping
1560
+ ]), [S, C] = E(""), w = D(null);
1362
1561
  P(() => {
1363
- var I;
1364
- o > 0 && ((I = H.current) === null || I === void 0 || I.focus());
1562
+ var A;
1563
+ o > 0 && ((A = w.current) === null || A === void 0 || A.focus());
1365
1564
  }, [o]);
1366
- const A = (I) => {
1367
- I.preventDefault(), x && (r.send($), z(""));
1368
- }, R = !((h = t.cta) === null || h === void 0 || (h = h.href) === null || h === void 0) && h.trim() ? t.cta : null, D = [{
1565
+ const T = q && !r.stopping, M = (A) => {
1566
+ A.preventDefault(), T && (r.send(S), C(""));
1567
+ }, G = !((p = t.cta) === null || p === void 0 || (p = p.href) === null || p === void 0) && p.trim() ? t.cta : null, F = [{
1369
1568
  key: "welcome",
1370
- text: Oe(t),
1569
+ text: Je(t),
1371
1570
  mine: !1
1372
1571
  }];
1373
- for (const I of r.turns) if (I.role === "user") {
1374
- var N;
1375
- D.push({
1376
- key: I.id,
1377
- text: (N = I.parts[0]) !== null && N !== void 0 ? N : "",
1572
+ for (const A of r.turns) if (A.role === "user") {
1573
+ var W;
1574
+ F.push({
1575
+ key: A.id,
1576
+ text: (W = A.parts[0]) !== null && W !== void 0 ? W : "",
1378
1577
  mine: !0
1379
1578
  });
1380
- } else I.parts.slice(0, I.shown).forEach((G, ke) => {
1381
- D.push({
1382
- key: `${I.id}:${ke}`,
1383
- text: G,
1579
+ } else A.parts.slice(0, A.shown).forEach((Q, Ie) => {
1580
+ F.push({
1581
+ key: `${A.id}:${Ie}`,
1582
+ text: Q,
1384
1583
  mine: !1
1385
1584
  });
1386
1585
  });
1387
- const Gt = D[D.length - 1], V = (I, G, ke, Se, Ge) => /* @__PURE__ */ s("button", {
1586
+ const ee = F[F.length - 1], N = (A, Q, Ie, Te, et) => /* @__PURE__ */ s("button", {
1388
1587
  type: "button",
1389
- class: Ge ? S(t, Ge) : void 0,
1390
- onClick: Se,
1391
- disabled: !Se,
1392
- "aria-label": G,
1393
- style: Y(a ? 36 : b.headerButton, {
1394
- color: ke,
1395
- opacity: Se ? 1 : 0.6
1588
+ class: et ? k(t, et) : void 0,
1589
+ onClick: Te,
1590
+ disabled: !Te,
1591
+ "aria-label": Q,
1592
+ style: J(a ? 36 : v.headerButton, {
1593
+ color: Ie,
1594
+ opacity: Te ? 1 : 0.6
1396
1595
  }),
1397
- children: I
1398
- }), K = b.headerIcon;
1596
+ children: A
1597
+ }), B = v.headerIcon;
1399
1598
  return /* @__PURE__ */ s("div", {
1400
- class: S(t, "panel"),
1599
+ class: k(t, "panel"),
1401
1600
  style: {
1402
1601
  display: "flex",
1403
1602
  flexDirection: "column",
1404
- borderRadius: u ? 0 : b.panelRadius,
1603
+ borderRadius: u ? 0 : v.panelRadius,
1405
1604
  overflow: "hidden",
1406
1605
  border: u ? void 0 : `1px solid ${g}`,
1407
- boxShadow: u ? void 0 : b.panelShadow,
1408
- background: y,
1606
+ boxShadow: u ? void 0 : v.panelShadow,
1607
+ background: x,
1409
1608
  color: `rgb(${n.ink})`,
1410
1609
  ...u ? {
1411
1610
  flex: 1,
1412
1611
  minHeight: 0
1413
1612
  } : {
1414
- height: b.panelHeight,
1415
- maxHeight: `calc(100vh - ${n.offsetY + b.launcherSize + b.panelGap + 12}px)`
1613
+ height: v.panelHeight,
1614
+ maxHeight: `calc(100vh - ${n.offsetY + v.launcherSize + v.panelGap + 12}px)`
1416
1615
  }
1417
1616
  },
1418
1617
  children: [
1419
1618
  /* @__PURE__ */ s("div", {
1420
- class: S(t, "header"),
1619
+ class: k(t, "header"),
1421
1620
  style: {
1422
1621
  display: "flex",
1423
1622
  alignItems: "center",
@@ -1426,9 +1625,9 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1426
1625
  borderBottom: `1px solid ${g}`
1427
1626
  },
1428
1627
  children: [
1429
- /* @__PURE__ */ s(Ye, {
1628
+ /* @__PURE__ */ s(Ze, {
1430
1629
  payload: e,
1431
- size: b.headerAvatar,
1630
+ size: v.headerAvatar,
1432
1631
  font: 14,
1433
1632
  palette: m
1434
1633
  }),
@@ -1442,31 +1641,32 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1442
1641
  },
1443
1642
  children: [/* @__PURE__ */ s("span", {
1444
1643
  style: {
1445
- fontSize: b.nameFont,
1644
+ fontSize: v.nameFont,
1446
1645
  fontWeight: 600,
1447
1646
  overflow: "hidden",
1448
1647
  textOverflow: "ellipsis",
1449
1648
  whiteSpace: "nowrap"
1450
1649
  },
1451
- children: k ? k.split("—")[0].trim() : "Chat"
1650
+ children: $ ? $.split("—")[0].trim() : "Chat"
1452
1651
  }), /* @__PURE__ */ s("span", {
1453
1652
  style: {
1454
1653
  color: _,
1455
1654
  opacity: 0.7,
1456
1655
  display: "flex"
1457
1656
  },
1458
- children: /* @__PURE__ */ s(Bt, { size: 16 })
1657
+ children: /* @__PURE__ */ s(Yt, { size: 16 })
1459
1658
  })]
1460
1659
  }),
1461
- V(/* @__PURE__ */ s(zn, { size: K }), "Call (unavailable)", b.blue),
1462
- V(/* @__PURE__ */ s(Hn, { size: K }), "Video call (unavailable)", b.blue),
1463
- V(/* @__PURE__ */ s(Rn, { size: K }), "Details (unavailable)", _),
1464
- d && V(/* @__PURE__ */ s(Pn, { size: K }), "Minimize chat", _, d),
1465
- c && V(/* @__PURE__ */ s(xe, { size: K }), "Close chat", _, c, "close")
1660
+ N(/* @__PURE__ */ s(Ln, { size: B }), "Call (unavailable)", v.blue),
1661
+ N(/* @__PURE__ */ s(Nn, { size: B }), "Video call (unavailable)", v.blue),
1662
+ N(/* @__PURE__ */ s(On, { size: B }), "Details (unavailable)", _),
1663
+ r.sessionId && N(/* @__PURE__ */ s(Xe, { size: B }), "Stop conversation", _, r.busy || r.stopping ? void 0 : r.askToStop, "stopButton"),
1664
+ d && N(/* @__PURE__ */ s(Un, { size: B }), "Minimize chat", _, d),
1665
+ c && N(/* @__PURE__ */ s(Ce, { size: B }), "Close chat", _, c, "close")
1466
1666
  ]
1467
1667
  }),
1468
1668
  /* @__PURE__ */ s("div", {
1469
- ref: q,
1669
+ ref: z,
1470
1670
  style: {
1471
1671
  flex: 1,
1472
1672
  minHeight: 0,
@@ -1477,18 +1677,30 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1477
1677
  overscrollBehavior: "contain"
1478
1678
  },
1479
1679
  children: [
1480
- D.map((I, G) => /* @__PURE__ */ s(dt, {
1481
- text: I.text,
1482
- mine: I.mine,
1483
- runStart: G === 0 || D[G - 1].mine !== I.mine,
1680
+ F.map((A, Q) => /* @__PURE__ */ s(Ee, {
1681
+ text: A.text,
1682
+ mine: A.mine,
1683
+ runStart: Q === 0 || F[Q - 1].mine !== A.mine,
1484
1684
  look: n,
1485
1685
  config: t,
1486
1686
  payload: e,
1487
1687
  palette: m
1488
- }, I.key)),
1489
- r.busy && /* @__PURE__ */ s(dt, {
1688
+ }, A.key)),
1689
+ r.stopping && /* @__PURE__ */ s(Ee, {
1490
1690
  mine: !1,
1491
- runStart: Gt.mine,
1691
+ runStart: ee.mine,
1692
+ look: n,
1693
+ config: t,
1694
+ payload: e,
1695
+ palette: m,
1696
+ children: /* @__PURE__ */ s(or, {
1697
+ chat: r,
1698
+ stopping: r.stopping
1699
+ })
1700
+ }),
1701
+ r.busy && /* @__PURE__ */ s(Ee, {
1702
+ mine: !1,
1703
+ runStart: ee.mine,
1492
1704
  look: n,
1493
1705
  config: t,
1494
1706
  payload: e,
@@ -1519,7 +1731,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1519
1731
  display: "flex",
1520
1732
  gap: 8,
1521
1733
  marginTop: 6,
1522
- paddingLeft: b.avatarSize + 6,
1734
+ paddingLeft: v.avatarSize + 6,
1523
1735
  fontSize: 12,
1524
1736
  color: _
1525
1737
  },
@@ -1527,7 +1739,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1527
1739
  type: "button",
1528
1740
  onClick: r.retry,
1529
1741
  style: {
1530
- color: b.blue,
1742
+ color: v.blue,
1531
1743
  fontWeight: 500,
1532
1744
  textDecoration: "underline"
1533
1745
  },
@@ -1536,7 +1748,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1536
1748
  })
1537
1749
  ]
1538
1750
  }),
1539
- R && /* @__PURE__ */ s("div", {
1751
+ G && /* @__PURE__ */ s("div", {
1540
1752
  style: {
1541
1753
  display: "flex",
1542
1754
  justifyContent: "flex-end",
@@ -1544,7 +1756,7 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1544
1756
  },
1545
1757
  children: /* @__PURE__ */ s("a", {
1546
1758
  class: "uq-cta",
1547
- href: R.href,
1759
+ href: G.href,
1548
1760
  target: "_blank",
1549
1761
  rel: "noopener noreferrer",
1550
1762
  onClick: i,
@@ -1554,18 +1766,18 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1554
1766
  gap: 6,
1555
1767
  padding: "8px 16px",
1556
1768
  borderRadius: 999,
1557
- background: b.gradient,
1769
+ background: v.gradient,
1558
1770
  color: "#fff",
1559
1771
  fontSize: 14,
1560
1772
  fontWeight: 600,
1561
- boxShadow: b.ctaShadow
1773
+ boxShadow: v.ctaShadow
1562
1774
  },
1563
- children: [R.label || "Learn more", /* @__PURE__ */ s(jn, { size: 16 })]
1775
+ children: [G.label || "Learn more", /* @__PURE__ */ s(Gn, { size: 16 })]
1564
1776
  })
1565
1777
  }),
1566
1778
  /* @__PURE__ */ s("form", {
1567
- class: S(t, "composer"),
1568
- onSubmit: A,
1779
+ class: k(t, "composer"),
1780
+ onSubmit: M,
1569
1781
  style: {
1570
1782
  display: "flex",
1571
1783
  alignItems: "center",
@@ -1574,31 +1786,31 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1574
1786
  borderTop: `1px solid ${g}`
1575
1787
  },
1576
1788
  children: [/* @__PURE__ */ s("input", {
1577
- ref: H,
1789
+ ref: w,
1578
1790
  type: "text",
1579
- value: $,
1580
- onInput: (I) => z(I.target.value),
1581
- placeholder: v,
1582
- disabled: !x,
1791
+ value: S,
1792
+ onInput: (A) => C(A.target.value),
1793
+ placeholder: y,
1794
+ disabled: !T,
1583
1795
  maxLength: 4e3,
1584
1796
  "aria-label": "Message",
1585
1797
  autoComplete: "off",
1586
1798
  style: {
1587
1799
  flex: 1,
1588
- minHeight: b.composerHeight,
1800
+ minHeight: v.composerHeight,
1589
1801
  padding: "0 12px",
1590
- borderRadius: b.composerRadius,
1591
- background: w,
1802
+ borderRadius: v.composerRadius,
1803
+ background: b,
1592
1804
  color: `rgb(${n.ink})`,
1593
1805
  fontSize: a ? 16 : 14,
1594
1806
  "--uq-placeholder": _
1595
1807
  }
1596
1808
  }), r.busy ? /* @__PURE__ */ s("button", {
1597
1809
  type: "button",
1598
- class: S(t, "sendButton"),
1810
+ class: k(t, "sendButton"),
1599
1811
  onClick: r.stop,
1600
1812
  "aria-label": "Stop",
1601
- style: Y(b.sendSize, { color: b.blue }),
1813
+ style: J(v.sendSize, { color: v.blue }),
1602
1814
  children: /* @__PURE__ */ s("span", { style: {
1603
1815
  width: 10,
1604
1816
  height: 10,
@@ -1607,32 +1819,32 @@ function ft({ payload: e, config: t, look: n, chat: r, focus: o, onCta: i, mobil
1607
1819
  } })
1608
1820
  }) : /* @__PURE__ */ s("button", {
1609
1821
  type: "submit",
1610
- class: S(t, "sendButton"),
1611
- disabled: !x || !$.trim(),
1822
+ class: k(t, "sendButton"),
1823
+ disabled: !T || !S.trim(),
1612
1824
  "aria-label": "Send",
1613
- style: Y(b.sendSize, {
1614
- color: b.blue,
1615
- opacity: x && $.trim() ? 1 : 0.5
1825
+ style: J(v.sendSize, {
1826
+ color: v.blue,
1827
+ opacity: T && S.trim() ? 1 : 0.5
1616
1828
  }),
1617
- children: /* @__PURE__ */ s(Fn, { size: b.sendIcon })
1829
+ children: /* @__PURE__ */ s(Yn, { size: v.sendIcon })
1618
1830
  })]
1619
1831
  })
1620
1832
  ]
1621
1833
  });
1622
1834
  }
1623
- function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open: a, setOpen: u, pinned: d, onCta: c }) {
1624
- const f = Wt(n.hostDark), { side: p, offsetY: l } = n, h = d ? void 0 : () => u(!1);
1835
+ function sr({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open: a, setOpen: u, pinned: d, onCta: c }) {
1836
+ const f = Vt(n.hostDark), { side: h, offsetY: l } = n, p = d ? void 0 : () => u(!1);
1625
1837
  if (a && o) {
1626
1838
  const m = {
1627
1839
  ...n,
1628
1840
  surfaceBg: f.surface,
1629
- rad: b.panelRadius
1841
+ rad: v.panelRadius
1630
1842
  };
1631
- return /* @__PURE__ */ s(Dt, {
1843
+ return /* @__PURE__ */ s(Gt, {
1632
1844
  look: m,
1633
1845
  pinned: d,
1634
1846
  onClose: () => u(!1),
1635
- children: /* @__PURE__ */ s(ft, {
1847
+ children: /* @__PURE__ */ s(bt, {
1636
1848
  payload: e,
1637
1849
  config: t,
1638
1850
  look: n,
@@ -1641,18 +1853,18 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1641
1853
  onCta: c,
1642
1854
  mobile: !0,
1643
1855
  fill: !0,
1644
- onClose: h
1856
+ onClose: p
1645
1857
  })
1646
1858
  });
1647
1859
  }
1648
- return /* @__PURE__ */ s(W, { children: [a && /* @__PURE__ */ s("div", {
1860
+ return /* @__PURE__ */ s(Y, { children: [a && /* @__PURE__ */ s("div", {
1649
1861
  class: "uq-fixed uq-rise",
1650
1862
  style: {
1651
- bottom: l + b.launcherSize + b.panelGap,
1652
- width: b.panelWidth,
1653
- ...p
1863
+ bottom: l + v.launcherSize + v.panelGap,
1864
+ width: v.panelWidth,
1865
+ ...h
1654
1866
  },
1655
- children: /* @__PURE__ */ s(ft, {
1867
+ children: /* @__PURE__ */ s(bt, {
1656
1868
  payload: e,
1657
1869
  config: t,
1658
1870
  look: n,
@@ -1660,12 +1872,12 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1660
1872
  focus: i,
1661
1873
  onCta: c,
1662
1874
  mobile: !1,
1663
- onMinimize: h,
1664
- onClose: h
1875
+ onMinimize: p,
1876
+ onClose: p
1665
1877
  })
1666
1878
  }), /* @__PURE__ */ s("button", {
1667
1879
  type: "button",
1668
- class: S(t, "launcher", "uq-fixed"),
1880
+ class: k(t, "launcher", "uq-fixed"),
1669
1881
  "aria-label": a ? "Close chat" : "Open chat",
1670
1882
  "aria-expanded": a,
1671
1883
  onClick: () => {
@@ -1673,16 +1885,16 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1673
1885
  },
1674
1886
  style: {
1675
1887
  bottom: l,
1676
- ...Y(b.launcherSize, { boxShadow: b.launcherShadow }),
1677
- ...p
1888
+ ...J(v.launcherSize, { boxShadow: v.launcherShadow }),
1889
+ ...h
1678
1890
  },
1679
- children: [/* @__PURE__ */ s(Ye, {
1891
+ children: [/* @__PURE__ */ s(Ze, {
1680
1892
  payload: e,
1681
- size: b.launcherSize,
1893
+ size: v.launcherSize,
1682
1894
  font: 16,
1683
1895
  palette: f,
1684
1896
  fallback: {
1685
- background: b.gradient,
1897
+ background: v.gradient,
1686
1898
  color: "#fff"
1687
1899
  }
1688
1900
  }), a ? /* @__PURE__ */ s("span", {
@@ -1696,29 +1908,29 @@ function Un({ payload: e, config: t, look: n, chat: r, mobile: o, focus: i, open
1696
1908
  justifyContent: "center",
1697
1909
  color: "#fff"
1698
1910
  },
1699
- children: /* @__PURE__ */ s(Bt, { size: 28 })
1911
+ children: /* @__PURE__ */ s(Yt, { size: 28 })
1700
1912
  }) : /* @__PURE__ */ s("span", {
1701
1913
  style: {
1702
1914
  position: "absolute",
1703
1915
  right: -4,
1704
1916
  bottom: -4,
1705
- ...Y(b.badgeSize, {
1706
- background: b.accent,
1917
+ ...J(v.badgeSize, {
1918
+ background: v.accent,
1707
1919
  color: "#fff",
1708
1920
  boxShadow: `0 0 0 2px ${f.surface}`
1709
1921
  })
1710
1922
  },
1711
- children: /* @__PURE__ */ s(Bn, {
1923
+ children: /* @__PURE__ */ s(Kn, {
1712
1924
  size: 12,
1713
- d: b.logo
1925
+ d: v.logo
1714
1926
  })
1715
1927
  })]
1716
1928
  })] });
1717
1929
  }
1718
- function le({ text: e, mine: t, onDark: n, look: r, config: o, children: i }) {
1719
- const a = ye(n), { isGlass: u, accentFill: d, accentText: c, rad: f } = r;
1930
+ function ne({ text: e, mine: t, onDark: n, look: r, config: o, children: i }) {
1931
+ const a = ce(n), { isGlass: u, accentFill: d, accentText: c, rad: f } = r;
1720
1932
  return /* @__PURE__ */ s("div", {
1721
- class: S(o, t ? "userMessage" : "botMessage", "uq-rise"),
1933
+ class: k(o, t ? "userMessage" : "botMessage", "uq-rise"),
1722
1934
  style: {
1723
1935
  alignSelf: t ? "flex-end" : "flex-start",
1724
1936
  maxWidth: t ? "78%" : "84%",
@@ -1736,7 +1948,7 @@ function le({ text: e, mine: t, onDark: n, look: r, config: o, children: i }) {
1736
1948
  children: i != null ? i : e
1737
1949
  });
1738
1950
  }
1739
- var Gn = (e) => /* @__PURE__ */ s(le, {
1951
+ var ar = (e) => /* @__PURE__ */ s(ne, {
1740
1952
  mine: !1,
1741
1953
  ...e,
1742
1954
  children: /* @__PURE__ */ s("span", {
@@ -1749,7 +1961,96 @@ var Gn = (e) => /* @__PURE__ */ s(le, {
1749
1961
  ]
1750
1962
  })
1751
1963
  });
1752
- function Nt({ config: e, look: t, onClick: n }) {
1964
+ function lr({ chat: e, onDark: t, look: n, config: r }) {
1965
+ const o = e.stopping;
1966
+ if (!o) return null;
1967
+ const { isGlass: i, accent: a, accentFill: u, accentText: d, rad: c } = n, f = i ? "#fff" : a, h = {
1968
+ padding: "5px 10px",
1969
+ borderRadius: c,
1970
+ fontSize: 11.5,
1971
+ fontWeight: 500,
1972
+ lineHeight: 1.3,
1973
+ opacity: o.busy ? 0.6 : 1
1974
+ };
1975
+ return /* @__PURE__ */ s(ne, {
1976
+ mine: !1,
1977
+ onDark: t,
1978
+ look: n,
1979
+ config: r,
1980
+ children: /* @__PURE__ */ s("div", {
1981
+ class: "uq-stop",
1982
+ style: {
1983
+ display: "flex",
1984
+ flexDirection: "column",
1985
+ gap: 8
1986
+ },
1987
+ children: [
1988
+ /* @__PURE__ */ s("span", {
1989
+ style: { fontWeight: 600 },
1990
+ children: "Stop the conversation?"
1991
+ }),
1992
+ /* @__PURE__ */ s("span", { children: "Do you want to stop this conversation?" }),
1993
+ /* @__PURE__ */ s("div", {
1994
+ style: {
1995
+ display: "flex",
1996
+ gap: 6,
1997
+ flexWrap: "wrap"
1998
+ },
1999
+ children: [/* @__PURE__ */ s("button", {
2000
+ type: "button",
2001
+ onClick: () => e.answerStop(!1),
2002
+ disabled: o.busy,
2003
+ style: {
2004
+ ...h,
2005
+ border: `1px solid ${f}`,
2006
+ color: f
2007
+ },
2008
+ children: "Keep chatting"
2009
+ }), /* @__PURE__ */ s("button", {
2010
+ type: "button",
2011
+ onClick: () => e.answerStop(!0),
2012
+ disabled: o.busy,
2013
+ style: {
2014
+ ...h,
2015
+ background: u,
2016
+ color: d
2017
+ },
2018
+ children: o.busy ? "Stopping…" : "Stop conversation"
2019
+ })]
2020
+ }),
2021
+ o.error && /* @__PURE__ */ s("span", {
2022
+ class: "uq-fade",
2023
+ style: { opacity: 0.7 },
2024
+ children: o.error
2025
+ })
2026
+ ]
2027
+ })
2028
+ });
2029
+ }
2030
+ function Xt({ config: e, look: t, onDark: n, chat: r, size: o }) {
2031
+ if (!r.sessionId) return null;
2032
+ const i = ce(n), a = !r.busy && !r.stopping;
2033
+ return /* @__PURE__ */ s("button", {
2034
+ type: "button",
2035
+ class: k(e, "stopButton"),
2036
+ onClick: r.askToStop,
2037
+ disabled: !a,
2038
+ "aria-label": "Stop conversation",
2039
+ style: {
2040
+ width: o,
2041
+ height: o,
2042
+ borderRadius: t.rad,
2043
+ color: t.isGlass ? "#fff" : `rgb(${i})`,
2044
+ opacity: a ? 0.55 : 0.3,
2045
+ display: "flex",
2046
+ alignItems: "center",
2047
+ justifyContent: "center",
2048
+ flexShrink: 0
2049
+ },
2050
+ children: /* @__PURE__ */ s(Xe, { size: o - 9 })
2051
+ });
2052
+ }
2053
+ function Jt({ config: e, look: t, onClick: n }) {
1753
2054
  var r;
1754
2055
  const o = !((r = e.cta) === null || r === void 0 || (r = r.href) === null || r === void 0) && r.trim() ? e.cta : null;
1755
2056
  return o ? /* @__PURE__ */ s("a", {
@@ -1772,111 +2073,127 @@ function Nt({ config: e, look: t, onClick: n }) {
1772
2073
  children: o.label || "Learn more"
1773
2074
  }) : null;
1774
2075
  }
1775
- function Ot({ config: e, look: t, onDark: n, hint: r, chat: o, disabled: i, focus: a }) {
1776
- const u = ye(n), { isGlass: d, accentFill: c, accentText: f, rad: p } = t, [l, h] = E(""), m = F(null);
2076
+ function Zt({ config: e, look: t, onDark: n, hint: r, chat: o, disabled: i, focus: a, withStop: u = !1 }) {
2077
+ const d = ce(n), { isGlass: c, accentFill: f, accentText: h, rad: l } = t, [p, m] = E(""), x = D(null);
1777
2078
  P(() => {
1778
- var _;
1779
- a > 0 && ((_ = m.current) === null || _ === void 0 || _.focus());
2079
+ var y;
2080
+ a > 0 && ((y = x.current) === null || y === void 0 || y.focus());
1780
2081
  }, [a]);
1781
- const y = (_) => {
1782
- _.preventDefault(), !i && (o.send(l), h(""));
1783
- }, w = d ? "rgba(255,255,255,.75)" : `rgba(${u},${n ? 0.6 : 0.45})`;
2082
+ const b = i || !!o.stopping, _ = (y) => {
2083
+ y.preventDefault(), !b && (o.send(p), m(""));
2084
+ }, g = c ? "rgba(255,255,255,.75)" : `rgba(${d},${n ? 0.6 : 0.45})`;
1784
2085
  return /* @__PURE__ */ s("form", {
1785
- class: S(e, "composer"),
1786
- onSubmit: y,
2086
+ class: k(e, "composer"),
2087
+ onSubmit: _,
1787
2088
  style: {
1788
2089
  display: "flex",
1789
2090
  alignItems: "center",
1790
2091
  gap: 8,
1791
2092
  padding: "7px 8px 7px 11px",
1792
- borderRadius: p,
1793
- border: d ? "1px solid rgba(255,255,255,.35)" : `1px solid rgba(${u},${n ? 0.28 : 0.12})`,
1794
- background: d ? "rgba(10,12,18,.3)" : `rgba(${u},${n ? 0.08 : 0.02})`,
1795
- backdropFilter: d || n ? "blur(6px)" : void 0
2093
+ borderRadius: l,
2094
+ border: c ? "1px solid rgba(255,255,255,.35)" : `1px solid rgba(${d},${n ? 0.28 : 0.12})`,
2095
+ background: c ? "rgba(10,12,18,.3)" : `rgba(${d},${n ? 0.08 : 0.02})`,
2096
+ backdropFilter: c || n ? "blur(6px)" : void 0
1796
2097
  },
1797
- children: [/* @__PURE__ */ s("input", {
1798
- ref: m,
1799
- type: "text",
1800
- value: l,
1801
- onInput: (_) => h(_.target.value),
1802
- placeholder: r || "Message…",
1803
- disabled: i,
1804
- maxLength: 4e3,
1805
- "aria-label": "Message",
1806
- autoComplete: "off",
1807
- style: {
1808
- flex: 1,
1809
- fontSize: 11.5,
1810
- color: d ? "#fff" : `rgb(${u})`,
1811
- "--uq-placeholder": w
1812
- }
1813
- }), o.busy ? /* @__PURE__ */ s("button", {
1814
- type: "button",
1815
- class: S(e, "sendButton"),
1816
- onClick: o.stop,
1817
- "aria-label": "Stop",
1818
- style: {
1819
- width: 24,
1820
- height: 24,
1821
- borderRadius: p,
1822
- background: c,
1823
- color: f,
1824
- display: "flex",
1825
- alignItems: "center",
1826
- justifyContent: "center",
1827
- flexShrink: 0
1828
- },
1829
- children: /* @__PURE__ */ s("span", { style: {
1830
- width: 8,
1831
- height: 8,
1832
- background: "currentColor",
1833
- borderRadius: 1
1834
- } })
1835
- }) : /* @__PURE__ */ s("button", {
1836
- type: "submit",
1837
- class: S(e, "sendButton"),
1838
- disabled: i,
1839
- "aria-label": "Send",
1840
- style: {
1841
- width: 24,
1842
- height: 24,
1843
- borderRadius: p,
1844
- background: c,
1845
- color: f,
1846
- display: "flex",
1847
- alignItems: "center",
1848
- justifyContent: "center",
1849
- flexShrink: 0,
1850
- opacity: i ? 0.5 : 1
1851
- },
1852
- children: /* @__PURE__ */ s(jt, { size: 13 })
1853
- })]
2098
+ children: [
2099
+ /* @__PURE__ */ s("input", {
2100
+ ref: x,
2101
+ type: "text",
2102
+ value: p,
2103
+ onInput: (y) => m(y.target.value),
2104
+ placeholder: r || "Message…",
2105
+ disabled: b,
2106
+ maxLength: 4e3,
2107
+ "aria-label": "Message",
2108
+ autoComplete: "off",
2109
+ style: {
2110
+ flex: 1,
2111
+ fontSize: 11.5,
2112
+ color: c ? "#fff" : `rgb(${d})`,
2113
+ "--uq-placeholder": g
2114
+ }
2115
+ }),
2116
+ u && /* @__PURE__ */ s(Xt, {
2117
+ config: e,
2118
+ look: t,
2119
+ onDark: n,
2120
+ chat: o,
2121
+ size: 24
2122
+ }),
2123
+ o.busy ? /* @__PURE__ */ s("button", {
2124
+ type: "button",
2125
+ class: k(e, "sendButton"),
2126
+ onClick: o.stop,
2127
+ "aria-label": "Stop",
2128
+ style: {
2129
+ width: 24,
2130
+ height: 24,
2131
+ borderRadius: l,
2132
+ background: f,
2133
+ color: h,
2134
+ display: "flex",
2135
+ alignItems: "center",
2136
+ justifyContent: "center",
2137
+ flexShrink: 0
2138
+ },
2139
+ children: /* @__PURE__ */ s("span", { style: {
2140
+ width: 8,
2141
+ height: 8,
2142
+ background: "currentColor",
2143
+ borderRadius: 1
2144
+ } })
2145
+ }) : /* @__PURE__ */ s("button", {
2146
+ type: "submit",
2147
+ class: k(e, "sendButton"),
2148
+ disabled: b,
2149
+ "aria-label": "Send",
2150
+ style: {
2151
+ width: 24,
2152
+ height: 24,
2153
+ borderRadius: l,
2154
+ background: f,
2155
+ color: h,
2156
+ display: "flex",
2157
+ alignItems: "center",
2158
+ justifyContent: "center",
2159
+ flexShrink: 0,
2160
+ opacity: b ? 0.5 : 1
2161
+ },
2162
+ children: /* @__PURE__ */ s(Ut, { size: 13 })
2163
+ })
2164
+ ]
1854
2165
  });
1855
2166
  }
1856
- function Ue({ welcome: e, chat: t, onDark: n, look: r, config: o }) {
1857
- const i = ye(n);
1858
- return /* @__PURE__ */ s(W, { children: [
1859
- /* @__PURE__ */ s(le, {
2167
+ function Qe({ welcome: e, chat: t, onDark: n, look: r, config: o }) {
2168
+ const i = ce(n);
2169
+ return /* @__PURE__ */ s(Y, { children: [
2170
+ /* @__PURE__ */ s(ne, {
1860
2171
  text: e,
1861
2172
  mine: !1,
1862
2173
  onDark: n,
1863
2174
  look: r,
1864
2175
  config: o
1865
2176
  }),
1866
- t.turns.map((a) => a.role === "user" ? /* @__PURE__ */ s(le, {
2177
+ t.turns.map((a) => a.role === "user" ? /* @__PURE__ */ s(ne, {
1867
2178
  text: a.parts[0],
1868
2179
  mine: !0,
1869
2180
  onDark: n,
1870
2181
  look: r,
1871
2182
  config: o
1872
- }, a.id) : a.parts.slice(0, a.shown).map((u, d) => /* @__PURE__ */ s(le, {
2183
+ }, a.id) : a.parts.slice(0, a.shown).map((u, d) => /* @__PURE__ */ s(ne, {
1873
2184
  text: u,
1874
2185
  mine: !1,
1875
2186
  onDark: n,
1876
2187
  look: r,
1877
2188
  config: o
1878
2189
  }, `${a.id}:${d}`))),
1879
- t.busy && /* @__PURE__ */ s(Gn, {
2190
+ /* @__PURE__ */ s(lr, {
2191
+ chat: t,
2192
+ onDark: n,
2193
+ look: r,
2194
+ config: o
2195
+ }),
2196
+ t.busy && /* @__PURE__ */ s(ar, {
1880
2197
  onDark: n,
1881
2198
  look: r,
1882
2199
  config: o
@@ -1904,39 +2221,43 @@ function Ue({ welcome: e, chat: t, onDark: n, look: r, config: o }) {
1904
2221
  })
1905
2222
  ] });
1906
2223
  }
1907
- function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus: a, onCta: u, fill: d = !1, onClose: c }) {
1908
- var f, p, l;
1909
- const { ink: h, surfaceBg: m, hostDark: y, accentFill: w, accentText: _, rad: g } = n, v = (f = (p = e.agent) === null || p === void 0 ? void 0 : p.name) !== null && f !== void 0 ? f : null, k = v ? v.trim().charAt(0).toUpperCase() : "A", x = Oe(t), q = we([
2224
+ function Pe({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus: a, onCta: u, fill: d = !1, height: c = K.panelHeight, maxHeight: f, onClose: h }) {
2225
+ var l, p, m;
2226
+ const { ink: x, surfaceBg: b, hostDark: _, accentFill: g, accentText: y, rad: $ } = n, q = (l = (p = e.agent) === null || p === void 0 ? void 0 : p.name) !== null && l !== void 0 ? l : null, z = q ? q.trim().charAt(0).toUpperCase() : "A", S = Je(t), C = qe([
1910
2227
  r.turns,
1911
2228
  r.busy,
1912
- r.error
1913
- ]), $ = !!(!((l = e.agent) === null || l === void 0) && l.live);
2229
+ r.error,
2230
+ r.stopping
2231
+ ]), w = !!(!((m = e.agent) === null || m === void 0) && m.live);
1914
2232
  return /* @__PURE__ */ s("div", {
1915
- class: S(t, "panel"),
2233
+ class: k(t, "panel"),
1916
2234
  style: {
1917
2235
  width: "100%",
1918
- borderRadius: d ? 0 : g,
2236
+ borderRadius: d ? 0 : $,
1919
2237
  overflow: "hidden",
1920
- border: d ? void 0 : `1px solid rgba(${h},.12)`,
2238
+ border: d ? void 0 : `1px solid rgba(${x},.12)`,
1921
2239
  boxShadow: o ? "0 18px 44px rgba(0,0,0,.16)" : void 0,
1922
- background: m,
2240
+ background: b,
2241
+ display: "flex",
2242
+ flexDirection: "column",
1923
2243
  ...d ? {
1924
2244
  flex: 1,
1925
- minHeight: 0,
1926
- display: "flex",
1927
- flexDirection: "column"
1928
- } : {}
2245
+ minHeight: 0
2246
+ } : {
2247
+ height: c,
2248
+ maxHeight: f
2249
+ }
1929
2250
  },
1930
2251
  children: [
1931
2252
  /* @__PURE__ */ s("div", {
1932
- class: S(t, "header"),
2253
+ class: k(t, "header"),
1933
2254
  style: {
1934
2255
  display: "flex",
1935
2256
  alignItems: "center",
1936
2257
  gap: 8,
1937
2258
  padding: "10px 12px",
1938
- background: w,
1939
- color: _
2259
+ background: g,
2260
+ color: y
1940
2261
  },
1941
2262
  children: [
1942
2263
  /* @__PURE__ */ s("span", {
@@ -1950,16 +2271,16 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1950
2271
  justifyContent: "center",
1951
2272
  fontSize: 10,
1952
2273
  fontWeight: 600,
1953
- color: _
2274
+ color: y
1954
2275
  },
1955
- children: k
2276
+ children: z
1956
2277
  }),
1957
2278
  /* @__PURE__ */ s("span", {
1958
2279
  style: {
1959
2280
  fontSize: 12,
1960
2281
  fontWeight: 500
1961
2282
  },
1962
- children: v ? v.split("—")[0].trim() : "Chat"
2283
+ children: q ? q.split("—")[0].trim() : "Chat"
1963
2284
  }),
1964
2285
  /* @__PURE__ */ s("span", {
1965
2286
  style: {
@@ -1967,12 +2288,32 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1967
2288
  fontSize: 10,
1968
2289
  opacity: 0.8
1969
2290
  },
1970
- children: $ ? "online" : "offline"
2291
+ children: w ? "online" : "offline"
1971
2292
  }),
1972
- c && /* @__PURE__ */ s("button", {
2293
+ r.sessionId && /* @__PURE__ */ s("button", {
1973
2294
  type: "button",
1974
- class: S(t, "close"),
1975
- onClick: c,
2295
+ class: k(t, "stopButton"),
2296
+ onClick: r.askToStop,
2297
+ disabled: r.busy || !!r.stopping,
2298
+ "aria-label": "Stop conversation",
2299
+ style: {
2300
+ width: 28,
2301
+ height: 28,
2302
+ marginRight: h ? 0 : -6,
2303
+ borderRadius: "50%",
2304
+ display: "flex",
2305
+ alignItems: "center",
2306
+ justifyContent: "center",
2307
+ color: y,
2308
+ opacity: r.busy || r.stopping ? 0.5 : 0.9,
2309
+ flexShrink: 0
2310
+ },
2311
+ children: /* @__PURE__ */ s(Xe, { size: 15 })
2312
+ }),
2313
+ h && /* @__PURE__ */ s("button", {
2314
+ type: "button",
2315
+ class: k(t, "close"),
2316
+ onClick: h,
1976
2317
  "aria-label": "Close chat",
1977
2318
  style: {
1978
2319
  width: 28,
@@ -1982,31 +2323,30 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
1982
2323
  display: "flex",
1983
2324
  alignItems: "center",
1984
2325
  justifyContent: "center",
1985
- color: _,
2326
+ color: y,
1986
2327
  flexShrink: 0
1987
2328
  },
1988
- children: /* @__PURE__ */ s(xe, { size: 16 })
2329
+ children: /* @__PURE__ */ s(Ce, { size: 16 })
1989
2330
  })
1990
2331
  ]
1991
2332
  }),
1992
2333
  /* @__PURE__ */ s("div", {
1993
- ref: q,
2334
+ ref: C,
1994
2335
  style: {
1995
2336
  display: "flex",
1996
2337
  flexDirection: "column",
1997
2338
  gap: 7,
1998
2339
  padding: 12,
1999
- background: m,
2000
- maxHeight: d ? void 0 : "min(58vh, 380px)",
2001
- flex: d ? 1 : void 0,
2002
- minHeight: d ? 0 : void 0,
2340
+ background: b,
2341
+ flex: 1,
2342
+ minHeight: 0,
2003
2343
  overflowY: "auto",
2004
2344
  overscrollBehavior: "contain"
2005
2345
  },
2006
- children: /* @__PURE__ */ s(Ue, {
2007
- welcome: x,
2346
+ children: /* @__PURE__ */ s(Qe, {
2347
+ welcome: S,
2008
2348
  chat: r,
2009
- onDark: y,
2349
+ onDark: _,
2010
2350
  look: n,
2011
2351
  config: t
2012
2352
  })
@@ -2017,84 +2357,86 @@ function Te({ payload: e, config: t, look: n, chat: r, shadow: o, hint: i, focus
2017
2357
  flexDirection: "column",
2018
2358
  gap: 8,
2019
2359
  padding: "0 12px 12px",
2020
- background: m
2360
+ background: b
2021
2361
  },
2022
- children: [/* @__PURE__ */ s(Nt, {
2362
+ children: [/* @__PURE__ */ s(Jt, {
2023
2363
  config: t,
2024
2364
  look: n,
2025
2365
  onClick: u
2026
- }), /* @__PURE__ */ s(Ot, {
2366
+ }), /* @__PURE__ */ s(Zt, {
2027
2367
  config: t,
2028
2368
  look: n,
2029
- onDark: y,
2369
+ onDark: _,
2030
2370
  hint: i,
2031
2371
  chat: r,
2032
- disabled: !$,
2372
+ disabled: !w,
2033
2373
  focus: a
2034
2374
  })]
2035
2375
  })
2036
2376
  ]
2037
2377
  });
2038
2378
  }
2039
- function Vn({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open: a, setOpen: u, pinned: d, focus: c }) {
2379
+ function cr({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open: a, setOpen: u, pinned: d, focus: c }) {
2040
2380
  var f;
2041
- const p = e.config, l = Wn(n, e, r, o), h = Lt(p), { accentFill: m, accentText: y, rad: w, side: _, offsetY: g } = t, v = Nn(), k = !!(!((f = e.agent) === null || f === void 0) && f.live), x = Oe(p), q = () => {
2042
- var z, H;
2381
+ const h = e.config, l = tr(n, e, r, o), p = Kt(h), { accentFill: m, accentText: x, rad: b, side: _, offsetY: g } = t, y = nr(), $ = !!(!((f = e.agent) === null || f === void 0) && f.live), q = Je(h), z = () => {
2382
+ var C, w;
2043
2383
  return i.report("cta.clicked", {
2044
2384
  widgetId: e.id,
2045
- sessionId: (z = l.sessionId) !== null && z !== void 0 ? z : void 0,
2046
- payload: { href: (H = p.cta) === null || H === void 0 ? void 0 : H.href }
2385
+ sessionId: (C = l.sessionId) !== null && C !== void 0 ? C : void 0,
2386
+ payload: { href: (w = h.cta) === null || w === void 0 ? void 0 : w.href }
2047
2387
  });
2048
2388
  };
2049
- if (t.isMessenger) return /* @__PURE__ */ s(Un, {
2389
+ if (t.isMessenger) return /* @__PURE__ */ s(sr, {
2050
2390
  payload: e,
2051
- config: p,
2391
+ config: h,
2052
2392
  look: t,
2053
2393
  chat: l,
2054
- mobile: v,
2394
+ mobile: y,
2055
2395
  focus: c,
2056
2396
  open: a,
2057
2397
  setOpen: u,
2058
2398
  pinned: d,
2059
- onCta: q
2399
+ onCta: z
2060
2400
  });
2061
- if (p.variant === "bubble")
2062
- return a && v ? /* @__PURE__ */ s(Dt, {
2401
+ if (h.variant === "bubble") {
2402
+ const C = g + K.launcherSize + K.panelGap;
2403
+ return a && y ? /* @__PURE__ */ s(Gt, {
2063
2404
  look: t,
2064
2405
  pinned: d,
2065
2406
  onClose: () => u(!1),
2066
- children: /* @__PURE__ */ s(Te, {
2407
+ children: /* @__PURE__ */ s(Pe, {
2067
2408
  payload: e,
2068
- config: p,
2409
+ config: h,
2069
2410
  look: t,
2070
2411
  chat: l,
2071
2412
  shadow: !1,
2072
- hint: h,
2413
+ hint: p,
2073
2414
  focus: c,
2074
- onCta: q,
2415
+ onCta: z,
2075
2416
  fill: !0,
2076
2417
  onClose: d ? void 0 : () => u(!1)
2077
2418
  })
2078
- }) : /* @__PURE__ */ s(W, { children: [a && /* @__PURE__ */ s("div", {
2419
+ }) : /* @__PURE__ */ s(Y, { children: [a && /* @__PURE__ */ s("div", {
2079
2420
  class: "uq-fixed uq-rise",
2080
2421
  style: {
2081
- bottom: g + 54,
2082
- width: 296,
2422
+ bottom: C,
2423
+ width: K.panelWidth,
2083
2424
  ..._
2084
2425
  },
2085
- children: /* @__PURE__ */ s(Te, {
2426
+ children: /* @__PURE__ */ s(Pe, {
2086
2427
  payload: e,
2087
- config: p,
2428
+ config: h,
2088
2429
  look: t,
2089
2430
  chat: l,
2090
2431
  shadow: !0,
2091
- hint: h,
2432
+ hint: p,
2092
2433
  focus: c,
2093
- onCta: q
2434
+ onCta: z,
2435
+ maxHeight: `calc(100vh - ${C + 12}px)`
2094
2436
  })
2095
2437
  }), /* @__PURE__ */ s("button", {
2096
2438
  type: "button",
2097
- class: S(p, "launcher", "uq-fixed"),
2439
+ class: k(h, "launcher", "uq-fixed"),
2098
2440
  "aria-label": a ? "Close chat" : "Open chat",
2099
2441
  "aria-expanded": a,
2100
2442
  onClick: () => {
@@ -2102,54 +2444,56 @@ function Vn({ payload: e, look: t, api: n, embed: r, page: o, reporter: i, open:
2102
2444
  },
2103
2445
  style: {
2104
2446
  bottom: g,
2105
- width: 44,
2106
- height: 44,
2107
- borderRadius: Math.min(22, w * 2),
2447
+ width: K.launcherSize,
2448
+ height: K.launcherSize,
2449
+ borderRadius: Math.min(K.launcherSize / 2, b * 2),
2108
2450
  background: m,
2109
- color: y,
2451
+ color: x,
2110
2452
  display: "flex",
2111
2453
  alignItems: "center",
2112
2454
  justifyContent: "center",
2113
2455
  boxShadow: "0 10px 26px rgba(0,0,0,.24)",
2114
2456
  ..._
2115
2457
  },
2116
- children: /* @__PURE__ */ s(Ft, { size: 20 })
2458
+ children: /* @__PURE__ */ s(Ot, { size: 20 })
2117
2459
  })] });
2118
- if (p.variant === "box") return /* @__PURE__ */ s("div", {
2460
+ }
2461
+ if (h.variant === "box") return /* @__PURE__ */ s("div", {
2119
2462
  class: "uq-inline",
2120
- children: /* @__PURE__ */ s(Te, {
2463
+ children: /* @__PURE__ */ s(Pe, {
2121
2464
  payload: e,
2122
- config: p,
2465
+ config: h,
2123
2466
  look: t,
2124
2467
  chat: l,
2125
2468
  shadow: !1,
2126
- hint: h,
2469
+ hint: p,
2127
2470
  focus: c,
2128
- onCta: q
2471
+ onCta: z
2129
2472
  })
2130
2473
  });
2131
- const $ = {
2474
+ const S = {
2132
2475
  payload: e,
2133
- config: p,
2476
+ config: h,
2134
2477
  look: t,
2135
2478
  chat: l,
2136
- hint: h,
2137
- mobile: v,
2479
+ hint: p,
2480
+ mobile: y,
2138
2481
  focus: c,
2139
- live: k,
2140
- welcome: x,
2141
- onCta: q
2482
+ live: $,
2483
+ welcome: q,
2484
+ onCta: z
2142
2485
  };
2143
- return p.variant === "chatbar" ? /* @__PURE__ */ s(Kn, { ...$ }) : /* @__PURE__ */ s(Xn, { ...$ });
2486
+ return h.variant === "chatbar" ? /* @__PURE__ */ s(ur, { ...S }) : /* @__PURE__ */ s(dr, { ...S });
2144
2487
  }
2145
- function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u }) {
2146
- const { ink: d, hostDark: c, accentFill: f, accentText: p, rad: l } = t, h = we([
2488
+ function ur({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u }) {
2489
+ const { ink: d, hostDark: c, accentFill: f, accentText: h, rad: l } = t, p = qe([
2147
2490
  n.turns,
2148
2491
  n.busy,
2149
- n.error
2150
- ]), m = n.turns.length > 0;
2492
+ n.error,
2493
+ n.stopping
2494
+ ]), m = n.turns.length > 0 || n.stopping !== null, x = !a || n.stopping !== null;
2151
2495
  return /* @__PURE__ */ s("div", {
2152
- class: S(e, "panel", "uq-fixed"),
2496
+ class: k(e, "panel", "uq-fixed"),
2153
2497
  style: {
2154
2498
  left: 0,
2155
2499
  right: 0,
@@ -2163,7 +2507,7 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2163
2507
  boxShadow: "0 -10px 30px rgba(0,0,0,.12)"
2164
2508
  },
2165
2509
  children: [m && /* @__PURE__ */ s("div", {
2166
- ref: h,
2510
+ ref: p,
2167
2511
  style: {
2168
2512
  display: "flex",
2169
2513
  flexDirection: "column",
@@ -2171,7 +2515,7 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2171
2515
  maxHeight: "min(50vh, 320px)",
2172
2516
  overflowY: "auto"
2173
2517
  },
2174
- children: /* @__PURE__ */ s(Ue, {
2518
+ children: /* @__PURE__ */ s(Qe, {
2175
2519
  welcome: u,
2176
2520
  chat: n,
2177
2521
  onDark: c,
@@ -2186,22 +2530,22 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2186
2530
  },
2187
2531
  children: [
2188
2532
  /* @__PURE__ */ s("span", {
2189
- class: S(e, "launcher"),
2533
+ class: k(e, "launcher"),
2190
2534
  style: {
2191
2535
  width: 26,
2192
2536
  height: 26,
2193
2537
  borderRadius: l,
2194
2538
  background: f,
2195
- color: p,
2539
+ color: h,
2196
2540
  display: "flex",
2197
2541
  alignItems: "center",
2198
2542
  justifyContent: "center",
2199
2543
  flexShrink: 0
2200
2544
  },
2201
- children: /* @__PURE__ */ s(Ft, { size: 14 })
2545
+ children: /* @__PURE__ */ s(Ot, { size: 14 })
2202
2546
  }),
2203
2547
  /* @__PURE__ */ s("span", {
2204
- class: S(e, "botMessage"),
2548
+ class: k(e, "botMessage"),
2205
2549
  style: {
2206
2550
  flex: 1,
2207
2551
  minWidth: 0,
@@ -2214,11 +2558,11 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2214
2558
  children: u
2215
2559
  }),
2216
2560
  /* @__PURE__ */ s("form", {
2217
- class: S(e, "composer"),
2218
- onSubmit: (y) => {
2219
- y.preventDefault();
2220
- const w = y.currentTarget.elements.namedItem("message");
2221
- !w || !a || (n.send(w.value), w.value = "");
2561
+ class: k(e, "composer"),
2562
+ onSubmit: (b) => {
2563
+ b.preventDefault();
2564
+ const _ = b.currentTarget.elements.namedItem("message");
2565
+ !_ || x || (n.send(_.value), _.value = "");
2222
2566
  },
2223
2567
  style: {
2224
2568
  display: "flex",
@@ -2230,62 +2574,73 @@ function Kn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2230
2574
  border: `1px solid rgba(${d},.14)`,
2231
2575
  minWidth: o ? 0 : 220
2232
2576
  },
2233
- children: [/* @__PURE__ */ s("input", {
2234
- name: "message",
2235
- type: "text",
2236
- placeholder: r,
2237
- disabled: !a,
2238
- maxLength: 4e3,
2239
- "aria-label": "Message",
2240
- autoComplete: "off",
2241
- ref: (y) => {
2242
- y && i > 0 && y.focus();
2243
- },
2244
- style: {
2245
- flex: 1,
2246
- fontSize: 11.5,
2247
- color: `rgb(${d})`,
2248
- "--uq-placeholder": `rgba(${d},.45)`
2249
- }
2250
- }), /* @__PURE__ */ s("button", {
2251
- type: n.busy ? "button" : "submit",
2252
- class: S(e, "sendButton"),
2253
- onClick: n.busy ? n.stop : void 0,
2254
- disabled: !a,
2255
- "aria-label": n.busy ? "Stop" : "Send",
2256
- style: {
2257
- width: 22,
2258
- height: 22,
2259
- borderRadius: l,
2260
- background: f,
2261
- color: p,
2262
- display: "flex",
2263
- alignItems: "center",
2264
- justifyContent: "center",
2265
- flexShrink: 0
2266
- },
2267
- children: n.busy ? /* @__PURE__ */ s("span", { style: {
2268
- width: 7,
2269
- height: 7,
2270
- background: "currentColor",
2271
- borderRadius: 1
2272
- } }) : /* @__PURE__ */ s(jt, { size: 12 })
2273
- })]
2577
+ children: [
2578
+ /* @__PURE__ */ s("input", {
2579
+ name: "message",
2580
+ type: "text",
2581
+ placeholder: r,
2582
+ disabled: x,
2583
+ maxLength: 4e3,
2584
+ "aria-label": "Message",
2585
+ autoComplete: "off",
2586
+ ref: (b) => {
2587
+ b && i > 0 && b.focus();
2588
+ },
2589
+ style: {
2590
+ flex: 1,
2591
+ fontSize: 11.5,
2592
+ color: `rgb(${d})`,
2593
+ "--uq-placeholder": `rgba(${d},.45)`
2594
+ }
2595
+ }),
2596
+ /* @__PURE__ */ s(Xt, {
2597
+ config: e,
2598
+ look: t,
2599
+ onDark: c,
2600
+ chat: n,
2601
+ size: 22
2602
+ }),
2603
+ /* @__PURE__ */ s("button", {
2604
+ type: n.busy ? "button" : "submit",
2605
+ class: k(e, "sendButton"),
2606
+ onClick: n.busy ? n.stop : void 0,
2607
+ disabled: x,
2608
+ "aria-label": n.busy ? "Stop" : "Send",
2609
+ style: {
2610
+ width: 22,
2611
+ height: 22,
2612
+ borderRadius: l,
2613
+ background: f,
2614
+ color: h,
2615
+ display: "flex",
2616
+ alignItems: "center",
2617
+ justifyContent: "center",
2618
+ flexShrink: 0
2619
+ },
2620
+ children: n.busy ? /* @__PURE__ */ s("span", { style: {
2621
+ width: 7,
2622
+ height: 7,
2623
+ background: "currentColor",
2624
+ borderRadius: 1
2625
+ } }) : /* @__PURE__ */ s(Ut, { size: 12 })
2626
+ })
2627
+ ]
2274
2628
  })
2275
2629
  ]
2276
2630
  })]
2277
2631
  });
2278
2632
  }
2279
- function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u, onCta: d }) {
2280
- const { hostDark: c, side: f, offsetY: p } = t, l = c, h = we([
2633
+ function dr({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a, welcome: u, onCta: d }) {
2634
+ const { hostDark: c, side: f, offsetY: h } = t, l = c, p = qe([
2281
2635
  n.turns,
2282
2636
  n.busy,
2283
- n.error
2637
+ n.error,
2638
+ n.stopping
2284
2639
  ]);
2285
2640
  return /* @__PURE__ */ s("div", {
2286
- class: S(e, "panel", "uq-fixed"),
2641
+ class: k(e, "panel", "uq-fixed"),
2287
2642
  style: {
2288
- bottom: p,
2643
+ bottom: h,
2289
2644
  width: o ? `calc(100% - ${e.appearance.offsetX * 2}px)` : 320,
2290
2645
  display: "flex",
2291
2646
  flexDirection: "column",
@@ -2294,7 +2649,7 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2294
2649
  },
2295
2650
  children: [
2296
2651
  /* @__PURE__ */ s("div", {
2297
- ref: h,
2652
+ ref: p,
2298
2653
  style: {
2299
2654
  display: "flex",
2300
2655
  flexDirection: "column",
@@ -2302,7 +2657,7 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2302
2657
  maxHeight: "min(60vh, 420px)",
2303
2658
  overflowY: "auto"
2304
2659
  },
2305
- children: /* @__PURE__ */ s(Ue, {
2660
+ children: /* @__PURE__ */ s(Qe, {
2306
2661
  welcome: u,
2307
2662
  chat: n,
2308
2663
  onDark: l,
@@ -2310,30 +2665,31 @@ function Xn({ config: e, look: t, chat: n, hint: r, mobile: o, focus: i, live: a
2310
2665
  config: e
2311
2666
  })
2312
2667
  }),
2313
- /* @__PURE__ */ s(Nt, {
2668
+ /* @__PURE__ */ s(Jt, {
2314
2669
  config: e,
2315
2670
  look: t,
2316
2671
  onClick: d
2317
2672
  }),
2318
- /* @__PURE__ */ s(Ot, {
2673
+ /* @__PURE__ */ s(Zt, {
2319
2674
  config: e,
2320
2675
  look: t,
2321
2676
  onDark: l,
2322
2677
  hint: r,
2323
2678
  chat: n,
2324
2679
  disabled: !a,
2325
- focus: i
2680
+ focus: i,
2681
+ withStop: !0
2326
2682
  })
2327
2683
  ]
2328
2684
  });
2329
2685
  }
2330
- var Jn = (e) => /^https?:\/\//i.test(e);
2331
- function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2686
+ var fr = (e) => /^https?:\/\//i.test(e);
2687
+ function pr({ config: e, block: t, index: n, look: r, onCta: o }) {
2332
2688
  const { ink: i, accent: a, accentFill: u, accentText: d, rad: c } = r, f = [
2333
2689
  "uq-block",
2334
2690
  `uq-block-${t.kind}`,
2335
2691
  t.cssClass.trim()
2336
- ].filter(Boolean).join(" "), p = "align" in t ? t.align : "center", l = {
2692
+ ].filter(Boolean).join(" "), h = "align" in t ? t.align : "center", l = {
2337
2693
  class: f,
2338
2694
  "data-uq-block": n
2339
2695
  };
@@ -2346,7 +2702,7 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2346
2702
  fontSize: t.size === "lg" ? 21 : t.size === "sm" ? 15 : 18,
2347
2703
  fontWeight: 600,
2348
2704
  letterSpacing: "-0.02em",
2349
- textAlign: p,
2705
+ textAlign: h,
2350
2706
  color: t.color || `rgb(${i})`
2351
2707
  },
2352
2708
  children: t.text
@@ -2357,14 +2713,14 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2357
2713
  style: {
2358
2714
  fontSize: 12.5,
2359
2715
  lineHeight: 1.5,
2360
- textAlign: p,
2716
+ textAlign: h,
2361
2717
  color: t.color || `rgba(${i},.65)`,
2362
2718
  whiteSpace: "pre-wrap"
2363
2719
  },
2364
2720
  children: t.text
2365
2721
  });
2366
2722
  case "media":
2367
- return !t.src || !Jn(t.src) ? null : t.mediaType === "video" ? /* @__PURE__ */ s("video", {
2723
+ return !t.src || !fr(t.src) ? null : t.mediaType === "video" ? /* @__PURE__ */ s("video", {
2368
2724
  ...l,
2369
2725
  src: t.src,
2370
2726
  muted: !0,
@@ -2416,7 +2772,7 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2416
2772
  case "cta":
2417
2773
  return /* @__PURE__ */ s("a", {
2418
2774
  ...l,
2419
- class: `${S(e, "cta")} ${f}`,
2775
+ class: `${k(e, "cta")} ${f}`,
2420
2776
  href: t.href || "#",
2421
2777
  target: t.newTab ? "_blank" : void 0,
2422
2778
  rel: t.newTab ? "noopener noreferrer" : void 0,
@@ -2437,17 +2793,17 @@ function Zn({ config: e, block: t, index: n, look: r, onCta: o }) {
2437
2793
  });
2438
2794
  }
2439
2795
  }
2440
- function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
2796
+ function hr({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }) {
2441
2797
  const a = e.config, { ink: u, surfaceBg: d, rad: c } = t;
2442
2798
  if (!r) return null;
2443
2799
  const f = () => {
2444
2800
  i || o(!1);
2445
- }, p = (l) => n.report("cta.clicked", {
2801
+ }, h = (l) => n.report("cta.clicked", {
2446
2802
  widgetId: e.id,
2447
2803
  payload: { href: l }
2448
2804
  });
2449
2805
  return /* @__PURE__ */ s("div", {
2450
- class: S(a, "scrim", "uq-fixed uq-fade"),
2806
+ class: k(a, "scrim", "uq-fixed uq-fade"),
2451
2807
  onClick: f,
2452
2808
  style: {
2453
2809
  inset: 0,
@@ -2458,7 +2814,7 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2458
2814
  padding: 24
2459
2815
  },
2460
2816
  children: /* @__PURE__ */ s("div", {
2461
- class: S(a, "card", "uq-rise"),
2817
+ class: k(a, "card", "uq-rise"),
2462
2818
  role: "dialog",
2463
2819
  "aria-modal": "true",
2464
2820
  onClick: (l) => l.stopPropagation(),
@@ -2480,7 +2836,7 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2480
2836
  },
2481
2837
  children: [!i && /* @__PURE__ */ s("button", {
2482
2838
  type: "button",
2483
- class: S(a, "close"),
2839
+ class: k(a, "close"),
2484
2840
  onClick: f,
2485
2841
  "aria-label": "Close",
2486
2842
  style: {
@@ -2495,26 +2851,26 @@ function Qn({ payload: e, look: t, reporter: n, open: r, setOpen: o, pinned: i }
2495
2851
  justifyContent: "center",
2496
2852
  color: `rgba(${u},.55)`
2497
2853
  },
2498
- children: /* @__PURE__ */ s(xe, { size: 14 })
2499
- }), a.blocks.map((l, h) => /* @__PURE__ */ s(Zn, {
2854
+ children: /* @__PURE__ */ s(Ce, { size: 14 })
2855
+ }), a.blocks.map((l, p) => /* @__PURE__ */ s(pr, {
2500
2856
  config: a,
2501
2857
  block: l,
2502
- index: h,
2858
+ index: p,
2503
2859
  look: t,
2504
- onCta: p
2505
- }, h))]
2860
+ onCta: h
2861
+ }, p))]
2506
2862
  })
2507
2863
  });
2508
2864
  }
2509
- var er = 3600;
2510
- function tr({ payload: e, look: t, open: n }) {
2865
+ var _r = 3600;
2866
+ function gr({ payload: e, look: t, open: n }) {
2511
2867
  const r = e.config, { ink: o, accent: i, surfaceBg: a, rad: u } = t, d = r.quotes, [c, f] = E(0);
2512
2868
  if (P(() => {
2513
2869
  if (d.length < 2) return;
2514
- const h = window.setInterval(() => f((m) => m + 1), er);
2515
- return () => window.clearInterval(h);
2870
+ const p = window.setInterval(() => f((m) => m + 1), _r);
2871
+ return () => window.clearInterval(p);
2516
2872
  }, [d.length]), !n || d.length === 0) return null;
2517
- const p = c % d.length, l = d[p];
2873
+ const h = c % d.length, l = d[h];
2518
2874
  return /* @__PURE__ */ s("div", {
2519
2875
  class: "uq-fixed uq-fade",
2520
2876
  style: {
@@ -2527,7 +2883,7 @@ function tr({ payload: e, look: t, open: n }) {
2527
2883
  pointerEvents: "none"
2528
2884
  },
2529
2885
  children: /* @__PURE__ */ s("figure", {
2530
- class: S(r, "frame"),
2886
+ class: k(r, "frame"),
2531
2887
  style: {
2532
2888
  width: "100%",
2533
2889
  maxWidth: 440,
@@ -2543,7 +2899,7 @@ function tr({ payload: e, look: t, open: n }) {
2543
2899
  pointerEvents: "auto"
2544
2900
  },
2545
2901
  children: [/* @__PURE__ */ s("blockquote", {
2546
- class: S(r, "quote", "uq-fade"),
2902
+ class: k(r, "quote", "uq-fade"),
2547
2903
  style: {
2548
2904
  fontSize: 13.5,
2549
2905
  lineHeight: 1.55,
@@ -2554,14 +2910,14 @@ function tr({ payload: e, look: t, open: n }) {
2554
2910
  l.text || "…",
2555
2911
  "”"
2556
2912
  ]
2557
- }, p), /* @__PURE__ */ s("figcaption", {
2913
+ }, h), /* @__PURE__ */ s("figcaption", {
2558
2914
  style: {
2559
2915
  display: "flex",
2560
2916
  alignItems: "center",
2561
2917
  gap: 10
2562
2918
  },
2563
2919
  children: [/* @__PURE__ */ s("span", {
2564
- class: S(r, "author"),
2920
+ class: k(r, "author"),
2565
2921
  style: {
2566
2922
  fontFamily: "monospace",
2567
2923
  fontSize: 11,
@@ -2569,24 +2925,24 @@ function tr({ payload: e, look: t, open: n }) {
2569
2925
  },
2570
2926
  children: l.author || "—"
2571
2927
  }), /* @__PURE__ */ s("span", {
2572
- class: S(r, "dots"),
2928
+ class: k(r, "dots"),
2573
2929
  style: {
2574
2930
  marginLeft: "auto",
2575
2931
  display: "flex",
2576
2932
  gap: 4
2577
2933
  },
2578
- children: d.map((h, m) => /* @__PURE__ */ s("span", { style: {
2934
+ children: d.map((p, m) => /* @__PURE__ */ s("span", { style: {
2579
2935
  width: 5,
2580
2936
  height: 5,
2581
2937
  borderRadius: "50%",
2582
- background: m === p ? i : `rgba(${o},.18)`
2938
+ background: m === h ? i : `rgba(${o},.18)`
2583
2939
  } }, m))
2584
2940
  })]
2585
2941
  })]
2586
2942
  })
2587
2943
  });
2588
2944
  }
2589
- function nr(e) {
2945
+ function mr(e) {
2590
2946
  switch (e.config.type) {
2591
2947
  case "chat":
2592
2948
  case "exit-popup":
@@ -2596,7 +2952,7 @@ function nr(e) {
2596
2952
  return !0;
2597
2953
  }
2598
2954
  }
2599
- function rr(e) {
2955
+ function br(e) {
2600
2956
  return e.rules.length > 0 || e.config.type !== "exit-popup" ? e.rules : [{
2601
2957
  id: `default:${e.id}`,
2602
2958
  trigger: "exit_intent",
@@ -2610,47 +2966,47 @@ function rr(e) {
2610
2966
  }
2611
2967
  }];
2612
2968
  }
2613
- function Yt({ payload: e, api: t, embed: n, page: r, reporter: o, hostDark: i, kick: a = null }) {
2614
- const u = he(() => An(e.config, i), [e, i]), d = he(() => rr(e), [e]), [c, f] = E(d.length === 0), [p, l] = E(() => d.length === 0 && nr(e)), [h, m] = E(!1), [y, w] = E(0), _ = F(p), g = (x) => {
2615
- l(x), x !== _.current && (_.current = x, o.report(x ? "surface.opened" : "surface.closed", { widgetId: e.id }));
2616
- }, v = ({ autoStart: x, pinned: q }) => {
2617
- f(!0), m(q), g(!0), x && w(($) => $ + 1);
2969
+ function Qt({ payload: e, api: t, embed: n, page: r, reporter: o, hostDark: i, kick: a = null }) {
2970
+ const u = ye(() => Dn(e.config, i), [e, i]), d = ye(() => br(e), [e]), [c, f] = E(d.length === 0), [h, l] = E(() => d.length === 0 && mr(e)), [p, m] = E(!1), [x, b] = E(0), _ = D(h), g = (q) => {
2971
+ l(q), q !== _.current && (_.current = q, o.report(q ? "surface.opened" : "surface.closed", { widgetId: e.id }));
2972
+ }, y = ({ autoStart: q, pinned: z }) => {
2973
+ f(!0), m(z), g(!0), q && b((S) => S + 1);
2618
2974
  };
2619
- if (P(() => zt(d, r, (x) => {
2975
+ if (P(() => Dt(d, r, (q) => {
2620
2976
  o.report("rule.fired", {
2621
2977
  widgetId: e.id,
2622
2978
  payload: {
2623
- ruleId: x.id,
2624
- trigger: x.trigger
2979
+ ruleId: q.id,
2980
+ trigger: q.trigger
2625
2981
  }
2626
- }), v(x.actionConfig);
2982
+ }), y(q.actionConfig);
2627
2983
  }), [e.id]), P(() => {
2628
- a && v(a.action);
2984
+ a && y(a.action);
2629
2985
  }, [a]), !c) return null;
2630
- const k = {
2986
+ const $ = {
2631
2987
  payload: e,
2632
2988
  look: u,
2633
2989
  api: t,
2634
2990
  embed: n,
2635
2991
  page: r,
2636
2992
  reporter: o,
2637
- open: p,
2993
+ open: h,
2638
2994
  setOpen: g,
2639
- pinned: h,
2640
- focus: y
2995
+ pinned: p,
2996
+ focus: x
2641
2997
  };
2642
2998
  switch (e.config.type) {
2643
2999
  case "chat":
2644
- return /* @__PURE__ */ s(Vn, { ...k });
3000
+ return /* @__PURE__ */ s(cr, { ...$ });
2645
3001
  case "exit-popup":
2646
- return /* @__PURE__ */ s(Qn, { ...k });
3002
+ return /* @__PURE__ */ s(hr, { ...$ });
2647
3003
  case "banner":
2648
- return /* @__PURE__ */ s(Dn, { ...k });
3004
+ return /* @__PURE__ */ s(Vn, { ...$ });
2649
3005
  case "testimonial":
2650
- return /* @__PURE__ */ s(tr, { ...k });
3006
+ return /* @__PURE__ */ s(gr, { ...$ });
2651
3007
  }
2652
3008
  }
2653
- function ir(e) {
3009
+ function vr(e) {
2654
3010
  const t = [], n = e.config.appearance.customCss.trim();
2655
3011
  return n && t.push(n), e.config.type === "exit-popup" && e.config.blocks.forEach((r, o) => {
2656
3012
  const i = r.css.trim();
@@ -2658,18 +3014,18 @@ function ir(e) {
2658
3014
  }), t.join(`
2659
3015
  `);
2660
3016
  }
2661
- function or(e) {
3017
+ function yr(e) {
2662
3018
  return e.kind === "widget" ? [e.payload] : e.payload.members.map((t) => t.widget);
2663
3019
  }
2664
- var ar = {
3020
+ var xr = {
2665
3021
  report: () => {
2666
3022
  },
2667
3023
  flush: () => {
2668
3024
  }
2669
3025
  };
2670
- function sr({ group: e, ...t }) {
2671
- const [n, r] = E(e.rules.length === 0), [o, i] = E(null), [a, u] = E(() => Cn(e));
2672
- return P(() => zt(e.rules, t.page, (d) => {
3026
+ function wr({ group: e, ...t }) {
3027
+ const [n, r] = E(e.rules.length === 0), [o, i] = E(null), [a, u] = E(() => En(e));
3028
+ return P(() => Dt(e.rules, t.page, (d) => {
2673
3029
  t.reporter.report("rule.fired", { payload: {
2674
3030
  ruleId: d.id,
2675
3031
  trigger: d.trigger
@@ -2682,89 +3038,89 @@ function sr({ group: e, ...t }) {
2682
3038
  });
2683
3039
  }), [e.id]), P(() => {
2684
3040
  if (e.mode !== "sequence" || !n) return;
2685
- const d = Rt(e);
3041
+ const d = Lt(e);
2686
3042
  if (d)
2687
- return $n(e, d, (c) => u(c ? [c.widget] : []));
3043
+ return Rn(e, d, (c) => u(c ? [c.widget] : []));
2688
3044
  }, [
2689
3045
  e.id,
2690
3046
  e.mode,
2691
3047
  n,
2692
3048
  a
2693
- ]), n ? /* @__PURE__ */ s(W, { children: a.map((d) => /* @__PURE__ */ s("div", {
3049
+ ]), n ? /* @__PURE__ */ s(Y, { children: a.map((d) => /* @__PURE__ */ s("div", {
2694
3050
  "data-uq-widget": d.id,
2695
3051
  style: "display:contents",
2696
- children: /* @__PURE__ */ s(Yt, {
3052
+ children: /* @__PURE__ */ s(Qt, {
2697
3053
  payload: d,
2698
3054
  kick: o,
2699
3055
  ...t
2700
3056
  })
2701
3057
  }, d.id)) }) : null;
2702
3058
  }
2703
- function lr({ snapshot: e, ...t }) {
3059
+ function Sr({ snapshot: e, ...t }) {
2704
3060
  const n = {
2705
3061
  kind: e.kind,
2706
3062
  id: e.payload.id
2707
3063
  };
2708
- return e.kind === "group" ? /* @__PURE__ */ s(sr, {
3064
+ return e.kind === "group" ? /* @__PURE__ */ s(wr, {
2709
3065
  group: e.payload,
2710
3066
  embed: n,
2711
3067
  ...t
2712
3068
  }) : /* @__PURE__ */ s("div", {
2713
3069
  "data-uq-widget": e.payload.id,
2714
3070
  style: "display:contents",
2715
- children: /* @__PURE__ */ s(Yt, {
3071
+ children: /* @__PURE__ */ s(Qt, {
2716
3072
  payload: e.payload,
2717
3073
  embed: n,
2718
3074
  ...t
2719
3075
  })
2720
3076
  });
2721
3077
  }
2722
- function cr(e, t, n = {}) {
3078
+ function kr(e, t, n = {}) {
2723
3079
  var r, o, i;
2724
3080
  const a = (r = t.shadowRoot) !== null && r !== void 0 ? r : t.attachShadow({ mode: "open" }), u = { base: ((o = n.apiUrl) !== null && o !== void 0 ? o : "https://api.usereq.com").replace(/\/+$/, "") }, d = {
2725
3081
  kind: e.kind,
2726
3082
  id: e.payload.id
2727
- }, c = n.silent ? ar : yn(u, d), f = qn((i = n.theme) !== null && i !== void 0 ? i : null), p = Mn(), l = document.createElement("style");
3083
+ }, c = n.silent ? xr : Tn(u, d), f = Pn((i = n.theme) !== null && i !== void 0 ? i : null), h = jn(), l = document.createElement("style");
2728
3084
  a.appendChild(l);
2729
- const h = document.createElement("div");
2730
- h.setAttribute("data-uq-root", ""), h.style.display = "contents", a.appendChild(h);
2731
- const m = (y) => {
2732
- l.textContent = [gn, ...or(y).map(ir)].join(`
2733
- `), Ze(/* @__PURE__ */ s(lr, {
2734
- snapshot: y,
3085
+ const p = document.createElement("div");
3086
+ p.setAttribute("data-uq-root", ""), p.style.display = "contents", a.appendChild(p);
3087
+ const m = (x) => {
3088
+ l.textContent = [$n, ...yr(x).map(vr)].join(`
3089
+ `), ot(/* @__PURE__ */ s(Sr, {
3090
+ snapshot: x,
2735
3091
  api: u,
2736
- page: p,
3092
+ page: h,
2737
3093
  reporter: c,
2738
3094
  hostDark: f
2739
- }), h);
3095
+ }), p);
2740
3096
  };
2741
3097
  return m(e), c.report("embed.loaded", { payload: { version: e.payload.version } }), {
2742
3098
  update: m,
2743
3099
  unmount: () => {
2744
- Ze(null, h), c.flush(), l.remove(), h.remove();
3100
+ ot(null, p), c.flush(), l.remove(), p.remove();
2745
3101
  }
2746
3102
  };
2747
3103
  }
2748
- function Ut(e, t) {
3104
+ function en(e, t) {
2749
3105
  if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2750
3106
  }
2751
- function ur(e, t) {
2752
- Ut(e, t), t.add(e);
3107
+ function $r(e, t) {
3108
+ en(e, t), t.add(e);
2753
3109
  }
2754
- function ht(e, t, n) {
2755
- Ut(e, t), t.set(e, n);
3110
+ function vt(e, t, n) {
3111
+ en(e, t), t.set(e, n);
2756
3112
  }
2757
- function pe(e, t, n) {
3113
+ function we(e, t, n) {
2758
3114
  if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2759
3115
  throw new TypeError("Private element is not present on this object");
2760
3116
  }
2761
- function ne(e, t) {
2762
- return e.get(pe(e, t));
3117
+ function de(e, t) {
3118
+ return e.get(we(e, t));
2763
3119
  }
2764
- function re(e, t, n) {
2765
- return e.set(pe(e, t), n), n;
3120
+ function fe(e, t, n) {
3121
+ return e.set(we(e, t), n), n;
2766
3122
  }
2767
- var dr = {
3123
+ var Cr = {
2768
3124
  widget: {
2769
3125
  element: "usereq-widget",
2770
3126
  attribute: "widget-id"
@@ -2774,66 +3130,66 @@ var dr = {
2774
3130
  attribute: "group-id"
2775
3131
  }
2776
3132
  };
2777
- function Ae(e) {
3133
+ function Fe(e) {
2778
3134
  console.warn(`[usereq] ${e}`);
2779
3135
  }
2780
- function pt(e) {
2781
- const { element: t, attribute: n } = dr[e];
3136
+ function yt(e) {
3137
+ const { element: t, attribute: n } = Cr[e];
2782
3138
  if (customElements.get(t)) return;
2783
3139
  var r = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakSet();
2784
3140
  class a extends HTMLElement {
2785
3141
  constructor(...c) {
2786
- super(...c), ur(this, i), ht(this, r, null), ht(this, o, 0);
3142
+ super(...c), $r(this, i), vt(this, r, null), vt(this, o, 0);
2787
3143
  }
2788
3144
  connectedCallback() {
2789
- pe(i, this, u).call(this);
3145
+ we(i, this, u).call(this);
2790
3146
  }
2791
3147
  disconnectedCallback() {
2792
3148
  var c;
2793
- (c = ne(r, this)) === null || c === void 0 || c.unmount(), re(r, this, null);
3149
+ (c = de(r, this)) === null || c === void 0 || c.unmount(), fe(r, this, null);
2794
3150
  }
2795
- attributeChangedCallback(c, f, p) {
2796
- f !== p && this.isConnected && pe(i, this, u).call(this);
3151
+ attributeChangedCallback(c, f, h) {
3152
+ f !== h && this.isConnected && we(i, this, u).call(this);
2797
3153
  }
2798
3154
  }
2799
3155
  async function u() {
2800
- var d, c, f, p;
3156
+ var d, c, f, h;
2801
3157
  const l = (d = this.getAttribute(n)) === null || d === void 0 ? void 0 : d.trim();
2802
3158
  if (!l) return;
2803
- const h = re(o, this, (c = ne(o, this), ++c));
2804
- (f = ne(r, this)) === null || f === void 0 || f.unmount(), re(r, this, null);
2805
- const m = ((p = this.getAttribute("api-url")) !== null && p !== void 0 ? p : "https://api.usereq.com").replace(/\/+$/, ""), y = this.getAttribute("theme"), w = y === "light" || y === "dark" ? y : null;
3159
+ const p = fe(o, this, (c = de(o, this), ++c));
3160
+ (f = de(r, this)) === null || f === void 0 || f.unmount(), fe(r, this, null);
3161
+ const m = ((h = this.getAttribute("api-url")) !== null && h !== void 0 ? h : "https://api.usereq.com").replace(/\/+$/, ""), x = this.getAttribute("theme"), b = x === "light" || x === "dark" ? x : null;
2806
3162
  let _;
2807
3163
  try {
2808
- const g = await Jt({ base: m }, e, l);
2809
- _ = nn(g, e);
3164
+ const g = await on({ base: m }, e, l);
3165
+ _ = fn(g, e);
2810
3166
  } catch (g) {
2811
- g instanceof ce ? Ae(`${t} ${l}: ${g.message} (${g.code})`) : Ae(`${t} ${l}: could not reach ${m}.`);
3167
+ g instanceof V ? Fe(`${t} ${l}: ${g.message} (${g.code})`) : Fe(`${t} ${l}: could not reach ${m}.`);
2812
3168
  return;
2813
3169
  }
2814
- if (!(h !== ne(o, this) || !this.isConnected)) {
3170
+ if (!(p !== de(o, this) || !this.isConnected)) {
2815
3171
  if (!_) {
2816
- Ae(`${t} ${l}: the response was not a ${e} snapshot.`);
3172
+ Fe(`${t} ${l}: the response was not a ${e} snapshot.`);
2817
3173
  return;
2818
3174
  }
2819
- re(r, this, cr(_, this, {
3175
+ fe(r, this, kr(_, this, {
2820
3176
  apiUrl: m,
2821
- theme: w
3177
+ theme: b
2822
3178
  }));
2823
3179
  }
2824
3180
  }
2825
- Ee(a, "observedAttributes", [
3181
+ je(a, "observedAttributes", [
2826
3182
  n,
2827
3183
  "api-url",
2828
3184
  "theme"
2829
3185
  ]), customElements.define(t, a);
2830
3186
  }
2831
- function fr() {
2832
- pt("widget"), pt("group");
3187
+ function qr() {
3188
+ yt("widget"), yt("group");
2833
3189
  }
2834
- fr();
3190
+ qr();
2835
3191
  export {
2836
- cr as render
3192
+ kr as render
2837
3193
  };
2838
3194
 
2839
3195
  //# sourceMappingURL=embed.mjs.map